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);
                        }
                    }
                }
            }
        }
예제 #4
0
 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);
                 }
             }
         }
     }
 }
예제 #5
0
 void ReadSize(GexfNodeAttr gexfNodeAttr) {
     var sizeVal = xmlReader.GetAttribute("value");
     if (sizeVal != null)
         gexfNodeAttr.Size = double.Parse(sizeVal);
 }
예제 #6
0
 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();
     }
 }