/// <summary> /// 矿井选择事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void lstMineName_MouseUp(object sender, MouseEventArgs e) { this.lstHorizontalName.Items.Clear(); this.lstMiningAreaName.Items.Clear(); this.lstWorkingFaceName.Items.Clear(); this.lstTunnelName.Items.Clear(); for (int i = 0; i < this.lstMineName.SelectedItems.Count; i++) { // 创建巷道实体 TunnelEntity tunnelEntity = new TunnelEntity(); // 矿井名称 tunnelEntity.MineName = this.lstMineName.SelectedItems[i].ToString(); //// 获取水平信息 //DataSet ds = TunnelInfoBLL.cboAddHorizontal(tunnelEntity); //// 检索件数 //int iSelCnt = ds.Tables[0].Rows.Count; //// 检索件数 > 0 的场合 //if (iSelCnt > 0) //{ // // 绑定水平信息 // foreach (DataRow dr in ds.Tables[0].Rows) // { // this.lstHorizontalName.Items.Add(dr["HORIZONTAL"].ToString()); // } //} } }
/// <summary> /// 添加其他巷道按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button_ChooseAdd_Click(object sender, EventArgs e) { //巷道选择窗体 TunnelChoose tunnelChoose; //第一次选择巷道时给巷道实体赋值,用于下条巷道选择时的控件选择定位 if (tunnelHCEntity.TunnelID_ZY != 0) { tunnelEntity.TunnelID = tunnelHCEntity.TunnelID_ZY; tunnelEntity = TunnelInfoBLL.selectTunnelInfoByTunnelID(tunnelEntity.TunnelID); } //第一次选择巷道 if (tunnelEntity.TunnelID == 0) { tunnelChoose = new TunnelChoose(); } //非第一次选择巷道 else { tunnelChoose = new TunnelChoose(tunnelEntity); } //巷道选择完毕 if (DialogResult.OK == tunnelChoose.ShowDialog()) { //添加信息到listBox listBox_Browse.Items.Add(tunnelChoose.returnTunnelInfo().TunnelName); //实体赋值 if (this.Text == Const_GM.TUNNEL_HC_CHANGE) { if ((tmpTunnelHCEntity.TunnelID != "") && (tmpTunnelHCEntity.TunnelID != null)) { tmpTunnelHCEntity.TunnelID += ","; } tmpTunnelHCEntity.TunnelID += Convert.ToString(tunnelChoose.returnTunnelInfo().TunnelID); } if (this.Text == Const_GM.TUNNEL_HC_ADD) { if ((tunnelHCEntity.TunnelID != "") && (tunnelHCEntity.TunnelID != null)) { tunnelHCEntity.TunnelID += ","; } tunnelHCEntity.TunnelID += Convert.ToString(tunnelChoose.returnTunnelInfo().TunnelID); } //巷道实体赋值,用于下次巷道选择 tunnelEntity = tunnelChoose.returnTunnelInfo(); } }
/// <summary> /// 返回巷道是否作为回采巷道 /// </summary> /// <param name="tunnelEntity">巷道实体</param> /// <returns>巷道是否作为回采巷道?true:false</returns> public static bool isTunnelUsedAsHC(TunnelEntity tunnelEntity) { ManageDataBase db = new ManageDataBase(DATABASE_TYPE.GeologyMeasureDB); string sql = "SELECT * FROM " + TunnelHCDbConstNames.TABLE_NAME + " WHERE " + TunnelHCDbConstNames.TUNNEL_ID1 + " = " + tunnelEntity.TunnelID + " OR " + TunnelHCDbConstNames.TUNNEL_ID2 + " = " + tunnelEntity.TunnelID + " OR " + TunnelHCDbConstNames.TUNNEL_ID3 + " = " + tunnelEntity.TunnelID; DataSet ds = db.ReturnDS(sql); if (ds.Tables[0].Rows.Count > 0) { return(true); } else { return(false); } }
/// <summary> /// 开切眼 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnTunnelChoose3_Click(object sender, EventArgs e) { //巷道选择窗体 TunnelChoose tunnelChoose; //第一次选择巷道时给巷道实体赋值,用于下条巷道选择时的控件选择定位 if (tunnelHCEntity.TunnelID_KQY != 0) { tunnelEntity.TunnelID = tunnelHCEntity.TunnelID_KQY; tunnelEntity = TunnelInfoBLL.selectTunnelInfoByTunnelID(tunnelEntity.TunnelID); } //第一次选择巷道 if (tunnelEntity.TunnelID == 0) { tunnelChoose = new TunnelChoose(); } //非第一次选择巷道 else { tunnelChoose = new TunnelChoose(tunnelEntity); } //巷道选择完毕 if (DialogResult.OK == tunnelChoose.ShowDialog()) { //巷道选择按钮Text改变 btnTunnelChoose3.Text = tunnelChoose.returnTunnelInfo().TunnelName; //实体赋值 if (this.Text == Const_GM.TUNNEL_HC_CHANGE) { tmpTunnelHCEntity.TunnelID_KQY = tunnelChoose.returnTunnelInfo().TunnelID; } if (this.Text == Const_GM.TUNNEL_HC_ADD) { tunnelHCEntity.TunnelID_KQY = tunnelChoose.returnTunnelInfo().TunnelID; } //巷道实体赋值,用于下次巷道选择 tunnelEntity = tunnelChoose.returnTunnelInfo(); } }
/// <summary> /// 根据传入的左邦点数组和右邦点数组生成巷道 /// </summary> /// <param name="tunnel"></param> /// <param name="pts"></param> /// <param name="editlayer"></param> public void DrawHuDong(TunnelEntity tunnel, WirePointInfoEntity[] pts, IFeatureLayer editlayer) { IPoint point = new PointClass(); IPointCollection4 pointCollection = new PolygonClass(); TunnelPointsCalculation TPC = new TunnelPointsCalculation(); Vector3_DW[] lstLeftBtmVertices = null; Vector3_DW[] lstRightBtmVertices = null; TPC.CalcLeftAndRightVertics(pts, ref lstLeftBtmVertices, ref lstRightBtmVertices); for (int intI = 0; intI < lstLeftBtmVertices.Length; intI++) { point.X = lstLeftBtmVertices[intI].X; point.Y = lstLeftBtmVertices[intI].Y; point.Z = lstLeftBtmVertices[intI].Z; pointCollection.AddPoint(point); } for (int intI = lstRightBtmVertices.Length; intI >= 0; intI--) { point.X = lstRightBtmVertices[intI].X; point.Y = lstRightBtmVertices[intI].Y; point.Z = lstRightBtmVertices[intI].Z; pointCollection.AddPoint(point); } IFeature f; IGeometryCollection polygon; //定义一个地物类,把要编辑的图层转化为定义的地物类 IFeatureClass fc = editlayer.FeatureClass; //先定义一个编辑的工作空间,然后把转化为数据集,最后转化为编辑工作空间, IWorkspaceEdit w = (fc as IDataset).Workspace as IWorkspaceEdit; //开始事务操作 w.StartEditing(false); //开始编辑 w.StartEditOperation(); //创建一个地物 //绘制巷道 polygon = new PolygonClass(); IGeometryCollection pGeoColl = pointCollection as IGeometryCollection; ISegmentCollection pRing = new RingClass(); pRing.AddSegmentCollection(pGeoColl as ISegmentCollection); polygon.AddGeometry(pRing as IGeometry); IPolygon polyGonGeo = polygon as IPolygon; polyGonGeo.SimplifyPreserveFromTo(); f = fc.CreateFeature(); //polygon.PutCoords(Convert.ToDouble(ge.CoordinateX), Convert.ToDouble(ge.CoordinateY)); //确定图形类型 f.Shape = (IGeometry)polyGonGeo; //给巷道赋属性值 int num3; //num3 = editlayer.FeatureClass.Fields.FindField("OBJECTID"); //f.set_Value(num3, tunnel.TunnelID); num3 = editlayer.FeatureClass.Fields.FindField("MINE_NAME"); f.set_Value(num3, tunnel.MineName); num3 = editlayer.FeatureClass.Fields.FindField("HORIZONTAL"); f.set_Value(num3, tunnel.HorizontalName); num3 = editlayer.FeatureClass.Fields.FindField("MINING_AREA"); f.set_Value(num3, tunnel.MiningAreaName); num3 = editlayer.FeatureClass.Fields.FindField("WORKING_FACE"); f.set_Value(num3, tunnel.WorkingFaceName); num3 = editlayer.FeatureClass.Fields.FindField("TUNNEL_NAME"); f.set_Value(num3, tunnel.TunnelName); num3 = editlayer.FeatureClass.Fields.FindField("SUPPORT_PATTERN"); f.set_Value(num3, tunnel.TunnelSupportPattern); num3 = editlayer.FeatureClass.Fields.FindField("LITHOLOGY_ID"); f.set_Value(num3, tunnel.TunnelLithologyID); num3 = editlayer.FeatureClass.Fields.FindField("FAULTAGETYPE"); f.set_Value(num3, tunnel.TunnelSectionType); num3 = editlayer.FeatureClass.Fields.FindField("PARAM"); f.set_Value(num3, tunnel.TunnelParam); num3 = editlayer.FeatureClass.Fields.FindField("DESIGNLENGTH"); f.set_Value(num3, tunnel.TunnelDesignLength); //num3 = editlayer.FeatureClass.Fields.FindField("RULE_CODE"); //f.set_Value(num3, tunnel.r); //保存地物 f.Store(); //渲染巷道样式 ISimpleFillSymbol pFillSymbol; pFillSymbol = new SimpleFillSymbolClass(); pFillSymbol.Color = getRGB(60, 100, 50); pFillSymbol.Outline.Color = getRGB(60, 100, 50); pFillSymbol.Outline.Width = 1; pFillSymbol.Style = esriSimpleFillStyle.esriSFSSolid; RenderfeatureLayer(editlayer, pFillSymbol as ISymbol); //结束编辑 w.StopEditOperation(); //结束事务操作 w.StopEditing(true); }
private void listBox_Browse_MouseDoubleClick(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { int index = listBox_Browse.IndexFromPoint(e.Location); if (index >= 0) { listBox_Browse.SelectedIndex = index; listBox_Browse.Items.RemoveAt(index); //实体赋值 if (this.Text == Const_GM.TUNNEL_HC_CHANGE) { string[] sArray = new string[10]; string strTunnelID = ""; if ((tmpTunnelHCEntity.TunnelID != "") && (tmpTunnelHCEntity.TunnelID != null)) { sArray = tmpTunnelHCEntity.TunnelID.Split(','); } int iIndex = 0; foreach (string i in sArray) { if (index != iIndex) { if ((strTunnelID != "") && (strTunnelID != null)) { strTunnelID += ","; } strTunnelID += i; //巷道实体赋值,用于下次巷道选择 tunnelEntity.TunnelID = Convert.ToInt16(i); tunnelEntity = TunnelInfoBLL.selectTunnelInfoByTunnelID(tunnelEntity.TunnelID); } else { int iTunnelID = Convert.ToInt16(i); TunnelInfoBLL.clearTunnelType(iTunnelID); } iIndex += 1; } tmpTunnelHCEntity.TunnelID = strTunnelID; } if (this.Text == Const_GM.TUNNEL_HC_ADD) { string[] sArray = new string[10]; string strTunnelID = ""; if ((tunnelHCEntity.TunnelID != "") && (tunnelHCEntity.TunnelID != null)) { sArray = tunnelHCEntity.TunnelID.Split(','); } int iIndex = 0; foreach (string i in sArray) { if (index != iIndex) { if ((strTunnelID != "") && (strTunnelID != null)) { strTunnelID += ","; } strTunnelID += i; //巷道实体赋值,用于下次巷道选择 tunnelEntity.TunnelID = Convert.ToInt16(i); tunnelEntity = TunnelInfoBLL.selectTunnelInfoByTunnelID(tunnelEntity.TunnelID); } iIndex += 1; } tunnelHCEntity.TunnelID = strTunnelID; } } } }
private void listBox_Browse_MouseDoubleClick(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { int index = listBox_Browse.IndexFromPoint(e.Location); if (index >= 0) { listBox_Browse.SelectedIndex = index; listBox_Browse.Items.RemoveAt(index); //实体赋值 if (this.Text == Const_GM.TUNNEL_HC_CHANGE) { string[] sArray = new string[10]; string strTunnelID = ""; if ((tmpTunnelHCEntity.TunnelID != "")&&(tmpTunnelHCEntity.TunnelID != null)) { sArray = tmpTunnelHCEntity.TunnelID.Split(','); } int iIndex = 0; foreach (string i in sArray) { if (index != iIndex) { if ((strTunnelID != "") && (strTunnelID != null)) { strTunnelID += ","; } strTunnelID += i; //巷道实体赋值,用于下次巷道选择 tunnelEntity.TunnelID = Convert.ToInt16(i); tunnelEntity = TunnelInfoBLL.selectTunnelInfoByTunnelID(tunnelEntity.TunnelID); } else { int iTunnelID = Convert.ToInt16(i); TunnelInfoBLL.clearTunnelType(iTunnelID); } iIndex += 1; } tmpTunnelHCEntity.TunnelID = strTunnelID; } if (this.Text == Const_GM.TUNNEL_HC_ADD) { string[] sArray = new string[10]; string strTunnelID = ""; if ((tunnelHCEntity.TunnelID != "")&&(tunnelHCEntity.TunnelID != null)) { sArray = tunnelHCEntity.TunnelID.Split(','); } int iIndex = 0; foreach (string i in sArray) { if (index != iIndex) { if ((strTunnelID != "") && (strTunnelID != null)) { strTunnelID += ","; } strTunnelID += i; //巷道实体赋值,用于下次巷道选择 tunnelEntity.TunnelID = Convert.ToInt16(i); tunnelEntity = TunnelInfoBLL.selectTunnelInfoByTunnelID(tunnelEntity.TunnelID); } iIndex += 1; } tunnelHCEntity.TunnelID = strTunnelID; } } } }
/// <summary> /// 添加其他巷道按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button_ChooseAdd_Click(object sender, EventArgs e) { //巷道选择窗体 TunnelChoose tunnelChoose; //第一次选择巷道时给巷道实体赋值,用于下条巷道选择时的控件选择定位 if (tunnelHCEntity.TunnelID_ZY != 0) { tunnelEntity.TunnelID = tunnelHCEntity.TunnelID_ZY; tunnelEntity = TunnelInfoBLL.selectTunnelInfoByTunnelID(tunnelEntity.TunnelID); } //第一次选择巷道 if (tunnelEntity.TunnelID == 0) { tunnelChoose = new TunnelChoose(); } //非第一次选择巷道 else { tunnelChoose = new TunnelChoose(tunnelEntity); } //巷道选择完毕 if (DialogResult.OK == tunnelChoose.ShowDialog()) { //添加信息到listBox listBox_Browse.Items.Add(tunnelChoose.returnTunnelInfo().TunnelName); //实体赋值 if (this.Text == Const_GM.TUNNEL_HC_CHANGE) { if ((tmpTunnelHCEntity.TunnelID != "")&&(tmpTunnelHCEntity.TunnelID!=null)) { tmpTunnelHCEntity.TunnelID += ","; } tmpTunnelHCEntity.TunnelID += Convert.ToString(tunnelChoose.returnTunnelInfo().TunnelID); } if (this.Text == Const_GM.TUNNEL_HC_ADD) { if ((tunnelHCEntity.TunnelID!="")&&(tunnelHCEntity.TunnelID!=null)) { tunnelHCEntity.TunnelID += ","; } tunnelHCEntity.TunnelID += Convert.ToString(tunnelChoose.returnTunnelInfo().TunnelID); } //巷道实体赋值,用于下次巷道选择 tunnelEntity = tunnelChoose.returnTunnelInfo(); } }
/// <summary> /// 根据传入的左邦点数组和右邦点数组生成巷道 /// </summary> /// <param name="tunnel"></param> /// <param name="pts"></param> /// <param name="editlayer"></param> public void DrawHuDong(TunnelEntity tunnel, WirePointInfoEntity[] pts, IFeatureLayer editlayer) { IPoint point = new PointClass(); IPointCollection4 pointCollection = new PolygonClass(); TunnelPointsCalculation TPC = new TunnelPointsCalculation(); Vector3_DW[] lstLeftBtmVertices = null; Vector3_DW[] lstRightBtmVertices = null; TPC.CalcLeftAndRightVertics(pts, ref lstLeftBtmVertices,ref lstRightBtmVertices); for (int intI = 0; intI < lstLeftBtmVertices.Length; intI++) { point.X = lstLeftBtmVertices[intI].X; point.Y = lstLeftBtmVertices[intI].Y; point.Z = lstLeftBtmVertices[intI].Z; pointCollection.AddPoint(point); } for (int intI = lstRightBtmVertices.Length; intI >=0; intI--) { point.X = lstRightBtmVertices[intI].X; point.Y = lstRightBtmVertices[intI].Y; point.Z = lstRightBtmVertices[intI].Z; pointCollection.AddPoint(point); } IFeature f; IGeometryCollection polygon; //定义一个地物类,把要编辑的图层转化为定义的地物类 IFeatureClass fc = editlayer.FeatureClass; //先定义一个编辑的工作空间,然后把转化为数据集,最后转化为编辑工作空间, IWorkspaceEdit w = (fc as IDataset).Workspace as IWorkspaceEdit; //开始事务操作 w.StartEditing(false); //开始编辑 w.StartEditOperation(); //创建一个地物 //绘制巷道 polygon = new PolygonClass(); IGeometryCollection pGeoColl = pointCollection as IGeometryCollection; ISegmentCollection pRing = new RingClass(); pRing.AddSegmentCollection(pGeoColl as ISegmentCollection); polygon.AddGeometry(pRing as IGeometry); IPolygon polyGonGeo = polygon as IPolygon; polyGonGeo.SimplifyPreserveFromTo(); f = fc.CreateFeature(); //polygon.PutCoords(Convert.ToDouble(ge.CoordinateX), Convert.ToDouble(ge.CoordinateY)); //确定图形类型 f.Shape = (IGeometry)polyGonGeo; //给巷道赋属性值 int num3; //num3 = editlayer.FeatureClass.Fields.FindField("OBJECTID"); //f.set_Value(num3, tunnel.TunnelID); num3 = editlayer.FeatureClass.Fields.FindField("MINE_NAME"); f.set_Value(num3, tunnel.MineName); num3 = editlayer.FeatureClass.Fields.FindField("HORIZONTAL"); f.set_Value(num3, tunnel.HorizontalName); num3 = editlayer.FeatureClass.Fields.FindField("MINING_AREA"); f.set_Value(num3, tunnel.MiningAreaName); num3 = editlayer.FeatureClass.Fields.FindField("WORKING_FACE"); f.set_Value(num3, tunnel.WorkingFaceName); num3 = editlayer.FeatureClass.Fields.FindField("TUNNEL_NAME"); f.set_Value(num3, tunnel.TunnelName); num3 = editlayer.FeatureClass.Fields.FindField("SUPPORT_PATTERN"); f.set_Value(num3, tunnel.TunnelSupportPattern); num3 = editlayer.FeatureClass.Fields.FindField("LITHOLOGY_ID"); f.set_Value(num3, tunnel.TunnelLithologyID); num3 = editlayer.FeatureClass.Fields.FindField("FAULTAGETYPE"); f.set_Value(num3, tunnel.TunnelSectionType); num3 = editlayer.FeatureClass.Fields.FindField("PARAM"); f.set_Value(num3, tunnel.TunnelParam); num3 = editlayer.FeatureClass.Fields.FindField("DESIGNLENGTH"); f.set_Value(num3, tunnel.TunnelDesignLength); //num3 = editlayer.FeatureClass.Fields.FindField("RULE_CODE"); //f.set_Value(num3, tunnel.r); //保存地物 f.Store(); //渲染巷道样式 ISimpleFillSymbol pFillSymbol; pFillSymbol = new SimpleFillSymbolClass(); pFillSymbol.Color = getRGB(60, 100, 50); pFillSymbol.Outline.Color = getRGB(60, 100, 50); pFillSymbol.Outline.Width = 1; pFillSymbol.Style = esriSimpleFillStyle.esriSFSSolid; RenderfeatureLayer(editlayer, pFillSymbol as ISymbol); //结束编辑 w.StopEditOperation(); //结束事务操作 w.StopEditing(true); }