#region Disclaimer / License // Copyright (C) 2010, Jackie Ng // http://trac.osgeo.org/mapguide/wiki/maestro, jumpinjackie@gmail.com // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // #endregion using System; using System.Collections.Generic; using System.Text; using System.Xml; namespace OSGeo.MapGuide.MaestroAPI.CoordinateSystem { /// /// Represents a coordinate system definition /// public abstract class CoordinateSystemDefinitionBase { /// /// The parent category /// protected CoordinateSystemCategory m_parent; /// /// The cs code /// protected string m_code; /// /// The description /// protected string m_description; /// /// The projection /// protected string m_projection; /// /// The projection description /// protected string m_projectionDescription; /// /// The datum /// protected string m_datum; /// /// The datum description /// protected string m_datumDescription; /// /// The ellipsoid /// protected string m_ellipsoid; /// /// The ellipsoid description /// protected string m_ellipsoidDescription; /// /// The cs wkt /// protected string m_wkt = null; /// /// The epsg code /// protected string m_epsg = null; /// /// Initializes a new instance of the class. /// protected CoordinateSystemDefinitionBase() { } /// /// Initializes a new instance of the class. /// /// The parent. protected CoordinateSystemDefinitionBase(CoordinateSystemCategory parent) { m_parent = parent; } internal CoordinateSystemCategory Parent { get { return m_parent; } set { m_parent = value; } } /// /// Gets or sets the code. /// /// The code. public string Code { get { return m_code; } set { m_code = value; } } /// /// Gets or sets the description. /// /// The description. public string Description { get { return m_description; } set { m_description = value; } } /// /// Gets the projection. /// /// The projection. public string Projection { get { return m_projection; } } /// /// Gets the projection description. /// /// The projection description. public string ProjectionDescription { get { return m_projectionDescription; } } /// /// Gets the datum. /// /// The datum. public string Datum { get { return m_datum; } } /// /// Gets the datum description. /// /// The datum description. public string DatumDescription { get { return m_datumDescription; } } /// /// Gets the ellipsoid. /// /// The ellipsoid. public string Ellipsoid { get { return m_ellipsoid; } } /// /// Gets the ellipsoid description. /// /// The ellipsoid description. public string EllipsoidDescription { get { return m_ellipsoidDescription; } } /// /// Gets or sets the WKT. /// /// The WKT. public string WKT { get { if (m_wkt == null) m_wkt = m_parent.Parent.ConvertCoordinateSystemCodeToWkt(m_code); return m_wkt; } set { m_wkt = value; } } /// /// Gets the EPSG code /// /// The EPSG code. public string EPSG { get { if (m_epsg == null) if (m_code.StartsWith("EPSG:")) //NOXLATE m_epsg = m_code.Substring(5); else m_epsg = m_parent.Parent.ConvertWktToEpsgCode(m_parent.Parent.ConvertCoordinateSystemCodeToWkt(m_code)); return m_epsg; } } /// /// Returns a that represents this instance. /// /// /// A that represents this instance. /// public override string ToString() { if (m_description == null && m_code == null) return m_wkt == null ? "" : m_wkt; //NOXLATE else if (m_description == null) return m_code; else if (m_code == null) return m_description; else return m_description + " (" + m_code + ")"; //NOXLATE } } }