Skip to content

Conversation

@Nynjin
Copy link
Contributor

@Nynjin Nynjin commented Dec 9, 2025

Description

This pull request introduces a new demonstration example for iTowns, adding a complete demo application under examples/demo, integrated amongst the other Itowns examples under the section Demo.

This demo section features multiple self-contained scenes with navigation, camera transitions, and layer management (visibility, controls, feature picking, recreation of view and layers from scratch, ...).

The examples/demo package can be described as such :

css/ : style for the UI elements

src/ : Typescript demo code

Config/ : global constants such as scene transition duration or distance from globe where to toggle on/off atmosphere

Layers/ : objects containing promises for itowns layered shared between multiple scenes to avoid refetching/re-instantiation, as well as methods such as feature picking which is specific to each layer

Sources/ : promises containing sources that are used by multiple layers to avoid refetching

Views/ : singletons for the different views shared between layers (globe, immersive, planar, ...) that initialize itowns views and expose extra methods/properties (visibility toggle, viewerDiv, layer insertion, instance clearing, ...)

Scenes/ : scenes used in the demo containing their methods and properties (title, description, layers, onCreate, onEnter, onExit, view)

Repositories/ : shared singleton containers such as SceneRepository (array of all used scenes)

Types/ : common types and wrappers (SceneType, or LayerType containing all types of itowns layers used)

Utils/ : global methods such as scene transition, ui update, camera movement, event propagation block, ...

Services/ : application-level services such as feature picking on click

index.ts : main demo entrypoint

index.html : entrypoint for the demo. Hosts the root containers for the UI

Motivation and Context

iTowns currently provides an unstructured collection of examples that are mainly designed for developers and are kind of tutorials in the end. This PR adds an end-user oriented demonstration of main iTowns features.
See related issue.

Environment

  • OS: Windows 11
  • Browser: Brave
  • Node: v24.11.0
  • npm: 11.6.1

Screenshots

Itowns.demo.mp4
Globe Scene Planar Scene Terrain Elevation Scene
Instanced Data Scene Point Cloud Scene BIM Scene
Textured Meshes Scene Immersive Scene

Open questions / TODO

  • Find a better 3DTiles dataset
  • Find a better point cloud (bigger, with classification and RGB if possible). Which dataset can we use from the LIDAR HD ?
  • Immersive and planar scene tend to be unstable (white screen sometimes, ground on immersive scene may not appear), mostly fixed with scene reset
  • Add extruded lines when ready
  • Move light on globe scene to not obscure the center
  • Camera movement based on duration can be troublesome when switching between scenes that have the same placement, or if resetting camera position when it hasn't moved, or has barely moved (waiting 2 seconds each time and blocking the UI)

@Nynjin Nynjin added the demo 🎢 Sharing a demo label Dec 9, 2025
@jailln jailln requested a review from Desplandis December 9, 2025 16:10
@Nynjin Nynjin marked this pull request as ready for review December 9, 2025 16:12
@Desplandis
Copy link
Contributor

I would not be able to do a review until new year's eve (vacation time :D), @alavenant @Calvina24 could you review the functionality of this PR and dispatch the technical part to a member of the team?

@Desplandis Desplandis requested review from alavenant and removed request for Desplandis December 12, 2025 13:56
@Desplandis Desplandis removed their assignment Dec 12, 2025
@Desplandis
Copy link
Contributor

@Nynjin I saw that there is a 10mB binary file in the changes, would it be possible to remove it from the commits and host it elsewhere to not pollute the main itowns repository? We usually use itowns2-sample-data for the datasets.

@Nynjin
Copy link
Contributor Author

Nynjin commented Dec 12, 2025

@Nynjin I saw that there is a 10mB binary file in the changes, would it be possible to remove it from the commits and host it elsewhere to not pollute the main itowns repository? We usually use itowns2-sample-data for the datasets.

Got it thanks, I uploaded my models there and made a PR.
Once that's done I'll update this one to remove the local models and use the uploaded ones instead.

