Package gov.nasa.worldwind.geom

Examples of gov.nasa.worldwind.geom.Position


      ArrayList<Point2D.Double> lstP2d = (ArrayList<Point2D.Double>) evt.getGeometry();
      List<Position> lstPosition = new ArrayList<Position>();
     
      for (Point2D.Double p2dCur: lstP2d)
      {
         Position posCur = Position.fromDegrees(p2dCur.y, p2dCur.x);
         lstPosition.add(posCur);
      }

      super.setLocations(lstPosition);
   }
View Full Code Here


      setMeasureShapeType(getPathType(newPositions));

      // Import positions and create control points
      for (int i = 0; i < newPositions.size(); i++)
      {
         Position pos = newPositions.get(i);
         this.positions.add(pos);
         if (i < newPositions.size() - 1 || !closedShape)
            addControlPoint(pos, CONTROL_TYPE_LOCATION_INDEX, this.positions.size() - 1);
      }
View Full Code Here

   // *** Editing shapes ***
   /** Add a control point to the current measure shape at the cuurrent WorldWindow position. */
   public void addControlPoint()
   {
      Position curPos = this.wwd.getCurrentPosition();
      if (curPos == null)
         return;


      // Line, path or polygons with less then two points
View Full Code Here

   }

   /** Remove the last control point from the current measure shape. */
   public void removeControlPoint()
   {
      Position currentLastPosition = null;

      if (this.positions.isEmpty())
         return;

      if (/*!this.measureShapeType.equals(SHAPE_POLYGON) || */this.positions.size() == 1)
View Full Code Here

      if (point.getValue(CONTROL_TYPE_LOCATION_INDEX) != null)
      {
         int positionIndex = (Integer) point.getValue(CONTROL_TYPE_LOCATION_INDEX);
         // Update positions
         Position surfacePosition = computeSurfacePosition(point.getPosition());
         surfacePosition = new Position(point.getPosition(), surfacePosition.getAltitude());
         positions.set(positionIndex, surfacePosition);

         // Update last pos too if polygon and first pos changed
            /*if (measureShapeType.equals(SHAPE_POLYGON) && positions.size() > 2 && positionIndex == 0)
         positions.set(positions.size() - 1, surfacePosition);*/
 
View Full Code Here

      else
      {*/
      // Move all positions and control points
      for (int i = 0; i < positions.size(); i++)
      {
         Position newPos = computeSurfacePosition(
                 LatLon.greatCircleEndPosition(positions.get(i), azimuth, distance));
         positions.set(i, newPos);
         if (/*!this.measureShapeType.equals(SHAPE_POLYGON) || */i < positions.size() - 1)
            ((ControlPoint) controlPoints.get(i)).setPosition(new Position(newPos, 0));
      }
      // Update heading for simple line
      if (measureShapeType.equals(SHAPE_LINE) && positions.size() > 1)
         shapeOrientation = LatLon.greatCircleAzimuth(positions.get(0), positions.get(1));
      // Update rendered shapes
View Full Code Here

      Vec4 surfacePoint = wwd.getSceneController().getTerrain().getSurfacePoint(latLon.getLatitude(),
              latLon.getLongitude());
      if (surfacePoint != null)
         return wwd.getModel().getGlobe().computePositionFromPoint(surfacePoint);
      else
         return new Position(latLon, wwd.getModel().getGlobe().getElevation(latLon.getLatitude(),
                 latLon.getLongitude()));
   }
View Full Code Here

   }

 
   protected void addControlPoint(Position position, String key, Object value)
   {
      ControlPoint controlPoint = new ControlPoint(new Position(position, 0), this.controlPointsAttributes, this);
      controlPoint.setValue(key, value);
      this.doAddControlPoint(controlPoint);
   }
View Full Code Here

              && this.measureTool.getWwd().getObjectsAtCurrentPosition().getTerrainObject() != null)
      {
         if (!isFreeHand() || (!measureTool.getMeasureShapeType().equals(GfrMeasureTool.SHAPE_PATH) /*&& !measureTool.getMeasureShapeType().equals(GfrMeasureTool.SHAPE_POLYGON)*/))
         {
            // Rubber band - Move control point and update shape
            Position lastPosition = rubberBandTarget.getPosition();
            PickedObjectList pol = measureTool.getWwd().getObjectsAtCurrentPosition();
            PickedObject to = pol.getTerrainObject();
            rubberBandTarget.setPosition(new Position(to.getPosition(), 0));
            measureTool.moveControlPoint(rubberBandTarget);
            measureTool.firePropertyChange(GfrMeasureTool.EVENT_POSITION_REPLACE,
                    lastPosition, rubberBandTarget.getPosition());
            measureTool.getWwd().redraw();
         }
         else
         {
            // Free hand - Compute distance from current control point (rubber band target)
            Position lastPosition = rubberBandTarget.getPosition();
            Position newPosition = measureTool.getWwd().getCurrentPosition();
            double distance = LatLon.greatCircleDistance(lastPosition, newPosition).radians
                    * measureTool.getWwd().getModel().getGlobe().getRadius();
            if (distance >= freeHandMinSpacing)
            {
               // Add new control point
View Full Code Here

            String message = Logging.getMessage("layers.AbstractLayer.NoViewSpecifiedInDrawingContext");
            Logging.logger().severe(message);
            throw new IllegalStateException(message);
        }

        Position eyePos = dc.getView().getEyePosition();
        if (eyePos == null)
            return false;

        double altitude = eyePos.getElevation();
        return altitude >= this.minActiveAltitude && altitude <= this.maxActiveAltitude;
    }
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.