/// <summary> /// Clears all diagram visual elements. /// </summary> public void Clear() { Subject = null; this.subjectDiagramElement = null; this.drawingEngine = null; DiagramElements.ToList().ForEach(x => x.Cleanup()); DiagramElements.Clear(); }
/// <summary> /// Assigns the diagram data. /// This is the main entry point to display something into the diagram visual tree. /// </summary> /// <param name="bindableDiagramData">The data to load into the diagram visual.</param> public void AssignDiagramData(object bindableDiagramData) { var subject = bindableDiagramData as IVisualisableTypeWithAssociations; if (subject == null) { throw new InvalidOperationException("Code Error: Invalid type given to Viewport Controller: " + bindableDiagramData); } Subject = subject; Subject.DiscoverSecondaryAssociationsInModel(); // This enables lines on the diagram other than those involving the subject. DiagramElements.Clear(); this.drawingEngine = new ClassUmlDrawingEngine(DiagramId, subject); foreach (DiagramElement element in this.drawingEngine.DrawAllBoxes()) { DiagramElements.Add(element); } }