Example #1
0
        private void ExtractButton_Click(object sender, EventArgs e)
        {
            if (_featureClass == null)
            {
                MessageBox.Show("未获取CAD文件相关信息,请重新选择CAD文件");
                return;
            }
            if (string.IsNullOrEmpty(this.SaveFiletextBox.Text))
            {
                MessageBox.Show("请选择输出文件路径!");
                return;
            }

            this.ExtractButton.Text    = "正在提取";
            this.ExtractButton.Enabled = false;
            var layerswhereClause = CheckedListBoxManager.GetWhereClause(LayerscheckedListBox, LayerName, true);
            var colorswhereClause = CheckedListBoxManager.GetWhereClause(ColorscheckedListBox, ColorName, false);
            var whereClause       = string.Format("({0}) AND ({1})", layerswhereClause, colorswhereClause);

            var tool = new FeatureClassExtractTool {
                FeatureClass = _featureClass, WhereClause = whereClause, SaveFilePath = this.SaveFiletextBox.Text
            };

            if (tool.Analyze())
            {
                MessageBox.Show("完成提取");
            }
            else
            {
                MessageBox.Show(string.Format("提取错误:{0}", tool.Error));
            }
            this.ExtractButton.Text    = "提取";
            this.ExtractButton.Enabled = true;
        }
        private void button1_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(this.SaveFoldertextBox.Text))
            {
                MessageBox.Show("请选择输出目录");
                return;
            }
            if (_list == null)
            {
                AnalyzeLayer(this.AccesstextBox.Text);
            }

            _tool = new MutipleClipTool
            {
                DataBasePath     = this.AccesstextBox.Text,
                Layers           = CheckedListBoxManager.GetChecked(this.LayerscheckedListBox),
                ClipLayers       = CheckedListBoxManager.GetChecked(this.ClipcheckedListBox),
                ClipDataBasePath = this.ClipDatabasetextBox.Text,
                SaveFolder       = this.SaveFoldertextBox.Text
            };
            if (!_tool.Init())
            {
                MessageBox.Show("执行失败");
            }
            else
            {
                MessageBox.Show("成功执行");
            }
        }
Example #3
0
        private void ExtractTYbutton_Click(object sender, EventArgs e)
        {
            if (_featureClass == null)
            {
                MessageBox.Show("未获取CAD文件相关信息,请重新选择CAD文件");
                return;
            }
            if (string.IsNullOrEmpty(this.SaveFiletextBox.Text))
            {
                MessageBox.Show("请选择输出文件路径!");
                return;
            }
            var colorswhereClause = CheckedListBoxManager.GetWhereClause(ColorscheckedListBox, ColorName, false);
            var layersWhereClause = CheckedListBoxManager.GetWhereClause(LayerscheckedListBox, LayerName, true);

            this.ExtractTYbutton.Text    = "正在提取...";
            this.ExtractTYbutton.Enabled = false;
            var whereClause = string.Format("({0}) AND ({1})", layersWhereClause, colorswhereClause);

            var savefile     = this.SaveFiletextBox.Text;
            var polylinefile = string.Format("{0}\\{1}_polyline.shp", System.IO.Path.GetDirectoryName(savefile), System.IO.Path.GetFileNameWithoutExtension(savefile));
            var tool         = new FeatureClassExtractTool {
                FeatureClass = _featureClass, WhereClause = whereClause, SaveFilePath = polylinefile
            };

            if (tool.Analyze())
            {
                var tool2 = new PolylineToPolygonTool {
                    PolylineFile = polylinefile, PolygonFile = savefile
                };
                if (tool2.Work())
                {
                    MessageBox.Show("完成");
                }
                else
                {
                    MessageBox.Show("线转面初始化失败!");
                }
            }
            else
            {
                MessageBox.Show(string.Format("提取Polyline错误:{0}", tool.Error));
            }


            this.ExtractTYbutton.Enabled = true;
            this.ExtractTYbutton.Text    = "提取(唐尧)";
        }
        private void AnalyzeColorbutton_Click(object sender, EventArgs e)
        {
            this.AnalyzeColorbutton.Text    = "正在分析...";
            this.AnalyzeColorbutton.Enabled = false;
            this.ColorscheckedListBox.Items.Clear();
            var files = CheckedListBoxManager.GetChecked(this.FilescheckedListBox);

            if (files.Count == 0)
            {
                MessageBox.Show("当前未选择文件");
                this.AnalyzeColorbutton.Text    = "分析颜色";
                this.AnalyzeColorbutton.Enabled = true;
                return;
            }
            var allColors = new List <string>();

            foreach (var fileName in files)
            {
                var fullName = System.IO.Path.Combine(this.FlodertextBox.Text, fileName);
                if (System.IO.File.Exists(fullName))
                {
                    var featureClass = CADManager.GetFeatureClass(fullName);
                    if (featureClass != null)
                    {
                        var colors = featureClass.GetUniqueValue(ColorName);
                        foreach (var item in colors)
                        {
                            if (!allColors.Contains(item))
                            {
                                allColors.Add(item);
                            }
                        }
                    }
                }
            }
            foreach (var item in allColors)
            {
                this.ColorscheckedListBox.Items.Add(item, true);
            }
            this.AnalyzeColorbutton.Text    = "分析颜色";
            this.AnalyzeColorbutton.Enabled = true;
        }
        private void button3_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(this.SavetextBox.Text))
            {
                MessageBox.Show("请选择输出文件路径");
                return;
            }
            var files = CheckedListBoxManager.GetChecked(this.FilescheckedListBox);

            if (files.Count == 0)
            {
                MessageBox.Show("请选择需要转换的CAD文件");
                return;
            }
            var fullFileNames = files.Select(k => System.IO.Path.Combine(this.FlodertextBox.Text, k)).ToList();
            var whereClause   = CheckedListBoxManager.GetWhereClause(this.ColorscheckedListBox, ColorName, false);

            this.button3.Text    = "正在提取...";
            this.button3.Enabled = false;
            var tool = new ExtractCADsToOnePolylineTool
            {
                CADFiles     = fullFileNames,
                PolylineFile = this.SavetextBox.Text,
                WhereClause  = whereClause
            };

            if (tool.Work())
            {
                MessageBox.Show("完成");
            }
            else
            {
                MessageBox.Show(string.Format("发生错误:{0}", tool.Error));
            }

            this.button3.Text    = "批量提取Polyline";
            this.button3.Enabled = true;
        }
 private void AntonymClipbutton_Click(object sender, EventArgs e)
 {
     CheckedListBoxManager.AntonymChecked(this.ClipcheckedListBox);
 }
 private void NotClipbutton_Click(object sender, EventArgs e)
 {
     CheckedListBoxManager.Checked(this.ClipcheckedListBox, false);
 }
 private void AntonymLayerButton_Click(object sender, EventArgs e)
 {
     CheckedListBoxManager.AntonymChecked(this.LayerscheckedListBox);
 }
 private void AllLayerbutton_Click(object sender, EventArgs e)
 {
     CheckedListBoxManager.Checked(this.LayerscheckedListBox, true);
 }