public static CoordinateSystemBase Create(CoordinateSystemDefinitionBase csDef)
 {
     Check.ArgumentNotNull(csDef, nameof(csDef));
     return(Create(csDef.WKT));
 }
        public override CoordinateSystem.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;
        }
Exemple #3
0
 public static CoordinateSystemBase Create(CoordinateSystemDefinitionBase csDef)
 {
     Check.NotNull(csDef, "csDef");
     return Create(csDef.WKT);
 }
        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();
        }
        private void WKTText_TextChanged(object sender, System.EventArgs e)
        {
            if (m_isUpdating)
                return;

            //			if (!WKTText.Focused)
            //				return;
            m_wktCoordSys = null;
            if (WKTText.Focused)
                UpdateOKButton();
        }
 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();
 }
        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();
        }
 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;
 }
        private void EPSGCodeText_TextChanged(object sender, System.EventArgs e)
        {
            if (m_isUpdating)
                return;

            //			if (!EPSGCodeText.Focused)
            //				return;
            m_epsgCoordSys = null;
            if (EPSGCodeText.Focused)
                UpdateOKButton();
        }
        /// <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(""); //NOXLATE

            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 != "") //NOXLATE
            {
                SelectByWKT.Checked = true;
                ValidateWKT_Click(null, null);
            }

            CoordinateWait.Visible = false;
        }