コード例 #1
0
        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("成功执行");
            }
        }
コード例 #2
0
        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;
        }
コード例 #3
0
        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;
        }