Skip to content

2017_05_05_ _JGA_Itowns2_archi_and_tech_presentation

Eric Boix edited this page Dec 21, 2017 · 4 revisions

Itowns2 Architecture Presentation

General architecture diagram

  • The provider is used to retrieve data (from external sources ? From the database only ?...) using protocols. In scene mode, it is possible to add protocols. Provider example in Itowns2 : WMS provider. It seems that there is one provider per protocol.

  • APIGlobe.js : File containing API functions related to globe mode. Also contains example of layers creations.

Layers

In iTowns2 : Layer.js

  • Geometry Layer : Contains the tiles of the globe (geometry + images)
  • The sequence diagram goes (refer here for an hopefully clearer explanation)
    1. Initialization of the data set: preprocessDataLayer that is
      • defined in a provider
      • called only once per layer level
      • pulls the 3DTiles defined by some URL
    2. Initialization of the update: pre-update()
      • technically a callback
      • called at each step of the Itowns engine (each time the screen must be refreshed)
      • at the level of the layer
    3. update() (technically callback):
      * called for each object of the layer (e.g. tiles of the geometry layer) * returns all the objects that must updated (recursively). * It is itowns/src/Core/Mainloop.js that collects those objects (in need of update) and calls update() on the returned objects (until they are all updated).
  • Layers linked to other layers only have one "callback" function (update())

General Itowns2 informations

  • Terrain model and orthoimages are directly downloaded from IGN server using a WMTS protocol.

Javascript notes

  • It is better to use let and const than to use var to declare variables : "let allows you to declare variables that are limited in scope to the block, statement, or expression on which it is used. This is unlike the var keyword, which defines a variable globally, or locally to an entire function regardless of block scope" (More...). Const works the same as let but declares constants instead of variables (More on const...)

  • Promise is used for asynchronous computations. Used for communication by the provider of Itowns2. For each promise, a function resolve() and reject() is defined. When a promise is "resolved" or "rejected", we can call functions using promise.then() and having has arguments the results of resolve() or reject().