Examples of Globe


Examples of gov.nasa.worldwind.globes.Globe

    }
   
    public static List<Position> s_createPositionSquareInViewport(WorldWindow wwd, Position position, Angle heading,
        double sizeInMeters)
    {
        Globe globe = wwd.getModel().getGlobe();
        Matrix transform = Matrix.IDENTITY;
        transform = transform.multiply(globe.computeSurfaceOrientationAtPosition(position));
        transform = transform.multiply(Matrix.fromRotationZ(heading.multiply(-1)));

        double widthOver2 = sizeInMeters / 2.0;
        double heightOver2 = sizeInMeters / 2.0;
        double depthOver2 = sizeInMeters / 2.0;
       
        Vec4[] points = new Vec4[]
            {
                new Vec4(-widthOver2, -heightOver2, depthOver2).transformBy4(transform), // lower left
                new Vec4(widthOver2, -heightOver2, depthOver2).transformBy4(transform), // lower right
                new Vec4(widthOver2, heightOver2, depthOver2).transformBy4(transform), // upper right
                new Vec4(-widthOver2, heightOver2, depthOver2).transformBy4(transform// upper left
            };

        Position[] locations = new Position[points.length];
       
        for (int i = 0; i < locations.length; i++)
        {
            locations[i] = globe.computePositionFromPoint(points[i]);
           
            // done in a hurry
            locations[i] = new Position(locations[i].getLatitude(), locations[i].getLongitude(), 1000);
        }
View Full Code Here

Examples of gov.nasa.worldwind.globes.Globe

    }

    public static List<Position> s_createPositionTriangleInViewport(WorldWindow wwd, Position position, Angle heading,
        double sizeInMeters)
    {
        Globe globe = wwd.getModel().getGlobe();
        Matrix transform = Matrix.IDENTITY;
        transform = transform.multiply(globe.computeSurfaceOrientationAtPosition(position));
        transform = transform.multiply(Matrix.fromRotationZ(heading.multiply(-1)));

        double widthOver2 = sizeInMeters / 2.0;
        double heightOver2 = sizeInMeters / 2.0;
        double depthOver2 = sizeInMeters / 2.0;
       
        Vec4[] points = new Vec4[]
            {
                new Vec4(-widthOver2, -heightOver2, depthOver2).transformBy4(transform), // lower left
                //new Vec4(widthOver2, -heightOver2, depthOver2).transformBy4(transform), // lower right
                new Vec4(widthOver2, heightOver2, depthOver2).transformBy4(transform), // upper right
                //new Vec4(-widthOver2, heightOver2, depthOver2).transformBy4(transform)  // upper left
            };

        int intMax = 2;
        Position[] locations = new Position[points.length];
       
        for (int i = 0; i < locations.length; i++)
        {
            locations[i] = globe.computePositionFromPoint(points[i]);
           
            // done in a hurry
            locations[i] = new Position(locations[i].getLatitude(), locations[i].getLongitude(), 1000);
        }
       
View Full Code Here

Examples of gov.nasa.worldwind.globes.Globe

                ShapeUtils.getViewportScaleFactor(wwd) : DEFAULT_SHAPE_SIZE_METERS;

            java.util.List<LatLon> locations = ShapeUtils.createSquareInViewport(wwd, position, heading, sizeInMeters);

            double maxElevation = -Double.MAX_VALUE;
            Globe globe = wwd.getModel().getGlobe();

            for (LatLon ll : locations)
            {
                double e = globe.getElevation(ll.getLatitude(), ll.getLongitude());
                if (e > maxElevation)
                    maxElevation = e;
            }

            polygon.setAltitudes(0.0, maxElevation + sizeInMeters);
View Full Code Here

Examples of gov.nasa.worldwind.globes.Globe

     *
     * @return Data that describes the arc.
     */
    protected ArcData computeArc(DrawContext dc)
    {
        Globe globe = dc.getGlobe();

        // The graphic looks like this:
        //
        //   A \
        //      \
        //   Mid |______\
        //       |      /
        //      /
        //   B /

        Vec4 pA = globe.computePointFromPosition(this.position2);
        Vec4 pB = globe.computePointFromPosition(this.position3);

        Position baseMidpoint = new Position(LatLon.interpolate(0.5, this.position2, this.position3), 0);
        Vec4 pMid = globe.computePointFromPosition(baseMidpoint);

        // Compute a vector perpendicular to the segment AB and the normal vector
        Vec4 vAB = pB.subtract3(pA);
        Vec4 normal = globe.computeSurfaceNormalAtPoint(pMid);
        Vec4 perpendicular = vAB.cross3(normal).normalize3();

        ArcData arcData = new ArcData();

        double chordLength = pA.distanceTo3(pB);
        Angle arcAngle = this.getArcAngle();

        // The arc is drawn as a segment of a circle defined by a chord and the arc angle. Control points 2 and 3 define
        // the chord. Compute the radius of the circle, and the distance from the center of the circle to the chord from
        // this information. See http://mathworld.wolfram.com/CircularSegment.html and
        // http://en.wikipedia.org/wiki/Circular_segment for background on these formulas.
        arcData.radius = chordLength / (2 * arcAngle.sinHalfAngle());
        double dist = arcData.radius * arcAngle.cosHalfAngle();

        // Determine which side of the line AB the arrow point falls on. We want the arc face away from the arrow, so
        // set the direction of the perpendicular component according to the sign of the scalar triple product.
        Vec4 vOrientation = globe.computePointFromPosition(this.position1).subtract3(pMid);
        double tripleProduct = perpendicular.dot3(vOrientation);
        double sign = (tripleProduct > 0) ? -1 : 1;

        arcData.direction = perpendicular.multiply3(sign);

        // Find the center point of the circle
        Vec4 pCenter = pMid.add3(arcData.direction.multiply3(dist));
        arcData.center = globe.computePositionFromPoint(pCenter);

        // Compute the start and sweep angles for the arc
        arcData.startAngle = LatLon.greatCircleAzimuth(arcData.center, this.position2);
        Angle endAngle = LatLon.greatCircleAzimuth(arcData.center, this.position3);

        // Compute the angle between the start and end points. Note that we cannot use Angle.angularDistance because
        // we need a signed distance here.
        double diffDegrees = endAngle.subtract(arcData.startAngle).degrees;
        if (diffDegrees < -180)
            diffDegrees += 360;
        else if (diffDegrees > 180)
            diffDegrees -= 360;

        arcData.arcAngle = Angle.fromDegrees(diffDegrees);

        // Find the midpoint of the arc
        double globeRadius = globe.getRadiusAt(arcData.center.getLatitude(), arcData.center.getLongitude());
        LatLon ll = LatLon.greatCircleEndPosition(arcData.center,
            arcData.arcAngle.divide(2.0).radians + arcData.startAngle.radians, arcData.radius / globeRadius);
        arcData.midpoint = new Position(ll, 0);

        return arcData;
View Full Code Here

Examples of gov.nasa.worldwind.globes.Globe

        public AppFrame()
        {
            super(true, true, false);
           
            Globe glbDefault = this.getWwd().getModel().getGlobe();
           
            if (glbDefault instanceof FlatGlobe)
            {
               System.out.println("glbDefault instanceof FlatGlobe");
              
               //Earth glbEarth = new Earth();
               //this.getWwd().getModel().setGlobe(glbEarth) ;
            }
           
            else if (glbDefault instanceof Earth)
            {
               System.out.println("glbDefault instanceof Earth");
            }
           
            else
            {
               System.err.println("Uncaught instanceof glbDefault: " + glbDefault.getClass().toString());
               System.exit(1);
            }

            // Change atmosphere SkyGradientLayer for SkyColorLayer
            // and set worldmap and compass max active altitude
View Full Code Here

Examples of gov.nasa.worldwind.globes.Globe

                    Double elevation = Configuration.getDoubleValue(AVKey.INITIAL_ALTITUDE);
                    */
                    Double lat = 0d;
                    Double lon = 0d;
                    Double elevation = 1.7E7d;
                    Globe glbDefault = getWwd().getModel().getGlobe();
                    if (glbDefault instanceof FlatGlobe)
                       elevation = 5.0E7d;  
                   
                    Position targetPos = Position.fromDegrees(lat, lon, 0);
                    BasicOrbitView view = (BasicOrbitView) getWwd().getView();
View Full Code Here

Examples of gov.nasa.worldwind.globes.Globe

            return vs.areExtentsContained(view);
        }

        public Vec4[] computeViewLookAtForScene(View view)
        {
            Globe globe = this.wwd.getModel().getGlobe();
            double ve = this.wwd.getSceneController().getVerticalExaggeration();

            ExtentVisibilitySupport vs = new ExtentVisibilitySupport();
            this.addExtents(vs);
View Full Code Here

Examples of gov.nasa.worldwind.globes.Globe

                }
            }

            if (!extentHolders.isEmpty())
            {
                Globe globe = this.wwd.getModel().getGlobe();
                double ve = this.wwd.getSceneController().getVerticalExaggeration();
                vs.setExtents(ExtentVisibilitySupport.extentsFromExtentHolders(extentHolders, globe, ve));
            }

            if (!screenExtents.isEmpty())
View Full Code Here

Examples of gov.nasa.worldwind.globes.Globe

            return vs.areExtentsContained(view);
        }

        public Vec4[] computeViewLookAtForScene(View view)
        {
            Globe globe = this.wwd.getModel().getGlobe();
            double ve = this.wwd.getSceneController().getVerticalExaggeration();

            ExtentVisibilitySupport vs = new ExtentVisibilitySupport();
            this.addExtents(vs);
View Full Code Here

Examples of gov.nasa.worldwind.globes.Globe

                }
            }

            if (!extentHolders.isEmpty())
            {
                Globe globe = this.wwd.getModel().getGlobe();
                double ve = this.wwd.getSceneController().getVerticalExaggeration();
                vs.setExtents(ExtentVisibilitySupport.extentsFromExtentHolders(extentHolders, globe, ve));
            }

            if (!screenExtents.isEmpty())
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.