Example #1
0
        public void AddEdge(IEdge edge)
        {
            if (dumpInfo.IsExcludedEdgeType(edge.Type))
            {
                return;
            }

            String erName = edgeRealizer ?? GetEdgeRealizer(edge.Type);

            String edgeName = graph.GetElementName(edge);
            String srcName  = graph.GetElementName(edge.Source);
            String tgtName  = graph.GetElementName(edge.Target);

            ycompStream.Write("addEdge \"e" + edgeName + "\" \"n" + srcName + "\" \"n" + tgtName
                              + "\" \"" + erName + "\" \"" + GetElemLabel(edge) + "\"\n");
            foreach (AttributeType attrType in edge.Type.AttributeTypes)
            {
                if (attrType.Kind == AttributeKind.SetAttr || attrType.Kind == AttributeKind.MapAttr)
                {
                    IDictionary setmap = (IDictionary)edge.GetAttribute(attrType.Name);
                    string      attrTypeString;
                    string      attrValue;
                    EmitHelper.ToString(setmap, out attrTypeString, out attrValue, attrType, graph);
                    ycompStream.Write("changeEdgeAttr \"e" + edgeName + "\" \"" + attrType.OwnerType.Name + "::" + attrType.Name + " : "
                                      + attrTypeString + "\" \"" + Encode(attrValue) + "\"\n");
                }
                else if (attrType.Kind == AttributeKind.ArrayAttr)
                {
                    IList  array = (IList)edge.GetAttribute(attrType.Name);
                    string attrTypeString;
                    string attrValue;
                    EmitHelper.ToString(array, out attrTypeString, out attrValue, attrType, graph);
                    ycompStream.Write("changeEdgeAttr \"e" + edgeName + "\" \"" + attrType.OwnerType.Name + "::" + attrType.Name + " : "
                                      + attrTypeString + "\" \"" + Encode(attrValue) + "\"\n");
                }
                else
                {
                    object attr = edge.GetAttribute(attrType.Name);
                    ycompStream.Write("changeEdgeAttr \"e" + edgeName + "\" \"" + attrType.OwnerType.Name + "::" + attrType.Name + " : "
                                      + GetKindName(attrType) + "\" \"" + EncodeAttr(attr) + "\"\n");
                }
            }
            isDirty       = true;
            isLayoutDirty = true;
        }
Example #2
0
 public void ChangeEdgeAttribute(IEdge edge, AttributeType attrType,
                                 AttributeChangeType changeType, Object newValue, Object keyValue)
 {
     if (attrType.Kind == AttributeKind.SetAttr || attrType.Kind == AttributeKind.MapAttr)
     {
         IDictionary setmap = (IDictionary)edge.GetAttribute(attrType.Name);
         string      attrTypeString;
         string      attrValue;
         EmitHelper.ToString(setmap, changeType, newValue, keyValue, out attrTypeString, out attrValue, attrType, graph);
         ChangeEdgeAttribute(edge, attrType, attrTypeString, attrValue);
     }
     else if (attrType.Kind == AttributeKind.ArrayAttr)
     {
         IList  array = (IList)edge.GetAttribute(attrType.Name);
         string attrTypeString;
         string attrValue;
         EmitHelper.ToString(array, changeType, newValue, keyValue, out attrTypeString, out attrValue, attrType, graph);
         ChangeEdgeAttribute(edge, attrType, attrTypeString, attrValue);
     }
     else
     {
         ChangeEdgeAttribute(edge, attrType, GetKindName(attrType), newValue.ToString());
     }
 }
Example #3
0
 public int Compare(INode this_, INode that)
 {
     IEdge thisParentalEdge = exporter.containedVia[this_];
     IEdge thatParentalEdge = exporter.containedVia[that];
     int typeNameComparison = thisParentalEdge.Type.Name.CompareTo(thatParentalEdge.Type.Name);
     if(typeNameComparison != 0)
         return typeNameComparison;
     else
     {
         try
         {
             int thisOrdering = (int)thisParentalEdge.GetAttribute("ordering");
             int thatOrdering = (int)thatParentalEdge.GetAttribute("ordering");
             return thisOrdering.CompareTo(thatOrdering);
         }
         catch(Exception)
         {
             return this_.GetHashCode().CompareTo(that.GetHashCode());
         }
     }
 }