/// <summary> /// Creates a new visual node with the specified id, adds it to the presentation and adds it to the model /// as a transition. Adjusts the size of the presentation area and scrolls according to the new visual /// nodes position. /// </summary> /// <param name="pos">The position on which the new transition is to be created.</param> /// <param name="id">The id of the transition to be created.</param> /// /// <returns>The id of the created transition.</returns> public String CreateTrans(Point pos, String id) { if (id == null) id = Guid.NewGuid().ToString(); Model.AddTransition((int)pos.X, (int)pos.Y, id); VisualNode newTrans = new VisualNode(pos.X, pos.Y, id, DrawSize, NodeType.Transition, SelectionManager, ElementManager, Model); ElementProvider.AddNode(newTrans); //if (!ElementProvider.NameFieldExists(id)) ElementProvider.AddNameField(new NameField(id, ElementManager, Model, newTrans)); ElementManager.AdjustViewSize(id, UndoRedoOps.Create); newTrans.IsBeyondEdge = true; return id; }
/// <summary> /// Creates a new visual node with the specified id, adds it to the presentation and adds it to the model /// as a place. Adjusts the size of the presentation area and scrolls according to the new visual nodes /// position. /// </summary> /// <param name="pos">The position on which the new place is to be created.</param> /// <param name="id">The id of the place to be created.</param> /// <returns>The id of the created place.</returns> public String CreatePlace(Point pos, String id) { if (id == null) id = Guid.NewGuid().ToString(); Model.AddPlace((int)pos.X, (int)pos.Y, id); VisualNode newPlace = new VisualNode(pos.X, pos.Y, id, DrawSize, NodeType.Place, SelectionManager, ElementManager, Model); ElementProvider.AddNode(newPlace); ElementProvider.AddNameField(new NameField(id, ElementManager, Model, newPlace)); ElementManager.AdjustViewSize(id, UndoRedoOps.Create); newPlace.IsBeyondEdge = true; return id; }