Detect if the line segment is of type "ICurve"

597
8
01-13-2014 04:45 AM
New Contributor
I'm using ArcGIS 10.1, and I have polyline feature Class, some of it's features have curves in it, how can I detect these features?
Reply
0 Kudos
8 Replies
Regular Contributor III
You'll have to loop through the segment collection of each feature's geometry.  Use TypeOf (VB.NET) or Is (C#) to see if a segment implements one of the interfaces associated with curves (i.e. ICircularArc, IEllipticArc, etc).  Unless they've added some new types recently, pretty much anything that isn't a Line is a curve of some type.  So, you could just test the segment to see if it isn't ILine.
Reply
0 Kudos
Regular Contributor
I'm not sure it's that easy to just test whether it implements ICurve.  You can see that even ILine implements ICurve.

As Neil suggested, you might want to test for the types of Curves you think your polyline featureclass contains.  You will have test each feature in your featureclass.

[ATTACH=CONFIG]30454[/ATTACH]
Reply
0 Kudos
Regular Contributor
What if you got the first and last points in the segment and created a new line segment then tested whether any of the middle points intersect that line?

[edit]
That won't work either, depending on how the feature was digitzed.  I'm no help. 🙂
Reply
0 Kudos
Esri Regular Contributor
The easier way to check is to cast each feature into a segment collection then use the ISegmentCollection.HasNonLinearSegments Method.
Reply
0 Kudos
Regular Contributor
Sean,

Would the ITopologicalOperater isSimple() give you the same result?
Reply
0 Kudos
Esri Regular Contributor
Would the ITopologicalOperater isSimple() give you the same result?

Not really in this case. isSimple will just tell you if a geometry is topological correct regardless of the geometry type, whereas the original question was more about 'does my feature have any curves in it.
Reply
0 Kudos
New Contributor
Thanks a lot guys for the two solutions, i'll try both and tell you the results. Thanks again.
Reply
0 Kudos
Occasional Contributor II
If you want to know which type of curve in your geometry, get the GeometryType property of ISegment.
Reply
0 Kudos