Exemple #1
0
 private void OKBtn_Click(object sender, EventArgs e)
 {
     if (SelectByList.Checked)
     {
         m_selectedCoordsys = CoordinateSystem.SelectedItem as CoordinateSystemDefinitionBase;
     }
     else if (SelectByCoordSysCode.Checked)
     {
         m_selectedCoordsys = m_coordsysCodeCoordSys;
     }
     else if (SelectByWKT.Checked && _cat == null)
     {
         m_selectedCoordsys             = _cat.CreateEmptyCoordinateSystem();
         m_selectedCoordsys.Code        = null;
         m_selectedCoordsys.Description = null;
         m_selectedCoordsys.WKT         = WKTText.Text;
     }
     else if (SelectByWKT.Checked)
     {
         m_selectedCoordsys = m_wktCoordSys;
     }
     else if (SelectByEPSGCode.Checked)
     {
         m_selectedCoordsys = m_epsgCoordSys;
     }
     else
     {
         m_selectedCoordsys = null;
     }
 }
Exemple #2
0
        public override CoordinateSystemDefinitionBase[] EnumerateCoordinateSystems(string category)
        {
            CoordinateSystemCategory cat = null;

            foreach (CoordinateSystemCategory csc in this.Categories)
            {
                if (csc.Name == category)
                {
                    cat = csc;
                    break;
                }
            }

            if (cat == null)
            {
                return(new CoordinateSystemDefinitionBase[0]);
            }

            string      req = this.RequestBuilder.EnumerateCoordinateSystems(category);
            XmlDocument doc = new XmlDocument();

            doc.Load(m_con.OpenRead(req));
            XmlNodeList lst = doc.SelectNodes("BatchPropertyCollection/PropertyCollection");

            CoordinateSystemDefinitionBase[] data = new CoordinateSystemDefinitionBase[lst.Count];
            for (int i = 0; i < lst.Count; i++)
            {
                data[i] = new HttpCoordinateSystemDefinition(cat, lst[i]);
            }

            return(data);
        }
        protected void CreateTestDataStore(IServerConnection conn, string fsId, ref FeatureSchema schema, ref ClassDefinition cls)
        {
            schema = new FeatureSchema("Default", "");
            cls    = new ClassDefinition("Class1", "");

            try
            {
                if (conn.ResourceService.ResourceExists(fsId))
                {
                    conn.ResourceService.DeleteResource(fsId);
                }

                cls.DefaultGeometryPropertyName = "GEOM";
                cls.AddProperty(new DataPropertyDefinition("KEY", "")
                {
                    DataType        = DataPropertyType.Int32,
                    IsAutoGenerated = true,
                    IsReadOnly      = true,
                    IsNullable      = false
                }, true);

                cls.AddProperty(new DataPropertyDefinition("NAME", "")
                {
                    DataType   = DataPropertyType.String,
                    Length     = 255,
                    IsNullable = true,
                    IsReadOnly = false
                });

                cls.AddProperty(new GeometricPropertyDefinition("GEOM", "")
                {
                    GeometricTypes            = FeatureGeometricType.Point,
                    SpatialContextAssociation = "Default"
                });

                schema.AddClass(cls);

                ICreateDataStore create = (ICreateDataStore)conn.CreateCommand((int)CommandType.CreateDataStore);
                CoordinateSystemDefinitionBase coordSys = conn.CoordinateSystemCatalog.FindCoordSys("LL84");
                create.FeatureSourceId     = fsId;
                create.CoordinateSystemWkt = coordSys.WKT;
                create.Name        = "Default";
                create.ExtentType  = OSGeo.MapGuide.ObjectModels.Common.FdoSpatialContextListSpatialContextExtentType.Dynamic;
                create.FileName    = "Test.sdf";
                create.Provider    = "OSGeo.SDF";
                create.Schema      = schema;
                create.XYTolerance = 0.001;
                create.ZTolerance  = 0.001;

                create.Execute();
            }
            catch
            {
                schema = null;
                cls    = null;
                throw;
            }
        }
