Skip to content

Commit

Permalink
add additional ui/ux
Browse files Browse the repository at this point in the history
  • Loading branch information
corybarr committed Feb 21, 2024
1 parent edb2d49 commit 7c5f753
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 36 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import logging
import omni.kit.window.property
import omni.usd
import omni.ui
from omni.kit.property.usd.custom_layout_helper import CustomLayoutFrame, CustomLayoutGroup, CustomLayoutProperty
from omni.kit.property.usd.usd_property_widget import SchemaPropertiesWidget
from cesium.usd.plugins.CesiumUsdSchemas import (
Expand Down Expand Up @@ -33,33 +34,48 @@ def _customize_props_layout(self, props):
prim_path = self._payload.get_paths()[0]
webMapTileServiceRasterOverlay = CesiumWebMapTileServiceRasterOverlay.Get(self._stage, prim_path)
specify_zoom_levels = webMapTileServiceRasterOverlay.GetSpecifyZoomLevelsAttr().Get()
specify_tile_matrix_set_labels = webMapTileServiceRasterOverlay.GetSpecifyTileMatrixSetLabelsAttr().Get()
specify_tiling_scheme = webMapTileServiceRasterOverlay.GetSpecifyTilingSchemeAttr().Get()

with frame:
with CustomLayoutGroup("WMTS Settings"):
CustomLayoutProperty("cesium:url")
CustomLayoutProperty("cesium:layer")
CustomLayoutProperty("cesium:style")
CustomLayoutProperty("cesium:format")
CustomLayoutProperty("cesium:tileMatrixSetId")
CustomLayoutProperty("cesium:specifyTileMatrixSetLabels")
# TODO: Tile Matrix Set Labels
CustomLayoutProperty("cesium:tileMatrixSetLabelPrefix")
CustomLayoutProperty("cesium:useWebMercatorProjection")
with CustomLayoutGroup("Zoom Settings"):
CustomLayoutProperty("cesium:specifyZoomLevels")
if specify_zoom_levels:
CustomLayoutProperty(
"cesium:minimumZoomLevel",
build_fn=build_slider(
0, 30, type="int", constrain={"attr": "cesium:maximumZoomLevel", "type": "maximum"}
),
)
CustomLayoutProperty(
"cesium:maximumZoomLevel",
build_fn=build_slider(
0, 30, type="int", constrain={"attr": "cesium:minimumZoomLevel", "type": "minimum"}
),
)
with CustomLayoutGroup("Tiling Matrix Set Settings", collapsed=False):
CustomLayoutProperty("cesium:tileMatrixSetId")
CustomLayoutProperty("cesium:specifyTileMatrixSetLabels")
if specify_tile_matrix_set_labels:
CustomLayoutProperty("cesium:tileMatrixSetLabels")
else:
CustomLayoutProperty("cesium:tileMatrixSetLabelPrefix")
CustomLayoutProperty("cesium:useWebMercatorProjection")
with CustomLayoutGroup("Tiling Scheme Settings", collapsed=False):
CustomLayoutProperty("cesium:specifyTilingScheme")
if specify_tiling_scheme:
CustomLayoutProperty("cesium:rootTilesX")
CustomLayoutProperty("cesium:rootTilesY")
CustomLayoutProperty("cesium:west")
CustomLayoutProperty("cesium:east")
CustomLayoutProperty("cesium:south")
CustomLayoutProperty("cesium:north")
with CustomLayoutGroup("Zoom Settings", collapsed=False):
CustomLayoutProperty("cesium:specifyZoomLevels")
if specify_zoom_levels:
CustomLayoutProperty(
"cesium:minimumZoomLevel",
build_fn=build_slider(
0, 30, type="int", constrain={"attr": "cesium:maximumZoomLevel", "type": "maximum"}
),
)
CustomLayoutProperty(
"cesium:maximumZoomLevel",
build_fn=build_slider(
0, 30, type="int", constrain={"attr": "cesium:minimumZoomLevel", "type": "minimum"}
),
)

build_common_raster_overlay_properties()

return frame.apply(props)
Expand Down
4 changes: 2 additions & 2 deletions exts/cesium.usd.plugins/schemas/cesium_schemas.usda
Original file line number Diff line number Diff line change
Expand Up @@ -696,12 +696,12 @@ class CesiumWebMapTileServiceRasterOverlayPrim "CesiumWebMapTileServiceRasterOve
doc = 'Prefix for tile matrix set labels. For instance, setting "EPSG:4326:" as prefix generates label list ["EPSG:4326:0", "EPSG:4326:1", "EPSG:4326:2", ...]'
)

