1- public protocol ImageManagerProtocol {
2- func image( for geoJsonObject: GeoJsonObject , with drawingRenderModel: DrawingRenderModel , width: Double , height: Double , debug: Bool ) -> UIImage ?
3-
4- @discardableResult
5- func snapshot( for geoJsonObject: GeoJsonObject , with drawingRenderModel: DrawingRenderModel , width: Double , height: Double , debug: Bool , completion: @escaping ( UIImage ? ) -> Void ) -> SnapshotRequest ?
6- }
7-
8- extension ImageManagerProtocol {
9- public func image( for geoJsonObject: GeoJsonObject , with drawingRenderModel: DrawingRenderModel , width: Double , height: Double ) -> UIImage ? {
10- return image ( for: geoJsonObject, with: drawingRenderModel, width: width, height: height, debug: false )
11- }
12-
13- @discardableResult
14- public func snapshot( for geoJsonObject: GeoJsonObject , with drawingRenderModel: DrawingRenderModel , width: Double , height: Double , completion: @escaping ( UIImage ? ) -> Void ) -> SnapshotRequest ? {
15- return snapshot ( for: geoJsonObject, with: drawingRenderModel, width: width, height: height, debug: false , completion: completion)
16- }
17-
18- public func image( for geoJsonObjects: [ GeoJsonObject ] , with drawingRenderModel: DrawingRenderModel , width: Double , height: Double ) -> UIImage ? {
19- let geometries = geoJsonObjects. compactMap { $0. objectGeometries } . flatMap { $0 }
20- let geoJsonObject = Geospatial ( ) . geoJson. geometryCollection ( geometries: geometries)
21-
22- return image ( for: geoJsonObject, with: drawingRenderModel, width: width, height: height, debug: false )
23- }
24-
25- @discardableResult
26- public func snapshot( for geoJsonObjects: [ GeoJsonObject ] , with drawingRenderModel: DrawingRenderModel , width: Double , height: Double , completion: @escaping ( UIImage ? ) -> Void ) -> SnapshotRequest ? {
27- let geometries = geoJsonObjects. compactMap { $0. objectGeometries } . flatMap { $0 }
28- let geoJsonObject = Geospatial ( ) . geoJson. geometryCollection ( geometries: geometries)
29-
30- return snapshot ( for: geoJsonObject, with: drawingRenderModel, width: width, height: height, debug: false , completion: completion)
31- }
32- }
1+ import GeospatialSwift
332
34- public struct ImageManager : ImageManagerProtocol {
3+ public struct ImageManager {
354 internal let imageGenerator : ImageGeneratorProtocol
365
376 init ( ) {
@@ -49,6 +18,15 @@ public struct ImageManager: ImageManagerProtocol {
4918 public func image( for geoJsonObject: GeoJsonObject , with drawingRenderModel: DrawingRenderModel , width: Double , height: Double , debug: Bool ) -> UIImage ? {
5019 return imageGenerator. image ( for: geoJsonObject, with: drawingRenderModel, width: width, height: height, debug: debug)
5120 }
21+ public func image( for geoJsonObject: GeoJsonObject , with drawingRenderModel: DrawingRenderModel , width: Double , height: Double ) -> UIImage ? {
22+ return image ( for: geoJsonObject, with: drawingRenderModel, width: width, height: height, debug: false )
23+ }
24+ public func image( for geoJsonObjects: [ GeoJsonObject ] , with drawingRenderModel: DrawingRenderModel , width: Double , height: Double ) -> UIImage ? {
25+ let geometries = geoJsonObjects. compactMap { $0. objectGeometries } . flatMap { $0 }
26+ let geoJsonObject = Geospatial ( ) . geoJson. geometryCollection ( geometries: geometries)
27+
28+ return image ( for: geoJsonObject, with: drawingRenderModel, width: width, height: height, debug: false )
29+ }
5230
5331 /**
5432 Same as create but with a Map background
@@ -58,4 +36,15 @@ public struct ImageManager: ImageManagerProtocol {
5836 public func snapshot( for geoJsonObject: GeoJsonObject , with drawingRenderModel: DrawingRenderModel , width: Double , height: Double , debug: Bool , completion: @escaping ( UIImage ? ) -> Void ) -> SnapshotRequest ? {
5937 return imageGenerator. snapshot ( for: geoJsonObject, with: drawingRenderModel, width: width, height: height, debug: debug, completion: completion)
6038 }
39+ @discardableResult
40+ public func snapshot( for geoJsonObject: GeoJsonObject , with drawingRenderModel: DrawingRenderModel , width: Double , height: Double , completion: @escaping ( UIImage ? ) -> Void ) -> SnapshotRequest ? {
41+ return snapshot ( for: geoJsonObject, with: drawingRenderModel, width: width, height: height, debug: false , completion: completion)
42+ }
43+ @discardableResult
44+ public func snapshot( for geoJsonObjects: [ GeoJsonObject ] , with drawingRenderModel: DrawingRenderModel , width: Double , height: Double , completion: @escaping ( UIImage ? ) -> Void ) -> SnapshotRequest ? {
45+ let geometries = geoJsonObjects. compactMap { $0. objectGeometries } . flatMap { $0 }
46+ let geoJsonObject = Geospatial ( ) . geoJson. geometryCollection ( geometries: geometries)
47+
48+ return snapshot ( for: geoJsonObject, with: drawingRenderModel, width: width, height: height, debug: false , completion: completion)
49+ }
6150}
0 commit comments