Beispiel #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("");
        }
Beispiel #2
0
        public static bool Check25W(string mapnumber25W)
        {
            if (string.IsNullOrEmpty(mapnumber25W) || !mapnumber25W.Contains("-") || !mapnumber25W.Contains("[") || !mapnumber25W.Contains("]"))
            {
                return(false);
            }
            string[] split = mapnumber25W.Split(new char[] { '-' }, StringSplitOptions.RemoveEmptyEntries);
            if (split.Length != 3 || !Mapnumber100W.ValidateRowNum(split[0]) || !Mapnumber100W.ValidateColumnNum(split[1]))
            {
                return(false);
            }
            string k = split[2];

            string[] subSplit = k.Split(new char[] { '[', ']' }, StringSplitOptions.RemoveEmptyEntries);
            int      len      = subSplit.Length;

            if (len != 1)
            {
                return(false);
            }
            int sum = OldMapnumber.SumCount(OldMapnumberDefine.MaxCount25W);

            string[] strs = OldMapnumber.AllAllowedNums(sum);
            return(MapnumberCommon.Contain(strs, subSplit[0]));
        }
Beispiel #3
0
        private static string ChangeOldMapnumberChar(string oldMapnumber)
        {
            oldMapnumber = oldMapnumber.Replace("(", "");
            oldMapnumber = oldMapnumber.Replace(")", "");
            oldMapnumber = oldMapnumber.Replace("(", "");
            oldMapnumber = oldMapnumber.Replace(")", "");
            oldMapnumber = oldMapnumber.Replace("【", "");
            oldMapnumber = oldMapnumber.Replace("】", "");
            oldMapnumber = oldMapnumber.Replace("甲", "1");
            oldMapnumber = oldMapnumber.Replace("乙", "2");
            oldMapnumber = oldMapnumber.Replace("丙", "3");
            oldMapnumber = oldMapnumber.Replace("丁", "4");
            oldMapnumber = oldMapnumber.Replace("A", "1");
            oldMapnumber = oldMapnumber.Replace("B", "2");
            oldMapnumber = oldMapnumber.Replace("C", "3");
            oldMapnumber = oldMapnumber.Replace("D", "4");
            oldMapnumber = oldMapnumber.Replace("a", "1");
            oldMapnumber = oldMapnumber.Replace("b", "2");
            oldMapnumber = oldMapnumber.Replace("c", "3");
            oldMapnumber = oldMapnumber.Replace("d", "4");

            oldMapnumber = oldMapnumber.ToUpper();
            foreach (string m100WR in Mapnumber100W.RowNums)
            {
                oldMapnumber = oldMapnumber.Replace(m100WR, Mapnumber100W.RowStringToDigital(m100WR).ToString());
            }
            return(oldMapnumber);
        }
Beispiel #4
0
 public static bool Check50W(string mapnumber50W)
 {
     if (string.IsNullOrEmpty(mapnumber50W) || !mapnumber50W.Contains("-"))
     {
         return(false);
     }
     string[] split = mapnumber50W.Split(new char[] { '-' }, StringSplitOptions.RemoveEmptyEntries);
     return(split.Length == 3 && Mapnumber100W.ValidateRowNum(split[0]) && Mapnumber100W.ValidateColumnNum(split[1]) && Contain(OldMapnumberDefine.ABCD, split[2]));
 }
        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);
        }
        private static decimal NewMapnumberSouth(string newMapnumber_100W_Row, decimal subRow = decimal.Zero, decimal subLatitudeDifference = decimal.Zero)
        {
            if (string.IsNullOrEmpty(newMapnumber_100W_Row))
            {
                throw new ArgumentNullException();
            }
            int n100WRInt = Mapnumber100W.RowStringToDigital(newMapnumber_100W_Row);

            if (n100WRInt <= 0)
            {
                throw new Exception();
            }
            decimal n100WR_d = n100WRInt;

            if (subLatitudeDifference != decimal.Zero)
            {
                return((n100WR_d - 1) * LongitudeLatitudeDifferent.MAPNUMBER_100W_LATITUDE_DIFFERENT + (LongitudeLatitudeDifferent.MAPNUMBER_100W_LATITUDE_DIFFERENT / subLatitudeDifference - subRow) * subLatitudeDifference);
            }
            else
            {
                return((n100WR_d - 1) * LongitudeLatitudeDifferent.MAPNUMBER_100W_LATITUDE_DIFFERENT);;
            }
        }