diff options
| author | Ruben Beltran del Rio <ruben@unlimited.pizza> | 2023-05-07 15:22:54 +0200 |
|---|---|---|
| committer | Ruben Beltran del Rio <ruben@unlimited.pizza> | 2023-05-07 15:22:54 +0200 |
| commit | fdb4633d3e9158e457d57e820df6e1efb4df39c2 (patch) | |
| tree | 176cad99cb9befc0a65a7af02561019e811814de /Map/Extensions | |
| parent | 75a0e4509a70055851b085f3f7293ae1cf48164c (diff) | |
Update to support notes + new style2.0.0
Diffstat (limited to 'Map/Extensions')
| -rw-r--r-- | Map/Extensions/Date+format.swift | 17 | ||||
| -rw-r--r-- | Map/Extensions/Map+parse.swift | 28 | ||||
| -rw-r--r-- | Map/Extensions/NSImage+writePNG.swift | 25 |
3 files changed, 0 insertions, 70 deletions
diff --git a/Map/Extensions/Date+format.swift b/Map/Extensions/Date+format.swift deleted file mode 100644 index d29ed0f..0000000 --- a/Map/Extensions/Date+format.swift +++ /dev/null @@ -1,17 +0,0 @@ -// -// Date+format.swift -// Map -// -// Created by Ruben Beltran del Rio on 2/1/21. -// - -import Foundation - -extension Date { - func format() -> String { - let formatter = DateFormatter() - formatter.dateStyle = .short - formatter.timeStyle = .medium - return formatter.string(from: self) - } -} diff --git a/Map/Extensions/Map+parse.swift b/Map/Extensions/Map+parse.swift deleted file mode 100644 index 904f492..0000000 --- a/Map/Extensions/Map+parse.swift +++ /dev/null @@ -1,28 +0,0 @@ -extension Map { - static func parse(content: String) -> ParsedMap { - - let parsers = [ - AnyMapParserStrategy(VertexParserStrategy()), - AnyMapParserStrategy(EdgeParserStrategy()), - AnyMapParserStrategy(BlockerParserStrategy()), - AnyMapParserStrategy(OpportunityParserStrategy()), - AnyMapParserStrategy(StageParserStrategy()), - ] - let builder = MapBuilder() - - let lines = content.split(whereSeparator: \.isNewline) - - for (index, line) in lines.enumerated() { - for parser in parsers { - if parser.canHandle(line: String(line)) { - let (type, object) = parser.handle( - index: index, line: String(line), vertices: builder.vertices) - builder.addObjectToMap(type: type, object: object) - break - } - } - } - - return builder.build() - } -} diff --git a/Map/Extensions/NSImage+writePNG.swift b/Map/Extensions/NSImage+writePNG.swift deleted file mode 100644 index c24c0cf..0000000 --- a/Map/Extensions/NSImage+writePNG.swift +++ /dev/null @@ -1,25 +0,0 @@ -import Cocoa - -extension NSImage { - public func writePNG(toURL url: URL) { - - guard let data = tiffRepresentation, - let rep = NSBitmapImageRep(data: data), - let imgData = rep.representation( - using: .png, properties: [.compressionFactor: NSNumber(floatLiteral: 1.0)]) - else { - - print( - "\(self.self) Error Function '\(#function)' Line: \(#line) No tiff rep found for image writing to \(url)" - ) - return - } - - do { - try imgData.write(to: url) - } catch let error { - print( - "\(self.self) Error Function '\(#function)' Line: \(#line) \(error.localizedDescription)") - } - } -} |