Exemple #1
0
        public new static vtkMutableDirectedGraph New()
        {
            vtkMutableDirectedGraph result = null;
            uint   mteStatus   = 0u;
            uint   mteIndex    = 4294967295u;
            uint   rawRefCount = 0u;
            IntPtr intPtr      = vtkMutableDirectedGraph.vtkMutableDirectedGraph_New(ref mteStatus, ref mteIndex, ref rawRefCount);

            if (IntPtr.Zero != intPtr)
            {
                bool flag;
                result = (vtkMutableDirectedGraph)Methods.CreateWrappedObject(mteStatus, mteIndex, rawRefCount, intPtr, true, out flag);
            }
            return(result);
        }
        public virtual vtkMutableDirectedGraph GetLinkGraph()
        {
            vtkMutableDirectedGraph vtkMutableDirectedGraph = null;
            uint   mteStatus   = 0u;
            uint   mteIndex    = 4294967295u;
            uint   rawRefCount = 0u;
            IntPtr intPtr      = vtkTableToGraph.vtkTableToGraph_GetLinkGraph_08(base.GetCppThis(), ref mteStatus, ref mteIndex, ref rawRefCount);

            if (IntPtr.Zero != intPtr)
            {
                bool flag;
                vtkMutableDirectedGraph = (vtkMutableDirectedGraph)Methods.CreateWrappedObject(mteStatus, mteIndex, rawRefCount, intPtr, true, out flag);
                if (flag)
                {
                    vtkMutableDirectedGraph.Register(null);
                }
            }
            return(vtkMutableDirectedGraph);
        }
Exemple #3
0
        public new static vtkMutableDirectedGraph SafeDownCast(vtkObjectBase o)
        {
            vtkMutableDirectedGraph vtkMutableDirectedGraph = null;
            uint   mteStatus   = 0u;
            uint   mteIndex    = 4294967295u;
            uint   rawRefCount = 0u;
            IntPtr intPtr      = vtkMutableDirectedGraph.vtkMutableDirectedGraph_SafeDownCast_17((o == null) ? default(HandleRef) : o.GetCppThis(), ref mteStatus, ref mteIndex, ref rawRefCount);

            if (IntPtr.Zero != intPtr)
            {
                bool flag;
                vtkMutableDirectedGraph = (vtkMutableDirectedGraph)Methods.CreateWrappedObject(mteStatus, mteIndex, rawRefCount, intPtr, true, out flag);
                if (flag)
                {
                    vtkMutableDirectedGraph.Register(null);
                }
            }
            return(vtkMutableDirectedGraph);
        }
 public void SetLinkGraph(vtkMutableDirectedGraph g)
 {
     vtkTableToGraph.vtkTableToGraph_SetLinkGraph_17(base.GetCppThis(), (g == null) ? default(HandleRef) : g.GetCppThis());
 }
 public void Set(vtkMutableDirectedGraph g)
 {
     vtkReebGraph.vtkReebGraph_Set_14(base.GetCppThis(), (g == null) ? default(HandleRef) : g.GetCppThis());
 }
Exemple #6
0
        /// <summary>
        /// Recursive function that finds and
        /// graphs Wikipedia links
        /// </summary>
        /// <param name="g">The graph</param>
        /// <param name="lookupValue">Name of orgin article</param>
        /// <param name="hops">How many degrees of separation from the original article</param>
        private void addLinks(Kitware.VTK.vtkMutableDirectedGraph g, string lookupValue, int hops)
        {
            vtkStringArray label  = (vtkStringArray)g.GetVertexData().GetAbstractArray("label");
            long           parent = label.LookupValue(lookupValue);

            //if lookupValue is not in the graph add it
            if (parent < 0)
            {
                rotateLogo();
                parent = g.AddVertex();
                label.InsertNextValue(lookupValue);
                arrListSmall.Add(lookupValue);
            }
            //Parse Wikipedia for the lookupValue
            string underscores = lookupValue.Replace(' ', '_');

            System.Net.HttpWebRequest webRequest = (System.Net.HttpWebRequest)System.Net.WebRequest.Create("http://en.wikipedia.org/wiki/Special:Export/" + underscores);
            webRequest.Credentials = System.Net.CredentialCache.DefaultCredentials;
            webRequest.Accept      = "text/xml";
            try
            {
                System.Net.HttpWebResponse webResponse    = (System.Net.HttpWebResponse)webRequest.GetResponse();
                System.IO.Stream           responseStream = webResponse.GetResponseStream();
                System.Xml.XmlReader       reader         = new System.Xml.XmlTextReader(responseStream);
                String NS = "http://www.mediawiki.org/xml/export-0.4/";
                System.Xml.XPath.XPathDocument doc = new System.Xml.XPath.XPathDocument(reader);
                reader.Close();
                webResponse.Close();
                System.Xml.XPath.XPathNavigator    myXPahtNavigator = doc.CreateNavigator();
                System.Xml.XPath.XPathNodeIterator nodesText        = myXPahtNavigator.SelectDescendants("text", NS, false);

                String fullText = "";
                //Parse the wiki page for links
                while (nodesText.MoveNext())
                {
                    fullText += nodesText.Current.InnerXml + " ";
                }
                System.Text.RegularExpressions.Match m = System.Text.RegularExpressions.Regex.Match(fullText, "\\[\\[.*?\\]\\]");
                int max;
                try
                {
                    max = System.Convert.ToInt32(toolStripTextBox2.Text);
                }
                catch (Exception)
                {
                    max = -1;
                }
                int count = 0;
                while (m.Success && ((count < max) || (max < 0)))
                {
                    String s         = m.ToString();
                    int    index     = s.IndexOf('|');
                    String substring = "";
                    if (index > 0)
                    {
                        substring = s.Substring(2, index - 2);
                    }
                    else
                    {
                        substring = s.Substring(2, s.Length - 4);
                    }
                    //if the new substring is not already there add it
                    long v = label.LookupValue(substring);
                    if (v < 0)
                    {
                        rotateLogo();
                        v = g.AddVertex();
                        label.InsertNextValue(substring);
                        arrListSmall.Add(substring);
                        if (hops > 1)
                        {
                            addLinks(g, substring, hops - 1);
                        }
                    }
                    else if (arrListSmall.IndexOf(substring) < 0)
                    {
                        arrListSmall.Add(substring);
                        if (hops > 1)
                        {
                            addLinks(g, substring, hops - 1);
                        }
                    }
                    //Make sure nothing is linked to twice by expanding the graph
                    vtkAdjacentVertexIterator avi = vtkAdjacentVertexIterator.New();
                    g.GetAdjacentVertices((int)parent, avi);
                    m = m.NextMatch();
                    ++count;

                    while (avi.HasNext())
                    {
                        long id = avi.Next();
                        if (id == v)
                        {
                            return;
                        }
                    }
                    rotateLogo();
                    g.AddGraphEdge((int)parent, (int)v);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }