You have to define a select renderIntent with the wanted visuals for
highlighting.
For example, at creating the vectorlayer:
var style = new OpenLayers.Style(
// the first argument is a base symbolizer
// all other symbolizers in rules will extend this one
{
graphicWidth: 21,
graphicHeight: 21,
graphicYOffset: -28, // shift graphic up 28 pixels
label: "${label}",
symbolizer: {
externalGraphic: "../../images/treeview/radio_rood.gif"
}
}
}
);
var selectstyle = new OpenLayers.Style(
// the first argument is a base symbolizer
// all other symbolizers in rules will extend this one
{
graphicWidth: 31,
graphicHeight: 31,
graphicYOffset: -28, // shift graphic up 28 pixels
label: "${label}",
symbolizer: {
externalGraphic: "../../images/treeview/radio_rood.gif"
}
}
}
);
this.vectorLayer = new OpenLayers.Layer.Vector("Points", {
styleMap: new OpenLayers.StyleMap( {
"default": style,
"select": selectstyle
})
}
);
And then (for example) use a selectfeaturecontrol for selecting the features
(on
var select = new OpenLayers.Control.SelectFeature(this.vectorLayer, {hover:
true});
this.map.addControl(select);
select.activate();
Met vriendelijke groet,
Meine Toonen
B3Partners BV
Tel: 030 214 2083
Jerome A. Wendell <[email protected]> , 15-1-2013 22:24:
I have a map where I have selected a feature by attribute, and then centered
and zoomed to the feature using the following:
vectorlayer.events.register('loadend', vectorlayer, function ()
{
var selfeatures =
vectorlayer.getFeaturesByAttribute("description","description");
map.setCenter(selfeatures[0].geometry.getCentroid());
map.zoomToExtent(selfeatures[0].geometry.getBounds());
});
I am having trouble getting the feature to highlight. My select control for
the map uses a popup. Could this be the problem? Do I need a second control
to highlight the feature?
Any suggestions are appreciated.
Thanks,
Jerome Wendell
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users