Skip to content

Commit

Permalink
Merge pull request #230 from CesiumGS/debug-window-cleanup
Browse files Browse the repository at this point in the history
Debug window cleanup
  • Loading branch information
lilleyse authored Mar 20, 2023
2 parents 0d11c84 + 9f0fd27 commit ffcdc98
Showing 1 changed file with 0 additions and 81 deletions.
81 changes: 0 additions & 81 deletions exts/cesium.omniverse/cesium/omniverse/ui/debug_window.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,9 @@
import logging
from enum import Enum
from typing import Optional

import omni.ui as ui

from .troubleshooter_window import CesiumTroubleshooterWindow
from ..bindings import ICesiumOmniverseInterface


class Tileset(Enum):
"""Possible tilesets for use with Cesium for Omniverse."""

CESIUM_WORLD_TERRAIN = 0
BING_MAPS = 1
CAPE_CANAVERAL = 2


class CesiumOmniverseDebugWindow(ui.Window):
WINDOW_NAME = "Cesium Debugging"
MENU_PATH = f"Window/Cesium/{WINDOW_NAME}"
Expand All @@ -40,66 +28,6 @@ def destroy(self):
def _build_fn(self):
"""Builds out the UI buttons and their handlers."""

def add_maxar_3d_surface_model():
"""Adds the Maxar data of Cape Canaveral to the stage."""

# Cape Canaveral
self._cesium_omniverse_interface.set_georeference_origin(-80.53, 28.46, -30.0)

self._cesium_omniverse_interface.add_tileset_ion(
"Cape Canaveral",
1387142,
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiIyMjRhYzI0Yi1kNWEwLTQ4ZWYtYjdmZC1hY2JmYWIzYmFiMGUiLCJpZCI6NDQsImlhdCI6MTY2NzQ4OTg0N30.du0tvWptgLWsvM1Gnbv3Zw_pDAOILg1Wr6s2sgK-qlM", # noqa: E501
)

def add_cesium_world_terrain():
"""Adds the standard Cesium World Terrain to the stage."""

# Cesium HQ
self._cesium_omniverse_interface.set_georeference_origin(-75.1564977, 39.9501464, 150.0)

tileset_path = self._cesium_omniverse_interface.add_tileset_ion(
"Cesium World Terrain",
1,
)

self._cesium_omniverse_interface.add_ion_imagery(
tileset_path,
"Layer",
3954,
)

def add_bing_maps_terrain():
"""Adds the Bing Maps & Cesium Terrain to the stage."""

# Cesium HQ
self._cesium_omniverse_interface.set_georeference_origin(-75.1564977, 39.9501464, 150.0)

tileset_path = self._cesium_omniverse_interface.add_tileset_ion(
"Bing Maps",
1,
)

self._cesium_omniverse_interface.add_ion_imagery(
tileset_path,
"Layer",
2,
)

def create_tileset(tileset=Tileset.CESIUM_WORLD_TERRAIN):
"""Creates the desired tileset on the stage.
Parameters:
tileset (Tileset): The desired tileset specified using the Tileset enumeration.
"""

if tileset is Tileset.CAPE_CANAVERAL:
add_maxar_3d_surface_model()
elif tileset is Tileset.BING_MAPS:
add_bing_maps_terrain()
else: # Terrain is Cesium World Terrain
add_cesium_world_terrain()

def remove_all_tilesets():
"""Removes all tilesets from the stage."""

Expand All @@ -122,18 +50,9 @@ def print_fabric_stage():
fabric_stage = self._cesium_omniverse_interface.print_fabric_stage()
self._cesium_message_field.set_value(fabric_stage)

def open_troubleshooting_window():
CesiumTroubleshooterWindow(self._cesium_omniverse_interface, "Testing", 1, 0, "Testing")

with ui.VStack():
ui.Button(
"Create Cesium World Terrain Tileset", clicked_fn=lambda: create_tileset(Tileset.CESIUM_WORLD_TERRAIN)
)
ui.Button("Create Bing Maps Tileset", clicked_fn=lambda: create_tileset(Tileset.BING_MAPS))
ui.Button("Create Cape Canaveral Tileset", clicked_fn=lambda: create_tileset(Tileset.CAPE_CANAVERAL))
ui.Button("Remove all Tilesets", clicked_fn=lambda: remove_all_tilesets())
ui.Button("Reload all Tilesets", clicked_fn=lambda: reload_all_tilesets())
ui.Button("Open Troubleshooter", clicked_fn=lambda: open_troubleshooting_window())
ui.Button("Print Fabric stage", clicked_fn=lambda: print_fabric_stage())
with ui.VStack():
self._cesium_message_field = ui.SimpleStringModel("")
Expand Down

0 comments on commit ffcdc98

Please sign in to comment.