/// <summary> /// 檢查是否為標准圖幅編號 /// </summary> /// <param name="MapNumber">圖幅編號</param> /// <returns>檢查結果True/false</returns> private bool CheckMapNumber(string MapNumber) { int ColumnNumber100; if (MapNumber.Length == 3)//1:100萬圖幅規則 { Regex RegMapNumber = new Regex(@"^[A-S]\d\d$"); if (RegMapNumber.IsMatch(MapNumber.ToUpper())) { ColumnNumber100 = Convert.ToInt32(MapNumber.Substring(1, 2)); if (ColumnNumber100 <= 60) { return true; } } } if (MapNumber.Length == 10)//其他圖幅規則 { string ScaleMark = ""; int ColumnNumber; int RowNumber; int RowMax = 0; int ColumnMax = 0; Regex RegMapNumber = new Regex(@"^[A-S]\d\d[B-H]\d\d\d\d\d\d$"); if (RegMapNumber.IsMatch(MapNumber.ToUpper())) { ScaleMark = MapNumber.Substring(3, 1); switch(ScaleMark) { case "B": RowMax = 2; ColumnMax = 2; break; case "C": RowMax = 4; ColumnMax = 4; break; case "D": RowMax = 12; ColumnMax = 12; break; case "E": RowMax = 24; ColumnMax = 24; break; case "F": RowMax = 48; ColumnMax = 48; break; case "G": RowMax = 96; ColumnMax = 96; break; case "H": RowMax = 192; ColumnMax = 192; break; default: RowMax = 0; ColumnMax = 0; break; } ColumnNumber100 = Convert.ToInt32(MapNumber.Substring(1, 2)); RowNumber = Convert.ToInt32(MapNumber.Substring(4, 3)); ColumnNumber = Convert.ToInt32(MapNumber.Substring(7, 3)); if (ColumnNumber100 <= 60 && RowNumber <= RowMax && ColumnNumber <= ColumnMax) { return true; } } } return false; }