[OpenLayers-Users] Need help changing fill/stroke colour for a
RegularPolygon
Ivan Grcic
igrcic at gmail.com
Fri Oct 9 04:51:06 EDT 2009
Hi, I dont think there is such symbolizer as RegularPolygon, thers
only symbolizers for Point, Line and Polygon. So Id try with Polygon.
Cheers
On Fri, Oct 9, 2009 at 6:01 AM, noosy
<vanessa.towers at dsto.defence.gov.au> wrote:
>
> Hi,
>
> I have the following code:
>
> var sketchSymbolizers = {
> "RegularPolygon": {
> strokeWidth: 2,
> strokeOpacity: 1,
> strokeColor: "#666666",
> fillColor: "#cbc7f0",
> fillOpacity: 0.3
> },
> "Point": {
> pointRadius: 4,
> graphicName: "square",
> fillColor: "white",
> fillOpacity: 1,
> strokeWidth: 1,
> strokeOpacity: 1,
> strokeColor: "#666666"
> },
> "Polygon": {
> strokeWidth: 2,
> strokeOpacity: 1,
> strokeColor: "#666666",
> fillColor: "#cbc7f0",
> fillOpacity: 0.3
> }
> };
>
> var style = new OpenLayers.Style();
> style.addRules([
> new OpenLayers.Rule({symbolizer: sketchSymbolizers})
> ]);
>
> var sm = new OpenLayers.StyleMap({"default": style});
>
> var polyOptions = {sides: 40, persist: true, layerOptions: {styleMap: sm}};
>
> var measureCirc = new GeoExt.Action({
> icon: './draw_circle_off.png',
> cls: 'x-btn-icon',
> control: new OpenLayers.Control.Measure(
> OpenLayers.Handler.RegularPolygon, {
> handlerOptions: polyOptions
> }
> ),
> map: mapPanel.map,
> // button options
> toggleGroup: "draw",
> allowDepress: true,
> // check item options
> group: "draw"
> });
>
> For some reason my circle is still orange :(
>
> The above code works fine with a OpenLayers.Handler.Polygon so what is the
> problem with the RegularPolygon?
>
> I have gone into Firebug and modified the following
>
> measureCirc -> control -> handler -> style -> fillColor -> "cbc7f0"
>
> ... and the colour changes to purple :) But I don't know how to do this
> programmatically as everything I have tried has had no effect. Please direct
> me as to how I can change the colour (so that it remains this colour on
> zoom/pan also) so long as the geometry persists.
>
> --
> View this message in context: http://n2.nabble.com/Need-help-changing-fill-stroke-colour-for-a-RegularPolygon-tp3792284p3792284.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
>
--
Ivan Grcic
More information about the Users
mailing list