本文整理汇总了C#中PolylineClass.QueryPointAndDistance方法的典型用法代码示例。如果您正苦于以下问题:C# PolylineClass.QueryPointAndDistance方法的具体用法?C# PolylineClass.QueryPointAndDistance怎么用?C# PolylineClass.QueryPointAndDistance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PolylineClass
的用法示例。
在下文中一共展示了PolylineClass.QueryPointAndDistance方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: getCoordinates
public Dictionary<string, List<IPoint>> getCoordinates(IPolygon polygon, IPolyline plin1, IPolyline plin2, IPolyline plin3, double hdwid1, double hdwid2)
{
Dictionary<string, List<IPoint>> res = new Dictionary<string, List<IPoint>>();
IPointCollection pnts = polygon as IPointCollection;
int index = 1;
for (int i = 0; i < pnts.PointCount - 1; i++)
{
IPolyline plinnew = new PolylineClass();
plinnew.SpatialReference = Global.spatialref;
plinnew.FromPoint = new PointClass() { X = pnts.get_Point(i).X, Y = pnts.get_Point(i).Y };
plinnew.ToPoint = new PointClass() { X = pnts.get_Point(i + 1).X, Y = pnts.get_Point(i + 1).Y };
ITopologicalOperator top1 = plin1 as ITopologicalOperator;
IGeometry geom1 = top1.Buffer(hdwid1);
IRelationalOperator relationOp1 = geom1 as IRelationalOperator;
bool bres1 = relationOp1.Contains(plinnew);
if (bres1)
continue;
ITopologicalOperator top2 = plin2 as ITopologicalOperator;
IGeometry geom2 = top2.Buffer(hdwid2);
IRelationalOperator relationOp2 = geom2 as IRelationalOperator;
bool bres2 = relationOp2.Contains(plinnew);
if (bres2)
continue;
List<IPoint> curpnts = new List<IPoint>();
curpnts.Add(pnts.get_Point(i));
curpnts.Add(pnts.get_Point(i + 1));
res.Add(index.ToString(), curpnts);
index++;
}
//处理顺序
IPoint pntCenter = new PointClass() { X = (plin3.Envelope.XMax + plin3.Envelope.XMin) / 2, Y = (plin3.Envelope.YMax + plin3.Envelope.YMin) / 2 };
IPolyline plin0 = new PolylineClass();
plin0.SpatialReference = Global.spatialref;
plin0.FromPoint = res["1"][0];
plin0.ToPoint = res["1"][1];
double dist0 = 0.0, dist1 = 0.0;
bool isrightside = false;
IPoint pntquery = null;
plin0.QueryPointAndDistance(esriSegmentExtension.esriNoExtension, pntCenter, false, pntquery, ref dist0, ref dist1, ref isrightside);
IPolyline plin00 = new PolylineClass();
plin00.SpatialReference = Global.spatialref;
plin00.FromPoint = res["2"][0];
plin00.ToPoint = res["2"][1];
double dist00 = 0.0, dist10 = 0.0;
bool isrightside0 = false;
IPoint pntquery0 = null;
plin00.QueryPointAndDistance(esriSegmentExtension.esriNoExtension, pntCenter, false, pntquery0, ref dist00, ref dist10, ref isrightside0);
if (dist10 > dist1)
{
List<IPoint> tmppnts = res["2"];
res["2"] = res["1"];
res["1"] = tmppnts;
}
return res;
}