Select to view content in your preferred language

ITopologyGraph.Post() Exceptions

2411
1
05-19-2010 05:44 AM
AaronFritz
New Contributor
Can anyone tell me how to get around an issue I'm having with making edits to topology graph objects and then committing back to the parent feature classes.

Here's a rundown:  I've got two feature class, one polyline and one polygon, included in a FileGDB topology.  I create a number of smaller envelopes based on the full extent of the feature classes in order to avoid the topology graph memory leak issues with building large topologies and then loop through each of those envelopes and build.  I then loop through the edges and based on where a polygon edge is not coincedent with a polyline edge BUT have both the same end nodes, I use the SetEdgeGeometry (and have tried ReshapeEdgeGeometry) to move the poly edge to match the polyline edge.

Here's the problem, if I try to post the changes using the Post method on the topology graph, I run into a 'attempted to read or write protected memory' exception (as well as the additional overhead of posting each individual change).  However, when i try to post all changes at the end of each Envelope loop, the first couple work, but then on my third envelope pass, I get the 'A topology graph edit operation caused a feature geometry to become empty.' exception.

Just FYI, I have the SetEdgeGeometry and Post operations in an active edit session and edit operation...

Question is, if I'm being forced to Post all changes after a full loop through an envelope of topology, how can I know which individual edit is causing the problem and catch/abort it without losing all of the other edits that are good and I want to post back to the original feature class?

I'm stumped, and frustrated yet again with ESRI software and even more so, their horrible documentation/examples of ArcObjects (or complete lack thereof in some cases)....

Any help would be greatly appreciated.

Thanks,

Aaron
0 Kudos
1 Reply
AndrewWilson3
New Contributor
I can address your "topology graph edit operation caused a feature geometry to become empty" error problem.
Before you move the topology edge corresponding to the polygon's edge, you have to make sure that the corresponding topology edge is selected.
topoGraph.SelectByGeometry((int)esriTopologyElementType.esriTopologyEdge, esriTopologySelectionResultEnum.esriTopologySelectionResultNew, pointOnPolygonEdge);
Then you'll be able to call SetEdgeGeometry without emptying the topology, and post without generating the error.

If you're moving any topology nodes, you have to make sure that no topology edges are selected on the graph and that only that topology node is selected.
_topoGraph.SetSelectionEmpty((int)esriTopologyElementType.esriTopologyEdge);
_topoGraph.SelectByGeometry((int)esriTopologyElementType.esriTopologyNode, esriTopologySelectionResultEnum.esriTopologySelectionResultNew, nodePoint);

If you dont make these selections/deselections before moving, it will cause the topology graph to become empty, and when you post, it will generate that error.
0 Kudos