Package gov.nasa.worldwind.geom

Examples of gov.nasa.worldwind.geom.Position


      LatLon posBeg = altPos.get(0);
      LatLon posEnd = altPos.get(1);

      LatLon latLonMid = LatLon.interpolateGreatCircle(0.5, posBeg, posEnd);

      return new Position(latLonMid, 0);

   }
View Full Code Here


   
    private void _initializePolygon_(WorldWindow wwd, ExtrudedPolygon polygon, boolean fitShapeToViewport)
    {
        // Creates a rectangle in the center of the viewport. Attempts to guess at a reasonable size and height.

        Position position = GfrShapeUtils.s_getNewShapePosition(wwd);
        Angle heading = GfrShapeUtils.s_getNewShapeHeading(wwd, true);
       
        double heightInMeters = fitShapeToViewport?
            GfrShapeUtils.s_getViewportScaleFactor(wwd):
                GfrFactoryObjShpPlnAbs._DBL_DEFAULT_SHAPE_SIZE_METERS;
View Full Code Here

      super();
   }
  
   public PointPlacemark create(WorldWindow wwd, String strNewWhatLabel)
   {
      Position posCenter = ((OrbitView) wwd.getView()).getCenterPosition();
     
      PointPlacemark ppk = new PointPlacemark(Position.fromDegrees(
              posCenter.latitude.degrees,
              posCenter.longitude.degrees,
              0d
View Full Code Here

    private void _initializePolygon_(WorldWindow wwd, Path polygon, boolean fitShapeToViewport)
    {
        // Creates a rectangle in the center of the viewport. Attempts to guess at a reasonable size and height.

        Position position = GfrShapeUtils.s_getNewShapePosition(wwd);
        Angle heading = GfrShapeUtils.s_getNewShapeHeading(wwd, true);
       
        double heightInMeters = fitShapeToViewport?
            GfrShapeUtils.s_getViewportScaleFactor(wwd):
                GfrFactoryObjShpPlnAbs._DBL_DEFAULT_SHAPE_SIZE_METERS;
View Full Code Here

    protected void _assembleVertexControlPoints_(DrawContext dc)
    {
        Terrain terrain = dc.getTerrain();
        ExtrudedPolygon pol = (ExtrudedPolygon) super._pol_;

        Position refPos = pol.getReferencePosition();
        Vec4 refPoint = terrain.getSurfacePoint(refPos.getLatitude(), refPos.getLongitude(), 0);

        int altitudeMode = pol.getAltitudeMode();
        double height = pol.getHeight();

        Vec4 vaa = null;
        double vaaLength = 0; // used to compute independent length of each cap vertex
        double vaLength = 0;

        int i = 0;
        for (LatLon location : pol.getOuterBoundary())
        {
            Vec4 vert;

            // Compute the top/cap point.
            if (altitudeMode == WorldWind.CONSTANT || !(location instanceof Position))
            {
                if (vaa == null)
                {
                    // Compute the vector lengths of the top and bottom points at the reference position.
                    vaa = refPoint.multiply3(height / refPoint.getLength3());
                    vaaLength = vaa.getLength3();
                    vaLength = refPoint.getLength3();
                }

                // Compute the bottom point, which is on the terrain.
                vert = terrain.getSurfacePoint(location.getLatitude(), location.getLongitude(), 0);

                double delta = vaLength - vert.dot3(refPoint) / vaLength;
                vert = vert.add3(vaa.multiply3(1d + delta / vaaLength));
            }
            else if (altitudeMode == WorldWind.RELATIVE_TO_GROUND)
            {
                vert = terrain.getSurfacePoint(location.getLatitude(), location.getLongitude(),
                    ((Position) location).getAltitude());
            }
            else // WorldWind.ABSOLUTE
            {
                vert = terrain.getGlobe().computePointFromPosition(location.getLatitude(), location.getLongitude(),
                    ((Position) location).getAltitude() * terrain.getVerticalExaggeration());
            }

            Position vertexPosition = super._wwd.getModel().getGlobe().computePositionFromPoint(vert);
          
           
            GfrMrkMoveHoriz pnt = new GfrMrkMoveHoriz(vertexPosition, vert,
                super._bmaControlVertex, i);

View Full Code Here

    private void _initializePolygon_(WorldWindow wwd, Polyline polygon, boolean fitShapeToViewport)
    {
        // Creates a rectangle in the center of the viewport. Attempts to guess at a reasonable size and height.

        Position position = GfrShapeUtils.s_getNewShapePosition(wwd);
        Angle heading = GfrShapeUtils.s_getNewShapeHeading(wwd, true);
       
        double heightInMeters = fitShapeToViewport?
            GfrShapeUtils.s_getViewportScaleFactor(wwd):
                GfrFactoryObjShpPlnAbs._DBL_DEFAULT_SHAPE_SIZE_METERS;
View Full Code Here

    protected void moveControlPoint(GfrMrkMoveHoriz controlPoint, Point lastMousePoint, Point moveToPoint)
    {
        View view = super._wwd.getView();
        Globe globe = super._wwd.getModel().getGlobe();

        Position refPos = controlPoint.getPosition();
        if (refPos == null)
            return;

        Line ray = view.computeRayFromScreenPoint(moveToPoint.getX(), moveToPoint.getY());
        Line previousRay = view.computeRayFromScreenPoint(lastMousePoint.getX(), lastMousePoint.getY());

        Vec4 vec = AirspaceEditorUtil.intersectGlobeAt(super._wwd, refPos.getElevation(), ray);
        Vec4 previousVec = AirspaceEditorUtil.intersectGlobeAt(super._wwd, refPos.getElevation(), previousRay);

        if (vec == null || previousVec == null)
        {
            return;
        }

        Position pos = globe.computePositionFromPoint(vec);
        Position previousPos = globe.computePositionFromPoint(previousVec);
        LatLon change = pos.subtract(previousPos);

        java.util.List<LatLon> boundary = new ArrayList<LatLon>();
        for (LatLon ll : ((ExtrudedPolygon) super._pol_).getOuterBoundary())
        {
            boundary.add(ll);
        }

        boundary.set(controlPoint.getIndex(), new Position(pos.add(change), refPos.getAltitude()));

        // ExtrudedPolygon ensures that the last boundary position is the same as the first. Remove the last point
        // before setting the boundary.
        boundary.remove(boundary.size() - 1);
View Full Code Here

            String strIdExisting = GfrWrpBasSynObjNameTloEclPlc.getInstance().getId(strNameCandidate);
           
            if (strIdExisting!=null && strIdExisting.length()>0)
            {
                Position posExisting = GfrWrpBasSynObjNameTloEclPlc.getInstance().getGeometry(strIdExisting);
                LatLon llnExisting = (LatLon) posExisting;
               
                /*
                 * if same latLon, and same name,
                 * then just return
View Full Code Here

       String strNameTarget = super.generateUniqueNameCopy(strNameSource);
       
       // --- data
       String strDescShortSource = GfrWrpBasSynObjNameTloEclPnt.getInstance().getDescription(strIdTloSource);
       String strUrlSource = GfrWrpBasSynObjNameTloEclPnt.getInstance().getUrlTlo(strIdTloSource);
       Position posSource = GfrWrpBasSynObjNameTloEclPnt.getInstance().getGeometry(strIdTloSource);
       Point2D.Double p2dSource = new Point2D.Double(posSource.longitude.degrees, posSource.latitude.degrees);

       String strIdTloTarget = super._save(
             GfrWrpUsrSpcDspPrtAppWork.getInstance().getPathAbsoluteDbDataChild(GfrIoBasNameDatPrjEcl.STR_FILE),
             strNameTarget,
View Full Code Here

            }

            // Determine if the view has changed since the last frame.
            this.checkForViewChange();

            Position positionAtStart = this.getCurrentPosition();
            PickedObject selectionAtStart = this.getCurrentSelection();
            PickedObjectList boxSelectionAtStart = this.getCurrentBoxSelection();

            try
            {
                this.callRenderingListeners(new RenderingEvent(this.drawable, RenderingEvent.BEFORE_RENDERING));
            }
            catch (Exception e)
            {
                Logging.logger().log(Level.SEVERE,
                    Logging.getMessage("WorldWindowGLAutoDrawable.ExceptionDuringGLEventListenerDisplay"), e);
            }

            int redrawDelay = this.doDisplay();
            if (redrawDelay > 0)
            {
                if (this.redrawTimer == null)
                {
                    this.redrawTimer = new Timer(redrawDelay, new ActionListener()
                    {
                        public void actionPerformed(ActionEvent actionEvent)
                        {
                            redraw();
                            redrawTimer = null;
                        }
                    });
                    redrawTimer.setRepeats(false);
                    redrawTimer.start();
                }
            }

            try
            {
                this.callRenderingListeners(new RenderingEvent(this.drawable, RenderingEvent.BEFORE_BUFFER_SWAP));
            }
            catch (Exception e)
            {
                Logging.logger().log(Level.SEVERE,
                    Logging.getMessage("WorldWindowGLAutoDrawable.ExceptionDuringGLEventListenerDisplay"), e);
            }

            this.doSwapBuffers(this.drawable);

            Double frameTime = sc.getFrameTime();
            if (frameTime != null)
                this.setValue(PerformanceStatistic.FRAME_TIME, frameTime);

            Double frameRate = sc.getFramesPerSecond();
            if (frameRate != null)
                this.setValue(PerformanceStatistic.FRAME_RATE, frameRate);

            // Dispatch the rendering exceptions accumulated by the SceneController during this frame to our
            // RenderingExceptionListeners.
            Iterable<Throwable> renderingExceptions = sc.getRenderingExceptions();
            if (renderingExceptions != null)
            {
                for (Throwable t : renderingExceptions)
                {
                    if (t != null)
                        this.callRenderingExceptionListeners(t);
                }
            }

            this.callRenderingListeners(new RenderingEvent(this.drawable, RenderingEvent.AFTER_BUFFER_SWAP));

            // Position and selection notification occurs only on triggering conditions, not same-state conditions:
            // start == null, end == null: nothing selected -- don't notify
            // start == null, end != null: something now selected -- notify
            // start != null, end == null: something was selected but no longer is -- notify
            // start != null, end != null, start != end: something new was selected -- notify
            // start != null, end != null, start == end: same thing is selected -- don't notify

            Position positionAtEnd = this.getCurrentPosition();
            if (positionAtStart != null || positionAtEnd != null)
            {
                // call the listener if both are not null or positions are the same
                if (positionAtStart != null && positionAtEnd != null)
                {
View Full Code Here

TOP

Related Classes of gov.nasa.worldwind.geom.Position

Copyright © 2018 www.massapicom. 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.