Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the Cesium Map models, views, & collections more modular #2189

Closed
robyngit opened this issue Aug 31, 2023 · 2 comments · Fixed by #2204
Closed

Make the Cesium Map models, views, & collections more modular #2189

robyngit opened this issue Aug 31, 2023 · 2 comments · Fixed by #2204
Assignees
Labels
ADC CI-16 Geospatial search improvements (ADC deliverable) cesium DRP Issues related to the Defense Resiliency Platform enhancement pdg Permafrost Discovery Gateway
Milestone

Comments

@robyngit
Copy link
Member

As we plan to introduce numerous features to our Cesium map, it has become clear that our current structure could be improved so that it scales better with this complexity. This issue came up while working on the DrawTool feature, which requires a different action when the map is clicked.

The aim of this issue is to make some small improvements to the models, views, & collections that comprise the Cesium map to allow easier integration of new features and make the code more maintainable.

Some specific improvements could include:

  1. Create a MapInteraction Model: Move attributes like currentScale, currentViewExtent, mousePosition, etc., into a new MapInteraction model to decouple these from the main map model. This will allow us to handle different kinds of interactions without bloating the main map model.

  2. Introduce GeoPoint and GeoBoundingBox Models: Factor out redundant code into new models such as GeoPoint and GeoBoundingBox. These models can handle operations related to geographical points and bounding boxes, making the code more DRY.

  3. Refactor CesiumWidget View Methods: The methods in the CesiumWidget view should be made smaller and more modular to increase readability and testability. Each method should have a single responsibility and should be easy to understand.

@robyngit robyngit added enhancement pdg Permafrost Discovery Gateway cesium DRP Issues related to the Defense Resiliency Platform labels Aug 31, 2023
@robyngit robyngit added this to the 2.27.0 milestone Aug 31, 2023
@robyngit robyngit self-assigned this Aug 31, 2023
@robyngit robyngit added the ADC CI-16 Geospatial search improvements (ADC deliverable) label Aug 31, 2023
robyngit added a commit that referenced this issue Aug 31, 2023
- Add MapInteraction, GeoPoint and GeoBoundingBox models
- Make the CesiumWidgetView methods smaller and more modular
- Move Map model attributes to the MapInteraction model (selectedFeatures, currentPosition, currentScale, and currentViewExtent)
- In MapAsset models, listen for changes to cesiumOptions and update Cesium model
- In map connectors, don't use new models as defaults to avoid instantiating new models unnecessarily
- Pass GeoPoint and GeoScale models directly to the ScaleBarView

Issues #2189, #2180, #2187
@robyngit
Copy link
Member Author

robyngit commented Aug 31, 2023

The MapInteraction, GeoPoint, and GeoBoundingBox models have been created, and the CesiumWidgetView has been somewhat improved. Since the initial work on this originated during the development of DrawTool (#2180), ongoing work is being committed to the feature-2180-draw-on-map branch.

Remaining Tasks:

  • Write tests for new models.
  • Update tests for existing models & collections where attributes or functionality have moved.
  • Address minor fixes related to feature selection.
  • Resolve issues with rendering selected features.
  • Thoroughly test changes in:
    • PDG production portal
    • ADC catalog
    • DRP catalog
    • DRP portal

Ideas for Further Improvement

While the current refactoring addresses immediate concerns, here are additional considerations that could either be implemented in this iteration, moved to separate issues, or passed on (to consider):

  1. Refactor CesiumWidgetView into Sub-Views:

    • CesiumAssets view could manage rendering MapAssets on the Cesium globe (e.g., layers and terrain).
    • CesiumCamera or CesiumNavigation view could handle zoom functionalities.
    • CesiumDataSourceView could encapsulate logic related to displaying CesiumDataSource data.
  2. Leverage GeoBoundingBox Model: Use this new model in the spatial filter to simplify logic around updating the spatial filter when the map position changes. (Also for the homePosition attribute on the Map model)

  3. Introduce a BoundedGeohashes Model: This model could contain a bounds attribute and a geohashes attribute. Updating the GeoBoundingBox model on the bounds attribute could automatically trigger an update to the Geohashes collection.

robyngit added a commit that referenced this issue Sep 6, 2023
robyngit added a commit that referenced this issue Sep 20, 2023
robyngit added a commit that referenced this issue Sep 20, 2023
robyngit added a commit that referenced this issue Oct 6, 2023
- Fix issues with drawing polygons, including drawing polygons over poles
- Allow drawn polygons to have properties set like other layers (color, opacity, etc)
- When drawing, draw both points and polygons
- Add CustomDataSource support
- Greatly reduce the number of re-renders Cesium must do (improve map performance)
- Add connectors between GeoPoints collection and polygons & points Entities

Issues #2180 and #2189
@robyngit
Copy link
Member Author

Other ideas for further improvement:

  • use the GeoPoints collection as well as the Geopoints-Polygon connector in the Geohash model to handle creating entities (see Enable drawing arbitrary polygons on the Cesium map #2180)
  • Create Geohashes in the coordinates provided by the ngeohash library. Let Cesium handle converting to ECEF, remove that library
  • Move logic around creating CZML to it's own model

robyngit added a commit that referenced this issue Oct 17, 2023
@robyngit robyngit linked a pull request Oct 17, 2023 that will close this issue
robyngit added a commit that referenced this issue Oct 18, 2023
- Properly switch the maps "click action" back to original setting after draw tool turned off
- Fixed delayed rendering of datasources after update (esp. Geohashes)
- Fix zooming to features on click (issue with getting bounding sphere of a feature)

Issues #2180 and #2189
robyngit added a commit that referenced this issue Oct 18, 2023
robyngit added a commit that referenced this issue Nov 1, 2023
- Wait to trigger catalog search until camera is moving has moved enough to be considered 'changed'
- Remove listeners in Map-Search-Filters connector
- Update some documentation
- Clean up some of the CesiumVectorData code

Issues #2180 and #2189
robyngit added a commit that referenced this issue Nov 1, 2023
In case there is no cesiumModel created yet.

Issues #2180 and #2189
@robyngit robyngit closed this as completed Nov 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ADC CI-16 Geospatial search improvements (ADC deliverable) cesium DRP Issues related to the Defense Resiliency Platform enhancement pdg Permafrost Discovery Gateway
Development

Successfully merging a pull request may close this issue.

1 participant