Hi,
I need to implenment a distance measurement function on the client side.
What I need for the function is that... when the users press down shift and ctrl keys (the distance measure mode will be enabled), they will be able to draw straight line on the map with the mouse and the distance will be measured and displayed on the map at the same time as they draw. Upon release of the shift and ctrl keys or mouseup, the line should disapear along with the meaured distance showed previously.
I can basically get this working. However, I have the following problems: 1) although I use Map1.SetDrawMode("Line")
, the line being drawn is not straight. 2)The line dispears when users release the shift and ctrl keys before mouse up, but the line stays on the map if mouse up is before the release of shift and ctrl keys..
what I do in the script like below..
function OnClientDrawEnd()
{
if (shiftDown && ctrlDown)
{
// Measurement for the line is done. Remove the line. Map1.CancelLatestFeature(); } }
And includ it in the cc1 tag in the Default.aspx file like this
<cc1:Map ID="Map1" runat="server" height="100%" width="100%" MapUnit="Meter"
onclientdrawend="OnClientDrawEnd">
</cc1:Map>
and I Map1.SetDrawMode("Line")
was called when the users press down shift and ctrl keys..
Hope you understand what I am talking about.. Can you show me how to fix this so that ... I can meet my requirement..that the line being drawn will be straight and after the distance measurement the line will be removed no matter whether the keys or the mouse are released first?
Thanks!
Roson