protected Cursor selectResizeCursor(Angle azimuth) {
    while (azimuth.degrees < 0) azimuth = azimuth.addDegrees(360);

    if (azimuth.degrees < 22.5) return Cursor.getPredefinedCursor(Cursor.N_RESIZE_CURSOR);
    else if (azimuth.degrees < 67.5) return Cursor.getPredefinedCursor(Cursor.NE_RESIZE_CURSOR);
    else if (azimuth.degrees < 112.5) return Cursor.getPredefinedCursor(Cursor.E_RESIZE_CURSOR);
    else if (azimuth.degrees < 157.5) return Cursor.getPredefinedCursor(Cursor.SE_RESIZE_CURSOR);
    else if (azimuth.degrees < 202.5) return Cursor.getPredefinedCursor(Cursor.S_RESIZE_CURSOR);
    else if (azimuth.degrees < 247.5) return Cursor.getPredefinedCursor(Cursor.SW_RESIZE_CURSOR);
    else if (azimuth.degrees < 292.5) return Cursor.getPredefinedCursor(Cursor.W_RESIZE_CURSOR);
    else if (azimuth.degrees < 337.5) return Cursor.getPredefinedCursor(Cursor.NW_RESIZE_CURSOR);
    else // if (azimuth.degrees < 360)
    return Cursor.getPredefinedCursor(Cursor.N_RESIZE_CURSOR);
  }
 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));
     }
   }
 }
 protected void setComponentCursor(Cursor cursor) {
   ((Component) this.measureTool.getWwd())
       .setCursor(cursor != null ? cursor : Cursor.getDefaultCursor());
 }