<HTML><HEAD>
<META content="text/html; charset=UTF-8" http-equiv=Content-Type></HEAD>
<BODY dir=ltr bgColor=#ffffff text=#000000>
<DIV dir=ltr>
<DIV style="FONT-FAMILY: 'Calibri'; COLOR: #000000; FONT-SIZE: 12pt">
<DIV>Hi,</DIV>
<DIV> </DIV>
<DIV>Nice work! I could see this as being very useful to many people.</DIV>
<DIV> </DIV>
<DIV>A few comments though.</DIV>
<DIV> </DIV>
<DIV>This also picks up clicks on virtual vertices, which would need to be
changed.</DIV>
<DIV> </DIV>
<DIV>This there a way to define a style for the selected vertex? </DIV>
<DIV> </DIV>
<DIV>Is there a way to store a reference to the selected vertex in the modify
feature control? So that I could allow a user to select a vertex and then if
they choose to delete it, I can just pull out a reference to it in the code from
the modify feature. I suppose this could also just be a deleteSeletectedVertex
function on the modifyFeature control too.</DIV>
<DIV> </DIV>
<DIV>Is there a way to deselect the the vertex too? So if I click on it and it
changes its style to the ‘selected’ style, I can then click on it again to
deselect it?</DIV>
<DIV> </DIV>
<DIV>Thanks,</DIV>
<DIV> </DIV>
<DIV>Rob Smart</DIV>
<DIV> </DIV>
<DIV
style="FONT-STYLE: normal; DISPLAY: inline; FONT-FAMILY: 'Calibri'; COLOR: #000000; FONT-SIZE: small; FONT-WEIGHT: normal; TEXT-DECORATION: none">
<DIV style="FONT: 10pt tahoma">
<DIV> </DIV>
<DIV style="BACKGROUND: #f5f5f5">
<DIV style="font-color: black"><B>From:</B> <A title=adube@mapgears.com
href="mailto:adube@mapgears.com">Alexandre Dubé</A> </DIV>
<DIV><B>Sent:</B> Thursday, February 28, 2013 5:07 PM</DIV>
<DIV><B>To:</B> <A title=r_n_smart@hotmail.com
href="mailto:r_n_smart@hotmail.com">Robert Smart</A> </DIV>
<DIV><B>Cc:</B> <A title=openlayers-users@lists.osgeo.org
href="mailto:openlayers-users@lists.osgeo.org">openlayers-users@lists.osgeo.org</A>
</DIV>
<DIV><B>Subject:</B> Re: [OpenLayers-Users] ModifyControl Select/Delete
Vertex?</DIV></DIV></DIV>
<DIV> </DIV></DIV>
<DIV
style="FONT-STYLE: normal; DISPLAY: inline; FONT-FAMILY: 'Calibri'; COLOR: #000000; FONT-SIZE: small; FONT-WEIGHT: normal; TEXT-DECORATION: none">
<DIV class=moz-cite-prefix>Hi Rob,<BR><BR> This small example should give
you the idea I had in mind: <BR> <A
class=moz-txt-link-freetext
href="http://dev5.mapgears.com/openlayers/2.12/examples/modify-feature-vertex-click.html">http://dev5.mapgears.com/openlayers/2.12/examples/modify-feature-vertex-click.html</A><BR><BR>
You'll notice I extended the ModifyFeature control class. It's recommended to do
that than modifying the source code (in fact, you should never edit the source
code of a lib).<BR><BR> What do you think
?<BR><BR>HTH,<BR><BR>Alexandre<BR><BR><BR>On 13-02-28 09:42 AM, Robert Smart
wrote:<BR></DIV>
<BLOCKQUOTE cite=mid:SNT127-DS2051A3484053EDDCE625B1AAFE0@phx.gbl type="cite">
<DIV dir=ltr>
<DIV style="FONT-FAMILY: 'Calibri'; COLOR: #000000; FONT-SIZE: 12pt">
<DIV>Great! I’m using version 2.12. </DIV>
<DIV> </DIV>
<DIV>Thanks,</DIV>
<DIV> </DIV>
<DIV>Rob Smart</DIV>
<DIV
style="FONT-STYLE: normal; DISPLAY: inline; FONT-FAMILY: 'Calibri'; COLOR: #000000; FONT-SIZE: small; FONT-WEIGHT: normal; TEXT-DECORATION: none">
<DIV style="FONT: 10pt tahoma">
<DIV> </DIV>
<DIV style="BACKGROUND: #f5f5f5">
<DIV style="font-color: black"><B>From:</B> <A title=adube@mapgears.com
href="mailto:adube@mapgears.com" moz-do-not-send="true">Alexandre Dubé</A>
</DIV>
<DIV><B>Sent:</B> Thursday, February 28, 2013 1:59 PM</DIV>
<DIV><B>Cc:</B> <A title=openlayers-users@lists.osgeo.org
href="mailto:openlayers-users@lists.osgeo.org"
moz-do-not-send="true">openlayers-users@lists.osgeo.org</A> </DIV>
<DIV><B>Subject:</B> Re: [OpenLayers-Users] ModifyControl Select/Delete
Vertex?</DIV></DIV></DIV>
<DIV> </DIV></DIV>
<DIV
style="FONT-STYLE: normal; DISPLAY: inline; FONT-FAMILY: 'Calibri'; COLOR: #000000; FONT-SIZE: small; FONT-WEIGHT: normal; TEXT-DECORATION: none">
<DIV class=moz-cite-prefix>Sure, I'd be glad to help. What version do
you use ?<BR><BR>Alexandre<BR><BR><BR>On 13-02-27 12:36 PM, Robert Smart
wrote:<BR></DIV>
<BLOCKQUOTE cite=mid:SNT401-EAS1579FC4FA8B4C553CE487E6AAFD0@phx.gbl
type="cite">
<DIV>Hi, </DIV>
<DIV> </DIV>
<DIV>Thanks for a really in depth answer. It really explains it well.</DIV>
<DIV> </DIV>
<DIV>Unfortunately my javascript skills are pretty basic at the moment, so a
lot of that went over my head<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)"
class=Apple-style-span>!</SPAN></DIV>
<DIV><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)" class=Apple-style-span><BR></SPAN></DIV>
<DIV><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)" class=Apple-style-span>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 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)" class=Apple-style-span><BR></SPAN></DIV>
<DIV><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)" class=Apple-style-span>Or even better give me
an example bit of code :)</SPAN></DIV>
<DIV><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)" class=Apple-style-span><BR></SPAN></DIV><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)"
class=Apple-style-span>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 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)" class=Apple-style-span><BR></SPAN></DIV>
<DIV><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)" class=Apple-style-span>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 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)" class=Apple-style-span><BR></SPAN></DIV>
<DIV><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)" class=Apple-style-span>Thanks
again,</SPAN></DIV>
<DIV><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)" class=Apple-style-span><BR></SPAN></DIV>
<DIV><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)" class=Apple-style-span>Rob</SPAN></DIV>
<DIV><BR><BR></DIV>
<DIV><BR>On 27 Feb 2013, at 13:51, "Alexandre Dubé" <<A
href="mailto:adube@mapgears.com"
moz-do-not-send="true">adube@mapgears.com</A>> wrote:<BR><BR></DIV>
<BLOCKQUOTE type="cite">
<DIV>
<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"
moz-do-not-send="true">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"
moz-do-not-send="true">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"
moz-do-not-send="true">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" moz-do-not-send="true">Users@lists.osgeo.org</A>
<A class=moz-txt-link-freetext href="http://lists.osgeo.org/mailman/listinfo/openlayers-users" moz-do-not-send="true">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" moz-do-not-send="true">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"
moz-do-not-send="true">Users@lists.osgeo.org</A></SPAN><BR><SPAN><A
href="http://lists.osgeo.org/mailman/listinfo/openlayers-users"
moz-do-not-send="true">http://lists.osgeo.org/mailman/listinfo/openlayers-users</A></SPAN><BR></DIV></BLOCKQUOTE></DIV></BLOCKQUOTE><BR><BR><PRE class=moz-signature cols="72">--
Alexandre Dubé
Mapgears
<A class=moz-txt-link-abbreviated href="http://www.mapgears.com" moz-do-not-send="true">www.mapgears.com</A>
</PRE>
<HR>
_______________________________________________<BR>Users mailing list<BR><A
class=moz-txt-link-abbreviated
href="mailto:Users@lists.osgeo.org">Users@lists.osgeo.org</A><BR><A
class=moz-txt-link-freetext
href="http://lists.osgeo.org/mailman/listinfo/openlayers-users">http://lists.osgeo.org/mailman/listinfo/openlayers-users</A><BR></DIV></DIV></DIV></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></DIV></DIV></BODY></HTML>