Beispiel #1
0
        /**
         * Clamp a roll angle to the range specified in a limit object.
         *
         * @param angle      angle to clamp to the allowed range.
         * @param viewLimits defines the roll limits.
         *
         * @throws ArgumentException if any argument is null.
         * @deprecated Use {@link #limitRoll(gov.nasa.worldwind.View, SharpEarth.geom.Angle)} instead.
         */
        public static Angle limitRoll(Angle angle, ViewPropertyLimits viewLimits)
        {
            if (angle == null)
            {
                string message = Logging.getMessage("nullValue.AngleIsNull");
                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);
            }

            Angle[] limits   = viewLimits.getRollLimits();
            Angle   newAngle = angle;

            if (angle.compareTo(limits[0]) < 0)
            {
                newAngle = limits[0];
            }
            else if (angle.compareTo(limits[1]) > 0)
            {
                newAngle = limits[1];
            }

            return(newAngle);
        }
Beispiel #2
0
        /**
         * Clamp an eye elevation to the range specified in a limit object.
         *
         * @param elevation  elevation to clamp to the allowed range.
         * @param viewLimits defines the eye elevation limits.
         *
         * @throws ArgumentException if any argument is null.
         * @deprecated Use {@link #limitEyePosition(gov.nasa.worldwind.View, SharpEarth.geom.Position)} instead.
         */
        public static double limitEyeElevation(double elevation, ViewPropertyLimits viewLimits)
        {
            if (viewLimits == null)
            {
                string message = Logging.getMessage("nullValue.ViewLimitsIsNull");
                Logging.logger().severe(message);
                throw new ArgumentException(message);
            }
            double newElevation = elevation;

            double[] elevLimits = viewLimits.getEyeElevationLimits();

            if (elevation < elevLimits[0])
            {
                newElevation = elevLimits[0];
            }
            else if (elevation > elevLimits[1])
            {
                newElevation = elevLimits[1];
            }
            return(newElevation);
        }
Beispiel #3
0
        /**
         * Clamp eye 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 eye location limits.
         *
         * @throws ArgumentException if any argument is null.
         * @deprecated Use {@link #limitEyePosition(gov.nasa.worldwind.View, SharpEarth.geom.Position)} instead.
         */
        public static LatLon limitEyePositionLocation(Angle latitude, Angle longitude, ViewPropertyLimits 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.getEyeLocationLimits();
            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));
        }