Skip to content

Commit

Permalink
fix issue with AssetRegistry::getRasterOverlay
Browse files Browse the repository at this point in the history
  • Loading branch information
corybarr committed Feb 16, 2024
1 parent 581447c commit d647dcd
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 7 deletions.
4 changes: 0 additions & 4 deletions src/core/include/cesium/omniverse/AssetRegistry.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,10 @@ class AssetRegistry {
OmniWebMapServiceRasterOverlay& addWebMapServiceRasterOverlay(const pxr::SdfPath& path);
void removeWebMapServiceRasterOverlay(const pxr::SdfPath& path);
[[nodiscard]] OmniWebMapServiceRasterOverlay* getWebMapServiceRasterOverlay(const pxr::SdfPath& path) const;
// [[nodiscard]] const std::vector<std::unique_ptr<OmniWebMapServiceRasterOverlay>>&
// getWebMapServiceRasterOverlays() const;

OmniTileMapServiceRasterOverlay& addTileMapServiceRasterOverlay(const pxr::SdfPath& path);
void removeTileMapServiceRasterOverlay(const pxr::SdfPath& path);
[[nodiscard]] OmniTileMapServiceRasterOverlay* getTileMapServiceRasterOverlay(const pxr::SdfPath& path) const;
[[nodiscard]] const std::vector<std::unique_ptr<OmniTileMapServiceRasterOverlay>>&
getTileMapServiceRasterOverlays() const;

OmniWebMapTileServiceRasterOverlay& addWebMapTileServiceRasterOverlay(const pxr::SdfPath& path);
void removeWebMapTileServiceRasterOverlay(const pxr::SdfPath& path);
Expand Down
10 changes: 10 additions & 0 deletions src/core/src/AssetRegistry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,16 @@ OmniRasterOverlay* AssetRegistry::getRasterOverlay(const pxr::SdfPath& path) con
return pWebMapServiceRasterOverlay;
}

const auto pTileMapServiceRasterOverlay = getTileMapServiceRasterOverlay(path);
if (pTileMapServiceRasterOverlay) {
return pTileMapServiceRasterOverlay;
}

const auto pWebMapTileServiceRasterOverlay = getWebMapTileServiceRasterOverlay(path);
if (pWebMapTileServiceRasterOverlay) {
return pWebMapTileServiceRasterOverlay;
}

return nullptr;
}

Expand Down
28 changes: 25 additions & 3 deletions src/core/src/UsdNotificationHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ void processCesiumWebMapTileServiceRasterOverlayChanged(
const std::vector<pxr::TfToken>& properties) {

const auto pWebMapTileServiceRasterOverlay =
context.getAssetRegistry().getWebMapServiceRasterOverlay(webMapTileServiceRasterOverlayPath);
context.getAssetRegistry().getWebMapTileServiceRasterOverlay(webMapTileServiceRasterOverlayPath);
if (!pWebMapTileServiceRasterOverlay) {
return;
}
Expand All @@ -498,11 +498,27 @@ void processCesiumWebMapTileServiceRasterOverlayChanged(
auto reload = false;
auto updateBindings = false;

// TODO: add needed checks
// TODO: UX for which properties need relading, updated bindings, etc
for (const auto& property : properties) {
if (property == pxr::CesiumTokens->cesiumUrl || property == pxr::CesiumTokens->cesiumLayer) {
if (property == pxr::CesiumTokens->cesiumUrl || property == pxr::CesiumTokens->cesiumLayer ||
property == pxr::CesiumTokens->cesiumStyle || property == pxr::CesiumTokens->cesiumFormat ||
property == pxr::CesiumTokens->cesiumTileMatrixSetId ||
property == pxr::CesiumTokens->cesiumSpecifyTileMatrixSetLabels ||
property == pxr::CesiumTokens->cesiumTileMatrixSetLabelPrefix ||
property == pxr::CesiumTokens->cesiumTileMatrixSetLabels ||
property == pxr::CesiumTokens->cesiumUseWebMercatorProjection ||
property == pxr::CesiumTokens->cesiumSpecifyTilingScheme ||
property == pxr::CesiumTokens->cesiumRootTilesX || property == pxr::CesiumTokens->cesiumRootTilesY ||
property == pxr::CesiumTokens->cesiumWest || property == pxr::CesiumTokens->cesiumEast ||
property == pxr::CesiumTokens->cesiumSouth || property == pxr::CesiumTokens->cesiumNorth ||
property == pxr::CesiumTokens->cesiumSpecifyZoomLevels ||
property == pxr::CesiumTokens->cesiumMinimumZoomLevel ||
property == pxr::CesiumTokens->cesiumMaximumZoomLevel

) {
reload = true;
updateBindings = true;

}
}

Expand Down Expand Up @@ -1007,6 +1023,12 @@ bool UsdNotificationHandler::processChangedPrim(const ChangedPrim& changedPrim)
case ChangedPrimType::CESIUM_WEB_MAP_SERVICE_RASTER_OVERLAY:
processCesiumWebMapServiceRasterOverlayRemoved(*_pContext, changedPrim.primPath);
break;
case ChangedPrimType::CESIUM_TILE_MAP_SERVICE_RASTER_OVERLAY:
processCesiumTileMapServiceRasterOverlayRemoved(*_pContext, changedPrim.primPath);
break;
case ChangedPrimType::CESIUM_WEB_MAP_TILE_SERVICE_RASTER_OVERLAY:
processCesiumWebMapTileServiceRasterOverlayRemoved(*_pContext, changedPrim.primPath);
break;
case ChangedPrimType::CESIUM_GEOREFERENCE:
processCesiumGeoreferenceRemoved(*_pContext, changedPrim.primPath);
break;
Expand Down

0 comments on commit d647dcd

Please sign in to comment.