Examples of distanceSq()


Examples of java.awt.Point.distanceSq()

      final NodeView sourceView = mapView.getNodeView(draggedLink.getSource());
      if (targetView != null && sourceView != null) {
        final Point targetLinkPoint = targetView.getLinkPoint(draggedLink.getEndInclination());
        final Point sourceLinkPoint = sourceView.getLinkPoint(draggedLink.getStartInclination());
        distSqToTarget = targetLinkPoint.distanceSq(originX, originY);
        distSqToSource = sourceLinkPoint.distanceSq(originX, originY);
      }
      if ((targetView == null || sourceView != null) && distSqToSource <= distSqToTarget * 2.25) {
        final Point changedInclination = draggedLink.getStartInclination();
        draggedLink.changeInclination(deltaX, deltaY, draggedLink.getSource(), changedInclination);
        draggedLink.setStartInclination(changedInclination);
View Full Code Here

Examples of java.awt.geom.Point2D.distanceSq()

   
      public void mousePressed( MouseEvent e )
      {
        Point2D  mousePt = getVirtualMousePos( e );
     
        if( mousePt.distanceSq( ctrlPt[ 0 ]) <= mousePt.distanceSq( ctrlPt[ 1 ])) {
          dragPt  = ctrlPt[ 0 ];
        } else {
          dragPt  = ctrlPt[ 1 ];
        }
       
View Full Code Here

Examples of java.awt.geom.Point2D.distanceSq()

   
      public void mousePressed( MouseEvent e )
      {
        Point2D  mousePt = getVirtualMousePos( e );
     
        if( mousePt.distanceSq( ctrlPt[ 0 ]) <= mousePt.distanceSq( ctrlPt[ 1 ])) {
          dragPt  = ctrlPt[ 0 ];
        } else {
          dragPt  = ctrlPt[ 1 ];
        }
       
View Full Code Here

Examples of java.awt.geom.Point2D.distanceSq()

   
      public void mousePressed( MouseEvent e )
      {
        Point2D  mousePt = getVirtualMousePos( e );
     
        if( mousePt.distanceSq( ctrlPt[ 0 ]) <= mousePt.distanceSq( ctrlPt[ 1 ])) {
          dragPt  = ctrlPt[ 0 ];
        } else {
          dragPt  = ctrlPt[ 1 ];
        }
       
View Full Code Here

Examples of java.awt.geom.Point2D.distanceSq()

   
      public void mousePressed( MouseEvent e )
      {
        Point2D  mousePt = getVirtualMousePos( e );
     
        if( mousePt.distanceSq( ctrlPt[ 0 ]) <= mousePt.distanceSq( ctrlPt[ 1 ])) {
          dragPt  = ctrlPt[ 0 ];
        } else {
          dragPt  = ctrlPt[ 1 ];
        }
       
View Full Code Here

Examples of java.awt.geom.Point2D.distanceSq()

        collRcv = doc.getActiveReceivers().getAll();
        for( i = 0; i < collRcv.size(); i++ ) {
          rcv = (Receiver) collRcv.get( i );
          ptReceiver = rcv.getAnchor();
          ptReceiverTrns = virtualToScreen( ptReceiver );
          distanceSq = ptReceiverTrns.distanceSq( ptMouse );
          if( distanceSq < hitDistSq ) {
            hitDistSq   = distanceSq;
            hitReceiver  = rcv;
          }
        }
View Full Code Here

Examples of java.awt.geom.Point2D.distanceSq()

        Shape shape = (Shape)ann;
        if(shape.contains(ip)) {
         
          Rectangle2D shapeBounds = shape.getBounds2D();
          Point2D shapeCenter = new Point2D.Double(shapeBounds.getCenterX(), shapeBounds.getCenterY());
          double distanceSq = shapeCenter.distanceSq(ip);
          if(distanceSq < closestDistance) {
            closestDistance = distanceSq;
            closestAnnotation = annotation;
          }
        }
View Full Code Here

Examples of java.awt.geom.Point2D.distanceSq()

       
        Shape componentBoundsShape = base.createTransformedShape(componentBounds);
        Point2D componentCenter = new Point2D.Double(componentBoundsShape.getBounds().getCenterX(),
            componentBoundsShape.getBounds().getCenterY());
        if(componentBoundsShape.contains(ip)) {
          double distanceSq = componentCenter.distanceSq(ip);
          if(distanceSq < closestDistance) {
            closestDistance = distanceSq;
            closestAnnotation = annotation;
          }
        }
View Full Code Here

Examples of org.openstreetmap.josm.data.coor.EastNorth.distanceSq()

        default:
            EastNorth P = n.getEastNorth();
            seg = segs.iterator().next();
            A = seg.a.getEastNorth();
            B = seg.b.getEastNorth();
            double a = P.distanceSq(B);
            double b = P.distanceSq(A);
            double c = A.distanceSq(B);
            q = (a - b + c) / (2*c);
            n.setEastNorth(new EastNorth(B.east() + q * (A.east() - B.east()), B.north() + q * (A.north() - B.north())));
        }
View Full Code Here

Examples of org.openstreetmap.josm.data.coor.EastNorth.distanceSq()

            EastNorth P = n.getEastNorth();
            seg = segs.iterator().next();
            A = seg.a.getEastNorth();
            B = seg.b.getEastNorth();
            double a = P.distanceSq(B);
            double b = P.distanceSq(A);
            double c = A.distanceSq(B);
            q = (a - b + c) / (2*c);
            n.setEastNorth(new EastNorth(B.east() + q * (A.east() - B.east()), B.north() + q * (A.north() - B.north())));
        }
    }
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.