[Users] Change color line in OpenLayers.Handler.Path
Alexandre Dube
adube at mapgears.com
Fri Mar 4 14:37:35 CET 2011
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://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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20110304/f5f27d93/attachment-0001.htm
More information about the Users
mailing list