本文整理汇总了C#中IPolyline.QueryPoint方法的典型用法代码示例。如果您正苦于以下问题:C# IPolyline.QueryPoint方法的具体用法?C# IPolyline.QueryPoint怎么用?C# IPolyline.QueryPoint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPolyline
的用法示例。
在下文中一共展示了IPolyline.QueryPoint方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CalculateExtendPointNew
/// <summary>
/// 计算延长线上的距离
/// </summary>
/// <params name="startP"></params>
/// <params name="endP"></params>
/// <params name="jjcd"></params>
/// <returns></returns>
public IPoint CalculateExtendPointNew(IPolyline plin, IPoint pntTo, double jjcd, out bool bres)
{
bres = false;
IPoint pntOut = new PointClass();
double distfrom = 0.0, distto = 0.0;
double outdistfrom = 0.0, outdistto = 0.0;
bool boolfrom = false;
plin.QueryPointAndDistance(esriSegmentExtension.esriExtendAtFrom, pntTo, false, pntOut, ref distfrom, ref outdistfrom, ref boolfrom);
plin.QueryPointAndDistance(esriSegmentExtension.esriNoExtension, pntTo, false, pntOut, ref distto, ref outdistto, ref boolfrom);
if (distfrom < distto)//反向的
{
bres = true;
plin.ReverseOrientation();
plin.QueryPoint(esriSegmentExtension.esriExtendAtTo, jjcd + plin.Length, false, pntOut);
}
else//正向
{
bres = false;
plin.QueryPoint(esriSegmentExtension.esriExtendAtTo, jjcd + plin.Length, false, pntOut);
}
return pntOut;
}
示例2: SetPINValue
private void SetPINValue()
{
//The Theory.
//Select polygons that intersect the sketch.
//Construct one polyline from the boundaries and intersect with sketch.
//Sort resulting intersection locations (multipoint) by distance of the intersect
// from the start of the sketch and create new ordered multipoint.
//Loop through new ordered multipoint, select underlying parcel and calc pin.
IFeatureLayer featLayer = m_editLayers.CurrentLayer;
m_curve = m_edSketch.Geometry as IPolyline;
//Search parcel polys by graphic to get feature cursor
ISpatialFilter spatialFilter = new SpatialFilter();
spatialFilter.Geometry = m_curve;
spatialFilter.GeometryField = m_editLayers.CurrentLayer.FeatureClass.ShapeFieldName;
spatialFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelCrosses;
IFeatureCursor featCursor = featLayer.Search(spatialFilter,true);
IFeature feature = featCursor.NextFeature();
//If we have no intersects then exit
if (feature == null)
return;
//Make a GeomBag of the polygons boundaries (polylines)
IGeometryCollection geomBag = new GeometryBagClass();
object missing = Type.Missing;
while (feature != null)
{
ITopologicalOperator poly = feature.Shape as ITopologicalOperator;
geomBag.AddGeometry(poly.Boundary,ref missing,ref missing);
feature = featCursor.NextFeature();
}
//Make one polyline from the boundaries
IPolyline polyLineU = new PolylineClass();
ITopologicalOperator topoOp = polyLineU as ITopologicalOperator;
topoOp.ConstructUnion(geomBag as IEnumGeometry);
//Get the intersections of the boundaries and the curve
IPointCollection pointCol = topoOp.Intersect(m_curve, esriGeometryDimension.esriGeometry0Dimension) as IPointCollection;
//The point collection is not ordered by distance along the curve so
//need to create a new collection with this info
int[] pointOrder = new int[pointCol.PointCount];
double dac = 0, dfc = 0;
bool bRS = false;
for (int i = 0; i < pointCol.PointCount; i++)
{
IPoint queryPoint = new PointClass();
pointCol.QueryPoint(i, queryPoint);
m_curve.QueryPointAndDistance(esriSegmentExtension.esriNoExtension, queryPoint, false, null,ref dac,ref dfc,ref bRS);
pointOrder[i] = (int)dac;
}
//use built in bubble sort
System.Array.Sort(pointOrder);
//Loop through the sorted array and calc midpoint between parcel boundaries
IPointCollection midPoints = new MultipointClass();
for (int i = 0; i < pointOrder.Length -1; i++)
{
//Get the midpoint distance
double midPointDist = (pointOrder[i] + pointOrder[i + 1]) / 2;
//create a point at the distance and store in point collection
IPoint queryPoint = new PointClass();
m_curve.QueryPoint(esriSegmentExtension.esriNoExtension, midPointDist, false, queryPoint);
midPoints.AddPoint(queryPoint,ref missing,ref missing);
}
//If ends of sketch are included then add them as points
if (chkEnds.Checked)
{
object before = 0 as object;
midPoints.AddPoint(m_curve.FromPoint, ref before, ref missing);
midPoints.AddPoint(m_curve.ToPoint, ref missing, ref missing);
}
m_editor.StartOperation();
//Loop through calculated midpoints, select polygon and calc pin
for (int i = 0; i < midPoints.PointCount; i++)
{
IPoint midPoint = midPoints.get_Point(i);
spatialFilter = new SpatialFilter();
spatialFilter.Geometry = midPoint;
spatialFilter.GeometryField = m_editLayers.CurrentLayer.FeatureClass.ShapeFieldName;
spatialFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelWithin;
featCursor = featLayer.Search(spatialFilter, false);
while ((feature = featCursor.NextFeature()) != null)
{
feature.set_Value(feature.Fields.FindField(cmbPINField.Text), m_lotNum);
feature.Store();
m_lotNum += int.Parse(txtlotinc.Text);
//.........这里部分代码省略.........