예제 #1
0
        public static void CheckProjection()
        {
            var proj = new GeoProjection {
                GlobalCallback = callback
            };

            if (proj.SetWgs84())
            {
                if (!proj.SetGoogleMercator())
                {
                    MessageBox.Show("ERROR: failed to set projection");
                }
                else
                {
                    axMap1.GeoProjection = proj;
                    if (!proj.SetWgs84())
                    {
                        Debug.WriteLine("Failed to change projection of the map; Frozen: " + proj.IsFrozen);
                        axMap1.GeoProjection = proj.Clone();
                        if (!proj.SetWgs84())
                        {
                            MessageBox.Show("ERROR: projection is still frozen when no longer applied to map");
                        }
                        else
                        {
                            Debug.WriteLine("Projection changed; Frozen: " + proj.IsFrozen);
                            MessageBox.Show("Success");
                        }
                    }
                    else
                    {
                        MessageBox.Show("ERROR: projection of the map was changed; Frozen: " + proj.IsFrozen);
                    }
                }
            }
            else
            {
                MessageBox.Show("Failed to set WGS84 projection");
            }
        }
예제 #2
0
 public ISpatialReference Clone()
 {
     return(new SpatialReference(_projection.Clone()));
 }