public override bool doTool() { if (trajectory.getInitial() != null && trajectory.getInitial().getID().Equals(nodeDataControl.getID())) { return(false); } trajectory.setInitial(nodeDataControl.getID()); if (trajectoryDataControl.initialNode != null) { trajectoryDataControl.initialNode.setInitial(false); } trajectoryDataControl.initialNode = nodeDataControl; trajectoryDataControl.initialNode.setInitial(true); return(true); }
public override bool doTool() { newSide = trajectory.addSide(startNode.getID(), endNode.getID(), -1); if (newSide != null) { newSideDataControl = new SideDataControl(sceneDataControl, trajectoryDataControl, newSide); trajectoryDataControl.getSides().Add(newSideDataControl); return(true); } return(false); }
/** * Add a new side to the trajectory * * @param startNode * the start node data control of the side * @param endNode * the end node data control of the side * @return bool indicating if the side was added */ public bool addSide(NodeDataControl startNode, NodeDataControl endNode) { if (startNode == endNode) { return(false); } string sID = startNode.getID(), eID = endNode.getID(); if (trajectory.getSides() .Any(s => (s.getIDStart() == sID && s.getIDEnd() == eID) || (s.getIDStart() == eID && s.getIDEnd() == sID))) { return(false); } Controller.Instance.AddTool(new AddTrajectorySideTool(startNode, endNode, trajectory, this, sceneDataControl)); return(true); }