Beispiel #1
0
        public bool Initialize()
        {
            Clear();

            foreach (string shpFile in Properties.Settings.Default.ShapeFiles)
            {
                //enabled
                //file name
                //table name for name of area
                //Coord type
                //Area type
                //name prefix
                string[] parts = shpFile.Split(new char[] { '|' }, 6);
                if (parts.Length == 6)
                {
                    try
                    {
                        if (bool.Parse(parts[0]))
                        {
                            ShapeFile sf = new ShapeFile(parts[1]);
                            if (sf.Initialize(parts[2], (ShapeFile.CoordType)Enum.Parse(typeof(ShapeFile.CoordType), parts[3]), (Framework.Data.AreaType)Enum.Parse(typeof(Framework.Data.AreaType), parts[4]), parts[5]))
                            {
                                _shapeFiles.Add(sf);
                            }
                        }
                    }
                    catch
                    {
                    }
                }
            }
            return true;
        }
Beispiel #2
0
        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            comboBox1.Items.Clear();
            comboBox2.SelectedIndex = -1;
            comboBox3.SelectedIndex = -1;
            comboBox2.Enabled       = false;
            comboBox3.Enabled       = false;
            bool error = false;

            if (textBox1.Text.Length > 0)
            {
                try
                {
                    using (ShapeFile sf = new ShapeFile(textBox1.Text))
                    {
                        comboBox1.Items.AddRange(sf.GetFields());
                    }
                }
                catch
                {
                    error = true;
                }
            }
            if (error)
            {
                MessageBox.Show(Utils.LanguageSupport.Instance.GetTranslation(STR_PARSEERROR), Utils.LanguageSupport.Instance.GetTranslation(STR_ERROR));
            }
            else if (comboBox1.Items.Count > 0)
            {
                comboBox2.Enabled = true;
                comboBox3.Enabled = true;
            }
        }
Beispiel #3
0
        public bool Initialize()
        {
            Clear();

            foreach (string shpFile in PluginSettings.Instance.ShapeFiles)
            {
                //enabled
                //file name
                //table name for name of area
                //Coord type
                //Area type
                //name prefix
                //dbfEncoding
                string[] parts = shpFile.Split(new char[] { '|' }, 7);
                if (parts.Length >= 6)
                {
                    try
                    {
                        if (bool.Parse(parts[0]))
                        {
                            string dbfEncoding = "";
                            if (parts.Length==7)
                            {
                                dbfEncoding = parts[6];
                            }
                            ShapeFile sf = new ShapeFile(parts[1]);
                            if (sf.Initialize(parts[2], (ShapeFile.CoordType)Enum.Parse(typeof(ShapeFile.CoordType), parts[3]), (Framework.Data.AreaType)Enum.Parse(typeof(Framework.Data.AreaType), parts[4]), parts[5], dbfEncoding))
                            {
                                _shapeFiles.Add(sf);
                            }
                        }
                    }
                    catch
                    {
                    }
                }
            }
            return true;
        }
Beispiel #4
0
        public bool Initialize()
        {
            Clear();

            foreach (string shpFile in PluginSettings.Instance.ShapeFiles)
            {
                //enabled
                //file name
                //table name for name of area
                //Coord type
                //Area type
                //name prefix
                //dbfEncoding
                string[] parts = shpFile.Split(new char[] { '|' }, 7);
                if (parts.Length >= 6)
                {
                    try
                    {
                        if (bool.Parse(parts[0]))
                        {
                            string dbfEncoding = "";
                            if (parts.Length == 7)
                            {
                                dbfEncoding = parts[6];
                            }
                            ShapeFile sf = new ShapeFile(parts[1]);
                            if (sf.Initialize(parts[2], (ShapeFile.CoordType)Enum.Parse(typeof(ShapeFile.CoordType), parts[3]), (Framework.Data.AreaType)Enum.Parse(typeof(Framework.Data.AreaType), parts[4]), parts[5], dbfEncoding))
                            {
                                _shapeFiles.Add(sf);
                            }
                        }
                    }
                    catch
                    {
                    }
                }
            }
            return(true);
        }
Beispiel #5
0
 private void textBox1_TextChanged(object sender, EventArgs e)
 {
     comboBox1.Items.Clear();
     comboBox2.SelectedIndex = -1;
     comboBox3.SelectedIndex = -1;
     comboBox2.Enabled = false;
     comboBox3.Enabled = false;
     bool error = false;
     if (textBox1.Text.Length > 0)
     {
         try
         {
             using (ShapeFile sf = new ShapeFile(textBox1.Text))
             {
                 comboBox1.Items.AddRange(sf.GetFields());
             }
         }
         catch
         {
             error = true;
         }
     }
     if (error)
     {
         MessageBox.Show(Utils.LanguageSupport.Instance.GetTranslation(STR_PARSEERROR), Utils.LanguageSupport.Instance.GetTranslation(STR_ERROR));
     }
     else if (comboBox1.Items.Count>0)
     {
         comboBox2.Enabled = true;
         comboBox3.Enabled = true;
     }
 }