Exemple #4
0
        /// <summary>
        /// Raises the <see cref="E:System.Windows.Forms.Form.Load"/> event.
        /// </summary>
        /// <param name="e">An <see cref="T:System.EventArgs"/> that contains the event data.</param>
        protected override void OnLoad(EventArgs e)
        {
            this.Visible           = true;
            CoordinateWait.Visible = true;
            CoordinateWait.BringToFront();
            this.Refresh();
            _cat.FindCoordSys(string.Empty);

            CoordinateSystemDefinitionBase[] items = null;
            try
            {
                items = _cat.Coordsys;
            }
            catch
            {
                items = new CoordinateSystemDefinitionBase[0];
            }

            EPSGCodeText.BeginUpdate();
            try
            {
                EPSGCodeText.Items.Clear();
                foreach (CoordinateSystemDefinitionBase c in items)
                {
                    if (c.Code.StartsWith("EPSG:")) //NOXLATE
                    {
                        EPSGCodeText.Items.Add(c.EPSG);
                    }
                }
            }
            finally
            {
                EPSGCodeText.EndUpdate();
            }

            CoordSysCodeText.BeginUpdate();
            try
            {
                CoordSysCodeText.Items.Clear();
                foreach (CoordinateSystemDefinitionBase c in items)
                {
                    CoordSysCodeText.Items.Add(c.Code);
                }
            }
            finally
            {
                CoordSysCodeText.EndUpdate();
            }

            if (WKTText.Text != string.Empty)
            {
                SelectByWKT.Checked = true;
                ValidateWKT_Click(null, null);
            }

            CoordinateWait.Visible = false;
        }
Exemple #5
0
 private void ValidateCoordSysCode_Click(object sender, EventArgs e)
 {
     try
     {
         m_coordsysCodeCoordSys = null;
         string s = _cat.ConvertCoordinateSystemCodeToWkt(CoordSysCodeText.Text);
         m_coordsysCodeCoordSys = _cat.FindCoordSys(CoordSysCodeText.Text);
     }
     catch
     {
     }
     UpdateOKButton();
 }
Exemple #6
0
        private void EPSGCodeText_TextChanged(object sender, System.EventArgs e)
        {
            if (m_isUpdating)
            {
                return;
            }

            //			if (!EPSGCodeText.Focused)
            //				return;
            m_epsgCoordSys = null;
            if (EPSGCodeText.Focused)
            {
                UpdateOKButton();
            }
        }
Exemple #7
0
        private void WKTText_TextChanged(object sender, System.EventArgs e)
        {
            if (m_isUpdating)
            {
                return;
            }

            //			if (!WKTText.Focused)
            //				return;
            m_wktCoordSys = null;
            if (WKTText.Focused)
            {
                UpdateOKButton();
            }
        }
Exemple #8
0
        private void ValidateWKT_Click(object sender, EventArgs e)
        {
            try
            {
                m_wktCoordSys = null;
                if (_cat.IsValid(WKTText.Text))
                {
                    try
                    {
                        string coordcode = _cat.ConvertWktToCoordinateSystemCode(WKTText.Text);
                        m_wktCoordSys = _cat.FindCoordSys(coordcode);
                    }
                    catch
                    {
                    }

                    if (m_wktCoordSys == null)
                    {
                        m_wktCoordSys             = _cat.CreateEmptyCoordinateSystem();
                        m_wktCoordSys.Code        = null;
                        m_wktCoordSys.Description = null;
                        m_wktCoordSys.WKT         = WKTText.Text;
                    }
                }
                else
                {
                    if (MessageBox.Show(Strings.ConfirmNonMapGuideSupportedCsWkt, Strings.NonMapGuideSupportedCsWkt, MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
                    {
                        m_wktCoordSys             = _cat.CreateEmptyCoordinateSystem();
                        m_wktCoordSys.Code        = null;
                        m_wktCoordSys.Description = null;
                        m_wktCoordSys.WKT         = WKTText.Text;
                    }
                }
            }
            catch
            {
                if (MessageBox.Show(Strings.ConfirmNonMapGuideSupportedCsWkt, Strings.NonMapGuideSupportedCsWkt, MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
                {
                    m_wktCoordSys             = _cat.CreateEmptyCoordinateSystem();
                    m_wktCoordSys.Code        = null;
                    m_wktCoordSys.Description = null;
                    m_wktCoordSys.WKT         = WKTText.Text;
                }
            }
            UpdateOKButton();
        }
Exemple #9
0
 private void ValidateEPSG_Click(object sender, EventArgs e)
 {
     try
     {
         m_epsgCoordSys = null;
         m_epsgCoordSys = _cat.FindCoordSys($"EPSG:{EPSGCodeText.Text}"); //NOXLATE
         if (m_epsgCoordSys == null)
         {
             string s = _cat.ConvertEpsgCodeToWkt(EPSGCodeText.Text);
             s = _cat.ConvertWktToCoordinateSystemCode(s);
             m_epsgCoordSys = _cat.FindCoordSys(s);
         }
     }
     catch
     {
     }
     UpdateOKButton();
 }