[OpenLayers-Users] Does anyone have an example of using the measure control in a toolbar?

Semantica jvanulde at nrcan.gc.ca
Tue Jan 13 11:45:58 EST 2009


I am having issues with this. For some reason, my control won't
activate/deactivate when the button is clicked. Here are a couple of
snippets:

var optionsLine = {
    handlerOptions: {
        style: "default", // this forces default render intent
        layerOptions: {styleMap: styleMap},
        persist: true
    },
    displayClass: 'olControlMeasureDistance'
};

var optionsPolygon = {
    handlerOptions: {
        style: "default", // this forces default render intent
        layerOptions: {styleMap: styleMap},
        persist: true
    },
    displayClass: 'olControlMeasureArea'
};

 measureControls = {
  line: new OpenLayers.Control.Measure(OpenLayers.Handler.Path,
optionsLine),
  polygon: new OpenLayers.Control.Measure(OpenLayers.Handler.Polygon,
optionsPolygon)
 };
                
// add the measure controls to the map    
var control;
for(var key in measureControls) {
  control = measureControls[key];
  control.events.on({
    "measure": handleMeasurements,
    "measurepartial": handleMeasurements
  });
}

panel.addControls([measureControls.line, measureControls.polygon]);
               
// add the panel to the map
map.addControl(panel);

Any ideas on what the problem might be?

Thank you in advance!


-- 
View this message in context: http://n2.nabble.com/Does-anyone-have-an-example-of-using-the-measure-control-in-a-toolbar--tp2152008p2152008.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.




More information about the Users mailing list