My map hosts a measure and a drawing control. The first should obviously perform client-side measuring, the drawing control should post the drawn geometry to the server on the featureAdded event.<br>The problem: after switching from drawing to measuring, the measuring control mimics the behaviour of the drawing control: the measurement geometry is also posted to the server after completing the measurement.<br>
<br>To circumvent this, I tried to restrict the controls to different vector layers, but had no success so far. Here is the relevant code snippet:<br><br>var plotLayer = new OpenLayers.Layer.Vector();<br>var drawControl = new OpenLayers.Control.DrawFeature(<br>
plotLayer, OpenLayers.Handler.Path,{ //plotLayer = vector layer for drawing control<br> handlerOptions: {maxVertices: 2, freehandMode: function (evt){return false;}},<br> featureAdded: function(feature){<br>
var drawnLine = feature;<br> var drawnLinePoints = feature.geometry.getVertices();<br> $.post ('webservice.url', {line: drawnLinePoints}, function(response){<br> self.displayPlots(response);<br>
})<br> }<br> });<br>var measureControl = new OpenLayers.Control.Measure(<br> OpenLayers.Handler.Path, {<br> persist: true,<br> layer: map.getLayersByName('vector')[0] //vector layer for measure control<br>
}<br>);<br>map.addControls([drawControl,measureControl]);<br><br>any ideas?<br><br>thanks,<br><br>Franz<br>