Hi

This should be a simple question.
I'm working on limiting a path to one single line. What I did was to fire a function on "Point" event. A global var is counting the points created. In this function when the global var is 2, I have an alert which pops up fine.

What I want to do instead of the alert, is add the drawn line to a layer. 
Afterwords I deactivate the draw control, and that's it.

This is my DrawFeature control:
<pre>
...
line: new OpenLayers.Control.DrawFeature(vectors, OpenLayers.Handler.Path, {callbacks: { &quot;point&quot;: this.TwoClickPath.bind(this) }}),
...
</pre>
And this is the function that is being fired:
<pre>
TwoClickPath: function(e) {
    this.TwoClickPathCount++;
    if (this.TwoClickPathCount == 2) {
        /*
            Here I want to add the drawn line to a layer
        */  
        // alert(&quot;&quot;);  fires ok
        controls.line.deactivate();
        this.TwoClickPathCount = 0;
    }
},
</pre>

How do I add the drawn line to a layer without double-clicking?

Thanks in advance
Amit
<br><hr align="left" width="300">
View this message in context: <a href="http://n2.nabble.com/Get-drawn-feature-from-map-and-add-it-to-a-layer-tp3503203p3503203.html">Get drawn feature from map and add it to a layer.</a><br>
Sent from the <a href="http://n2.nabble.com/OpenLayers-Users-f1822463.html">OpenLayers Users mailing list archive</a> at Nabble.com.<br>