public static bool TryParse(String value, out GeoLine line) { line = null; int index1 = value.IndexOf(GeoPoint.TOSTRING_DELIM); String name = String.Empty; if (index1 > 0) { name = value.Substring(0, index1).Trim(); value = value.Substring(index1).Trim(); } int index = value.IndexOf(" - "); if (index > 0) { String s1 = value.Substring(0, index).Trim(); String s2 = value.Substring(index + 2).Trim(); GeoPoint p1, p2; if (GeoPoint.TryParse(s1, out p1) && GeoPoint.TryParse(s2, out p2)) { line = new GeoLine(p1, p2); line.Name = name; } } return(line != null); }
public static bool TryParse(String str, out GeoCircle circle) { circle = null; String[] parts = str.Split('R'); GeoPoint p; Double r; if (parts.Length == 2 && GeoPoint.TryParse(parts[0].Trim(), out p) && Double.TryParse(parts[1].Trim(), out r)) { circle = new GeoCircle(p, r); } return(circle != null); }