[OpenLayers-Users] Fwd: pb with Strategy.Refresh

Sébastien Geindre sebastien.geindre at meteo.fr
Wed Jul 28 05:48:50 EDT 2010


Thanks for your answer.

I added a fresh function that close the popup open on the layer before 
refresh it :
new OpenLayers.Strategy.Refresh(
	{ force: true,
	  interval:  60000,
	  refresh: function()  {
	   if (this.layer && this.layer.refresh) {
	    while( this.layer.map.popups.length ) {
	     this.layer.map.removePopup(this.layer.map.popups[0]);
	    }
	    this.layer.refresh({force: this.force});
	   }
	  }
	 }
>
>> Hi Sebastien,
>>
>> The refresh strategy only reloads the layer, so the problem with the
>> Math.random key would be in the Http class i guess.
>>
>> I think that is due to the fact that you generate the number once
>> during construction of the Http class.
>>
>> The problem with the popup is also noticed by myself.
>> It is due to the fact that the popup is connected to the feature and
>> due to the refresh the features are removed and added again.
>> i solved this outside OpenLayers by closing the popup after a certain
>> time automatically.
>>
>> But i think this needs to be solved when removing the feature actually
>>
>> Hope this helps.
>> .
>> Met vriendelijke groet, Kind regards,
>> * *
>> *Kristiaan Geusebroek*
>> Consultant**
>> * *
>>
>>
>> *
>> *
>> Email: kgeusebroek at xebia.com <mailto:kgeusebroek at xebia.com>__
>> Tel: +31 (0)35 538 1921
>> Fax: +31 (0)35 538 1922
>> Mobiel: +31 (0)6 3069 7223**
>> * *
>> Utrechtseweg 49
>> 1213 TL Hilversum
>> The Netherlands
>> http://www.xebia.com <http://www.xebia.com/>
>> Xebia Blog: http://blog.xebia.com/
>> Xebia Podcast: http://podcast.xebia.com/
>>
>> On Jul 28, 2010, at 9:50 AM, Sébastien Geindre wrote:
>>
>>> hi all,
>>>
>>> Some pbs with Strategy.Refresh :
>>> Imagine the following layer :
>>>
>>> var layer = new OpenLayers.Layer.Vector("FIR+Sigmets", {
>>> strategies : [ new OpenLayers.Strategy.BBOX()
>>> ,new OpenLayers.Strategy.Refresh(
>>> {force: true, interval: 10000 } )] ,
>>> protocol : new OpenLayers.Protocol.HTTP( {
>>> url : "./xml/data.xml",
>>> params: { 'key': Math.random()},
>>> format : myformat
>>> }),
>>> styleMap : new OpenLayers.StyleMap(style),
>>> renderers : [ "Canvas", "SVG", "VML" ],
>>> projection : map.displayProjection
>>> });
>>>
>>> I noticed *2 pbs :
>>>
>>> 1/ If i add a control select : selectControl = new
>>> OpenLayers.Control.SelectFeature(layer), with an open popup on feature
>>> selection. The pb is that when the layer is refreshed, the popups are
>>> not erased...The layer changed, and it is not possible to access to the
>>> layer used to create popup...
>>>
>>> 2/ In the example, note that the url of protocol.HTTP includes a
>>> Math.random() key. Refresh process does not seem to generate again the
>>> key param...
>>>
>>> any help during this hot summer ?
>>>
>>> _______________________________________________
>>> Users mailing list
>>> Users at openlayers.org <mailto:Users at openlayers.org>
>>> http://openlayers.org/mailman/listinfo/users
>>
>
>
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users





More information about the Users mailing list