public ClosestPoints getClosestPoints(Point point) { IConnectorPoint minPoint = this.connector.getConnectorStartPoint(); IConnectorPoint currentPoint = minPoint; while (currentPoint.getNextPoint() != null) { Point previousPoint = new Point(currentPoint.getAbsoluteLeft(),currentPoint.getAbsoluteTop()); Point nextPoint = new Point(currentPoint.getNextPoint().getAbsoluteLeft(),currentPoint.getNextPoint().getAbsoluteTop()); Region r = new Region(previousPoint,nextPoint); if (r.contains(point)){ minPoint = currentPoint; break; } currentPoint = currentPoint.getNextPoint(); } IConnectorPoint maxPoint = minPoint.getNextPoint(); ClosestPoints closesPoints = new ClosestPoints(minPoint, maxPoint); return closesPoints; }
@Override public void removeIntermediateConnectorPoint(IConnectorPoint point) { point.getPreviousPoint().setNextPoint(point.getNextPoint()); point.getNextPoint().setPreviousPoint(point.getPreviousPoint()); this.connectorPoints.remove(point); this.fireEvent(new RemoveIntermediateConnectorPointEvent(point)); this.fireEvent(new RemoveWayPointEvent(point)); this.refresh(); }
@Override public void refresh() { super.refresh(); invisibleLinearPath.getPoints().clear(); // TODO: determine best path // - rebuild it with new points starting with start point IConnectorPoint previousConnectorPoint = this.connectorStart; com.ebmwebsourcing.geasytools.geasysvg.ext.impl.Point previousPoint = null; while (previousConnectorPoint != null) { com.ebmwebsourcing.geasytools.geasysvg.ext.impl.Point point = new com.ebmwebsourcing.geasytools.geasysvg.ext.impl.Point( previousConnectorPoint.getRelativeX()+getUIPanel().getScrollLeft(), previousConnectorPoint.getRelativeY()+getUIPanel().getScrollTop()); if (previousPoint != null) previousPoint.setNextPoint(point); invisibleLinearPath.addPoint(point); previousConnectorPoint = previousConnectorPoint.getNextPoint(); previousPoint = point; } invisibleLinearPath.connectAllPoints(); refreshLabelPosition(); invisibleLinearPath.getElement().setAttribute("stroke-width", "7"); invisibleLinearPath.getElement().setAttribute("pointer-events", "painted"); invisibleLinearPath.getElement().setAttribute("visibility", "hidden"); //invisibleLinearPath.toFront(); this.visibleLinearPath.getElement().setAttribute("d", this.invisibleLinearPath.getElement().getAttribute("d")); //visibleLinearPath.toBack(); this.group.toFront(); }
p2 = new Point(point.getPreviousPoint().getAbsoluteLeft(),point.getPreviousPoint().getAbsoluteTop()); }else{ p2 = new Point(point.getNextPoint().getAbsoluteLeft(),point.getNextPoint().getAbsoluteTop());