Пример #1
0
        public EquidistantConicProjection()
        {
            MinLatitude        = ProjectionMath.ToRadians(10);
            MaxLatitude        = ProjectionMath.ToRadians(70);
            MinLongitude       = ProjectionMath.ToRadians(-90);
            MaxLongitude       = ProjectionMath.ToRadians(90);
            _standardLatitude1 = ProjectionMath.ToDegrees(60); //???
            _standardLatitude2 = ProjectionMath.ToDegrees(20); //???

            Initialize(ProjectionMath.ToRadians(0), ProjectionMath.ToRadians(37.5), _standardLatitude1, _standardLatitude2);
        }
Пример #2
0
        public override Coordinate Project(double lplam, double lpphi, Coordinate xy)
        {
            double phi = Math.Abs(lpphi);
            int    i   = (int)Math.Floor(phi * C1);

            if (i >= NODES)
            {
                i = NODES - 1;
            }
            phi  = ProjectionMath.ToDegrees(phi - RC1 * i);
            i   *= 4;
            xy.X = poly(X, i, phi) * FXC * lplam;
            xy.Y = poly(Y, i, phi) * FYC;
            if (lpphi < 0.0)
            {
                xy.Y = -xy.Y;
            }
            return(xy);
        }
Пример #3
0
        public string Format(string format, object arg, IFormatProvider formatProvider)
        {
            if (!(arg is float || arg is double))
            {
                if (arg is IFormattable)
                {
                    return(((IFormattable)arg).ToString(format, formatProvider));
                }

                return(arg != null?arg.ToString() : String.Empty);
            }

            if (String.IsNullOrEmpty(format))
            {
                format = _pattern;
            }
            else
            {
                CheckFormatString(format);
            }

            int     length   = format.Length;
            Boolean negative = false;

            Double number = Convert.ToDouble(arg);

            if (number < 0)
            {
                for (int i = length - 1; i >= 0; i--)
                {
                    char c = _pattern[i];
                    if (c == 'W' || c == 'N')
                    {
                        number   = -number;
                        negative = true;
                        break;
                    }
                }
            }

            double ddmmss = _isDegrees
                ? number
                : ProjectionMath.ToDegrees(number);
            int iddmmss = (int)Math.Round(ddmmss * 3600);

            if (iddmmss < 0)
            {
                iddmmss = -iddmmss;
            }
            int fraction = iddmmss % 3600;

            StringBuilder result = new StringBuilder();

            foreach (char c in format)
            {
                int f;
                switch (c)
                {
                case 'R':
                    result.Append(number);
                    break;

                case 'D':
                    result.Append((int)ddmmss);
                    break;

                case 'M':
                    f = fraction / 60;
                    if (f < 10)
                    {
                        result.Append('0');
                    }
                    result.Append(f);
                    break;

                case 'S':
                    f = fraction % 60;
                    if (f < 10)
                    {
                        result.Append('0');
                    }
                    result.Append(f);
                    break;

                case 'F':
                    result.Append(fraction);
                    break;

                case 'W':
                    if (negative)
                    {
                        result.Append('W');
                    }
                    else
                    {
                        result.Append('E');
                    }
                    break;

                case 'N':
                    if (negative)
                    {
                        result.Append('S');
                    }
                    else
                    {
                        result.Append('N');
                    }
                    break;

                default:
                    result.Append(c);
                    break;
                }
            }
            return(result.ToString());
        }