[OpenLayers-Users] any click events in Control.DrawFeature
while drawing polygon
Eric Lemoine
eric.c2c at gmail.com
Wed Jun 13 00:39:33 EDT 2007
On 6/12/07, Richard Duivenvoorde <rdmailings at duif.net> wrote:
> Hi,
>
> I'm using the DrawFeature control to let users define linestrings. I can
> capture the doubleclick event (for ending the line) using
> lineLayer.onFeatureInsert
>
> But I cannot find a way to check something WHILE clicking/adding the
> segments. Actually on the addition of every segment I want to be able to
> count the number of segments, because I want to be sure the will be not
> more then 20 segments in certain lines.
Hi Richard,
Looking at the code I think you can pass a "point callback" to the
DrawFeature constructor.
Try something like that (untested):
var cnt = 0;
function counter(geometries) {
cnt++;
}
new OpenLayers.Control.DrawFeature(
layer,
OpenLayers.Handler.Path,
{ callbacks: { point: counter }}
);
--
Eric
More information about the Users
mailing list