0

when I customize handlerOptions of drawfeature, savestrategy does not work. Here's my code :

var handoptions = {
        handlerOptions: {
            freehand: true,
            style: {
                fillColor: "yellow",
                fillOpacity: 0.4,
                strokeColor: "green",
                strokeOpacity: 1,
                strokeWidth: 1,
                pointRadius: 6
            }
        }
    };

    draw = new OpenLayers.Control.DrawFeature(
       wfs_layer, OpenLayers.Handler.Point,handoptions,
       {
           //  title: "Draw Feature",
           //  displayClass: "olControlDrawFeaturePolygon",
           multi: true,
       }
       );

I don't know why ?

3

You need to set the 'handlerOptions' as one option of OpenLayers.Control.DrawFeature control. Following code should work.

var myHandlerOptions = {
    // freehand: true,    // Point handler does not have freehand mode
    style: {
        fillColor: "yellow",
        fillOpacity: 0.4,
        strokeColor: "green",
        strokeOpacity: 1,
        strokeWidth: 1,
        pointRadius: 6
    }
};

var drawControl = new OpenLayers.Control.DrawFeature(
    wfs_layer,
    OpenLayers.Handler.Point,
    {
        handlerOptions: myHandlerOptions,
        // title: "DrawFeature",
        // displayClass: "olControlDrawFeaturePolygon",
        multi: true
    }
);
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.