@@ -209,7 +209,7 @@ void UCesiumITwinAPIGetIModelsAsyncAction::Activate() {
209209 LogCesium,
210210 Warning,
211211 TEXT (
212- " Get itwins finished but get itwins async action is no longer valid." ));
212+ " Get imodels finished but get imodels async action is no longer valid." ));
213213 return ;
214214 }
215215
@@ -233,3 +233,184 @@ void UCesiumITwinAPIGetIModelsAsyncAction::Activate() {
233233 }
234234 });
235235}
236+
237+ UCesiumITwinAPIGetIModelMeshExportsAsyncAction*
238+ UCesiumITwinAPIGetIModelMeshExportsAsyncAction::GetIModelMeshExports (
239+ UCesiumITwinConnection* pConnection,
240+ const FString& iModelId,
241+ int Page) {
242+ UCesiumITwinAPIGetIModelMeshExportsAsyncAction* pAsyncAction =
243+ NewObject<UCesiumITwinAPIGetIModelMeshExportsAsyncAction>();
244+ pAsyncAction->pConnection = pConnection->pConnection ;
245+ pAsyncAction->page = FMath::Max (Page, 1 );
246+ pAsyncAction->iModelId = iModelId;
247+ return pAsyncAction;
248+ }
249+
250+ void UCesiumITwinAPIGetIModelMeshExportsAsyncAction::Activate () {
251+ if (!this ->pConnection ) {
252+ TArray<FString> Errors;
253+ Errors.Push (" No connection to iTwin." );
254+ OnIModelMeshExportsResult.Broadcast (
255+ TArray<UCesiumIModelMeshExport*>(),
256+ false ,
257+ Errors);
258+ return ;
259+ }
260+
261+ CesiumITwinClient::QueryParameters params;
262+ params.top = PageSize;
263+ params.skip = PageSize * (this ->page - 1 );
264+
265+ this ->pConnection ->meshExports (TCHAR_TO_UTF8 (*this ->iModelId ), params)
266+ .thenInMainThread ([this ](
267+ CesiumUtility::Result<CesiumITwinClient::PagedList<
268+ CesiumITwinClient::IModelMeshExport>>&&
269+ result) {
270+ if (!IsValid (this )) {
271+ UE_LOG (
272+ LogCesium,
273+ Warning,
274+ TEXT (
275+ " Get imodel mesh exports finished but get imodel mesh exports async action is no longer valid." ));
276+ return ;
277+ }
278+
279+ if (!result.value ) {
280+ OnIModelMeshExportsResult.Broadcast (
281+ TArray<UCesiumIModelMeshExport*>(),
282+ false ,
283+ errorListToArray (result.errors ));
284+ } else {
285+ TArray<UCesiumIModelMeshExport*> iModels;
286+ iModels.Reserve (result.value ->size ());
287+ for (CesiumITwinClient::IModelMeshExport& iModel : *result.value ) {
288+ UCesiumIModelMeshExport* pIModel =
289+ NewObject<UCesiumIModelMeshExport>();
290+ pIModel->SetIModelMeshExport (MoveTemp (iModel));
291+ iModels.Emplace (pIModel);
292+ }
293+ OnIModelMeshExportsResult.Broadcast (
294+ iModels,
295+ result.value ->hasNextUrl (),
296+ TArray<FString>());
297+ }
298+ });
299+ }
300+
301+ UCesiumITwinAPIGetRealityDataAsyncAction*
302+ UCesiumITwinAPIGetRealityDataAsyncAction::GetITwinRealityData (
303+ UCesiumITwinConnection* pConnection,
304+ const FString& iTwinId,
305+ int Page) {
306+ UCesiumITwinAPIGetRealityDataAsyncAction* pAsyncAction =
307+ NewObject<UCesiumITwinAPIGetRealityDataAsyncAction>();
308+ pAsyncAction->pConnection = pConnection->pConnection ;
309+ pAsyncAction->page = FMath::Max (Page, 1 );
310+ pAsyncAction->iTwinId = iTwinId;
311+ return pAsyncAction;
312+ }
313+
314+ void UCesiumITwinAPIGetRealityDataAsyncAction::Activate () {
315+ if (!this ->pConnection ) {
316+ TArray<FString> Errors;
317+ Errors.Push (" No connection to iTwin." );
318+ OnITwinRealityDataResult.Broadcast (
319+ TArray<UCesiumITwinRealityData*>(),
320+ false ,
321+ Errors);
322+ return ;
323+ }
324+
325+ CesiumITwinClient::QueryParameters params;
326+ params.top = PageSize;
327+ params.skip = PageSize * (this ->page - 1 );
328+
329+ this ->pConnection ->realityData (TCHAR_TO_UTF8 (*this ->iTwinId ), params)
330+ .thenInMainThread ([this ](
331+ CesiumUtility::Result<CesiumITwinClient::PagedList<
332+ CesiumITwinClient::ITwinRealityData>>&&
333+ result) {
334+ if (!IsValid (this )) {
335+ UE_LOG (
336+ LogCesium,
337+ Warning,
338+ TEXT (
339+ " Get reality data finished but get reality data async action is no longer valid." ));
340+ return ;
341+ }
342+
343+ if (!result.value ) {
344+ OnITwinRealityDataResult.Broadcast (
345+ TArray<UCesiumITwinRealityData*>(),
346+ false ,
347+ errorListToArray (result.errors ));
348+ } else {
349+ TArray<UCesiumITwinRealityData*> realityDataObjects;
350+ realityDataObjects.Reserve (result.value ->size ());
351+ for (CesiumITwinClient::ITwinRealityData& realityData :
352+ *result.value ) {
353+ UCesiumITwinRealityData* pRealityData =
354+ NewObject<UCesiumITwinRealityData>();
355+ pRealityData->SetITwinRealityData (MoveTemp (realityData));
356+ realityDataObjects.Emplace (pRealityData);
357+ }
358+ OnITwinRealityDataResult.Broadcast (
359+ realityDataObjects,
360+ result.value ->hasNextUrl (),
361+ TArray<FString>());
362+ }
363+ });
364+ }
365+
366+ UCesiumITwinAPIListCesiumCuratedContentAsyncAction*
367+ UCesiumITwinAPIListCesiumCuratedContentAsyncAction::
368+ GetCesiumCuratedContentAssets (UCesiumITwinConnection* pConnection) {
369+ UCesiumITwinAPIListCesiumCuratedContentAsyncAction* pAsyncAction =
370+ NewObject<UCesiumITwinAPIListCesiumCuratedContentAsyncAction>();
371+ pAsyncAction->pConnection = pConnection->pConnection ;
372+ return pAsyncAction;
373+ }
374+
375+ void UCesiumITwinAPIListCesiumCuratedContentAsyncAction::Activate () {
376+ if (!this ->pConnection ) {
377+ TArray<FString> Errors;
378+ Errors.Push (" No connection to iTwin." );
379+ OnListCesiumCuratedContentDelegate.Broadcast (
380+ TArray<UCesiumCuratedContentAsset*>(),
381+ Errors);
382+ return ;
383+ }
384+
385+ this ->pConnection ->cesiumCuratedContent ().thenInMainThread (
386+ [this ](CesiumUtility::Result<std::vector<
387+ CesiumITwinClient::CesiumCuratedContentAsset>>&& result) {
388+ if (!IsValid (this )) {
389+ UE_LOG (
390+ LogCesium,
391+ Warning,
392+ TEXT (
393+ " Get cesium curated content finished but get cesium curated content async action is no longer valid." ));
394+ return ;
395+ }
396+
397+ if (!result.value ) {
398+ OnListCesiumCuratedContentDelegate.Broadcast (
399+ TArray<UCesiumCuratedContentAsset*>(),
400+ errorListToArray (result.errors ));
401+ } else {
402+ TArray<UCesiumCuratedContentAsset*> assets;
403+ assets.Reserve (result.value ->size ());
404+ for (CesiumITwinClient::CesiumCuratedContentAsset& asset :
405+ *result.value ) {
406+ UCesiumCuratedContentAsset* pAsset =
407+ NewObject<UCesiumCuratedContentAsset>();
408+ pAsset->SetCesiumCuratedContentAsset (MoveTemp (asset));
409+ assets.Emplace (pAsset);
410+ }
411+ OnListCesiumCuratedContentDelegate.Broadcast (
412+ assets,
413+ TArray<FString>());
414+ }
415+ });
416+ }
0 commit comments