Package gov.nasa.worldwind.geom

Examples of gov.nasa.worldwind.geom.Position


              && this.measureTool.getWwd().getObjectsAtCurrentPosition().getTerrainObject() != null)
      {
         if (!isFreeHand() || (!measureTool.getMeasureShapeType().equals(GfrEditorObjShpSegWiseTool.SHAPE_PATH) /*&& !measureTool.getMeasureShapeType().equals(GfrEditorObjShpSegWiseTool.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(GfrEditorObjShpSegWiseTool.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


   protected void dragSelected(SelectEvent event)
   {
      ControlPoint point = (ControlPoint) event.getTopObject();
     

      Position lastPosition = point.getPosition();
     
       //int positionIndex = (Integer) point.getValue(GfrEditorObjShpSegWiseTool.CONTROL_TYPE_LOCATION_INDEX);
     
      //-- done in a hurry, positions should not be an array list => coz only two positions in this case
         /*int positionIndexPointNotChanged =-1;
View Full Code Here

    {
        this.placePoint = null;
        this.terrainPoint = null;
        this.screenPoint = null;

        Position pos = this.getPosition();
        if (pos == null)
            return;

        if (this.altitudeMode == WorldWind.CLAMP_TO_GROUND)
        {
            this.placePoint = dc.computeTerrainPoint(pos.getLatitude(), pos.getLongitude(), 0);
        }
        else if (this.altitudeMode == WorldWind.RELATIVE_TO_GROUND)
        {
            this.placePoint = dc.computeTerrainPoint(pos.getLatitude(), pos.getLongitude(), pos.getAltitude());
        }
        else  // ABSOLUTE
        {
            double height = pos.getElevation()
                * (this.isApplyVerticalExaggeration() ? dc.getVerticalExaggeration() : 1);
            this.placePoint = dc.getGlobe().computePointFromPosition(pos.getLatitude(), pos.getLongitude(), height);
        }

        if (this.placePoint == null)
            return;

        // Compute a terrain point if needed.
        if (this.isLineEnabled() && this.altitudeMode != WorldWind.CLAMP_TO_GROUND)
            this.terrainPoint = dc.computeTerrainPoint(pos.getLatitude(), pos.getLongitude(), 0);

        // Compute the placemark point's screen location.
        this.screenPoint = dc.getView().project(this.placePoint);
        this.eyeDistance = this.placePoint.distanceTo3(dc.getView().getEyePoint());
    }
View Full Code Here

            String msg = Logging.getMessage("nullValue.PositionIsNull");
            Logging.logger().severe(msg);
            throw new IllegalArgumentException(msg);
        }

        Position refPos = this.getReferencePosition();

        // The reference position is null if this shape has positions. With PointPlacemark, this should never happen
        // because its position must always be non-null. We check and this case anyway to handle a subclass overriding
        // getReferencePosition and returning null. In this case moving the shape by a relative delta is meaningless
        // because the shape has no geographic location. Therefore we fail softly by exiting and doing nothing.
        if (refPos == null)
            return;

        this.moveTo(refPos.add(delta));
    }
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

   }

   /** 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

         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
View Full Code Here

         throw new IllegalArgumentException(msg);
      }

      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

//        this._lyrCustomControlPoints.removeAllRenderables(); // TODO: why commented out? Are annotations being disposed?
   }

   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

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.