<div dir="ltr"><div>Hello,</div>
<div> </div>
<div>I made a custom control in a separate *.js file which I want to use on my WMS layer to select a point there and with a WFS GetFeature request retrieve the geometry. The top part of the class looks as followed:</div>
<div> </div>
<div>------------------</div>
<div> Select = OpenLayers.Class(OpenLayers.Control, { <br> <br> layer: null,<br> <br> defaultHandlerOptions: {<br> 'single': true,<br> 'double': false,<br>
'pixelTolerance': 0,<br> 'stopSingle': false,<br> 'stopDouble': false<br> },</div>
<div> initialize: function(layer,options) {<br> this.layer = layer;<br> this.handlerOptions = OpenLayers.Util.extend(<br> {}, this.defaultHandlerOptions<br> );<br> OpenLayers.Control.prototype.initialize.apply(<br>
this, arguments<br> ); <br> this.handler = new OpenLayers.Handler.Click(<br> this, {<br> 'click': this.trigger<br> }, this.handlerOptions<br>
);<br> }, </div>
<div> </div>
<div>------------------------</div>
<div>When I user the 'layer' parameter : <b><font color="#0000c8" size="2">
<p>var</p></font></b><font size="2"> selectCcontrol = </font><b><font color="#0000c8" size="2">new</font></b><font size="2"> </font><font color="#0064c8" size="2">Select</font><font size="2">(wozSelectLayer, {</font><font color="#008000" size="2">'displayClass'</font><font size="2">: </font><font color="#008000" size="2">'olControlSelectFeature'</font><font size="2">}) ;</font>I get the error:<span class="objectBox objectBox-errorMessage hasBreakSwitch">
<div class="errorTitle">extent has no properties</div>
<div class="errorTrace"></div>
<div class="errorSourceBox errorSource-exec"><span class="errorSource">this.extent = extent.clone();</span></div>
<div class="logRow logRow-errorMessage"><a class="objectLink objectLink-sourceLink">Renderer.js (line 98)</a></div>
<div class="logRow logRow-errorMessage">I need the layer in this class and without it the eror doesn't occur. What am I doing wrong?</div>
<div class="logRow logRow-errorMessage"> </div>
<div class="logRow logRow-errorMessage">Best regards,</div>
<div class="logRow logRow-errorMessage"> </div>
<div class="logRow logRow-errorMessage">Bas Couwenberg</div>
<div class="logRow logRow-errorMessage"></div></span> </div></div>