[Users] Change color line in OpenLayers.Handler.Path
Alexandre Dube
adube at mapgears.com
Tue Mar 8 14:31:51 CET 2011
Hi,
I didn't mentioned "style" in my previous mail, but "layerOptions".
There is an example among those of OpenLayers demonstrating that (I
don't know why I didn't have the reflex to check there first) :
http://dev.openlayers.org/releases/OpenLayers-2.10/examples/measure.html
Regards,
Alexandre
On 11-03-08 05:51 AM, Vidal, Antoni wrote:
>
> 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:adube at mapgears.com]
> *Enviat:* viernes, 04 de marzo de 2011 14:38
> *Per a:* Vidal, Antoni
> *A/c:* users at geoext.org
> *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 <http://www.mapgears.com>
--
Alexandre Dubé
Mapgears
www.mapgears.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20110308/4a97bfab/attachment-0001.htm
More information about the Users
mailing list