void ReadNodeFeatures(Node node) { GexfNodeAttr gexfNodeAttr; idsToGexfNodeAttr[node.Id] = gexfNodeAttr = new GexfNodeAttr(); while (xmlReader.IsStartElement()) { switch (xmlReader.Name) { case "viz:color": ReadColor(node); break; case "viz:position": ReadPosition(gexfNodeAttr); break; case "viz:size": ReadSize(gexfNodeAttr); break; default: xmlReader.Skip(); break; } xmlReader.Read(); } }
void ReadSize(GexfNodeAttr gexfNodeAttr) { var sizeVal = xmlReader.GetAttribute("value"); if (sizeVal != null) { gexfNodeAttr.Size = double.Parse(sizeVal); } }
void ReadPosition(GexfNodeAttr gexfNodeAttr) { var xStr = GetAttr("x"); if (xStr != null) { double x; if (double.TryParse(xStr, out x)) { var yStr = GetAttr("y"); if (yStr != null) { double y; if (double.TryParse(yStr, out y)) { gexfNodeAttr.Position = new Point(x, y); } } } } }
void ReadPosition(GexfNodeAttr gexfNodeAttr) { var xStr = GetAttr("x"); if (xStr != null) { double x; if (double.TryParse(xStr, out x)) { var yStr = GetAttr("y"); if(yStr!=null) { double y; if (double.TryParse(yStr, out y)) { gexfNodeAttr.Position = new Point(x, y); } } } } }
void ReadSize(GexfNodeAttr gexfNodeAttr) { var sizeVal = xmlReader.GetAttribute("value"); if (sizeVal != null) gexfNodeAttr.Size = double.Parse(sizeVal); }