<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<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>
</body>
</html>