Try this :
var oMeasrLinearCtrlOptions =
{
title: 'bla bla bla',
displayUnits: 'km',
eventListeners:
{
'measure': handleMeasr,
'measurepartial': handleMeasr
},
handlerOptions:
{
persist: true
}
};
var oMeasrLinearCtrl = new
OpenLayers.Control.Measure ( OpenLayers.Handler.Path, oMeasrLinearCtrlOptions );
oToolbar.addControl ( oMeasrLinearCtrl, {
iconCls: 'measrlinear', toggleGroup: 'map' } );
function handleMeasr(event)
{
if(event.order==1) // LINEAR
displayMeasr (event.measure.toFixed(3) + " " + event.units, "");
else // POLYGON
{
var area = event.measure.toFixed(3) + " " + event.units;
var a = oMap.getControlsByClass('OpenLayers.Control.Measure');
var ctrl = a[0];
var length = (ctrl.getBestLength(event.geometry)[0]).toFixed(3) + " " +
ctrl.getBestLength(event.geometry)[1];
//displayMeasr (length, area);
}
}
James
________________________________
De: [email protected] de la part de RFeagin
Date: jeu. 19-03-09 11:38
À: [email protected]
Objet : [OpenLayers-Users] Measure Control - get distance on mouse move
Has anyone made the measure control get the distance on mouse move? After
the first point has been added it would be nice to see a 'real-time'
distance using the current mouse position as the final point.
Just thought I'd check to see if someone had already done it and was willing
to share.
Thanks
--
View this message in context:
http://n2.nabble.com/Measure-Control---get-distance-on-mouse-move-tp2503580p2503580.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
_______________________________________________
Users mailing list
[email protected]
http://openlayers.org/mailman/listinfo/users
_______________________________________________
Users mailing list
[email protected]
http://openlayers.org/mailman/listinfo/users