[OpenLayers-Users] Polygon red and polygon gree
alexe100
imoveisnacionais at gmail.com
Sun Jun 3 09:09:33 PDT 2012
Hi
I aould like to let user draw polygons on map and using a optionbox define
their fill color (green or red)
Then, during runtime I would like to get all the drawn polygons vertices and
their fill color.
How can i do this?
I tried with
//cores para polygon layer
styleMapRed = new OpenLayers.StyleMap(OpenLayers.Util.applyDefaults
(
{fillColor: "red", fillOpacity: 0.25, strokeColor: "black"},
OpenLayers.Feature.Vector.style["RED"])
//OpenLayers.Feature.Vector.style["default"])
);
styleMapgreen = new OpenLayers.StyleMap(OpenLayers.Util.applyDefaults
(
{fillColor: "green", fillOpacity: 0.25, strokeColor: "black"},
OpenLayers.Feature.Vector.style["VERDE"])
//OpenLayers.Feature.Vector.style["default"])
);
polygonLayer = new OpenLayers.Layer.Vector("Polygon Layer",{styleMap:
styleMapGreen});
but during runtime I can not get the fill color.
var attribs=polygonLayer.features[i].attributes;
var tot=attribs.length;
Is it possible to apply a fill color per DrawFeature? How?
drawControls =
{
polygon: new
OpenLayers.Control.DrawFeature(polygonLayer,OpenLayers.Handler.Polygon)
};
Thanks a lot
Alex
--
View this message in context: http://osgeo-org.1560.n6.nabble.com/Polygon-red-and-polygon-gree-tp4978815.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
More information about the Users
mailing list