Пример #1
0
        public LinkedList <UPNodeConnector> LoadEdges(JsonTextReader reader, HashSet <UPNodeBase> nodeList)
        {
            loadedEdges.Clear();
            while (reader.Read() && reader.TokenType != JsonToken.EndArray)
            {
                UPNodeConnector edge = new UPNodeConnector();
                edge.lnNodeConnector.StrokeThickness    = 10;
                edge.lnNodeConnector.StrokeStartLineCap = System.Windows.Media.PenLineCap.Flat;
                edge.lnNodeConnector.StrokeEndLineCap   = System.Windows.Media.PenLineCap.Flat;

                int fromNodeID = (int)(long)reader.Value;
                edge.fromNodeRef = loadedNodes[fromNodeID];
                edge.fromNodeRef.fromLines.AddLast(edge);
                reader.Read();

                int toNodeID = (int)(long)reader.Value;
                edge.toNodeRef = loadedNodes[toNodeID];
                edge.toNodeRef.toLines.AddLast(edge);

                loadedEdges.AddLast(edge);
            }
            return(loadedEdges);
        }
Пример #2
0
 public void SaveEdgeData(UPNodeConnector edge, JsonWriter writer)
 {
     writer.WriteValue(edge.fromNodeRef.nodeID);
     writer.WriteValue(edge.toNodeRef.nodeID);
 }