public static List<PointF> ParsePolygonString(String polygonString, String componentType, ICoordinateTransform coordinateTransformer) { List<PointF> returnList = new List<PointF>(); // left, center, right referring to ( , ) which wraps a point (1 , 2) int searchFrom = 0; while (searchFrom != -1 && polygonString.Length > 0) { int left = polygonString.IndexOf("(", searchFrom); int center = polygonString.IndexOf(",", searchFrom); int right = polygonString.IndexOf(")", searchFrom); int leftPlusPlus = left + 1; int centerPlusPlus = center + 1; String xString = polygonString.Substring(leftPlusPlus, center - leftPlusPlus); String yString = polygonString.Substring(centerPlusPlus, right - centerPlusPlus); xString = xString.Replace("\r\n","").Trim(); yString = yString.Replace("\r\n","").Trim(); if (xString.Length > 0 && yString.Length > 0) { float xPoly = float.Parse(xString); float yPoly = float.Parse(yString); // use transform xPoly = coordinateTransformer.RetrieveX(xPoly); yPoly = coordinateTransformer.RetrieveY(yPoly); returnList.Add(new PointF(xPoly, yPoly)); } searchFrom = polygonString.IndexOf(",", right) + 1; if (searchFrom == 0) { searchFrom = -1; // index returns 0 as failure, but we want 0 on the first iteration, so use -1 } } // point load while coordinateTransformer.PostProcessPolygon(returnList, componentType); return returnList; }