public Position getPosition()
            {
                if (orbitView == null)
                {
                    return(null);
                }

                return(orbitView.getCenterPosition());
            }
Esempio n. 2
0
        public bool isColliding(OrbitView orbitView, double nearDistance, DrawContext dc)
        {
            if (orbitView == null)
            {
                String message = Logging.getMessage("nullValue.OrbitViewIsNull");
                Logging.logger().severe(message);
                throw new ArgumentException(message);
            }
            if (nearDistance < 0)
            {
                String message = Logging.getMessage("generic.ArgumentOutOfRange", nearDistance);
                Logging.logger().severe(message);
                throw new ArgumentException(message);
            }
            if (dc == null)
            {
                String message = Logging.getMessage("nullValue.DrawContextIsNull");
                Logging.logger().severe(message);
                throw new ArgumentException(message);
            }
            Globe globe = dc.getGlobe();

            if (globe == null)
            {
                String message = Logging.getMessage("nullValue.DrawingContextGlobeIsNull");
                Logging.logger().severe(message);
                throw new ArgumentException(message);
            }

            Matrix modelviewInv = getModelviewInverse(globe,
                                                      orbitView.getCenterPosition(), orbitView.getHeading(), orbitView.getPitch(), orbitView.getRoll(),
                                                      orbitView.getZoom());

            if (modelviewInv != null)
            {
                // OrbitView is colliding when its eye point is below the collision threshold.
                double heightAboveSurface = computeViewHeightAboveSurface(dc, modelviewInv,
                                                                          orbitView.getFieldOfView(), orbitView.getViewport(), nearDistance);
                return(heightAboveSurface < this.collisionThreshold);
            }

            return(false);
        }
        /**
         * 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));
        }