private void button5_Click(object sender, EventArgs e) { strOperator = "add"; IPointCollection pointCollection; IPoint point = new PointClass(); IPoint fromPoint = new PointClass(); IPoint toPoint = new PointClass(); if (m_Feature.Shape.GeometryType == esriGeometryType.esriGeometryPolyline) { pointCollection = new PolylineClass(); IPolyline polyline = m_Feature.Shape as IPolyline; object missing1 = Type.Missing; object missing2 = Type.Missing; pointCollection = polyline as IPointCollection; //获取线对象的最后两个点 fromPoint = pointCollection.get_Point(pointCollection.PointCount - 2); toPoint = pointCollection.get_Point(pointCollection.PointCount - 1); //根据线最后两个点,创建一个新点 point.PutCoords((fromPoint.X + toPoint.X) / 2 + 300, (fromPoint.Y + toPoint.Y) / 2 + 500); //将新点添加到线对象的点集合中 pointCollection.AddPoint(point, ref missing1, ref missing2); } else if (m_Feature.Shape.GeometryType == esriGeometryType.esriGeometryPolygon) { pointCollection = new PolygonClass(); IPolygon polygon = m_Feature.Shape as IPolygon; object missing1 = Type.Missing; object missing2 = Type.Missing; pointCollection = polygon as IPointCollection; //获取面对象点集最后两个点 fromPoint = pointCollection.get_Point(pointCollection.PointCount - 2); toPoint = pointCollection.get_Point(pointCollection.PointCount - 1); //根据线最后两个点,创建一个新点 point.PutCoords((fromPoint.X + toPoint.X) / 2, (fromPoint.Y + toPoint.Y) / 2 + 50); //将新点添加到线对象的点集合中 pointCollection.AddPoint(point, ref missing1, ref missing2); } IWorkspaceEdit workspaceEdit; IWorkspace workspace; IDataset dataset = m_FeatureLayer.FeatureClass as IDataset; workspace = dataset.Workspace; workspaceEdit = workspace as IWorkspaceEdit; //开始编辑 workspaceEdit.StartEditing(true); workspaceEdit.StartEditOperation(); //保存数据 m_Feature.Store(); //结束编辑 workspaceEdit.StopEditOperation(); workspaceEdit.StopEditing(true); m_activeView.Refresh(); }
private bool LoadROI(string inSample, out string msg) { try { msg = ""; if (roiLayerDic.Count > 0) { roiLayerDic.Clear(); } if (!string.IsNullOrEmpty(inSample) && File.Exists(inSample)) { XmlDocument xmlDocument = new XmlDocument(); xmlDocument.Load(inSample); XmlNode xmlNode = xmlDocument.SelectSingleNode("RegionsOfInterest"); if (xmlNode == null) { msg = "ROI内容为空!"; return(false); } for (int i = 0; i < xmlNode.ChildNodes.Count; i++) { XmlNode xmlNode2 = xmlNode.ChildNodes[i]; string value = xmlNode2.Attributes[0].Value; string value2 = xmlNode2.Attributes[1].Value; string[] array = value2.Split(new char[] { ',' }); int red = CommonAPI.ConvertToInt(array[0]); int green = CommonAPI.ConvertToInt(array[1]); int blue = CommonAPI.ConvertToInt(array[2]); IRgbColor color = new RgbColorClass { Red = red, Green = green, Blue = blue }; ROILayerClass rOILayerClass = new ROILayerClass(); rOILayerClass.ID = ((roiLayerDic.Keys.Count == 0) ? 1 : (roiLayerDic.Keys.Max() + 1)); rOILayerClass.Name = value; rOILayerClass.Color = color; rOILayerClass.ElementList = new List <ROIElementClass>(); roiLayerDic.Add(rOILayerClass.ID, rOILayerClass); string innerText = xmlNode2.SelectSingleNode("GeometryDef/CoordSysStr").InnerText; spatialReference = EngineAPI.GetSpatialRefFromPrjStr(innerText); XmlNodeList xmlNodeList = xmlNode2.SelectNodes("GeometryDef/Polygon/Exterior/LinearRing/Coordinates"); for (int j = 0; j < xmlNodeList.Count; j++) { IPointCollection pointCollection = new PolygonClass(); string innerText2 = xmlNodeList[j].InnerText; string[] array2 = innerText2.Split(new char[] { ' ' }); int num = array2.Length / 2; for (int k = 0; k < num; k++) { IPoint point = new PointClass(); double x = CommonAPI.ConvertToDouble(array2[2 * k]); double y = CommonAPI.ConvertToDouble(array2[2 * k + 1]); point.PutCoords(x, y); object value3 = Missing.Value; object value4 = Missing.Value; pointCollection.AddPoint(point, ref value3, ref value4); } IPolygon polygon = pointCollection as IPolygon; polygon.FromPoint = pointCollection.get_Point(0); polygon.ToPoint = pointCollection.get_Point(pointCollection.PointCount - 1); if (spatialReference == null) { spatialReference = new UnknownCoordinateSystemClass(); } polygon.SpatialReference = spatialReference; polygon.Close(); IElement element = new PolygonElementClass(); element.Geometry = polygon; ROIElementClass rOIElementClass = new ROIElementClass { Element = element, Checked = true }; rOILayerClass.ElementList.Add(rOIElementClass); } } } return(true); } catch (Exception ex) { msg = ex.Message; return(false); } }
/// <summary> /// 回采进尺更新 /// </summary> /// <params name="hd1">主巷道ID</params> /// <params name="hd2">辅助巷道ID</params> /// <params name="hd3">切眼巷道ID</params> /// <params name="Bid">要修改的回采对象的BID</params> /// <params name="hccd">回采的尺度</params> /// <params name="search">查询附近地质构造的距离</params> /// <returns></returns> public Dictionary<string, IPoint> UpdateHCCD(string hd1, string hd2, string hd3, string Bid, double hccd, double zywid, double fywid, double qywid, double search = 0) { Dictionary<string, IPoint> respnts = new Dictionary<string, IPoint>(); Dictionary<string, string> hdids = new Dictionary<string, string>(); hdids.Add(GIS_Const.FIELD_HDID, hd1); List<Tuple<IFeature, IGeometry, Dictionary<string, string>>> selobjs1 = Global.commonclss.SearchFeaturesByGeoAndText(Global.centerlyr, hdids); IPolyline pline1 = selobjs1[0].Item2 as IPolyline; hdids[GIS_Const.FIELD_HDID] = hd2; List<Tuple<IFeature, IGeometry, Dictionary<string, string>>> selobjs2 = Global.commonclss.SearchFeaturesByGeoAndText(Global.centerlyr, hdids); IPolyline pline2 = selobjs2[0].Item2 as IPolyline; hdids[GIS_Const.FIELD_HDID] = hd3; List<Tuple<IFeature, IGeometry, Dictionary<string, string>>> selobjs3 = Global.commonclss.SearchFeaturesByGeoAndText(Global.centerlyr, hdids); IPolyline pline3 = selobjs3[0].Item2 as IPolyline; hdids[GIS_Const.FIELD_HDID] = hd1 + "_" + hd2; IPointCollection pntcol = new PolygonClass(); //查询对应的回采进尺的面 IFeatureClass feaclss = Global.hcqlyr.FeatureClass; IWorkspaceEdit wks = (feaclss as IDataset).Workspace as IWorkspaceEdit; wks.StartEditing(false); wks.StartEditOperation(); string sql = "\"" + GIS_Const.FIELD_HDID + "\"='" + hdids[GIS_Const.FIELD_HDID] + "' AND \"" + GIS_Const.FIELD_BS + "\"=0 AND " + GIS_Const.FIELD_BID + "='" + Bid + "'"; IQueryFilter queryfilter = new QueryFilterClass(); queryfilter.WhereClause = sql; IFeatureCursor hdhc_cursors = feaclss.Update(queryfilter, false); IFeature hdhc_fea = hdhc_cursors.NextFeature(); if (hdhc_fea == null) { MessageBox.Show("没有找到对应的回采进尺空间信息,请检查数据库和地图!", "系统提示"); return null; } else { //修改当前的回采进尺 List<IPoint> pnthccols = new List<IPoint>(); IPolygon hcpolygon = hdhc_fea.Shape as IPolygon; Dictionary<string, List<IPoint>> oldpnts = Global.commonclss.getCoordinates(hcpolygon, pline1, pline2, pline3, zywid, fywid); if (oldpnts.Count == 0) return null; IPointCollection pts = hcpolygon as IPointCollection; //IPoint ptstart = pts.get_Point(0); //IPoint ptend = pts.get_Point(pts.PointCount-1); IPoint ptstart = oldpnts["2"][1]; IPoint ptend = oldpnts["2"][0]; IPoint ptcenter = new PointClass(); ptcenter.X = (ptstart.X + ptend.X) / 2; ptcenter.Y = (ptstart.Y + ptend.Y) / 2; //原始中心点的坐标 IPoint ptcenter1 = new PointClass(); //ptcenter1.X = (pts.get_Point(1).X + pts.get_Point(2).X) / 2; //ptcenter1.Y = (pts.get_Point(1).Y + pts.get_Point(2).Y) / 2; ptcenter1.X = (oldpnts["1"][0].X + oldpnts["1"][1].X) / 2; ptcenter1.Y = (oldpnts["1"][0].Y + oldpnts["1"][1].Y) / 2; //设置回采移动的切眼 int dirflag = Global.commonclss.GetDirectionByPnt(pline3, ptcenter); IPolyline pline3new = new PolylineClass(); pline3new.FromPoint = oldpnts["2"][0]; pline3new.ToPoint = oldpnts["2"][1]; pntcol = Global.hcjsclass.GetBackPolygonArea(pline1, pline2, pline3new, zywid, fywid, qywid, hccd, dirflag); if (pntcol != null) { Dictionary<string, string> dics = new Dictionary<string, string>(); for (int i = 0; i < pntcol.PointCount - 1; i++) { pnthccols.Add(pntcol.get_Point(i)); } IPolygon polygon = Global.commonclss.CreatePolygonFromPnts(pnthccols, Global.spatialref); hdhc_fea.Shape = polygon; hdhc_cursors.UpdateFeature(hdhc_fea); IPoint prevHcPoint = pntcol.get_Point(pntcol.PointCount - 1); prevHcPoint.Z = 0.0; //将当前的回采中心点添加到结果集中,以备更新数据库表中的workingface表 respnts.Add(Bid, prevHcPoint); //更新导线点图层中的点 //Global.commonclss.UpdateFeature(sql, prevHcPoint, Global.pntlyr); //平移或缩放后面的回采进尺面 double xdeta = prevHcPoint.X - ptcenter1.X; double ydeta = prevHcPoint.Y - ptcenter1.Y; int xhpos = hdhc_fea.Fields.FindField(GIS_Const.FIELD_XH); int xh = Convert.ToInt32(hdhc_fea.get_Value(xhpos)); Marshal.ReleaseComObject(hdhc_cursors); //string sql_hdfull = "\""+GIS.GIS_Const.FIELD_HDID+"\"='" + hdids[GIS.GIS_Const.FIELD_HDID] + "' AND \""+GIS.GIS_Const.FIELD_BS+"\"=0 AND "+GIS.GIS_Const.FIELD_XH+">" + xh.ToString(); string sql_hdfull = "\"HdId\"='" + hdids[GIS_Const.FIELD_HDID] + "' AND \"" + GIS_Const.FIELD_BS + "\"=0 AND " + GIS_Const.FIELD_XH + ">" + xh.ToString(); IQueryFilter queryfilter1 = new QueryFilterClass(); queryfilter1.WhereClause = sql_hdfull; queryfilter1.SubFields = "*"; IFeatureCursor otherhcursor = feaclss.Update(queryfilter1, false); IFeature fea_hc = otherhcursor.NextFeature(); int bidpos = otherhcursor.FindField(GIS_Const.FIELD_BID); while (fea_hc != null) { IPolygon reg = fea_hc.Shape as IPolygon; ITransform2D trans = reg as ITransform2D; trans.Move(xdeta, ydeta); fea_hc.Shape = reg; otherhcursor.UpdateFeature(fea_hc); //将工作面的中心点坐标保存到集合中 IPointCollection ptsothers = reg as IPointCollection; IPoint ptothercenter = new PointClass(); Dictionary<string, List<IPoint>> otherpnts = Global.commonclss.getCoordinates(reg, pline1, pline2, pline3, zywid, fywid); //ptothercenter.X = (ptsothers.get_Point(pts.PointCount - 3).X + ptsothers.get_Point(pts.PointCount - 2).X) / 2; //ptothercenter.Y = (ptsothers.get_Point(pts.PointCount - 3).Y + ptsothers.get_Point(pts.PointCount - 2).Y) / 2; ptothercenter.X = (otherpnts["1"][0].X + otherpnts["1"][1].X) / 2; ptothercenter.Y = (otherpnts["1"][0].Y + otherpnts["1"][1].Y) / 2; ptothercenter.Z = 0.0; string bidval = fea_hc.get_Value(bidpos).ToString(); respnts.Add(bidval, ptothercenter); //更新导线点图层 //Global.commonclss.UpdateFeature(sql_hdfull, ptothercenter, Global.pntlyr); fea_hc = otherhcursor.NextFeature(); } Marshal.ReleaseComObject(otherhcursor); } } Global.pActiveView.Refresh(); return respnts; //将获得的点写入到工作面表中 }
/// <summary> /// 绘制工作面回采 /// </summary> /// <params name="hd1">巷道1 ID</params> /// <params name="hd2">巷道2 ID</params> /// <params name="hd3">切眼 ID</params> /// <params name="hccd">回采长度</params> /// <params name="hd1wid1">巷道1宽度</params> /// <params name="hd1wid2">巷道2宽度</params> /// <params name="hcbz">回采与回采校正标识</params> /// <returns></returns> public Dictionary<string, List<GeoStruct>> DrawHDHC(string hd1, string hd2, string hd3, double hccd, double hd1wid1, double hd1wid2, double qywid, int hcbz, double searchlen, Dictionary<string, string> dics, bool isAdd, IPoint prevPoint, out IPoint pos) { List<int> hd_ids = new List<int>(); hd_ids.Add(Convert.ToInt16(hd1)); hd_ids.Add(Convert.ToInt16(hd2)); hd_ids.Add(Convert.ToInt16(hd3)); //返回工作面坐标点 IPoint prevHcPoint = new PointClass(); pos = prevHcPoint; Dictionary<string, List<GeoStruct>> dzxlist = new Dictionary<string, List<GeoStruct>>(); Dictionary<string, string> hdids = new Dictionary<string, string>(); hdids.Add(GIS_Const.FIELD_HDID, hd1); List<Tuple<IFeature, IGeometry, Dictionary<string, string>>> selobjs1 = Global.commonclss.SearchFeaturesByGeoAndText(Global.centerlyr, hdids); if (null == selobjs1 || selobjs1.Count < 0) { Log.Error("[GIS]....绘制回采巷道,“中心线图层”可能不存在,请检查GIS数据库。"); return null; } IPolyline pline1 = selobjs1[0].Item2 as IPolyline; hdids[GIS_Const.FIELD_HDID] = hd2; List<Tuple<IFeature, IGeometry, Dictionary<string, string>>> selobjs2 = Global.commonclss.SearchFeaturesByGeoAndText(Global.centerlyr, hdids); IPolyline pline2 = selobjs2[0].Item2 as IPolyline; hdids[GIS_Const.FIELD_HDID] = hd3; List<Tuple<IFeature, IGeometry, Dictionary<string, string>>> selobjs3 = Global.commonclss.SearchFeaturesByGeoAndText(Global.centerlyr, hdids); IPolyline pline3 = selobjs3[0].Item2 as IPolyline; hdids[GIS_Const.FIELD_HDID] = hd1 + "_" + hd2; //设置回采移动的切眼 int dirflag = 0; List<Tuple<IFeature, IGeometry, Dictionary<string, string>>> selhcregs = Global.commonclss.SearchFeaturesByGeoAndText(Global.hcqlyr, hdids); if (prevPoint != null && selhcregs != null && selhcregs.Count > 0) { //查询回采面中心点在切眼中的方向 dirflag = Global.commonclss.GetDirectionByPnt(pline3, prevPoint); //构造新的切眼巷道 Dictionary<string, List<IPoint>> regcoordinates = Global.commonclss.getCoordinates(selhcregs[0].Item2 as IPolygon, pline1, pline2, pline3, hd1wid1, hd1wid2); pline3 = new PolylineClass(); pline3.FromPoint = regcoordinates["1"][1]; pline3.ToPoint = regcoordinates["1"][0]; } //查询采掘图层上是否包含了相应的回采区 List<Tuple<IFeature, IGeometry, Dictionary<string, string>>> selcjqs = Global.commonclss.SearchFeaturesByGeoAndText(Global.hcqlyr, hdids); IPointCollection pntcol = new PolygonClass(); if (hcbz == 1)//粗糙回采 { pntcol = Global.hcjsclass.GetBackPolygonArea(pline1, pline2, pline3, hd1wid1, hd1wid1, qywid, hccd, dirflag); if (pntcol == null) { pos = null; return null; } List<IPoint> pnthccols = new List<IPoint>(); for (int i = 0; i < pntcol.PointCount - 1; i++) { pnthccols.Add(pntcol.get_Point(i)); } if (isAdd) Global.cons.AddHangdaoToLayer(pnthccols, dics, Global.hcqlyr); else { IPolygon poly = Global.commonclss.CreatePolygonFromPnts(pnthccols, Global.spatialref); if (selcjqs.Count > 0) Global.commonclss.UpdateFeature(Global.hcqlyr, selcjqs[0].Item1, dics, poly); } prevHcPoint = pntcol.get_Point(pntcol.PointCount - 1); pos = pntcol.get_Point(pntcol.PointCount - 1); //根据点查询60米范围内的地质构造的信息 //dzxlist = Global.commonclss.GetStructsInfos(prevHcPoint, hd_ids); dzxlist = Global.commonclss.GetStructsInfosNew(prevHcPoint, hd_ids, 2); } if (hcbz == 2)//回采校正 { double x = 0.0;//Convert.ToDouble(this.txtX.Text); double y = 0.0;// Convert.ToDouble(this.txtY.Text); double hccd1 = Math.Sqrt(Math.Pow((x - prevHcPoint.X), 2) + Math.Pow((y - prevHcPoint.Y), 2)); //将BS为0的回采去删除,创建新的回采区 string sql = "\"" + GIS_Const.FIELD_HDID + "\"='" + hd1 + "_" + hd2 + "' AND \"" + GIS_Const.FIELD_BS + "\"=0"; Global.commonclss.DelFeatures(Global.hcqlyr, sql); //查询对应的采掘 pntcol = Global.hcjsclass.GetBackPolygonArea(pline1, pline2, pline3, hd1wid1, hd1wid1, hd1wid2, hccd1, dirflag); if (pntcol == null) return null; //构造采掘区对象 List<IPoint> pnthccols = new List<IPoint>(); for (int i = 0; i < pntcol.PointCount - 1; i++) { pnthccols.Add(pntcol.get_Point(i)); } if (isAdd) Global.cons.AddHangdaoToLayer(pnthccols, dics, Global.hcqlyr); else { IPolygon poly = Global.commonclss.CreatePolygonFromPnts(pnthccols, Global.spatialref); Global.commonclss.UpdateFeature(Global.hcqlyr, selcjqs[0].Item1, dics, poly); } //将当前点写入到对应的工作面表中 prevHcPoint = pntcol.get_Point(pntcol.PointCount - 1); pos = prevHcPoint; //根据点查询60米范围内的地质构造的信息 //dzxlist = Global.commonclss.GetStructsInfos(prevHcPoint, hd_ids); dzxlist = Global.commonclss.GetStructsInfosNew(prevHcPoint, hd_ids, 2); } Global.pActiveView.Refresh(); return dzxlist; }
/// <summary> /// 巷道回采校正 /// </summary> private void TunnelHcJz(List <IPoint> pnts, string hd1, string hd2, string hd3, int workingfaceid, double zywid, double fywid, double qywid) { //查询对应的巷道信息 var hdids = new Dictionary <string, string>(); hdids.Add(GIS_Const.FIELD_HDID, hd1); var selobjs1 = Global.commonclss.SearchFeaturesByGeoAndText(Global.centerlyr, hdids); var pline1 = selobjs1[0].Item2 as IPolyline; hdids[GIS_Const.FIELD_HDID] = hd2; var selobjs2 = Global.commonclss.SearchFeaturesByGeoAndText(Global.centerlyr, hdids); var pline2 = selobjs2[0].Item2 as IPolyline; hdids[GIS_Const.FIELD_HDID] = hd3; var selobjs3 = Global.commonclss.SearchFeaturesByGeoAndText(Global.centerlyr, hdids); var pline3 = selobjs3[0].Item2 as IPolyline; //删除原来的采掘区 hdids[GIS_Const.FIELD_HDID] = hd1 + "_" + hd2; var sql = "\"" + GIS_Const.FIELD_HDID + "\"='" + hd1 + "_" + hd2 + "' AND \"" + GIS_Const.FIELD_BS + "\"=0"; Global.commonclss.DelFeatures(Global.hcqlyr, sql); //查询对应的回采区 for (var k = 0; k < pnts.Count; k++) { //导线点 var pnt = pnts[k]; var jzx = pnt.X; var jzy = pnt.Y; //构造采掘区对象 var xh = 0; var selobjshcqs = Global.commonclss.SearchFeaturesByGeoAndText(Global.hcqlyr, hdids); Dictionary <string, List <IPoint> > oldpnts = null; if (selobjshcqs.Count != 0) { oldpnts = Global.commonclss.getCoordinates(selobjshcqs[0].Item2 as IPolygon, pline1, pline2, pline3, zywid, fywid); xh = Convert.ToInt32(selobjshcqs[0].Item3[GIS_Const.FIELD_XH]); } IPointCollection pntcol = new PolygonClass(); if (selobjshcqs.Count == 0) { //计算校正点距离切眼的距离 IPoint outp = new PointClass(); var distancealong = 0.0; var distancefrom = 0.0; var bres = false; pline3.QueryPointAndDistance(esriSegmentExtension.esriNoExtension, pnt, false, outp, ref distancealong, ref distancefrom, ref bres); //根据距离绘制回采面 pntcol = Global.hcjsclass.GetBackPolygonArea(pline1, pline2, pline3, zywid, fywid, qywid, distancefrom, 0); } else { //IPolygon hcreg = selobjshcqs[0].Item2 as IPolygon; //Dictionary<string, List<IPoint>> fourpnts = Global.commonclss.getCoordinates(hcreg, pline1, pline2, pline3, Global.linespace, Global.linespace); //List<IPoint> listpnts = fourpnts["1"]; IPoint pntcenter = new PointClass(); pntcenter.PutCoords((oldpnts["1"][0].X + oldpnts["1"][1].X) / 2, (oldpnts["1"][0].Y + oldpnts["1"][1].Y) / 2); pntcenter.Z = 0; //double hccd1 = Math.Sqrt(Math.Pow((pnt.X - pntcenter.X), 2) + Math.Pow((pnt.Y - pntcenter.Y), 2)); //查询回采方向 这里没有设置传入的切眼 可能会出错 需要调试2014-9-23 var dirflag = 0; dirflag = Global.commonclss.GetDirectionByPnt(pline3, pntcenter); pline3 = new PolylineClass(); if (oldpnts == null) { return; } pline3.FromPoint = oldpnts["1"][1]; pline3.ToPoint = oldpnts["1"][0]; //计算校正点距离切眼的距离 IPoint outp = new PointClass(); var distancealong = 0.0; var distancefrom = 0.0; var bres = false; pline3.QueryPointAndDistance(esriSegmentExtension.esriNoExtension, pnt, false, outp, ref distancealong, ref distancefrom, ref bres); //根据距离绘制回采面 pntcol = Global.hcjsclass.GetBackPolygonArea(pline1, pline2, pline3, zywid, fywid, qywid, distancefrom, dirflag); } var pnthccols = new List <IPoint>(); for (var i = 0; i < pntcol.PointCount - 1; i++) { pnthccols.Add(pntcol.get_Point(i)); } var dics = new Dictionary <string, string>(); dics[GIS_Const.FIELD_ID] = "0"; dics[GIS_Const.FIELD_BS] = "1"; dics[GIS_Const.FIELD_HDID] = hdids[GIS_Const.FIELD_HDID]; dics[GIS_Const.FIELD_XH] = (xh + 1).ToString(); Global.cons.AddHangdaoToLayer(pnthccols, dics, Global.hcqlyr); //将当前点写入到对应的工作面表中 var prevPnt = pntcol.get_Point(pntcol.PointCount - 1); var workingFace = selectWorkingFaceControl1.SelectedWorkingFace; if (prevPnt != null) { workingFace.SetCoordinate(prevPnt.X, prevPnt.Y, 0.0); workingFace.Save(); } //根据点查询60米范围内的地质构造的信息 var hd_ids = new List <int>(); hd_ids.Add(Convert.ToInt16(hd1)); hd_ids.Add(Convert.ToInt16(hd2)); hd_ids.Add(Convert.ToInt16(hd3)); var geostructs = Global.commonclss.GetStructsInfos(prevPnt, hd_ids); if (geostructs == null) { return; } GeologySpaceBll.DeleteGeologySpaceEntityInfos(workingFace.WorkingFaceId); //删除对应工作面ID的地质构造信息 foreach (var key in geostructs.Keys) { var geoinfos = geostructs[key]; var geo_type = key; for (var i = 0; i < geoinfos.Count; i++) { var tmp = geoinfos[i]; var geologyspaceEntity = new GeologySpace(); geologyspaceEntity.WorkingFace = workingFace; geologyspaceEntity.TectonicType = Convert.ToInt32(key); geologyspaceEntity.TectonicId = tmp.geoinfos[GIS_Const.FIELD_BID]; geologyspaceEntity.Distance = tmp.dist; geologyspaceEntity.OnDateTime = DateTime.Now.ToShortDateString(); geologyspaceEntity.Save(); } } } }
public static IGeometry GetExample10() { const double CircleDegrees = 360.0; const int CircleDivisions = 36; const double VectorComponentOffset = 0.0000001; const double CircleRadius = 3.0; const double BaseZ = 0.0; //Extrusion: 3D Circle Polygon Extruded Along 3D Line Via ConstructExtrudeAlongLine() IPointCollection polygonPointCollection = new PolygonClass(); IGeometry polygonGeometry = polygonPointCollection as IGeometry; GeometryUtilities.MakeZAware(polygonGeometry); IPoint originPoint = GeometryUtilities.ConstructPoint3D(0, 0, 0); IVector3D upperAxisVector3D = GeometryUtilities.ConstructVector3D(0, 0, 10); IVector3D lowerAxisVector3D = GeometryUtilities.ConstructVector3D(0, 0, -10); lowerAxisVector3D.XComponent += VectorComponentOffset; IVector3D normalVector3D = upperAxisVector3D.CrossProduct(lowerAxisVector3D) as IVector3D; normalVector3D.Magnitude = CircleRadius; double rotationAngleInRadians = GeometryUtilities.GetRadians(CircleDegrees / CircleDivisions); for (int i = 0; i < CircleDivisions; i++) { normalVector3D.Rotate(-1 * rotationAngleInRadians, upperAxisVector3D); IPoint vertexPoint = GeometryUtilities.ConstructPoint3D(originPoint.X + normalVector3D.XComponent, originPoint.Y + normalVector3D.YComponent, BaseZ); polygonPointCollection.AddPoint(vertexPoint, ref _missing, ref _missing); } polygonPointCollection.AddPoint(polygonPointCollection.get_Point(0), ref _missing, ref _missing); ITopologicalOperator topologicalOperator = polygonGeometry as ITopologicalOperator; topologicalOperator.Simplify(); //Define Line To Extrude Along ILine extrusionLine = new LineClass(); extrusionLine.FromPoint = GeometryUtilities.ConstructPoint3D(-4, -4, -5); extrusionLine.ToPoint = GeometryUtilities.ConstructPoint3D(4, 4, 5); //Perform Extrusion IConstructMultiPatch constructMultiPatch = new MultiPatchClass(); constructMultiPatch.ConstructExtrudeAlongLine(extrusionLine, polygonGeometry); //Transform Extrusion Result IArea area = polygonGeometry as IArea; ITransform2D transform2D = constructMultiPatch as ITransform2D; transform2D.Move(extrusionLine.FromPoint.X - area.Centroid.X, extrusionLine.FromPoint.Y - area.Centroid.Y); return(constructMultiPatch as IGeometry); }
public static IGeometry GetExample10() { const double CircleDegrees = 360.0; const int CircleDivisions = 36; const double VectorComponentOffset = 0.0000001; const double CircleRadius = 3.0; const double BaseZ = 0.0; //Extrusion: 3D Circle Polygon Extruded Along 3D Line Via ConstructExtrudeAlongLine() IPointCollection polygonPointCollection = new PolygonClass(); IGeometry polygonGeometry = polygonPointCollection as IGeometry; GeometryUtilities.MakeZAware(polygonGeometry); IPoint originPoint = GeometryUtilities.ConstructPoint3D(0, 0, 0); IVector3D upperAxisVector3D = GeometryUtilities.ConstructVector3D(0, 0, 10); IVector3D lowerAxisVector3D = GeometryUtilities.ConstructVector3D(0, 0, -10); lowerAxisVector3D.XComponent += VectorComponentOffset; IVector3D normalVector3D = upperAxisVector3D.CrossProduct(lowerAxisVector3D) as IVector3D; normalVector3D.Magnitude = CircleRadius; double rotationAngleInRadians = GeometryUtilities.GetRadians(CircleDegrees / CircleDivisions); for (int i = 0; i < CircleDivisions; i++) { normalVector3D.Rotate(-1 * rotationAngleInRadians, upperAxisVector3D); IPoint vertexPoint = GeometryUtilities.ConstructPoint3D(originPoint.X + normalVector3D.XComponent, originPoint.Y + normalVector3D.YComponent, BaseZ); polygonPointCollection.AddPoint(vertexPoint, ref _missing, ref _missing); } polygonPointCollection.AddPoint(polygonPointCollection.get_Point(0), ref _missing, ref _missing); ITopologicalOperator topologicalOperator = polygonGeometry as ITopologicalOperator; topologicalOperator.Simplify(); //Define Line To Extrude Along ILine extrusionLine = new LineClass(); extrusionLine.FromPoint = GeometryUtilities.ConstructPoint3D(-4, -4, -5); extrusionLine.ToPoint = GeometryUtilities.ConstructPoint3D(4, 4, 5); //Perform Extrusion IConstructMultiPatch constructMultiPatch = new MultiPatchClass(); constructMultiPatch.ConstructExtrudeAlongLine(extrusionLine, polygonGeometry); //Transform Extrusion Result IArea area = polygonGeometry as IArea; ITransform2D transform2D = constructMultiPatch as ITransform2D; transform2D.Move(extrusionLine.FromPoint.X - area.Centroid.X, extrusionLine.FromPoint.Y - area.Centroid.Y); return constructMultiPatch as IGeometry; }