コード例 #1
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);
                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);
        }
コード例 #2
0
 /// <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
ファイル: CoordinateSystemBase.cs プロジェクト: kanbang/Colt
        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));
 }