// Intersect a ray through each mouse point, with a geoid passing through the reference elevation.
// If either ray fails to intersect the geoid, then ignore this event. Use the difference between the two
// intersected positions to move the control point's location.
View view = this._wwd.getView();
Globe globe = this._wwd.getModel().getGlobe();
Position refPos = this._pol_.getReferencePosition();
if (refPos == null)
return;
Line ray = view.computeRayFromScreenPoint(mousePoint.getX(), mousePoint.getY());
Line previousRay = view.computeRayFromScreenPoint(previousMousePoint.getX(), previousMousePoint.getY());
Vec4 vec = AirspaceEditorUtil.intersectGlobeAt(this._wwd, refPos.getElevation(), ray);
Vec4 previousVec = AirspaceEditorUtil.intersectGlobeAt(this._wwd, refPos.getElevation(), previousRay);
if (vec == null || previousVec == null)
{
return;
}
Position pos = globe.computePositionFromPoint(vec);
Position previousPos = globe.computePositionFromPoint(previousVec);
LatLon change = pos.subtract(previousPos);
this._pol_.move(new Position(change.getLatitude(), change.getLongitude(), 0.0));
}