Beispiel #1
0
        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;
            }
        }
Beispiel #2
0
        private void RefreshData()
        {
            var gasContent = GasContent.FindAll();

            gcGasContent.DataSource = gasContent;
        }
Beispiel #3
0
 private void RefreshData()
 {
     gcGasContent.DataSource = GasContent.FindAll();
 }