<html><head></head><body bgcolor="#FFFFFF"><div>Hi, </div><div><br></div><div>Thanks for a really in depth answer. It really explains it well.</div><div><br></div><div>Unfortunately my javascript skills are pretty basic at the moment, so a lot of that went over my head<span class="Apple-style-span" style="-webkit-tap-highlight-color: rgba(26, 26, 26, 0.292969); -webkit-composition-fill-color: rgba(175, 192, 227, 0.230469); -webkit-composition-frame-color: rgba(77, 128, 180, 0.230469);">!</span></div><div><span class="Apple-style-span" style="-webkit-tap-highlight-color: rgba(26, 26, 26, 0.292969); -webkit-composition-fill-color: rgba(175, 192, 227, 0.230469); -webkit-composition-frame-color: rgba(77, 128, 180, 0.230469);"><br></span></div><div><span class="Apple-style-span" style="-webkit-tap-highlight-color: rgba(26, 26, 26, 0.292969); -webkit-composition-fill-color: rgba(175, 192, 227, 0.230469); -webkit-composition-frame-color: rgba(77, 128, 180, 0.230469);">I like the sound of the vertexselection event on the vector layer class. Could you give me a few more hints about how this might work?</span></div><div><span class="Apple-style-span" style="-webkit-tap-highlight-color: rgba(26, 26, 26, 0.292969); -webkit-composition-fill-color: rgba(175, 192, 227, 0.230469); -webkit-composition-frame-color: rgba(77, 128, 180, 0.230469);"><br></span></div><div><span class="Apple-style-span" style="-webkit-tap-highlight-color: rgba(26, 26, 26, 0.292969); -webkit-composition-fill-color: rgba(175, 192, 227, 0.230469); -webkit-composition-frame-color: rgba(77, 128, 180, 0.230469);">Or even better give me an example bit of code :)</span></div><div><span class="Apple-style-span" style="-webkit-tap-highlight-color: rgba(26, 26, 26, 0.292969); -webkit-composition-fill-color: rgba(175, 192, 227, 0.230469); -webkit-composition-frame-color: rgba(77, 128, 180, 0.230469);"><br></span></div><span class="Apple-style-span" style="-webkit-tap-highlight-color: rgba(26, 26, 26, 0.292969); -webkit-composition-fill-color: rgba(175, 192, 227, 0.230469); -webkit-composition-frame-color: rgba(77, 128, 180, 0.230469); ">We would need to be able to access the vertex index of the selected vertex, and i guess there would have to be a method of removing the vertex from the feature, which would trigger a redraw of the feature on the map.</span><div><span class="Apple-style-span" style="-webkit-tap-highlight-color: rgba(26, 26, 26, 0.292969); -webkit-composition-fill-color: rgba(175, 192, 227, 0.230469); -webkit-composition-frame-color: rgba(77, 128, 180, 0.230469);"><br></span></div><div><span class="Apple-style-span" style="-webkit-tap-highlight-color: rgba(26, 26, 26, 0.292969); -webkit-composition-fill-color: rgba(175, 192, 227, 0.230469); -webkit-composition-frame-color: rgba(77, 128, 180, 0.230469);">We would have to also be able to define a style for that selected vertex too, and i suppose add some error trap to ensure that we can't select a virtual vertex?<br></span></div><div><div><span class="Apple-style-span" style="-webkit-tap-highlight-color: rgba(26, 26, 26, 0.292969); -webkit-composition-fill-color: rgba(175, 192, 227, 0.230469); -webkit-composition-frame-color: rgba(77, 128, 180, 0.230469);"><br></span></div><div><span class="Apple-style-span" style="-webkit-tap-highlight-color: rgba(26, 26, 26, 0.292969); -webkit-composition-fill-color: rgba(175, 192, 227, 0.230469); -webkit-composition-frame-color: rgba(77, 128, 180, 0.230469);">Thanks again,</span></div><div><span class="Apple-style-span" style="-webkit-tap-highlight-color: rgba(26, 26, 26, 0.292969); -webkit-composition-fill-color: rgba(175, 192, 227, 0.230469); -webkit-composition-frame-color: rgba(77, 128, 180, 0.230469);"><br></span></div><div><span class="Apple-style-span" style="-webkit-tap-highlight-color: rgba(26, 26, 26, 0.292969); -webkit-composition-fill-color: rgba(175, 192, 227, 0.230469); -webkit-composition-frame-color: rgba(77, 128, 180, 0.230469);">Rob</span></div><div><br><br></div><div><br>On 27 Feb 2013, at 13:51, "Alexandre Dubé" <<a href="mailto:adube@mapgears.com">adube@mapgears.com</a>> wrote:<br><br></div><div></div><blockquote type="cite"><div>
  
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  
  
    <div class="moz-cite-prefix">Hi Rob,<br>
      <br>
        This would indeed be a nice feature to have.  Looking at the
      ModifyFeature control, I think this could be easily accomplished
      with minor modifications.<br>
      <br>
        If we look at the ModifyFeature control, it creates a
      DragFeature control to allow dragging the vertices around.  When
      you "mouse hover" a vertex feature, a callback function is
      triggered because it was defined here :<br>
         
