public virtual void AddRootShapesForElement(DomainModelElement modelElement)//, bool bIgnoreVisualizationBehavior) { DiagramDomainDataDirectory data = modelElement.Store.DomainDataAdvDirectory.ResolveExtensionDirectory <DiagramDomainDataDirectory>(); IDomainModelServices topMost = modelElement.GetDomainModelServices().TopMostService; List <Guid> shapeIds = data.GetRootShapeTypesForElement(modelElement.GetDomainClassId()); if (shapeIds != null) { foreach (Guid shapeId in shapeIds) { ShapeClassInfo shapeInfo = data.ShapeClassInfos[shapeId]; ReadOnlyCollection <ModelElement> diagrams = modelElement.Store.ElementDirectory.FindElements(shapeInfo.DiagramClassType); if (diagrams.Count == 0) { continue; } foreach (Diagram d in diagrams) { if (d.IsVisible && d.CanHostShape(shapeId)) { if (!DiagramHelper.IsElementDisplayedOn(d, shapeId, modelElement.Id)) { NodeShape shape = topMost.ShapeProvider.CreateShapeForElement(shapeId, modelElement) as NodeShape; d.Children.Add(shape); DiagramsShapeStore.AddToStore(shape.Element.Id, shape.Id); shape.FixUpMissingLinkShapes(); } } } } } }
/// <summary> /// Adds a ShapeElement to the shape mapping dictionary. /// </summary> /// <param name="shapeElement">Shape element to add to the shape mapping dictionary.</param> public virtual void AddToShapeMapping(ShapeElement shapeElement, bool bOnlyAddToStore) { if (shapeElement == null) { throw new ArgumentNullException("shapeElement"); } if (shapeElement.Element == null) { throw new ArgumentNullException("shapeElement.Element"); } if (!bOnlyAddToStore) { if (!shapeMapping.ContainsKey(shapeElement.Element.Id)) { shapeMapping.Add(shapeElement.Element.Id, new List <Guid>()); } if (!shapeMapping[shapeElement.Element.Id].Contains(shapeElement.Id)) { shapeMapping[shapeElement.Element.Id].Add(shapeElement.Id); } } DiagramsShapeStore.AddToStore(shapeElement.Element.Id, shapeElement.Id); }