Пример #1
0
        private void newSHPFile(object sender, EventArgs e)
        {
            SaveFileDialog save = new SaveFileDialog();

            save.Filter = "GIS ShapeFile (*.SHP)|*.shp";
            if (save.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            string filename = save.FileName;

            if (createSHPFile(filename))
            {
                openFile(filename, "point");
                ProjectSetting shpSetting  = new ProjectSetting(name: ModuleName + "_file", value: Filepath, module: ModuleName);
                ProjectSetting shpRelative = new ProjectSetting(name: ModuleName + "_relative", value: Util.MakeRelativePath(Properties.Settings.Default.lastProject, Filepath), module: ModuleName);
                Project.settings.SetSetting(shpSetting);
                Project.settings.SetSetting(shpRelative);
            }
        }
Пример #2
0
        public void saveHandler(object sender, EventArgs e)
        {
            Panel_Other controls = getOtherControls();

            if (!controls.toolStripButtonSave.Enabled)
            {
                return;
            }
            FeatureLayer selectionLayer = (FeatureLayer)Layer;
            ISelection   shpSelection   = selectionLayer.Selection;
            string       tamsidcolumn   = Project.settings.GetValue(ModuleName + "_f_TAMSID");

            Dictionary <string, string> values = new Dictionary <string, string>();

            values["type"]        = controls.comboBoxObject.Text;
            values["icon"]        = Util.DictionaryItemString(icons, controls.comboBoxObject.Text);
            values["address"]     = controls.textBoxAddress.Text;
            values["description"] = controls.textBoxDescription.Text;
            values["photo"]       = controls.textBoxPhotoFile.Text;
            values["property1"]   = controls.getProperty(values["type"], 0);
            values["property2"]   = controls.getProperty(values["type"], 1);
            values["property3"]   = controls.getProperty(values["type"], 2);
            values["property4"]   = controls.getProperty(values["type"], 3);
            values["notes"]       = controls.getProperty(values["type"], 4);

            if (!string.IsNullOrWhiteSpace(controls.textBoxPhotoFile.Text))
            {
                Properties.Settings.Default.lastPhoto = controls.textBoxPhotoFile.Text;
            }

            for (int i = 0; i < tamsids.Count; i++)
            {
                values["TAMSID"] = tamsids[i];
                Dictionary <string, string> v = new Dictionary <string, string>();

                foreach (string key in values.Keys)
                {
                    v[key] = values[key];
                    if ((string.IsNullOrWhiteSpace(values[key]) || values[key].Equals("multi") || values[key].Equals("-1") || key.Equals("category")) && selectionValues.Count > 1)
                    {
                        if (i < selectionValues.Count && selectionValues[i].ContainsKey(key))
                        {
                            v[key] = selectionValues[i][key];
                        }
                    }
                }

                if (!Database.ReplaceRow(Project.conn, v, ModuleName))
                {
                    MessageBox.Show("Could not save data!");
                }
            }

            string tamsidsCSV = string.Join(",", tamsids.ToArray());

            foreach (DataRow row in selectionLayer.DataSet.DataTable.Select(tamsidcolumn + " IN (" + tamsidsCSV + ")"))
            {
                row["TAMSICON"] = values["icon"];
            }

            resetDisplay();
            disableDisplay();
            Properties.Settings.Default.Save();
            selectionLayer.ClearSelection();
            selectionLayer.DataSet.Save();
            setSymbolizer();
            Project.map.Invalidate();
            Project.map.Refresh();
            Project.map.ResetBuffer();
            Project.map.Update();
        }
Пример #3
0
        private void enterCoordinates(object sender, EventArgs e)
        {
            FormLatLon dlg = new FormLatLon();

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                double lat, lon;
                if (dlg.tabControlDegree.SelectedTab == dlg.tabPageDecimal)
                {
                    lat = Util.ToDouble(dlg.textBoxLatitude.Text) * (dlg.radioButtonNorth1.Checked ? 1 : -1);
                    lon = Util.ToDouble(dlg.textBoxLongitude.Text) * (dlg.radioButtonEast1.Checked ? 1 : -1);
                }
                else
                {
                    lat = (Util.ToDouble(dlg.textBoxLatDeg.Text) + Util.ToDouble(dlg.textBoxLatMin.Text) / 60 + Util.ToDouble(dlg.textBoxLatSec.Text) / 3600) * (dlg.radioButtonNorth2.Checked ? 1 : -1);
                    lon = (Util.ToDouble(dlg.textBoxLonDeg.Text) + Util.ToDouble(dlg.textBoxLonMin.Text) / 60 + Util.ToDouble(dlg.textBoxLonSec.Text) / 3600) * (dlg.radioButtonEast2.Checked ? 1 : -1);
                }
                addFeature(lat, lon);
            }
            dlg.Close();
        }
Пример #4
0
        private void setMaxID()
        {
            DataTable tmp = Database.GetDataByQuery(Project.conn, "SELECT MAX(TAMSID) FROM miscellaneous");

            maxTAMSID = tmp.Rows.Count > 0 ? Util.ToInt(tmp.Rows[0]["MAX(TAMSID)"].ToString()) : 0;
        }