@Test public void splittingArcPointSplitsHalfWay() { ArcPoint nextPoint = new ArcPoint(new Point2D.Double(10, 10), false); ArcPoint splitPoint = new ArcPoint(new Point2D.Double(0, 0), false); when(mockArc.getNextPoint(splitPoint)).thenReturn(nextPoint); controller.splitArcPoint(splitPoint); ArcPoint expected = new ArcPoint(new Point2D.Double(5, 5), false); verify(mockArc).addIntermediatePoint(expected); }
public void splitArcPoint(ArcPoint arcPoint) { ArcPoint nextPoint = arc.getNextPoint(arcPoint); double x = (arcPoint.getPoint().getX() + nextPoint.getPoint().getX())/2; double y = (arcPoint.getPoint().getY() + nextPoint.getPoint().getY())/2; Point2D point = new Point2D.Double(x,y); ArcPoint newPoint = new ArcPoint(point, arcPoint.isCurved()); arc.addIntermediatePoint(newPoint); UndoableEdit splitEdit = new AddArcPathPoint<>(arc, newPoint); registerUndoableEdit(splitEdit); }
ArcController extends AbstractPetriNetComponentController<Arc<S, T>> { public void splitArcPoint(ArcPoint arcPoint) { ArcPoint nextPoint = arc.getNextPoint(arcPoint); double x = (arcPoint.getPoint().getX() + nextPoint.getPoint().getX())/2; double y = (arcPoint.getPoint().getY() + nextPoint.getPoint().getY())/2; Point2D point = new Point2D.Double(x,y); ArcPoint newPoint = new ArcPoint(point, arcPoint.isCurved()); arc.addIntermediatePoint(newPoint); UndoableEdit splitEdit = new AddArcPathPoint<>(arc, newPoint); registerUndoableEdit(splitEdit); } }
ArcController extends AbstractPetriNetComponentController<Arc<S, T>> { public void splitArcPoint(ArcPoint arcPoint) { ArcPoint nextPoint = arc.getNextPoint(arcPoint); double x = (arcPoint.getPoint().getX() + nextPoint.getPoint().getX())/2; double y = (arcPoint.getPoint().getY() + nextPoint.getPoint().getY())/2; Point2D point = new Point2D.Double(x,y); ArcPoint newPoint = new ArcPoint(point, arcPoint.isCurved()); arc.addIntermediatePoint(newPoint); UndoableEdit splitEdit = new AddArcPathPoint<>(arc, newPoint); registerUndoableEdit(splitEdit); } ArcController(Arc<S, T> arc, PetriNetController petriNetController, UndoableEditListener listener); }
ArcController extends AbstractPetriNetComponentController<Arc<S, T>> { public void splitArcPoint(ArcPoint arcPoint) { ArcPoint nextPoint = arc.getNextPoint(arcPoint); double x = (arcPoint.getPoint().getX() + nextPoint.getPoint().getX())/2; double y = (arcPoint.getPoint().getY() + nextPoint.getPoint().getY())/2; Point2D point = new Point2D.Double(x,y); ArcPoint newPoint = new ArcPoint(point, arcPoint.isCurved()); arc.addIntermediatePoint(newPoint); UndoableEdit splitEdit = new AddArcPathPoint<>(arc, newPoint); registerUndoableEdit(splitEdit); } ArcController(Arc<S, T> arc, PetriNetController petriNetController, UndoableEditListener listener); void setWeight(String token, String expr); void setWeights(Map<String, String> newWeights); String getWeightForToken(String token); Connectable getTarget(); void toggleArcPointType(ArcPoint arcPoint); void splitArcPoint(ArcPoint arcPoint); void addPoint(Point2D point); void deletePoint(ArcPoint point); }
ArcController extends AbstractPetriNetComponentController<Arc<S, T>> { public void splitArcPoint(ArcPoint arcPoint) { ArcPoint nextPoint = arc.getNextPoint(arcPoint); double x = (arcPoint.getPoint().getX() + nextPoint.getPoint().getX())/2; double y = (arcPoint.getPoint().getY() + nextPoint.getPoint().getY())/2; Point2D point = new Point2D.Double(x,y); ArcPoint newPoint = new ArcPoint(point, arcPoint.isCurved()); arc.addIntermediatePoint(newPoint); UndoableEdit splitEdit = new AddArcPathPoint<>(arc, newPoint); registerUndoableEdit(splitEdit); } ArcController(Arc<S, T> arc, PetriNetController petriNetController, UndoableEditListener listener); void setWeight(String token, String expr); void setWeights(Map<String, String> newWeights); String getWeightForToken(String token); Connectable getTarget(); void toggleArcPointType(ArcPoint arcPoint); void splitArcPoint(ArcPoint arcPoint); void addPoint(Point2D point); void deletePoint(ArcPoint point);  }