Ejemplo n.º 1
0
    public void AddModelObject(ClassTypeInfo extendedTypeData, string classModelGroup)
    {
      if (extendedTypeData == null)
      {
        throw new ArgumentNullException("extendedTypeData");
      }

      ExtendedObjectInfo objectInfo = new ExtendedObjectInfo(extendedTypeData, classModelGroup);
      DiagramContext.DiagramObjects.Add(objectInfo);
    }
Ejemplo n.º 2
0
    /// <summary>
    /// Finds the base type in namespace.
    /// </summary>
    /// <param name="objectInfo">The object info.</param>
    /// <returns>The found base type info, null when not found.</returns>
    private ExtendedObjectInfo FindBaseTypeInNamespace(ExtendedObjectInfo objectInfo)
    {
      ExtendedObjectInfo result = null;
      if (objectInfo.BaseType != null && objectInfo.BaseType.Namespace == objectInfo.Namespace)
      {
        ExtendedObjectInfo baseType = this.DiagramModel.Find(objectInfo.BaseType.Key) as ExtendedObjectInfo;
        if (baseType != null)
        {
          result = this.FindBaseTypeInNamespace(baseType);
          if (result == null)
          {
            return baseType;
          }
        }
      }

      return result;
    }
Ejemplo n.º 3
0
    /// <summary>
    /// Creates the node.
    /// </summary>
    /// <param name="objectInfo">The extended object info.</param>
    /// <returns>A new DiagramNode based on the given objectInfo.</returns>
    private static DiagramNode CreateNode(ExtendedObjectInfo objectInfo)
    {
      DiagramModelNode node = new DiagramModelNode();
      node.ObjectInfo = objectInfo;
      switch (objectInfo.Modifier)
      {
        case TypeModifier.None:
          node.NodeType = NodeType.Class;
          break;
        case TypeModifier.Interface:
          node.NodeType = NodeType.Interface;
          break;
        case TypeModifier.Abstract:
          node.NodeType = NodeType.Abstract;
          break;
        case TypeModifier.Sealed:
          node.NodeType = NodeType.Sealed;
          break;
        case TypeModifier.Static:
          node.NodeType = NodeType.Static;
          break;
        case TypeModifier.Enumeration:
          node.NodeType = NodeType.Enumeration;
          break;
        case TypeModifier.Struct:
          node.NodeType = NodeType.Struct;
          break;
        case TypeModifier.Delegate:
          node.NodeType = NodeType.Delegate;
          break;
        default:
          node.NodeType = NodeType.Class;
          break;
      }

      if (objectInfo.BaseType != null)
      {
        if (string.Compare(objectInfo.Namespace, objectInfo.BaseType.Namespace, StringComparison.Ordinal) != 0)
        {
          node.NodeBaseLabel = objectInfo.BaseType.FullName;
        }
        else
        {
          node.NodeBaseLabel = objectInfo.BaseType.ToString();
        }
        node.MeasureWidth();
      }

      return node;
    }