can't manage my first control <br><br>hi,<br><br>I am still trying to develop a new control for my application. The control is called ParallelLine. I am sorry to bother you with this again. <br>I copied most of the code from ModifyFeature control as Ivan suggested.<br>
<br>As in the ModifyFeature control, this new control includes a selectControl variable. <br><br>The problem is that when I activate my control the selectControl variables seems not to be propperly initialized.<br><br>To test it, I added an alert to the SelectFeature activate method to see if it is called when instanciating the selectControl variable of my new control. And it isn't. I have tried to see what happen when I activate the original ModifyFeature, and of course, it works fine.<br>
<br>I think I have forgotten to change some url. Otherwise I do not have any idea what is going on.<br>I must have you all quite confused.<br><br>/////////////////////////////////////////////////////////////////<br>This is how I call the js files.<br>
/////////////////////////////////////////////////////////////////<br><br><script src="../OpenLayers.js"></script><br><script src="../lib/OpenLayers/Control/ParallelLine.js"></script><br>
<br>/////////////////////////////////////////////////////////////////<br>This is how I initialize the parallelLine control<br>/////////////////////////////////////////////////////////////////<br> initialize: function(layer, options) {<br>
this.layer = layer;<br> OpenLayers.Control.prototype.initialize.apply(this, [options]);<br><br> var control = this;<br> var selectOptions = {<br> geometryTypes: this.geometryTypes,<br> hover: true,<br>
clickout: this.clickout,<br> toggle: this.toggle<br> };<br><br> this.selectControl = new OpenLayers.Control.SelectFeature(<br> this.layer, selectOptions<br> );<br><br>
this.layer.events.on({<br> "beforefeatureselected": this.beforeSelectFeature,<br> "selectFeature": this.selectFeature,<br> scope: this<br> });<br> <br>
<br> // Regiter the events (sigte)<br> this.layer.events.register("mousemove", this, this.mmove );<br> this.layer.events.register("mousedown", this, this.mdown );<br> }<br><br>/////////////////////////////////////////////////////////////////<br>
This is how I activate the parallelLine control.<br>/////////////////////////////////////////////////////////////////<br> activate: function() {<br> //this function is called. Sure.<br> return (this.selectControl.activate() &&<br>
OpenLayers.Control.prototype.activate.apply(this, arguments));<br> }<br><br>This is the activate method from SelectFeature.js which seems to be never called.<br> /*From SelectFeature.js*/<br> activate: function () {<br>
alert("yes");<br> if (!this.active) {<br> this.handlers.feature.activate();<br> if(this.box && this.handlers.box) {<br> this.handlers.box.activate();<br> }<br>
}<br> return OpenLayers.Control.prototype.activate.apply(<br> this, arguments<br> );<br> }<br><br>I promise not to bother you again in one week.<br>ok two weeks then.<br>