Exemple #1
0
        public static string ToOldMapnumber100W(string oldMapnumber100W)
        {
            if (string.IsNullOrEmpty(oldMapnumber100W))
            {
                return("");
            }
            if (OldMapnumberCheck.Check100W(oldMapnumber100W))
            {
                return(oldMapnumber100W);
            }

            oldMapnumber100W = ChangeOldMapnumberChar(oldMapnumber100W);
            if (!oldMapnumber100W.Contains("-"))
            {
                return("");
            }
            var split  = oldMapnumber100W.Split(new char[] { '-' }, StringSplitOptions.RemoveEmptyEntries);
            var length = split.Length;

            if (length != 2 || !int.TryParse(split[0], out int x100R) || !int.TryParse(split[1], out int x100C))
            {
                return("");
            }

            var s100R = Mapnumber100W.RowDigitalToString(x100R);
            var s100C = x100C.ToString("00");

            oldMapnumber100W = s100R + "-" + s100C;
            if (OldMapnumberCheck.Check100W(oldMapnumber100W))
            {
                return(oldMapnumber100W);
            }
            return("");
        }
        public static string NewMapnumber100WFromLongitudeLatitude(decimal longitude, decimal latitude)
        {
            var rNum  = (int)(latitude / LongitudeLatitudeDifferent.MAPNUMBER_100W_LATITUDE_DIFFERENT) + 1;
            var cNum  = (int)(longitude / LongitudeLatitudeDifferent.MAPNUMBER_100W_LONGITUDE_DIFFERENT) + 31;
            var rStr  = Mapnumber100W.RowDigitalToString(rNum);
            var n100W = rStr + cNum.ToString("00");

            if (!NewMapnumberCheck.Check(n100W))
            {
                return(null);
            }
            return(n100W);
        }
        public static string OldMapnumber100WFromLongitudeLatitude(decimal longitude, decimal latitude)
        {
            int    rNum  = (int)(latitude / LongitudeLatitudeDifferent.MAPNUMBER_100W_LONGITUDE_DIFFERENT) + 1;
            int    cNum  = (int)(longitude / LongitudeLatitudeDifferent.MAPNUMBER_100W_LATITUDE_DIFFERENT) + 31;
            string rStr  = Mapnumber100W.RowDigitalToString(rNum);
            string o100W = rStr + "-" + cNum.ToString("00");

            if (OldMapnumberCheck.Check100W(o100W))
            {
                return(o100W);
            }
            return(null);
        }