예제 #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DiagramConnectorNode"/> class.
 /// </summary>
 /// <param name="node">The diagram node.</param>
 /// <param name="group">The diagram group.</param>
 /// <param name="row">The diagram row.</param>
 internal DiagramConnectorNode(DiagramNode node, DiagramGroup group, DiagramRow row)
 {
   this.node = node;
   this.group = group;
   this.row = row;
 }
예제 #2
0
    /// <summary>
    /// Creates the model descendant row.
    /// </summary>
    /// <returns>The newly created DiagramRow.</returns>
    internal DiagramRow CreateClassModelDescendantRow()
    {
      // TODO: Find proper algorithm to layout the shapes...
      // The object info nodes are contained in one groups, 
      DiagramGroup descendantGroup = new DiagramGroup();
      DiagramGroup baselessGroup = new DiagramGroup();

      // Set up the row.
      DiagramRow descendantRow = new DiagramRow();

      foreach (ExtendedObjectInfo objectInfo in this.DiagramModel)
      {
        // find descendants from primaryRow.PrimaryGroup.Nodes
        if (objectInfo.BaseType != null && this.objectInfoLookup.ContainsKey(objectInfo.BaseType) && !this.objectInfoLookup.ContainsKey(objectInfo))
        {
          if (!this.objectInfoLookup.ContainsKey(objectInfo))
          {
            DiagramNode node = CreateNode(objectInfo);
            descendantGroup.Add(node);
            DiagramConnectorNode startConnector = new DiagramConnectorNode(node, descendantGroup, descendantRow);
            this.objectInfoLookup.Add(node.ObjectInfo, startConnector);

            DiagramConnectorNode endConnector = this.objectInfoLookup[objectInfo.BaseType];

            // create inheritance connector
            this.connections.Add(new DiagramInheritanceConnector(startConnector, endConnector));

            // create association connector
            this.connections.Add(new DiagramAssociationConnector(startConnector, endConnector));
          }
        }
        else if (objectInfo.BaseType != null && !this.objectInfoLookup.ContainsKey(objectInfo))
        {
          if (!this.objectInfoLookup.ContainsKey(objectInfo))
          {
            DiagramNode node = CreateNode(objectInfo);
            descendantGroup.Add(node);
            this.objectInfoLookup.Add(node.ObjectInfo, new DiagramConnectorNode(node, descendantGroup, descendantRow));
          }
        }

        // add four more nodes (if available) to baselessGroup
      }

      descendantRow.Add(descendantGroup);
      descendantRow.Add(baselessGroup);

      return descendantRow;
    }
예제 #3
0
    /// <summary>
    /// Creates the primary model row.
    /// </summary>
    /// <param name="primaryObjectInfo">The primary object info.</param>
    /// <returns>The created DiagramRow instance.</returns>
    internal DiagramRow CreateClassModelPrimaryRow(ObjectInfo primaryObjectInfo)
    {
      // TODO: find proper algorithm to layout the shapes...
      // The object info nodes are contained in different groups, 
      DiagramGroup primaryGroup = new DiagramGroup();
      DiagramGroup baselessGroup = new DiagramGroup();

      // Set up the row.
      DiagramRow primaryRow = new DiagramRow();

      // do something with objectInfo's group
      ExtendedObjectInfo extendedInfo = primaryObjectInfo as ExtendedObjectInfo;
      if (extendedInfo != null)
      {
        // code is here currently to use property getter;
        if (string.Compare(extendedInfo.Group, "default", StringComparison.OrdinalIgnoreCase) == 0)
        {
          // this is the default group...
        }
        else
        {
          // these are any other groups...
        }

        foreach (ExtendedObjectInfo objectInfo in this.DiagramModel)
        {
          // find base type within current namespace
          ExtendedObjectInfo baseInfo = this.FindBaseTypeInNamespace(objectInfo);
          if (baseInfo != null)
          {
            if (!this.objectInfoLookup.ContainsKey(baseInfo))
            {
              DiagramNode node = CreateNode(baseInfo);

              // code is here currently to use property getter;
              if (node.NodeType == NodeType.TypeInfo || node.NodeType == NodeType.MessageInfo)
              {
                // exit.....
                if (node.Location.X == 0)
                {
                  // exit even faster...
                }
              }

              primaryGroup.Add(node);
              this.objectInfoLookup.Add(node.ObjectInfo, new DiagramConnectorNode(node, primaryGroup, primaryRow));
            }
          }
          else
          {
            if (baselessGroup.Nodes.Count < 10)
            {
              if (!this.objectInfoLookup.ContainsKey(objectInfo))
              {
                DiagramNode node = CreateNode(objectInfo);
                baselessGroup.Add(node);
                this.objectInfoLookup.Add(node.ObjectInfo, new DiagramConnectorNode(node, baselessGroup, primaryRow));
              }
            }
          }
        }
      }

      primaryRow.Add(primaryGroup);
      primaryRow.Add(baselessGroup);

      return primaryRow;
    }
예제 #4
0
    /// <summary>
    /// Creates the message row.
    /// </summary>
    /// <param name="messageInfo">The message info.</param>
    /// <returns>A new message row.</returns>
    internal DiagramRow CreateSequenceMessageRow(MessageInfo messageInfo)
    {
      DiagramGroup group = new DiagramGroup();

      // Set up the row.
      DiagramRow row = new DiagramRow();
      DiagramConnectorNode sourceConnector = null;
      DiagramConnectorNode targetConnector = null;

      foreach (DiagramConnectorNode connectorNode in this.ObjectInfoLookup.Values)
      {
        DiagramNode node = CreateNode(messageInfo);
        if (messageInfo != null &&
          (connectorNode.Node.ObjectInfo == messageInfo.Source || connectorNode.Node.ObjectInfo == messageInfo.Target))
        {
          node.ObjectInfo = connectorNode.Node.ObjectInfo;
          if (connectorNode.Node.ObjectInfo == messageInfo.Source && sourceConnector == null)
          {
            sourceConnector = new DiagramConnectorNode(node, group, row);
          }
          else
          {
            targetConnector = new DiagramConnectorNode(node, group, row);
          }
        }

        group.Add(node);
      }

      if (targetConnector == null)
      {
        targetConnector = sourceConnector;
      }

      if (sourceConnector != null)
      {
        // add the message connection between the two nodes
        this.connections.Add(new DiagramCallConnector(sourceConnector, targetConnector));
      }

      row.Add(group);

      return row;
    }
예제 #5
0
    /// <summary>
    /// Creates the primary row.
    /// </summary>
    /// <returns>The primary row.</returns>
    internal DiagramRow CreateSequencePrimaryRow()
    {
      // The object info nodes are contained in one groups, 
      DiagramGroup primaryGroup = new DiagramGroup();

      // Set up the row.
      DiagramRow primaryRow = new DiagramRow();

      foreach (ObjectInfo objectInfo in this.DiagramModel)
      {
        DiagramNode node = CreateNode(objectInfo);
        primaryGroup.Add(node);
        this.objectInfoLookup.Add(node.ObjectInfo, new DiagramConnectorNode(node, primaryGroup, primaryRow));
      }

      primaryRow.Add(primaryGroup);

      return primaryRow;
    }
예제 #6
0
 /// <summary>
 /// Add the group to the row.
 /// </summary>
 /// <param name="group">The diagram group.</param>
 internal void Add(DiagramGroup group)
 {
   this.groups.Add(group);
   this.AddVisualChild(group);
 }