Currently in line draw mode, lines are draw by initially clicking the map, then moving the mouse to another point and subsequently clicking to continue adding segments to the line, finally double clicking to end the line. Is there a way to change the mechanics of drawing a line? Perhaps to simplify drawing a single line segment to mousing down to begin, dragging mouse and mousing up to end the segment?
Thanks,
Sarah
Simpler Line Drawing in EditOverlay
Hi Sarah,
Our Web control don’t support it directly with APIs, but as in the client side, we are using openlayers library as map engine to draw every thing and I guess may be the OpenLayers supports it by overwriting some codes but more complex.
I looked into OpenLayers source codes and the drawing line is related with path.js and if we overwrite the “up”,“move”,“down”, I think it is possible but may complex as you have to understand the codes means. github.com/openlayers/openlayers/blob/master/lib/OpenLayers/Handler/Path.js
The below codes shows how to override an openlayers class methods:
<
script
language
=
“javascript”
type
=
“text/javascript”
>
OnMapCreating = function () {
OpenLayers.Handler.Path.prototype.down = function(evt) {
…
}
OpenLayers.Handler.Path.prototype.move = function(evt) {
…
}
OpenLayers.Handler.Path.prototype.up = function(evt) {
…
}
}
Please let us know if you have any questions.
Thanks,
Troy
Hi Sarah,
We looked into openlayers further and found Openlayer has support it already. Please try the below codes:
<
script
language
=
"javascript"
type
=
"text/javascript"
>
OnMapCreating = function () {
OpenLayers.Handler.Path.prototype.maxVertices = 2;
}
Thanks,
Troy