Пример #1
0
        /// <summary>
        /// Shows information about selected projection
        /// </summary>
        /// <param name="projection"></param>
        public void ShowProjection(CoordinateSystem projection)
        {
            if (projection == null)
            {
                throw new NullReferenceException("Geoprojection wasn't passed");
            }

            txtName.Text = projection.Name;
            txtCode.Text = projection.Code.ToString();

            m_proj = new MapWinGIS.GeoProjection();
            if (!m_proj.ImportFromEPSG(projection.Code))
            {
                // usupported projection
            }
            else
            {
                projectionTextBox1.ShowProjection(m_proj.ExportToWKT());

                projectionMap1.DrawCoordinateSystem(projection);
                projectionMap1.ZoomToCoordinateSystem(projection);

                txtProj4.Text = m_proj.ExportToProj4();

                txtAreaName.Text = projection.AreaName;
                txtRemarks.Text  = projection.Remarks;
                txtScope.Text    = projection.Scope;
            }

            // showing dialects
            if (m_coordinateSystem != null)
            {
                m_database.ReadDialects(m_coordinateSystem);

                for (int i = 0; i < m_coordinateSystem.Dialects.Count; i++)
                {
                    string       s    = m_coordinateSystem.Dialects[i];
                    ListViewItem item = this.listView1.Items.Add(i.ToString());
                    this.UpdateDialectString(item, s);
                }
                m_index = m_coordinateSystem.Dialects.Count;

                if (listView1.Items.Count > 0)
                {
                    listView1.Items[0].Selected = true;
                }
            }
        }
Пример #2
0
        // <summary>
        // Some operaions with GeoProjection object
        // </summary>
        public void GeoProjection(AxMap axMap1)
        {
            GeoProjection proj = new GeoProjection();

            // EPSG code
            proj.ImportFromEPSG(4326);  // WGS84

            // proj 4 string
            proj.ImportFromProj4("+proj=longlat +datum=WGS84 +no_defs");  // WGS84

            // autodetect the format
            string unknown_format = "4326";

            proj.ImportFromAutoDetect(unknown_format);

            // from file
            string filename = "some_name";

            proj.ReadFromFile(filename);

            // show the name of the loaded projection
            Debug.Print("Projection loaded: " + proj.Name);

            // show proj 4 representation
            Debug.Print("Proj4 representation: " + proj.ExportToProj4());

            // let's show the properties of the geographic projection
            string s = "";

            double[] arr = new double[5];
            for (int i = 0; i < 5; i++)
            {
                // extract the parameter in element of val arr
                proj.get_GeogCSParam((tkGeogCSParameter)i, ref arr[i]);

                // append the name of parameter and the value to the string
                s += (tkGeogCSParameter)i + ": " + arr[i] + Environment.NewLine;
            }
            MessageBox.Show("Parameters of geographic coordinate system: " + Environment.NewLine + s);
        }
Пример #3
0
        /// <summary>
        /// Shows information about unrecognized projection
        /// </summary>
        public void ShowProjection(MapWinGIS.GeoProjection projection)
        {
            if (projection == null)
            {
                throw new NullReferenceException("Geoprojection wasn't passed");
            }

            m_proj = projection;

            txtName.Text = projection.Name == "" ? "None" : projection.Name;
            txtCode.Text = "None";

            if (!projection.IsEmpty)
            {
                projectionTextBox1.ShowProjection(m_proj.ExportToWKT());
                txtProj4.Text = m_proj.ExportToProj4();

                txtAreaName.Text = "Not defined";
                txtScope.Text    = "Not defined";
                txtRemarks.Text  = "Unrecognized projection";
            }
        }
Пример #4
0
 public string ExportToProj4()
 {
     return(_projection.ExportToProj4());
 }