// 端点捕捉 private static void GetPortPntCollection(List <IFeature> listFeats, IFeatureClass pFeatureClass, IProximityOperator pProximity, double dSearchDist) { IPointCollection pPntColTemp = new MultipointClass(); for (int i = 0; i < listFeats.Count; i++) { IFeature pFeature = listFeats[i]; //判断该Feature图层 if (pFeature.Class.ObjectClassID != pFeatureClass.ObjectClassID) { continue; } if (pFeature.Shape.GeometryType == esriGeometryType.esriGeometryPolyline || pFeature.Shape.GeometryType == esriGeometryType.esriGeometryPolygon) { double dScreenSearchDist = pProximity.ReturnDistance(pFeature.Shape); if (dScreenSearchDist < 1.5 * dSearchDist) { IGeometryCollection pGeoCollection = pFeature.Shape as IGeometryCollection; for (int j = 0; j < pGeoCollection.GeometryCount; j++) { IGeometry pGeom = pGeoCollection.get_Geometry(j); IPointCollection pPntCol = pGeom as IPointCollection; m_PointCollection.AddPointCollection(pPntCol); pPntColTemp.AddPointCollection(pPntCol); } } } } m_dicPointCollection.Add(pPntColTemp, "PortPnt"); }
private IPolygon FlatBuffer(IPolyline pLline1, double pBufferDis) { object o = System.Type.Missing; //分别对输入的线平移两次(正方向和负方向) IConstructCurve pCurve1 = new PolylineClass(); pCurve1.ConstructOffset(pLline1, pBufferDis, ref o, ref o); IPointCollection pCol = pCurve1 as IPointCollection; IConstructCurve pCurve2 = new PolylineClass(); pCurve2.ConstructOffset(pLline1, -1 * pBufferDis, ref o, ref o); //把第二次平移的线的所有节点翻转 IPolyline pline2 = pCurve2 as IPolyline; pline2.ReverseOrientation(); //把第二条的所有节点放到第一条线的IPointCollection里面 IPointCollection pCol2 = pline2 as IPointCollection; pCol.AddPointCollection(pCol2); //用面去初始化一个IPointCollection IPointCollection pPointCol = new PolygonClass(); pPointCol.AddPointCollection(pCol); //把IPointCollection转换为面 IPolygon pPolygon = pPointCol as IPolygon; //简化节点次序 pPolygon.SimplifyPreserveFromTo(); return(pPolygon); }
static void createWkbMultiLineString(byte[] wkb, ref int startIndex, BitConversion bitConversion, out IGeometry geometry) { geometry = new PolylineClass(); IPointCollection mp = (IPointCollection)geometry; // Get the number of line strings. UInt32 lineStringCnt; getWkbUInt32(wkb, ref startIndex, bitConversion, out lineStringCnt); UInt32 pointCnt; double x, y; object missing = Type.Missing; // Loop through each LineString. for (int i = 0; i < lineStringCnt; i++) { startIndex += 5; // Jump past useless header stuff. getWkbUInt32(wkb, ref startIndex, bitConversion, out pointCnt); IPointCollection tempPc = new MultipointClass(); // Loop through each point. for (int j = 0; j < pointCnt; j++) { getWkbDouble(wkb, ref startIndex, bitConversion, out x); getWkbDouble(wkb, ref startIndex, bitConversion, out y); tempPc.AddPoint(createAoPoint(x, y), ref missing, ref missing); } mp.AddPointCollection(tempPc); } }
public void DrawAllVertex() { if (m_pMap.SelectionCount == 1) { IPolyline pPolyline; IPolygon pPolygon; IFeature pFeature; IEnumFeature pEnumFeature = m_pMap.FeatureSelection as IEnumFeature; if (pEnumFeature == null) { return; } pEnumFeature.Reset(); pFeature = pEnumFeature.Next(); switch (pFeature.Shape.GeometryType) { case esriGeometryType.esriGeometryPolyline: m_pPointCol = new PolylineClass(); pPolyline = pFeature.Shape as IPolyline; m_pPointCol.AddPointCollection(pPolyline as IPointCollection); ShowAllVertex(m_pPointCol); break; case esriGeometryType.esriGeometryPolygon: m_pPointCol = new PolygonClass(); pPolygon = pFeature.Shape as IPolygon; m_pPointCol.AddPointCollection(pPolygon as IPointCollection); ShowAllVertex(m_pPointCol); break; default: break; } } }
/// <summary> /// 得到Feature与 FeatureList所有的交点 /// </summary> /// <param name="vNewFeature"></param> /// <param name="vFeatureCol"></param> /// <returns></returns> private IPointCollection GetAllIntersect(IFeature OneOfFeature, List <IFeature> list_AllFeatures) { IPolyline tempLine = new PolylineClass(); IPointCollection pPointColl = tempLine as IPointCollection; pPointColl.AddPointCollection(OneOfFeature.Shape as IPointCollection); IPointCollection vItersectCol = new MultipointClass(); IMultipoint vIntersectPnt = new MultipointClass(); IFeature vFeature; for (int i = 0; i < list_AllFeatures.Count; i++) { vFeature = list_AllFeatures[i]; if (vFeature != OneOfFeature) { vIntersectPnt = GetIntersection(vFeature.Shape, tempLine as IPolyline) as IMultipoint; if (vIntersectPnt != null) { vItersectCol.AddPointCollection(vIntersectPnt as IPointCollection); } } } return(vItersectCol); }
private static IPointCollection GetSketchIntersectionPointsWithOriginalGeometries( [NotNull] IEnumerable <IGeometry> geometriesToReshape, [NotNull] IPolyline highLevelReshapePath) { IPointCollection sketchOriginalIntersectionPoints = null; foreach (IGeometry geometry in geometriesToReshape) { if (sketchOriginalIntersectionPoints == null) { sketchOriginalIntersectionPoints = (IPointCollection)IntersectionUtils.GetIntersectionPoints( highLevelReshapePath, geometry); } else { sketchOriginalIntersectionPoints.AddPointCollection( (IPointCollection)IntersectionUtils.GetIntersectionPoints( highLevelReshapePath, geometry)); } } return(sketchOriginalIntersectionPoints); }