protected Angle computePanHeading(OrbitView view, ScreenAnnotation control) {
   // Compute last pick point 'heading' relative to pan control center
   double size = control.getAttributes().getSize().width * control.getAttributes().getScale();
   Vec4 center = new Vec4(control.getScreenPoint().x, control.getScreenPoint().y + size / 2, 0);
   double px = lastPickPoint.x - center.x;
   double py = view.getViewport().getHeight() - lastPickPoint.y - center.y;
   Angle heading = view.getHeading().add(Angle.fromRadians(Math.atan2(px, py)));
   heading = heading.degrees >= 0 ? heading : heading.addDegrees(360);
   return heading;
 }
 protected Angle computeLookHeading(OrbitView view, ScreenAnnotation control, double headingStep) {
   // Compute last pick point 'heading' relative to look control center on x
   double size = control.getAttributes().getSize().width * control.getAttributes().getScale();
   Vec4 center = new Vec4(control.getScreenPoint().x, control.getScreenPoint().y + size / 2, 0);
   double px = lastPickPoint.x - center.x;
   double pickDistanceFactor = Math.min(Math.abs(px) / 3000, 5) * Math.signum(px);
   // New heading
   Angle heading = view.getHeading().add(Angle.fromRadians(headingStep * pickDistanceFactor));
   heading = heading.degrees >= 0 ? heading : heading.addDegrees(360);
   return heading;
 }
  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);
  }
Beispiel #4
0
 /**
  * Compute the view range footprint on the globe.
  *
  * @param dc the current <code>DrawContext</code>
  * @param steps the number of steps.
  * @return an array list of <code>LatLon</code> forming a closed shape.
  */
 protected ArrayList<LatLon> computeViewFootPrint(DrawContext dc, int steps) {
   ArrayList<LatLon> positions = new ArrayList<LatLon>();
   Position eyePos = dc.getView().getEyePosition();
   Angle distance =
       Angle.fromRadians(
           Math.asin(
               dc.getView().getFarClipDistance()
                   / (dc.getGlobe().getRadius() + eyePos.getElevation())));
   if (distance.degrees > 10) {
     double headStep = 360d / steps;
     Angle heading = Angle.ZERO;
     for (int i = 0; i <= steps; i++) {
       LatLon p = LatLon.greatCircleEndPosition(eyePos, heading, distance);
       positions.add(p);
       heading = heading.addDegrees(headStep);
     }
     return positions;
   } else return null;
 }
 private void recalculateVertices(Globe globe, double verticalExaggeration) {
   synchronized (elevationLock) {
     if (elevations != null) {
       elevations.rewind();
       vertices.rewind();
       Angle minlon = sector.getMinLongitude();
       Angle minlat = sector.getMaxLatitude();
       double lonstep = sector.getDeltaLonDegrees() / (width - 1);
       double latstep = sector.getDeltaLatDegrees() / (height - 1);
       for (int y = 0; y < height; y++) {
         Angle lat = minlat.subtractDegrees(latstep * y);
         for (int x = 0; x < width; x++) {
           Angle lon = minlon.addDegrees(lonstep * x);
           double elev = elevations.get() * scale * verticalExaggeration;
           Vec4 point = globe.computePointFromPosition(lat, lon, elev);
           vertices.put(point.x).put(point.y).put(point.z);
         }
       }
     }
   }
 }