private void ComputeBlockItems() { string[] LonNOs = GetLongitudeNOs(); string[] LatNOs = GetLatitudeNOs(); _items = new List <BlockItem>(); for (int i = 0; i < LatNOs.Length; i++) { float LeftY = GetLat(LatNOs[i]); for (int j = 0; j < LonNOs.Length; j++) { float LeftX = GetLon(LonNOs[j]); BlockItem it = new BlockItem(LatNOs[i] + LonNOs[j], LeftX, LeftY, (float)((span / 0.01) * _lonResolution)); it.BlockIdentity = "D10"; //Console.WriteLine("NO:" + it.Name + ",X = " + it.MinX.ToString() + ", Y = " + it.MaxY.ToString()); _items.Add(it); it.BlockTypes = masBlockTypes.D10; } } }
public static bool TryParse(string text, out BlockItem blockItem) { blockItem = null; if (string.IsNullOrEmpty(text)) { return(false); } string exp = @"^{Name:(?<Name>\S*),MinLon:(?<MinLon>\d+(\.\d+)?),MaxLon:(?<MaxLon>\d+(\.\d+)?),MinLat:(?<MinLat>\d+(\.\d+)?),MaxLat:(?<MaxLat>\d+(\.\d+)?)}$"; Match m = Regex.Match(text, exp); if (!m.Success) { return(false); } blockItem = new BlockItem(m.Groups["Name"].Value, float.Parse(m.Groups["MinLon"].Value), float.Parse(m.Groups["MaxLat"].Value), float.Parse(m.Groups["MaxLon"].Value) - float.Parse(m.Groups["MinLon"].Value), float.Parse(m.Groups["MaxLat"].Value) - float.Parse(m.Groups["MinLat"].Value)); return(true); }