[OpenLayers-Users] Common style for points, lines and polygons
Yves Moisan
yves.moisan at boreal-is.com
Wed Nov 25 13:35:12 EST 2009
Thanx Arnd ! Works like a charm
Yves
> Hi,
>
> The way, you declare your common style, you set all not named properties of
> the common OL style to null. If you add pointRadius : 10 to your style, it
> should also work for points.
>
> I use
>
> var newStyle = new OpenLayers.Util.applyDefaults(
> {
> strokeColor: "black",
> strokeWidth: 1,
> strokeOpacity: 0.6,
> fillOpacity: 0.8
> }, OpenLayers.Feature.Vector.style["default"]
> );
>
> to declare a new style.
>
> Arnd
>
>
>
> -----Ursprüngliche Nachricht-----
> Von: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org] Im
> Auftrag von Yves Moisan
> Gesendet: Dienstag, 24. November 2009 21:01
> An: users
> Betreff: [OpenLayers-Users] Common style for points, lines and polygons
>
> Hi All,
>
> I'm trying to get a common style for any of (point,line,polygon). I thought
> something like :
>
> var s = new OpenLayers.Style({
> fillColor: "#0000FF",
> strokeColor: "#0000FF",
> strokeWidth: 2
> });
>
> var myStyles = new OpenLayers.StyleMap(s);
>
>
> would work, but I only get blue lines and nothing for points. I haven't
> tried polygons but I'm confident it works. I thought since all the
> properties defined in the style apply to all feature types I should expect
> blue points but instead I get nothing. I'm using OpenLayers trunk. Any clue
> ?
>
> TIA,
>
> Yves
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
More information about the Users
mailing list