hey all.  I've been working on making GeoNode use a less customized 
format for transferring map details between gxp Viewers and the Django 
app.  I took the opportunity to make another step in the 'heavy models, 
light views' direction.

geonode.maps.views.build_map_config(map) has been replaced with 
geonode.maps.models.Map.viewer_json(*extra_layers)
geonode.maps.views.create_map_json(config) and update_map_json(config) 
have both been replaced with 
geonode.maps.models.Map.update_from_viewer(config).  (update_from_viewer 
saves the generated map configuration, be warned).

You can see how these are used in my branch at 
http://github.com/dwins/geonode/compare/master...issue-566

Basically, whenever we want to make a viewer configuration, we should 
create a Map instance (if we don't want to save to the database, we 
don't have to) and use its viewer_json, rather than repeating the logic 
of making a correct viewer config throughout the code.  See the 
fall-through case in layerController for an example.

http://github.com/dwins/geonode/blob/issue-566/src/GeoNodePy/geonode/maps/views.py#L511

I'm going to write some better docs in the docstrings, but I wanted to 
go ahead and bring it up on the list in case anyone sees an obvious flaw 
in the approach.

--
David Winslow
OpenGeo - http://opengeo.org/

Reply via email to