Application main behaviour
Managing Elements To display
Every time something occurs on the app which will impact the elements displayed, the following actions take place :
- Handle a change like filter checked, map move…
- Starting the global main process ->
App.ElementsManager.checkForNewElementsToRetrieve - If necessary, retrieve some new elements from the server that we haven’t downloaded yet
- Update the array of elements which need to be displayed according to the current geographical zone, filters etc… ->
App.elementsModule.updateElementsToDisplay - Update the view according to the new ElementsToDisplay array ->
App.ElementsManager.handleElementsToDisplayChanged
Retrieve partial data
For large dataset, it’s better not retrieving all the elements in one shot. Instead we prefer retrieve element on a particular geographical zone (called a Bound), one after another. The detailled actions from the above task : “If necessary, retrieve some new elements from the server that we haven’t downloaded yet” are :
- Calculating the geographical zone where we haven’t already retrieved the proper data ->
App.boundsModule.calculateFreeBounds - Retrieve the data for this geographical zone ->
App.ajaxModule.getElementsInBounds - Receive the JSON object containing the elements ->
App.ElementManagers.handleNewElementsReceivedFromServer - Transform the JSON data into proper
Elementclasses ->App.elementsJsonModule.convertJsonElements