@granite-js/naver-map 1.0.0
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/CHANGELOG.md +7 -0
- package/GraniteNaverMap.podspec +81 -0
- package/android/build.gradle +160 -0
- package/android/gradle.properties +5 -0
- package/android/src/builtinProvider/java/run/granite/navermap/builtinProvider/BuiltInGraniteNaverMapProvider.kt +549 -0
- package/android/src/main/AndroidManifest.xml +3 -0
- package/android/src/main/java/run/granite/navermap/GraniteNaverMapEvents.kt +91 -0
- package/android/src/main/java/run/granite/navermap/GraniteNaverMapPackage.kt +16 -0
- package/android/src/main/java/run/granite/navermap/GraniteNaverMapProvider.kt +242 -0
- package/android/src/main/java/run/granite/navermap/GraniteNaverMapRegistry.kt +116 -0
- package/android/src/main/java/run/granite/navermap/GraniteNaverMapView.kt +732 -0
- package/android/src/newarch/java/run/granite/navermap/GraniteNaverMapViewManager.kt +446 -0
- package/android/src/oldarch/java/run/granite/navermap/GraniteNaverMapViewManager.kt +249 -0
- package/dist/module/NaverMapView.js +110 -0
- package/dist/module/NaverMapView.js.map +1 -0
- package/dist/module/index.js +6 -0
- package/dist/module/index.js.map +1 -0
- package/dist/module/internals/colorUtils.js +624 -0
- package/dist/module/internals/colorUtils.js.map +1 -0
- package/dist/module/internals/context.js +8 -0
- package/dist/module/internals/context.js.map +1 -0
- package/dist/module/internals/id.js +10 -0
- package/dist/module/internals/id.js.map +1 -0
- package/dist/module/internals/useMapOverlay.js +44 -0
- package/dist/module/internals/useMapOverlay.js.map +1 -0
- package/dist/module/internals/usePreservedReference.js +36 -0
- package/dist/module/internals/usePreservedReference.js.map +1 -0
- package/dist/module/overlays/ArrowheadPath.js +37 -0
- package/dist/module/overlays/ArrowheadPath.js.map +1 -0
- package/dist/module/overlays/Circle.js +35 -0
- package/dist/module/overlays/Circle.js.map +1 -0
- package/dist/module/overlays/GroundOverlay.js +30 -0
- package/dist/module/overlays/GroundOverlay.js.map +1 -0
- package/dist/module/overlays/InfoWindow.js +32 -0
- package/dist/module/overlays/InfoWindow.js.map +1 -0
- package/dist/module/overlays/Marker.js +37 -0
- package/dist/module/overlays/Marker.js.map +1 -0
- package/dist/module/overlays/Path.js +41 -0
- package/dist/module/overlays/Path.js.map +1 -0
- package/dist/module/overlays/Polygon.js +51 -0
- package/dist/module/overlays/Polygon.js.map +1 -0
- package/dist/module/overlays/Polyline.js +60 -0
- package/dist/module/overlays/Polyline.js.map +1 -0
- package/dist/module/overlays/index.js +11 -0
- package/dist/module/overlays/index.js.map +1 -0
- package/dist/module/package.json +1 -0
- package/dist/module/specs/GraniteNaverMapViewNativeComponent.ts +352 -0
- package/dist/module/types/Coord.js +2 -0
- package/dist/module/types/Coord.js.map +1 -0
- package/dist/module/types/index.js +29 -0
- package/dist/module/types/index.js.map +1 -0
- package/dist/typescript/NaverMapView.d.ts +41 -0
- package/dist/typescript/index.d.ts +3 -0
- package/dist/typescript/internals/colorUtils.d.ts +10 -0
- package/dist/typescript/internals/context.d.ts +8 -0
- package/dist/typescript/internals/id.d.ts +1 -0
- package/dist/typescript/internals/useMapOverlay.d.ts +15 -0
- package/dist/typescript/internals/usePreservedReference.d.ts +6 -0
- package/dist/typescript/overlays/ArrowheadPath.d.ts +11 -0
- package/dist/typescript/overlays/Circle.d.ts +10 -0
- package/dist/typescript/overlays/GroundOverlay.d.ts +11 -0
- package/dist/typescript/overlays/InfoWindow.d.ts +14 -0
- package/dist/typescript/overlays/Marker.d.ts +16 -0
- package/dist/typescript/overlays/Path.d.ts +15 -0
- package/dist/typescript/overlays/Polygon.d.ts +10 -0
- package/dist/typescript/overlays/Polyline.d.ts +11 -0
- package/dist/typescript/overlays/index.d.ts +16 -0
- package/dist/typescript/specs/GraniteNaverMapViewNativeComponent.d.ts +92 -0
- package/dist/typescript/types/Coord.d.ts +4 -0
- package/dist/typescript/types/index.d.ts +55 -0
- package/ios/GraniteNaverMap-Bridging-Header.h +20 -0
- package/ios/GraniteNaverMapProvider.swift +312 -0
- package/ios/GraniteNaverMapRegistry.swift +91 -0
- package/ios/GraniteNaverMapView.h +15 -0
- package/ios/GraniteNaverMapView.mm +390 -0
- package/ios/GraniteNaverMapViewImpl.swift +496 -0
- package/ios/GraniteNaverMapViewManager.m +67 -0
- package/ios/GraniteNaverMapViewManager.swift +133 -0
- package/ios/GraniteNaverMapViewWrapper.swift +215 -0
- package/ios/builtinProvider/BuiltInNaverMapProvider.swift +489 -0
- package/ios/builtinProvider/GraniteNaverMapMarkerData.swift +66 -0
- package/ios/builtinProvider/NMFMarker+Extension.swift +65 -0
- package/ios/builtinProvider/RCTConvert+NMFMapView.h +17 -0
- package/ios/builtinProvider/RCTConvert+NMFMapView.m +67 -0
- package/package.json +103 -0
- package/src/NaverMapView.tsx +168 -0
- package/src/index.tsx +3 -0
- package/src/internals/colorUtils.ts +697 -0
- package/src/internals/context.ts +14 -0
- package/src/internals/id.ts +9 -0
- package/src/internals/useMapOverlay.ts +59 -0
- package/src/internals/usePreservedReference.ts +41 -0
- package/src/overlays/ArrowheadPath.ts +71 -0
- package/src/overlays/Circle.ts +68 -0
- package/src/overlays/GroundOverlay.ts +62 -0
- package/src/overlays/InfoWindow.ts +68 -0
- package/src/overlays/Marker.ts +83 -0
- package/src/overlays/Path.ts +87 -0
- package/src/overlays/Polygon.ts +83 -0
- package/src/overlays/Polyline.ts +93 -0
- package/src/overlays/index.ts +23 -0
- package/src/specs/GraniteNaverMapViewNativeComponent.ts +352 -0
- package/src/types/Coord.ts +4 -0
- package/src/types/index.ts +78 -0
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import type { HostComponent, ViewProps } from 'react-native';
|
|
2
|
+
import type { DirectEventHandler, Double, Float, Int32, WithDefault } from 'react-native/Libraries/Types/CodegenTypes';
|
|
3
|
+
export type OnCameraChangeEvent = Readonly<{
|
|
4
|
+
latitude: Double;
|
|
5
|
+
longitude: Double;
|
|
6
|
+
zoom: Double;
|
|
7
|
+
}>;
|
|
8
|
+
export type OnTouchEvent = Readonly<{
|
|
9
|
+
reason: Int32;
|
|
10
|
+
animated: boolean;
|
|
11
|
+
}>;
|
|
12
|
+
export type OnMapClickEvent = Readonly<{
|
|
13
|
+
x: Double;
|
|
14
|
+
y: Double;
|
|
15
|
+
latitude: Double;
|
|
16
|
+
longitude: Double;
|
|
17
|
+
}>;
|
|
18
|
+
export type OnMarkerClickEvent = Readonly<{
|
|
19
|
+
id: string;
|
|
20
|
+
}>;
|
|
21
|
+
export type OnInitializedEvent = Readonly<{}>;
|
|
22
|
+
type CenterProp = Readonly<{
|
|
23
|
+
latitude: Double;
|
|
24
|
+
longitude: Double;
|
|
25
|
+
zoom?: Double;
|
|
26
|
+
tilt?: Double;
|
|
27
|
+
bearing?: Double;
|
|
28
|
+
}>;
|
|
29
|
+
type PaddingProp = Readonly<{
|
|
30
|
+
top?: Double;
|
|
31
|
+
left?: Double;
|
|
32
|
+
bottom?: Double;
|
|
33
|
+
right?: Double;
|
|
34
|
+
}>;
|
|
35
|
+
export interface NativeProps extends ViewProps {
|
|
36
|
+
center?: CenterProp;
|
|
37
|
+
showsMyLocationButton?: boolean;
|
|
38
|
+
compass?: boolean;
|
|
39
|
+
scaleBar?: boolean;
|
|
40
|
+
zoomControl?: boolean;
|
|
41
|
+
mapType?: WithDefault<Int32, 0>;
|
|
42
|
+
minZoomLevel?: WithDefault<Double, 0>;
|
|
43
|
+
maxZoomLevel?: WithDefault<Double, 21>;
|
|
44
|
+
buildingHeight?: WithDefault<Float, 1>;
|
|
45
|
+
nightMode?: boolean;
|
|
46
|
+
mapPadding?: PaddingProp;
|
|
47
|
+
locationTrackingMode?: WithDefault<Int32, 0>;
|
|
48
|
+
scrollGesturesEnabled?: WithDefault<boolean, true>;
|
|
49
|
+
zoomGesturesEnabled?: WithDefault<boolean, true>;
|
|
50
|
+
tiltGesturesEnabled?: WithDefault<boolean, true>;
|
|
51
|
+
rotateGesturesEnabled?: WithDefault<boolean, true>;
|
|
52
|
+
stopGesturesEnabled?: WithDefault<boolean, true>;
|
|
53
|
+
onInitialized?: DirectEventHandler<OnInitializedEvent>;
|
|
54
|
+
onCameraChange?: DirectEventHandler<OnCameraChangeEvent>;
|
|
55
|
+
onTouch?: DirectEventHandler<OnTouchEvent>;
|
|
56
|
+
onMapClick?: DirectEventHandler<OnMapClickEvent>;
|
|
57
|
+
onMarkerClick?: DirectEventHandler<OnMarkerClickEvent>;
|
|
58
|
+
}
|
|
59
|
+
type ComponentType = HostComponent<NativeProps>;
|
|
60
|
+
interface NativeCommands {
|
|
61
|
+
animateToCoordinate: (viewRef: React.ElementRef<ComponentType>, latitude: Double, longitude: Double) => void;
|
|
62
|
+
animateToTwoCoordinates: (viewRef: React.ElementRef<ComponentType>, lat1: Double, lng1: Double, lat2: Double, lng2: Double) => void;
|
|
63
|
+
animateToRegion: (viewRef: React.ElementRef<ComponentType>, latitude: Double, longitude: Double, latitudeDelta: Double, longitudeDelta: Double) => void;
|
|
64
|
+
setLayerGroupEnabled: (viewRef: React.ElementRef<ComponentType>, group: string, enabled: boolean) => void;
|
|
65
|
+
addMarker: (viewRef: React.ElementRef<ComponentType>, identifier: string, latitude: Double, longitude: Double, width: Int32, height: Int32, zIndex: Int32, rotation: Float, flat: boolean, alpha: Float, pinColor: Int32, image: string) => void;
|
|
66
|
+
updateMarker: (viewRef: React.ElementRef<ComponentType>, identifier: string, latitude: Double, longitude: Double, width: Int32, height: Int32, zIndex: Int32, rotation: Float, flat: boolean, alpha: Float, pinColor: Int32, image: string) => void;
|
|
67
|
+
removeMarker: (viewRef: React.ElementRef<ComponentType>, identifier: string) => void;
|
|
68
|
+
addPolyline: (viewRef: React.ElementRef<ComponentType>, identifier: string, coordsJson: string, strokeWidth: Float, strokeColor: Int32, zIndex: Int32, lineCap: Int32, lineJoin: Int32, patternJson: string) => void;
|
|
69
|
+
updatePolyline: (viewRef: React.ElementRef<ComponentType>, identifier: string, coordsJson: string, strokeWidth: Float, strokeColor: Int32, zIndex: Int32, lineCap: Int32, lineJoin: Int32, patternJson: string) => void;
|
|
70
|
+
removePolyline: (viewRef: React.ElementRef<ComponentType>, identifier: string) => void;
|
|
71
|
+
addPolygon: (viewRef: React.ElementRef<ComponentType>, identifier: string, coordsJson: string, holesJson: string, fillColor: Int32, strokeColor: Int32, strokeWidth: Float, zIndex: Int32) => void;
|
|
72
|
+
updatePolygon: (viewRef: React.ElementRef<ComponentType>, identifier: string, coordsJson: string, holesJson: string, fillColor: Int32, strokeColor: Int32, strokeWidth: Float, zIndex: Int32) => void;
|
|
73
|
+
removePolygon: (viewRef: React.ElementRef<ComponentType>, identifier: string) => void;
|
|
74
|
+
addCircle: (viewRef: React.ElementRef<ComponentType>, identifier: string, latitude: Double, longitude: Double, radius: Double, fillColor: Int32, strokeColor: Int32, strokeWidth: Float, zIndex: Int32) => void;
|
|
75
|
+
updateCircle: (viewRef: React.ElementRef<ComponentType>, identifier: string, latitude: Double, longitude: Double, radius: Double, fillColor: Int32, strokeColor: Int32, strokeWidth: Float, zIndex: Int32) => void;
|
|
76
|
+
removeCircle: (viewRef: React.ElementRef<ComponentType>, identifier: string) => void;
|
|
77
|
+
addPath: (viewRef: React.ElementRef<ComponentType>, identifier: string, coordsJson: string, width: Float, outlineWidth: Float, color: Int32, outlineColor: Int32, passedColor: Int32, passedOutlineColor: Int32, patternImage: string, patternInterval: Int32, progress: Float, zIndex: Int32) => void;
|
|
78
|
+
updatePath: (viewRef: React.ElementRef<ComponentType>, identifier: string, coordsJson: string, width: Float, outlineWidth: Float, color: Int32, outlineColor: Int32, passedColor: Int32, passedOutlineColor: Int32, patternImage: string, patternInterval: Int32, progress: Float, zIndex: Int32) => void;
|
|
79
|
+
removePath: (viewRef: React.ElementRef<ComponentType>, identifier: string) => void;
|
|
80
|
+
addArrowheadPath: (viewRef: React.ElementRef<ComponentType>, identifier: string, coordsJson: string, width: Float, outlineWidth: Float, color: Int32, outlineColor: Int32, headSizeRatio: Float, zIndex: Int32) => void;
|
|
81
|
+
updateArrowheadPath: (viewRef: React.ElementRef<ComponentType>, identifier: string, coordsJson: string, width: Float, outlineWidth: Float, color: Int32, outlineColor: Int32, headSizeRatio: Float, zIndex: Int32) => void;
|
|
82
|
+
removeArrowheadPath: (viewRef: React.ElementRef<ComponentType>, identifier: string) => void;
|
|
83
|
+
addGroundOverlay: (viewRef: React.ElementRef<ComponentType>, identifier: string, southWestLat: Double, southWestLng: Double, northEastLat: Double, northEastLng: Double, image: string, alpha: Float, zIndex: Int32) => void;
|
|
84
|
+
updateGroundOverlay: (viewRef: React.ElementRef<ComponentType>, identifier: string, southWestLat: Double, southWestLng: Double, northEastLat: Double, northEastLng: Double, image: string, alpha: Float, zIndex: Int32) => void;
|
|
85
|
+
removeGroundOverlay: (viewRef: React.ElementRef<ComponentType>, identifier: string) => void;
|
|
86
|
+
addInfoWindow: (viewRef: React.ElementRef<ComponentType>, identifier: string, latitude: Double, longitude: Double, text: string, alpha: Float, zIndex: Int32, offsetX: Int32, offsetY: Int32) => void;
|
|
87
|
+
updateInfoWindow: (viewRef: React.ElementRef<ComponentType>, identifier: string, latitude: Double, longitude: Double, text: string, alpha: Float, zIndex: Int32, offsetX: Int32, offsetY: Int32) => void;
|
|
88
|
+
removeInfoWindow: (viewRef: React.ElementRef<ComponentType>, identifier: string) => void;
|
|
89
|
+
}
|
|
90
|
+
export declare const Commands: NativeCommands;
|
|
91
|
+
declare const _default: ComponentType;
|
|
92
|
+
export default _default;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { NativeSyntheticEvent } from 'react-native';
|
|
2
|
+
import type { OnCameraChangeEvent, OnTouchEvent, OnMapClickEvent, OnMarkerClickEvent } from '../specs/GraniteNaverMapViewNativeComponent';
|
|
3
|
+
export * from './Coord';
|
|
4
|
+
/**
|
|
5
|
+
* Camera change event data
|
|
6
|
+
*/
|
|
7
|
+
export interface CameraChangeEvent {
|
|
8
|
+
latitude: number;
|
|
9
|
+
longitude: number;
|
|
10
|
+
zoom: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Touch event data
|
|
14
|
+
*/
|
|
15
|
+
export interface TouchEvent {
|
|
16
|
+
reason: number;
|
|
17
|
+
animated: boolean;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Map click event data
|
|
21
|
+
*/
|
|
22
|
+
export interface MapClickEvent {
|
|
23
|
+
x: number;
|
|
24
|
+
y: number;
|
|
25
|
+
latitude: number;
|
|
26
|
+
longitude: number;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Marker click event data
|
|
30
|
+
*/
|
|
31
|
+
export interface MarkerClickEvent {
|
|
32
|
+
id: string;
|
|
33
|
+
}
|
|
34
|
+
export interface NaverMapViewProps {
|
|
35
|
+
/**
|
|
36
|
+
* Callback when map is initialized
|
|
37
|
+
*/
|
|
38
|
+
onInitialized?: () => void;
|
|
39
|
+
/**
|
|
40
|
+
* Callback when camera changes
|
|
41
|
+
*/
|
|
42
|
+
onCameraChange?: (event: NativeSyntheticEvent<OnCameraChangeEvent>) => void;
|
|
43
|
+
/**
|
|
44
|
+
* Callback when map is touched
|
|
45
|
+
*/
|
|
46
|
+
onTouch?: (event: NativeSyntheticEvent<OnTouchEvent>) => void;
|
|
47
|
+
/**
|
|
48
|
+
* Callback when map is clicked
|
|
49
|
+
*/
|
|
50
|
+
onMapClick?: (event: NativeSyntheticEvent<OnMapClickEvent>) => void;
|
|
51
|
+
/**
|
|
52
|
+
* Callback when marker is clicked
|
|
53
|
+
*/
|
|
54
|
+
onMarkerClick?: (event: NativeSyntheticEvent<OnMarkerClickEvent>) => void;
|
|
55
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//
|
|
2
|
+
// GraniteNaverMap-Bridging-Header.h
|
|
3
|
+
// granite-naver-map
|
|
4
|
+
//
|
|
5
|
+
|
|
6
|
+
#import <React/RCTBridgeModule.h>
|
|
7
|
+
#import <React/RCTViewManager.h>
|
|
8
|
+
#import <React/RCTEventEmitter.h>
|
|
9
|
+
#import <React/RCTConvert.h>
|
|
10
|
+
#import <React/RCTLog.h>
|
|
11
|
+
#import <React/RCTUIManager.h>
|
|
12
|
+
|
|
13
|
+
// NMapsMap-specific imports (only when default provider is enabled)
|
|
14
|
+
#ifdef GRANITE_NAVER_MAP_DEFAULT_PROVIDER
|
|
15
|
+
#import "RCTConvert+NMFMapView.h"
|
|
16
|
+
#endif
|
|
17
|
+
|
|
18
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
19
|
+
#import <React/RCTViewComponentView.h>
|
|
20
|
+
#endif
|
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
//
|
|
2
|
+
// GraniteNaverMapProvider.swift
|
|
3
|
+
// granite-naver-map
|
|
4
|
+
//
|
|
5
|
+
// Pluggable Provider protocol for NaverMap
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import UIKit
|
|
9
|
+
|
|
10
|
+
// MARK: - Provider Enums
|
|
11
|
+
|
|
12
|
+
@objc public enum GraniteNaverMapType: Int {
|
|
13
|
+
case basic = 0
|
|
14
|
+
case navi = 1
|
|
15
|
+
case satellite = 2
|
|
16
|
+
case hybrid = 3
|
|
17
|
+
case terrain = 4
|
|
18
|
+
case none = 5
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
@objc public enum GraniteNaverMapLocationTrackingMode: Int {
|
|
22
|
+
case none = 0
|
|
23
|
+
case noFollow = 1
|
|
24
|
+
case follow = 2
|
|
25
|
+
case face = 3
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// MARK: - Data Types
|
|
29
|
+
|
|
30
|
+
@objc public class GraniteNaverMapCoordinate: NSObject {
|
|
31
|
+
@objc public let latitude: Double
|
|
32
|
+
@objc public let longitude: Double
|
|
33
|
+
|
|
34
|
+
@objc public init(latitude: Double, longitude: Double) {
|
|
35
|
+
self.latitude = latitude
|
|
36
|
+
self.longitude = longitude
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
@objc public class GraniteNaverMapCameraPosition: NSObject {
|
|
41
|
+
@objc public let target: GraniteNaverMapCoordinate
|
|
42
|
+
@objc public let zoom: Double
|
|
43
|
+
@objc public let tilt: Double
|
|
44
|
+
@objc public let bearing: Double
|
|
45
|
+
|
|
46
|
+
@objc public init(target: GraniteNaverMapCoordinate, zoom: Double, tilt: Double = 0, bearing: Double = 0) {
|
|
47
|
+
self.target = target
|
|
48
|
+
self.zoom = zoom
|
|
49
|
+
self.tilt = tilt
|
|
50
|
+
self.bearing = bearing
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
@objc public class GraniteNaverMapBounds: NSObject {
|
|
55
|
+
@objc public let southWest: GraniteNaverMapCoordinate
|
|
56
|
+
@objc public let northEast: GraniteNaverMapCoordinate
|
|
57
|
+
|
|
58
|
+
@objc public init(southWest: GraniteNaverMapCoordinate, northEast: GraniteNaverMapCoordinate) {
|
|
59
|
+
self.southWest = southWest
|
|
60
|
+
self.northEast = northEast
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// MARK: - Marker Data
|
|
65
|
+
|
|
66
|
+
@objc public class ProviderMarkerData: NSObject {
|
|
67
|
+
@objc public let identifier: String
|
|
68
|
+
@objc public let coordinate: GraniteNaverMapCoordinate
|
|
69
|
+
@objc public let width: Int
|
|
70
|
+
@objc public let height: Int
|
|
71
|
+
@objc public let zIndex: Int
|
|
72
|
+
@objc public let rotation: Float
|
|
73
|
+
@objc public let flat: Bool
|
|
74
|
+
@objc public let alpha: Float
|
|
75
|
+
@objc public let pinColor: Int
|
|
76
|
+
@objc public let image: String
|
|
77
|
+
|
|
78
|
+
@objc public init(
|
|
79
|
+
identifier: String,
|
|
80
|
+
coordinate: GraniteNaverMapCoordinate,
|
|
81
|
+
width: Int,
|
|
82
|
+
height: Int,
|
|
83
|
+
zIndex: Int,
|
|
84
|
+
rotation: Float,
|
|
85
|
+
flat: Bool,
|
|
86
|
+
alpha: Float,
|
|
87
|
+
pinColor: Int,
|
|
88
|
+
image: String
|
|
89
|
+
) {
|
|
90
|
+
self.identifier = identifier
|
|
91
|
+
self.coordinate = coordinate
|
|
92
|
+
self.width = width
|
|
93
|
+
self.height = height
|
|
94
|
+
self.zIndex = zIndex
|
|
95
|
+
self.rotation = rotation
|
|
96
|
+
self.flat = flat
|
|
97
|
+
self.alpha = alpha
|
|
98
|
+
self.pinColor = pinColor
|
|
99
|
+
self.image = image
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// MARK: - Overlay Data
|
|
104
|
+
|
|
105
|
+
@objc public class ProviderPolylineData: NSObject {
|
|
106
|
+
@objc public let identifier: String
|
|
107
|
+
@objc public let coordinates: [GraniteNaverMapCoordinate]
|
|
108
|
+
@objc public let strokeWidth: Float
|
|
109
|
+
@objc public let strokeColor: Int
|
|
110
|
+
@objc public let zIndex: Int
|
|
111
|
+
@objc public let lineCap: Int
|
|
112
|
+
@objc public let lineJoin: Int
|
|
113
|
+
@objc public let pattern: [Int]
|
|
114
|
+
|
|
115
|
+
@objc public init(
|
|
116
|
+
identifier: String,
|
|
117
|
+
coordinates: [GraniteNaverMapCoordinate],
|
|
118
|
+
strokeWidth: Float,
|
|
119
|
+
strokeColor: Int,
|
|
120
|
+
zIndex: Int,
|
|
121
|
+
lineCap: Int,
|
|
122
|
+
lineJoin: Int,
|
|
123
|
+
pattern: [Int]
|
|
124
|
+
) {
|
|
125
|
+
self.identifier = identifier
|
|
126
|
+
self.coordinates = coordinates
|
|
127
|
+
self.strokeWidth = strokeWidth
|
|
128
|
+
self.strokeColor = strokeColor
|
|
129
|
+
self.zIndex = zIndex
|
|
130
|
+
self.lineCap = lineCap
|
|
131
|
+
self.lineJoin = lineJoin
|
|
132
|
+
self.pattern = pattern
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
@objc public class ProviderPolygonData: NSObject {
|
|
137
|
+
@objc public let identifier: String
|
|
138
|
+
@objc public let coordinates: [GraniteNaverMapCoordinate]
|
|
139
|
+
@objc public let holes: [[GraniteNaverMapCoordinate]]
|
|
140
|
+
@objc public let fillColor: Int
|
|
141
|
+
@objc public let strokeColor: Int
|
|
142
|
+
@objc public let strokeWidth: Float
|
|
143
|
+
@objc public let zIndex: Int
|
|
144
|
+
|
|
145
|
+
@objc public init(
|
|
146
|
+
identifier: String,
|
|
147
|
+
coordinates: [GraniteNaverMapCoordinate],
|
|
148
|
+
holes: [[GraniteNaverMapCoordinate]],
|
|
149
|
+
fillColor: Int,
|
|
150
|
+
strokeColor: Int,
|
|
151
|
+
strokeWidth: Float,
|
|
152
|
+
zIndex: Int
|
|
153
|
+
) {
|
|
154
|
+
self.identifier = identifier
|
|
155
|
+
self.coordinates = coordinates
|
|
156
|
+
self.holes = holes
|
|
157
|
+
self.fillColor = fillColor
|
|
158
|
+
self.strokeColor = strokeColor
|
|
159
|
+
self.strokeWidth = strokeWidth
|
|
160
|
+
self.zIndex = zIndex
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
@objc public class ProviderCircleData: NSObject {
|
|
165
|
+
@objc public let identifier: String
|
|
166
|
+
@objc public let center: GraniteNaverMapCoordinate
|
|
167
|
+
@objc public let radius: Double
|
|
168
|
+
@objc public let fillColor: Int
|
|
169
|
+
@objc public let strokeColor: Int
|
|
170
|
+
@objc public let strokeWidth: Float
|
|
171
|
+
@objc public let zIndex: Int
|
|
172
|
+
|
|
173
|
+
@objc public init(
|
|
174
|
+
identifier: String,
|
|
175
|
+
center: GraniteNaverMapCoordinate,
|
|
176
|
+
radius: Double,
|
|
177
|
+
fillColor: Int,
|
|
178
|
+
strokeColor: Int,
|
|
179
|
+
strokeWidth: Float,
|
|
180
|
+
zIndex: Int
|
|
181
|
+
) {
|
|
182
|
+
self.identifier = identifier
|
|
183
|
+
self.center = center
|
|
184
|
+
self.radius = radius
|
|
185
|
+
self.fillColor = fillColor
|
|
186
|
+
self.strokeColor = strokeColor
|
|
187
|
+
self.strokeWidth = strokeWidth
|
|
188
|
+
self.zIndex = zIndex
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
@objc public class ProviderPathData: NSObject {
|
|
193
|
+
@objc public let identifier: String
|
|
194
|
+
@objc public let coordinates: [GraniteNaverMapCoordinate]
|
|
195
|
+
@objc public let width: Float
|
|
196
|
+
@objc public let outlineWidth: Float
|
|
197
|
+
@objc public let color: Int
|
|
198
|
+
@objc public let outlineColor: Int
|
|
199
|
+
@objc public let passedColor: Int
|
|
200
|
+
@objc public let passedOutlineColor: Int
|
|
201
|
+
@objc public let patternImage: String
|
|
202
|
+
@objc public let patternInterval: Int
|
|
203
|
+
@objc public let progress: Float
|
|
204
|
+
@objc public let zIndex: Int
|
|
205
|
+
|
|
206
|
+
@objc public init(
|
|
207
|
+
identifier: String,
|
|
208
|
+
coordinates: [GraniteNaverMapCoordinate],
|
|
209
|
+
width: Float,
|
|
210
|
+
outlineWidth: Float,
|
|
211
|
+
color: Int,
|
|
212
|
+
outlineColor: Int,
|
|
213
|
+
passedColor: Int,
|
|
214
|
+
passedOutlineColor: Int,
|
|
215
|
+
patternImage: String,
|
|
216
|
+
patternInterval: Int,
|
|
217
|
+
progress: Float,
|
|
218
|
+
zIndex: Int
|
|
219
|
+
) {
|
|
220
|
+
self.identifier = identifier
|
|
221
|
+
self.coordinates = coordinates
|
|
222
|
+
self.width = width
|
|
223
|
+
self.outlineWidth = outlineWidth
|
|
224
|
+
self.color = color
|
|
225
|
+
self.outlineColor = outlineColor
|
|
226
|
+
self.passedColor = passedColor
|
|
227
|
+
self.passedOutlineColor = passedOutlineColor
|
|
228
|
+
self.patternImage = patternImage
|
|
229
|
+
self.patternInterval = patternInterval
|
|
230
|
+
self.progress = progress
|
|
231
|
+
self.zIndex = zIndex
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
// MARK: - Provider Delegate
|
|
236
|
+
|
|
237
|
+
@objc public protocol GraniteNaverMapProviderDelegate: NSObjectProtocol {
|
|
238
|
+
@objc func mapViewDidInitialize()
|
|
239
|
+
@objc func mapViewDidChangeCamera(position: GraniteNaverMapCameraPosition)
|
|
240
|
+
@objc func mapViewDidTouch(reason: Int, animated: Bool)
|
|
241
|
+
@objc func mapViewDidClick(x: Double, y: Double, latitude: Double, longitude: Double)
|
|
242
|
+
@objc func mapViewDidClickMarker(id: String)
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
// MARK: - Provider Factory Protocol
|
|
246
|
+
|
|
247
|
+
/// Factory protocol for creating NaverMap providers.
|
|
248
|
+
/// Each call to createProvider() should return a new instance.
|
|
249
|
+
@objc public protocol GraniteNaverMapProviderFactory: NSObjectProtocol {
|
|
250
|
+
/// Create a new provider instance.
|
|
251
|
+
/// This should be called for each NaverMap view.
|
|
252
|
+
@objc func createProvider() -> GraniteNaverMapProvidable
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
// MARK: - Provider Protocol
|
|
256
|
+
|
|
257
|
+
@objc public protocol GraniteNaverMapProvidable: NSObjectProtocol {
|
|
258
|
+
/// Create the map view
|
|
259
|
+
@objc func createMapView(frame: CGRect) -> UIView
|
|
260
|
+
|
|
261
|
+
/// Set the delegate for map events
|
|
262
|
+
@objc func setDelegate(_ delegate: GraniteNaverMapProviderDelegate?)
|
|
263
|
+
|
|
264
|
+
// MARK: - Camera
|
|
265
|
+
@objc func moveCamera(to position: GraniteNaverMapCameraPosition, animated: Bool)
|
|
266
|
+
@objc func animateToCoordinate(_ coordinate: GraniteNaverMapCoordinate)
|
|
267
|
+
@objc func animateToBounds(_ bounds: GraniteNaverMapBounds, padding: CGFloat)
|
|
268
|
+
|
|
269
|
+
// MARK: - Map Properties
|
|
270
|
+
@objc func setMapType(_ type: GraniteNaverMapType)
|
|
271
|
+
@objc func setMapPadding(_ padding: UIEdgeInsets)
|
|
272
|
+
@objc func setCompassEnabled(_ enabled: Bool)
|
|
273
|
+
@objc func setScaleBarEnabled(_ enabled: Bool)
|
|
274
|
+
@objc func setZoomControlEnabled(_ enabled: Bool)
|
|
275
|
+
@objc func setLocationButtonEnabled(_ enabled: Bool)
|
|
276
|
+
@objc func setBuildingHeight(_ height: Float)
|
|
277
|
+
@objc func setNightModeEnabled(_ enabled: Bool)
|
|
278
|
+
@objc func setMinZoomLevel(_ level: Double)
|
|
279
|
+
@objc func setMaxZoomLevel(_ level: Double)
|
|
280
|
+
@objc func setScrollGesturesEnabled(_ enabled: Bool)
|
|
281
|
+
@objc func setZoomGesturesEnabled(_ enabled: Bool)
|
|
282
|
+
@objc func setTiltGesturesEnabled(_ enabled: Bool)
|
|
283
|
+
@objc func setRotateGesturesEnabled(_ enabled: Bool)
|
|
284
|
+
@objc func setStopGesturesEnabled(_ enabled: Bool)
|
|
285
|
+
@objc func setLocationTrackingMode(_ mode: GraniteNaverMapLocationTrackingMode)
|
|
286
|
+
@objc func setLayerGroupEnabled(group: String, enabled: Bool)
|
|
287
|
+
|
|
288
|
+
// MARK: - Markers
|
|
289
|
+
@objc func addMarker(_ data: ProviderMarkerData)
|
|
290
|
+
@objc func updateMarker(_ data: ProviderMarkerData)
|
|
291
|
+
@objc func removeMarker(identifier: String)
|
|
292
|
+
|
|
293
|
+
// MARK: - Polylines
|
|
294
|
+
@objc func addPolyline(_ data: ProviderPolylineData)
|
|
295
|
+
@objc func updatePolyline(_ data: ProviderPolylineData)
|
|
296
|
+
@objc func removePolyline(identifier: String)
|
|
297
|
+
|
|
298
|
+
// MARK: - Polygons
|
|
299
|
+
@objc func addPolygon(_ data: ProviderPolygonData)
|
|
300
|
+
@objc func updatePolygon(_ data: ProviderPolygonData)
|
|
301
|
+
@objc func removePolygon(identifier: String)
|
|
302
|
+
|
|
303
|
+
// MARK: - Circles
|
|
304
|
+
@objc func addCircle(_ data: ProviderCircleData)
|
|
305
|
+
@objc func updateCircle(_ data: ProviderCircleData)
|
|
306
|
+
@objc func removeCircle(identifier: String)
|
|
307
|
+
|
|
308
|
+
// MARK: - Paths
|
|
309
|
+
@objc func addPath(_ data: ProviderPathData)
|
|
310
|
+
@objc func updatePath(_ data: ProviderPathData)
|
|
311
|
+
@objc func removePath(identifier: String)
|
|
312
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
//
|
|
2
|
+
// GraniteNaverMapRegistry.swift
|
|
3
|
+
// granite-naver-map
|
|
4
|
+
//
|
|
5
|
+
// Registry singleton for NaverMap provider factories
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
|
|
10
|
+
/// Type alias for provider creation closure
|
|
11
|
+
public typealias GraniteNaverMapProviderCreator = () -> GraniteNaverMapProvidable
|
|
12
|
+
|
|
13
|
+
/// Internal wrapper to adapt closure to factory protocol (for Obj-C compatibility)
|
|
14
|
+
private class ClosureProviderFactory: NSObject, GraniteNaverMapProviderFactory {
|
|
15
|
+
private let creator: GraniteNaverMapProviderCreator
|
|
16
|
+
|
|
17
|
+
init(creator: @escaping GraniteNaverMapProviderCreator) {
|
|
18
|
+
self.creator = creator
|
|
19
|
+
super.init()
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
func createProvider() -> GraniteNaverMapProvidable {
|
|
23
|
+
return creator()
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
@objc public class GraniteNaverMapRegistry: NSObject {
|
|
28
|
+
@objc public static let shared = GraniteNaverMapRegistry()
|
|
29
|
+
|
|
30
|
+
@objc public private(set) var factory: GraniteNaverMapProviderFactory?
|
|
31
|
+
|
|
32
|
+
private override init() {
|
|
33
|
+
super.init()
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/// Register a provider using a closure. Call this at app startup before using NaverMap.
|
|
37
|
+
/// This is the preferred Swift API.
|
|
38
|
+
///
|
|
39
|
+
/// Usage:
|
|
40
|
+
/// ```swift
|
|
41
|
+
/// GraniteNaverMapRegistry.shared.register {
|
|
42
|
+
/// return MyNaverMapProvider()
|
|
43
|
+
/// }
|
|
44
|
+
/// ```
|
|
45
|
+
public func register(creator: @escaping GraniteNaverMapProviderCreator) {
|
|
46
|
+
self.factory = ClosureProviderFactory(creator: creator)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/// Register a custom provider factory. Call this at app startup before using NaverMap.
|
|
50
|
+
/// This API is provided for Obj-C compatibility.
|
|
51
|
+
@objc public func register(factory: GraniteNaverMapProviderFactory) {
|
|
52
|
+
self.factory = factory
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/// Create a new provider instance for a NaverMap view.
|
|
56
|
+
/// Each view should call this to get its own provider instance.
|
|
57
|
+
@objc public func createProvider() -> GraniteNaverMapProvidable? {
|
|
58
|
+
// Use registered factory if available
|
|
59
|
+
if let factory = factory {
|
|
60
|
+
return factory.createProvider()
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
#if GRANITE_NAVER_MAP_DEFAULT_PROVIDER
|
|
64
|
+
// Use built-in factory
|
|
65
|
+
let builtInFactory = BuiltInNaverMapProviderFactory()
|
|
66
|
+
return builtInFactory.createProvider()
|
|
67
|
+
#else
|
|
68
|
+
// No default provider available - user must register a custom factory
|
|
69
|
+
return nil
|
|
70
|
+
#endif
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/// Check if a custom factory has been registered
|
|
74
|
+
@objc public var hasCustomFactory: Bool {
|
|
75
|
+
return factory != nil
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/// Check if a default provider is available
|
|
79
|
+
@objc public var hasDefaultProvider: Bool {
|
|
80
|
+
#if GRANITE_NAVER_MAP_DEFAULT_PROVIDER
|
|
81
|
+
return true
|
|
82
|
+
#else
|
|
83
|
+
return false
|
|
84
|
+
#endif
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/// Reset the factory (useful for testing)
|
|
88
|
+
@objc public func reset() {
|
|
89
|
+
factory = nil
|
|
90
|
+
}
|
|
91
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#import <UIKit/UIKit.h>
|
|
2
|
+
|
|
3
|
+
#ifndef GraniteNaverMapViewNativeComponent_h
|
|
4
|
+
#define GraniteNaverMapViewNativeComponent_h
|
|
5
|
+
|
|
6
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
7
|
+
|
|
8
|
+
// Forward declare to avoid pulling in C++ headers
|
|
9
|
+
// RCTViewComponentView import is in the .mm file
|
|
10
|
+
@interface GraniteNaverMapView : UIView
|
|
11
|
+
@end
|
|
12
|
+
|
|
13
|
+
NS_ASSUME_NONNULL_END
|
|
14
|
+
|
|
15
|
+
#endif /* GraniteNaverMapViewNativeComponent_h */
|