示例#1
0
        public GMLayRenamerForm(string filename)
        {
            InitializeComponent();

            this.filename = filename;
            FileStream   fs = new FileStream(filename, FileMode.Open, FileAccess.Read);
            StreamReader sr = new StreamReader(fs, System.Text.Encoding.UTF8);

            this.xml = sr.ReadToEnd();
            sr.Close();
            fs.Close();

            this.xml = KMFile.RemoveXMLNamespaces(this.xml);
            this.xd  = new XmlDocument();
            this.xd.LoadXml(xml);

            int no = 0;

            foreach (XmlNode xn in xd.SelectNodes("GPI/Group/CategoryList/Category"))
            {
                string id           = xn.SelectSingleNode("ID").ChildNodes[0].Value;
                string CustomSymbol = xn.SelectSingleNode("CustomSymbol").ChildNodes[0].Value;
                string Name         = xn.SelectSingleNode("Name/LString[@lang='RU']").ChildNodes[0].Value;
                categories.Add(new Category(id, CustomSymbol, Name));
                layers.Items.Add(String.Format("{0}: {1}", no++, Name), CustomSymbol);
            }
            ;

            string path = System.IO.Path.GetDirectoryName(filename) + @"\";

            foreach (XmlNode xn in xd.SelectNodes("GPI/Group/SymbolList/Symbol"))
            {
                string id   = xn.SelectSingleNode("ID").ChildNodes[0].Value;
                string file = path + xn.SelectSingleNode("File").ChildNodes[0].Value;
                symbols.Add(new Symbol(id, file));
                Image im = Image.FromFile(file);
                images.Images.Add(id, (Image)(new Bitmap(im)));
                im.Dispose();
            }
            ;
        }
示例#2
0
        public Selection_Filter(KMZRebuilederForm parent, KMFile km, KMLayer kl)
        {
            this.parent = parent;

            InitializeComponent();
            marksFilter.SelectedIndex = 0;

            kfile = km;
            if (kfile != null)
            {
                this.Text += " to `" + kfile.kmldocName + "`";
            }
            klayer = kl;
            if (klayer != null)
            {
                this.Text += " to `" + klayer.name + "`";
            }

            List();

            Reset();
        }