protected void setCursor(MeasureTool.ControlPoint controlPoint) { // TODO: handle 'rotating' mode cursor is this.isRotating() - when using Alt key on regular // shapes if (controlPoint == null) { setComponentCursor(null); } else { if (this.measureTool.isRegularShape()) { if (this.measureTool.isCornerControl(controlPoint)) { Angle azimuth = LatLon.greatCircleAzimuth( controlPoint.getPosition(), this.measureTool.getCenterPosition()); // Account for view heading in cursor selection azimuth = azimuth.subtract(this.measureTool.getWwd().getView().getHeading()); setComponentCursor(selectResizeCursor(azimuth)); } else if (this.measureTool.isCenterControl(controlPoint)) { setComponentCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR)); } } else { // Line, path and polygon setComponentCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR)); } } }
/** * Move the shape to the specified new position * * @param oldPosition Previous position of shape * @param newPosition New position for shape */ protected void moveToPosition(Position oldPosition, Position newPosition) { Angle distanceAngle = LatLon.greatCircleDistance(oldPosition, newPosition); Angle azimuthAngle = LatLon.greatCircleAzimuth(oldPosition, newPosition); measureTool.moveMeasureShape(azimuthAngle, distanceAngle); measureTool.firePropertyChange(MeasureTool.EVENT_POSITION_REPLACE, oldPosition, newPosition); }
protected Angle computeHeading(Position pa, Position pb) { return LatLon.greatCircleAzimuth(pa, pb); }