internal VisualEdge(EdgeController edgeController, uint startSlotId, uint endSlotId, bool isImplicit) { this.edgeController = edgeController; if (isImplicit) this.EdgeType = EdgeType.ImplicitConnection; else this.EdgeType = EdgeType.ExplicitConnection; this.version = VisualEdge.Version.Current; this.StartSlotId = startSlotId; this.EndSlotId = endSlotId; // Generate new ID for this visual edge. GraphController graphController = edgeController.GetGraphController(); IdGenerator idGenerator = graphController.GetIdGenerator(); this.EdgeId = idGenerator.GetNextId(ComponentType.Edge); controlPoints.Add(new Point()); controlPoints.Add(new Point()); controlPoints.Add(new Point()); controlPoints.Add(new Point()); GraphController controller = edgeController.GetGraphController(); Slot startSlot = controller.GetSlot(this.StartSlotId) as Slot; Slot endSlot = controller.GetSlot(this.EndSlotId) as Slot; if (startSlot != null && endSlot != null) { Point startPoint = startSlot.GetPosition(); Point endPoint = endSlot.GetPosition(); UpdateControlPoint(startPoint, endPoint, startSlot.SlotType != SlotType.Output); } else throw new ArgumentNullException("startSlot or endSlot"); }
internal VisualEdge(EdgeController edgeController, EdgeType edgeType) { this.edgeController = edgeController; this.EdgeType = edgeType; controlPoints.Add(new Point()); controlPoints.Add(new Point()); controlPoints.Add(new Point()); controlPoints.Add(new Point()); }
public void TestCreate01() { IStorage storage = null; GraphController graphController = new GraphController(null); EdgeController edgeController = new EdgeController(graphController); Assert.Throws<ArgumentNullException>(() => { IVisualEdge edge = VisualEdge.Create(edgeController, storage); }); }
public void TestDeserializeNullException() { IStorage storage = null; GraphController graphController = new GraphController(null); EdgeController edgeController = new EdgeController(graphController); IVisualEdge edge = new VisualEdge(edgeController, 0x30000001, 0x30000002, false); Assert.Throws<ArgumentNullException>(() => { edge.Deserialize(storage); }); }
public void TestCreate02() { IStorage storage = new BinaryStorage(); GraphController graphController = new GraphController(null); EdgeController edgeController = new EdgeController(graphController); IVisualEdge edge00 = new VisualEdge(edgeController, 0x30000001, 0x30000002, false); edge00.Serialize(storage); storage.Seek(0, SeekOrigin.Begin); IVisualEdge edge01 = VisualEdge.Create(edgeController, storage); Assert.AreEqual(edge00.EdgeId, edge01.EdgeId); Assert.AreEqual(edge00.StartSlotId, edge01.StartSlotId); Assert.AreEqual(edge00.EndSlotId, edge01.EndSlotId); }
public void TestRecordEdgeCreationForUndo00() { GraphController graphController = new GraphController(null); UndoRedoRecorder urr = new UndoRedoRecorder(graphController); EdgeController edgeController = new EdgeController(graphController); List<IVisualEdge> edgeList = new List<IVisualEdge>(); VisualEdge edge = new VisualEdge(edgeController, EdgeType.ExplicitConnection); edgeList.Add(edge); Assert.Throws<InvalidOperationException>(() => { urr.RecordEdgeCreationForUndo(edgeList); }); }
private VisualEdge(EdgeController edgeController) { this.edgeController = edgeController; }
internal static IVisualEdge Create(EdgeController edgeController, IStorage storage) { if (edgeController == null || storage == null) throw new ArgumentNullException("edgeController, storage"); IVisualEdge edge = new VisualEdge(edgeController); edge.Deserialize(storage); return edge; }
public void TestDeserilaizeOperationException() { IStorage storage = new BinaryStorage(); GraphController graphController = new GraphController(null); EdgeController edgeController = new EdgeController(graphController); IVisualEdge edge = new VisualEdge(edgeController, 0x30000001, 0x30000002, false); storage.WriteUnsignedInteger(FieldCode.EdgeSignature, 12); storage.Seek(0, SeekOrigin.Begin); Assert.Throws<InvalidOperationException>(() => { edge.Deserialize(storage); }); }
private void InitializeInternal(IGraphVisualHost visualHost) { //The identity of this graph controller this.Identifier = GraphController.identifierCounter++; //Optional Object this.visualHost = visualHost; //Essential Object this.edgeController = new EdgeController(this); this.graphProperties = new GraphProperties(); this.undoRedoRecorder = new UndoRedoRecorder(this); DrawingVisual visual = new DrawingVisual(); this.selectionBox = new SelectionBox(this, this.visualHost); // Create a timer for auto-saving in the background. this.autoSaveTimer = new DispatcherTimer(); this.autoSaveTimer.Interval = TimeSpan.FromSeconds(58); this.autoSaveTimer.Tick += OnAutoSaveTimerTicked; }