[OpenLayers-Users] Register click event on OpenLayers.Feature.Vector

Imran Rajjad rajjad at gmail.com
Wed Jun 9 05:09:58 EDT 2010


Hi Ju

try adding

onSelect : check after toggle to your OpenLayers.Control.SelectFeature

where check is

var check =function(e){
alert(e.feature.id);
}

try it

regards,
Imran

On Wed, Jun 9, 2010 at 2:03 PM, JuKiM <rifins at gmail.com> wrote:
> I've seen that this is happening when I reload the layers.. For cleaning the
> map and redraw other things..
> if (lyrTesting) {
>                 lyrTesting.destroy();
>             }
>             lyrTesting = new OpenLayers.Layer.Vector('Testing');
>             map.addLayer(lyrTesting);
> I'll investigate what is happening here..
> Thanks!
>
> 2010/6/9 JuKiM <rifins at gmail.com>
>>
>> Hi,
>> I'll take a look to your examples..
>> But after a little searching I'm trying do like this:
>> var polygonFeature = new OpenLayers.Feature.Vector(linearRing, null,
>> style_poly);
>> polygonFeature.data.OLPosition = position;
>> polygonFeature.data.infoContent = szInformation;
>> lyrTesting.addFeatures([polygonFeature]);
>> var hoverSelect = new OpenLayers.Control.SelectFeature(lyrTesting, {
>>        toggle: true,
>>        multiple: false,
>>        geometryTypes: ["OpenLayers.Geometry.LineString"],
>>        renderIntent: "temporary",
>>        eventListeners: {
>>            featurehighlighted: function(f) {
>>                var feature = new OpenLayers.Feature(lyrTesting,
>> f.feature.data.OLPosition);
>>                feature.closeBox = true;
>>                feature.popupClass = popupClass;
>>                feature.data.popupContentHTML = f.feature.data.infoContent;
>>                feature.data.overflow = (true) ? "auto" : "hidden";
>>                if (f.feature.popup == null) {
>>                    f.feature.popup =
>> feature.createPopup(feature.closeBox);
>>                    map.addPopup(f.feature.popup);
>>                    f.feature.popup.show();
>>                } else {
>>                    f.feature.popup.toggle();
>>                }
>>            },
>>            featureunhighlighted: function(f) {
>>                if (f.feature.popup != null) {
>>                    f.feature.popup.destroy();
>>                    f.feature.popup = undefined;
>>                }
>>            }
>>        }
>>    });
>>
>> The problem I get is when I try to redraw the map, an error is fired
>> saying that there is an error with style in the next function. (Says
>> that 'this.div.style' is undefined or not an object.)
>> getZIndex:function(){return this.div.style.zIndex;}
>> What I'm doing wrong?
>> Thanks!
>>
>>
>> 2010/6/8 giraam <sdjbm17 at gmail.com>
>>>
>>> Hi,
>>>
>>> Maybe you can find something useful here..
>>> http://trac.openlayers.org/wiki/UserRecipes
>>> http://trac.openlayers.org/wiki/UserRecipes  =)
>>>
>>> Regards,
>>>
>>> -----
>>> just another web developer
>>> --
>>> View this message in context:
>>> http://osgeo-org.1803224.n2.nabble.com/Register-click-event-on-OpenLayers-Feature-Vector-tp5154434p5155291.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
>>
>
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
>



-- 
I.R



More information about the Users mailing list