@mgermerie mgermerie self-requested a review December 12, 2025 17:20
@Nynjin Nynjin force-pushed the feature/demo branch 2 times, most recently from 1b4a570 to 1c434dd Compare December 15, 2025 15:59
camera movement between scene coordinates, layers removal/additions, onEnter/onExit for extra properties
- instead of removing / readding same layers which is bug-prone, don't remove and just toggle visibility

- added heading to scenes to ensure camera ends up in the right spot
…oordinate projection

- onCreate promise for scene first instantiation to set ready state
- onEnter for each entry in scene
- Scenes manage their layers to handle dependencies, transitionToScene only manages visibility
- better ImmersiveView types
…fit specification with same pov and shared layers
added PointCloudView with PlanarControls, fixed default camera position for ImmersiveView + added IgnMnt elevation layer where missing
fixed empty UI on first scene, UI updates before camera transition now + navigation buttons now have fixed position regardless of text
Transition now uses camera's coordinates instead of current scene coordinates + avoid unecessary unzoom step when next scene's position is already further away that computed minimal distance for transition
PlanarView requires extent in constructor
so instead of singleton like other views, there is one instance per extent
added custom type to encapsulate all currently required itowns layer types to avoid ts error
updated scene transition to avoid displaying current scene's layers and next scene's layers at the same time
minor fix on gui transition to remove elevation and geoid layers as well
- removed unecessary ambiant lights
- added atmosphere removal for scenes that do not require it with transition based on scene ranges
- refactor required to make layer promises and cache accessible to hard reset method by turning layers to objects with layerRepository
- added clearInstance method to View in order to remove viewerDiv, dispose view and delete instance
- moved sceneRepository outside of index.html to make it accessible
- refactor on some types and scene names to make it clearer
- prevent reset while doing scene transition
- bypass view dispose error if possible
- use Globe3dScene as transition between scenes with its layers visible
- prevent actions during scene transition
- replaced IGN_MNT elevation layer by WORLD_DTM
- prevent moveCameraTo if not a globe view
- reset transition scene as well
- display informations about an element from a tracked layer
- each LayerPromise manages how their info are extracted/structured with getPickingInfo
- switch between color and classification render with buttons
- filter registered layers by visibility before feature picking
- made FeaturePickerService's blockEvents method a global utils so PointCloudScene's UI can use it
- check skymanager's existence and enabled property before define
- use custom type to add skymanager to view
- Added "itowns" as a dependency in the demo's package.json
- Refactored modules with index.ts exports for each namespace
- Removed LayerRepository and replaced its usage with direct layer imports
- Updated the webpack configuration to support the demo example
@alavenant
Copy link
Contributor

alavenant commented Dec 16, 2025

Thanks for the work.

The transition from one demo to another is smooth and enjoyable.

I suggest to put the "go local" next to "bring your data to life".

In "Feel the Relief", you could also talk about the ortho-images.

"go local" : unzoom so that we can fully appreciate the scene as a whole

Why not add a view "combine your data" with lidar, 3D objects, buildings, bim, ... ?

@Nynjin
Copy link
Contributor Author

Nynjin commented Dec 16, 2025

Thanks for the work.

The transition from one demo to another is smooth and enjoyable.

I suggest to put the "go local" next to "bring your data to life".

In "Feel the Relief", you could also talk about the ortho-images.

"go local" : unzoom so that we can fully appreciate the scene as a whole

Why not add a view "combine your data" with lidar, 3D objects, buildings, bim, ... ?

Thank you for you feedback.

I did consider putting "go local" before "bring your data to life" but having a planar view right in the middle of globe views looks a bit off, that's mostly why planar and street views are at the very end.

And when it comes to combining the data, it's an interesting idea but I'd have to check how it holds up performance-wise since clicking directly on that scene would attempt to instantiate all of these elements at the same time.

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

Labels

demo 🎢 Sharing a demo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants