本文整理汇总了C#中IPolyline.GetSubcurve方法的典型用法代码示例。如果您正苦于以下问题:C# IPolyline.GetSubcurve方法的具体用法?C# IPolyline.GetSubcurve怎么用?C# IPolyline.GetSubcurve使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPolyline
的用法示例。
在下文中一共展示了IPolyline.GetSubcurve方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ClipContour
/// <summary>
/// clip a polyline at the specified lengths
/// </summary>
public static IPolyline ClipContour(IPoint npsPoint, IPolyline npsPolyline, double RangeLeft, double RangeRight)
{
ICurve NewPolyline = null, pl2, pl1;
IPoint npsExactPoint;
double PolylineLength, DistanceFromStart = 0, DistanceFromCurve = 0, NewLineEnd,
AmountOver, start1 = 0, start2 = 0, end1 = 0, end2 = 0, NewLineStart;
bool npsRightSide = false, IsOutOfBoundsLeft, IsOutOfBoundsRight;
ISegmentCollection newpl = null;
if (npsPolyline == null) return null;
PolylineLength = npsPolyline.Length;
//get the distance of the point from the start of the contour
npsExactPoint = new PointClass();
npsPolyline.QueryPointAndDistance(esriSegmentExtension.esriNoExtension, npsPoint, false,
npsExactPoint, ref DistanceFromStart, ref DistanceFromCurve, ref npsRightSide);
//if (contour)polyline is not a closed line
if (npsPolyline.IsClosed == false)
{
IsOutOfBoundsLeft = false;
IsOutOfBoundsRight = false;
NewLineStart = DistanceFromStart - RangeLeft;
NewLineEnd = DistanceFromStart + RangeRight;
if (NewLineStart < 0) IsOutOfBoundsLeft = true;
if (NewLineEnd > PolylineLength) IsOutOfBoundsRight = true;
//if contour is outbound to the left, then try to shift it to the right
if (IsOutOfBoundsLeft == true && IsOutOfBoundsRight == false)
{
AmountOver = (DistanceFromStart - RangeLeft) * -1;
if (((DistanceFromStart + RangeRight) + AmountOver) < PolylineLength)
{
NewLineStart = 0;
NewLineEnd = (DistanceFromStart + RangeRight) + AmountOver;
}
else
{
NewLineStart = -1;
NewLineEnd = -1;
}
}
//if contour is out of bounds to the right, then try to shift it to the left
if (IsOutOfBoundsLeft == false && IsOutOfBoundsRight == true)
{
AmountOver = (DistanceFromStart + RangeRight) - PolylineLength;
if (((DistanceFromStart - RangeLeft) - AmountOver) >= 0)
{
NewLineStart = (DistanceFromStart - RangeLeft) - AmountOver;
NewLineEnd = PolylineLength;
}
else
{
NewLineStart = -1;
NewLineEnd = -1;
}
}
//since the contour is to short on both ends to create the new polyline,abound operation
if (IsOutOfBoundsLeft == true && IsOutOfBoundsRight == true)
{
NewLineStart = -1;
NewLineEnd = -1;
}
if (NewLineStart != -1 && NewLineEnd != -1)
{
NewPolyline = new PolylineClass();
npsPolyline.GetSubcurve(NewLineStart, NewLineEnd, false, out NewPolyline);
}
}
else //if polyline is closed
{
if ((RangeLeft + RangeRight) < PolylineLength)
{
pl1 = new PolylineClass();
pl2 = new PolylineClass();
newpl = new PolylineClass();
//if desired subcurve does not cross the start/end point of the closed polyline(circular) then get
//a sub curve as normal
if ((DistanceFromStart - RangeLeft) >= 0 && (DistanceFromStart + RangeRight) < PolylineLength)
{
//.........这里部分代码省略.........