<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: The code counts the wrong number of nodes for a topology, why? in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/the-code-counts-the-wrong-number-of-nodes-for-a/m-p/279486#M7205</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Does anyone know it and tell me? Thank you.&lt;BR /&gt; &lt;BR /&gt;Saili&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The topology will still return the endpoints of the lines, even if they are outside of your user defined envelope.&amp;nbsp; You could try using the SelectByGeometry method to only return the nodes inside the envelope.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Another thing to mention is that if your topology has other feature classes participating in it, any places where the geometry of any participating feature classes intersect, a node will be returned....whether the other feature classes are present in the map document or not.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 17 Dec 2010 15:28:40 GMT</pubDate>
    <dc:creator>JeffMatson</dc:creator>
    <dc:date>2010-12-17T15:28:40Z</dc:date>
    <item>
      <title>The code counts the wrong number of nodes for a topology, why?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/the-code-counts-the-wrong-number-of-nodes-for-a/m-p/279484#M7203</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi, &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; This is the code for counting the number of nodes and edges for a topology.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Private Sub CursorCount_MouseDown(ByVal button As Long, ByVal shift As Long, ByVal x As Long, ByVal y As Long)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim pmXDoc As IMxDocument&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Set pmXDoc = ThisDocument&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim pTopologyLayer As ITopologyLayer&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim pTopology As ITopology&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim pTopoGraph As ITopologyGraph&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim pCursor As ICursor&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim pEnumTopoNode As IEnumTopologyNode&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim i As Long&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim pTopoNode As ITopologyNode&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim penumNodeEdge As IEnumNodeEdge&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim pTopoEdge As ITopologyEdge&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim batfrom As Boolean&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim pPolyline As IPolyline&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim pEnv As IEnvelope&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim pRubber As IRubberBand&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Set pRubber = New RubberEnvelope&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim pActiveView As IActiveView&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Set pActiveView = pmXDoc.ActiveView&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Set pEnv = pRubber.TrackNew(pActiveView.screenDisplay, Nothing)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Set pTopologyLayer = pmXDoc.FocusMap.Layer(0) 'A topology has to be in first position in the view Table of content&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Set pTopology = pTopologyLayer.Topology 'Get the topology&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Set pTopoGraph = pTopology.Cache 'Get the topologygraph&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;pTopoGraph.Build pEnv, False 'Build the topology graph&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Set pEnumTopoNode = pTopoGraph.Nodes 'Get all the nodes of the graph&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;'For each nodes get the adjacent edges and print the length of the edges&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;MsgBox "Number of nodes : " &amp;amp; pEnumTopoNode.Count&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;For i = 0 To pEnumTopoNode.Count - 1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; Set pTopoNode = pEnumTopoNode.Next&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; Set penumNodeEdge = pTopoNode.Edges(True) 'Get all the adjacent edges&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; MsgBox "Number of edges adjacent to that node : " &amp;amp; penumNodeEdge.Count&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; MsgBox "Is the enumerator Clockwise : " &amp;amp; penumNodeEdge.IsClockwise&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; penumNodeEdge.Next pTopoEdge, batfrom 'Get the next adjacent edge&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; While Not pTopoEdge Is Nothing&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pPolyline = pTopoEdge.Geometry&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Debug.Print "Length of polyline : " &amp;amp; pPolyline.Length&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; penumNodeEdge.Next pTopoEdge, batfrom 'Get the next edge&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; Wend&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Next&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;End Sub&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But the counting result is wrong. Please see the picture in the attachment. The number of nodes in the area of the picture should be 1, but the result of the code is 4. Could you tell me how to fix it?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Saili&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Dec 2010 17:57:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/the-code-counts-the-wrong-number-of-nodes-for-a/m-p/279484#M7203</guid>
      <dc:creator>sailiTang</dc:creator>
      <dc:date>2010-12-15T17:57:30Z</dc:date>
    </item>
    <item>
      <title>Re: The code counts the wrong number of nodes for a topology, why?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/the-code-counts-the-wrong-number-of-nodes-for-a/m-p/279485#M7204</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Does anyone know it and tell me? Thank you.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Saili&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Dec 2010 13:37:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/the-code-counts-the-wrong-number-of-nodes-for-a/m-p/279485#M7204</guid>
      <dc:creator>sailiTang</dc:creator>
      <dc:date>2010-12-17T13:37:44Z</dc:date>
    </item>
    <item>
      <title>Re: The code counts the wrong number of nodes for a topology, why?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/the-code-counts-the-wrong-number-of-nodes-for-a/m-p/279486#M7205</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Does anyone know it and tell me? Thank you.&lt;BR /&gt; &lt;BR /&gt;Saili&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The topology will still return the endpoints of the lines, even if they are outside of your user defined envelope.&amp;nbsp; You could try using the SelectByGeometry method to only return the nodes inside the envelope.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Another thing to mention is that if your topology has other feature classes participating in it, any places where the geometry of any participating feature classes intersect, a node will be returned....whether the other feature classes are present in the map document or not.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Dec 2010 15:28:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/the-code-counts-the-wrong-number-of-nodes-for-a/m-p/279486#M7205</guid>
      <dc:creator>JeffMatson</dc:creator>
      <dc:date>2010-12-17T15:28:40Z</dc:date>
    </item>
  </channel>
</rss>

