コード例 #1
0
        /// <summary>
        /// Create a shape of the given link shape type.
        /// </summary>
        /// <param name="shapeTypeId">Shape type id.</param>
        /// <param name="modelElement">Model element.</param>
        /// <param name="assignments">Properties for the shape.</param>
        /// <returns>Shape if one could be created. Null otherwise.</returns>
        public override DslModeling::ModelElement CreateShapeForElementLink(System.Guid shapeTypeId, DslModeling::ModelElement modelElement, params DslModeling::PropertyAssignment[] assignments)
        {
            DslEditorDiagrams::LinkShape nodeShape = null;

            if (createRSShapeMap == null)
            {
                createRSShapeMap = new global::System.Collections.Generic.Dictionary <global::System.Guid, int>(2);
                createRSShapeMap.Add(global::Tum.FamilyTreeDSL.ParentOfShape.DomainClassId, 0);
                createRSShapeMap.Add(global::Tum.FamilyTreeDSL.MarriedToShape.DomainClassId, 1);
            }
            int index;

            if (!createRSShapeMap.TryGetValue(shapeTypeId, out index))
            {
                throw new global::System.ArgumentException("Unrecognized shape type " + shapeTypeId.ToString());
            }
            switch (index)
            {
            case 0: nodeShape = new global::Tum.FamilyTreeDSL.ParentOfShape(modelElement.Store, assignments); break;

            case 1: nodeShape = new global::Tum.FamilyTreeDSL.MarriedToShape(modelElement.Store, assignments); break;
            }

            if (nodeShape == null)
            {
                throw new System.InvalidOperationException("Couldn't create shape of type " + shapeTypeId.ToString() + " for element link " + modelElement.ToString());
            }

            nodeShape.Element = modelElement;

            return(nodeShape);
        }
コード例 #2
0
        /// <summary>
        /// Create a shape of the given link shape type.
        /// </summary>
        /// <param name="shapeTypeId">Shape type id.</param>
        /// <param name="modelElement">Model element.</param>
		/// <param name="assignments">Properties for the shape.</param>
        /// <returns>Shape if one could be created. Null otherwise.</returns>
        public override DslModeling::ModelElement CreateShapeForElementLink(System.Guid shapeTypeId, DslModeling::ModelElement modelElement, params DslModeling::PropertyAssignment[] assignments)
		{
			
			DslEditorDiagrams::LinkShape nodeShape = null;	
		
			if( createRSShapeMap == null )
			{
				createRSShapeMap = new global::System.Collections.Generic.Dictionary<global::System.Guid, int>(2);
				createRSShapeMap.Add(global::Tum.FamilyTreeDSL.ParentOfShape.DomainClassId, 0);
				createRSShapeMap.Add(global::Tum.FamilyTreeDSL.MarriedToShape.DomainClassId, 1);
			}
			int index;
			if (!createRSShapeMap.TryGetValue(shapeTypeId, out index))
				throw new global::System.ArgumentException("Unrecognized shape type " + shapeTypeId.ToString());
			switch (index)
			{
				case 0: nodeShape = new global::Tum.FamilyTreeDSL.ParentOfShape(modelElement.Store, assignments); break;
				case 1: nodeShape = new global::Tum.FamilyTreeDSL.MarriedToShape(modelElement.Store, assignments); break;
				
			}

			if( nodeShape == null )
				throw new System.InvalidOperationException("Couldn't create shape of type " + shapeTypeId.ToString() + " for element link " + modelElement.ToString());
			
			nodeShape.Element = modelElement;
								
			return nodeShape;
		
        }