Package java.awt.geom

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


   
      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

   
      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

   
      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

        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

        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

       
        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

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.