string cesium:tileMatrixSetLabels = "" (
string cesium:tileMatrixSetLabels (
customData = {
string apiName = "tileMatrixSetLabels"
}
displayName = "Tile Matrix Set Labels"
doc = "Tile Matrix Set Labels."
doc = "Comma-separated tile matrix set labels"
)

bool cesium:useWebMercatorProjection = true (
Expand Down
9 changes: 3 additions & 6 deletions src/core/src/OmniWebMapTileServiceRasterOverlay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -290,12 +290,9 @@ void OmniWebMapTileServiceRasterOverlay::reload() {
wmtsOptions.format = format;
}

// TODO: push this check to UI
const auto minimumLevel = getMinimumZoomLevel();
const auto maximumLevel = getMaximumZoomLevel();
if (maximumLevel > minimumLevel && getSpecifyZoomLevels()) {
wmtsOptions.minimumLevel = minimumLevel;
wmtsOptions.maximumLevel = maximumLevel;
if (getSpecifyZoomLevels()) {
wmtsOptions.minimumLevel = getMinimumZoomLevel();
wmtsOptions.maximumLevel = getMaximumZoomLevel();
}

CesiumGeospatial::Projection projection;
Expand Down
5 changes: 1 addition & 4 deletions src/core/src/UsdNotificationHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,6 @@ void processCesiumWebMapTileServiceRasterOverlayChanged(
auto reload = false;
auto updateBindings = false;

// TODO: UX for which properties need relading, updated bindings, etc
for (const auto& property : properties) {
if (property == pxr::CesiumTokens->cesiumUrl || property == pxr::CesiumTokens->cesiumLayer ||
property == pxr::CesiumTokens->cesiumStyle || property == pxr::CesiumTokens->cesiumFormat ||
Expand All @@ -513,9 +512,7 @@ void processCesiumWebMapTileServiceRasterOverlayChanged(
property == pxr::CesiumTokens->cesiumSouth || property == pxr::CesiumTokens->cesiumNorth ||
property == pxr::CesiumTokens->cesiumSpecifyZoomLevels ||
property == pxr::CesiumTokens->cesiumMinimumZoomLevel ||
property == pxr::CesiumTokens->cesiumMaximumZoomLevel

) {
property == pxr::CesiumTokens->cesiumMaximumZoomLevel) {
reload = true;
updateBindings = true;
}
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/CesiumUsdSchemas/generatedSchema.usda.in
Original file line number Diff line number Diff line change
Expand Up @@ -647,9 +647,9 @@ class CesiumWebMapTileServiceRasterOverlayPrim "CesiumWebMapTileServiceRasterOve
displayName = "Tile Matrix Set Label Prefix"
doc = 'Prefix for tile matrix set labels. For instance, setting "EPSG:4326:" as prefix generates label list ["EPSG:4326:0", "EPSG:4326:1", "EPSG:4326:2", ...]'
)
string cesium:tileMatrixSetLabels = "" (
string cesium:tileMatrixSetLabels (
displayName = "Tile Matrix Set Labels"
doc = "Tile Matrix Set Labels."
doc = "Comma-separated tile matrix set labels"
)
string cesium:url = "" (
displayName = "Url"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,11 +283,11 @@ class CesiumWebMapTileServiceRasterOverlay : public CesiumRasterOverlay
// --------------------------------------------------------------------- //
// TILEMATRIXSETLABELS
// --------------------------------------------------------------------- //
/// Tile Matrix Set Labels.
/// Comma-separated tile matrix set labels
///
/// | ||
/// | -- | -- |
/// | Declaration | `string cesium:tileMatrixSetLabels = ""` |
/// | Declaration | `string cesium:tileMatrixSetLabels` |
/// | C++ Type | std::string |
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->String |
CESIUMUSDSCHEMAS_API
Expand Down

0 comments on commit 7c5f753

Please sign in to comment.