User Tools

Site Tools


tecnica:gps_cartografia_gis:openlayers_style

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Last revisionBoth sides next revision
tecnica:gps_cartografia_gis:openlayers_style [2010/01/26 10:27] niccolotecnica:gps_cartografia_gis:openlayers_style [2011/07/15 16:02] – [Utilizzare l'oggetto StyleMap] niccolo
Line 66: Line 66:
  
 <code javascript> <code javascript>
-{{{ 
 var styleMap = new OpenLayers.StyleMap({ var styleMap = new OpenLayers.StyleMap({
     "default": {     "default": {
Line 75: Line 74:
         fillColor: "yellow"}         fillColor: "yellow"}
 }); });
-}}}+</code> 
 + 
 +===== Definire lo stile di un Vector layer ===== 
 + 
 +Esempio: 
 + 
 +<code javascript> 
 +var style = new OpenLayers.Style(); 
 + 
 +style.strokeColor = strokeColor; 
 +style.strokeWidth = strokeWidth; 
 +style.strokeOpacity = strokeOpacity; 
 +style.fillColor = fillColor; 
 +style.fillOpacity = fillOpacity; 
 + 
 +var vector = new OpenLayers.Layer.Vector(label, {'style': style}); 
 +vector.addFeatures( 
 +    new OpenLayers.Feature.Vector( 
 +        new OpenLayers.Geometry.LinearRing(points_array), 
 +        null, 
 +        style 
 +    ) 
 +);
 </code> </code>
  
tecnica/gps_cartografia_gis/openlayers_style.txt · Last modified: 2011/07/15 16:03 by niccolo