Skip to content

Commit 7fcb119

Browse files
authored
Merge pull request #97567 from mschofie/user/mschofie/coarse-reloc-api-fix
Remove usage of the deprecated 'ASACreateFactory' call
2 parents f7cd8f8 + 9cbf161 commit 7fcb119

File tree

2 files changed

+7
-15
lines changed

2 files changed

+7
-15
lines changed

articles/spatial-anchors/concepts/coarse-reloc.md

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,8 @@ cloudSpatialAnchorSession->LocationProvider(sensorProvider);
102102
103103
# [C++ WinRT](#tab/cppwinrt)
104104
```cpp
105-
// Create the ASA factory
106-
SpatialAnchorsFactory m_asaFactory { nullptr };
107-
// . . .
108-
109105
// Create the sensor fingerprint provider
110-
PlatformLocationProvider sensorProvider;
111-
sensorProvider = m_asaFactory.CreatePlatformLocationProvider();
106+
PlatformLocationProvider sensorProvider = PlatformLocationProvider();
112107
113108
// Create and configure the session
114109
cloudSpatialAnchorSession = CloudSpatialAnchorSession();
@@ -576,7 +571,7 @@ anchorLocateCriteria->NearDevice(nearDeviceCriteria);
576571
# [C++ WinRT](#tab/cppwinrt)
577572
578573
```cpp
579-
NearDeviceCriteria nearDeviceCriteria = m_asaFactory.CreateNearDeviceCriteria();
574+
NearDeviceCriteria nearDeviceCriteria = NearDeviceCriteria();
580575
581576
// Choose a maximum exploration distance between your device and the returned anchors
582577
nearDeviceCriteria.DistanceInMeters(5.0f);
@@ -585,7 +580,7 @@ nearDeviceCriteria.DistanceInMeters(5.0f);
585580
nearDeviceCriteria.MaxResultCount(25);
586581
587582
// Set the session's locate criteria
588-
anchorLocateCriteria = m_asaFactory.CreateAnchorLocateCriteria();
583+
anchorLocateCriteria = AnchorLocateCriteria();
589584
anchorLocateCriteria.NearDevice(nearDeviceCriteria);
590585
```
591586

articles/spatial-anchors/how-tos/create-locate-anchors-cpp-winrt.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,9 @@ To complete this guide, make sure you have:
4040
Learn more about the [CloudSpatialAnchorSession](https://docs.microsoft.com/cpp/api/spatial-anchors/winrt/cloudspatialanchorsession) class.
4141

4242
```cpp
43-
SpatialAnchorsFactory m_asafactory{ nullptr };
4443
CloudSpatialAnchorSession m_cloudSession{ nullptr };
45-
winrt::com_ptr<::IUnknown> unk;
46-
winrt::check_hresult(ASACreateFactory(unk.put()));
47-
m_asafactory = unk.as<SpatialAnchorsFactory>();
48-
m_cloudSession = m_asafactory.CreateCloudSpatialAnchorSession();
44+
45+
m_cloudSession = CloudSpatialAnchorSession();
4946
```
5047
5148
[!INCLUDE [Account Keys](../../../includes/spatial-anchors-create-locate-anchors-account-keys.md)]
@@ -173,7 +170,7 @@ Learn more about the [CloudSpatialAnchor](https://docs.microsoft.com/cpp/api/spa
173170
// If the user is placing some application content in their environment,
174171
// you might show content at this anchor for a while, then save when
175172
// the user confirms placement.
176-
CloudSpatialAnchor cloudAnchor = m_asafactory.CreateCloudSpatialAnchor();
173+
CloudSpatialAnchor cloudAnchor = CloudSpatialAnchor();
177174
cloudAnchor.LocalAnchor(localAnchor);
178175
co_await m_cloudSession.CreateAnchorAsync(cloudAnchor);
179176
m_feedback = LR"(Created a cloud anchor with ID=)" + cloudAnchor.Identifier();
@@ -194,7 +191,7 @@ Learn more about the [GetSessionStatusAsync](https://docs.microsoft.com/cpp/api/
194191
Learn more about the [AppProperties](https://docs.microsoft.com/cpp/api/spatial-anchors/winrt/cloudspatialanchor#appproperties) method.
195192

196193
```cpp
197-
CloudSpatialAnchor cloudAnchor = m_asafactory.CreateCloudSpatialAnchor();
194+
CloudSpatialAnchor cloudAnchor = CloudSpatialAnchor();
198195
cloudAnchor.LocalAnchor(localAnchor);
199196
auto properties = m_cloudAnchor.AppProperties();
200197
properties.Insert(LR"(model-type)", LR"(frame)");

0 commit comments

Comments
 (0)