internal static CoordinateSystemBase Create(ICoordinateSystem coordSys)
        {
            CoordinateSystemBase csb = null;

            try
            {
                //This fails because the XY-M projection is not supported
                csb = new ActualCoordinateSystem(coordSys);
            }
            catch { }

            if (csb == null && coordSys != null)
            {
                IUnit unit = coordSys.GetUnits(0);
                var   au   = unit as IAngularUnit;
                var   lu   = unit as ILinearUnit;
                if (au != null)
                {
                    double radians = au.RadiansPerUnit;
                    csb = new DegreeBasedCoordinateSystem();
                }
                else if (lu != null)
                {
                    csb = new MeterBasedCoordinateSystem(lu.MetersPerUnit, lu.MetersPerUnit);
                }
            }

            if (csb == null)
            {
                csb = new MeterBasedCoordinateSystem();
            }

            return(csb);
        }
 /// <summary>
 /// Gets the units for the dimension within coordinate system.
 /// Each dimension in the coordinate system has corresponding units.
 /// </summary>
 public override IUnit GetUnits(int dimension)
 {
     return(_BaseCoordinateSystem.GetUnits(dimension));
 }
예제 #3
0
        internal static CoordinateSystemBase Create(ICoordinateSystem coordSys)
        {
            CoordinateSystemBase csb = null;
            try
            {
                //This fails because the XY-M projection is not supported
                csb = new ActualCoordinateSystem(coordSys);
            }
            catch { }

            if (csb == null && coordSys != null)
            {
                IUnit unit = coordSys.GetUnits(0);
                if (unit is IAngularUnit)
                {
                    double radians = (unit as IAngularUnit).RadiansPerUnit;
                    csb = new DegreeBasedCoordinateSystem();
                }
                else if (unit is ILinearUnit)
                    csb = new MeterBasedCoordinateSystem(((ILinearUnit)unit).MetersPerUnit, ((ILinearUnit)unit).MetersPerUnit);
            }

            if (csb == null)
                csb = new MeterBasedCoordinateSystem();

            return csb;
        }
예제 #4
0
 public IUnit GetUnits(int dimension)
 {
     return(_coordinateSystem.GetUnits(dimension));
 }