public override Entity parse(List <string> section) { gatherCodes(section); getCommonCodes(); vertices = new Point[getCode(" 76", 2)]; arrow = getCode(" 71", true); hook = getCode(" 75", false); annotationReference = getCode("340", ""); readStatus status = readStatus.seek; int vertexCount = 0; for (int i = 0; i < section.Count; i++) { switch (status) { case readStatus.x: vertices[vertexCount].X = section[i].ConvertToDoubleWithCulture(); status = readStatus.seek; break; case readStatus.y: vertices[vertexCount++].Y = section[i].ConvertToDoubleWithCulture(); status = readStatus.seek; break; case readStatus.seek: switch (section[i]) { case " 10": status = readStatus.x; break; case " 20": status = readStatus.y; break; } break; } } return(this); }
public override Entity parse(List <string> section) { gatherCodes(section); getCommonCodes(); closed = getCode(" 70", 0) > 0; thickness = getCode(" 39", thickness); widthConstant = getCode(" 43", widthConstant); vertices = new PolylineVertex[closed ? getCode(" 90", 2) + 1 : getCode(" 90", 2)]; //bulge = new double[getCode(" 90", 2)]; int i = 0; while (!(section[i + 1].Equals(" 10") || section[i + 1].Equals(" 42"))) { i++; } readStatus status = readStatus.seek; int vertexCount = 0; while (i < section.Count - 1) { switch (status) { case readStatus.x: vertices[vertexCount].vertex.X = section[i].ConvertToDoubleWithCulture(); if (vertexCount < vertices.Length - 1) { vertices[vertexCount + 1].lastVertex.X = vertices[vertexCount].vertex.X; } status = readStatus.seek; break; case readStatus.y: vertices[vertexCount].vertex.Y = section[i].ConvertToDoubleWithCulture(); if (vertexCount < vertices.Length - 1) { vertices[vertexCount + 1].lastVertex.Y = vertices[vertexCount].vertex.Y; } vertexCount++; status = readStatus.seek; break; case readStatus.bulge: if (vertexCount == vertices.Length) { vertices[vertexCount - 1].bulge = section[i].ConvertToDoubleWithCulture(); } else { vertices[vertexCount].bulge = section[i].ConvertToDoubleWithCulture(); } status = readStatus.seek; break; case readStatus.beginWidth: vertices[vertexCount - 1].bWidth = section[i].ConvertToDoubleWithCulture(); status = readStatus.seek; break; case readStatus.endWidth: vertices[vertexCount - 1].eWidth = section[i].ConvertToDoubleWithCulture(); status = readStatus.seek; break; case readStatus.seek: switch (section[i]) { case " 10": status = readStatus.x; break; case " 20": status = readStatus.y; break; case " 40": status = readStatus.beginWidth; break; case " 41": status = readStatus.endWidth; break; case " 42": status = readStatus.bulge; break; } break; } i++; } if (closed) { vertices[vertices.Length - 1].vertex = vertices[0].vertex; } return(this); }