public VisioPage(Page Page) { this.Page = Page; this.classes = new VisioList<VisioClass>( Page.Shapes, delegate(Shape shape) { return VisioHelpers.GetShapeType(shape) == Constants.Class; } ); this.relationships = new VisioList<VisioConnector>( Page.Shapes, delegate(Shape shape) { String type = VisioHelpers.GetShapeType(shape); return type == Constants.Association || type == Constants.Composition; } ); this.inheritances = new VisioList<VisioConnector>( Page.Shapes, delegate(Shape shape) { return VisioHelpers.GetShapeType(shape) == Constants.Generalization; } ); this.connectors = new VisioList<VisioConnector>( Page.Shapes, delegate(Shape shape) { String type = VisioHelpers.GetShapeType(shape); return type == Constants.Association || type == Constants.Composition || type == Constants.Generalization; } ); }
private void SynchronizeClasses(List<DomainClass> implementationOnlyClasses) { Trace.WriteLine("Synchronizing Classes"); Trace.Indent(); foreach (DomainClass dc in Doc.Dsl.Classes) { if (!implementationOnlyClasses.Contains(dc)) { Shape shape = Page.Find(dc.GUID); VisioClass vc = new VisioClass(shape == null ? VisioMaster.Drop(Page.Document, "Class") : shape); vc.GUID = dc.GUID; vc.Name = dc.Xml.GetAttribute("Name"); vc.DisplayName = dc.Xml.GetAttribute("DisplayName"); String attrs = ""; foreach (DomainProperty prop in dc.Properties) { attrs += prop.Xml.GetAttribute("Name") + "\n"; } vc.Attributes = attrs.Trim(); } } foreach (DomainClass dc in Doc.Dsl.Classes) { if (!implementationOnlyClasses.Contains(dc)) { if (dc.BaseClass != null) { Shape vc = Page.Find(dc.GUID); Shape bc = Page.Find(Doc.Dsl.Classes[dc.BaseClass].GUID); VisioList<VisioConnector> connectors = new VisioList<VisioConnector>( Page.Shapes, delegate(Shape shape) { VisioConnector conn = new VisioConnector(shape); return conn.Source == vc && conn.Target == bc; } ); if (connectors.Count == 0) { VisioMaster.DropConnection(vc, bc, Constants.Generalization); } } } } Trace.Unindent(); }