Hi Alenxandre,

 

I've changed ,y code, but it doesn't work:

 

        var NewStyle = {strokeColor: "blue", strokeOpacity: "0.7", strokeWidth: 
2, fillColor: "blue", pointRadius: 3, cursor: "pointer"};

                               

        action = new GeoExt.Action({

            control: new OpenLayers.Control.Measure(OpenLayers.Handler.Path, 
{persist: true, style: NewStyle}),

           ....

 

Any idea?

 

Thanks again,

 

Toni.

 

De: Alexandre Dube [mailto:[email protected]] 
Enviat: viernes, 04 de marzo de 2011 14:38
Per a: Vidal, Antoni
A/c: [email protected]
Tema: Re: Change color line in OpenLayers.Handler.Path

 

Hi Vidal,

  You're problem isn't related to a GeoExt feature by the way.  "Styling a 
Vector feature" is purely OpenLayers oriented and you were right to post it to 
the OpenLayers-Users ML.

  If Firebug, if you look at the Handler.Path you create, you'll see that it 
has a 'layer' property.  It is a OpenLayers.Layer.Vector that is used to put 
the drawn features of the Handler.  Now, if you look at the 
./lib/OpenLayers/Handler/Path.js, you won't see the 'layer' property, but the 
constructor extends from OpenLayers.Handler.Point.  Looking at this one, you'll 
see the 'layer' property there and also a 'layerOptions', which is exactly what 
you're looking for : "{Object} Any optional properties to be set on the sketch 
layer".

  Use this property to style your sketch layer features by reading the 
documentation and example about styling I sent :
  http://docs.openlayers.org/library/feature_styling.html 
<http://docs.openlayers.org/library/feature_styling.html> 
  
http://trac.osgeo.org/openlayers/browser/branches/openlayers/2.10/lib/OpenLayers/Feature/Vector.js#L432

Best regards,

Alexandre


On 11-03-04 06:26 AM, Vidal, Antoni wrote: 

Hi Alexander,

 

You answered me in OL list but my problem is using GeoExt.

 

My code:

 

        action = new GeoExt.Action({

            control: new OpenLayers.Control.Measure(OpenLayers.Handler.Path, 
{persist: true}),

            tooltip: 'Line',

            map: map,

            iconCls: 'drawline',

            toggleGroup: 'tools'

        });

 

        action.control.events.on({

            "measure": handleMeasurement,

            "measurepartial": handleMeasurements

        });

 

        actions.push(action);

 

How can I change default orange color of drawned lines?

 

Thanks again

 

Antoni Vidal

Unitat d'Aplicacions SIG-WEB
Institut Cartogràfic de Catalunya 
<http://mercuri.icc.cat/website/mob_nf/mob1/mob2/inici2.htm?CONSULTA=Institut%20Cartogr%25E0fic%20de%20Catalunya&XYADDRESS=429486:4580392>
 
Parc de Montjuïc, E-08038 Barcelona
Tel. (+34) 93 567 15 00 (ext. 3228)
www.icc.cat <http://www.icc.cat/> 

 






-- 
Alexandre Dubé
Mapgears
www.mapgears.com
_______________________________________________
Users mailing list
[email protected]
http://www.geoext.org/cgi-bin/mailman/listinfo/users

Reply via email to