You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Update example app to use remote dependency
* Embed image in repo (#2)
* Add function for annular sectors (#4)
* Add Swiftlint
* Enable adding label without icon (#7)
* Enable export by KMZ (#7)
* Update readme
* Use Sector and Segment correctly (#8)
Copy file name to clipboardExpand all lines: README.md
+36-27Lines changed: 36 additions & 27 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,26 +2,21 @@
2
2
3
3
> Swift framework to build KML files in Jeppesen ForeFlight friendly format.
4
4
5
-
This package provides a small, focused API for composing KML documents suitable for importing into ForeFlight as **User Map Shapes (KML)**. It intentionally avoids UI concerns — it gives you `String` KML output (or bytes) which your app can write to disk and share using the standard iOS share sheet.
5
+
This package provides a small, focused API for composing KML/KMZ documents suitable for importing into ForeFlight as **User Map Shapes (KML)**. It intentionally avoids UI concerns — it gives you `String` KML output (or bytes) which your app can write to disk and share using the standard iOS share sheet.
6
6
7
-
---
8
7
9
8
## Quick highlights
10
9
11
-
- Compose `Placemark`s with `Point`, `LineString`, `Polygon` and derived geometry helpers (circles, arc segments, etc.).
10
+
- Compose `Placemark`s with `Point`, `LineString`, `Polygon` and derived geometry helpers (circles, arc sectors, etc.).
12
11
- Create reusable styles (`Style`, `LineStyle`, `PolyStyle`, `IconStyle`, `LabelStyle`) and assign them to placemarks.
13
-
-`ForeFlightKMLBuilder` collects placemarks and styles, emits a complete `kml` document string.
12
+
-`ForeFlightKMLBuilder` collects placemarks and styles, emits a complete `kml`or `kmz`document .
14
13
- Lightweight — no UI code.
15
14
16
-
---
17
-
18
15
## Install
19
-
20
16
1. In Xcode: **File › Add Packages...**
21
17
2. Enter the repository URL.
22
18
3. Choose the `ForeFlightKML` package product and add it to your app target.
23
19
24
-
---
25
20
26
21
## Example Output
27
22
Using the example given on the [ForeFlight website](https://foreflight.com/support/user-map-shapes/) the below is generated using this Framework.
@@ -30,27 +25,23 @@ See `/Tests/ForeFlightKMLTests/UserMapShapesSampleFullTest.swift`
> **Note**: ForeFlight supports importing KML/KMZ files via the iOS share sheet. See ForeFlight's docs for exact import behavior.
63
-
---
64
54
65
-
## API quick reference (important types)
66
55
67
-
-`ForeFlightKMLBuilder` — builder for the KML document. Methods: `addPlacemark(_:)`, `kmlString()`.
56
+
## API Reference
57
+
58
+
### KMLBuidler
59
+
`ForeFlightKMLBuilder` is the builder for the KML/KMZ document.
60
+
- Document name can be set on `init` or with `setDocumentName()`
61
+
- Elements can be manually added using `addPlacemark(_:)`
62
+
- The output is accessed by: for KML `try builder.build()` or for KMZ: `try builder.buildKMZ()`
63
+
64
+
### KMLBuilder Convenience Elements
65
+
-`addPoint` Add a point with style.
66
+
-`addLine` Add a line connecting multiple coordinates.
67
+
-`addLineCircle` Add a circular line (approximated by line segments).
68
+
-`addLineSector` Add an arc sector line geometry.
69
+
-`addPolygon` Add a polygon with outer boundary and optional holes.
70
+
-`addPolygonCircle` Add a polygon with outer boundary and optional holes.
71
+
-`addPolygonSector` Add a filled sector polygon (pie slice).
72
+
-`addPolygonAnnularSector` Add a filled annular (ring) sector polygon.
73
+
-`addLabel` Add a text-only label placemark at a coordinate.
74
+
75
+
### ForeflightKMLBuilder Export formats
76
+
-`kml String` via `builder.build()`
77
+
-`kml Data` via `builder.kmlData()`
78
+
-`kmz Data` via `builder.buildKMZ()`
79
+
- KMZ (zipped KML) is required when using custom icons or using labelBadge (which uses a transparent .png under the hood).
80
+
81
+
### Underlying elements
68
82
-`Placemark` — a Feature containing a geometry (must implement `KMLElement`). Optionally attach a `KMLStyle`.
69
-
- Geometry types: `Point`, `Line`, `LineCircle`, `LineSegment` (segment of a Circle), `Polygon`, `PolygonCircle` (filled circle), `PolygonSegment` (filled segment) `LinearRing`.
83
+
- Geometry types: `Point`, `Line`, `LineCircle`, `LineSector` (sector of a Circle), `Polygon`, `PolygonCircle` (filled circle), `PolygonSector` (filled sector) `LinearRing`.
70
84
-`Style` and substyles: `LineStyle`, `PolyStyle`, `IconStyle`, `LabelStyle`.
71
85
-`KMLColor` — helper to create the aabbggrr color values used by KML.
72
86
73
-
Full public API surface is visible in the package sources; the README examples show common usage patterns.
74
-
75
-
---
87
+
Full public API surface is visible in the package sources.
76
88
77
89
## Notes, conventions and gotchas
78
90
@@ -81,13 +93,10 @@ Full public API surface is visible in the package sources; the README examples s
81
93
-**Angles/bearings**: bearings (for arc & circle generation) are interpreted in degrees (0..360). The bearing convention is clockwise from north.
82
94
-**Altitude**: When you provide altitudes, the `AltitudeMode` is emitted (defaults to `.absolute` in most geometries).
83
95
-**Styles**: `Style` generates a stable `id` when provided; otherwise a UUID-based id is generated. `ForeFlightKMLBuilder` will automatically register styles added via `Placemark`.
84
-
---
85
96
86
97
## Demo & tests
87
98
88
-
The repo contains an `Example` app that demonstrates building shapes and the `Tests` folder with unit tests. Before publishing, ensure the example builds and the tests run in CI.
89
-
90
-
---
99
+
The repo contains an `Example` app that demonstrates building shapes and the `Tests` folder with unit tests.
0 commit comments