示例#1
0
 public void Export(ClassModelData data)
 {
   List<ClassModelData> modelData = new List<ClassModelData>();
   modelData.Add(data);
   this.RenderDiagram(modelData);
 }
    /// <summary>
    /// Gets the class model data.
    /// </summary>
    /// <param name="referenceTypeName">Name of the reference type.</param>
    /// <returns>
    /// A new ClassModelData that contains the model for the type(s).
    /// </returns>
    private ClassModelData GetClassModelData(string referenceTypeName)
    {
      ClassModelData data = new ClassModelData();
      foreach (var typeInfo in this.ClassData.TypeDataList)
      {
        if (string.Compare(typeInfo.StartTypeName, referenceTypeName, StringComparison.Ordinal) == 0 && Rules.IsValidType(typeInfo.FullName))
        {
          // add the type
          data.AddObject(typeInfo);

          // add the base class connection
          if (typeInfo.BaseType != null && Rules.IsValidType(typeInfo.BaseType.FullName) && this.ClassData.TypeDataList.Contains(typeInfo.BaseType))
          {
            data.AddConnector(new ClassConnectorInfo(typeInfo.BaseType, typeInfo, string.Empty));
          }

          // add the property connections
          foreach (var item in typeInfo.PropertyList)
          {
            if (Rules.IsValidType(item.Value.ToString()))
            {
              data.AddConnector(new ClassConnectorInfo(typeInfo, item.Value, item.Key));
            }
          }
        }
      }

      return data;
    }