&& this.measureTool.getWwd().getObjectsAtCurrentPosition().getTerrainObject() != null)
{
if (!isFreeHand() || (!measureTool.getMeasureShapeType().equals(GfrMeasureTool.SHAPE_PATH) /*&& !measureTool.getMeasureShapeType().equals(GfrMeasureTool.SHAPE_POLYGON)*/))
{
// Rubber band - Move control point and update shape
Position lastPosition = rubberBandTarget.getPosition();
PickedObjectList pol = measureTool.getWwd().getObjectsAtCurrentPosition();
PickedObject to = pol.getTerrainObject();
rubberBandTarget.setPosition(new Position(to.getPosition(), 0));
measureTool.moveControlPoint(rubberBandTarget);
measureTool.firePropertyChange(GfrMeasureTool.EVENT_POSITION_REPLACE,
lastPosition, rubberBandTarget.getPosition());
measureTool.getWwd().redraw();
}
else
{
// Free hand - Compute distance from current control point (rubber band target)
Position lastPosition = rubberBandTarget.getPosition();
Position newPosition = measureTool.getWwd().getCurrentPosition();
double distance = LatLon.greatCircleDistance(lastPosition, newPosition).radians
* measureTool.getWwd().getModel().getGlobe().getRadius();
if (distance >= freeHandMinSpacing)
{
// Add new control point