Exemple #1
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();
            }
        }
Exemple #2
0
        void ReadSize(GexfNodeAttr gexfNodeAttr)
        {
            var sizeVal = xmlReader.GetAttribute("value");

            if (sizeVal != null)
            {
                gexfNodeAttr.Size = double.Parse(sizeVal);
            }
        }
        private void ReadAttvalue(GexfNodeAttr gexfNodeAttr)
        {
            var attFor = xmlReader.GetAttribute("for");
            var attVal = xmlReader.GetAttribute("value");

            if (attFor != null && attVal != null)
            {
                gexfNodeAttr.Attvalues[attFor] = attVal;
            }
        }
 private void ReadAttvalues(GexfNodeAttr gexfNodeAttr)
 {
     xmlReader.Read();
     while (IsStartElement() && Name == "attvalue")
     {
         ReadAttvalue(gexfNodeAttr);
         if (!xmlReader.IsEmptyElement)
         {
             xmlReader.Read();
         }
         xmlReader.ReadEndElement();
     }
     if (Name == "attvalues")
     {
         xmlReader.ReadEndElement();
     }
 }
 private void SetLabelFromAttrValues(Node node, GexfNodeAttr gexfNodeAttr)
 {
     if (gexfNodeAttr.Attvalues.Count > 0)
     {
         var    first     = true;
         String labelText = "";
         foreach (var attVal in gexfNodeAttr.Attvalues.Values)
         {
             if (!first)
             {
                 labelText += " ";
             }
             labelText += attVal;
             first      = false;
         }
         node.LabelText = labelText;
     }
 }
Exemple #6
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);
                        }
                    }
                }
            }
        }
        void ReadNodeFeatures(Node node)
        {
            GexfNodeAttr gexfNodeAttr;

            idsToGexfNodeAttr[node.Id] = gexfNodeAttr = new GexfNodeAttr();
            while (xmlReader.IsStartElement())
            {
                switch (xmlReader.Name)
                {
                case "viz:color":
                    ReadColor(node);
                    xmlReader.Read();
                    xmlReader.ReadEndElement();
                    break;

                case "viz:position":
                    ReadPosition(gexfNodeAttr);
                    xmlReader.Read();
                    xmlReader.ReadEndElement();
                    break;

                case "viz:size":
                    ReadSize(gexfNodeAttr);
                    xmlReader.Read();
                    xmlReader.ReadEndElement();
                    break;

                case "attvalues":
                    ReadAttvalues(gexfNodeAttr);
                    break;

                default:
                    xmlReader.Skip();
                    break;
                }
                //xmlReader.Read();
            }

            SetLabelFromAttrValues(node, gexfNodeAttr);
        }
 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);
 }
 private void ReadAttvalue(GexfNodeAttr gexfNodeAttr)
 {
     var attFor = xmlReader.GetAttribute("for");
     var attVal = xmlReader.GetAttribute("value");
     if (attFor != null && attVal != null)
         gexfNodeAttr.Attvalues[attFor] = attVal;
 }
 private void ReadAttvalues(GexfNodeAttr gexfNodeAttr)
 {
     xmlReader.Read();
     while (IsStartElement() && Name == "attvalue")
     {
         ReadAttvalue(gexfNodeAttr);
         if(!xmlReader.IsEmptyElement)
             xmlReader.Read();
         xmlReader.ReadEndElement();
     }
     if(Name=="attvalues")
         xmlReader.ReadEndElement();
 }
        void ReadNodeFeatures(Node node) {
            GexfNodeAttr gexfNodeAttr;
            idsToGexfNodeAttr[node.Id] = gexfNodeAttr = new GexfNodeAttr();
            while (xmlReader.IsStartElement()) {
                switch (xmlReader.Name) {
                    case "viz:color":
                        ReadColor(node);
                        xmlReader.Read();
                        xmlReader.ReadEndElement();
                        break;
                    case "viz:position":
                        ReadPosition(gexfNodeAttr);
                        xmlReader.Read();
                        xmlReader.ReadEndElement();
                        break;
                    case "viz:size":
                        ReadSize(gexfNodeAttr);
                        xmlReader.Read();
                        xmlReader.ReadEndElement();
                        break;
                    case "attvalues":
                        ReadAttvalues(gexfNodeAttr);
                        break;
                    default:
                        xmlReader.Skip();
                        break;
                }
                //xmlReader.Read();
            }

            SetLabelFromAttrValues(node, gexfNodeAttr);
        }
 private void SetLabelFromAttrValues(Node node, GexfNodeAttr gexfNodeAttr)
 {
     if (gexfNodeAttr.Attvalues.Count > 0)
     {
         var first = true;
         String labelText = "";
         foreach (var attVal in gexfNodeAttr.Attvalues.Values)
         {
             if (!first) labelText += " ";
             labelText += attVal;
             first = false;
         }
         node.LabelText = labelText;
     }
 }