- let match = matches[0];
- let key = String(line[Range(match.range(at: 1), in: line)!])
- let xString = String(line[Range(match.range(at: 2), in: line)!])
- let yString = String(line[Range(match.range(at: 3), in: line)!])
- let x = CGFloat(truncating: NumberFormatter().number(from:xString) ?? 0.0)
- let y = CGFloat(truncating: NumberFormatter().number(from:yString) ?? 0.0)
- let point = CGPoint(x: x, y: y)
-
- result[key] = point
- }
- }
-
- return result
-}
-
-// Extracts the edges from the text
-
-func parseEdges(_ text: String, vertices: [String: CGPoint]) -> [MapEdge] {
-
- var result: [MapEdge] = []
- let regex = try! NSRegularExpression(pattern: EDGE_PATTERN, options: .caseInsensitive)
-
- let lines = text.split(whereSeparator: \.isNewline)
-