[OpenLayers-Users] Popup problems on different GML layers with GeoRSS format

Simo D simone.dalmasso at gmail.com
Thu May 14 06:53:56 EDT 2009


Thanks Christopher.
Now I downloaded the trunk SelectFeature, RootContainer and Openlayers.js.

I modified my code like this:
	var popups = new
OpenLayers.Control.SelectFeature([gdacs_earth,gdacs_flood,gdacs_cyclones],
GeorssPopups.init());
	map.addControl(popups);
	popups.activate();

But nothing changes...is there something wrong?

Thanks in advance.

Simone.


Christopher Schmidt-2 wrote:
> 
> On Wed, May 13, 2009 at 01:13:01PM -0700, Simo D wrote:
>> 
>> Hi list, I'm trying to add custom popups on three GML layers which
>> contains
>> GeoRSS feed.
>> 
>> My code is composed by three layers declarated like this.
>> 
>> var gdacs_earth = new OpenLayers.Layer.GML("Earthquakes (GDACS)",
>> "feedaddress", {format: georss_format, styleMap:
>> createStyle('iconpath')});	
>> 
>> Where georss_format is 	var georss_format = new
>> OpenLayers.Format.GeoRSS(in_options);
>> 
>> 
>> Then i attach three 	var eqpopups = new
>> OpenLayers.Control.SelectFeature(gdacs_earth, GeorssPopups.init());
>> map.addControl(eqpopups); eqpopups.activate(); 
> 
> Can't do that. Gotta do one, with three layers passed in the first arg,
> and that will only work in 2.8/trunk.
> 
> -- Chris
> 
>> obviously with different variable names.
>> 
>> GeorssPopups is a hash: 
>> 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;
>> 		    }
>> 		}
>> };
>> 
>> 
>> The problem is that on most browsers this solution works only for the
>> last
>> layer declarated except for Safari 4 where all works fine.
> 
> Safari 4 is whacked. The former is the expected behavior. This is
> because browsers will not let us catch events through the top SVG
> element on the lower level elements. As a result, we've extended the
> SelectFeature control to be able to take efeatures from *all* layers and
> put them in the same SVG element.
> 
>> It seems that the listener associated with the SelectFeture method
>> listens
>> only on the last GML layer declared. 
> 
>> If I declare one layer with GML class
>> and others with the GeoRSS class it works. 
> 
> Yes, Because the GeoRSS class uses markers, and doens't have the same
> behavior because no SVG is involved.
> 
>> I also tried to declare two
>> layers from GML with only one having the selectFeature associated and it
>> breaks, I can see the icons but no frameCloud appears.
> 
> The clicks aren't getting there.
> 
> 
>> Can you help me? Having nice popups on GeoRSS it's important.
>> -- 
>> View this message in context:
>> http://n2.nabble.com/Popup-problems-on-different-GML-layers-with-GeoRSS-format-tp2886288p2886288.html
>> Sent from the OpenLayers Users mailing list archive at Nabble.com.
>> 
>> _______________________________________________
>> Users mailing list
>> Users at openlayers.org
>> http://openlayers.org/mailman/listinfo/users
> 
> -- 
> Christopher Schmidt
> MetaCarta
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
> 
> 

-- 
View this message in context: http://n2.nabble.com/Popup-problems-on-different-GML-layers-with-GeoRSS-format-tp2886288p2889389.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.




More information about the Users mailing list