<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=EN-US link=blue vlink=purple>
<div class=WordSection1>
<p class=MsoNormal><span style='color:#1F497D'>Guys,<o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'>Still need some help on this.<o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'>I have taken the simple app from
examples and edited it to see if I can make this work. It works but not the way
I expect it to work?<o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'>See : <a
href="http://staging.demos.numaps.com.au/shape_tester.html">http://staging.demos.numaps.com.au/shape_tester.html</a><o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'>I have extended the DrawFeature
control to echo out the coordinates of the vector generated polygon. When the
control is deactivated (controlled by the ‘navigate’ radio) the
notice function is triggered – not sure why? <o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'>I am trying to trigger this function
only when the control is activated. <o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'>Its just not doing what I would
have expected so I must be doing something really stupid. <o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'>Can someone have a quick look at
this for me?<o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'>Cheers.<o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'>Brad….<o:p></o:p></span></p>
<p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p>
<div>
<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'>
<p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span
style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>
users-bounces@openlayers.org [mailto:users-bounces@openlayers.org] <b>On Behalf
Of </b>Brad Spencer<br>
<b>Sent:</b> Friday, July 09, 2010 9:12 PM<br>
<b>To:</b> openlayers users<br>
<b>Subject:</b> [OpenLayers-Users] RegularPolygon as a search polygon<o:p></o:p></span></p>
</div>
</div>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>Guys,<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>I have been able to build a control to freehand digitize a
polygon and then launch a function to use the polygon as a search polygon in a
WFS request. <o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>This works for me:<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>drawControls = new OpenLayers.Control.DrawFeature(vectorLayer,
OpenLayers.Handler.Polygon) ;<o:p></o:p></p>
<p class=MsoNormal>
// extend the drawcontrol with its behavior<o:p></o:p></p>
<p class=MsoNormal>
OpenLayers.Util.extend(drawControls, <o:p></o:p></p>
<p class=MsoNormal>
{
draw: function (){<o:p></o:p></p>
<p class=MsoNormal style='margin-left:.5in;text-indent:.5in'>this.polygon = new
OpenLayers.Handler.Polygon(drawControls,{"done":
this.notice});
this.polygon.activate();},<o:p></o:p></p>
<p class=MsoNormal>
notice: function (polygon)<o:p></o:p></p>
<p class=MsoNormal>
{<o:p></o:p></p>
<p class=MsoNormal>
// get vertices of polygon into and array of coordinate pairs<o:p></o:p></p>
<p class=MsoNormal>
var polyString = polygon.toString() ;<o:p></o:p></p>
<p class=MsoNormal>
<o:p></o:p></p>
<p class=MsoNormal>
// do whatever with polygon linestring here<o:p></o:p></p>
<p class=MsoNormal style='margin-left:1.0in;text-indent:.5in'>…
<o:p></o:p></p>
<p class=MsoNormal>
}<o:p></o:p></p>
<p class=MsoNormal>
}); <o:p></o:p></p>
<p class=MsoNormal> map.addControl(drawControls);<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>I wanted to use the RegularPolygon feature to do the same
but it does not launch the function in the same way after the vector geometry
is successfully created. <o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>var polyType = 6;<o:p></o:p></p>
<p class=MsoNormal>var rad = ‘’;<o:p></o:p></p>
<p class=MsoNormal>polyOptions = {sides: polyType, radius: rad, angle: 0}<o:p></o:p></p>
<p class=MsoNormal>shapeControl = new
OpenLayers.Control.DrawFeature(vectorLayer, OpenLayers.Handler.RegularPolygon,
{handlerOptions: polyOptions});<o:p></o:p></p>
<p class=MsoNormal>
// extend the shapeControl with its behavior<o:p></o:p></p>
<p class=MsoNormal>
OpenLayers.Util.extend(shapeControl, <o:p></o:p></p>
<p class=MsoNormal>
{
draw: function (){<o:p></o:p></p>
<p class=MsoNormal>
this.polygon = new OpenLayers.Handler.RegularPolygon(shapeControl,
{"done": this.notice}); this.polygon.activate();},<o:p></o:p></p>
<p class=MsoNormal>
notice: function (polygon)<o:p></o:p></p>
<p class=MsoNormal>
{<o:p></o:p></p>
<p class=MsoNormal>
// get vertices of polygon into and array of coordinate pairs<o:p></o:p></p>
<p class=MsoNormal>
var polyString = polygon.toString() ;<o:p></o:p></p>
<p class=MsoNormal>
// do whatever with polygon linestring here<o:p></o:p></p>
<p class=MsoNormal>
…
<o:p></o:p></p>
<p class=MsoNormal>
}<o:p></o:p></p>
<p class=MsoNormal>
});<o:p></o:p></p>
<p class=MsoNormal> <o:p></o:p></p>
<p class=MsoNormal>In both cases the polygon is created and drawn to the
vectorLayer.<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>Can anyone see anything obviously wrong with the second
piece of code?<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>Cheers,<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal><b><span style='font-size:14.0pt'>Brad Spencer<o:p></o:p></span></b></p>
<p class=MsoNormal>General Manager <o:p></o:p></p>
<p class=MsoNormal>NuMaps<o:p></o:p></p>
<p class=MsoNormal><i>"DemographicDrapes"<o:p></o:p></i></p>
<p class=MsoNormal>www.numaps.com.au<o:p></o:p></p>
<p class=MsoNormal>brad@numaps.com.au<o:p></o:p></p>
<p class=MsoNormal>0404 841 131<o:p></o:p></p>
<p class=MsoNormal>(02)9481 7024<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>"<a
href="http://www.numaps.com.au/numaps/index.cfm/resources/resources/apps4nsw-competition-winner/">DemographicDrapes
wins NSW award</a>"<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
</div>
</body>
</html>