An example of my use case could be that we have 5 different features in a
layer. Let's say it's:
powerlines (red lines),
sewerlines (blue lines),
telephone lines (dotted green),
trees (image/point)
and buildings (red polygons).
Then I thought that the easiest way would be to create 5 drawFeature
Is there no way to set it in the drawFeature control's constructor?
--
View this message in context:
http://n2.nabble.com/Styling-a-feature-through-drawFeature-s-constructor-tp4674311p4701966.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
On Tue, Mar 9, 2010 at 3:53 PM, Frost89 kristian_fro...@hotmail.com wrote:
Is there no way to set it in the drawFeature control's constructor?
How about using a StyleMap in your layer?
--
Eric Lemoine
Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex
Tel : 00 33
Hi list,
I have added a control to my map to draw a polygon. Now I would like to give
this polygon a style, so I tried this:
redlining: new OpenLayers.Control.DrawFeature(vectorLayer,
OpenLayers.Handler.Polygon, {
type: OpenLayers.Control.TYPE_TOOL,
style: { fillColor: 'yellow' }
})
Krisitan,
You could register a featureadded event to your DrawControl to affect
a unique style, something like this (untested) :
yourControl.events.on({
featureadded: onPolygonDrawn,
scope: this
});
function onPolygonDrawn(event) {
var feature = event.feature;
// create a symbolizer from