Exemplo n.º 1
0
        public static MinuteOfAngle operator +(MinuteOfAngle a1, decimal seconds)
        {
            MinuteOfAngle ret = new MinuteOfAngle(0, 0, 0);
            ret.second = (a1.second + seconds) % 60m;
            int minutesOfSecond = (int)(a1.second + seconds) / 60;

            ret.minute = (minutesOfSecond + a1.minute) % 60;
            ret.degree = (minutesOfSecond + a1.minute) / 60 + a1.degree;

            return ret;
        }
Exemplo n.º 2
0
        /// <summary>
        /// 根据经纬度计算出坐标值
        /// </summary>
        public static long CalculateCoordinate(decimal latitude, decimal longitude, decimal centerLatitude, decimal centerLongtitude, decimal rasterPrecision)
        {
            decimal precision = new MinuteOfAngle(0, 0, rasterPrecision).ToDecimal();
            long x = (long)System.Math.Abs((((decimal)longitude - centerLongtitude) / precision));
            long y = (long)System.Math.Abs((((decimal)latitude - centerLatitude) / precision));

            // 计算象限值
            Quadrand quadValue = Quadrand.TopRight;
            if ((decimal)longitude < centerLongtitude)
            {
                quadValue = ((decimal)latitude < centerLatitude) ? Quadrand.BottomLeft : Quadrand.TopLeft;
            }
            else
            {
                quadValue = ((decimal)latitude < centerLatitude) ? Quadrand.BottomRight : Quadrand.TopRight;
            }

            return new RasterCoordinate(quadValue, x, y).RasterCode;
        }
Exemplo n.º 3
0
        public static MinuteOfAngle operator -(MinuteOfAngle a1, decimal seconds)
        {
            decimal subingSeconds = seconds % 60;
            int subingMinutes = (int)((seconds - subingSeconds) / 60);

            MinuteOfAngle ret = new MinuteOfAngle(0, 0, 0);
            if (a1.second < subingSeconds)
            {
                a1.minute -= 1;
                a1.second += 60m;
            }
            ret.second = a1.second - subingSeconds;

            if (a1.minute < 0 || a1.minute < subingMinutes % 60)
            {
                a1.degree -= 1;
                a1.minute += 60;
            }
            ret.minute = a1.minute - subingMinutes % 60;

            ret.degree = a1.degree - subingMinutes / 60;

            return ret;
        }