コード例 #1
0
        /** {@inheritDoc} */
        public double limitZoom(View view, double value)
        {
            if (view == null)
            {
                String message = Logging.getMessage("nullValue.ViewIsNull");
                Logging.logger().severe(message);
                throw new ArgumentException(message);
            }

            double minZoom = this.minZoom;
            double maxZoom = this.maxZoom;

            if (this.is2DGlobe(view.getGlobe())) // limit zoom to ~360 degrees of visible longitude on 2D globes
            {
                double max2DZoom = Math.PI * view.getGlobe().getEquatorialRadius() / view.getFieldOfView().tanHalfAngle();
                if (minZoom > max2DZoom)
                {
                    minZoom = max2DZoom;
                }
                if (maxZoom > max2DZoom)
                {
                    maxZoom = max2DZoom;
                }
            }

            return(WWMath.clamp(value, minZoom, maxZoom));
        }
コード例 #2
0
        protected BufferedImageRaster chooseRasterForCanvas(BufferedImageRaster canvas)
        {
            int level = this.computeMipmapLevel(
                this.getWidth(), this.getHeight(), this.getSector(),
                canvas.getWidth(), canvas.getHeight(), canvas.getSector());

            int maxLevel = this.levelRasters.length - 1;

            level = (int)WWMath.clamp(level, 0, maxLevel);

            return(this.levelRasters[level]);
        }
コード例 #3
0
        /** {@inheritDoc} */
        public Position limitCenterPosition(View view, Position position)
        {
            if (view == null)
            {
                String message = Logging.getMessage("nullValue.ViewIsNull");
                Logging.logger().severe(message);
                throw new ArgumentException(message);
            }

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

            Sector sector = this.centerLocationLimits;
            Angle  lat    = Angle.clamp(position.latitude, sector.getMinLatitude(), sector.getMaxLatitude());
            Angle  lon    = Angle.clamp(position.longitude, sector.getMinLongitude(), sector.getMaxLongitude());
            double alt    = WWMath.clamp(position.elevation, this.minCenterElevation, this.maxCenterElevation);

            return(new Position(lat, lon, alt));
        }