/** * Sets the <code>OrbitViewLimits</code> that will apply to this <code>OrbitView</code>. Incoming parameters to the * methods setCenterPosition, setHeading, setPitch, or setZoom will be limited by the parameters defined in * <code>viewLimits</code>. * * @param viewLimits the <code>OrbitViewLimits</code> that will apply to this <code>OrbitView</code>. * * @throws ArgumentException if <code>viewLimits</code> is null. */ public void setOrbitViewLimits(OrbitViewLimits viewLimits) { if (viewLimits == null) { String message = Logging.getMessage("nullValue.ViewLimitsIsNull"); Logging.logger().severe(message); throw new ArgumentException(message); } this.viewLimits = viewLimits; }
/** * Clamp center location angles and elevation to the range specified in a limit object. * * @param position position to clamp to the allowed range. * @param viewLimits defines the center location and elevation limits. * * @throws ArgumentException if any argument is null. * @deprecated Use {@link #limitCenterPosition(gov.nasa.worldwind.View, SharpEarth.geom.Position)} instead. */ public static Position limitCenterPosition(Position position, OrbitViewLimits viewLimits) { if (position == null) { String message = Logging.getMessage("nullValue.PositionIsNull"); Logging.logger().severe(message); throw new ArgumentException(message); } if (viewLimits == null) { String message = Logging.getMessage("nullValue.ViewLimitsIsNull"); Logging.logger().severe(message); throw new ArgumentException(message); } return(new Position( limitCenterLocation(position.getLatitude(), position.getLongitude(), viewLimits), limitCenterElevation(position.getElevation(), viewLimits))); }
/** * Applies the orbit view property limits to the specified view. * * @param view the view that receives the property limits. * @param viewLimits defines the view property limits. * * @throws ArgumentException if any argument is null. * @deprecated Use methods that limit individual view properties directly: {@link #limitCenterPosition(gov.nasa.worldwind.View, * SharpEarth.geom.Position)}, {@link #limitHeading(gov.nasa.worldwind.View, * SharpEarth.geom.Angle)}, etc. */ public static void applyLimits(OrbitView view, OrbitViewLimits viewLimits) { if (view == null) { String message = Logging.getMessage("nullValue.ViewIsNull"); Logging.logger().severe(message); throw new ArgumentException(message); } if (viewLimits == null) { String message = Logging.getMessage("nullValue.ViewLimitsIsNull"); Logging.logger().severe(message); throw new ArgumentException(message); } view.setCenterPosition(limitCenterPosition(view.getCenterPosition(), viewLimits)); view.setHeading(limitHeading(view.getHeading(), viewLimits)); view.setPitch(limitPitch(view.getPitch(), viewLimits)); view.setZoom(limitZoom(view.getZoom(), viewLimits)); }
/** * Clamp center location angles to the range specified in a limit object. * * @param latitude latitude angle to clamp to the allowed range. * @param longitude longitude angle to clamp to the allowed range. * @param viewLimits defines the center location limits. * * @throws ArgumentException if any argument is null. * @deprecated Use {@link #limitCenterPosition(gov.nasa.worldwind.View, SharpEarth.geom.Position)} instead. */ public static LatLon limitCenterLocation(Angle latitude, Angle longitude, OrbitViewLimits viewLimits) { if (latitude == null || longitude == null) { String message = Logging.getMessage("nullValue.LatitudeOrLongitudeIsNull"); Logging.logger().severe(message); throw new ArgumentException(message); } if (viewLimits == null) { String message = Logging.getMessage("nullValue.ViewLimitsIsNull"); Logging.logger().severe(message); throw new ArgumentException(message); } Sector limits = viewLimits.getCenterLocationLimits(); Angle newLatitude = latitude; Angle newLongitude = longitude; if (latitude.compareTo(limits.getMinLatitude()) < 0) { newLatitude = limits.getMinLatitude(); } else if (latitude.compareTo(limits.getMaxLatitude()) > 0) { newLatitude = limits.getMaxLatitude(); } if (longitude.compareTo(limits.getMinLongitude()) < 0) { newLongitude = limits.getMinLongitude(); } else if (longitude.compareTo(limits.getMaxLongitude()) > 0) { newLongitude = limits.getMaxLongitude(); } return(new LatLon(newLatitude, newLongitude)); }
/** * Clamp an zoom distance to the range specified in a limit object. * * @param value distance to clamp to the allowed range. * @param viewLimits defines the zoom distance limits. * * @throws ArgumentException if any argument is null. * @deprecated Use {@link #limitZoom(gov.nasa.worldwind.View, double)} instead. */ public static double limitZoom(double value, OrbitViewLimits viewLimits) { if (viewLimits == null) { String message = Logging.getMessage("nullValue.ViewLimitsIsNull"); Logging.logger().severe(message); throw new ArgumentException(message); } double[] limits = viewLimits.getZoomLimits(); double newValue = value; if (value < limits[0]) { newValue = limits[0]; } else if (value > limits[1]) { newValue = limits[1]; } return(newValue); }