Hi,
We are currently developing a GIS-SPA, in which the user should be able to choose between several map configurations, lets call them "map modes". These map modes will present different map layers from different sources, render different tools available etc.
The user should be able to go back and forth between these map modes, keeping the state of some mapView-properties like extent, scale etc.
Our initial idea was to always work with a single instance of the MapView, while having several instances of the Map-class. When the user would switch to a different map mode, we simple replace the instance of the Map with the one corresponding to the current map mode, informing out MapView of this new Map it should be viewing.
We also have a single instance of LayerList, connected to our one MapView-instance.
Switching "map mode" was working just fine in 4.6, the MapView loaded the new map config and the LayerList was automatically updated. After updating to 4.7, the MapView seems to be loading the new map config correctly, but the LayerList produces a DOM-exception: 'Failed to execute 'insertBefore' on 'Node': The node before which the new node is to be inserted is not a child of this node.
Now, after reading "A Map object should be created prior to a view so it can be passed into the map
property of that view..." in the API Reference, it got me thinking that maybe we are going about this map mode handling the wrong way.
Would we perhaps be better off creating a sort of bundle for the Map and MapView, keeping a one-to-one relation for these entities, for each of our map modes? Would this in turn also call for having multiple instances of the LayerList?
Thanks in advance,
Sebastian