@maydon_tech/react-native-nitro-maps 0.2.0 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/build.gradle +6 -2
- package/android/src/main/kotlin/com/margelo/nitro/nitromap/NitroMap.kt +13 -8
- package/android/src/main/kotlin/com/margelo/nitro/nitromap/providers/google/GoogleMapProvider+Overlays.kt +2 -2
- package/android/src/main/kotlin/com/margelo/nitro/nitromap/providers/google/GoogleMapProvider.kt +11 -5
- package/ios/Providers/Google/GoogleMapProvider+Overlays.swift +2 -2
- package/lib/module/components/NitroPolygon.js +3 -1
- package/lib/module/components/NitroPolygon.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/index.d.ts +1 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/types/overlay.d.ts +11 -2
- package/lib/typescript/src/types/overlay.d.ts.map +1 -1
- package/nitrogen/generated/android/c++/JCoordinateRing.hpp +77 -0
- package/nitrogen/generated/android/c++/JHybridNitroMapSpec.cpp +4 -0
- package/nitrogen/generated/android/c++/JPolygonData.hpp +8 -24
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromap/CoordinateRing.kt +38 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromap/PolygonData.kt +2 -2
- package/nitrogen/generated/ios/NitroMap-Swift-Cxx-Bridge.hpp +8 -5
- package/nitrogen/generated/ios/NitroMap-Swift-Cxx-Umbrella.hpp +3 -0
- package/nitrogen/generated/ios/c++/HybridNitroMapSpecSwift.hpp +3 -0
- package/nitrogen/generated/ios/swift/CoordinateRing.swift +48 -0
- package/nitrogen/generated/ios/swift/PolygonData.swift +9 -21
- package/nitrogen/generated/shared/c++/CoordinateRing.hpp +77 -0
- package/nitrogen/generated/shared/c++/PolygonData.hpp +8 -5
- package/package.json +1 -1
- package/src/components/NitroPolygon.tsx +1 -1
- package/src/index.tsx +6 -1
- package/src/types/overlay.ts +12 -2
package/android/build.gradle
CHANGED
|
@@ -106,8 +106,12 @@ android {
|
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
compileOptions {
|
|
109
|
-
sourceCompatibility JavaVersion.
|
|
110
|
-
targetCompatibility JavaVersion.
|
|
109
|
+
sourceCompatibility JavaVersion.VERSION_17
|
|
110
|
+
targetCompatibility JavaVersion.VERSION_17
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
kotlinOptions {
|
|
114
|
+
jvmTarget = "17"
|
|
111
115
|
}
|
|
112
116
|
|
|
113
117
|
sourceSets {
|
|
@@ -72,8 +72,14 @@ class HybridNitroMap(context: Context) : HybridNitroMapSpec() {
|
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
private fun attachMapView() {
|
|
75
|
-
if (currentMapView != null)
|
|
75
|
+
if (currentMapView != null) {
|
|
76
|
+
// Reattaching — reuse existing MapView, just resume it
|
|
77
|
+
mapProvider.onViewAttached(currentMapView!!)
|
|
78
|
+
Log.d(TAG, "MapView reattached (resumed)")
|
|
79
|
+
return
|
|
80
|
+
}
|
|
76
81
|
|
|
82
|
+
// First time — create and add to container
|
|
77
83
|
val mv = mapProvider.createMapView(mapContext)
|
|
78
84
|
container.addView(mv, FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT)
|
|
79
85
|
|
|
@@ -81,16 +87,15 @@ class HybridNitroMap(context: Context) : HybridNitroMapSpec() {
|
|
|
81
87
|
mapProvider.onViewAttached(mv)
|
|
82
88
|
}
|
|
83
89
|
currentMapView = mv
|
|
84
|
-
Log.d(TAG, "MapView attached")
|
|
90
|
+
Log.d(TAG, "MapView created and attached")
|
|
85
91
|
}
|
|
86
92
|
|
|
87
93
|
private fun detachMapView() {
|
|
88
|
-
currentMapView
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
Log.d(TAG, "MapView detached (paused, state saved)")
|
|
94
|
+
if (currentMapView == null) return
|
|
95
|
+
mapProvider.onViewDetaching()
|
|
96
|
+
// Keep currentMapView and the view in the container — reuse on reattach.
|
|
97
|
+
// The MapView and GoogleMap survive pause/resume cycles.
|
|
98
|
+
Log.d(TAG, "MapView paused (preserved for reattach)")
|
|
94
99
|
}
|
|
95
100
|
|
|
96
101
|
override fun dispose() {
|
|
@@ -83,8 +83,8 @@ private fun buildPolygonOptions(data: PolygonData): PolygonOptions {
|
|
|
83
83
|
opts.clickable(data.tappable)
|
|
84
84
|
|
|
85
85
|
// Add holes
|
|
86
|
-
for (
|
|
87
|
-
val holePath =
|
|
86
|
+
for (ring in data.holes) {
|
|
87
|
+
val holePath = ring.coordinates.map { LatLng(it.latitude, it.longitude) }
|
|
88
88
|
opts.addHole(holePath)
|
|
89
89
|
}
|
|
90
90
|
|
package/android/src/main/kotlin/com/margelo/nitro/nitromap/providers/google/GoogleMapProvider.kt
CHANGED
|
@@ -67,6 +67,14 @@ class GoogleMapProvider(internal val context: Context) : MapProviderInterface {
|
|
|
67
67
|
|
|
68
68
|
override fun onViewAttached(view: View) {
|
|
69
69
|
val mv = view as NitroMapView
|
|
70
|
+
if (isMapReady && googleMap != null) {
|
|
71
|
+
// Resuming from detach — GoogleMap is still valid, just resume the MapView
|
|
72
|
+
mv.onStart()
|
|
73
|
+
mv.onResume()
|
|
74
|
+
Log.d(TAG, "MapView resumed — GoogleMap still valid")
|
|
75
|
+
return
|
|
76
|
+
}
|
|
77
|
+
// First attach — need async init
|
|
70
78
|
mv.getMapAsync { googleMap ->
|
|
71
79
|
onMapReady(googleMap, mv)
|
|
72
80
|
}
|
|
@@ -74,14 +82,12 @@ class GoogleMapProvider(internal val context: Context) : MapProviderInterface {
|
|
|
74
82
|
|
|
75
83
|
override fun onViewDetaching() {
|
|
76
84
|
mapView?.let { mv ->
|
|
77
|
-
val state = Bundle()
|
|
78
|
-
mv.onSaveInstanceState(state)
|
|
79
|
-
savedState = state
|
|
80
85
|
mv.onPause()
|
|
81
86
|
mv.onStop()
|
|
82
87
|
}
|
|
83
|
-
|
|
84
|
-
|
|
88
|
+
// Keep mapView, googleMap, isMapReady, and all rendered objects alive.
|
|
89
|
+
// GoogleMap and its native markers/overlays survive pause/resume cycles.
|
|
90
|
+
Log.d(TAG, "MapView paused — all state preserved for reattach")
|
|
85
91
|
}
|
|
86
92
|
|
|
87
93
|
override fun onViewDestroying() {
|
|
@@ -164,9 +164,9 @@ extension GoogleMapProvider {
|
|
|
164
164
|
// Add holes
|
|
165
165
|
if !polygon.holes.isEmpty {
|
|
166
166
|
var holePaths: [GMSPath] = []
|
|
167
|
-
for
|
|
167
|
+
for ring in polygon.holes {
|
|
168
168
|
let holePath = GMSMutablePath()
|
|
169
|
-
for coord in
|
|
169
|
+
for coord in ring.coordinates {
|
|
170
170
|
holePath.add(CLLocationCoordinate2D(latitude: coord.latitude, longitude: coord.longitude))
|
|
171
171
|
}
|
|
172
172
|
holePaths.append(holePath)
|
|
@@ -115,7 +115,9 @@ export const NitroPolygon = /*#__PURE__*/memo(function NitroPolygon({
|
|
|
115
115
|
const buildPolygonData = useCallback(() => ({
|
|
116
116
|
id: polygonId,
|
|
117
117
|
coordinates,
|
|
118
|
-
holes
|
|
118
|
+
holes: holes.map(ring => ({
|
|
119
|
+
coordinates: ring
|
|
120
|
+
})),
|
|
119
121
|
fillColor: parseColor(fillColor) ?? defaultFillColor,
|
|
120
122
|
strokeColor: parseColor(strokeColor) ?? defaultStrokeColor,
|
|
121
123
|
strokeWidth,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["memo","useCallback","useEffect","useRef","useNitroPolygon","parseColor","areColorsEqual","Colors","validateCoordinates","polygonIdCounter","generatePolygonId","defaultFillColor","r","g","b","a","defaultStrokeColor","black","arePropsEqual","prev","next","id","strokeWidth","zIndex","tappable","accessibilityLabel","fillColor","strokeColor","prevCoords","coordinates","nextCoords","length","i","latitude","longitude","prevHoles","holes","nextHoles","ph","nh","j","NitroPolygon","__DEV__","console","warn","forEach","hole","polygonId","current","buildPolygonData","arePolygonPropsEqual"],"sourceRoot":"../../../src","sources":["components/NitroPolygon.tsx"],"mappings":";;AAAA;AACA,SAASA,IAAI,EAAEC,WAAW,EAAEC,SAAS,EAAEC,MAAM,QAAQ,OAAO;AAC5D,SAASC,eAAe,QAAQ,6BAA0B;AAG1D,SACEC,UAAU,EACVC,cAAc,EAEdC,MAAM,QACD,oBAAiB;AACxB,SAASC,mBAAmB,QAAQ,wBAAqB;;AAGzD;AACA;AACA;;AA2DA;AACA,IAAIC,gBAAgB,GAAG,CAAC;AACxB,MAAMC,iBAAiB,GAAGA,CAAA,KAAc,WAAW,EAAED,gBAAgB,EAAE;;AAEvE;AACA,MAAME,gBAA6B,GAAG;EAAEC,CAAC,EAAE,CAAC;EAAEC,CAAC,EAAE,CAAC;EAAEC,CAAC,EAAE,CAAC;EAAEC,CAAC,EAAE;AAAG,CAAC,CAAC,CAAC;AACnE,MAAMC,kBAA+B,GAAGT,MAAM,CAACU,KAAK;;AAEpD;AACA,MAAMC,aAAa,GAAGA,CACpBC,IAAuB,EACvBC,IAAuB,KACX;EACZ;EACA,IACED,IAAI,CAACE,EAAE,KAAKD,IAAI,CAACC,EAAE,IACnBF,IAAI,CAACG,WAAW,KAAKF,IAAI,CAACE,WAAW,IACrCH,IAAI,CAACI,MAAM,KAAKH,IAAI,CAACG,MAAM,IAC3BJ,IAAI,CAACK,QAAQ,KAAKJ,IAAI,CAACI,QAAQ,IAC/BL,IAAI,CAACM,kBAAkB,KAAKL,IAAI,CAACK,kBAAkB,EACnD;IACA,OAAO,KAAK;EACd;EAEA,IAAI,CAACnB,cAAc,CAACa,IAAI,CAACO,SAAS,EAAEN,IAAI,CAACM,SAAS,CAAC,EAAE,OAAO,KAAK;EACjE,IAAI,CAACpB,cAAc,CAACa,IAAI,CAACQ,WAAW,EAAEP,IAAI,CAACO,WAAW,CAAC,EAAE,OAAO,KAAK;;EAErE;EACA,MAAMC,UAAU,GAAGT,IAAI,CAACU,WAAW;EACnC,MAAMC,UA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OAAO,IAAI;AACb,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMO,YAAY,gBAAGzC,IAAI,CAAC,SAASyC,YAAYA,CAAC;EACrDpB,EAAE;EACFQ,WAAW;EACXO,KAAK,GAAG,EAAE;EACVV,SAAS;EACTC,WAAW;EACXL,WAAW,GAAG,CAAC;EACfC,MAAM,GAAG,CAAC;EACVC,QAAQ,GAAG,KAAK;EAChBC;AACiB,CAAC,EAAE;EACpBvB,SAAS,CAAC,MAAM;IACd,IAAIwC,OAAO,EAAE;MACX,IAAIb,WAAW,CAACE,MAAM,GAAG,CAAC,EAAE;QAC1BY,OAAO,CAACC,IAAI,CACV,iFAAiF,GAC/E,YAAYf,WAAW,CAACE,MAAM,GAClC,CAAC;MACH;MACAvB,mBAAmB,CAACqB,WAAW,EAAE,cAAc,CAAC;MAChDO,KAAK,CAACS,OAAO,CAAC,CAACC,IAAI,EAAEd,CAAC,KACpBxB,mBAAmB,CAACsC,IAAI,EAAE,qBAAqBd,CAAC,GAAG,CACrD,CAAC;IACH;IACA;EACF,CAAC,EAAE,EAAE,CAAC;;EAEN;EACA,MAAMe,SAAS,GAAG5C,MAAM,CAACkB,EAAE,IAAIX,iBAAiB,CAAC,CAAC,CAAC,CAACsC,OAAO;;EAE3D;EACA,MAAMC,gBAAgB,GAAGhD,WAAW,CAClC,OAAoB;IAClBoB,EAAE,EAAE0B,SAAS;IACblB,WAAW;IACXO,KAAK;
|
|
1
|
+
{"version":3,"names":["memo","useCallback","useEffect","useRef","useNitroPolygon","parseColor","areColorsEqual","Colors","validateCoordinates","polygonIdCounter","generatePolygonId","defaultFillColor","r","g","b","a","defaultStrokeColor","black","arePropsEqual","prev","next","id","strokeWidth","zIndex","tappable","accessibilityLabel","fillColor","strokeColor","prevCoords","coordinates","nextCoords","length","i","latitude","longitude","prevHoles","holes","nextHoles","ph","nh","j","NitroPolygon","__DEV__","console","warn","forEach","hole","polygonId","current","buildPolygonData","map","ring","arePolygonPropsEqual"],"sourceRoot":"../../../src","sources":["components/NitroPolygon.tsx"],"mappings":";;AAAA;AACA,SAASA,IAAI,EAAEC,WAAW,EAAEC,SAAS,EAAEC,MAAM,QAAQ,OAAO;AAC5D,SAASC,eAAe,QAAQ,6BAA0B;AAG1D,SACEC,UAAU,EACVC,cAAc,EAEdC,MAAM,QACD,oBAAiB;AACxB,SAASC,mBAAmB,QAAQ,wBAAqB;;AAGzD;AACA;AACA;;AA2DA;AACA,IAAIC,gBAAgB,GAAG,CAAC;AACxB,MAAMC,iBAAiB,GAAGA,CAAA,KAAc,WAAW,EAAED,gBAAgB,EAAE;;AAEvE;AACA,MAAME,gBAA6B,GAAG;EAAEC,CAAC,EAAE,CAAC;EAAEC,CAAC,EAAE,CAAC;EAAEC,CAAC,EAAE,CAAC;EAAEC,CAAC,EAAE;AAAG,CAAC,CAAC,CAAC;AACnE,MAAMC,kBAA+B,GAAGT,MAAM,CAACU,KAAK;;AAEpD;AACA,MAAMC,aAAa,GAAGA,CACpBC,IAAuB,EACvBC,IAAuB,KACX;EACZ;EACA,IACED,IAAI,CAACE,EAAE,KAAKD,IAAI,CAACC,EAAE,IACnBF,IAAI,CAACG,WAAW,KAAKF,IAAI,CAACE,WAAW,IACrCH,IAAI,CAACI,MAAM,KAAKH,IAAI,CAACG,MAAM,IAC3BJ,IAAI,CAACK,QAAQ,KAAKJ,IAAI,CAACI,QAAQ,IAC/BL,IAAI,CAACM,kBAAkB,KAAKL,IAAI,CAACK,kBAAkB,EACnD;IACA,OAAO,KAAK;EACd;EAEA,IAAI,CAACnB,cAAc,CAACa,IAAI,CAACO,SAAS,EAAEN,IAAI,CAACM,SAAS,CAAC,EAAE,OAAO,KAAK;EACjE,IAAI,CAACpB,cAAc,CAACa,IAAI,CAACQ,WAAW,EAAEP,IAAI,CAACO,WAAW,CA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AAIf,gBAAgB;IACpDgB,WAAW,EAAEtB,UAAU,CAACsB,WAAW,CAAC,IAAIX,kBAAkB;IAC1DM,WAAW;IACXC,MAAM;IACNC,QAAQ;IACRC;EACF,CAAC,CAAC,EACF,CACEsB,SAAS,EACTlB,WAAW,EACXO,KAAK,EACLV,SAAS,EACTC,WAAW,EACXL,WAAW,EACXC,MAAM,EACNC,QAAQ,EACRC,kBAAkB,CAEtB,CAAC;;EAED;EACArB,eAAe,CAAC6C,gBAAgB,CAAC;;EAEjC;EACA,OAAO,IAAI;AACb,CAAC,EACD/B,aAAa,CAAC;AAEd,SAASA,aAAa,IAAIkC,oBAAoB;AAC9C,eAAeX,YAAY","ignoreList":[]}
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NitroMap","default","PriceMarker","ImageMarker","Marker","NitroPolyline","NitroPolygon","NitroCircle","NitroMapContext","NitroMapInitialize","IsNitroMapInitialized","getDefaultProvider","rgb","hex","Colors"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA;;AAEA;AACA,SAASA,QAAQ,EAAEC,OAAO,QAAQ,0BAAuB;;AAEzD;AACA,SAASC,WAAW,QAAQ,6BAA0B;AACtD,SAASC,WAAW,QAAQ,6BAA0B;AACtD,SAASC,MAAM,QAAQ,wBAAqB;AAC5C,SAASC,aAAa,QAAQ,+BAA4B;AAC1D,SAASC,YAAY,QAAQ,8BAA2B;AACxD,SAASC,WAAW,QAAQ,6BAA0B;;AAEtD;;AAGA,SAASC,eAAe,QAAQ,8BAA2B;
|
|
1
|
+
{"version":3,"names":["NitroMap","default","PriceMarker","ImageMarker","Marker","NitroPolyline","NitroPolygon","NitroCircle","NitroMapContext","NitroMapInitialize","IsNitroMapInitialized","getDefaultProvider","rgb","hex","Colors"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA;;AAEA;AACA,SAASA,QAAQ,EAAEC,OAAO,QAAQ,0BAAuB;;AAEzD;AACA,SAASC,WAAW,QAAQ,6BAA0B;AACtD,SAASC,WAAW,QAAQ,6BAA0B;AACtD,SAASC,MAAM,QAAQ,wBAAqB;AAC5C,SAASC,aAAa,QAAQ,+BAA4B;AAC1D,SAASC,YAAY,QAAQ,8BAA2B;AACxD,SAASC,WAAW,QAAQ,6BAA0B;;AAEtD;;AAGA,SAASC,eAAe,QAAQ,8BAA2B;AAoD3D,SACEC,kBAAkB,EAClBC,qBAAqB,EACrBC,kBAAkB,QAEb,oBAAW;;AAElB;;AASA;AACA;AACA,SAASC,GAAG,EAAEC,GAAG,EAAEC,MAAM,QAAQ,mBAAgB","ignoreList":[]}
|
|
@@ -11,7 +11,7 @@ export { NitroMapContext } from './context/NitroMapContext';
|
|
|
11
11
|
export type { NitroMapContextValue } from './context/NitroMapContext';
|
|
12
12
|
export type { Region, Coordinate, MapType, MapPressEvent, RegionChangeEvent, EdgePadding, Camera, MapBoundaries, MapStyleElement, MapStyler, MapProvider, MapStyle, MapError, Point, UserLocationChangeEvent, UserTrackingMode, } from './types/map';
|
|
13
13
|
export type { MarkerStyle, PriceMarkerStyle, MarkerColor, ImageMarkerConfig, ClusterPressEvent, ClusterConfig, ClusterStrategy, MarkerAnimation, MarkerConfig, MarkerData, MarkerDragEvent, MarkerPressEvent, } from './types/marker';
|
|
14
|
-
export type { PolylineData, PolygonData, CircleData } from './types/overlay';
|
|
14
|
+
export type { CoordinateRing, PolylineData, PolygonData, CircleData, } from './types/overlay';
|
|
15
15
|
export type { GoogleMapTheme, AppleMapTheme, YandexMapTheme, ThemeForProvider, MapTheme, } from './types/theme';
|
|
16
16
|
export { NitroMapInitialize, IsNitroMapInitialized, getDefaultProvider, type NitroMapInitConfig, } from './modules';
|
|
17
17
|
export type { PriceMarkerProps } from './components/PriceMarker';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,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AAM,qBAAqB,CAAC;AACvD,YAAY,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACrE,YAAY,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACnE,YAAY,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAIjE,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAClD,YAAY,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import type { Coordinate } from './map';
|
|
2
2
|
import type { MarkerColor } from './marker';
|
|
3
|
+
/**
|
|
4
|
+
* Wrapper struct for an array of coordinates.
|
|
5
|
+
* Used to avoid nested arrays (Coordinate[][]) which trigger a Nitrogen codegen bug
|
|
6
|
+
* where variable names collide in the generated C++ JNI bridge code.
|
|
7
|
+
*/
|
|
8
|
+
export type CoordinateRing = {
|
|
9
|
+
/** Array of coordinates forming a ring (e.g., a polygon hole boundary) */
|
|
10
|
+
coordinates: Coordinate[];
|
|
11
|
+
};
|
|
3
12
|
/**
|
|
4
13
|
* Data structure for a polyline overlay on the map.
|
|
5
14
|
* Represents a line connecting multiple geographic points.
|
|
@@ -33,8 +42,8 @@ export type PolygonData = {
|
|
|
33
42
|
id: string;
|
|
34
43
|
/** Array of geographic coordinates that form the polygon boundary */
|
|
35
44
|
coordinates: Coordinate[];
|
|
36
|
-
/**
|
|
37
|
-
holes:
|
|
45
|
+
/** Array of holes — each hole is a CoordinateRing cut out from the fill */
|
|
46
|
+
holes: CoordinateRing[];
|
|
38
47
|
/** Fill color as RGBA */
|
|
39
48
|
fillColor: MarkerColor;
|
|
40
49
|
/** Stroke color as RGBA */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"overlay.d.ts","sourceRoot":"","sources":["../../../../src/types/overlay.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;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JCoordinateRing.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include <fbjni/fbjni.h>
|
|
11
|
+
#include "CoordinateRing.hpp"
|
|
12
|
+
|
|
13
|
+
#include "Coordinate.hpp"
|
|
14
|
+
#include "JCoordinate.hpp"
|
|
15
|
+
#include <vector>
|
|
16
|
+
|
|
17
|
+
namespace margelo::nitro::nitromap {
|
|
18
|
+
|
|
19
|
+
using namespace facebook;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The C++ JNI bridge between the C++ struct "CoordinateRing" and the the Kotlin data class "CoordinateRing".
|
|
23
|
+
*/
|
|
24
|
+
struct JCoordinateRing final: public jni::JavaClass<JCoordinateRing> {
|
|
25
|
+
public:
|
|
26
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/nitromap/CoordinateRing;";
|
|
27
|
+
|
|
28
|
+
public:
|
|
29
|
+
/**
|
|
30
|
+
* Convert this Java/Kotlin-based struct to the C++ struct CoordinateRing by copying all values to C++.
|
|
31
|
+
*/
|
|
32
|
+
[[maybe_unused]]
|
|
33
|
+
[[nodiscard]]
|
|
34
|
+
CoordinateRing toCpp() const {
|
|
35
|
+
static const auto clazz = javaClassStatic();
|
|
36
|
+
static const auto fieldCoordinates = clazz->getField<jni::JArrayClass<JCoordinate>>("coordinates");
|
|
37
|
+
jni::local_ref<jni::JArrayClass<JCoordinate>> coordinates = this->getFieldValue(fieldCoordinates);
|
|
38
|
+
return CoordinateRing(
|
|
39
|
+
[&]() {
|
|
40
|
+
size_t __size = coordinates->size();
|
|
41
|
+
std::vector<Coordinate> __vector;
|
|
42
|
+
__vector.reserve(__size);
|
|
43
|
+
for (size_t __i = 0; __i < __size; __i++) {
|
|
44
|
+
auto __element = coordinates->getElement(__i);
|
|
45
|
+
__vector.push_back(__element->toCpp());
|
|
46
|
+
}
|
|
47
|
+
return __vector;
|
|
48
|
+
}()
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
public:
|
|
53
|
+
/**
|
|
54
|
+
* Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
|
|
55
|
+
*/
|
|
56
|
+
[[maybe_unused]]
|
|
57
|
+
static jni::local_ref<JCoordinateRing::javaobject> fromCpp(const CoordinateRing& value) {
|
|
58
|
+
using JSignature = JCoordinateRing(jni::alias_ref<jni::JArrayClass<JCoordinate>>);
|
|
59
|
+
static const auto clazz = javaClassStatic();
|
|
60
|
+
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
|
|
61
|
+
return create(
|
|
62
|
+
clazz,
|
|
63
|
+
[&]() {
|
|
64
|
+
size_t __size = value.coordinates.size();
|
|
65
|
+
jni::local_ref<jni::JArrayClass<JCoordinate>> __array = jni::JArrayClass<JCoordinate>::newArray(__size);
|
|
66
|
+
for (size_t __i = 0; __i < __size; __i++) {
|
|
67
|
+
const auto& __element = value.coordinates[__i];
|
|
68
|
+
auto __elementJni = JCoordinate::fromCpp(__element);
|
|
69
|
+
__array->setElement(__i, *__elementJni);
|
|
70
|
+
}
|
|
71
|
+
return __array;
|
|
72
|
+
}()
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
} // namespace margelo::nitro::nitromap
|
|
@@ -65,6 +65,8 @@ namespace margelo::nitro::nitromap { enum class MarkerAnimation; }
|
|
|
65
65
|
namespace margelo::nitro::nitromap { struct PolylineData; }
|
|
66
66
|
// Forward declaration of `PolygonData` to properly resolve imports.
|
|
67
67
|
namespace margelo::nitro::nitromap { struct PolygonData; }
|
|
68
|
+
// Forward declaration of `CoordinateRing` to properly resolve imports.
|
|
69
|
+
namespace margelo::nitro::nitromap { struct CoordinateRing; }
|
|
68
70
|
// Forward declaration of `CircleData` to properly resolve imports.
|
|
69
71
|
namespace margelo::nitro::nitromap { struct CircleData; }
|
|
70
72
|
|
|
@@ -146,6 +148,8 @@ namespace margelo::nitro::nitromap { struct CircleData; }
|
|
|
146
148
|
#include "JPolylineData.hpp"
|
|
147
149
|
#include "PolygonData.hpp"
|
|
148
150
|
#include "JPolygonData.hpp"
|
|
151
|
+
#include "CoordinateRing.hpp"
|
|
152
|
+
#include "JCoordinateRing.hpp"
|
|
149
153
|
#include "CircleData.hpp"
|
|
150
154
|
#include "JCircleData.hpp"
|
|
151
155
|
|
|
@@ -11,7 +11,9 @@
|
|
|
11
11
|
#include "PolygonData.hpp"
|
|
12
12
|
|
|
13
13
|
#include "Coordinate.hpp"
|
|
14
|
+
#include "CoordinateRing.hpp"
|
|
14
15
|
#include "JCoordinate.hpp"
|
|
16
|
+
#include "JCoordinateRing.hpp"
|
|
15
17
|
#include "JMarkerColor.hpp"
|
|
16
18
|
#include "MarkerColor.hpp"
|
|
17
19
|
#include <optional>
|
|
@@ -41,8 +43,8 @@ namespace margelo::nitro::nitromap {
|
|
|
41
43
|
jni::local_ref<jni::JString> id = this->getFieldValue(fieldId);
|
|
42
44
|
static const auto fieldCoordinates = clazz->getField<jni::JArrayClass<JCoordinate>>("coordinates");
|
|
43
45
|
jni::local_ref<jni::JArrayClass<JCoordinate>> coordinates = this->getFieldValue(fieldCoordinates);
|
|
44
|
-
static const auto fieldHoles = clazz->getField<jni::JArrayClass<
|
|
45
|
-
jni::local_ref<jni::JArrayClass<
|
|
46
|
+
static const auto fieldHoles = clazz->getField<jni::JArrayClass<JCoordinateRing>>("holes");
|
|
47
|
+
jni::local_ref<jni::JArrayClass<JCoordinateRing>> holes = this->getFieldValue(fieldHoles);
|
|
46
48
|
static const auto fieldFillColor = clazz->getField<JMarkerColor>("fillColor");
|
|
47
49
|
jni::local_ref<JMarkerColor> fillColor = this->getFieldValue(fieldFillColor);
|
|
48
50
|
static const auto fieldStrokeColor = clazz->getField<JMarkerColor>("strokeColor");
|
|
@@ -69,22 +71,13 @@ namespace margelo::nitro::nitromap {
|
|
|
69
71
|
}(),
|
|
70
72
|
[&]() {
|
|
71
73
|
size_t __size = holes->size();
|
|
72
|
-
std::vector<
|
|
74
|
+
std::vector<CoordinateRing> __vector;
|
|
73
75
|
__vector.reserve(__size);
|
|
74
76
|
for (size_t __i = 0; __i < __size; __i++) {
|
|
75
77
|
auto __element = holes->getElement(__i);
|
|
76
|
-
__vector.push_back([&]() {
|
|
77
|
-
size_t __size = __element->size();
|
|
78
|
-
std::vector<Coordinate> __vector;
|
|
79
|
-
__vector.reserve(__size);
|
|
80
|
-
for (size_t __i = 0; __i < __size; __i++) {
|
|
81
|
-
auto __element = __element->getElement(__i);
|
|
82
78
|
__vector.push_back(__element->toCpp());
|
|
83
79
|
}
|
|
84
80
|
return __vector;
|
|
85
|
-
}());
|
|
86
|
-
}
|
|
87
|
-
return __vector;
|
|
88
81
|
}(),
|
|
89
82
|
fillColor->toCpp(),
|
|
90
83
|
strokeColor->toCpp(),
|
|
@@ -101,7 +94,7 @@ namespace margelo::nitro::nitromap {
|
|
|
101
94
|
*/
|
|
102
95
|
[[maybe_unused]]
|
|
103
96
|
static jni::local_ref<JPolygonData::javaobject> fromCpp(const PolygonData& value) {
|
|
104
|
-
using JSignature = JPolygonData(jni::alias_ref<jni::JString>, jni::alias_ref<jni::JArrayClass<JCoordinate>>, jni::alias_ref<jni::JArrayClass<
|
|
97
|
+
using JSignature = JPolygonData(jni::alias_ref<jni::JString>, jni::alias_ref<jni::JArrayClass<JCoordinate>>, jni::alias_ref<jni::JArrayClass<JCoordinateRing>>, jni::alias_ref<JMarkerColor>, jni::alias_ref<JMarkerColor>, double, double, jboolean, jni::alias_ref<jni::JString>);
|
|
105
98
|
static const auto clazz = javaClassStatic();
|
|
106
99
|
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
|
|
107
100
|
return create(
|
|
@@ -119,19 +112,10 @@ namespace margelo::nitro::nitromap {
|
|
|
119
112
|
}(),
|
|
120
113
|
[&]() {
|
|
121
114
|
size_t __size = value.holes.size();
|
|
122
|
-
jni::local_ref<jni::JArrayClass<
|
|
115
|
+
jni::local_ref<jni::JArrayClass<JCoordinateRing>> __array = jni::JArrayClass<JCoordinateRing>::newArray(__size);
|
|
123
116
|
for (size_t __i = 0; __i < __size; __i++) {
|
|
124
117
|
const auto& __element = value.holes[__i];
|
|
125
|
-
auto __elementJni =
|
|
126
|
-
size_t __size = __element.size();
|
|
127
|
-
jni::local_ref<jni::JArrayClass<JCoordinate>> __array = jni::JArrayClass<JCoordinate>::newArray(__size);
|
|
128
|
-
for (size_t __i = 0; __i < __size; __i++) {
|
|
129
|
-
const auto& __element = __element[__i];
|
|
130
|
-
auto __elementJni = JCoordinate::fromCpp(__element);
|
|
131
|
-
__array->setElement(__i, *__elementJni);
|
|
132
|
-
}
|
|
133
|
-
return __array;
|
|
134
|
-
}();
|
|
118
|
+
auto __elementJni = JCoordinateRing::fromCpp(__element);
|
|
135
119
|
__array->setElement(__i, *__elementJni);
|
|
136
120
|
}
|
|
137
121
|
return __array;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// CoordinateRing.kt
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
package com.margelo.nitro.nitromap
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Represents the JavaScript object/struct "CoordinateRing".
|
|
16
|
+
*/
|
|
17
|
+
@DoNotStrip
|
|
18
|
+
@Keep
|
|
19
|
+
data class CoordinateRing(
|
|
20
|
+
@DoNotStrip
|
|
21
|
+
@Keep
|
|
22
|
+
val coordinates: Array<Coordinate>
|
|
23
|
+
) {
|
|
24
|
+
/* primary constructor */
|
|
25
|
+
|
|
26
|
+
private companion object {
|
|
27
|
+
/**
|
|
28
|
+
* Constructor called from C++
|
|
29
|
+
*/
|
|
30
|
+
@DoNotStrip
|
|
31
|
+
@Keep
|
|
32
|
+
@Suppress("unused")
|
|
33
|
+
@JvmStatic
|
|
34
|
+
private fun fromCpp(coordinates: Array<Coordinate>): CoordinateRing {
|
|
35
|
+
return CoordinateRing(coordinates)
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -25,7 +25,7 @@ data class PolygonData(
|
|
|
25
25
|
val coordinates: Array<Coordinate>,
|
|
26
26
|
@DoNotStrip
|
|
27
27
|
@Keep
|
|
28
|
-
val holes: Array<
|
|
28
|
+
val holes: Array<CoordinateRing>,
|
|
29
29
|
@DoNotStrip
|
|
30
30
|
@Keep
|
|
31
31
|
val fillColor: MarkerColor,
|
|
@@ -55,7 +55,7 @@ data class PolygonData(
|
|
|
55
55
|
@Keep
|
|
56
56
|
@Suppress("unused")
|
|
57
57
|
@JvmStatic
|
|
58
|
-
private fun fromCpp(id: String, coordinates: Array<Coordinate>, holes: Array<
|
|
58
|
+
private fun fromCpp(id: String, coordinates: Array<Coordinate>, holes: Array<CoordinateRing>, fillColor: MarkerColor, strokeColor: MarkerColor, strokeWidth: Double, zIndex: Double, tappable: Boolean, accessibilityLabel: String?): PolygonData {
|
|
59
59
|
return PolygonData(id, coordinates, holes, fillColor, strokeColor, strokeWidth, zIndex, tappable, accessibilityLabel)
|
|
60
60
|
}
|
|
61
61
|
}
|
|
@@ -16,6 +16,8 @@ namespace margelo::nitro::nitromap { struct ClusterConfig; }
|
|
|
16
16
|
namespace margelo::nitro::nitromap { struct ClusterPressEvent; }
|
|
17
17
|
// Forward declaration of `ClusterStrategy` to properly resolve imports.
|
|
18
18
|
namespace margelo::nitro::nitromap { enum class ClusterStrategy; }
|
|
19
|
+
// Forward declaration of `CoordinateRing` to properly resolve imports.
|
|
20
|
+
namespace margelo::nitro::nitromap { struct CoordinateRing; }
|
|
19
21
|
// Forward declaration of `Coordinate` to properly resolve imports.
|
|
20
22
|
namespace margelo::nitro::nitromap { struct Coordinate; }
|
|
21
23
|
// Forward declaration of `EdgePadding` to properly resolve imports.
|
|
@@ -79,6 +81,7 @@ namespace NitroMap { class HybridNitroMapSpec_cxx; }
|
|
|
79
81
|
#include "ClusterPressEvent.hpp"
|
|
80
82
|
#include "ClusterStrategy.hpp"
|
|
81
83
|
#include "Coordinate.hpp"
|
|
84
|
+
#include "CoordinateRing.hpp"
|
|
82
85
|
#include "EdgePadding.hpp"
|
|
83
86
|
#include "HybridNitroMapConfigSpec.hpp"
|
|
84
87
|
#include "HybridNitroMapSpec.hpp"
|
|
@@ -889,13 +892,13 @@ namespace margelo::nitro::nitromap::bridge::swift {
|
|
|
889
892
|
return vector;
|
|
890
893
|
}
|
|
891
894
|
|
|
892
|
-
// pragma MARK: std::vector<
|
|
895
|
+
// pragma MARK: std::vector<CoordinateRing>
|
|
893
896
|
/**
|
|
894
|
-
* Specialized version of `std::vector<
|
|
897
|
+
* Specialized version of `std::vector<CoordinateRing>`.
|
|
895
898
|
*/
|
|
896
|
-
using
|
|
897
|
-
inline std::vector<
|
|
898
|
-
std::vector<
|
|
899
|
+
using std__vector_CoordinateRing_ = std::vector<CoordinateRing>;
|
|
900
|
+
inline std::vector<CoordinateRing> create_std__vector_CoordinateRing_(size_t size) noexcept {
|
|
901
|
+
std::vector<CoordinateRing> vector;
|
|
899
902
|
vector.reserve(size);
|
|
900
903
|
return vector;
|
|
901
904
|
}
|
|
@@ -18,6 +18,8 @@ namespace margelo::nitro::nitromap { struct ClusterConfig; }
|
|
|
18
18
|
namespace margelo::nitro::nitromap { struct ClusterPressEvent; }
|
|
19
19
|
// Forward declaration of `ClusterStrategy` to properly resolve imports.
|
|
20
20
|
namespace margelo::nitro::nitromap { enum class ClusterStrategy; }
|
|
21
|
+
// Forward declaration of `CoordinateRing` to properly resolve imports.
|
|
22
|
+
namespace margelo::nitro::nitromap { struct CoordinateRing; }
|
|
21
23
|
// Forward declaration of `Coordinate` to properly resolve imports.
|
|
22
24
|
namespace margelo::nitro::nitromap { struct Coordinate; }
|
|
23
25
|
// Forward declaration of `EdgePadding` to properly resolve imports.
|
|
@@ -80,6 +82,7 @@ namespace margelo::nitro::nitromap { enum class UserTrackingMode; }
|
|
|
80
82
|
#include "ClusterPressEvent.hpp"
|
|
81
83
|
#include "ClusterStrategy.hpp"
|
|
82
84
|
#include "Coordinate.hpp"
|
|
85
|
+
#include "CoordinateRing.hpp"
|
|
83
86
|
#include "EdgePadding.hpp"
|
|
84
87
|
#include "HybridNitroMapConfigSpec.hpp"
|
|
85
88
|
#include "HybridNitroMapSpec.hpp"
|
|
@@ -70,6 +70,8 @@ namespace margelo::nitro::nitromap { enum class MarkerAnimation; }
|
|
|
70
70
|
namespace margelo::nitro::nitromap { struct PolylineData; }
|
|
71
71
|
// Forward declaration of `PolygonData` to properly resolve imports.
|
|
72
72
|
namespace margelo::nitro::nitromap { struct PolygonData; }
|
|
73
|
+
// Forward declaration of `CoordinateRing` to properly resolve imports.
|
|
74
|
+
namespace margelo::nitro::nitromap { struct CoordinateRing; }
|
|
73
75
|
// Forward declaration of `CircleData` to properly resolve imports.
|
|
74
76
|
namespace margelo::nitro::nitromap { struct CircleData; }
|
|
75
77
|
|
|
@@ -108,6 +110,7 @@ namespace margelo::nitro::nitromap { struct CircleData; }
|
|
|
108
110
|
#include "MarkerAnimation.hpp"
|
|
109
111
|
#include "PolylineData.hpp"
|
|
110
112
|
#include "PolygonData.hpp"
|
|
113
|
+
#include "CoordinateRing.hpp"
|
|
111
114
|
#include "CircleData.hpp"
|
|
112
115
|
|
|
113
116
|
#include "NitroMap-Swift-Cxx-Umbrella.hpp"
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// CoordinateRing.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
import NitroModules
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Represents an instance of `CoordinateRing`, backed by a C++ struct.
|
|
13
|
+
*/
|
|
14
|
+
public typealias CoordinateRing = margelo.nitro.nitromap.CoordinateRing
|
|
15
|
+
|
|
16
|
+
public extension CoordinateRing {
|
|
17
|
+
private typealias bridge = margelo.nitro.nitromap.bridge.swift
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Create a new instance of `CoordinateRing`.
|
|
21
|
+
*/
|
|
22
|
+
init(coordinates: [Coordinate]) {
|
|
23
|
+
self.init({ () -> bridge.std__vector_Coordinate_ in
|
|
24
|
+
var __vector = bridge.create_std__vector_Coordinate_(coordinates.count)
|
|
25
|
+
for __item in coordinates {
|
|
26
|
+
__vector.push_back(__item)
|
|
27
|
+
}
|
|
28
|
+
return __vector
|
|
29
|
+
}())
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
var coordinates: [Coordinate] {
|
|
33
|
+
@inline(__always)
|
|
34
|
+
get {
|
|
35
|
+
return self.__coordinates.map({ __item in __item })
|
|
36
|
+
}
|
|
37
|
+
@inline(__always)
|
|
38
|
+
set {
|
|
39
|
+
self.__coordinates = { () -> bridge.std__vector_Coordinate_ in
|
|
40
|
+
var __vector = bridge.create_std__vector_Coordinate_(newValue.count)
|
|
41
|
+
for __item in newValue {
|
|
42
|
+
__vector.push_back(__item)
|
|
43
|
+
}
|
|
44
|
+
return __vector
|
|
45
|
+
}()
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -19,23 +19,17 @@ public extension PolygonData {
|
|
|
19
19
|
/**
|
|
20
20
|
* Create a new instance of `PolygonData`.
|
|
21
21
|
*/
|
|
22
|
-
init(id: String, coordinates: [Coordinate], holes: [
|
|
22
|
+
init(id: String, coordinates: [Coordinate], holes: [CoordinateRing], fillColor: MarkerColor, strokeColor: MarkerColor, strokeWidth: Double, zIndex: Double, tappable: Bool, accessibilityLabel: String?) {
|
|
23
23
|
self.init(std.string(id), { () -> bridge.std__vector_Coordinate_ in
|
|
24
24
|
var __vector = bridge.create_std__vector_Coordinate_(coordinates.count)
|
|
25
25
|
for __item in coordinates {
|
|
26
26
|
__vector.push_back(__item)
|
|
27
27
|
}
|
|
28
28
|
return __vector
|
|
29
|
-
}(), { () -> bridge.
|
|
30
|
-
var __vector = bridge.
|
|
29
|
+
}(), { () -> bridge.std__vector_CoordinateRing_ in
|
|
30
|
+
var __vector = bridge.create_std__vector_CoordinateRing_(holes.count)
|
|
31
31
|
for __item in holes {
|
|
32
|
-
__vector.push_back(
|
|
33
|
-
var __vector = bridge.create_std__vector_Coordinate_(__item.count)
|
|
34
|
-
for __item in __item {
|
|
35
|
-
__vector.push_back(__item)
|
|
36
|
-
}
|
|
37
|
-
return __vector
|
|
38
|
-
}())
|
|
32
|
+
__vector.push_back(__item)
|
|
39
33
|
}
|
|
40
34
|
return __vector
|
|
41
35
|
}(), fillColor, strokeColor, strokeWidth, zIndex, tappable, { () -> bridge.std__optional_std__string_ in
|
|
@@ -75,23 +69,17 @@ public extension PolygonData {
|
|
|
75
69
|
}
|
|
76
70
|
}
|
|
77
71
|
|
|
78
|
-
var holes: [
|
|
72
|
+
var holes: [CoordinateRing] {
|
|
79
73
|
@inline(__always)
|
|
80
74
|
get {
|
|
81
|
-
return self.__holes.map({ __item in __item
|
|
75
|
+
return self.__holes.map({ __item in __item })
|
|
82
76
|
}
|
|
83
77
|
@inline(__always)
|
|
84
78
|
set {
|
|
85
|
-
self.__holes = { () -> bridge.
|
|
86
|
-
var __vector = bridge.
|
|
79
|
+
self.__holes = { () -> bridge.std__vector_CoordinateRing_ in
|
|
80
|
+
var __vector = bridge.create_std__vector_CoordinateRing_(newValue.count)
|
|
87
81
|
for __item in newValue {
|
|
88
|
-
__vector.push_back(
|
|
89
|
-
var __vector = bridge.create_std__vector_Coordinate_(__item.count)
|
|
90
|
-
for __item in __item {
|
|
91
|
-
__vector.push_back(__item)
|
|
92
|
-
}
|
|
93
|
-
return __vector
|
|
94
|
-
}())
|
|
82
|
+
__vector.push_back(__item)
|
|
95
83
|
}
|
|
96
84
|
return __vector
|
|
97
85
|
}()
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// CoordinateRing.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
|
21
|
+
#include <NitroModules/JSIHelpers.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
|
|
26
|
+
// Forward declaration of `Coordinate` to properly resolve imports.
|
|
27
|
+
namespace margelo::nitro::nitromap { struct Coordinate; }
|
|
28
|
+
|
|
29
|
+
#include "Coordinate.hpp"
|
|
30
|
+
#include <vector>
|
|
31
|
+
|
|
32
|
+
namespace margelo::nitro::nitromap {
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* A struct which can be represented as a JavaScript object (CoordinateRing).
|
|
36
|
+
*/
|
|
37
|
+
struct CoordinateRing {
|
|
38
|
+
public:
|
|
39
|
+
std::vector<Coordinate> coordinates SWIFT_PRIVATE;
|
|
40
|
+
|
|
41
|
+
public:
|
|
42
|
+
CoordinateRing() = default;
|
|
43
|
+
explicit CoordinateRing(std::vector<Coordinate> coordinates): coordinates(coordinates) {}
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
} // namespace margelo::nitro::nitromap
|
|
47
|
+
|
|
48
|
+
namespace margelo::nitro {
|
|
49
|
+
|
|
50
|
+
// C++ CoordinateRing <> JS CoordinateRing (object)
|
|
51
|
+
template <>
|
|
52
|
+
struct JSIConverter<margelo::nitro::nitromap::CoordinateRing> final {
|
|
53
|
+
static inline margelo::nitro::nitromap::CoordinateRing fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
54
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
55
|
+
return margelo::nitro::nitromap::CoordinateRing(
|
|
56
|
+
JSIConverter<std::vector<margelo::nitro::nitromap::Coordinate>>::fromJSI(runtime, obj.getProperty(runtime, "coordinates"))
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::nitromap::CoordinateRing& arg) {
|
|
60
|
+
jsi::Object obj(runtime);
|
|
61
|
+
obj.setProperty(runtime, "coordinates", JSIConverter<std::vector<margelo::nitro::nitromap::Coordinate>>::toJSI(runtime, arg.coordinates));
|
|
62
|
+
return obj;
|
|
63
|
+
}
|
|
64
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
65
|
+
if (!value.isObject()) {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
jsi::Object obj = value.getObject(runtime);
|
|
69
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
if (!JSIConverter<std::vector<margelo::nitro::nitromap::Coordinate>>::canConvert(runtime, obj.getProperty(runtime, "coordinates"))) return false;
|
|
73
|
+
return true;
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
} // namespace margelo::nitro
|
|
@@ -25,12 +25,15 @@
|
|
|
25
25
|
|
|
26
26
|
// Forward declaration of `Coordinate` to properly resolve imports.
|
|
27
27
|
namespace margelo::nitro::nitromap { struct Coordinate; }
|
|
28
|
+
// Forward declaration of `CoordinateRing` to properly resolve imports.
|
|
29
|
+
namespace margelo::nitro::nitromap { struct CoordinateRing; }
|
|
28
30
|
// Forward declaration of `MarkerColor` to properly resolve imports.
|
|
29
31
|
namespace margelo::nitro::nitromap { struct MarkerColor; }
|
|
30
32
|
|
|
31
33
|
#include <string>
|
|
32
34
|
#include "Coordinate.hpp"
|
|
33
35
|
#include <vector>
|
|
36
|
+
#include "CoordinateRing.hpp"
|
|
34
37
|
#include "MarkerColor.hpp"
|
|
35
38
|
#include <optional>
|
|
36
39
|
|
|
@@ -43,7 +46,7 @@ namespace margelo::nitro::nitromap {
|
|
|
43
46
|
public:
|
|
44
47
|
std::string id SWIFT_PRIVATE;
|
|
45
48
|
std::vector<Coordinate> coordinates SWIFT_PRIVATE;
|
|
46
|
-
std::vector<
|
|
49
|
+
std::vector<CoordinateRing> holes SWIFT_PRIVATE;
|
|
47
50
|
MarkerColor fillColor SWIFT_PRIVATE;
|
|
48
51
|
MarkerColor strokeColor SWIFT_PRIVATE;
|
|
49
52
|
double strokeWidth SWIFT_PRIVATE;
|
|
@@ -53,7 +56,7 @@ namespace margelo::nitro::nitromap {
|
|
|
53
56
|
|
|
54
57
|
public:
|
|
55
58
|
PolygonData() = default;
|
|
56
|
-
explicit PolygonData(std::string id, std::vector<Coordinate> coordinates, std::vector<
|
|
59
|
+
explicit PolygonData(std::string id, std::vector<Coordinate> coordinates, std::vector<CoordinateRing> holes, MarkerColor fillColor, MarkerColor strokeColor, double strokeWidth, double zIndex, bool tappable, std::optional<std::string> accessibilityLabel): id(id), coordinates(coordinates), holes(holes), fillColor(fillColor), strokeColor(strokeColor), strokeWidth(strokeWidth), zIndex(zIndex), tappable(tappable), accessibilityLabel(accessibilityLabel) {}
|
|
57
60
|
};
|
|
58
61
|
|
|
59
62
|
} // namespace margelo::nitro::nitromap
|
|
@@ -68,7 +71,7 @@ namespace margelo::nitro {
|
|
|
68
71
|
return margelo::nitro::nitromap::PolygonData(
|
|
69
72
|
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "id")),
|
|
70
73
|
JSIConverter<std::vector<margelo::nitro::nitromap::Coordinate>>::fromJSI(runtime, obj.getProperty(runtime, "coordinates")),
|
|
71
|
-
JSIConverter<std::vector<
|
|
74
|
+
JSIConverter<std::vector<margelo::nitro::nitromap::CoordinateRing>>::fromJSI(runtime, obj.getProperty(runtime, "holes")),
|
|
72
75
|
JSIConverter<margelo::nitro::nitromap::MarkerColor>::fromJSI(runtime, obj.getProperty(runtime, "fillColor")),
|
|
73
76
|
JSIConverter<margelo::nitro::nitromap::MarkerColor>::fromJSI(runtime, obj.getProperty(runtime, "strokeColor")),
|
|
74
77
|
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "strokeWidth")),
|
|
@@ -81,7 +84,7 @@ namespace margelo::nitro {
|
|
|
81
84
|
jsi::Object obj(runtime);
|
|
82
85
|
obj.setProperty(runtime, "id", JSIConverter<std::string>::toJSI(runtime, arg.id));
|
|
83
86
|
obj.setProperty(runtime, "coordinates", JSIConverter<std::vector<margelo::nitro::nitromap::Coordinate>>::toJSI(runtime, arg.coordinates));
|
|
84
|
-
obj.setProperty(runtime, "holes", JSIConverter<std::vector<
|
|
87
|
+
obj.setProperty(runtime, "holes", JSIConverter<std::vector<margelo::nitro::nitromap::CoordinateRing>>::toJSI(runtime, arg.holes));
|
|
85
88
|
obj.setProperty(runtime, "fillColor", JSIConverter<margelo::nitro::nitromap::MarkerColor>::toJSI(runtime, arg.fillColor));
|
|
86
89
|
obj.setProperty(runtime, "strokeColor", JSIConverter<margelo::nitro::nitromap::MarkerColor>::toJSI(runtime, arg.strokeColor));
|
|
87
90
|
obj.setProperty(runtime, "strokeWidth", JSIConverter<double>::toJSI(runtime, arg.strokeWidth));
|
|
@@ -100,7 +103,7 @@ namespace margelo::nitro {
|
|
|
100
103
|
}
|
|
101
104
|
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "id"))) return false;
|
|
102
105
|
if (!JSIConverter<std::vector<margelo::nitro::nitromap::Coordinate>>::canConvert(runtime, obj.getProperty(runtime, "coordinates"))) return false;
|
|
103
|
-
if (!JSIConverter<std::vector<
|
|
106
|
+
if (!JSIConverter<std::vector<margelo::nitro::nitromap::CoordinateRing>>::canConvert(runtime, obj.getProperty(runtime, "holes"))) return false;
|
|
104
107
|
if (!JSIConverter<margelo::nitro::nitromap::MarkerColor>::canConvert(runtime, obj.getProperty(runtime, "fillColor"))) return false;
|
|
105
108
|
if (!JSIConverter<margelo::nitro::nitromap::MarkerColor>::canConvert(runtime, obj.getProperty(runtime, "strokeColor"))) return false;
|
|
106
109
|
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "strokeWidth"))) return false;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maydon_tech/react-native-nitro-maps",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "A high-performance React Native map library powered by Nitro Modules with support for Apple Maps, Google Maps, and Yandex Maps. Features native clustering, custom markers, and seamless cross-platform integration.",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
6
|
"types": "./lib/typescript/src/index.d.ts",
|
|
@@ -196,7 +196,7 @@ export const NitroPolygon = memo(function NitroPolygon({
|
|
|
196
196
|
(): PolygonData => ({
|
|
197
197
|
id: polygonId,
|
|
198
198
|
coordinates,
|
|
199
|
-
holes,
|
|
199
|
+
holes: holes.map((ring) => ({ coordinates: ring })),
|
|
200
200
|
fillColor: parseColor(fillColor) ?? defaultFillColor,
|
|
201
201
|
strokeColor: parseColor(strokeColor) ?? defaultStrokeColor,
|
|
202
202
|
strokeWidth,
|
package/src/index.tsx
CHANGED
|
@@ -51,7 +51,12 @@ export type {
|
|
|
51
51
|
MarkerPressEvent,
|
|
52
52
|
} from './types/marker';
|
|
53
53
|
|
|
54
|
-
export type {
|
|
54
|
+
export type {
|
|
55
|
+
CoordinateRing,
|
|
56
|
+
PolylineData,
|
|
57
|
+
PolygonData,
|
|
58
|
+
CircleData,
|
|
59
|
+
} from './types/overlay';
|
|
55
60
|
|
|
56
61
|
export type {
|
|
57
62
|
GoogleMapTheme,
|
package/src/types/overlay.ts
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import type { Coordinate } from './map';
|
|
2
2
|
import type { MarkerColor } from './marker';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Wrapper struct for an array of coordinates.
|
|
6
|
+
* Used to avoid nested arrays (Coordinate[][]) which trigger a Nitrogen codegen bug
|
|
7
|
+
* where variable names collide in the generated C++ JNI bridge code.
|
|
8
|
+
*/
|
|
9
|
+
export type CoordinateRing = {
|
|
10
|
+
/** Array of coordinates forming a ring (e.g., a polygon hole boundary) */
|
|
11
|
+
coordinates: Coordinate[];
|
|
12
|
+
};
|
|
13
|
+
|
|
4
14
|
/**
|
|
5
15
|
* Data structure for a polyline overlay on the map.
|
|
6
16
|
* Represents a line connecting multiple geographic points.
|
|
@@ -35,8 +45,8 @@ export type PolygonData = {
|
|
|
35
45
|
id: string;
|
|
36
46
|
/** Array of geographic coordinates that form the polygon boundary */
|
|
37
47
|
coordinates: Coordinate[];
|
|
38
|
-
/**
|
|
39
|
-
holes:
|
|
48
|
+
/** Array of holes — each hole is a CoordinateRing cut out from the fill */
|
|
49
|
+
holes: CoordinateRing[];
|
|
40
50
|
/** Fill color as RGBA */
|
|
41
51
|
fillColor: MarkerColor;
|
|
42
52
|
/** Stroke color as RGBA */
|