[OpenLayers-Users] Style for Drawfeature(Polygon/Path)

Alexandre Dube adube at mapgears.com
Wed Aug 6 08:23:53 EDT 2008


You can set it in the featureAdded function of your drawFeatureControl.  
Here's an example for MultiLineString.  Try to add the following :

        // featureAdded function
        oDrawControls['line'].featureAdded = function(oFeature) {
            oFeature.layer.eraseFeatures([oFeature]);
            // cast to multilinestring
            oFeature.geometry = new OpenLayers.Geometry.MultiLineString(
                oFeature.geometry
            );
*        oFeature.style = OpenLayers.Util.extend(
        {strokeColor:"#ff0000", strokeWidth: 3 }, oFeature.style);*

            oFeature.state = OpenLayers.State.INSERT;
            oFeature.layer.drawFeature(oFeature);
        }

Regards,

Alexandre

Dipl. Inf. Carsten Eider wrote:
> Any ideas where to setup the style for a drawfeatureControl?
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>   


-- 
Alexandre Dubé
Mapgears
www.mapgears.com




More information about the Users mailing list