[OpenLayers-Dev] Popups on different GML Layers with SelectFeature

Simo D simone.dalmasso at gmail.com
Wed May 20 11:36:42 EDT 2009


Hi, now I tried to use the whole ol trun, but nothing changes. Maybe the
error could be in my implementation of the onSelect and onUnselect events of
the SelectFeature class:

var GeorssPopups = {
	init: function(){
		return  {onSelect: this.onFeatureSelect, onUnselect:
this.onFeatureUnselect};

	}	,
	onFeatureSelect: function(feature){
		  var popup = new OpenLayers.Popup.FramedCloud("featurePopup",
	                            feature.geometry.getBounds().getCenterLonLat(),
	                            new OpenLayers.Size(100,100),
	                            "<h2>"+feature.attributes.title + "</h2>" +
	                            feature.attributes.description,
	                            null, true,
function(){map.removePopup(feature.popup);
													    feature.popup.destroy();
													    feature.popup = null;});
	   feature.popup = popup;   
	   map.addPopup(popup);
	},
	onFeatureUnselect: function(feature) {
		    if (feature.popup) {        
		        map.removePopup(feature.popup);
		        feature.popup.destroy();
		        feature.popup = null;
		    }
		}
};

But it's strange because this worked for a single layer.
Thanks if anyone can help.


Simo D wrote:
> 
> Hi, this is the link:  http://130.192.92.159/mapfish/prove/sdi_layout.html
> Ithaca sdi .
> It's a blocking issue for me, so I really appreciate any advice.
> 
> Thanks a lot.
> Simone.
> 
> 
> Christopher Schmidt-2 wrote:
>> 
>> On Fri, May 15, 2009 at 06:13:28AM -0700, Simo D wrote:
>>> 
>>> Hi, I'm trying to use the new trunk SelectFeature and RootContainer to
>>> add
>>> custom popups on three different GML layers.
>>> Now I'm passing the layers as an array to the SelectFeature constructor.
>>> But
>>> nothing changes from the 2.7 api, in most browsers (except for safari
>>> 4),
>>> the popups don't show.
>>> This is the code:
>>> var popups = new
>>> OpenLayers.Control.SelectFeature([gdacs_earth,gdacs_cyclones,gdacs_floods],
>>> GeorssPopups.init());
>>> 	map.addControl(popups);
>>> 	popups.activate();
>>> 
>>> 
>>> GeorssPopups implements the onSelect and onUnselect events.
>>> 
>>> Is still there something wrong in my code?
>> 
>> It's hard to tell, since there's no information here about the *rest* of
>> your code. Can you give a link?
>> 
>> -- Chris
>> 
>>> Thanks in advance.
>>> 
>>> Simone
>>> -- 
>>> View this message in context:
>>> http://n2.nabble.com/Popups-on-different-GML-Layers-with-SelectFeature-tp2907685p2907685.html
>>> Sent from the OpenLayers Dev mailing list archive at Nabble.com.
>>> 
>>> _______________________________________________
>>> Dev mailing list
>>> Dev at openlayers.org
>>> http://openlayers.org/mailman/listinfo/dev
>> 
>> -- 
>> Christopher Schmidt
>> MetaCarta
>> _______________________________________________
>> Dev mailing list
>> Dev at openlayers.org
>> http://openlayers.org/mailman/listinfo/dev
>> 
>> 
> 
> 

-- 
View this message in context: http://n2.nabble.com/Popups-on-different-GML-Layers-with-SelectFeature-tp2907685p2946872.html
Sent from the OpenLayers Dev mailing list archive at Nabble.com.




More information about the Dev mailing list