[OpenLayers-Users] Re: TransformFeature :deselect an item?

ulao S_K_U_N_X at yahoo.com
Fri Apr 8 14:49:45 EDT 2011


ok I finally found a way to trick the transform to deselect. There are over 5
topics floating around the net asking for such a simple little feature. As
they all agree, its just ridicules to have added a setfeature with out a
remove feature. So here us one work around.

modHandle is may array of handlers for each layer. I basically loop trough
them all and if the feature is selected I destroy and recreate it. Feel free
to use this in any way you can.



for (var i=0;i<modHandle.length;i++)
	{
		if (modHandle[ i ].feature)
		{
			var layer = modHandle[ i ].feature.layer;//get the layer
			modHandle[ i ].destroy();//kill the transform
			
			modHandle[ i ] = new OpenLayers.Control.TransformFeature(layer,
{//recreate it.
								renderIntent: "transform", 
								eventListeners: { beforesetfeature :Events.modify, setfeature
:Events.modifySet }}) 			
			Map.map2d.addControl( modHandle[ i ] ); modHandle[ i ].activate();//re
active it
		}
	}	


--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/TransformFeature-deselect-an-item-tp6199790p6254846.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.


More information about the Users mailing list