{
// Try to find the edge that is closest to a ray passing through the screen point. We're trying to determine
// the user's intent as to which edge a new two control points should be added to.
Line ray = super._wwd.getView().computeRayFromScreenPoint(mousePoint.getX(), mousePoint.getY());
Vec4 pickPoint = super._intersectPolygonAltitudeAt(ray);
double nearestDistance = Double.MAX_VALUE;
int newVertexIndex = 0;
// Loop through the control points and determine which edge is closest to the pick point
for (int i = 0; i < this._lstMarkerControlPoints.size()-1; i++)
{
GfrMrkMoveAbs thisMarker = (GfrMrkMoveAbs) this._lstMarkerControlPoints.get(i);
GfrMrkMoveAbs nextMarker = (GfrMrkMoveAbs) this._lstMarkerControlPoints.get(
(i + 1) % this._lstMarkerControlPoints.size());
Vec4 pointOnEdge = AirspaceEditorUtil.nearestPointOnSegment(thisMarker.getPoint(), nextMarker.getPoint(), pickPoint);
if (!AirspaceEditorUtil.isPointBehindLineOrigin(ray, pointOnEdge))
{
double d = pointOnEdge.distanceTo3(pickPoint);
if (d < nearestDistance)
{
newVertexIndex = i + 1;
nearestDistance = d;