<a class="moz-txt-link-freetext" href="https://github.com/openlayers/openlayers/blob/master/lib/OpenLayers/Control/ModifyFeature.js#L267">https://github.com/openlayers/openlayers/blob/master/lib/OpenLayers/Control/ModifyFeature.js#L267</a><br>
      <br>
        That's the callbacks for the OpenLayers.Handler.Feature object
      the drag control needs to interact with features on the map.  The
      drag control defines its callbacks method in the featureCallbacks
      object :<br>
         
<a class="moz-txt-link-freetext" href="https://github.com/openlayers/openlayers/blob/master/lib/OpenLayers/Control/DragFeature.js#L119">https://github.com/openlayers/openlayers/blob/master/lib/OpenLayers/Control/DragFeature.js#L119</a><br>
      <br>
        and here's the list of callbacks you can set to a feature
      handler: click, clickout, over, out, and dblclick.<br>
         
<a class="moz-txt-link-freetext" href="https://github.com/openlayers/openlayers/blob/master/lib/OpenLayers/Handler/Feature.js#L30">https://github.com/openlayers/openlayers/blob/master/lib/OpenLayers/Handler/Feature.js#L30</a><br>
      <br>
        So, back in the ModifyFeature control, you could add a 'click'
      callback function just next to the 'over' one.  Instead of coding
      what you want it to do directly in the source, just define an
      abstract function that needs to be overriden OR you could fire an
      new vector layer event : vertexselected (which would need to be
      added to OpenLayer.Layer.Vector).<br>
      <br>
        Whoa, sorry for the long reply :)   In short, try to create a
      delegate method or event we could register to to do whatever we
      wanted on vertex selection.<br>
      <br>
        Does that make sense ?<br>
      <br>
      HTH,<br>
      <br>
      Alexandre<br>
      <br>
      <br>
      On 13-02-26 11:42 AM, Robert Smart wrote:<br>
    </div>
    <blockquote cite="mid:SNT127-DS253CEE7303DEA8D2C4CA9AAFC0@phx.gbl" type="cite">
      <div dir="ltr">
        <div style="FONT-FAMILY: 'Calibri'; COLOR: #000000; FONT-SIZE:
          12pt"><font face="Times New Roman">Hi All,<br>
            <br>
            I'm trying to port some existing functionality into open
            layers and have <br>
            managed to get most of it working. I'm just stuck on a
            seemingly simple <br>
            task.<br>
            <br>
            The current code allows a user to highlight a polygon vertex
            by clicking on <br>
            it (which changes its colour), so that the user can then
            press a delete <br>
            button to remove the vertex.<br>
            <br>
            Using the modify control I'm able to display the vertices,
            and even delete <br>
            them if I click on it and then press 'del' on my keyboard,
            but this is not a <br>
            great solution as there is no visual clue as to what vertex
            has been <br>
            selected.<br>
            <br>
            So is there a way to highlight or change the colour of a
            single vertex the <br>
            user has clicked on? is there then a way to remove that
            vertex via code and <br>
            have the polygon redraw on the screen to suit?<br>
            <br>
            I think this would actually be quite useful as a standard
            feature as there <br>
            are many cases where one might want to select an individual
            vertex.<br>
            <br>
            Thanks,<br>
            <br>
            Rob</font> </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@lists.osgeo.org">Users@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/openlayers-users">http://lists.osgeo.org/mailman/listinfo/openlayers-users</a>
</pre>
    </blockquote>
    <br>
    <br>
    <pre class="moz-signature" cols="72">-- 
Alexandre Dubé
Mapgears
<a class="moz-txt-link-abbreviated" href="http://www.mapgears.com">www.mapgears.com</a>
</pre>
  

</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>Users mailing list</span><br><span><a href="mailto:Users@lists.osgeo.org">Users@lists.osgeo.org</a></span><br><span><a href="http://lists.osgeo.org/mailman/listinfo/openlayers-users">http://lists.osgeo.org/mailman/listinfo/openlayers-users</a></span><br></div></blockquote></div></body></html>