Пример #1
0
        private void OnCompressClick(object sender, EventArgs e)
        {
            if (this.xmlDocument != null)
            {
                XmlDocument xmlDoc = XmlUtilities.CompressBoundaries(this.xmlDocument);

                this.regions = new RegionSet(xmlDoc);
                this.treeView1.Nodes.Clear();
                this.regions.LoadTreeView(this.treeView1);

                DisplayTextFile(50, this.regions.Names());


                this.xmlDocument = xmlDoc;

                this.mapPanel.Invalidate();
            }
        }
Пример #2
0
        private void OnOpenKmlClick(object sender, EventArgs e)
        {
            var       fileContent = string.Empty;
            var       filePath    = string.Empty;
            var       xmlDoc      = new XmlDocument();
            RegionSet regions;

            using (OpenFileDialog openFileDialog = new OpenFileDialog()) {
                openFileDialog.Filter           = "txt files (*.txt)|*.txt|All files (*.*)|*.*";
                openFileDialog.FilterIndex      = 2;
                openFileDialog.RestoreDirectory = true;

                if (openFileDialog.ShowDialog() == DialogResult.OK)
                {
                    filePath = openFileDialog.FileName;

                    var fileStream = openFileDialog.OpenFile();
                    try {
                        xmlDoc.Load(fileStream);
                    }
                    catch (Exception exception) {
                        MessageBox.Show(exception.Message);
                    };


                    regions = new RegionSet(xmlDoc);
                    this.treeView1.Nodes.Clear();
                    regions.LoadTreeView(this.treeView1);

                    DisplayTextFile(50, regions.Names());

                    this.toolStripFileLabel.Text = "KML File: " + Utilities.TruncateString(filePath, 80);
                    this.xmlDocument             = xmlDoc;
                    this.regions = regions;
                    this.mapPanel.Invalidate();
                }
            }
        }