/// <summary> /// Create a shape of the given type for the given element type. /// </summary> /// <param name="modelElement">Model element.</param> /// <param name="shapeTypeId">Shape type id.</param> /// <param name="assignments">Properties for the shape.</param> /// <returns>Shape if one could be created. Null otherwise.</returns> public override DslModeling.ModelElement CreateShapeForElement(System.Guid shapeTypeId, DslModeling::ModelElement modelElement, params DslModeling::PropertyAssignment[] assignments) { DslEditorDiagrams::NodeShape nodeShape = null; if (createShapeMap == null) { createShapeMap = new global::System.Collections.Generic.Dictionary <global::System.Guid, int>(1); createShapeMap.Add(global::Tum.TestLanguage.TestShape.DomainClassId, 0); } int index; if (!createShapeMap.TryGetValue(shapeTypeId, out index)) { throw new global::System.ArgumentException("Unrecognized shape type " + shapeTypeId.ToString()); } switch (index) { case 0: nodeShape = new global::Tum.TestLanguage.TestShape(modelElement.Store, assignments); break; } if (nodeShape == null) { throw new System.InvalidOperationException("Couldn't create shape of type " + shapeTypeId.ToString() + " for model element " + modelElement.ToString()); } nodeShape.Element = modelElement; return(nodeShape); }
/// <summary> /// Create a shape of the given type for the given element type. /// </summary> /// <param name="modelElement">Model element.</param> /// <param name="shapeTypeId">Shape type id.</param> /// <param name="assignments">Properties for the shape.</param> /// <returns>Shape if one could be created. Null otherwise.</returns> public override DslModeling.ModelElement CreateShapeForElement(System.Guid shapeTypeId, DslModeling::ModelElement modelElement, params DslModeling::PropertyAssignment[] assignments) { DslEditorDiagrams::NodeShape nodeShape = null; if( createShapeMap == null ) { createShapeMap = new global::System.Collections.Generic.Dictionary<global::System.Guid, int>(1); createShapeMap.Add(global::Tum.TestLanguage.TestShape.DomainClassId, 0); } int index; if (!createShapeMap.TryGetValue(shapeTypeId, out index)) throw new global::System.ArgumentException("Unrecognized shape type " + shapeTypeId.ToString()); switch (index) { case 0: nodeShape = new global::Tum.TestLanguage.TestShape(modelElement.Store, assignments); break; } if( nodeShape == null ) throw new System.InvalidOperationException("Couldn't create shape of type " + shapeTypeId.ToString() + " for model element " + modelElement.ToString()); nodeShape.Element = modelElement; return nodeShape; }