Skip to content

Conversation

Desplandis
Copy link
Contributor

@Desplandis Desplandis commented Jun 11, 2025

Description

This PR introduces several changes to the base Layer and layer-related classes. The main changes includes the migration of LayerUpdateState and LayerUpdateStrategy to typescript, the reorganization of Layer properties for better separation of concerns and the addition of a startup lifecycle method as a first step to cleanup the mess that is View#preprocessLayer. This will not break existing layers within iTowns but could break custom layers inheriting directly from Layer.

Motivation and Context

The motivation for the following changes is as follow:

  • Introduction of Layer#startup lifecycle method for separation of concerns, allowing for more explicit initialization of layers. Follow-up: remove View#preprocessLayer and most of the complexity of View#addLayer.
  • Migration of LayerUpdateState and LayerUpdateStrategy to typescript (I will personally rebase Further simplify tile subdivision mechanism #2525 on this PR since there is some function paramater changes to chooseNextLevelToFetch).
    Follow-up: migrate TileMesh-related modules to typescript (see Migrate TileMesh-related modules to typescript #2557) / migrate LayerNodeProcessing
  • Move ImageryLayers to its own module as I have short-term plan to migrate all layers to typescript (with some type hacks) and have no plan to migrate ImageryLayers (which given the code needs an entire refactoring...).
    Follow-up: migrate Layer modules to typescript
  • Move some layers properties to inherited classes for better separation of concerns, facilitate the typechecking of Layer and children.
    • layerUpdateStrategy used only on RasterLayer-derived classes
    • style used only on *3DTilesLayer, FeatureGeometryLayer and ColorLayer
    • mergeFeatures/addLabel used only on FeatureGeometryLayer and ColorLayer
      Follow-up: migrate Layer modules to typescript

Changes considered but not done on this PR:

  • Cleanup the mess in View#preprocessLayer
  • Moving the caching mechanism in classes where it is effectively used
  • Some things that I surely forgot ;)

Screenshots (if appropriate)

@Desplandis Desplandis force-pushed the cleanup/layer branch 2 times, most recently from b56d9e0 to 2c2e6bf Compare June 11, 2025 13:19
@Desplandis Desplandis force-pushed the cleanup/layer branch 6 times, most recently from 8f932c2 to 2292cc4 Compare June 25, 2025 14:37
@Desplandis Desplandis marked this pull request as ready for review June 25, 2025 14:55
@Desplandis
Copy link
Contributor Author

@AnthonyGlt @mgermerie @HoloTheDrunk If anyone want to review this PR. Especially if you depend on some properties here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant