I am trying to create a polyline from the points that I query from a polygon. I have a polygon, and I am getting its edges, casting them to segments, and then use QueryNormal to get the mid point for that edge. I get 2 different points from 2 edges, I want to create a curve from those 2 points, not a straight line, but follow the polygon path from one point to another. the pictures below explain things better. I tried using the topological operator and cut but thats not doing what I want, I tried using the polygon.Split() but also that does not give me what I want. Is it possible to split a polygon based on points?
New Edits:- After being able to get the subcurve using the 2 input point distances, it is always giving me the longest part of the polyCurve, here is apicture of what its doing, where I want the short path as per the picture above. 
Answer
I solved the problem, by getting the polygons exterior ring, IRing interface has the method GetSubcurveEx, this method is perfect for my case since I can specify which direction I want the subcurve to follow. I can specify clockwise or counter clockwise, so I got both directions and simply picked the shortest. Here is how I done it.
ExteriorPolygonRing.QueryPointAndDistance(esriSegmentExtension.esriNoExtension, terminalPointOnParcel, false,outPoint, ref pointDistance, ref fromcr, ref rightSide);
ExteriorPolygonRing.QueryPointAndDistance(esriSegmentExtension.esriNoExtension, handHoleParcelEdgePoint, false,outPoint2, ref pointDistance2, ref fromcr2, ref rightSide);
var clockWisePath = polyRing.GetSubcurveEx(pointDistance, pointDistance2, false, true, true);
var counterClockWisePath = polyRing.GetSubcurveEx(pointDistance, pointDistance2, false, false, true);
if (clockWisePath.Length < counterClockWisePath.Length) {
return clockWisePath;
}
return counterClockWisePath;
}

No comments:
Post a Comment