[OpenLayers-Users] Drawfeature question

Robert Sanson Robert.Sanson at asurequality.com
Wed Feb 22 21:11:39 EST 2012


I have a map where I load a vector polygon layer (crops) with source data coming from a database in WKT format. The layer is loaded when a button on the interface is pressed. I add DrawFeature, ModifyFeature and SelectFeature controls to the layer, which are selectively activated when a button on the interface is pressed.

...
map.addLayer(crops);
cropControls = {
                dpoly: new OpenLayers.Control.DrawFeature(crops,OpenLayers.Handler.Polygon,
			{displayClass: "olControlDrawFeaturePoint", title: "Draw Features", handlerOptions: {holeModifier: "altKey"}}),
                modify: new OpenLayers.Control.ModifyFeature(crops,{displayClass: "olControlModifyFeature", title: "Modify Features"}),
                delf: new OpenLayers.Control.SelectFeature(crops, {onSelect: function(feature) {feature.attributes.pstate = "del";
                                                                                                 feature.style = del_style;
                                                                                                 crops.drawFeature(feature);
                                                                                                 }
											}
									)
};
for(var key in cropControls) {
                map.addControl(cropControls[key]);
}
...
function newcrop() {
    var val = "dpoly";
    for(key in cropControls) {
                var crcontrol = cropControls[key];
                if(val == key) {
                    crcontrol.activate();
                } else {
                    crcontrol.deactivate();
                }
    }
    crops.onFeatureInsert = function(feature) {...}
}

My problem is that the DrawFeature control does not display the draw symbol (default circle) until after I digitise the first point.

How can I get the circle showing underneath my mouse cursor as soon as the DrawFeature control is activated?

Many thanks,

Robert Sanson



This email and any attachments are confidential and intended solely for the addressee(s). If you are not the intended recipient, please notify us immediately and then delete this email from your system.

This message has been scanned for Malware and Viruses by Websense Hosted Security.
www.websense.com


More information about the Users mailing list