Doing some testing with a C# program using HitTest() and esriGeometryPartVertex trying to determine if the intersection of two or more lines is at each other From/To points with mixed results.
I have drawn some test layers where I purposefully draw the lines that have only a From and To vertex and they connect with other lines at one of their From/To vertices. I then run a program against that layer using the following code snippet:
double dblRadius = 0.0;
double dblHitDist = 0.0;
int lPartIdx = -1;
int lSegIdx = -1;
bool blnRightSide = false;
IHitTest FeatureHitTest = IntFeature.Shape as IHitTest;
bool HitTestResult = FeatureHitTest.HitTest(VertexPt, dblRadius, esriGeometryHitPartType.esriGeometryPartVertex,
null, ref dblHitDist, ref lPartIdx, ref lSegIdx, ref blnRightSide);
where VertexPt is a From or To point of the source line and IntFeature is an intersecting line feature
When running this, some segments/intersections show a TRUE HitTestResult while others show FALSE even though the lines are connected to endpoints when drawn. There is no rhyme or reason to the TRUE/FALSE return.
I purposefully set by the "radius" to 0 thinking that will give me points that are right on top of one another and maybe that is problem. When I select a decimal non zero number the HitTestResults start becoming TRUE. How granular is that Radius? Is it related to my Map Units or Display Units or something else? Is that the root of my problem?
Thanks
Solved! Go to Solution.
That number should be equal to your feature class XY tolerance.
That number should be equal to your feature class XY tolerance.
Is there a way to programmatically in C# to get the XY Tolerance?