Thank you Matt for your reply,

 

The code comes from the OpenLayers example :
http://openlayers.org/dev/examples/wmc.html 

So I do wmcFormat = new OpenLayers.Format.WMC(); to write and read contexts.

 

What I need, as you said, is  to change the options of my map with the
parameters of the context (BoundingBox, ZoomLevel, layers visible or not…).
I don’t want to merge the result like the openlayers example.

The problem is that wmcFormat.read(context, {map: mapOptions})  returns a
map.

 

So when I do map.setOptions(wmcFormat.read(context,{map:mapOptions});
nothing happens.

 

The result is that I need to know the map options contained in my context
but I only access to a map with the wmcFormat.

Do I have to extract the informations from the context (XML format) to set
the options and refresh all GeoExt widgets by myself ?

 

Best Regards

Arno

 

 

 

De : Matt Priour [mailto:mpri...@kestrelcomputer.com] 
Envoyé : lundi 9 janvier 2012 17:42
À : Arnaud Jean-Charles
Cc : 'Users'
Objet : Re: [Users] MapPanel refresh after a wmcFormat.read()

 

I'm not sure what exactly you are trying to do, but I can assure you that
you are doing wrong. 

map.destroy();

NO! Never destroy the map unless you want it really and truly gone for good.

var jsonFormat = new OpenLayers.Format.JSON();

var mapOptions = jsonFormat.read('{"allOverlays": true}');

OL.Format.JSON is for reading JSON "encoded" vector features into a layer.
You do NOT need this to simply set options. mapOptions = {allOverlays:true};
instead of the 2 lines and quoted strings you have used. However, again, you
should only be setting that once and creating the map once, NOT attempting
to fully destroy the map and recreate it everytime you want to read or
refresh a data source.

map   = wmcFormat.read(context, {map: mapOptions}); 

Instead of this you should use:
map.setOptions(wmcFormat.read(context,{map:mapOptions});

The FireFox error is : layers is null in MapPanel.js (ligne 301)

 

And do I have to re-build all the GeoExt widgets (ScaleStore, LegendPanel,
OverviewMap…) which are bind to my map ??


Thanks for the help

Arno





_______________________________________________
Users mailing list
 <mailto:Users@geoext.org> Users@geoext.org
 <http://www.geoext.org/cgi-bin/mailman/listinfo/users>
http://www.geoext.org/cgi-bin/mailman/listinfo/users

 

_______________________________________________
Users mailing list
Users@geoext.org
http://www.geoext.org/cgi-bin/mailman/listinfo/users

Reply via email to