public List <GeoStruct> BufferAnalyseNew(IPolyline pGeom, double dist, IFeatureLayer fealyr, IGeometry Reg = null) { List <GeoStruct> geoList = new List <GeoStruct>(); ITopologicalOperator top = pGeom as ITopologicalOperator; IGeometry geom = top.Buffer(dist); IFeatureCursor searchCursor = SpatialSearch(geom, "1=1", fealyr); if (searchCursor != null) { IFeature fea = searchCursor.NextFeature(); while (fea != null) { GeoStruct geoTmp = new GeoStruct(); var fieldDict = new Dictionary <string, string>(); for (var i = 0; i < fea.Fields.FieldCount; i++) { var field = fea.Fields.Field[i]; if (field.Type != esriFieldType.esriFieldTypeGeometry) { fieldDict.Add(field.Name, fea.Value[i].ToString()); } else { geoTmp.geo = fea.Shape; } } geoTmp.geoinfos = fieldDict; IRelationalOperator relation = Reg as IRelationalOperator; bool bin = (relation.Overlaps(fea.Shape) || relation.Touches(fea.Shape) || relation.Contains(fea.Shape)); double distance = CalculateDistanceNew(pGeom, geoTmp.geo); if (bin) { distance = 0.0; } if (distance < Global.searchlen) { geoTmp.dist = distance; geoList.Add(geoTmp); } //geoTmp.dist = distance; //geoList.Add(geoTmp); fea = searchCursor.NextFeature(); } } return(geoList); }
public List<GeoStruct> BufferAnalyseNew(IPolyline pGeom, double dist, IFeatureLayer fealyr, IGeometry Reg = null) { List<GeoStruct> geoList = new List<GeoStruct>(); ITopologicalOperator top = pGeom as ITopologicalOperator; IGeometry geom = top.Buffer(dist); IFeatureCursor searchCursor = SpatialSearch(geom, "1=1", fealyr); if (searchCursor != null) { IFeature fea = searchCursor.NextFeature(); while (fea != null) { GeoStruct geoTmp = new GeoStruct(); var fieldDict = new Dictionary<string, string>(); for (var i = 0; i < fea.Fields.FieldCount; i++) { var field = fea.Fields.Field[i]; if (field.Type != esriFieldType.esriFieldTypeGeometry) { fieldDict.Add(field.Name, fea.Value[i].ToString()); } else { geoTmp.geo = fea.Shape; } } geoTmp.geoinfos = fieldDict; IRelationalOperator relation = Reg as IRelationalOperator; bool bin = (relation.Overlaps(fea.Shape) || relation.Touches(fea.Shape) || relation.Contains(fea.Shape)); double distance = CalculateDistanceNew(pGeom, geoTmp.geo); if (bin) distance = 0.0; if (distance < Global.searchlen) { geoTmp.dist = distance; geoList.Add(geoTmp); } //geoTmp.dist = distance; //geoList.Add(geoTmp); fea = searchCursor.NextFeature(); } } return geoList; }
/// <summary> /// 创建点缓冲区查询 查询对应的地质构造信息 /// </summary> /// <param name="pGeom">点</param> /// <param name="dist">缓冲距离</param> /// <param name="fealyr">缓冲图层</param> /// <returns></returns> public List <GeoStruct> BufferAnalyse(IPoint pGeom, double dist, IFeatureLayer fealyr) { List <GeoStruct> geoList = new List <GeoStruct>(); ITopologicalOperator top = pGeom as ITopologicalOperator; IGeometry geom = top.Buffer(dist); IFeatureCursor searchCursor = SpatialSearch(geom, "1=1", fealyr); if (searchCursor != null) { IFeature fea = searchCursor.NextFeature(); while (fea != null) { GeoStruct geoTmp = new GeoStruct(); while (fea != null) { var fieldDict = new Dictionary <string, string>(); for (var i = 0; i < fea.Fields.FieldCount; i++) { var field = fea.Fields.Field[i]; if (field.Type != esriFieldType.esriFieldTypeGeometry) { fieldDict.Add(field.Name, fea.Value[i].ToString()); } else { geoTmp.geo = fea.Shape; } } geoTmp.geoinfos = fieldDict; double distance = CalculateDistance(pGeom, geoTmp.geo); geoTmp.dist = distance; geoList.Add(geoTmp); fea = searchCursor.NextFeature(); } } } return(geoList); }
/// <summary> /// 创建点缓冲区查询 查询对应的地质构造信息 /// </summary> /// <params name="pGeom">点</params> /// <params name="dist">缓冲距离</params> /// <params name="fealyr">缓冲图层</params> /// <returns></returns> public List<GeoStruct> BufferAnalyse(IPoint pGeom, double dist, IFeatureLayer fealyr) { List<GeoStruct> geoList = new List<GeoStruct>(); ITopologicalOperator top = pGeom as ITopologicalOperator; IGeometry geom = top.Buffer(dist); IFeatureCursor searchCursor = SpatialSearch(geom, "1=1", fealyr); if (searchCursor != null) { IFeature fea = searchCursor.NextFeature(); while (fea != null) { GeoStruct geoTmp = new GeoStruct(); while (fea != null) { var fieldDict = new Dictionary<string, string>(); for (var i = 0; i < fea.Fields.FieldCount; i++) { var field = fea.Fields.Field[i]; if (field.Type != esriFieldType.esriFieldTypeGeometry) { fieldDict.Add(field.Name, fea.Value[i].ToString()); } else { geoTmp.geo = fea.Shape; } } geoTmp.geoinfos = fieldDict; double distance = CalculateDistance(pGeom, geoTmp.geo); geoTmp.dist = distance; geoList.Add(geoTmp); fea = searchCursor.NextFeature(); } } } return geoList; }
/// <summary> /// 绘制巷道掘进 /// </summary> /// <params name="HdId">巷道ID</params> /// <params name="xzpnts">校正点</params> /// <params name="jjcd">掘进长度</params> /// <params name="jjfx">掘进方向</params> /// <params name="search">查询地质资料的范围</params> /// <params name="checkval">上下层关系判断阈值</params> /// <params name="jjbs">掘进与校正标识</params> public Dictionary<string, List<GeoStruct>> DrawJJCD(string HdId, string bid, double hdwid, List<IPoint> xzpnts, double jjcd = 0, int jjfx = 0, double search = 0, double checkval = 0, int jjbs = 0) { Dictionary<string, List<GeoStruct>> dzxlist = null; List<IPoint> rightpts = null; List<IPoint> leftpts = null; List<IPoint> rightresults = null; List<IPoint> leftresults = null; List<IPoint> results = null; Dictionary<string, string> fldvals = new Dictionary<string, string>(); fldvals.Add(GIS_Const.FIELD_HDID, HdId); //查询指定id的巷道对应的中心线(用于计算的分段显示的中心线) List<Tuple<IFeature, IGeometry, Dictionary<string, string>>> selobjs = Global.commonclss.SearchFeaturesByGeoAndText(Global.centerfdlyr, fldvals); if (selobjs.Count == 0) { MessageBox.Show("没有找到相应的巷道信息!", "系统提示"); return null; } int xh = Convert.ToInt32(selobjs[0].Item3[GIS_Const.FIELD_XH]) + 1; Dictionary<string, string> fdlin_dics = new Dictionary<string, string>(); fdlin_dics.Add(GIS_Const.FIELD_HDID, HdId); fdlin_dics.Add(GIS_Const.FIELD_XH, xh.ToString()); fdlin_dics.Add(GIS_Const.FIELD_ID, "0"); fdlin_dics.Add(GIS_Const.FIELD_BS, "0"); fdlin_dics.Add(GIS_Const.FIELD_BID, bid); //计算延长点的坐标 IGeometry geosel = selobjs[0].Item2; IPolyline plin = (IPolyline)geosel; if (jjbs == 0)//掘进 { IPoint outP = new PointClass(); outP.SpatialReference = Global.spatialref; plin.QueryPoint(esriSegmentExtension.esriExtendAtTo, jjcd + plin.Length, false, outP); //根据点查询60米范围内的地质构造的信息 List<int> hd_ids = new List<int>(); hd_ids.Add(Convert.ToInt16(HdId)); //将延长点添加到导线点图层上 List<IPoint> dpts = new List<IPoint>(); dpts.Add(outP); Dictionary<string, string> dics = new Dictionary<string, string>(); dics.Add(GIS_Const.FIELD_HDID, HdId); dics.Add(GIS_Const.FIELD_BS, "0"); dics.Add(GIS_Const.FIELD_BID, bid); //AddHangdaoToLayer(dpts, dics, Global.pntlyr); //将延长线添加到中线分段图层上 List<IPoint> fdlin_pts = new List<IPoint>(); fdlin_pts.Add(plin.ToPoint); fdlin_pts.Add(outP); AddFDLineToLayer(fdlin_pts, fdlin_dics, Global.centerfdlyr, 0); //将延长线添加到中线全图层上 List<Tuple<IFeature, IGeometry, Dictionary<string, string>>> selcenterlin = Global.commonclss.SearchFeaturesByGeoAndText(Global.centerlyr, fldvals); IPolyline centerlin = selcenterlin[0].Item2 as IPolyline; IPointCollection centerpnts = centerlin as IPointCollection; centerpnts.AddPoint(outP); IPolyline centerlinnew = centerpnts as IPolyline; IFeature centerlinfea = selcenterlin[0].Item1; AddHangdaoToLayer(fdlin_pts, fdlin_dics, Global.centerlyr); //将延长分段面添加到巷道面分段图层中 List<Tuple<IFeature, IGeometry, Dictionary<string, string>>> selhdfd = Global.commonclss.SearchFeaturesByGeoAndText(Global.hdfdlyr, fldvals); IPolygon hdfd_polygon = (IPolygon)selhdfd[0].Item2; IPointCollection hdfd_cols = hdfd_polygon as IPointCollection; IPolyline center_line = new PolylineClass(); center_line.FromPoint = plin.ToPoint; center_line.ToPoint = outP; IConstructCurve constructCurve = new PolylineClass(); constructCurve.ConstructOffset(center_line, -hdwid / 2);//左侧的线 IPolyline plyleft = constructCurve as IPolyline; IConstructCurve constructCurveright = new PolylineClass(); constructCurveright.ConstructOffset(center_line, hdwid / 2);//左侧的线 IPolyline plyright = constructCurveright as IPolyline; List<IPoint> hdfdjj_leftcols = new List<IPoint>(); hdfdjj_leftcols.Add(plyleft.FromPoint); hdfdjj_leftcols.Add(plyleft.ToPoint); List<IPoint> hdfdjj_rightcols = new List<IPoint>(); hdfdjj_rightcols.Add(plyright.FromPoint); hdfdjj_rightcols.Add(plyright.ToPoint); //IPolyline plyleft = new PolylineClass(); //plyleft.SpatialReference = Global.spatialref; //IPointCollection plinleftcols = plyleft as IPointCollection; //if (plin.FromPoint.X - plin.ToPoint.X > 0) //{ // plinleftcols.AddPoint(hdfd_cols.get_Point(0)); // plinleftcols.AddPoint(hdfd_cols.get_Point(1)); //} //else //{ // plinleftcols.AddPoint(hdfd_cols.get_Point(1)); // plinleftcols.AddPoint(hdfd_cols.get_Point(0)); //} //IPoint pntleft = new PointClass(); //plyleft.QueryPoint(esriSegmentExtension.esriExtendAtTo, jjcd + plyleft.Length, false, pntleft); //IPolyline plyright = new PolylineClass(); //plyright.SpatialReference = Global.spatialref; //IPointCollection plinrightcols = plyright as IPointCollection; //if (plin.FromPoint.X - plin.ToPoint.X > 0) //{ // plinrightcols.AddPoint(hdfd_cols.get_Point(3)); // plinrightcols.AddPoint(hdfd_cols.get_Point(2)); //} //else //{ // plinrightcols.AddPoint(hdfd_cols.get_Point(2)); // plinrightcols.AddPoint(hdfd_cols.get_Point(3)); //} //IPoint pntright = new PointClass(); //plyright.QueryPoint(esriSegmentExtension.esriExtendAtTo, jjcd + plyright.Length, false, pntright); //List<IPoint> hdfdjj_leftcols = new List<IPoint>(); //if (plin.FromPoint.X - plin.ToPoint.X > 0) //{ // hdfdjj_leftcols.Add(pntleft); // hdfdjj_leftcols.Add(hdfd_cols.get_Point(1)); //} //else //{ // hdfdjj_leftcols.Add(pntleft); // hdfdjj_leftcols.Add(hdfd_cols.get_Point(0)); //} //List<IPoint> hdfdjj_rightcols = new List<IPoint>(); //if (plin.FromPoint.X - plin.ToPoint.X > 0) //{ // hdfdjj_rightcols.Add(hdfd_cols.get_Point(2)); // hdfdjj_rightcols.Add(pntright); //} //else //{ // hdfdjj_rightcols.Add(hdfd_cols.get_Point(3)); // hdfdjj_rightcols.Add(pntright); //} AddFDRegToLayer_JC(hdfdjj_leftcols, hdfdjj_rightcols, fdlin_pts, fdlin_dics, Global.hdfdlyr, hdwid); //更新巷道全面 List<Tuple<IFeature, IGeometry, Dictionary<string, string>>> selhdfull = Global.commonclss.SearchFeaturesByGeoAndText(Global.hdfdfulllyr, fldvals); IPolygon hdfull_polygon = selhdfull[0].Item2 as IPolygon; ITopologicalOperator topo = (ITopologicalOperator)hdfull_polygon; hdfdjj_rightcols.Reverse(); List<IPoint> newhdcols = ConstructPnts(hdfdjj_leftcols, hdfdjj_rightcols); IPolygon hdadd = AddRegToLayer(newhdcols, fdlin_dics, Global.hdfdfulllyr); //查询地质构造 //dzxlist = Global.commonclss.GetStructsInfos(outP,hd_ids); dzxlist = Global.commonclss.GetStructsInfosNew(outP, hd_ids); //将掘进点保存 List<GeoStruct> Last = new List<GeoStruct>(); GeoStruct LastGeo = new GeoStruct(); LastGeo.geo = outP; Last.Add(LastGeo); dzxlist.Add("LAST", Last); } Global.pActiveView.Refresh(); return dzxlist; }