[OpenLayers-Users] FramedCloud with Layer.Text?

jericks JERICKS at co.pierce.wa.us
Thu May 1 11:10:13 EDT 2008


I ran into the exact same problem and came up with a small patch to
OpeLayers.Layer.Text that adds popupClass as a property.  When the
OpenLayers.Feature object is created it's popupClass property is set.  Very
useful for people dependent on Text layers.  I will attach the patch here,
but I should probably open a ticket right?

Thanks,
Jared

http://www.nabble.com/file/p16993296/text_popup_class_patch.patch
text_popup_class_patch.patch 




Christopher Schmidt-4 wrote:
> 
> On Mon, Apr 21, 2008 at 10:39:56AM -0400, Bobby H. Braswell wrote:
>> 
>> Hi-
>> 
>> Is there an example of using the framed cloud popups with a text layer  
>> in 2.6? In general can we specify the popup type when constructing a  
>> text layer?
> 
> Generally, the answer is 'no, and why are you still using a Layer.Text?
> Use a Layer.GML with a format: OpenLayers.Format.Text and a
> selectFeature control instead.' 
> 
> I understand that this is impractical for long running applications (we
> maintain backwards API compatibility for a reason, after all). 
> 
> Anyway, the following hacks will let you get something that I like a lot
> better for text layers:
> 
>         OpenLayers.Feature.prototype.popupClass =
> OpenLayers.Popup.FramedCloud;
> 
>         OpenLayers.Layer.Text.prototype.markerClick = function(evt) {
>             var sameMarkerClicked = (this == this.layer.selectedFeature);
>             if (this.popup) {
>                 this.popup.toggle(); 
>             } else {
>                 this.layer.map.addPopup(this.createPopup(true));
>             }
>             this.layer.selectedFeature = (!sameMarkerClicked) ? this :
> null;
>             OpenLayers.Event.stop(evt);        
>         }
> 
> Good Luck,
> -- 
> Christopher Schmidt
> MetaCarta
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
> 
> 

-- 
View this message in context: http://www.nabble.com/FramedCloud-with-Layer.Text--tp16811991p16993296.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.




More information about the Users mailing list