public boolean isHoverable(Point pt) { if (hoverPos != null) { return pt.distanceSq(hoverPos) <= HOVER_THRESHOLD; } return false; } }
@Override public void mouseDragged(MouseEvent event) { if (point1 == null) { return; } if (point2 == null) { // first drag event after mousePressed --> // then we must check against triggerDistance Point p2 = event.getPoint(); if (Point.distanceSq(point1.getX(), point1.getY(), p2.getX(), p2.getY()) >= triggerDistance * triggerDistance) { point2 = p2; updateAnnotation(); } } else { // already dragging, just update point2 = event.getPoint(); updateAnnotation(); } }
@Override public void mouseDragged(MouseEvent event) { if (point1 == null) { return; } if (point2 == null) { // first drag event after mousePressed --> // then we must check against triggerDistance Point p2 = event.getPoint(); if (Point.distanceSq(point1.getX(), point1.getY(), p2.getX(), p2.getY()) >= triggerDistance * triggerDistance) { point2 = p2; updateAnnotation(); } } else { // already dragging, just update point2 = event.getPoint(); updateAnnotation(); } }
final Valeur v = (Valeur) c.valeurs_.get(j); final Point vr = versEcran(v, _cx); dtmp = _p.distanceSq(vr.x, vr.y); if (dtmp < d) { d = dtmp; final Valeur v = (Valeur) _cx.cs_.valeurs_.get(j); final Point vr = versEcran(v, _cx); dtmp = _p.distanceSq(vr.x, vr.y); if (dtmp < d) { d = dtmp;
/** * Return, from the given list of cell, the one which is the closer to the * {@link #point} of this instance. */ private mxCell getClosestCell( final Iterable< mxCell > vertices ) { double min_dist = Double.POSITIVE_INFINITY; mxCell target_cell = null; for ( final mxCell lCell : vertices ) { final Point location = lCell.getGeometry().getPoint(); final double dist = location.distanceSq( point ); if ( dist < min_dist ) { min_dist = dist; target_cell = lCell; } } return target_cell; }
/** * Return, from the given list of cell, the one which is the closer to the * {@link #point} of this instance. */ private mxCell getClosestCell( final Iterable< mxCell > vertices ) { double min_dist = Double.POSITIVE_INFINITY; mxCell target_cell = null; for ( final mxCell lCell : vertices ) { final Point location = lCell.getGeometry().getPoint(); final double dist = location.distanceSq( point ); if ( dist < min_dist ) { min_dist = dist; target_cell = lCell; } } return target_cell; }
/** * Return, from the given list of cell, the one which is the closer to * the point of this instance. * * @param point */ private mxCell getClosestCell( final Iterable< mxCell > vertices, final Point2D point ) { double min_dist = Double.POSITIVE_INFINITY; mxCell target_cell = null; for ( final mxCell cell : vertices ) { final Point location = cell.getGeometry().getPoint(); final double dist = location.distanceSq( point ); if ( dist < min_dist ) { min_dist = dist; target_cell = cell; } } return target_cell; } }
/** * Return, from the given list of cell, the one which is the closer to * the point of this instance. * * @param point */ private mxCell getClosestCell( final Iterable< mxCell > vertices, final Point2D point ) { double min_dist = Double.POSITIVE_INFINITY; mxCell target_cell = null; for ( final mxCell cell : vertices ) { final Point location = cell.getGeometry().getPoint(); final double dist = location.distanceSq( point ); if ( dist < min_dist ) { min_dist = dist; target_cell = cell; } } return target_cell; } }
if (curveEnd.distanceSq(arcEnd) < curveEnd.distanceSq(arc.getEnd(!rev))) { return new ArcView(arc, true); if (curveEnd.distanceSq(arcP1) < curveEnd.distanceSq(arcP2)) { return new ArcView(arc, true);
final Point targetLinkPoint = targetView.getLinkPoint(draggedLink.getEndInclination()); final Point sourceLinkPoint = sourceView.getLinkPoint(draggedLink.getStartInclination()); distSqToTarget = targetLinkPoint.distanceSq(originX, originY); distSqToSource = sourceLinkPoint.distanceSq(originX, originY);
final double dist = center.distanceSq(target);