/// <summary> /// 20140801SDE中添加瓦斯压力点 /// </summary> private void DrawGasGushQuantityPt(GasPressure gasGushQuantityEntity) { var dCoordinateX = Convert.ToDouble(txtCoordinateX.Text); var dCoordinateY = Convert.ToDouble(txtCoordinateY.Text); var dCoordinateZ = Convert.ToDouble(txtCoordinateZ.Text); IPoint pt = new PointClass(); pt.X = dCoordinateX; pt.Y = dCoordinateY; pt.Z = dCoordinateZ; var pLayer = DataEditCommon.GetLayerByName(DataEditCommon.g_pMap, LayerNames.LAYER_ALIAS_MR_WSYLD); if (pLayer == null) { MessageBox.Show(@"未找到瓦斯压力点图层,无法绘制瓦斯压力点图元。"); return; } var pFeatureLayer = (IFeatureLayer)pLayer; IGeometry geometry = pt; var list = new List <ziduan> { new ziduan("bid", gasGushQuantityEntity.BindingId), new ziduan("mc", gasGushQuantityEntity.CoalSeams.ToString()), new ziduan("addtime", DateTime.Now.ToString(CultureInfo.InvariantCulture)) }; var wsyl = gasGushQuantityEntity.GasPressureValue.ToString(CultureInfo.InvariantCulture); var cdbg = gasGushQuantityEntity.CoordinateZ.ToString(CultureInfo.InvariantCulture); var ms = gasGushQuantityEntity.Depth.ToString(CultureInfo.InvariantCulture); if (DataEditCommon.strLen(cdbg) < DataEditCommon.strLen(ms)) { var count = DataEditCommon.strLen(ms) - DataEditCommon.strLen(cdbg); for (var i = 0; i < count; i++) { cdbg = " " + cdbg; // // 测点标高 } } else if (DataEditCommon.strLen(cdbg) > DataEditCommon.strLen(ms)) { var count = DataEditCommon.strLen(cdbg) - DataEditCommon.strLen(ms); for (var i = 0; i < count; i++) { ms += " "; } } list.Add(new ziduan("wsyl", wsyl)); list.Add(new ziduan("cdbg", cdbg)); list.Add(new ziduan("ms", ms)); var pfeature = DataEditCommon.CreateNewFeature(pFeatureLayer, geometry, list); if (pfeature != null) { MyMapHelp.Jump(pt); DataEditCommon.g_pMyMapCtrl.ActiveView.PartialRefresh( (esriViewDrawPhase)34, null, null); } }
/// <summary> /// 提 交 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSubmit_Click(object sender, EventArgs e) { // 验证 if (!Check()) { DialogResult = DialogResult.None; return; } DialogResult = DialogResult.OK; // 创建一个瓦斯含量点实体 if (GasPressure == null) { var gasPressure = new GasPressure { CoordinateX = Convert.ToDouble(txtCoordinateX.Text), CoordinateY = Convert.ToDouble(txtCoordinateY.Text), CoordinateZ = Convert.ToDouble(txtCoordinateZ.Text), Depth = Convert.ToDouble(txtDepth.Text), GasPressureValue = Convert.ToDouble(txtGasPressureValue.Text), MeasureDateTime = dtpMeasureDateTime.Value, Tunnel = selectTunnelSimple1.SelectedTunnel, CoalSeams = (CoalSeams)cboCoalSeams.SelectedItem, BindingId = IDGenerator.NewBindingID() }; // 坐标X gasPressure.Save(); DrawGasGushQuantityPt(gasPressure); } else { GasPressure.CoordinateX = Convert.ToDouble(txtCoordinateX.Text); GasPressure.CoordinateY = Convert.ToDouble(txtCoordinateY.Text); GasPressure.CoordinateZ = Convert.ToDouble(txtCoordinateZ.Text); GasPressure.Depth = Convert.ToDouble(txtDepth.Text); GasPressure.GasPressureValue = Convert.ToDouble(txtGasPressureValue.Text); GasPressure.MeasureDateTime = dtpMeasureDateTime.Value; GasPressure.Tunnel = selectTunnelSimple1.SelectedTunnel; GasPressure.CoalSeams = (CoalSeams)cboCoalSeams.SelectedValue; GasPressure.Save(); DelGasGushQuantityPt(GasPressure.BindingId, GasPressure.CoalSeams.CoalSeamsName); DrawGasGushQuantityPt(GasPressure); } }
/// <summary> /// 提 交 /// </summary> /// <params name="sender"></params> /// <params name="e"></params> private void btnSubmit_Click(object sender, EventArgs e) { DialogResult = DialogResult.OK; // 创建一个瓦斯含量点实体 if (GasPressure == null) { var gasPressure = new GasPressure { coordinate_x = Convert.ToDouble(txtCoordinateX.Text), coordinate_y = Convert.ToDouble(txtCoordinateY.Text), coordinate_z = Convert.ToDouble(txtCoordinateZ.Text), depth = Convert.ToDouble(txtDepth.Text), gas_pressure_value = Convert.ToDouble(txtGasPressureValue.Text), measure_date_time = dtpMeasureDateTime.Value, tunnel = selectTunnelSimple1.selected_tunnel, bid = IdGenerator.NewBindingId() }; // 坐标X gasPressure.Save(); DrawGasGushQuantityPt(gasPressure); } else { GasPressure.coordinate_x = Convert.ToDouble(txtCoordinateX.Text); GasPressure.coordinate_y = Convert.ToDouble(txtCoordinateY.Text); GasPressure.coordinate_z = Convert.ToDouble(txtCoordinateZ.Text); GasPressure.depth = Convert.ToDouble(txtDepth.Text); GasPressure.gas_pressure_value = Convert.ToDouble(txtGasPressureValue.Text); GasPressure.measure_date_time = dtpMeasureDateTime.Value; GasPressure.tunnel = selectTunnelSimple1.selected_tunnel; GasPressure.Save(); DelGasGushQuantityPt(GasPressure.bid, GasPressure.coal_seam); DrawGasGushQuantityPt(GasPressure); } }
/// <summary> /// 带参数的构造方法 /// </summary> public GasPressureInfoEntering(GasPressure gasPressure) { GasPressure = gasPressure; InitializeComponent(); }
/// <summary> /// 20140801SDE中添加瓦斯压力点 /// </summary> private void DrawGasGushQuantityPt(GasPressure gasGushQuantityEntity) { var dCoordinateX = Convert.ToDouble(txtCoordinateX.Text); var dCoordinateY = Convert.ToDouble(txtCoordinateY.Text); var dCoordinateZ = Convert.ToDouble(txtCoordinateZ.Text); IPoint pt = new PointClass(); pt.X = dCoordinateX; pt.Y = dCoordinateY; pt.Z = dCoordinateZ; var pLayer = DataEditCommon.GetLayerByName(DataEditCommon.g_pMap, LayerNames.LAYER_ALIAS_MR_WSYLD); if (pLayer == null) { MessageBox.Show(@"未找到瓦斯压力点图层,无法绘制瓦斯压力点图元。"); return; } var pFeatureLayer = (IFeatureLayer)pLayer; IGeometry geometry = pt; var list = new List<ziduan> { new ziduan("bid", gasGushQuantityEntity.bid), new ziduan("mc", gasGushQuantityEntity.coal_seam.ToString()), new ziduan("addtime", DateTime.Now.ToString(CultureInfo.InvariantCulture)) }; var wsyl = gasGushQuantityEntity.gas_pressure_value.ToString(CultureInfo.InvariantCulture); var cdbg = gasGushQuantityEntity.coordinate_z.ToString(CultureInfo.InvariantCulture); var ms = gasGushQuantityEntity.depth.ToString(CultureInfo.InvariantCulture); if (DataEditCommon.strLen(cdbg) < DataEditCommon.strLen(ms)) { var count = DataEditCommon.strLen(ms) - DataEditCommon.strLen(cdbg); for (var i = 0; i < count; i++) { cdbg = " " + cdbg; // // 测点标高 } } else if (DataEditCommon.strLen(cdbg) > DataEditCommon.strLen(ms)) { var count = DataEditCommon.strLen(cdbg) - DataEditCommon.strLen(ms); for (var i = 0; i < count; i++) { ms += " "; } } list.Add(new ziduan("wsyl", wsyl)); list.Add(new ziduan("cdbg", cdbg)); list.Add(new ziduan("ms", ms)); var pfeature = DataEditCommon.CreateNewFeature(pFeatureLayer, geometry, list); if (pfeature != null) { MyMapHelp.Jump(pt); DataEditCommon.g_pMyMapCtrl.ActiveView.PartialRefresh( (esriViewDrawPhase)34, null, null); } }
private void RefreshData() { gcGasPressure.DataSource = GasPressure.FindAll(); }
private void BT_Ok_Click(object sender, EventArgs e) { try { if (!Directory.Exists(m_MakeContoursFolder)) { Directory.CreateDirectory(m_MakeContoursFolder); } panel1.Enabled = false; panel2.Enabled = false; panel4.Enabled = false; lbshengc.Visible = true; Application.DoEvents(); ArrayList TheValueList = new ArrayList(); if (radioBtndata.Checked) { if (m_layerAliasName.Equals("瓦斯压力等值线")) { var gasPressures = GasPressure.FindAll(); foreach (var i in gasPressures) { XYValueStruct temp; temp.X = i.coordinate_x; temp.Y = i.coordinate_y; temp.TheValue = i.gas_pressure_value; TheValueList.Add(temp); } } if (m_layerAliasName.Equals("瓦斯含量等值线")) { var gasContent = GasContent.FindAll(); foreach (var i in gasContent) { XYValueStruct temp; temp.X = i.coordinate_x; temp.Y = i.coordinate_y; temp.TheValue = i.gas_content_value; TheValueList.Add(temp); } } if (m_layerAliasName.Equals("瓦斯涌出量等值线")) { var gasGushQuantity = GasGushQuantity.FindAll(); foreach (var i in gasGushQuantity) { XYValueStruct temp; temp.X = i.coordinate_x; temp.Y = i.coordinate_y; temp.TheValue = i.absolute_gas_gush_quantity; TheValueList.Add(temp); } } if (TheValueList.Count < 3) { MessageBox.Show("离散点数据为空或小于三个,无法生成等值线!"); return; } string[] strlsd = new string[TheValueList.Count]; for (int i = 0; i < TheValueList.Count; i++) { XYValueStruct tempxy = (XYValueStruct)TheValueList[i]; string temstr = tempxy.X + "," + tempxy.Y + "," + tempxy.TheValue; strlsd[i] = temstr; } m_strDataFilePath = Application.StartupPath + "\\tempdata.txt"; File.WriteAllLines(m_strDataFilePath, strlsd); } else { m_strDataFilePath = TB_DocumentPath.Text.Trim(); if (m_strDataFilePath.Equals("")) { MessageBox.Show("请选择一个离散点文件!"); return; } } bool bIsSuccess = false; string failInfo = ""; DrawSpecialCommon drawspecial = new DrawSpecialCommon(); string sLayerAliasName = m_layerAliasName; //MapControl中图层名称 string nameOftargetFeatureClass = SDELayerName; //m_layerName + "_NO" + sCoalseamNO;//数据库中图层名称 string extent = ""; if (radioBtnKJ.Checked) { ILayer pLayer = DataEditCommon.GetLayerByName(DataEditCommon.g_pMap, LayerNames.LAYER_ALIAS_MINE_BOUNDARY); IFeatureLayer pFeatureLayer = (IFeatureLayer)pLayer; IEnvelope pEnvelope = pFeatureLayer.AreaOfInterest; //右上左下 xmax ymax xmin ymin extent = pEnvelope.XMax.ToString() + " " + pEnvelope.YMax.ToString() + " " + pEnvelope.XMin.ToString() + " " + pEnvelope.YMin.ToString(); } IWorkspace targetworkspace = DataEditCommon.g_pCurrentWorkSpace; //最后重新生成图层并添加到数据库及MapControl中 bIsSuccess = CreateContours(targetworkspace, nameOftargetFeatureClass, sLayerAliasName, extent, ref failInfo); if (bIsSuccess) { string layername = ""; if (m_layerAliasName.Equals("瓦斯压力等值线")) { layername = LayerNames.LAYER_ALIAS_MR_YLDZX; } if (m_layerAliasName.Equals("瓦斯含量等值线")) { layername = LayerNames.LAYER_ALIAS_MR_HLDZX; } if (m_layerAliasName.Equals("瓦斯涌出量等值线")) { layername = LayerNames.LAYER_ALIAS_MR_YCLDZX; } if (m_layerAliasName.Equals("地面标高等值线")) { layername = LayerNames.GROUND_LEVLE_CONTOUR; } if (m_layerAliasName.Equals("煤层底板等值线")) { layername = LayerNames.FLOOR_ELEVATION_CONTOUR; } if (m_layerAliasName.Equals("埋深等值线")) { layername = LayerNames.EMBEDDED_DEPTH_CONTOUR; } DataEditCommon.SetLayerVisibleByName(DataEditCommon.g_pMap, layername, true); MessageBox.Show("等值线和渲染图生成完成。"); this.Close(); } else { MessageBox.Show(failInfo + "生成过程有误,请检查。"); } //this.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { panel1.Enabled = true; panel2.Enabled = true; panel4.Enabled = true; lbshengc.Visible = false; Application.DoEvents(); progressBarControl1.Position = 0; } }