Package gov.nasa.worldwind.geom

Examples of gov.nasa.worldwind.geom.Vec4


    {
        // Try to find the edge that is closest to a ray passing through the screen point. We're trying to determine
        // the user's intent as to which edge a new two control points should be added to.

        Line ray = super._wwd.getView().computeRayFromScreenPoint(mousePoint.getX(), mousePoint.getY());
        Vec4 pickPoint = super._intersectPolygonAltitudeAt(ray);

        double nearestDistance = Double.MAX_VALUE;
        int newVertexIndex = 0;

        // Loop through the control points and determine which edge is closest to the pick point
        for (int i = 0; i < this._lstMarkerControlPoints.size()-1; i++)
        {
            GfrMrkMoveAbs thisMarker = (GfrMrkMoveAbs) this._lstMarkerControlPoints.get(i);
           
            GfrMrkMoveAbs nextMarker = (GfrMrkMoveAbs) this._lstMarkerControlPoints.get(
                (i + 1) % this._lstMarkerControlPoints.size());

            Vec4 pointOnEdge = AirspaceEditorUtil.nearestPointOnSegment(thisMarker.getPoint(), nextMarker.getPoint(), pickPoint);
           
            if (!AirspaceEditorUtil.isPointBehindLineOrigin(ray, pointOnEdge))
            {
                double d = pointOnEdge.distanceTo3(pickPoint);
               
                if (d < nearestDistance)
                {
                    newVertexIndex = i + 1;
                    nearestDistance = d;
View Full Code Here


            return;

        Line ray = view.computeRayFromScreenPoint(mousePoint.getX(), mousePoint.getY());
        Line previousRay = view.computeRayFromScreenPoint(previousMousePoint.getX(), previousMousePoint.getY());

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

        if (vec == null || previousVec == null)
        {
            return;
        }
View Full Code Here

        Position secondVertex = this._lstMarkerControlPoints.get(1).getPosition();

        Globe globe = this._wwd.getModel().getGlobe();

        // Get cartesian points for the vertices
        Vec4 firstPoint = globe.computePointFromPosition(firstVertex);
        Vec4 secondPoint = globe.computePointFromPosition(secondVertex);

        // Find the midpoint of the line segment that connects the vertices
        Vec4 halfwayPoint = firstPoint.add3(secondPoint).divide3(2.0);

        Position halfwayPosition = globe.computePositionFromPoint(halfwayPoint);
       
        this._lstMarkerControlPoints.add(new GfrMrkMoveVert(halfwayPosition, halfwayPoint,
            this._bmaControlHeight, this._lstMarkerControlPoints.size()));
View Full Code Here

            return;
        }

        this._san.setText(displayString);

        Vec4 screenPoint = this._computeAnnotationPosition_(pos);
        if (screenPoint != null)
            this._san.setScreenPoint(new Point((int) screenPoint.x, (int) screenPoint.y));

        this._san.getAttributes().setVisible(true);
    }
View Full Code Here

    // ----
    // beg private

    private Vec4 _computeAnnotationPosition_(Position pos)
    {
        Vec4 surfacePoint = this._wwd.getSceneController().getTerrain().getSurfacePoint(
            pos.getLatitude(), pos.getLongitude());
       
        if (surfacePoint == null)
        {
            Globe globe = this._wwd.getModel().getGlobe();
View Full Code Here

      //}
   }

   protected Position computeSurfacePosition(LatLon latLon)
   {
      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(),
View Full Code Here

         return;
      }

      this.annotation.setText(displayString);

      Vec4 screenPoint = this.computeAnnotationPosition(pos);
      if (screenPoint != null)
         this.annotation.setScreenPoint(new Point((int) screenPoint.x, (int) screenPoint.y));

      this.annotation.getAttributes().setVisible(true);
   }
View Full Code Here

      return displayString;
   }

   protected Vec4 computeAnnotationPosition(Position pos)
   {
      Vec4 surfacePoint = this.wwd.getSceneController().getTerrain().getSurfacePoint(
              pos.getLatitude(), pos.getLongitude());
      if (surfacePoint == null)
      {
         Globe globe = this.wwd.getModel().getGlobe();
         surfacePoint = globe.computePointFromPosition(pos.getLatitude(), pos.getLongitude(),
View Full Code Here

            this.locationOffset = Vec4.ZERO;

        // Compute appropriate offset
        int x = (int) this.locationOffset.x - (refPoint.x - targetPoint.x);
        int y = (int) this.locationOffset.y - (refPoint.y - targetPoint.y);
        this.locationOffset = new Vec4(x, y, 0);

        // Compensate for rounding errors
        Point computedPoint = this.computeLocation(this.wwd.getView().getViewport());
        x += targetPoint.x - computedPoint.x;
        y += targetPoint.y - computedPoint.y;
        this.locationOffset = new Vec4(x, y, 0);

        if (this.snapToCorners)
            this.snapToCorners();
    }
View Full Code Here

        // Snap to edges
        x = Math.abs(x) < 16 ? 0 : x;
        y = Math.abs(y) < 16 ? 0 : y;

        this.position = newPos;
        this.locationOffset = new Vec4(x, y, 0);
    }
View Full Code Here

TOP

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

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.