<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="ProgId" content="Word.Document"><meta name="Generator" content="Microsoft Word 12"><meta name="Originator" content="Microsoft Word 12"><link rel="File-List" href="file:///C:%5CUsers%5Chlam%5CAppData%5CLocal%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_filelist.xml"><link rel="themeData" href="file:///C:%5CUsers%5Chlam%5CAppData%5CLocal%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_themedata.thmx"><link rel="colorSchemeMapping" href="file:///C:%5CUsers%5Chlam%5CAppData%5CLocal%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_colorschememapping.xml"><style>
<!--
/* Font Definitions */
@font-face
        {font-family:"MS Mincho";
        panose-1:2 2 6 9 4 2 5 8 3 4;
        mso-font-alt:"?l?r ??fc";
        mso-font-charset:128;
        mso-generic-font-family:modern;
        mso-font-pitch:fixed;
        mso-font-signature:-536870145 1791491579 18 0 131231 0;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;
        mso-font-charset:0;
        mso-generic-font-family:roman;
        mso-font-pitch:variable;
        mso-font-signature:-1610611985 1107304683 0 0 159 0;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;
        mso-font-charset:0;
        mso-generic-font-family:swiss;
        mso-font-pitch:variable;
        mso-font-signature:-1610611985 1073750139 0 0 159 0;}
@font-face
        {font-family:"\@MS Mincho";
        panose-1:2 2 6 9 4 2 5 8 3 4;
        mso-font-charset:128;
        mso-generic-font-family:modern;
        mso-font-pitch:fixed;
        mso-font-signature:-536870145 1791491579 18 0 131231 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {mso-style-unhide:no;
        mso-style-qformat:yes;
        mso-style-parent:"";
        margin:0in;
        margin-bottom:.0001pt;
        mso-pagination:widow-orphan;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        mso-ascii-font-family:Calibri;
        mso-ascii-theme-font:minor-latin;
        mso-fareast-font-family:"MS Mincho";
        mso-fareast-theme-font:minor-fareast;
        mso-hansi-font-family:Calibri;
        mso-hansi-theme-font:minor-latin;
        mso-bidi-font-family:"Times New Roman";
        mso-bidi-theme-font:minor-bidi;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        mso-themecolor:hyperlink;
        text-decoration:underline;
        text-underline:single;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-noshow:yes;
        mso-style-priority:99;
        color:purple;
        mso-themecolor:followedhyperlink;
        text-decoration:underline;
        text-underline:single;}
span.EmailStyle16
        {mso-style-type:personal;
        mso-style-noshow:yes;
        mso-style-unhide:no;
        mso-ansi-font-size:11.0pt;
        mso-bidi-font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        mso-ascii-font-family:Calibri;
        mso-ascii-theme-font:minor-latin;
        mso-fareast-font-family:"MS Mincho";
        mso-fareast-theme-font:minor-fareast;
        mso-hansi-font-family:Calibri;
        mso-hansi-theme-font:minor-latin;
        mso-bidi-font-family:"Times New Roman";
        mso-bidi-theme-font:minor-bidi;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        mso-default-props:yes;
        mso-ascii-font-family:Calibri;
        mso-ascii-theme-font:minor-latin;
        mso-fareast-font-family:"MS Mincho";
        mso-fareast-theme-font:minor-fareast;
        mso-hansi-font-family:Calibri;
        mso-hansi-theme-font:minor-latin;
        mso-bidi-font-family:"Times New Roman";
        mso-bidi-theme-font:minor-bidi;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;
        mso-header-margin:.5in;
        mso-footer-margin:.5in;
        mso-paper-source:0;}
div.Section1
        {page:Section1;}
-->
</style>
<p class="MsoNormal">Hello community! This is my first post; I hope I'm not asking too trivial a question. :) I'll get right into it:<br></p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">Based on this example -- <a href="http://www.openlayers.org/dev/examples/drag-feature.html">http://www.openlayers.org/dev/examples/drag-feature.html</a>
-- I have put a similar control on my website where I can draw a polygon on my
map. So what I want to do is get the coordinates of my polygon’s
vertices after I finish drawing it.</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">According to</p>
<p class="MsoNormal"><a href="http://dev.openlayers.org/releases/OpenLayers-2.8/doc/apidocs/files/OpenLayers/Handler/Polygon-js.html">http://dev.openlayers.org/releases/OpenLayers-2.8/doc/apidocs/files/OpenLayers/Handler/Polygon-js.html</a></p>
<p class="MsoNormal">there are callback functions called ‘point’ and ‘done’ that
should be able to give me what I want.</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">My question is how do I get control of those functions? <span style=""> </span>I think I am a little lacking in syntax
knowledge as to how to set it up.</p><p class="MsoNormal"><br></p>
<p class="MsoNormal">For example I have:</p>
<p class="MsoNormal"><span style="font-family: "Courier New";">var drawpoly = new OpenLayers.Control.DrawFeature(vectorLayer,
OpenLayers.Handler.Polygon);</span></p>
<p class="MsoNormal"><span style="font-family: "Courier New";">map.addControl(drawpoly);</span></p>
<p class="MsoNormal">which takes care of enabling the drawing feature.<span style=""> </span>But I don’t know how to get to the done()
callback function from here.</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">On a separate note, I found this example online:</p>
<p class="MsoNormal"><span style="font-family: "Courier New";">var drawpoly = new OpenLayers.Control.DrawFeature(vectorLayer,
OpenLayers.Handler.Polygon, {'featureAdded': polygonAdded});</span></p>
<p class="MsoNormal"><span style="font-family: "Courier New";">...</span></p>
<p class="MsoNormal"><span style="font-family: "Courier New";">polygonAdded =
function (feature) {</span></p>
<p class="MsoNormal" style="text-indent: 4.5pt;"><span style="font-family: "Courier New";"><span style=""> </span>//Yay, I can do stuff here!</span></p>
<p class="MsoNormal"><span style="font-family: "Courier New";">}</span></p>
<p class="MsoNormal">which is pretty close to what I want, but I think the object
passed to it is not the polygon object I want to manipulate.<span style="">
</span>(Or is it?)</p>
<p class="MsoNormal"><br></p><p class="MsoNormal">If anyone has a better way to get the coordinates of a polygon (I assume I'd get an x-y pixel value first and would have to convert to lat/lng), I'd love to hear that, too. But knowing how to get to the callbacks would also be useful in future applications. :)<br>
</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">Thanks for reading and considering!</p><p class="MsoNormal"><br></p><p class="MsoNormal">--Harry</p><p class="MsoNormal"><a href="mailto:mr.harry.lam@gmail.com">mr.harry.lam@gmail.com</a><br><span style=""></span></p>