示例#1
0
        private void btnTestLoadAndSave_Click(object sender, EventArgs e)
        {
            LoadSave ls = new LoadSave("kml");
            string fpath = ls.GetLoadPath();
            if (fpath != null)
            {
                KMLRoot kml = KMLRoot.Load(fpath);
                //MessageBox.Show("Loaded kml: " + fpath);
                Style s = new Style();
                s.Id = "#style1";
                LineStyle lineStyle = new LineStyle();
                lineStyle.Color = Color.White;
                PolyStyle polyStyle = new PolyStyle();
                polyStyle.Color = Color.FromArgb(1, 255, 0, 0);
                s.Add(lineStyle);
                s.Add(polyStyle);

                StyleMap smap = new StyleMap();
                smap.Id = "#sm1";
                smap.AddPairs(new Pair("normal", "#style1"), new Pair("highlight", "#style1"));

                kml.Document.Styles.Add(s);
                kml.Document.Styles.Add(smap);

                fpath = ls.GetSavePath();
                if (fpath != null)
                {
                    kml.Save(fpath);
                }
            }
        }
示例#2
0
 private void button3_Click(object sender, EventArgs e) {
     KMLRoot kml = CreateKmlFeat();
     LoadSave ls = new LoadSave("kml");
     string fpath = ls.GetSavePath();
     if (fpath != null) {
         kml.Save(fpath);
     }
 }
示例#3
0
 private void button3_Click(object sender, EventArgs e)
 {
     var kml = CreateKmlFeat();
     var ls = new LoadSave("kml");
     var fpath = ls.GetSavePath();
     if (fpath != null)
     {
         kml.Save(fpath);
     }
 }
示例#4
0
 private void button2_Click(object sender, EventArgs e)
 {
     LoadSave ls = new LoadSave("kml");
     string fpath = ls.GetLoadPath();
     if (fpath != null) {
         KMLRoot kml = KMLRoot.Load(fpath);
         if (kml.UsesDocument) {
             MessageBox.Show("Loaded kml (doc): " + kml.Document.List.Count);
         } else {
             MessageBox.Show("Loaded kml (feature): " + kml.Feature.name);
         }
     }
 }
示例#5
0
        public static bool BrowseLoadForTextBox(TextBox txtBox, string ext)
        {
            var ls = new LoadSave(ext);
            if (String.IsNullOrEmpty(txtBox.Text))
            {
                ls.InitialDirectory = txtBox.Text;
            }

            var path = ls.GetLoadPath();
            if (path != null)
            {
                txtBox.Text = path;
                return true;
            }

            return false;
        }
示例#6
0
        public static bool BrowseSaveForTextBox(TextBox txtBox, string ext)
        {
            LoadSave ls = new LoadSave(ext);

            if (String.IsNullOrEmpty(txtBox.Text))
            {
                ls.InitialDirectory = txtBox.Text;
            }
            string path = ls.GetSavePath();

            if (path != null)
            {
                txtBox.Text = path;
                return(true);
            }
            return(false);
        }