├── note.md
├── ios
├── frameworks
│ ├── MAMapKit.framework
│ │ ├── 4.4.0.cc00c67
│ │ ├── MAMapKit
│ │ ├── AMap.bundle
│ │ │ └── images
│ │ │ │ ├── redPin.png
│ │ │ │ ├── greenPin.png
│ │ │ │ ├── greenPin@2x.png
│ │ │ │ ├── greenPin@3x.png
│ │ │ │ ├── pin_shadow.png
│ │ │ │ ├── purplePin.png
│ │ │ │ ├── redPin@2x.png
│ │ │ │ ├── redPin@3x.png
│ │ │ │ ├── redPin_lift.png
│ │ │ │ ├── greenPin_lift.png
│ │ │ │ ├── pin_shadow@2x.png
│ │ │ │ ├── pin_shadow@3x.png
│ │ │ │ ├── purplePin@2x.png
│ │ │ │ ├── purplePin@3x.png
│ │ │ │ ├── greenPin_lift@2x.png
│ │ │ │ ├── greenPin_lift@3x.png
│ │ │ │ ├── purplePin_lift.png
│ │ │ │ ├── redPin_lift@2x.png
│ │ │ │ ├── redPin_lift@3x.png
│ │ │ │ ├── purplePin_lift@2x.png
│ │ │ │ └── purplePin_lift@3x.png
│ │ └── Headers
│ │ │ ├── MAShape.h
│ │ │ ├── MAPointAnnotation.h
│ │ │ ├── MACircleView.h
│ │ │ ├── MAPolygonView.h
│ │ │ ├── MAPolylineView.h
│ │ │ ├── MACircleRenderer.h
│ │ │ ├── MAPolygonRenderer.h
│ │ │ ├── MAPolylineRenderer.h
│ │ │ ├── MAGroundOverlayView.h
│ │ │ ├── MATileOverlayView.h
│ │ │ ├── MAGroundOverlayRenderer.h
│ │ │ ├── MAPinAnnotationView.h
│ │ │ ├── MAGeodesicPolyline.h
│ │ │ ├── MAMapVersion.h
│ │ │ ├── MATileOverlayRenderer.h
│ │ │ ├── MAOverlay.h
│ │ │ ├── MAMultiPoint.h
│ │ │ ├── MAPolyline.h
│ │ │ ├── MAAnnotation.h
│ │ │ ├── MAUserLocation.h
│ │ │ ├── MAMultiColoredPolylineRenderer.h
│ │ │ ├── MAUserLocationRepresentation.h
│ │ │ ├── MACircle.h
│ │ │ ├── MAMultiPolyline.h
│ │ │ ├── MAHeatMapTileOverlay.h
│ │ │ ├── MAGroundOverlay.h
│ │ │ ├── MAMapKit.h
│ │ │ ├── MAPolygon.h
│ │ │ ├── MATileOverlay.h
│ │ │ ├── MAOverlayView.h
│ │ │ ├── MAOverlayPathView.h
│ │ │ ├── MAOverlayRenderer.h
│ │ │ ├── MAOverlayPathRenderer.h
│ │ │ ├── MAAnnotationView.h
│ │ │ ├── MAGeometry.h
│ │ │ └── MAMapView.h
│ ├── AMapSearchKit.framework
│ │ ├── 4.3.0.03f89c0
│ │ ├── AMapSearchKit
│ │ └── Headers
│ │ │ ├── AMapSearchKit.h
│ │ │ ├── AMapSearchVersion.h
│ │ │ ├── AMapNearbyUploadInfo.h
│ │ │ ├── AMapNearbySearchManager.h
│ │ │ ├── AMapSearchError.h
│ │ │ ├── AMapSearchAPI.h
│ │ │ └── AMapSearchObj.h
│ └── AMapFoundationKit.framework
│ │ ├── AMapFoundationKit
│ │ └── Headers
│ │ ├── AMapFoundationKit.h
│ │ ├── AMapFoundationVersion.h
│ │ ├── AMapServices.h
│ │ ├── AMapURLSearch.h
│ │ ├── AMapUtility.h
│ │ ├── AMapURLSearchType.h
│ │ └── AMapURLSearchConfig.h
├── Frameworks
│ ├── AMapSearchKit.framework
│ │ └── 4.4.0.5bd4275
│ └── AMapFoundationKit.framework
│ │ └── version.txt
├── AMapResources
│ ├── gpsStat1@2x.png
│ ├── icon_location@2x.png
│ └── icon_location@3x.png
└── RCTAMap
│ ├── AMap.bundle
│ └── images
│ │ ├── greenPin.png
│ │ ├── redPin.png
│ │ ├── pin_shadow.png
│ │ ├── purplePin.png
│ │ ├── redPin@2x.png
│ │ ├── redPin@3x.png
│ │ ├── greenPin@2x.png
│ │ ├── greenPin@3x.png
│ │ ├── greenPin_lift.png
│ │ ├── pin_shadow@2x.png
│ │ ├── pin_shadow@3x.png
│ │ ├── purplePin@2x.png
│ │ ├── purplePin@3x.png
│ │ ├── redPin_lift.png
│ │ ├── purplePin_lift.png
│ │ ├── redPin_lift@2x.png
│ │ ├── redPin_lift@3x.png
│ │ ├── greenPin_lift@2x.png
│ │ ├── greenPin_lift@3x.png
│ │ ├── purplePin_lift@2x.png
│ │ └── purplePin_lift@3x.png
│ ├── RCTAMap
│ ├── RCTAMapManager.h
│ ├── RCTAMap.m
│ ├── RCTAMap.h
│ ├── APIKey.h
│ ├── Configuration
│ │ └── APIKey.h
│ └── PrefixHeader.pch
│ ├── RCTAMap.xcodeproj
│ ├── project.xcworkspace
│ │ └── contents.xcworkspacedata
│ └── project.pbxproj
│ └── PrefixHeader.pch
├── android
├── src
│ └── main
│ │ ├── res
│ │ └── values
│ │ │ └── strings.xml
│ │ ├── AndroidManifest.xml
│ │ └── java
│ │ └── com
│ │ └── reactnativecomponent
│ │ └── amap
│ │ ├── RCTAMapPackage.java
│ │ ├── RCTAMapManager.java
│ │ ├── util
│ │ └── SensorEventHelper.java
│ │ ├── Utils.java
│ │ ├── RCTAMapModule.java
│ │ └── RCTAMapView.java
├── AMapResources
│ ├── gps_stat1.png
│ ├── gpsStat1@2x.png
│ ├── poi_marker.png
│ ├── icon_location.png
│ ├── icon_location@2x.png
│ └── icon_location@3x.png
├── proguard-rules.pro
└── build.gradle
├── .gitignore
├── .npmignore
├── AMap.js
├── package.json
├── LICENSE
├── AMap-android.js
├── AMap-ios.js
└── README.md
/note.md:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/ios/frameworks/MAMapKit.framework/4.4.0.cc00c67:
--------------------------------------------------------------------------------
1 | 4.4.0.cc00c67
2 |
--------------------------------------------------------------------------------
/ios/Frameworks/AMapSearchKit.framework/4.4.0.5bd4275:
--------------------------------------------------------------------------------
1 | 4.4.0.5bd4275
2 |
--------------------------------------------------------------------------------
/ios/frameworks/AMapSearchKit.framework/4.3.0.03f89c0:
--------------------------------------------------------------------------------
1 | 4.3.0.03f89c0
2 |
--------------------------------------------------------------------------------
/ios/Frameworks/AMapFoundationKit.framework/version.txt:
--------------------------------------------------------------------------------
1 | 1.4.0+foundation.e669e61
2 |
--------------------------------------------------------------------------------
/android/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | RCTAMap
3 |
4 |
--------------------------------------------------------------------------------
/ios/AMapResources/gpsStat1@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/react-native-component/react-native-smart-amap/HEAD/ios/AMapResources/gpsStat1@2x.png
--------------------------------------------------------------------------------
/android/AMapResources/gps_stat1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/react-native-component/react-native-smart-amap/HEAD/android/AMapResources/gps_stat1.png
--------------------------------------------------------------------------------
/android/AMapResources/gpsStat1@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/react-native-component/react-native-smart-amap/HEAD/android/AMapResources/gpsStat1@2x.png
--------------------------------------------------------------------------------
/android/AMapResources/poi_marker.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/react-native-component/react-native-smart-amap/HEAD/android/AMapResources/poi_marker.png
--------------------------------------------------------------------------------
/ios/AMapResources/icon_location@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/react-native-component/react-native-smart-amap/HEAD/ios/AMapResources/icon_location@2x.png
--------------------------------------------------------------------------------
/ios/AMapResources/icon_location@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/react-native-component/react-native-smart-amap/HEAD/ios/AMapResources/icon_location@3x.png
--------------------------------------------------------------------------------
/android/AMapResources/icon_location.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/react-native-component/react-native-smart-amap/HEAD/android/AMapResources/icon_location.png
--------------------------------------------------------------------------------
/android/AMapResources/icon_location@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/react-native-component/react-native-smart-amap/HEAD/android/AMapResources/icon_location@2x.png
--------------------------------------------------------------------------------
/android/AMapResources/icon_location@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/react-native-component/react-native-smart-amap/HEAD/android/AMapResources/icon_location@3x.png
--------------------------------------------------------------------------------
/ios/RCTAMap/AMap.bundle/images/greenPin.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/react-native-component/react-native-smart-amap/HEAD/ios/RCTAMap/AMap.bundle/images/greenPin.png
--------------------------------------------------------------------------------
/ios/RCTAMap/AMap.bundle/images/redPin.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/react-native-component/react-native-smart-amap/HEAD/ios/RCTAMap/AMap.bundle/images/redPin.png
--------------------------------------------------------------------------------
/ios/frameworks/MAMapKit.framework/MAMapKit:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/react-native-component/react-native-smart-amap/HEAD/ios/frameworks/MAMapKit.framework/MAMapKit
--------------------------------------------------------------------------------
/ios/RCTAMap/AMap.bundle/images/pin_shadow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/react-native-component/react-native-smart-amap/HEAD/ios/RCTAMap/AMap.bundle/images/pin_shadow.png
--------------------------------------------------------------------------------
/ios/RCTAMap/AMap.bundle/images/purplePin.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/react-native-component/react-native-smart-amap/HEAD/ios/RCTAMap/AMap.bundle/images/purplePin.png
--------------------------------------------------------------------------------
/ios/RCTAMap/AMap.bundle/images/redPin@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/react-native-component/react-native-smart-amap/HEAD/ios/RCTAMap/AMap.bundle/images/redPin@2x.png
--------------------------------------------------------------------------------
/ios/RCTAMap/AMap.bundle/images/redPin@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/react-native-component/react-native-smart-amap/HEAD/ios/RCTAMap/AMap.bundle/images/redPin@3x.png
--------------------------------------------------------------------------------
/android/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
--------------------------------------------------------------------------------
/ios/RCTAMap/AMap.bundle/images/greenPin@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/react-native-component/react-native-smart-amap/HEAD/ios/RCTAMap/AMap.bundle/images/greenPin@2x.png
--------------------------------------------------------------------------------
/ios/RCTAMap/AMap.bundle/images/greenPin@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/react-native-component/react-native-smart-amap/HEAD/ios/RCTAMap/AMap.bundle/images/greenPin@3x.png
--------------------------------------------------------------------------------
/ios/RCTAMap/AMap.bundle/images/greenPin_lift.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/react-native-component/react-native-smart-amap/HEAD/ios/RCTAMap/AMap.bundle/images/greenPin_lift.png
--------------------------------------------------------------------------------
/ios/RCTAMap/AMap.bundle/images/pin_shadow@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/react-native-component/react-native-smart-amap/HEAD/ios/RCTAMap/AMap.bundle/images/pin_shadow@2x.png
--------------------------------------------------------------------------------
/ios/RCTAMap/AMap.bundle/images/pin_shadow@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/react-native-component/react-native-smart-amap/HEAD/ios/RCTAMap/AMap.bundle/images/pin_shadow@3x.png
--------------------------------------------------------------------------------
/ios/RCTAMap/AMap.bundle/images/purplePin@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/react-native-component/react-native-smart-amap/HEAD/ios/RCTAMap/AMap.bundle/images/purplePin@2x.png
--------------------------------------------------------------------------------
/ios/RCTAMap/AMap.bundle/images/purplePin@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/react-native-component/react-native-smart-amap/HEAD/ios/RCTAMap/AMap.bundle/images/purplePin@3x.png
--------------------------------------------------------------------------------
/ios/RCTAMap/AMap.bundle/images/redPin_lift.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/react-native-component/react-native-smart-amap/HEAD/ios/RCTAMap/AMap.bundle/images/redPin_lift.png
--------------------------------------------------------------------------------
/ios/RCTAMap/AMap.bundle/images/purplePin_lift.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/react-native-component/react-native-smart-amap/HEAD/ios/RCTAMap/AMap.bundle/images/purplePin_lift.png
--------------------------------------------------------------------------------
/ios/RCTAMap/AMap.bundle/images/redPin_lift@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/react-native-component/react-native-smart-amap/HEAD/ios/RCTAMap/AMap.bundle/images/redPin_lift@2x.png
--------------------------------------------------------------------------------
/ios/RCTAMap/AMap.bundle/images/redPin_lift@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/react-native-component/react-native-smart-amap/HEAD/ios/RCTAMap/AMap.bundle/images/redPin_lift@3x.png
--------------------------------------------------------------------------------
/ios/RCTAMap/AMap.bundle/images/greenPin_lift@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/react-native-component/react-native-smart-amap/HEAD/ios/RCTAMap/AMap.bundle/images/greenPin_lift@2x.png
--------------------------------------------------------------------------------
/ios/RCTAMap/AMap.bundle/images/greenPin_lift@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/react-native-component/react-native-smart-amap/HEAD/ios/RCTAMap/AMap.bundle/images/greenPin_lift@3x.png
--------------------------------------------------------------------------------
/ios/RCTAMap/AMap.bundle/images/purplePin_lift@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/react-native-component/react-native-smart-amap/HEAD/ios/RCTAMap/AMap.bundle/images/purplePin_lift@2x.png
--------------------------------------------------------------------------------
/ios/RCTAMap/AMap.bundle/images/purplePin_lift@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/react-native-component/react-native-smart-amap/HEAD/ios/RCTAMap/AMap.bundle/images/purplePin_lift@3x.png
--------------------------------------------------------------------------------
/ios/frameworks/AMapSearchKit.framework/AMapSearchKit:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/react-native-component/react-native-smart-amap/HEAD/ios/frameworks/AMapSearchKit.framework/AMapSearchKit
--------------------------------------------------------------------------------
/ios/RCTAMap/RCTAMap/RCTAMapManager.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | @interface RCTAMapManager : RCTViewManager
4 |
5 | - (void)gpsLocateWithMapView: (UIView *)view;
6 |
7 | @end
8 |
9 |
--------------------------------------------------------------------------------
/ios/frameworks/AMapFoundationKit.framework/AMapFoundationKit:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/react-native-component/react-native-smart-amap/HEAD/ios/frameworks/AMapFoundationKit.framework/AMapFoundationKit
--------------------------------------------------------------------------------
/ios/frameworks/MAMapKit.framework/AMap.bundle/images/redPin.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/react-native-component/react-native-smart-amap/HEAD/ios/frameworks/MAMapKit.framework/AMap.bundle/images/redPin.png
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.[aod]
2 | *.DS_Store
3 | .DS_Store
4 | *Thumbs.db
5 | *.iml
6 | .gradle
7 | .idea
8 | node_modules
9 | npm-debug.log
10 | /android/build
11 | /ios/**/*xcuserdata*
12 | /ios/**/*xcshareddata*
--------------------------------------------------------------------------------
/.npmignore:
--------------------------------------------------------------------------------
1 | *.[aod]
2 | *.DS_Store
3 | .DS_Store
4 | *Thumbs.db
5 | *.iml
6 | .gradle
7 | .idea
8 | node_modules
9 | npm-debug.log
10 | /android/build
11 | /ios/**/*xcuserdata*
12 | /ios/**/*xcshareddata*
--------------------------------------------------------------------------------
/ios/frameworks/MAMapKit.framework/AMap.bundle/images/greenPin.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/react-native-component/react-native-smart-amap/HEAD/ios/frameworks/MAMapKit.framework/AMap.bundle/images/greenPin.png
--------------------------------------------------------------------------------
/ios/frameworks/MAMapKit.framework/AMap.bundle/images/greenPin@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/react-native-component/react-native-smart-amap/HEAD/ios/frameworks/MAMapKit.framework/AMap.bundle/images/greenPin@2x.png
--------------------------------------------------------------------------------
/ios/frameworks/MAMapKit.framework/AMap.bundle/images/greenPin@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/react-native-component/react-native-smart-amap/HEAD/ios/frameworks/MAMapKit.framework/AMap.bundle/images/greenPin@3x.png
--------------------------------------------------------------------------------
/ios/frameworks/MAMapKit.framework/AMap.bundle/images/pin_shadow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/react-native-component/react-native-smart-amap/HEAD/ios/frameworks/MAMapKit.framework/AMap.bundle/images/pin_shadow.png
--------------------------------------------------------------------------------
/ios/frameworks/MAMapKit.framework/AMap.bundle/images/purplePin.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/react-native-component/react-native-smart-amap/HEAD/ios/frameworks/MAMapKit.framework/AMap.bundle/images/purplePin.png
--------------------------------------------------------------------------------
/ios/frameworks/MAMapKit.framework/AMap.bundle/images/redPin@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/react-native-component/react-native-smart-amap/HEAD/ios/frameworks/MAMapKit.framework/AMap.bundle/images/redPin@2x.png
--------------------------------------------------------------------------------
/ios/frameworks/MAMapKit.framework/AMap.bundle/images/redPin@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/react-native-component/react-native-smart-amap/HEAD/ios/frameworks/MAMapKit.framework/AMap.bundle/images/redPin@3x.png
--------------------------------------------------------------------------------
/ios/frameworks/MAMapKit.framework/AMap.bundle/images/redPin_lift.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/react-native-component/react-native-smart-amap/HEAD/ios/frameworks/MAMapKit.framework/AMap.bundle/images/redPin_lift.png
--------------------------------------------------------------------------------
/ios/frameworks/MAMapKit.framework/AMap.bundle/images/greenPin_lift.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/react-native-component/react-native-smart-amap/HEAD/ios/frameworks/MAMapKit.framework/AMap.bundle/images/greenPin_lift.png
--------------------------------------------------------------------------------
/ios/frameworks/MAMapKit.framework/AMap.bundle/images/pin_shadow@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/react-native-component/react-native-smart-amap/HEAD/ios/frameworks/MAMapKit.framework/AMap.bundle/images/pin_shadow@2x.png
--------------------------------------------------------------------------------
/ios/frameworks/MAMapKit.framework/AMap.bundle/images/pin_shadow@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/react-native-component/react-native-smart-amap/HEAD/ios/frameworks/MAMapKit.framework/AMap.bundle/images/pin_shadow@3x.png
--------------------------------------------------------------------------------
/ios/frameworks/MAMapKit.framework/AMap.bundle/images/purplePin@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/react-native-component/react-native-smart-amap/HEAD/ios/frameworks/MAMapKit.framework/AMap.bundle/images/purplePin@2x.png
--------------------------------------------------------------------------------
/ios/frameworks/MAMapKit.framework/AMap.bundle/images/purplePin@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/react-native-component/react-native-smart-amap/HEAD/ios/frameworks/MAMapKit.framework/AMap.bundle/images/purplePin@3x.png
--------------------------------------------------------------------------------
/ios/frameworks/MAMapKit.framework/AMap.bundle/images/greenPin_lift@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/react-native-component/react-native-smart-amap/HEAD/ios/frameworks/MAMapKit.framework/AMap.bundle/images/greenPin_lift@2x.png
--------------------------------------------------------------------------------
/ios/frameworks/MAMapKit.framework/AMap.bundle/images/greenPin_lift@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/react-native-component/react-native-smart-amap/HEAD/ios/frameworks/MAMapKit.framework/AMap.bundle/images/greenPin_lift@3x.png
--------------------------------------------------------------------------------
/ios/frameworks/MAMapKit.framework/AMap.bundle/images/purplePin_lift.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/react-native-component/react-native-smart-amap/HEAD/ios/frameworks/MAMapKit.framework/AMap.bundle/images/purplePin_lift.png
--------------------------------------------------------------------------------
/ios/frameworks/MAMapKit.framework/AMap.bundle/images/redPin_lift@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/react-native-component/react-native-smart-amap/HEAD/ios/frameworks/MAMapKit.framework/AMap.bundle/images/redPin_lift@2x.png
--------------------------------------------------------------------------------
/ios/frameworks/MAMapKit.framework/AMap.bundle/images/redPin_lift@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/react-native-component/react-native-smart-amap/HEAD/ios/frameworks/MAMapKit.framework/AMap.bundle/images/redPin_lift@3x.png
--------------------------------------------------------------------------------
/ios/frameworks/MAMapKit.framework/AMap.bundle/images/purplePin_lift@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/react-native-component/react-native-smart-amap/HEAD/ios/frameworks/MAMapKit.framework/AMap.bundle/images/purplePin_lift@2x.png
--------------------------------------------------------------------------------
/ios/frameworks/MAMapKit.framework/AMap.bundle/images/purplePin_lift@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/react-native-component/react-native-smart-amap/HEAD/ios/frameworks/MAMapKit.framework/AMap.bundle/images/purplePin_lift@3x.png
--------------------------------------------------------------------------------
/ios/RCTAMap/RCTAMap.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/ios/RCTAMap/RCTAMap/RCTAMap.m:
--------------------------------------------------------------------------------
1 |
2 | #import "RCTAMap.h"
3 |
4 | @interface RCTAMap ()
5 |
6 | @property (nonatomic, weak) RCTAMapManager *manager;
7 |
8 | @end
9 |
10 | @implementation RCTAMap
11 |
12 | - (id)initWithManager:(RCTAMapManager*)manager
13 | {
14 |
15 | if ((self = [super init])) {
16 | self.manager = manager;
17 | }
18 | return self;
19 |
20 | }
21 |
22 | @end
23 |
--------------------------------------------------------------------------------
/ios/RCTAMap/RCTAMap/RCTAMap.h:
--------------------------------------------------------------------------------
1 |
2 | #import "RCTAMapManager.h"
3 | #import
4 |
5 | @interface RCTAMap : MAMapView
6 |
7 | @property (nonatomic, assign) BOOL hasUserLocationPointAnnotaiton;
8 |
9 | @property (nonatomic, copy) RCTBubblingEventBlock onDidMoveByUser;
10 |
11 | @property (nonatomic, copy) NSString *centerMarker;
12 |
13 | - (id)initWithManager: (RCTAMapManager*)manager;
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/ios/RCTAMap/RCTAMap/APIKey.h:
--------------------------------------------------------------------------------
1 | //
2 | // APIKey.h
3 | // SearchV3Demo
4 | //
5 | // Created by songjian on 13-8-14.
6 | // Copyright (c) 2013年 songjian. All rights reserved.
7 | //
8 |
9 | #ifndef SearchV3Demo_APIKey_h
10 | #define SearchV3Demo_APIKey_h
11 |
12 | /* 使用高德地图API,请注册Key,注册地址:http://lbs.amap.com/dev/#/ */
13 |
14 | const static NSString *APIKey = @"0ae1edc4435fb58c241e0842bd83bb8c";
15 | const static NSString *TableID = @"";
16 |
17 | #endif
18 |
--------------------------------------------------------------------------------
/ios/RCTAMap/RCTAMap/Configuration/APIKey.h:
--------------------------------------------------------------------------------
1 | //
2 | // APIKey.h
3 | // SearchV3Demo
4 | //
5 | // Created by songjian on 13-8-14.
6 | // Copyright (c) 2013年 songjian. All rights reserved.
7 | //
8 |
9 | #ifndef SearchV3Demo_APIKey_h
10 | #define SearchV3Demo_APIKey_h
11 |
12 | /* 使用高德地图API,请注册Key,注册地址:http://lbs.amap.com/dev/#/ */
13 |
14 | const static NSString *APIKey = @"0ae1edc4435fb58c241e0842bd83bb8c";
15 | const static NSString *TableID = @"";
16 |
17 | #endif
18 |
--------------------------------------------------------------------------------
/ios/frameworks/AMapFoundationKit.framework/Headers/AMapFoundationKit.h:
--------------------------------------------------------------------------------
1 | //
2 | // AMapFoundationKit.h
3 | // AMapFoundationKit
4 | //
5 | // Created by xiaoming han on 15/10/28.
6 | // Copyright © 2015年 Amap. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 | #import
12 | #import
13 | #import
14 |
15 | #import
16 |
--------------------------------------------------------------------------------
/AMap.js:
--------------------------------------------------------------------------------
1 | /*
2 | * A smart AMap Library for react-native apps
3 | * https://github.com/react-native-component/react-native-smart-amap/
4 | * Released under the MIT license
5 | * Copyright (c) 2016 react-native-component
6 | */
7 |
8 | import {
9 | Platform,
10 | } from 'react-native'
11 |
12 | import AndroidAMap from './AMap-android'
13 | import IOSAMap from './AMap-ios'
14 |
15 | let AMap
16 |
17 | if(Platform.OS == 'ios') {
18 | AMap = IOSAMap
19 | }
20 | else {
21 | AMap = AndroidAMap
22 | }
23 |
24 | export default AMap
25 |
--------------------------------------------------------------------------------
/ios/frameworks/AMapSearchKit.framework/Headers/AMapSearchKit.h:
--------------------------------------------------------------------------------
1 | //
2 | // AMapSearchKit.h
3 | // AMapSearchKit
4 | //
5 | // Created by xiaoming han on 15/7/22.
6 | // Copyright (c) 2015年 AutoNavi. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 | #import
12 | #import
13 | #import
14 | #import
15 |
16 | #import
--------------------------------------------------------------------------------
/ios/frameworks/AMapFoundationKit.framework/Headers/AMapFoundationVersion.h:
--------------------------------------------------------------------------------
1 | //
2 | // AMapFoundationVersion.h
3 | // AMapFoundation
4 | //
5 | // Created by xiaoming han on 15/10/26.
6 | // Copyright © 2015年 Amap. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | #ifndef AMapFoundationVersion_h
12 | #define AMapFoundationVersion_h
13 |
14 | #define AMapFoundationVersionNumber 10400
15 |
16 | FOUNDATION_EXTERN NSString * const AMapFoundationVersion;
17 | FOUNDATION_EXTERN NSString * const AMapFoundationName;
18 |
19 | #endif /* AMapFoundationVersion_h */
20 |
--------------------------------------------------------------------------------
/ios/frameworks/MAMapKit.framework/Headers/MAShape.h:
--------------------------------------------------------------------------------
1 | //
2 | // MAShape.h
3 | // MAMapKit
4 | //
5 | // Created by AutoNavi.
6 | // Copyright (c) 2013年 AutoNavi. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "MAAnnotation.h"
11 |
12 | /*!
13 | @brief 该类为一个抽象类,定义了基于MAAnnotation的MAShape类的基本属性和行为,不能直接使用,必须子类化之后才能使用
14 | */
15 | @interface MAShape : NSObject
16 |
17 | /*!
18 | @brief 标题
19 | */
20 | @property (nonatomic, copy) NSString *title;
21 |
22 | /*!
23 | @brief 副标题
24 | */
25 | @property (nonatomic, copy) NSString *subtitle;
26 |
27 | @end
28 |
--------------------------------------------------------------------------------
/ios/frameworks/MAMapKit.framework/Headers/MAPointAnnotation.h:
--------------------------------------------------------------------------------
1 | //
2 | // MAPointAnnotation.h
3 | // MAMapKit
4 | //
5 | // Created by AutoNavi.
6 | // Copyright (c) 2013年 AutoNavi. All rights reserved.
7 | //
8 |
9 | #import "MAShape.h"
10 |
11 | /*!
12 | @brief 点标注数据
13 | */
14 | @interface MAPointAnnotation : MAShape
15 |
16 | /*!
17 | @brief 经纬度
18 | */
19 | @property (nonatomic, assign) CLLocationCoordinate2D coordinate;
20 |
21 | /**
22 | 是否固定在屏幕一点, 注意,拖动或者手动改变经纬度,都会导致设置失效
23 | */
24 | @property (nonatomic, assign, getter = isLockedToScreen) BOOL lockedToScreen;
25 |
26 | /**
27 | 固定屏幕点的坐标
28 | */
29 | @property (nonatomic, assign) CGPoint lockedScreenPoint;
30 |
31 | @end
32 |
--------------------------------------------------------------------------------
/ios/frameworks/MAMapKit.framework/Headers/MACircleView.h:
--------------------------------------------------------------------------------
1 | //
2 | // MACircleView.h
3 | // MAMapKitNew
4 | //
5 | // Created by AutoNavi.
6 | // Copyright (c) 2014年 AutoNavi. All rights reserved.
7 | //
8 |
9 | #import "MAOverlayPathView.h"
10 | #import "MACircle.h"
11 |
12 | /*!
13 | @brief 该类是MACircle的显示圆View,可以通过MAOverlayPathView修改其fill和stroke attributes
14 | */
15 | @interface MACircleView : MAOverlayPathView
16 |
17 | /*!
18 | @brief 根据指定圆生成对应的View
19 | @param circle 指定的MACircle model
20 | @return 生成的View
21 | */
22 | - (id)initWithCircle:(MACircle *)circle;
23 |
24 | /*!
25 | @brief 关联的MAcirlce model
26 | */
27 | @property (nonatomic, readonly) MACircle *circle;
28 |
29 | @end
30 |
--------------------------------------------------------------------------------
/ios/frameworks/MAMapKit.framework/Headers/MAPolygonView.h:
--------------------------------------------------------------------------------
1 | //
2 | // MAPolygonView.h
3 | // MAMapKitNew
4 | //
5 | // Created by AutoNavi.
6 | // Copyright (c) 2014年 AutoNavi. All rights reserved.
7 | //
8 |
9 | #import "MAOverlayPathView.h"
10 | #import "MAPolygon.h"
11 |
12 | /*!
13 | @brief 此类是MAPolygon的显示多边形View,可以通过MAOverlayPathView修改其fill和stroke attributes
14 | */
15 | @interface MAPolygonView : MAOverlayPathView
16 |
17 | /*!
18 | @brief 根据指定的多边形生成一个多边形view
19 | @param polygon 指定的多边形数据对象
20 | @return 新生成的多边形view
21 | */
22 | - (id)initWithPolygon:(MAPolygon *)polygon;
23 |
24 | /*!
25 | @brief 关联的MAPolygon model
26 | */
27 | @property (nonatomic, readonly) MAPolygon *polygon;
28 |
29 | @end
30 |
--------------------------------------------------------------------------------
/ios/RCTAMap/PrefixHeader.pch:
--------------------------------------------------------------------------------
1 | //
2 | // PrefixHeader.pch
3 | // MAMapKit_2D_Demo
4 | //
5 | // Created by shaobin on 16/8/9.
6 | // Copyright © 2016年 Autonavi. All rights reserved.
7 | //
8 |
9 | #ifndef PrefixHeader_pch
10 | #define PrefixHeader_pch
11 |
12 | // Include any system framework and library headers here that should be included in all compilation units.
13 | // You will also need to set the Prefix Header build setting of one or more of your targets to reference this file.
14 |
15 | #import
16 | #import
17 | #import
18 | #import "APIKey.h"
19 | #import "RouteCommon.h"
20 |
21 | #endif /* PrefixHeader_pch */
22 |
--------------------------------------------------------------------------------
/ios/RCTAMap/RCTAMap/PrefixHeader.pch:
--------------------------------------------------------------------------------
1 | //
2 | // PrefixHeader.pch
3 | // MAMapKit_2D_Demo
4 | //
5 | // Created by shaobin on 16/8/9.
6 | // Copyright © 2016年 Autonavi. All rights reserved.
7 | //
8 |
9 | #ifndef PrefixHeader_pch
10 | #define PrefixHeader_pch
11 |
12 | // Include any system framework and library headers here that should be included in all compilation units.
13 | // You will also need to set the Prefix Header build setting of one or more of your targets to reference this file.
14 |
15 | #import
16 | #import
17 | #import
18 | #import "APIKey.h"
19 | #import "RouteCommon.h"
20 |
21 | #endif /* PrefixHeader_pch */
22 |
--------------------------------------------------------------------------------
/ios/frameworks/MAMapKit.framework/Headers/MAPolylineView.h:
--------------------------------------------------------------------------------
1 | //
2 | // MAPolylineView.h
3 | // MAMapKitNew
4 | //
5 | // Created by AutoNavi.
6 | // Copyright (c) 2014年 AutoNavi. All rights reserved.
7 | //
8 |
9 | #import "MAOverlayPathView.h"
10 | #import "MAPolyline.h"
11 |
12 | /*!
13 | @brief 此类是MAPolyline的显示多段线View,可以通过MAOverlayPathView修改其fill和stroke attributes
14 | */
15 | @interface MAPolylineView : MAOverlayPathView
16 |
17 | /*!
18 | @brief 根据指定的MAPolyline生成一个多段线view
19 | @param polyline 指定MAPolyline
20 | @return 新生成的多段线view
21 | */
22 | - (id)initWithPolyline:(MAPolyline *)polyline;
23 |
24 | /*!
25 | @brief 关联的MAPolyline model
26 | */
27 | @property (nonatomic, readonly) MAPolyline *polyline;
28 |
29 | @end
30 |
--------------------------------------------------------------------------------
/ios/frameworks/MAMapKit.framework/Headers/MACircleRenderer.h:
--------------------------------------------------------------------------------
1 | //
2 | // MACircleRenderer.h
3 | // MAMapKit
4 | //
5 | // Created by AutoNavi.
6 | // Copyright (c) 2013年 AutoNavi. All rights reserved.
7 | //
8 |
9 | #import "MACircle.h"
10 | #import "MAOverlayPathRenderer.h"
11 |
12 | /*!
13 | @brief 该类是MACircle的显示圆renderer,可以通过MAOverlayPathRenderer修改其fill和stroke attributes
14 | */
15 | @interface MACircleRenderer : MAOverlayPathRenderer
16 |
17 | /*!
18 | @brief 根据指定圆生成对应的Renderer
19 | @param circle 指定的MACircle model
20 | @return 生成的Renderer
21 | */
22 | - (instancetype)initWithCircle:(MACircle *)circle;
23 |
24 | /*!
25 | @brief 关联的MAcirlce model
26 | */
27 | @property (nonatomic, readonly) MACircle *circle;
28 |
29 | @end
30 |
--------------------------------------------------------------------------------
/ios/frameworks/MAMapKit.framework/Headers/MAPolygonRenderer.h:
--------------------------------------------------------------------------------
1 | //
2 | // MAPolygonRenderer.h
3 | // MAMapKit
4 | //
5 | // Created by AutoNavi.
6 | // Copyright (c) 2013年 AutoNavi. All rights reserved.
7 | //
8 |
9 | #import "MAOverlayPathRenderer.h"
10 | #import "MAPolygon.h"
11 |
12 | /*!
13 | @brief 此类是MAPolygon的显示多边形Renderer,可以通过MAOverlayPathRenderer修改其fill和stroke attributes
14 | */
15 | @interface MAPolygonRenderer : MAOverlayPathRenderer
16 |
17 | /*!
18 | @brief 根据指定的多边形生成一个多边形renderer
19 | @param polygon 指定的多边形数据对象
20 | @return 新生成的多边形renderer
21 | */
22 | - (id)initWithPolygon:(MAPolygon *)polygon;
23 |
24 | /*!
25 | @brief 关联的MAPolygon model
26 | */
27 | @property (nonatomic, readonly) MAPolygon *polygon;
28 |
29 | @end
30 |
--------------------------------------------------------------------------------
/android/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/cyqresig/Library/Android/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/ios/frameworks/MAMapKit.framework/Headers/MAPolylineRenderer.h:
--------------------------------------------------------------------------------
1 | //
2 | // MAPolylineRenderer.h
3 | // MAMapKit
4 | //
5 | // Created by AutoNavi.
6 | // Copyright (c) 2013年 AutoNavi. All rights reserved.
7 | //
8 |
9 | #import "MAOverlayPathRenderer.h"
10 | #import "MAPolyline.h"
11 |
12 | /*!
13 | @brief 此类是MAPolyline的显示多段线renderer,可以通过MAOverlayPathRenderer修改其fill和stroke attributes
14 | */
15 | @interface MAPolylineRenderer : MAOverlayPathRenderer
16 |
17 | /*!
18 | @brief 根据指定的MAPolyline生成一个多段线renderer
19 | @param polyline 指定MAPolyline
20 | @return 新生成的多段线renderer
21 | */
22 | - (id)initWithPolyline:(MAPolyline *)polyline;
23 |
24 | /*!
25 | @brief 关联的MAPolyline model
26 | */
27 | @property (nonatomic, readonly) MAPolyline *polyline;
28 |
29 | @end
30 |
--------------------------------------------------------------------------------
/ios/frameworks/MAMapKit.framework/Headers/MAGroundOverlayView.h:
--------------------------------------------------------------------------------
1 | //
2 | // MAGroundOverlayView.h
3 | // MAMapKitNew
4 | //
5 | // Created by AutoNavi.
6 | // Copyright (c) 2014年 AutoNavi. All rights reserved.
7 | //
8 |
9 | #import "MAOverlayView.h"
10 | #import "MAGroundOverlay.h"
11 |
12 | /*!
13 | @brief 此类是将MAGroundOverlay中的覆盖图片显示在地图上的View;
14 | */
15 | @interface MAGroundOverlayView : MAOverlayView
16 |
17 | /*!
18 | @brief groundOverlay 具有覆盖图片,以及图片覆盖的区域
19 | */
20 | @property (nonatomic ,readonly) MAGroundOverlay *groundOverlay;
21 |
22 | /*!
23 | @brief 根据指定的GroundOverlay生成将图片显示在地图上View
24 | @param groundOverlay 制定了覆盖图片,以及图片的覆盖区域的groundOverlay
25 | @return 以GroundOverlay新生成View
26 | */
27 | - (id)initWithGroundOverlay:(MAGroundOverlay *)groundOverlay;
28 |
29 |
30 | @end
31 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "react-native-smart-amap",
3 | "version": "1.0.7",
4 | "description": "A AMap Library for React Native apps.",
5 | "main": "AMap.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "repository": {
10 | "type": "git",
11 | "url": "git+https://github.com/react-native-component/react-native-smart-amap.git"
12 | },
13 | "keywords": [
14 | "react-native",
15 | "smart",
16 | "map",
17 | "amap",
18 | "component"
19 | ],
20 | "author": "HISAME SHIZUMARU",
21 | "license": "MIT",
22 | "bugs": {
23 | "url": "https://github.com/react-native-component/react-native-smart-amap/issues"
24 | },
25 | "homepage": "https://github.com/react-native-component/react-native-smart-amap#readme"
26 | }
27 |
--------------------------------------------------------------------------------
/ios/frameworks/MAMapKit.framework/Headers/MATileOverlayView.h:
--------------------------------------------------------------------------------
1 | //
2 | // MATileOverlayView.h
3 | // MAMapKitNew
4 | //
5 | // Created by xiaoming han on 14-5-4.
6 | // Copyright (c) 2014年 AutoNavi. All rights reserved.
7 | //
8 |
9 | #import "MAOverlayView.h"
10 | #import "MATileOverlay.h"
11 |
12 | /*!
13 | @brief 此类将MATileOverlay中的tile渲染到地图上
14 | */
15 | @interface MATileOverlayView : MAOverlayView
16 |
17 | /*!
18 | @brief 覆盖在球面墨卡托投影上的图片tiles的数据源
19 | */
20 | @property (nonatomic ,readonly) MATileOverlay *tileOverlay;
21 |
22 | /*!
23 | @brief 根据指定的tileOverlay生成MAOverlayView
24 | @param overlay 数据源
25 | @return 初始化成功则返回overlayView,否则返回nil
26 | */
27 | - (id)initWithTileOverlay:(MATileOverlay *)overlay;
28 |
29 | /*!
30 | @brief 清除所有tile的缓存,并刷新overlay
31 | */
32 | - (void)reloadData;
33 |
34 | @end
35 |
--------------------------------------------------------------------------------
/ios/frameworks/MAMapKit.framework/Headers/MAGroundOverlayRenderer.h:
--------------------------------------------------------------------------------
1 | //
2 | // MAGroundOverlayRenderer.h
3 | // DevDemo2D
4 | //
5 | // Created by AutoNavi.
6 | // Copyright (c) 2014年 AutoNavi. All rights reserved.
7 | //
8 |
9 | #import "MAOverlayRenderer.h"
10 | #import "MAGroundOverlay.h"
11 |
12 | /*!
13 | @brief 此类是将MAGroundOverlay中的覆盖图片显示在地图上的renderer;
14 | */
15 | @interface MAGroundOverlayRenderer : MAOverlayRenderer
16 |
17 | /*!
18 | @brief groundOverlay 具有覆盖图片,以及图片覆盖的区域
19 | */
20 | @property (nonatomic ,readonly) MAGroundOverlay *groundOverlay;
21 |
22 | /*!
23 | @brief 根据指定的GroundOverlay生成将图片显示在地图上Renderer
24 | @param groundOverlay 制定了覆盖图片,以及图片的覆盖区域的groundOverlay
25 | @return 以GroundOverlay新生成Renderer
26 | */
27 | - (instancetype)initWithGroundOverlay:(MAGroundOverlay *)groundOverlay;
28 |
29 | @end
30 |
--------------------------------------------------------------------------------
/ios/frameworks/MAMapKit.framework/Headers/MAPinAnnotationView.h:
--------------------------------------------------------------------------------
1 | //
2 | // MAPinAnnotationView.h
3 | // MAMapKit
4 | //
5 | // Created by AutoNavi.
6 | // Copyright (c) 2013年 AutoNavi. All rights reserved.
7 | //
8 |
9 | #import "MAAnnotationView.h"
10 |
11 | typedef NS_ENUM(NSInteger, MAPinAnnotationColor) {
12 | MAPinAnnotationColorRed = 0,
13 | MAPinAnnotationColorGreen,
14 | MAPinAnnotationColorPurple
15 | };
16 |
17 | /*!
18 | @brief 提供类似大头针效果的annotation view
19 | */
20 | @interface MAPinAnnotationView : MAAnnotationView
21 |
22 | /*!
23 | @brief 大头针的颜色,有MAPinAnnotationColorRed, MAPinAnnotationColorGreen, MAPinAnnotationColorPurple三种
24 | */
25 | @property (nonatomic) MAPinAnnotationColor pinColor;
26 |
27 | /*!
28 | @brief 动画效果
29 | */
30 | @property (nonatomic) BOOL animatesDrop;
31 |
32 | @end
33 |
--------------------------------------------------------------------------------
/ios/frameworks/MAMapKit.framework/Headers/MAGeodesicPolyline.h:
--------------------------------------------------------------------------------
1 | //
2 | // MAGeodesicPolyline.h
3 | // MapKit_static
4 | //
5 | // Created by AutoNavi.
6 | // Copyright (c) 2013年 AutoNavi. All rights reserved.
7 | //
8 |
9 | #import "MAPolyline.h"
10 |
11 | @interface MAGeodesicPolyline : MAPolyline
12 |
13 | /*!
14 | @brief 根据map point数据生成Geodesic
15 | @param points map point数据,points对应的内存会拷贝,调用者负责该内存的释放
16 | @param count map point个数
17 | @return 生成的Geodesic
18 | */
19 | + (instancetype)polylineWithPoints:(MAMapPoint *)points count:(NSUInteger)count;
20 |
21 | /*!
22 | @brief 根据经纬度坐标数据生成Geodesic
23 | @param coords 经纬度坐标数据,coords对应的内存会拷贝,调用者负责该内存的释放
24 | @param count 经纬度坐标个数
25 | @return 生成的Geodesic
26 | */
27 | + (instancetype)polylineWithCoordinates:(CLLocationCoordinate2D *)coords count:(NSUInteger)count;
28 |
29 | @end
30 |
--------------------------------------------------------------------------------
/ios/frameworks/MAMapKit.framework/Headers/MAMapVersion.h:
--------------------------------------------------------------------------------
1 | //
2 | // MAMapVersion.h
3 | // MAMapKit
4 | //
5 | // Created by yi chen on 2/24/16.
6 | // Copyright © 2016 AutoNavi. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | #ifndef MAMapVersion_h
12 | #define MAMapVersion_h
13 |
14 | #define MAMapVersionNumber 40400
15 | #define MAMapMinRequiredFoundationVersion 10200
16 |
17 | // 依赖库版本检测
18 | #if AMapFoundationVersionNumber < MAMapMinRequiredFoundationVersion
19 | #error "The AMapFoundationKit version is less than minimum required, please update! Any questions please to visit http://lbs.amap.com"
20 | #endif
21 |
22 | FOUNDATION_EXTERN NSString * const MAMapKitVersion;
23 | FOUNDATION_EXTERN NSString * const MAMapKitName;
24 |
25 |
26 | #endif /* MAMapVersion_h */
27 |
--------------------------------------------------------------------------------
/android/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | compileSdkVersion 23
5 | buildToolsVersion "23.0.3"
6 |
7 | defaultConfig {
8 | minSdkVersion 16
9 | targetSdkVersion 23
10 | versionCode 1
11 | versionName "1.0"
12 | }
13 | buildTypes {
14 | release {
15 | minifyEnabled false
16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
17 | }
18 | }
19 | }
20 |
21 | dependencies {
22 | compile fileTree(include: ['*.jar'], dir: 'libs')
23 | compile 'com.android.support:appcompat-v7:23.4.0'
24 | compile 'com.facebook.react:react-native:+'
25 | compile 'com.amap.api:map2d:2.9.1'
26 | compile 'com.amap.api:search:3.5.0.1'
27 | compile 'com.amap.api:location:3.1.0'
28 | }
29 |
--------------------------------------------------------------------------------
/ios/frameworks/MAMapKit.framework/Headers/MATileOverlayRenderer.h:
--------------------------------------------------------------------------------
1 | //
2 | // MATileOverlayRenderer.h
3 | // MAMapKitNew
4 | //
5 | // Created by xiaoming han on 14-1-24.
6 | // Copyright (c) 2014年 AutoNavi. All rights reserved.
7 | //
8 |
9 | #import "MAOverlayRenderer.h"
10 | #import "MATileOverlay.h"
11 |
12 | /*!
13 | @brief 此类将MATileOverlay中的tile渲染到地图上
14 | */
15 | @interface MATileOverlayRenderer : MAOverlayRenderer
16 |
17 | /*!
18 | @brief 覆盖在球面墨卡托投影上的图片tiles的数据源
19 | */
20 | @property (nonatomic ,readonly) MATileOverlay *tileOverlay;
21 |
22 | /*!
23 | @brief 根据指定的tileOverlay生成MATileOverlayRenderer
24 | @param overlay 数据源
25 | @return 初始化成功则返回overlay renderer,否则返回nil
26 | */
27 | - (instancetype)initWithTileOverlay:(MATileOverlay *)overlay;
28 |
29 | /*!
30 | @brief 清除所有tile的缓存,并刷新overlay
31 | */
32 | - (void)reloadData;
33 |
34 | @end
35 |
--------------------------------------------------------------------------------
/ios/frameworks/MAMapKit.framework/Headers/MAOverlay.h:
--------------------------------------------------------------------------------
1 | //
2 | // MAOverlay.h
3 | // MAMapKit
4 | //
5 | // Created by AutoNavi.
6 | // Copyright (c) 2013年 AutoNavi. All rights reserved.
7 | //
8 |
9 | #import "MAAnnotation.h"
10 | #import "MAGeometry.h"
11 |
12 | /*!
13 | @brief 该类是地图覆盖物的基类,所有地图的覆盖物需要继承自此类
14 | */
15 | @protocol MAOverlay
16 | @required
17 |
18 | /*!
19 | @brief 返回区域中心坐标.
20 | */
21 | @property (nonatomic, readonly) CLLocationCoordinate2D coordinate;
22 |
23 | /*!
24 | @brief 区域外接矩形
25 | */
26 | @property (nonatomic, readonly) MAMapRect boundingMapRect;
27 |
28 | @optional
29 |
30 | /*!
31 | @brief 判断boundingMapRect和给定的mapRect是否相交,可以用MAMapRectIntersectsRect([overlay boundingMapRect], mapRect)替代
32 | @param mapRect 指定的map rect
33 | @return 两个矩形是否相交
34 | */
35 | - (BOOL)intersectsMapRect:(MAMapRect)mapRect;
36 |
37 | @end
38 |
--------------------------------------------------------------------------------
/ios/frameworks/MAMapKit.framework/Headers/MAMultiPoint.h:
--------------------------------------------------------------------------------
1 | //
2 | // MAMultiPoint.h
3 | // MAMapKit
4 | //
5 | // Created by AutoNavi.
6 | // Copyright (c) 2013年 AutoNavi. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "MAGeometry.h"
11 | #import "MAShape.h"
12 |
13 | /*!
14 | @brief 该类是个由多个点组成的虚基类, 不能直接实例化对象, 要使用其子类MAPolyline,MAPolygon来实例化
15 | */
16 | @interface MAMultiPoint : MAShape
17 |
18 | /*!
19 | @brief 坐标点数组
20 | */
21 | @property (nonatomic, readonly) MAMapPoint *points;
22 |
23 | /*!
24 | @brief 坐标点的个数
25 | */
26 | @property (nonatomic, readonly) NSUInteger pointCount;
27 |
28 | /*!
29 | @brief 将内部的坐标点数据转化为经纬度坐标并拷贝到coords内存中
30 | @param coords 调用者提供的内存空间, 该空间长度必须大于等于要拷贝的坐标点的个数(range.length)
31 | @param range 要拷贝的数据范围
32 | */
33 | - (void)getCoordinates:(CLLocationCoordinate2D *)coords range:(NSRange)range;
34 |
35 | @end
36 |
--------------------------------------------------------------------------------
/ios/frameworks/AMapSearchKit.framework/Headers/AMapSearchVersion.h:
--------------------------------------------------------------------------------
1 | //
2 | // AMapSearchVersion.h
3 | // AMapSearchKit
4 | //
5 | // Created by xiaoming han on 15/10/27.
6 | // Copyright © 2015年 AutoNavi. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | #ifndef AMapSearchVersion_h
13 | #define AMapSearchVersion_h
14 |
15 | #define AMapSearchVersionNumber 40400
16 | #define AMapSearchMinRequiredFoundationVersion 10200
17 |
18 | // 依赖库版本检测
19 | #if AMapFoundationVersionNumber < AMapSearchMinRequiredFoundationVersion
20 | #error "The AMapFoundationKit version is less than minimum required, please update! Any questions please to visit http://lbs.amap.com"
21 | #endif
22 |
23 | FOUNDATION_EXTERN NSString * const AMapSearchVersion;
24 | FOUNDATION_EXTERN NSString * const AMapSearchName;
25 |
26 | #endif /* AMapSearchVersion_h */
27 |
--------------------------------------------------------------------------------
/ios/frameworks/MAMapKit.framework/Headers/MAPolyline.h:
--------------------------------------------------------------------------------
1 | //
2 | // MAPolyline.h
3 | // MAMapKit
4 | //
5 | // Created by AutoNavi.
6 | // Copyright (c) 2013年 AutoNavi. All rights reserved.
7 | //
8 |
9 | #import "MAMultiPoint.h"
10 | #import "MAOverlay.h"
11 |
12 | /*!
13 | @brief 此类用于定义一个由多个点相连的多段线,点与点之间尾部想连但第一点与最后一个点不相连, 通常MAPolyline是MAPolylineRenderer的model
14 | */
15 | @interface MAPolyline : MAMultiPoint
16 |
17 | /*!
18 | @brief 根据map point数据生成多段线
19 | @param points map point数据,points对应的内存会拷贝,调用者负责该内存的释放
20 | @param count map point个数
21 | @return 生成的多段线
22 | */
23 | + (instancetype)polylineWithPoints:(MAMapPoint *)points count:(NSUInteger)count;
24 |
25 | /*!
26 | @brief 根据经纬度坐标数据生成多段线
27 | @param coords 经纬度坐标数据,coords对应的内存会拷贝,调用者负责该内存的释放
28 | @param count 经纬度坐标个数
29 | @return 生成的多段线
30 | */
31 | + (instancetype)polylineWithCoordinates:(CLLocationCoordinate2D *)coords count:(NSUInteger)count;
32 |
33 | @end
34 |
--------------------------------------------------------------------------------
/ios/frameworks/AMapFoundationKit.framework/Headers/AMapServices.h:
--------------------------------------------------------------------------------
1 | //
2 | // AMapSearchServices.h
3 | // AMapSearchKit
4 | //
5 | // Created by xiaoming han on 15/6/18.
6 | // Copyright (c) 2015年 xiaoming han. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | ///高德SDK服务类
12 | @interface AMapServices : NSObject
13 |
14 | /**
15 | * @brief 获取单例
16 | */
17 | + (AMapServices *)sharedServices;
18 |
19 | ///APIkey。设置key,需要绑定对应的bundle id。
20 | @property (nonatomic, copy) NSString *apiKey;
21 |
22 | ///是否开启HTTPS,从1.3.3版本开始默认为YES。
23 | @property (nonatomic, assign) BOOL enableHTTPS;
24 |
25 | ///是否启用崩溃日志上传。默认为YES, 只有在真机上设置有效。\n开启崩溃日志上传有助于我们更好的了解SDK的状况,可以帮助我们持续优化和改进SDK。需要注意的是,SDK内部是通过设置NSUncaughtExceptionHandler来捕获异常的,如果您的APP中使用了其他收集崩溃日志的SDK,或者自己有设置NSUncaughtExceptionHandler的话,请保证 AMapServices 的初始化是在其他设置NSUncaughtExceptionHandler操作之后进行的,我们的handler会再处理完异常后调用前一次设置的handler,保证之前设置的handler会被执行。
26 | @property (nonatomic, assign) BOOL crashReportEnabled;
27 |
28 | @end
29 |
--------------------------------------------------------------------------------
/ios/frameworks/AMapSearchKit.framework/Headers/AMapNearbyUploadInfo.h:
--------------------------------------------------------------------------------
1 | //
2 | // AMapNearbyUploadInfo.h
3 | // AMapSearchKit
4 | //
5 | // Created by xiaoming han on 15/9/6.
6 | // Copyright (c) 2015年 AutoNavi. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | /// 上传经纬度类型
13 | typedef NS_ENUM(NSInteger, AMapSearchCoordinateType)
14 | {
15 | AMapSearchCoordinateTypeGPS = 1, //!< 标准GPS坐标
16 | AMapSearchCoordinateTypeAMap = 2, //!< 高德坐标
17 | };
18 |
19 |
20 | /// 附近搜索上传信息
21 | @interface AMapNearbyUploadInfo : NSObject
22 |
23 | /**
24 | * 用户唯一标识,不能为空,否则上传会失败。
25 | * 长度不超过32字符,只能包含英文、数字、下划线、短横杠.
26 | */
27 | @property (nonatomic, copy) NSString *userID;
28 |
29 | /// 坐标类型,默认是 AMapSearchCoordinateTypeAMap
30 | @property (nonatomic, assign) AMapSearchCoordinateType coordinateType;
31 |
32 | /// 用户位置经纬度。
33 | @property (nonatomic, assign) CLLocationCoordinate2D coordinate;
34 |
35 | @end
36 |
--------------------------------------------------------------------------------
/ios/frameworks/AMapFoundationKit.framework/Headers/AMapURLSearch.h:
--------------------------------------------------------------------------------
1 | //
2 | // AMapURLSearch.h
3 | // AMapFoundation
4 | //
5 | // Created by xiaoming han on 15/10/28.
6 | // Copyright © 2015年 Amap. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "AMapURLSearchConfig.h"
11 |
12 | ///调起高德地图URL进行搜索,若是调起失败,可使用`+ (void)getLatestAMapApp;`方法获取最新版高德地图app.
13 | @interface AMapURLSearch : NSObject
14 |
15 | /**
16 | * @brief 打开高德地图AppStore页面
17 | */
18 | + (void)getLatestAMapApp;
19 |
20 | /**
21 | * @brief 调起高德地图app驾车导航.
22 | * @param config 配置参数.
23 | * @return 是否成功.若为YES则成功调起,若为NO则无法调起.
24 | */
25 | + (BOOL)openAMapNavigation:(AMapNaviConfig *)config;
26 |
27 | /**
28 | * @brief 调起高德地图app进行路径规划.
29 | * @param config 配置参数.
30 | * @return 是否成功.
31 | */
32 | + (BOOL)openAMapRouteSearch:(AMapRouteConfig *)config;
33 |
34 | /**
35 | * @brief 调起高德地图app进行POI搜索.
36 | * @param config 配置参数.
37 | * @return 是否成功.
38 | */
39 | + (BOOL)openAMapPOISearch:(AMapPOIConfig *)config;
40 |
41 | @end
42 |
--------------------------------------------------------------------------------
/ios/frameworks/MAMapKit.framework/Headers/MAAnnotation.h:
--------------------------------------------------------------------------------
1 | //
2 | // MAAnnotation.h
3 | // MAMapKit
4 | //
5 | // Created by AutoNavi on 13-12-13.
6 | // Copyright (c) 2013年 AutoNavi. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 | #import
12 |
13 | /*!
14 | @brief 该类为标注点的protocol,提供了标注类的基本信息函数
15 | */
16 | @protocol MAAnnotation
17 |
18 | /*!
19 | @brief 标注view中心坐标
20 | */
21 | @property (nonatomic, readonly) CLLocationCoordinate2D coordinate;
22 |
23 | @optional
24 |
25 | /*!
26 | @brief 获取annotation标题
27 | @return 返回annotation的标题信息
28 | */
29 | @property (nonatomic, readonly, copy) NSString *title;
30 |
31 | /*!
32 | @brief 获取annotation副标题
33 | @return 返回annotation的副标题信息
34 | */
35 | @property (nonatomic, readonly, copy) NSString *subtitle;
36 |
37 | /**
38 | @brief 设置标注的坐标,在拖拽时会被调用.
39 | @param newCoordinate 新的坐标值
40 | */
41 | - (void)setCoordinate:(CLLocationCoordinate2D)newCoordinate;
42 |
43 | @end
44 |
--------------------------------------------------------------------------------
/ios/frameworks/MAMapKit.framework/Headers/MAUserLocation.h:
--------------------------------------------------------------------------------
1 | //
2 | // MAUserLocation.h
3 | // MAMapKit
4 | //
5 | // Created by AutoNavi.
6 | // Copyright (c) 2012年 AutoNavi. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "MAAnnotation.h"
11 |
12 | @class CLLocation;
13 | @class CLHeading;
14 |
15 | /*!
16 | @brief 定位信息类
17 | */
18 | @interface MAUserLocation : NSObject
19 |
20 | /*!
21 | @brief 位置更新状态,如果正在更新位置信息,则该值为YES.
22 | */
23 | @property (nonatomic, readonly, getter = isUpdating) BOOL updating;
24 |
25 | /*!
26 | @brief 位置信息, 如果MAMapView的showsUserLocation为NO, 或者尚未定位成功, 则该值为nil.
27 | */
28 | @property (nonatomic, readonly) CLLocation *location;
29 |
30 | /*!
31 | @brief heading信息.
32 | */
33 | @property (nonatomic, readonly) CLHeading *heading;
34 |
35 | /*!
36 | @brief 定位标注点要显示的标题信息.
37 | */
38 | @property (nonatomic, copy) NSString *title;
39 |
40 | /*!
41 | @brief 定位标注点要显示的子标题信息.
42 | */
43 | @property (nonatomic, copy) NSString *subtitle;
44 |
45 | @end
46 |
47 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2016
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/android/src/main/java/com/reactnativecomponent/amap/RCTAMapPackage.java:
--------------------------------------------------------------------------------
1 | package com.reactnativecomponent.amap;
2 |
3 | import com.facebook.react.ReactPackage;
4 | import com.facebook.react.bridge.JavaScriptModule;
5 | import com.facebook.react.bridge.NativeModule;
6 | import com.facebook.react.bridge.ReactApplicationContext;
7 | import com.facebook.react.uimanager.ViewManager;
8 |
9 | import java.util.Arrays;
10 | import java.util.Collections;
11 | import java.util.List;
12 |
13 |
14 |
15 | public class RCTAMapPackage implements ReactPackage {
16 | @Override
17 | public List createNativeModules(ReactApplicationContext reactContext) {
18 | return Arrays.asList(
19 | new RCTAMapModule(reactContext)
20 | );
21 | }
22 |
23 | @Override
24 | public List> createJSModules() {
25 | return Collections.emptyList();
26 | }
27 |
28 | @Override
29 | public List createViewManagers(ReactApplicationContext reactContext) {
30 | return Arrays.asList(
31 | new RCTAMapManager());
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/ios/frameworks/MAMapKit.framework/Headers/MAMultiColoredPolylineRenderer.h:
--------------------------------------------------------------------------------
1 | //
2 | // MAMultiColoredPolylineRenderer.h
3 | // MapKit_static
4 | //
5 | // Created by yi chen on 12/11/15.
6 | // Copyright © 2015 songjian. All rights reserved.
7 | //
8 |
9 | #import "MAPolylineRenderer.h"
10 | #import "MAMultiPolyline.h"
11 |
12 | /*!
13 | 此类用于绘制MAMultiPolyline对应的多段线,支持分段颜色绘制
14 | MAMultiColoredPolylineRenderer仅支持lineJoin = kCGLineJoinRound, lineCap = kCGLineCapRound,设为其他值无效。
15 | */
16 | @interface MAMultiColoredPolylineRenderer : MAPolylineRenderer
17 |
18 | /*!
19 | @brief 根据指定的MAPolyline生成一个多段线Renderer
20 | @param multiPolyline 指定MAMultiPolyline
21 | @return 新生成的多段线Renderer
22 | */
23 | - (instancetype)initWithMultiPolyline:(MAMultiPolyline *)multiPolyline;
24 |
25 | /*!
26 | @brief 关联的MAMultiPolyline model
27 | */
28 | @property (nonatomic, readonly) MAMultiPolyline *multiPolyline;
29 |
30 | /*!
31 | @brief 分段绘制的颜色。
32 | 需要分段颜色绘制时,必须设置(内容必须为UIColor)
33 | */
34 | @property (nonatomic, strong) NSArray *strokeColors;
35 |
36 | /*!
37 | @brief 颜色是否渐变。
38 | 在颜色渐变情况下,暂不支持虚线绘制。
39 | */
40 | @property (nonatomic, assign, getter=isGradient) BOOL gradient;
41 |
42 | @end
43 |
--------------------------------------------------------------------------------
/ios/frameworks/MAMapKit.framework/Headers/MAUserLocationRepresentation.h:
--------------------------------------------------------------------------------
1 | //
2 | // MAUserLocationRepresentation.h
3 | // MAMapKitNew
4 | //
5 | // Created by AutoNavi.
6 | // Copyright (c) 2014年 AutoNavi. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | /*!
13 | @brief 精度圈样式信息
14 | */
15 | @interface MAUserLocationRepresentation : NSObject
16 |
17 | /*!
18 | @brief 标注图片。若设置为nil,则为默认图片。
19 | */
20 | @property (nonatomic, strong) UIImage *image;
21 |
22 | /*!
23 | @brief 是否显示精度圈。默认为YES
24 | */
25 | @property (nonatomic, assign) BOOL showsAccuracyRing;
26 |
27 | /*!
28 | @brief 是否显示方向指示(MAUserTrackingModeFollowWithHeading模式开启)。默认为YES
29 | */
30 | @property (nonatomic, assign) BOOL showsHeadingIndicator;
31 |
32 | /*!
33 | @brief 精度圈边线宽度,默认是2
34 | */
35 | @property (nonatomic, assign) CGFloat lineWidth;
36 |
37 | /*!
38 | @brief 精度圈填充颜色
39 | */
40 | @property (nonatomic, strong) UIColor *fillColor;
41 |
42 | /*!
43 | @brief 精度圈边线颜色
44 | */
45 | @property (nonatomic, strong) UIColor *strokeColor;
46 |
47 | /*!
48 | @brief 边线虚线样式, 默认是nil
49 | */
50 | @property (nonatomic, copy) NSArray *lineDashPattern;
51 |
52 | @end
53 |
--------------------------------------------------------------------------------
/ios/frameworks/MAMapKit.framework/Headers/MACircle.h:
--------------------------------------------------------------------------------
1 | //
2 | // MACircle.h
3 | // MAMapKit
4 | //
5 | // Created by AutoNavi.
6 | // Copyright (c) 2013年 AutoNavi. All rights reserved.
7 | //
8 |
9 | #import "MAShape.h"
10 | #import "MAOverlay.h"
11 | #import "MAGeometry.h"
12 |
13 | /*!
14 | @brief 该类用于定义一个圆, 通常MACircle是MACircleRenderer的model
15 | */
16 | @interface MACircle : MAShape
17 |
18 | /*!
19 | @brief 根据中心点和半径生成圆
20 | @param coord 中心点的经纬度坐标
21 | @param radius 半径,单位:米
22 | @return 新生成的圆
23 | */
24 | + (instancetype)circleWithCenterCoordinate:(CLLocationCoordinate2D)coord
25 | radius:(CLLocationDistance)radius;
26 |
27 | /*!
28 | @brief 根据map rect生成圆
29 | @param mapRect 生成的圆的直径为MAX(width, height)
30 | @return 新生成的圆
31 | */
32 | + (instancetype)circleWithMapRect:(MAMapRect)mapRect;
33 |
34 | /*!
35 | @brief 中心点经纬度坐标
36 | */
37 | @property (nonatomic, readonly) CLLocationCoordinate2D coordinate;
38 |
39 | /*!
40 | @brief 半径,单位:米
41 | */
42 | @property (nonatomic, readonly) CLLocationDistance radius;
43 |
44 | /*!
45 | @brief 该圆的外接map rect
46 | */
47 | @property (nonatomic, readonly) MAMapRect boundingMapRect;
48 |
49 | @end
50 |
--------------------------------------------------------------------------------
/ios/frameworks/MAMapKit.framework/Headers/MAMultiPolyline.h:
--------------------------------------------------------------------------------
1 | //
2 | // MAMultiPolyline.h
3 | // MapKit_static
4 | //
5 | // Created by yi chen on 12/11/15.
6 | // Copyright © 2015 songjian. All rights reserved.
7 | //
8 |
9 | #import "MAPolyline.h"
10 |
11 | /*!
12 | @brief 此类用于定义一个由多个点相连的多段线,绘制时支持分段采用不同颜色绘制,点与点之间尾部相连但第一点与最后一个点不相连, 通常MAMultiPolyline是MAMultiColoredPolylineRenderer(分段颜色绘制)model
13 | */
14 | @interface MAMultiPolyline : MAPolyline
15 |
16 | /*!
17 | @brief 颜色索引数组,成员为NSNumber,且为非负数,负数按0处理
18 | */
19 | @property (nonatomic, strong, readonly) NSArray *drawStyleIndexes;
20 |
21 | /*!
22 | @brief 分段绘制,根据map point数据生成多段线
23 |
24 | 分段颜色绘制:其对应的MAMultiColoredPolylineRenderer必须设置strokeColors属性
25 |
26 | @param points 指定的直角坐标点数组
27 | @param count 坐标点的个数
28 | @param drawStyleIndexes 颜色索引数组,成员为NSNumber,且为非负数,负数按0处理
29 | @return 新生成的折线对象
30 | */
31 | + (instancetype)polylineWithPoints:(MAMapPoint *)points count:(NSUInteger)count drawStyleIndexes:(NSArray*)drawStyleIndexes;
32 |
33 | /*!
34 | @brief 分段绘制,根据经纬度坐标数据生成多段线
35 |
36 | 分段颜色绘制:其对应的MAMultiColoredPolylineRenderer必须设置strokeColors属性
37 |
38 | @param coords 指定的经纬度坐标点数组
39 | @param count 坐标点的个数
40 | @param drawStyleIndexes 颜色索引数组,成员为NSNumber,且为非负数,负数按0处理
41 | @return 新生成的折线对象
42 | */
43 | + (instancetype)polylineWithCoordinates:(CLLocationCoordinate2D *)coords count:(NSUInteger)count drawStyleIndexes:(NSArray*)drawStyleIndexes;
44 |
45 | @end
46 |
--------------------------------------------------------------------------------
/ios/frameworks/AMapFoundationKit.framework/Headers/AMapUtility.h:
--------------------------------------------------------------------------------
1 | //
2 | // AMapUtility.h
3 | // AMapFoundation
4 | //
5 | // Created by xiaoming han on 15/10/27.
6 | // Copyright © 2015年 Amap. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | //工具方法
13 |
14 | /**
15 | * @brief 如果字符串为nil则返回空字符串
16 | */
17 | FOUNDATION_STATIC_INLINE NSString * AMapEmptyStringIfNil(NSString *s)
18 | {
19 | return s ? s : @"";
20 | }
21 |
22 | ///坐标类型枚举
23 | typedef NS_ENUM(NSUInteger, AMapCoordinateType)
24 | {
25 | AMapCoordinateTypeBaidu = 0, ///
25 |
26 | @property (nonatomic, readonly) NSArray *colors; // default [blue,green,red]
27 | @property (nonatomic, readonly) NSArray *startPoints; // default [@(0.2),@(0.5),@(0,9)]
28 |
29 | ///重新设置gradient的时候,需要执行 MATileOverlayView 中的 reloadData 方法.
30 | - (instancetype)initWithColor:(NSArray *)colors andWithStartPoints:(NSArray *)startPoints;
31 |
32 | @end
33 |
34 | /**
35 | * 热力图tileOverlay
36 | */
37 | @interface MAHeatMapTileOverlay : MATileOverlay
38 |
39 | @property (nonatomic, strong) NSArray *data; // MAHeatMapNode array
40 | @property (nonatomic, assign) NSInteger radius; // 12, 范围:0-100 screen point
41 | @property (nonatomic, assign) CGFloat opacity; // 0.6,范围:0-1
42 |
43 | @property (nonatomic, strong) MAHeatMapGradient *gradient;
44 |
45 | @property (nonatomic, assign) BOOL allowRetinaAdapting; //是否开启高清热力图,默认关闭。
46 |
47 | @end
48 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/ios/frameworks/MAMapKit.framework/Headers/MAGroundOverlay.h:
--------------------------------------------------------------------------------
1 | //
2 | // MAGroundOverlay.h
3 | // DevDemo2D
4 | //
5 | // Created by AutoNavi.
6 | // Copyright (c) 2014年 AutoNavi. All rights reserved.
7 | //
8 |
9 | #import "MAShape.h"
10 | #import "MAOverlay.h"
11 |
12 | /*!
13 | @brief 该类用于确定覆盖在地图上的图片,及其覆盖区域, 通常MAGroundOverlay是MAGroundOverlayRenderer的model
14 | */
15 | @interface MAGroundOverlay : MAShape
16 |
17 | /*!
18 | @brief 绘制在地图上的覆盖图片
19 | */
20 | @property (nonatomic, readonly) UIImage *icon;
21 |
22 | /*!
23 | @brief 覆盖图片在地图尺寸等同于其像素的zoom值
24 | */
25 | @property (nonatomic, readonly) CGFloat zoomLevel;
26 |
27 | /*!
28 | @brief 图片在地图中的覆盖范围
29 | */
30 | @property (nonatomic, readonly) MACoordinateBounds bounds;
31 |
32 | /*!
33 | @brief 根据bounds值和icon生成GroundOverlay
34 | @param bounds 图片的在地图的覆盖范围
35 | @param icon 覆盖图片
36 | @return 以bounds和icon 新生成GroundOverlay
37 | */
38 | + (instancetype)groundOverlayWithBounds:(MACoordinateBounds)bounds
39 | icon:(UIImage *)icon;
40 |
41 | /*!
42 | @brief 根据coordinate,icon,zoomLevel生成GroundOverlay
43 | @param coordinate 图片的在地图上的中心点
44 | @param zoomLevel 图片在地图尺寸等同于像素的zoom值
45 | @param icon 覆盖图片
46 | @return 以coordinate,icon,zoomLevel 新生成GroundOverlay
47 | */
48 | + (instancetype)groundOverlayWithCoordinate:(CLLocationCoordinate2D)coordinate
49 | zoomLevel:(CGFloat)zoomLevel
50 | icon:(UIImage *)icon;
51 |
52 | @end
53 |
--------------------------------------------------------------------------------
/ios/frameworks/AMapFoundationKit.framework/Headers/AMapURLSearchType.h:
--------------------------------------------------------------------------------
1 | //
2 | // MAMapURLSearchType.h
3 | // MAMapKitNew
4 | //
5 | // Created by xiaoming han on 15/5/25.
6 | // Copyright (c) 2015年 xiaoming han. All rights reserved.
7 | //
8 |
9 | ///驾车策略
10 | typedef NS_ENUM(NSInteger, AMapDrivingStrategy)
11 | {
12 | AMapDrivingStrategyFastest = 0, ///<速度最快
13 | AMapDrivingStrategyMinFare = 1, ///<避免收费
14 | AMapDrivingStrategyShortest = 2, ///<距离最短
15 |
16 | AMapDrivingStrategyNoHighways = 3, ///<不走高速
17 | AMapDrivingStrategyAvoidCongestion = 4, ///<躲避拥堵
18 |
19 | AMapDrivingStrategyAvoidHighwaysAndFare = 5, ///<不走高速且避免收费
20 | AMapDrivingStrategyAvoidHighwaysAndCongestion = 6, ///<不走高速且躲避拥堵
21 | AMapDrivingStrategyAvoidFareAndCongestion = 7, ///<躲避收费和拥堵
22 | AMapDrivingStrategyAvoidHighwaysAndFareAndCongestion = 8 ///<不走高速躲避收费和拥堵
23 | };
24 |
25 | ///公交策略
26 | typedef NS_ENUM(NSInteger, AMapTransitStrategy)
27 | {
28 | AMapTransitStrategyFastest = 0,///<最快捷
29 | AMapTransitStrategyMinFare = 1,///<最经济
30 | AMapTransitStrategyMinTransfer = 2,///<最少换乘
31 | AMapTransitStrategyMinWalk = 3,///<最少步行
32 | AMapTransitStrategyMostComfortable = 4,///<最舒适
33 | AMapTransitStrategyAvoidSubway = 5,///<不乘地铁
34 | };
35 |
36 | ///路径规划类型
37 | typedef NS_ENUM(NSInteger, AMapRouteSearchType)
38 | {
39 | AMapRouteSearchTypeDriving = 0, ///<驾车
40 | AMapRouteSearchTypeTransit = 1, ///<公交
41 | AMapRouteSearchTypeWalking = 2, ///<步行
42 | };
43 |
44 |
45 |
--------------------------------------------------------------------------------
/ios/frameworks/MAMapKit.framework/Headers/MAMapKit.h:
--------------------------------------------------------------------------------
1 | //
2 | // MAMapKit.h
3 | // MAMapKit
4 | //
5 | // Created by xiaoming han on 15/12/7.
6 | // Copyright © 2015年 AutoNavi. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 | #import
12 | #import
13 | #import
14 | #import
15 | #import
16 | #import
17 | #import
18 | #import
19 | #import
20 | #import
21 | #import
22 | #import
23 | #import
24 | #import
25 | #import
26 | #import
27 | #import
28 | #import
29 | #import
30 | #import
31 | #import
32 | #import
33 | #import
34 | #import
35 | #import
36 | #import
37 |
38 | #pragma mark - deprecated
39 |
40 | #import
41 | #import
42 | #import
43 | #import
44 | #import
45 | #import
46 | #import
47 |
48 |
--------------------------------------------------------------------------------
/ios/frameworks/MAMapKit.framework/Headers/MAPolygon.h:
--------------------------------------------------------------------------------
1 | //
2 | // MAPolygon.h
3 | // MAMapKit
4 | //
5 | // Created by AutoNavi.
6 | // Copyright (c) 2013年 AutoNavi. All rights reserved.
7 | //
8 |
9 | #import "MAMultiPoint.h"
10 | #import "MAOverlay.h"
11 |
12 | /*!
13 | @brief 此类用于定义一个由多个点组成的闭合多边形, 点与点之间按顺序尾部相连, 第一个点与最后一个点相连, 通常MAPolygon是MAPolygonRenderer的model
14 | */
15 | @interface MAPolygon : MAMultiPoint
16 |
17 | /*!
18 | @brief 根据map point数据生成多边形
19 | @param points map point数据,points对应的内存会拷贝,调用者负责该内存的释放
20 | @param count 点的个数
21 | @return 新生成的多边形
22 | */
23 | + (instancetype)polygonWithPoints:(MAMapPoint *)points count:(NSUInteger)count;
24 |
25 | /*!
26 | @brief 根据map point数据和interior polygons生成多边形
27 | @param points map point数据,points对应的内存会拷贝,调用者负责该内存的释放
28 | @param count 点的个数
29 | @param interiorPolygons MAPolygon数组,指定在生成的多边形中需要裁剪掉的区域
30 | @return 新生成的多边形
31 | */
32 | + (instancetype)polygonWithPoints:(MAMapPoint *)points count:(NSUInteger)count interiorPolygons:(NSArray *)interiorPolygons;
33 |
34 | /*!
35 | @brief 根据经纬度坐标数据生成闭合多边形
36 | @param coords 经纬度坐标点数据,coords对应的内存会拷贝,调用者负责该内存的释放
37 | @param count 经纬度坐标点数组个数
38 | @return 新生成的多边形
39 | */
40 | + (instancetype)polygonWithCoordinates:(CLLocationCoordinate2D *)coords count:(NSUInteger)count;
41 |
42 | /*!
43 | @brief 根据经纬度坐标数据和interior polygons生成闭合多边形
44 | @param coords 经纬度坐标点数据,coords对应的内存会拷贝,调用者负责该内存的释放
45 | @param count 经纬度坐标点数组个数
46 | @param interiorPolygons MAPolygon数组,指定在生成的多边形中需要裁剪掉的区域
47 | @return 新生成的多边形
48 | */
49 | + (instancetype)polygonWithCoordinates:(CLLocationCoordinate2D *)coords count:(NSUInteger)count interiorPolygons:(NSArray *)interiorPolygons;
50 |
51 | /*!
52 | @brief 内嵌MAPolygon数组,在生成的多边形中将会裁减掉内嵌polygon包含的区域
53 | */
54 | @property (readonly) NSArray *interiorPolygons;
55 |
56 | @end
57 |
--------------------------------------------------------------------------------
/ios/frameworks/AMapFoundationKit.framework/Headers/AMapURLSearchConfig.h:
--------------------------------------------------------------------------------
1 | //
2 | // MAMapURLSearchConfig.h
3 | // MAMapKitNew
4 | //
5 | // Created by xiaoming han on 15/5/25.
6 | // Copyright (c) 2015年 xiaoming han. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 | #import "AMapURLSearchType.h"
12 |
13 | ///导航配置信息
14 | @interface AMapNaviConfig : NSObject
15 |
16 | ///应用返回的Scheme
17 | @property (nonatomic, copy) NSString *appScheme;
18 |
19 | ///应用名称
20 | @property (nonatomic, copy) NSString *appName;
21 |
22 | ///终点
23 | @property (nonatomic, assign) CLLocationCoordinate2D destination;
24 |
25 | ///导航策略
26 | @property (nonatomic, assign) AMapDrivingStrategy strategy;
27 |
28 | @end
29 |
30 | #pragma mark -
31 |
32 | ///路径搜索配置信息
33 | @interface AMapRouteConfig : NSObject
34 |
35 | ///应用返回的Scheme
36 | @property (nonatomic, copy) NSString *appScheme;
37 |
38 | ///应用名称
39 | @property (nonatomic, copy) NSString *appName;
40 |
41 | ///起点坐标
42 | @property (nonatomic, assign) CLLocationCoordinate2D startCoordinate;
43 |
44 | ///终点坐标
45 | @property (nonatomic, assign) CLLocationCoordinate2D destinationCoordinate;
46 |
47 | ///驾车策略
48 | @property (nonatomic, assign) AMapDrivingStrategy drivingStrategy;
49 |
50 | ///公交策略
51 | @property (nonatomic, assign) AMapTransitStrategy transitStrategy;
52 |
53 | ///路径规划类型
54 | @property (nonatomic, assign) AMapRouteSearchType routeType;
55 |
56 | @end
57 |
58 | #pragma mark -
59 |
60 | ///POI搜索配置信息
61 | @interface AMapPOIConfig : NSObject
62 |
63 | ///应用返回的Scheme
64 | @property (nonatomic, copy) NSString *appScheme;
65 |
66 | ///应用名称
67 | @property (nonatomic, copy) NSString *appName;
68 |
69 | ///搜索关键字
70 | @property (nonatomic, copy) NSString *keywords;
71 |
72 | ///左上角坐标
73 | @property (nonatomic, assign) CLLocationCoordinate2D leftTopCoordinate;
74 |
75 | ///右下角坐标
76 | @property (nonatomic, assign) CLLocationCoordinate2D rightBottomCoordinate;
77 |
78 | @end
79 |
80 |
--------------------------------------------------------------------------------
/ios/frameworks/MAMapKit.framework/Headers/MATileOverlay.h:
--------------------------------------------------------------------------------
1 | //
2 | // MATileOverlay.h
3 | // MAMapKitNew
4 | //
5 | // Created by xiaoming han on 14-1-24.
6 | // Copyright (c) 2014年 AutoNavi. All rights reserved.
7 | //
8 |
9 | #import "MAOverlay.h"
10 |
11 | /**
12 | 该类是覆盖在球面墨卡托投影上的图片tiles的数据源
13 | */
14 | @interface MATileOverlay : NSObject
15 |
16 | /**
17 | 根据指定的URLTemplate生成tileOverlay
18 |
19 | @param URLTemplate URLTemplate是一个包含"{x}","{y}","{z}","{scale}"的字符串,"{x}","{y}","{z}","{scale}"会被tile path的值所替换,并生成用来加载tile图片数据的URL 。例如: http://server/path?x={x}&y={y}&z={z}&scale={scale}。
20 |
21 | @return 以指定的URLTemplate字符串生成tileOverlay
22 | */
23 | - (instancetype)initWithURLTemplate:(NSString *)URLTemplate;
24 |
25 | /**
26 | 默认tileSize 256x256
27 | */
28 | @property CGSize tileSize;
29 |
30 | /**
31 | overlay可以渲染的最小缩放级别。当0级时,一个tile覆盖整个世界范围,1级时覆盖 1/4th 世界,2级时1/16th,以此类推。
32 | */
33 | @property NSInteger minimumZ;
34 |
35 | /**
36 | overlay可以渲染的最大缩放级别。
37 | */
38 | @property NSInteger maximumZ;
39 |
40 | @property (readonly) NSString *URLTemplate;
41 |
42 | /**
43 | 区域外接矩形,可用来设定tileOverlay的可渲染区域
44 | */
45 | @property (nonatomic) MAMapRect boundingMapRect;
46 |
47 | @end
48 |
49 | /**
50 | 记录某特定tile的据结构。contentScaleFactor根据设备的ScrennScale而定, 为1.0或2.0。
51 | */
52 | typedef struct {
53 | NSInteger x;
54 | NSInteger y;
55 | NSInteger z;
56 | CGFloat contentScaleFactor;
57 | } MATileOverlayPath;
58 |
59 | /**
60 | 子类可覆盖CustomLoading中的方法来自定义加载MATileOverlay的行为。
61 | */
62 | @interface MATileOverlay (CustomLoading)
63 |
64 | /**
65 | 以tile path生成URL。用于加载tile, 此方法默认填充URLTemplate
66 |
67 | @param path path
68 | @return path相应的url
69 | */
70 | - (NSURL *)URLForTilePath:(MATileOverlayPath)path;
71 |
72 | /**
73 | 加载被请求的tile, 并以tile数据或加载tile失败error访问回调block; 默认实现为首先用 -URLForTilePath 去获取URL, 然后用异步NSURLConnection加载tile数据。当绘制大面积的tileOverlay时,建议重写此函数并实现缓存机制。
74 |
75 | @param path path
76 | @param result 用来传入tile数据或加载tile失败的error访问的回调block
77 | */
78 | - (void)loadTileAtPath:(MATileOverlayPath)path result:(void (^)(NSData *tileData, NSError *error))result;
79 |
80 | @end
81 |
--------------------------------------------------------------------------------
/ios/frameworks/AMapSearchKit.framework/Headers/AMapNearbySearchManager.h:
--------------------------------------------------------------------------------
1 | //
2 | // AMapNearbySearchManager.h
3 | // AMapSearchKit
4 | //
5 | // Created by xiaoming han on 15/8/31.
6 | // Copyright (c) 2015年 AutoNavi. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "AMapSearchError.h"
11 |
12 | @class AMapNearbySearchManager;
13 | @class AMapNearbyUploadInfo;
14 |
15 | /// 附近搜索代理
16 | @protocol AMapNearbySearchManagerDelegate
17 | @optional
18 |
19 | /*
20 | * 开启自动上传,需实现该回调。
21 | */
22 | - (AMapNearbyUploadInfo *)nearbyInfoForUploading:(AMapNearbySearchManager *)manager;
23 |
24 | /**
25 | * 用户信息上传完毕回调。
26 | *
27 | * @param error 错误,为空时表示成功。
28 | */
29 | - (void)onNearbyInfoUploadedWithError:(NSError *)error;
30 |
31 | /**
32 | * 用户信息清除完毕回调。
33 | *
34 | * @param error 错误,为空时表示成功。
35 | */
36 | - (void)onUserInfoClearedWithError:(NSError *)error;
37 |
38 |
39 | @end
40 |
41 | /// 附近搜索管理类,同时只能有一个实例开启,否则可能会出现错误。
42 | @interface AMapNearbySearchManager : NSObject
43 |
44 | /**
45 | * manager单例.
46 | *
47 | * 初始化之前请设置key,否则将无法正常使用该服务.
48 | *
49 | * @return nearbySearch实例。
50 | */
51 | + (instancetype)sharedInstance;
52 |
53 | /// 请使用单例。
54 | - (instancetype)init __attribute__((unavailable));
55 |
56 | /// 上传最小间隔,默认15s,最小7s。自动上传的过程中设置无效。
57 | @property (nonatomic, assign) NSTimeInterval uploadTimeInterval;
58 |
59 | /// 代理对象。
60 | @property (nonatomic, weak) id delegate;
61 |
62 | /// 是否正在自动上传状态中。
63 | @property (nonatomic, readonly) BOOL isAutoUploading;
64 |
65 | /**
66 | * 启动自动上传。
67 | */
68 | - (void)startAutoUploadNearbyInfo;
69 |
70 | /**
71 | * 关闭自动上传。
72 | */
73 | - (void)stopAutoUploadNearbyInfo;
74 |
75 | /**
76 | * 执行单次上传,执行间隔不低于uploadTimeInterval最小值,否则执行失败。
77 | *
78 | * @param info 需要上传的信息。
79 | *
80 | * @return 成功执行返回YES,否则返回NO。
81 | */
82 | - (BOOL)uploadNearbyInfo:(AMapNearbyUploadInfo *)info;
83 |
84 | /**
85 | * 清除服务器上某一用户的信息。
86 | *
87 | * @param userID 指定的用户ID
88 | *
89 | * @return 成功执行返回YES,否则返回NO。
90 | */
91 | - (BOOL)clearUserInfoWithID:(NSString *)userID;
92 |
93 |
94 | @end
95 |
--------------------------------------------------------------------------------
/AMap-android.js:
--------------------------------------------------------------------------------
1 | /*
2 | * A smart AMap Library for react-native apps
3 | * https://github.com/react-native-component/react-native-smart-amap/
4 | * Released under the MIT license
5 | * Copyright (c) 2016 react-native-component
6 | */
7 |
8 | import React, {
9 | PropTypes,
10 | Component,
11 | } from 'react'
12 | import {
13 | View,
14 | requireNativeComponent,
15 | NativeModules,
16 | findNodeHandle,
17 | Platform,
18 | } from 'react-native'
19 |
20 | const AMapManager = Platform.OS == 'ios' ? null : NativeModules.AMapModule
21 |
22 | export default class AMap extends Component {
23 |
24 | static constants = {
25 |
26 | }
27 |
28 | static defaultProps = {
29 | //mapType: 0,
30 | //showTraffic: false,
31 | //showsUserLocation: true,
32 | }
33 |
34 | static propTypes = {
35 | ...View.propTypes,
36 | options: PropTypes.shape({
37 | centerCoordinate: PropTypes.shape({
38 | latitude: PropTypes.number.isRequired,
39 | longitude: PropTypes.number.isRequired,
40 | }),
41 | zoomLevel: PropTypes.number,
42 | centerMarker: PropTypes.string,
43 | }).isRequired,
44 | onDidMoveByUser: PropTypes.func,
45 | }
46 |
47 | constructor(props) {
48 | super(props)
49 | this.state = {}
50 | }
51 |
52 | render() {
53 | return (
54 |
57 | )
58 | }
59 |
60 | setOptions(options) {
61 | AMapManager.setOptions(findNodeHandle(this), options)
62 | }
63 |
64 | searchPoiByCenterCoordinate(params) {
65 | AMapManager.searchPoiByCenterCoordinate(params) //传null为默认参数配置
66 | }
67 |
68 | setCenterCoordinate(coordinate) {
69 | //console.log('findNodeHandle => ')
70 | //console.log(findNodeHandle)
71 | AMapManager.setCenterCoordinate(findNodeHandle(this), coordinate)
72 | }
73 | }
74 |
75 | const NativeAMap = Platform.OS == 'ios' ? View : requireNativeComponent('RCTAMapView', AMap)
76 |
--------------------------------------------------------------------------------
/android/src/main/java/com/reactnativecomponent/amap/RCTAMapManager.java:
--------------------------------------------------------------------------------
1 | package com.reactnativecomponent.amap;
2 |
3 |
4 | import com.amap.api.maps2d.model.LatLng;
5 | import com.facebook.react.bridge.ReadableMap;
6 | import com.facebook.react.common.MapBuilder;
7 | import com.facebook.react.uimanager.ThemedReactContext;
8 | import com.facebook.react.uimanager.ViewGroupManager;
9 | import com.facebook.react.uimanager.annotations.ReactProp;
10 |
11 | import java.util.Map;
12 |
13 | public class RCTAMapManager extends ViewGroupManager {
14 | // public static final LatLng SHANGHAI = new LatLng(31.238068, 121.501654);// 上海市经纬度
15 | @Override
16 | public String getName() {
17 | return "RCTAMapView";
18 | }
19 |
20 |
21 | @Override
22 | protected RCTAMapView createViewInstance(ThemedReactContext reactContext) {
23 | RCTAMapView mapView = new RCTAMapView(reactContext);
24 | return mapView;
25 | }
26 |
27 | @ReactProp(name = "options")
28 | public void setOptions(RCTAMapView view, final ReadableMap Map) {
29 | if(Map.hasKey("centerCoordinate")) {
30 | ReadableMap centerCoordinateMap = Map.getMap("centerCoordinate");
31 | view.setLatLng(new LatLng(centerCoordinateMap.getDouble("latitude"), centerCoordinateMap.getDouble("longitude")));
32 | }
33 | if(Map.hasKey("zoomLevel")) {
34 | double zoomLevel = Map.getDouble("zoomLevel");
35 | view.setZoomLevel(zoomLevel);
36 | }
37 | if(Map.hasKey("centerMarker")) {
38 | String centerMarker = Map.getString("centerMarker");
39 | view.setCenterMarker(centerMarker);
40 | }
41 | }
42 |
43 | @Override
44 | protected void addEventEmitters(
45 | final ThemedReactContext reactContext,
46 | final RCTAMapView view) {
47 | }
48 |
49 | @Override
50 | public Map getExportedCustomDirectEventTypeConstants() {
51 | return MapBuilder.builder()
52 | .put("onDidMoveByUser", MapBuilder.of("registrationName", "onDidMoveByUser"))//registrationName 后的名字,RN中方法也要是这个名字否则不执行
53 | .build();
54 | }
55 |
56 | }
57 |
--------------------------------------------------------------------------------
/ios/frameworks/MAMapKit.framework/Headers/MAOverlayView.h:
--------------------------------------------------------------------------------
1 | //
2 | // MAOverlayView.h
3 | // MAMapKitNew
4 | //
5 | // Created by AutoNavi.
6 | // Copyright (c) 2014年 AutoNavi. All rights reserved.
7 | //
8 |
9 | #import "MAGeometry.h"
10 | #import "MAOverlay.h"
11 |
12 | /*!
13 | @brief 该类是地图覆盖物View的基类, 提供绘制overlay的接口但并无实际的实现
14 | */
15 | @interface MAOverlayView : UIView
16 |
17 | /*!
18 | @brief 初始化并返回一个overlay view
19 | @param overlay 关联的overlay对象
20 | @return 初始化成功则返回overlay view,否则返回nil
21 | */
22 | - (id)initWithOverlay:(id )overlay;
23 |
24 | /*!
25 | @brief 关联的overlay对象
26 | */
27 | @property (nonatomic, readonly) id overlay;
28 |
29 | /*!
30 | @brief 将MAMapPoint转化为相对于receiver的本地坐标
31 | @param mapPoint 要转化的MAMapPoint
32 | @return 相对于receiver的本地坐标
33 | */
34 | - (CGPoint)pointForMapPoint:(MAMapPoint)mapPoint;
35 |
36 | /*!
37 | @brief 将相对于receiver的本地坐标转化为MAMapPoint
38 | @param point 要转化的相对于receiver的本地坐标
39 | @return MAMapPoint
40 | */
41 | - (MAMapPoint)mapPointForPoint:(CGPoint)point;
42 |
43 | /*!
44 | @brief 将MAMapRect转化为相对于receiver的本地rect
45 | @param mapRect 要转化的MAMapRect
46 | @return 相对于receiver的本地rect
47 | */
48 | - (CGRect)rectForMapRect:(MAMapRect)mapRect;
49 |
50 | /*!
51 | @brief 将相对于receiver的本地rect转化为MAMapRect
52 | @param rect 要转化的相对于receiver的本地rect
53 | @return MAMapRect
54 | */
55 | - (MAMapRect)mapRectForRect:(CGRect)rect;
56 |
57 | /*!
58 | @brief 判断overlay view是否可以绘制包含的内容
59 | @param mapRect 该MAMapRect范围内需要绘制
60 | @param zoomScale 当前的缩放比例值
61 | @return 是否可以进行绘制
62 | */
63 | - (BOOL)canDrawMapRect:(MAMapRect)mapRect zoomScale:(MAZoomScale)zoomScale;
64 |
65 | /*!
66 | @brief 绘制overlay view的内容
67 | @param mapRect 该MAMapRect范围内需要更新
68 | @param zoomScale 当前的缩放比例值
69 | @param context 绘制操作的graphics context
70 | */
71 | - (void)drawMapRect:(MAMapRect)mapRect zoomScale:(MAZoomScale)zoomScale inContext:(CGContextRef)context;
72 |
73 | - (void)setNeedsDisplay;
74 |
75 | /*!
76 | @brief 重绘指定map rect内的内容
77 | @param mapRect 该map rect范围内的内容需要重绘
78 | */
79 | - (void)setNeedsDisplayInMapRect:(MAMapRect)mapRect;
80 |
81 | /*!
82 | @brief 重绘指定zoom scale下map rect内的内容
83 | @param mapRect 该map rect范围内的内容需要重绘
84 | @param zoomScale 当前的缩放比例值
85 | */
86 | - (void)setNeedsDisplayInMapRect:(MAMapRect)mapRect zoomScale:(MAZoomScale)zoomScale;
87 |
88 | /*!
89 | @brief overlay的透明度
90 | */
91 | @property CGFloat alpha;
92 |
93 | /*!
94 | @brief context的比例系数
95 | */
96 | @property (readonly) CGFloat contentScaleFactor;
97 |
98 | @end
99 |
--------------------------------------------------------------------------------
/ios/frameworks/MAMapKit.framework/Headers/MAOverlayPathView.h:
--------------------------------------------------------------------------------
1 | //
2 | // MAOverlayPathView.h
3 | // MAMapKitNew
4 | //
5 | // Created by AutoNavi.
6 | // Copyright (c) 2014年 AutoNavi. All rights reserved.
7 | //
8 |
9 | #import "MAOverlayView.h"
10 |
11 | /*!
12 | @brief 该类提供使用CGPathRef来绘制overlay,默认的操作是使用fill attributes, stroke attributes绘制当前path到context中, 可以使用该类的子类MACircleView, MAPolylineView, MAPolygonView或者继承该类, 如果继承该类,需要重载-(void)createPath方法
13 | */
14 | @interface MAOverlayPathView : MAOverlayView
15 |
16 | /*!
17 | @brief 填充颜色,默认是[UIColor colorWithRed:0 green:1 blue:0 alpha:0.6]
18 | */
19 | @property (strong) UIColor *fillColor;
20 |
21 | /*!
22 | @brief 笔触颜色,默认是[UIColor colorWithRed:1 green:0 blue:0 alpha:0.6]
23 | */
24 | @property (strong) UIColor *strokeColor;
25 |
26 | /*!
27 | @brief 笔触宽度,默认是0
28 | */
29 | @property CGFloat lineWidth;
30 |
31 | /*!
32 | @brief LineJoin,默认是kCGLineJoinRound
33 | */
34 | @property CGLineJoin lineJoin;
35 |
36 | /*!
37 | @brief LineCap,默认是kCGLineCapRound
38 | */
39 | @property CGLineCap lineCap;
40 |
41 | /*!
42 | @brief MiterLimit,默认是10.f
43 | */
44 | @property CGFloat miterLimit;
45 |
46 | /*!
47 | @brief LineDashPhase,默认是0.f
48 | */
49 | @property CGFloat lineDashPhase;
50 |
51 | /*!
52 | @brief LineDashPattern,默认是nil
53 | */
54 | @property (copy) NSArray *lineDashPattern;
55 |
56 | /*!
57 | @brief 子类需要重载该方法并设置(self.path = newPath)
58 | */
59 | - (void)createPath;
60 |
61 | /*!
62 | @brief 当前的path
63 | */
64 | @property CGPathRef path;
65 |
66 | /*!
67 | @brief 释放当前path,调用之后 path == NULL
68 | */
69 | - (void)invalidatePath;
70 |
71 | /*!
72 | @brief 将当前的stroke attributes设置到指定的context
73 | @param context 目标context
74 | @param zoomScale 当前缩放比例值
75 | */
76 | - (void)applyStrokePropertiesToContext:(CGContextRef)context atZoomScale:(MAZoomScale)zoomScale;
77 |
78 | /*!
79 | @brief 将当前的fill attributes设置到指定的context
80 | @param context 目标context
81 | @param zoomScale 当前缩放比例值
82 | */
83 | - (void)applyFillPropertiesToContext:(CGContextRef)context atZoomScale:(MAZoomScale)zoomScale;
84 |
85 | /*!
86 | @brief 绘制path
87 | @param path 要绘制的path
88 | @param context 目标context
89 | */
90 | - (void)strokePath:(CGPathRef)path inContext:(CGContextRef)context;
91 |
92 | /*!
93 | @brief 填充path
94 | @param path 要绘制的path
95 | @param context 目标context
96 | */
97 | - (void)fillPath:(CGPathRef)path inContext:(CGContextRef)context;
98 |
99 | @end
100 |
--------------------------------------------------------------------------------
/ios/frameworks/MAMapKit.framework/Headers/MAOverlayRenderer.h:
--------------------------------------------------------------------------------
1 | //
2 | // MAOverlayRenderer.h
3 | // MAMapKit
4 | //
5 | // Created by AutoNavi.
6 | // Copyright (c) 2013年 AutoNavi. All rights reserved.
7 | //
8 |
9 | #import "MAGeometry.h"
10 | #import "MAOverlay.h"
11 |
12 | /*!
13 | @brief 该类是地图覆盖物Renderer的基类, 提供绘制overlay的接口但并无实际的实现
14 | */
15 | @interface MAOverlayRenderer : NSObject
16 |
17 | /*!
18 | @brief 初始化并返回一个overlay renderer
19 | @param overlay 关联的overlay对象
20 | @return 初始化成功则返回overlay renderer,否则返回nil
21 | */
22 | - (id)initWithOverlay:(id )overlay;
23 |
24 | /*!
25 | @brief 关联的overlay对象
26 | */
27 | @property (nonatomic, readonly) id overlay;
28 |
29 | /*!
30 | @brief 将MAMapPoint转化为相对于receiver的本地坐标
31 | @param mapPoint 要转化的MAMapPoint
32 | @return 相对于receiver的本地坐标
33 | */
34 | - (CGPoint)pointForMapPoint:(MAMapPoint)mapPoint;
35 |
36 | /*!
37 | @brief 将相对于receiver的本地坐标转化为MAMapPoint
38 | @param point 要转化的相对于receiver的本地坐标
39 | @return MAMapPoint
40 | */
41 | - (MAMapPoint)mapPointForPoint:(CGPoint)point;
42 |
43 | /*!
44 | @brief 将MAMapRect转化为相对于receiver的本地rect
45 | @param mapRect 要转化的MAMapRect
46 | @return 相对于receiver的本地rect
47 | */
48 | - (CGRect)rectForMapRect:(MAMapRect)mapRect;
49 |
50 | /*!
51 | @brief 将相对于receiver的本地rect转化为MAMapRect
52 | @param rect 要转化的相对于receiver的本地rect
53 | @return MAMapRect
54 | */
55 | - (MAMapRect)mapRectForRect:(CGRect)rect;
56 |
57 | /*!
58 | @brief 判断overlay renderer是否可以绘制包含的内容
59 | @param mapRect 该MAMapRect范围内需要绘制
60 | @param zoomScale 当前的缩放比例值
61 | @return 是否可以进行绘制
62 | */
63 | - (BOOL)canDrawMapRect:(MAMapRect)mapRect zoomScale:(MAZoomScale)zoomScale;
64 |
65 | /*!
66 | @brief 绘制overlay renderer的内容
67 | @param mapRect 该MAMapRect范围内需要更新
68 | @param zoomScale 当前的缩放比例值
69 | @param context 绘制操作的graphics context
70 | */
71 | - (void)drawMapRect:(MAMapRect)mapRect zoomScale:(MAZoomScale)zoomScale inContext:(CGContextRef)context;
72 |
73 | - (void)setNeedsDisplay;
74 |
75 | /*!
76 | @brief 重绘指定map rect内的内容
77 | @param mapRect 该map rect范围内的内容需要重绘
78 | */
79 | - (void)setNeedsDisplayInMapRect:(MAMapRect)mapRect;
80 |
81 | /*!
82 | @brief 重绘指定zoom scale下map rect内的内容
83 | @param mapRect 该map rect范围内的内容需要重绘
84 | @param zoomScale 当前的缩放比例值
85 | */
86 | - (void)setNeedsDisplayInMapRect:(MAMapRect)mapRect zoomScale:(MAZoomScale)zoomScale;
87 |
88 | /*!
89 | @brief overlay的透明度
90 | */
91 | @property CGFloat alpha;
92 |
93 | /*!
94 | @brief context的比例系数
95 | */
96 | @property (readonly) CGFloat contentScaleFactor;
97 |
98 | @end
99 |
--------------------------------------------------------------------------------
/ios/frameworks/MAMapKit.framework/Headers/MAOverlayPathRenderer.h:
--------------------------------------------------------------------------------
1 | //
2 | // MAOverlayPathRenderer.h
3 | // MAMapKit
4 | //
5 | // Created by AutoNavi.
6 | // Copyright (c) 2013年 AutoNavi. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "MAOverlayRenderer.h"
11 |
12 | /*!
13 | @brief 该类提供使用CGPathRef来绘制overlay,默认的操作是使用fill attributes, stroke attributes绘制当前path到context中, 可以使用该类的子类MACircleRenderer, MAPolylineRenderer, MAPolygonRenderer或者继承该类, 如果继承该类,需要重载-(void)createPath方法
14 | */
15 | @interface MAOverlayPathRenderer : MAOverlayRenderer
16 |
17 | /*!
18 | @brief 填充颜色,默认是[UIColor colorWithRed:0 green:1 blue:0 alpha:0.6]
19 | */
20 | @property (strong) UIColor *fillColor;
21 |
22 | /*!
23 | @brief 笔触颜色,默认是[UIColor colorWithRed:1 green:0 blue:0 alpha:0.6]
24 | */
25 | @property (strong) UIColor *strokeColor;
26 |
27 | /*!
28 | @brief 笔触宽度,默认是0
29 | */
30 | @property CGFloat lineWidth;
31 |
32 | /*!
33 | @brief LineJoin,默认是kCGLineJoinRound
34 | */
35 | @property CGLineJoin lineJoin;
36 |
37 | /*!
38 | @brief LineCap,默认是kCGLineCapRound
39 | */
40 | @property CGLineCap lineCap;
41 |
42 | /*!
43 | @brief MiterLimit,默认是10.f
44 | */
45 | @property CGFloat miterLimit;
46 |
47 | /*!
48 | @brief LineDashPhase,默认是0.f
49 | */
50 | @property CGFloat lineDashPhase;
51 |
52 | /*!
53 | @brief LineDashPattern,默认是nil
54 | */
55 | @property (copy) NSArray *lineDashPattern;
56 |
57 | /*!
58 | @brief 子类需要重载该方法并设置(self.path = newPath)
59 | */
60 | - (void)createPath;
61 |
62 | /*!
63 | @brief 当前的path
64 | */
65 | @property CGPathRef path;
66 |
67 | /*!
68 | @brief 释放当前path,调用之后 path == NULL
69 | */
70 | - (void)invalidatePath;
71 |
72 | /*!
73 | @brief 将当前的stroke attributes设置到指定的context
74 | @param context 目标context
75 | @param zoomScale 当前缩放比例值
76 | */
77 | - (void)applyStrokePropertiesToContext:(CGContextRef)context atZoomScale:(MAZoomScale)zoomScale;
78 |
79 | /*!
80 | @brief 将当前的fill attributes设置到指定的context
81 | @param context 目标context
82 | @param zoomScale 当前缩放比例值
83 | */
84 | - (void)applyFillPropertiesToContext:(CGContextRef)context atZoomScale:(MAZoomScale)zoomScale;
85 |
86 | /*!
87 | @brief 绘制path
88 | @param path 要绘制的path
89 | @param context 目标context
90 | */
91 | - (void)strokePath:(CGPathRef)path inContext:(CGContextRef)context;
92 |
93 | /*!
94 | @brief 填充path
95 | @param path 要绘制的path
96 | @param context 目标context
97 | */
98 | - (void)fillPath:(CGPathRef)path inContext:(CGContextRef)context;
99 |
100 | @end
101 |
--------------------------------------------------------------------------------
/AMap-ios.js:
--------------------------------------------------------------------------------
1 | /*
2 | * A smart AMap Library for react-native apps
3 | * https://github.com/react-native-component/react-native-smart-amap/
4 | * Released under the MIT license
5 | * Copyright (c) 2016 react-native-component
6 | */
7 |
8 | import React, {
9 | PropTypes,
10 | Component,
11 | } from 'react'
12 | import {
13 | View,
14 | requireNativeComponent,
15 | NativeModules,
16 | findNodeHandle,
17 | Platform,
18 | } from 'react-native'
19 |
20 | const AMapManager = Platform.OS == 'ios' ? NativeModules.AMap : null
21 |
22 | export default class AMap extends Component {
23 |
24 | static constants = {
25 | userTrackingMode: Platform.OS == 'ios' ? AMapManager.userTrackingMode : null, //only for ios
26 | }
27 |
28 | static defaultProps = {
29 | //mapType: 0,
30 | //showTraffic: false,
31 | //showsUserLocation: true,
32 | }
33 |
34 | static propTypes = {
35 | ...View.propTypes,
36 | options: PropTypes.shape({
37 | frame: PropTypes.shape({
38 | width: PropTypes.number.isRequired,
39 | height: PropTypes.number.isRequired,
40 | }),
41 | mapType: PropTypes.number,
42 | showTraffic: PropTypes.bool,
43 | showsUserLocation: PropTypes.bool,
44 | userTrackingMode: PropTypes.number,
45 | centerCoordinate: PropTypes.shape({
46 | latitude: PropTypes.number.isRequired,
47 | longitude: PropTypes.number.isRequired,
48 | }),
49 | zoomLevel: PropTypes.number,
50 | centerMarker: PropTypes.string,
51 | }).isRequired,
52 | onDidMoveByUser: PropTypes.func,
53 | }
54 |
55 | constructor(props) {
56 | super(props)
57 | this.state = {}
58 | }
59 |
60 | render() {
61 | return (
62 |
65 | )
66 | }
67 |
68 | setOptions(options) {
69 | AMapManager.setOptions(findNodeHandle(this), options)
70 | }
71 |
72 | searchPoiByCenterCoordinate(params) {
73 | AMapManager.searchPoiByCenterCoordinate(params) //传null为默认参数配置
74 | }
75 |
76 | setCenterCoordinate(coordinate) {
77 | //console.log('findNodeHandle => ')
78 | //console.log(findNodeHandle)
79 | AMapManager.setCenterCoordinate(findNodeHandle(this), coordinate)
80 | }
81 | }
82 |
83 | const NativeAMap = Platform.OS == 'ios' ? requireNativeComponent('RCTAMap', AMap) : View
84 |
--------------------------------------------------------------------------------
/android/src/main/java/com/reactnativecomponent/amap/util/SensorEventHelper.java:
--------------------------------------------------------------------------------
1 | package com.reactnativecomponent.amap.util;
2 |
3 | import android.content.Context;
4 | import android.hardware.Sensor;
5 | import android.hardware.SensorEvent;
6 | import android.hardware.SensorEventListener;
7 | import android.hardware.SensorManager;
8 | import android.view.Display;
9 | import android.view.Surface;
10 | import android.view.WindowManager;
11 |
12 | import com.amap.api.maps2d.model.Marker;
13 |
14 | public class SensorEventHelper implements SensorEventListener {
15 |
16 | private SensorManager mSensorManager;
17 | private Sensor mSensor;
18 | private long lastTime = 0;
19 | private final int TIME_SENSOR = 100;
20 | private float mAngle;
21 | private Context mContext;
22 | private Marker mMarker;
23 |
24 | public SensorEventHelper(Context context) {
25 | mContext = context;
26 | mSensorManager = (SensorManager) context
27 | .getSystemService(Context.SENSOR_SERVICE);
28 | mSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_ORIENTATION);
29 |
30 | }
31 |
32 | public void registerSensorListener() {
33 | mSensorManager.registerListener(this, mSensor,
34 | SensorManager.SENSOR_DELAY_NORMAL);
35 | }
36 |
37 | public void unRegisterSensorListener() {
38 | mSensorManager.unregisterListener(this, mSensor);
39 | }
40 |
41 | public void setCurrentMarker(Marker marker) {
42 | mMarker = marker;
43 | }
44 |
45 | @Override
46 | public void onAccuracyChanged(Sensor sensor, int accuracy) {
47 | // TODO Auto-generated method stub
48 |
49 | }
50 |
51 | @Override
52 | public void onSensorChanged(SensorEvent event) {
53 | if (System.currentTimeMillis() - lastTime < TIME_SENSOR) {
54 | return;
55 | }
56 | switch (event.sensor.getType()) {
57 | case Sensor.TYPE_ORIENTATION: {
58 | float x = event.values[0];
59 | x += getScreenRotationOnPhone(mContext);
60 | x %= 360.0F;
61 | if (x > 180.0F)
62 | x -= 360.0F;
63 | else if (x < -180.0F)
64 | x += 360.0F;
65 |
66 | if (Math.abs(mAngle - x) < 3.0f) {
67 | break;
68 | }
69 | mAngle = Float.isNaN(x) ? 0 : x;
70 | if (mMarker != null) {
71 | mMarker.setRotateAngle(360-mAngle);
72 | }
73 | lastTime = System.currentTimeMillis();
74 | }
75 | }
76 |
77 | }
78 |
79 | public static int getScreenRotationOnPhone(Context context) {
80 | final Display display = ((WindowManager) context
81 | .getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
82 |
83 | switch (display.getRotation()) {
84 | case Surface.ROTATION_0:
85 | return 0;
86 |
87 | case Surface.ROTATION_90:
88 | return 90;
89 |
90 | case Surface.ROTATION_180:
91 | return 180;
92 |
93 | case Surface.ROTATION_270:
94 | return -90;
95 | }
96 | return 0;
97 | }
98 | }
99 |
--------------------------------------------------------------------------------
/ios/frameworks/MAMapKit.framework/Headers/MAAnnotationView.h:
--------------------------------------------------------------------------------
1 | //
2 | // MAAnnotationView.h
3 | // MAMapKit
4 | //
5 | // Created by AutoNavi.
6 | // Copyright (c) 2013年 AutoNavi. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | typedef NS_ENUM(NSInteger, MAAnnotationViewDragState) {
12 | MAAnnotationViewDragStateNone = 0, ///< 静止状态
13 | MAAnnotationViewDragStateStarting, ///< 开始拖动
14 | MAAnnotationViewDragStateDragging, ///< 拖动中
15 | MAAnnotationViewDragStateCanceling, ///< 取消拖动
16 | MAAnnotationViewDragStateEnding ///< 拖动结束
17 | };
18 |
19 | @protocol MAAnnotation;
20 |
21 | /*!
22 | @brief 标注view
23 | */
24 | @interface MAAnnotationView : UIView
25 |
26 | /*!
27 | @brief 初始化并返回一个annotation view
28 | @param annotation 关联的annotation对象
29 | @param reuseIdentifier 如果要复用view,传入一个字符串,否则设为nil,建议重用view
30 | @return 初始化成功则返回annotation view,否则返回nil
31 | */
32 | - (id)initWithAnnotation:(id )annotation reuseIdentifier:(NSString *)reuseIdentifier;
33 |
34 | /*!
35 | @brief 复用标识
36 | */
37 | @property (nonatomic, readonly) NSString *reuseIdentifier;
38 |
39 | /*!
40 | @brief z值,大值在上,默认为0。
41 | */
42 | @property (nonatomic, assign) NSInteger zIndex;
43 |
44 | /*!
45 | @brief 当从reuse队列里取出时被调用
46 | */
47 | - (void)prepareForReuse;
48 |
49 | /*!
50 | @brief 关联的annotation
51 | */
52 | @property (nonatomic, strong) id annotation;
53 |
54 | /*!
55 | @brief 显示的image
56 | */
57 | @property (nonatomic, strong) UIImage *image;
58 |
59 | /*!
60 | @brief 默认情况下,annotation view的中心位于annotation的坐标位置,可以设置centerOffset改变view的位置,正的偏移使view朝右下方移动,负的朝左上方,单位是像素
61 | */
62 | @property (nonatomic) CGPoint centerOffset;
63 |
64 | /*!
65 | @brief 默认情况下,弹出的气泡位于view正中上方,可以设置calloutOffset改变view的位置,正的偏移使view朝右下方移动,负的朝左上方,单位是像素
66 | */
67 | @property (nonatomic) CGPoint calloutOffset;
68 |
69 | /*!
70 | @brief 默认为YES,当为NO时view忽略触摸事件
71 | */
72 | @property (nonatomic, getter=isEnabled) BOOL enabled;
73 |
74 | /*!
75 | @brief annotationView是否突出显示(一般不需要手动设置)
76 | */
77 | @property (nonatomic, getter=isHighlighted) BOOL highlighted;
78 |
79 | /*!
80 | @brief 设置是否处于选中状态, 外部如果要选中请使用mapView的selectAnnotation方法。
81 | */
82 | @property (nonatomic, getter=isSelected) BOOL selected;
83 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated;
84 |
85 | /*!
86 | @brief 设置是否可以显示callout,默认为NO
87 | */
88 | @property (nonatomic) BOOL canShowCallout;
89 |
90 | /*!
91 | @brief 显示在气泡左侧的view
92 | */
93 | @property (nonatomic, strong) UIView *leftCalloutAccessoryView;
94 |
95 | /*!
96 | @brief 显示在气泡右侧的view
97 | */
98 | @property (nonatomic, strong) UIView *rightCalloutAccessoryView;
99 |
100 | /*!
101 | @brief 是否支持拖动,默认为NO
102 | */
103 | @property (nonatomic, getter=isDraggable) BOOL draggable;
104 |
105 | /*!
106 | @brief 当前view的拖动状态
107 | */
108 | @property (nonatomic) MAAnnotationViewDragState dragState;
109 | - (void)setDragState:(MAAnnotationViewDragState)newDragState animated:(BOOL)animated;
110 |
111 |
112 | @end
113 |
--------------------------------------------------------------------------------
/android/src/main/java/com/reactnativecomponent/amap/Utils.java:
--------------------------------------------------------------------------------
1 | /**
2 | *
3 | */
4 | package com.reactnativecomponent.amap;
5 |
6 | import android.text.TextUtils;
7 |
8 | import com.amap.api.location.AMapLocation;
9 |
10 | import java.text.SimpleDateFormat;
11 | import java.util.Locale;
12 |
13 |
14 | public class Utils {
15 | /**
16 | * 开始定位
17 | */
18 | public final static int MSG_LOCATION_START = 0;
19 | /**
20 | * 定位完成
21 | */
22 | public final static int MSG_LOCATION_FINISH = 1;
23 | /**
24 | * 停止定位
25 | */
26 | public final static int MSG_LOCATION_STOP= 2;
27 |
28 | public final static String KEY_URL = "URL";
29 | public final static String URL_H5LOCATION = "file:///android_asset/location.html";
30 | /**
31 | * 根据定位结果返回定位信息的字符串
32 | * @param
33 | * @return
34 | */
35 | public synchronized static String getLocationStr(AMapLocation location){
36 | if(null == location){
37 | return null;
38 | }
39 | StringBuffer sb = new StringBuffer();
40 | //errCode等于0代表定位成功,其他的为定位失败,具体的可以参照官网定位错误码说明
41 | if(location.getErrorCode() == 0){
42 | sb.append("定位成功" + "\n");
43 | sb.append("定位类型: " + location.getLocationType() + "\n");
44 | sb.append("经 度 : " + location.getLongitude() + "\n");
45 | sb.append("纬 度 : " + location.getLatitude() + "\n");
46 | sb.append("精 度 : " + location.getAccuracy() + "米" + "\n");
47 | sb.append("提供者 : " + location.getProvider() + "\n");
48 |
49 | if (location.getProvider().equalsIgnoreCase(
50 | android.location.LocationManager.GPS_PROVIDER)) {
51 | // 以下信息只有提供者是GPS时才会有
52 | sb.append("速 度 : " + location.getSpeed() + "米/秒" + "\n");
53 | sb.append("角 度 : " + location.getBearing() + "\n");
54 | // 获取当前提供定位服务的卫星个数
55 | sb.append("星 数 : "
56 | + location.getSatellites() + "\n");
57 | } else {
58 | // 提供者是GPS时是没有以下信息的
59 | sb.append("国 家 : " + location.getCountry() + "\n");
60 | sb.append("省 : " + location.getProvince() + "\n");
61 | sb.append("市 : " + location.getCity() + "\n");
62 | sb.append("城市编码 : " + location.getCityCode() + "\n");
63 | sb.append("区 : " + location.getDistrict() + "\n");
64 | sb.append("区域 码 : " + location.getAdCode() + "\n");
65 | sb.append("地 址 : " + location.getAddress() + "\n");
66 | sb.append("兴趣点 : " + location.getPoiName() + "\n");
67 | //定位完成的时间
68 | sb.append("定位时间: " + formatUTC(location.getTime(), "yyyy-MM-dd HH:mm:ss") + "\n");
69 | }
70 | } else {
71 | //定位失败
72 | sb.append("定位失败" + "\n");
73 | sb.append("错误码:" + location.getErrorCode() + "\n");
74 | sb.append("错误信息:" + location.getErrorInfo() + "\n");
75 | sb.append("错误描述:" + location.getLocationDetail() + "\n");
76 | }
77 | //定位之后的回调时间
78 | sb.append("回调时间: " + formatUTC(System.currentTimeMillis(), "yyyy-MM-dd HH:mm:ss") + "\n");
79 | return sb.toString();
80 | }
81 |
82 | private static SimpleDateFormat sdf = null;
83 | public synchronized static String formatUTC(long l, String strPattern) {
84 | if (TextUtils.isEmpty(strPattern)) {
85 | strPattern = "yyyy-MM-dd HH:mm:ss";
86 | }
87 | if (sdf == null) {
88 | try {
89 | sdf = new SimpleDateFormat(strPattern, Locale.CHINA);
90 | } catch (Throwable e) {
91 | }
92 | } else {
93 | sdf.applyPattern(strPattern);
94 | }
95 | return sdf == null ? "NULL" : sdf.format(l);
96 | }
97 | }
98 |
--------------------------------------------------------------------------------
/ios/frameworks/AMapSearchKit.framework/Headers/AMapSearchError.h:
--------------------------------------------------------------------------------
1 | //
2 | // AMapSearchError.h
3 | // AMapSearchKit
4 | //
5 | // Created by xiaoming han on 15/7/29.
6 | // Copyright (c) 2015年 AutoNavi. All rights reserved.
7 | //
8 |
9 | #ifndef AMapSearchKit_AMapSearchError_h
10 | #define AMapSearchKit_AMapSearchError_h
11 |
12 | /** AMapSearch errorDomain */
13 | extern NSString * const AMapSearchErrorDomain;
14 |
15 | /** AMapSearch errorCode */
16 | typedef NS_ENUM(NSInteger, AMapSearchErrorCode)
17 | {
18 | AMapSearchErrorOK = 1000,//!< 没有错误
19 | AMapSearchErrorInvalidSignature = 1001,//!< 无效签名
20 | AMapSearchErrorInvalidUserKey = 1002,//!< key非法或过期
21 | AMapSearchErrorServiceNotAvailable = 1003,//!< 没有权限使用相应的接口
22 | AMapSearchErrorDailyQueryOverLimit = 1004,//!< 访问已超出日访问量
23 | AMapSearchErrorTooFrequently = 1005,//!< 用户访问过于频繁
24 | AMapSearchErrorInvalidUserIP = 1006,//!< 用户IP无效
25 | AMapSearchErrorInvalidUserDomain = 1007,//!< 用户域名无效
26 | AMapSearchErrorInvalidUserSCode = 1008,//!< 安全码验证错误,bundleID与key不对应
27 | AMapSearchErrorUserKeyNotMatch = 1009,//!< 请求key与绑定平台不符
28 | AMapSearchErrorIPQueryOverLimit = 1010,//!< IP请求超限
29 | AMapSearchErrorNotSupportHttps = 1011,//!< 不支持HTTPS请求
30 | AMapSearchErrorInsufficientPrivileges = 1012,//!< 权限不足,服务请求被拒绝
31 | AMapSearchErrorUserKeyRecycled = 1013,//!< 开发者key被删除,无法正常使用
32 |
33 | AMapSearchErrorInvalidResponse = 1100,//!< 请求服务响应错误
34 | AMapSearchErrorInvalidEngineData = 1101,//!< 引擎返回数据异常
35 | AMapSearchErrorConnectTimeout = 1102,//!< 服务端请求链接超时
36 | AMapSearchErrorReturnTimeout = 1103,//!< 读取服务结果超时
37 | AMapSearchErrorInvalidParams = 1200,//!< 请求参数非法
38 | AMapSearchErrorMissingRequiredParams = 1201,//!< 缺少必填参数
39 | AMapSearchErrorIllegalRequest = 1202,//!< 请求协议非法
40 | AMapSearchErrorServiceUnknown = 1203,//!< 其他服务端未知错误
41 |
42 | AMapSearchErrorClientUnknown = 1800,//!< 客户端未知错误,服务返回结果为空或其他错误
43 | AMapSearchErrorInvalidProtocol = 1801,//!< 协议解析错误,通常是返回结果无法解析
44 | AMapSearchErrorTimeOut = 1802,//!< 连接超时
45 | AMapSearchErrorBadURL = 1803,//!< URL异常
46 | AMapSearchErrorCannotFindHost = 1804,//!< 找不到主机
47 | AMapSearchErrorCannotConnectToHost = 1805,//!< 服务器连接失败
48 | AMapSearchErrorNotConnectedToInternet = 1806,//!< 连接异常,通常为没有网络的情况
49 | AMapSearchErrorCancelled = 1807,//!< 连接取消
50 |
51 | AMapSearchErrorTableIDNotExist = 2000,//!< table id 格式不正确
52 | AMapSearchErrorIDNotExist = 2001,//!< id 不存在
53 | AMapSearchErrorServiceMaintenance = 2002,//!< 服务器维护中
54 | AMapSearchErrorEngineTableIDNotExist = 2003,//!< key对应的table id 不存在
55 | AMapSearchErrorInvalidNearbyUserID = 2100,//!< 找不到对应userID的信息
56 | AMapSearchErrorNearbyKeyNotBind = 2101,//!< key未开通“附近”功能
57 |
58 | AMapSearchErrorOutOfService = 3000,//!< 规划点(包括起点、终点、途经点)不在中国范围内
59 | AMapSearchErrorNoRoadsNearby = 3001,//!< 规划点(包括起点、终点、途经点)附近搜不到道路
60 | AMapSearchErrorRouteFailed = 3002,//!< 路线计算失败,通常是由于道路连通关系导致
61 | AMapSearchErrorOverDirectionRange = 3003,//!< 起点终点距离过长
62 |
63 | AMapSearchErrorShareLicenseExpired = 4000,//!< 短串分享认证失败
64 | AMapSearchErrorShareFailed = 4001,//!< 短串请求失败
65 | };
66 |
67 | #endif
68 |
--------------------------------------------------------------------------------
/android/src/main/java/com/reactnativecomponent/amap/RCTAMapModule.java:
--------------------------------------------------------------------------------
1 | package com.reactnativecomponent.amap;
2 |
3 | import com.amap.api.maps2d.model.LatLng;
4 | import com.amap.api.services.core.LatLonPoint;
5 | import com.amap.api.services.core.PoiItem;
6 | import com.amap.api.services.poisearch.PoiResult;
7 | import com.amap.api.services.poisearch.PoiSearch;
8 | import com.facebook.react.bridge.Arguments;
9 | import com.facebook.react.bridge.ReactApplicationContext;
10 | import com.facebook.react.bridge.ReactContextBaseJavaModule;
11 | import com.facebook.react.bridge.ReactMethod;
12 | import com.facebook.react.bridge.ReadableMap;
13 | import com.facebook.react.bridge.WritableArray;
14 | import com.facebook.react.bridge.WritableMap;
15 | import com.facebook.react.modules.core.DeviceEventManagerModule;
16 | import java.util.List;
17 |
18 |
19 | public class RCTAMapModule extends ReactContextBaseJavaModule implements PoiSearch.OnPoiSearchListener{
20 | ReactApplicationContext mContext;
21 |
22 | private PoiSearch poiSearch;
23 | private int defaultRadius = 3000;
24 |
25 | public RCTAMapModule(ReactApplicationContext reactContext) {
26 | super(reactContext);
27 | mContext = reactContext;
28 | PoiSearch poiSearch = new PoiSearch(mContext, null);
29 | this.poiSearch = poiSearch;
30 | }
31 |
32 | @Override
33 | public String getName() {
34 | return "AMapModule";
35 | }
36 |
37 | @ReactMethod
38 | public void setOptions(final int reactTag, final ReadableMap options){
39 | mContext.getCurrentActivity().runOnUiThread(new Runnable() {
40 | public void run() {
41 | final RCTAMapView mapView = ((RCTAMapView) mContext.getCurrentActivity().findViewById(reactTag));
42 | if(options.hasKey("centerCoordinate")) {
43 | ReadableMap centerCoordinateMap = options.getMap("centerCoordinate");
44 | mapView.setLatLng(new LatLng(centerCoordinateMap.getDouble("latitude"), centerCoordinateMap.getDouble("longitude")));
45 | }
46 | if(options.hasKey("zoomLevel")) {
47 | double zoomLevel = options.getDouble("zoomLevel");
48 | mapView.setZoomLevel(zoomLevel);
49 | }
50 | }
51 | });
52 | }
53 |
54 | @ReactMethod
55 | public void setCenterCoordinate(final int reactTag, final ReadableMap coordinate){
56 | mContext.getCurrentActivity().runOnUiThread(new Runnable() {
57 | public void run() {
58 | final RCTAMapView mapView = ((RCTAMapView) mContext.getCurrentActivity().findViewById(reactTag));
59 | mapView.setCenterLocation(coordinate.getDouble("latitude"), coordinate.getDouble("longitude"));
60 | }
61 | });
62 | }
63 |
64 | @ReactMethod
65 | public void searchPoiByCenterCoordinate(ReadableMap params) {
66 |
67 | String types = "";
68 | if(params.hasKey("types")) {
69 | types = params.getString("types");
70 | }
71 | String keywords = "";
72 | if(params.hasKey("keywords")) {
73 | keywords = params.getString("keywords");
74 | }
75 |
76 | PoiSearch.Query query = new PoiSearch.Query(keywords, types);
77 |
78 | if(params.hasKey("offset")) {
79 | int offset = params.getInt("offset");
80 | query.setPageSize(offset);// 设置每页最多返回多少条poiitem
81 | }
82 | if(params.hasKey("page")) {
83 | int page = params.getInt("page");
84 | query.setPageNum(page);//设置查询页码
85 | }
86 | poiSearch.setQuery(query);
87 | if(params.hasKey("coordinate")) {
88 | ReadableMap coordinateMap = params.getMap("coordinate");
89 | double latitude = coordinateMap.getDouble("latitude");
90 | double longitude = coordinateMap.getDouble("longitude");
91 | int radius = defaultRadius;
92 | if (params.hasKey("radius")) {
93 | radius = params.getInt("radius");
94 | }
95 | poiSearch.setBound(new PoiSearch.SearchBound(new LatLonPoint(latitude, longitude), radius)); //设置周边搜索的中心点以及半径(单位: 米, 默认3公里)
96 | }
97 | poiSearch.setOnPoiSearchListener(this);
98 | poiSearch.searchPOIAsyn();
99 | }
100 |
101 | @Override
102 | public void onPoiSearched(PoiResult result, int rCode) {
103 | List poiItems;
104 | WritableMap dataMap = Arguments.createMap();
105 | if (rCode == 1000) {
106 | if (result != null && result.getQuery() != null) {// 搜索poi的结果
107 | // 取得搜索到的poiitems有多少页
108 | poiItems = result.getPois();// 取得第一页的poiitem数据,页数从数字0开始
109 |
110 | WritableArray array = Arguments.createArray();
111 | for (PoiItem poi : poiItems) {
112 | WritableMap data = Arguments.createMap();
113 | data.putString("uid", poi.getPoiId());
114 | data.putString("name", poi.getTitle());
115 | data.putString("type", poi.getTypeDes());
116 | data.putDouble("longitude", poi.getLatLonPoint().getLongitude());
117 | data.putDouble("latitude", poi.getLatLonPoint().getLatitude());
118 | data.putString("address", poi.getSnippet());
119 | data.putString("tel", poi.getTel());
120 | data.putInt("distance", poi.getDistance());
121 | data.putString("cityCode", poi.getCityCode());
122 | data.putString("cityName", poi.getCityName());
123 | data.putString("provinceCode", poi.getProvinceCode());
124 | data.putString("provinceName", poi.getProvinceName());
125 | data.putString("adCode", poi.getAdCode());
126 | data.putString("adName", poi.getAdName());
127 | array.pushMap(data);
128 | }
129 | dataMap.putArray("searchResultList", array);
130 | }
131 | }
132 | else {
133 | WritableMap error = Arguments.createMap();
134 | error.putString("code", String.valueOf(rCode));
135 | dataMap.putMap("error", error);
136 | }
137 |
138 | mContext
139 | .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
140 | .emit("amap.onPOISearchDone", dataMap);
141 | }
142 |
143 | @Override
144 | public void onPoiItemSearched(PoiItem poiItem, int i) {
145 |
146 | }
147 | }
148 |
--------------------------------------------------------------------------------
/ios/frameworks/AMapSearchKit.framework/Headers/AMapSearchAPI.h:
--------------------------------------------------------------------------------
1 | //
2 | // AMapSearchAPI.h
3 | // AMapSearchKit
4 | //
5 | // Created by xiaoming han on 15/7/22.
6 | // Copyright (c) 2015年 AutoNavi. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "AMapSearchObj.h"
11 | #import "AMapCommonObj.h"
12 |
13 | @protocol AMapSearchDelegate;
14 |
15 | /// 搜索结果语言
16 | typedef NS_ENUM(NSInteger, AMapSearchLanguage)
17 | {
18 | AMapSearchLanguageZhCN = 0, //!< 中文
19 | AMapSearchLanguageEn = 1 //!< 英文
20 | };
21 |
22 | /// 搜索类
23 | @interface AMapSearchAPI : NSObject
24 |
25 | /// 实现了AMapSearchDelegate协议的类指针
26 | @property (nonatomic, weak) id delegate;
27 |
28 | /// 查询超时时间,单位秒,默认为20秒
29 | @property (nonatomic, assign) NSInteger timeout;
30 |
31 | /// 查询结果返回语言, 默认为中文
32 | @property (nonatomic, assign) AMapSearchLanguage language;
33 |
34 |
35 | /**
36 | * AMapSearch的初始化函数。
37 | *
38 | * 初始化之前请正确设置key,否则将无法正常使用搜索服务.
39 | * @return AMapSearch类对象实例
40 | */
41 | - (instancetype)init;
42 |
43 | /**
44 | * 取消所有未回调的请求,触发错误回调。
45 | */
46 | - (void)cancelAllRequests;
47 |
48 | #pragma mark - 搜索服务接口
49 |
50 | /**
51 | * POI ID查询接口
52 | *
53 | * @param request 查询选项。具体属性字段请参考 AMapPOIIDSearchRequest 类。
54 | */
55 | - (void)AMapPOIIDSearch:(AMapPOIIDSearchRequest *)request;
56 |
57 | /**
58 | * POI 关键字查询接口
59 | *
60 | * @param request 查询选项。具体属性字段请参考 AMapPOIKeywordsSearchRequest 类。
61 | */
62 | - (void)AMapPOIKeywordsSearch:(AMapPOIKeywordsSearchRequest *)request;
63 |
64 | /**
65 | * POI 周边查询接口
66 | *
67 | * @param request 查询选项。具体属性字段请参考 AMapPOIAroundSearchRequest 类。
68 | */
69 | - (void)AMapPOIAroundSearch:(AMapPOIAroundSearchRequest *)request;
70 |
71 | /**
72 | * POI 多边形查询接口
73 | *
74 | * @param request 查询选项。具体属性字段请参考 AMapPOIPolygonSearchRequest 类。
75 | */
76 | - (void)AMapPOIPolygonSearch:(AMapPOIPolygonSearchRequest *)request;
77 |
78 | /**
79 | * 沿途查询接口 (v4.3.0)
80 | *
81 | * @param request 查询选项。具体属性字段请参考 AMapRoutePOISearchRequest 类。
82 | */
83 | - (void)AMapRoutePOISearch:(AMapRoutePOISearchRequest *)request;
84 |
85 | /**
86 | * 地址编码查询接口
87 | *
88 | * @param request 查询选项。具体属性字段请参考 AMapGeocodeSearchRequest 类。
89 | */
90 | - (void)AMapGeocodeSearch:(AMapGeocodeSearchRequest *)request;
91 |
92 | /**
93 | * 逆地址编码查询接口
94 | *
95 | * @param request 查询选项。具体属性字段请参考 AMapReGeocodeSearchRequest 类。
96 | */
97 | - (void)AMapReGoecodeSearch:(AMapReGeocodeSearchRequest *)request;
98 |
99 | /**
100 | * 输入提示查询接口
101 | *
102 | * @param request 查询选项。具体属性字段请参考 AMapInputTipsSearchRequest 类。
103 | */
104 | - (void)AMapInputTipsSearch:(AMapInputTipsSearchRequest *)request;
105 |
106 | /**
107 | * 公交站点查询接口
108 | *
109 | * @param request 查询选项。具体属性字段请参考 AMapBusStopSearchRequest 类。
110 | */
111 | - (void)AMapBusStopSearch:(AMapBusStopSearchRequest *)request;
112 |
113 | /**
114 | * 公交线路关键字查询
115 | *
116 | * @param request 查询选项。具体属性字段请参考 AMapBusLineIDSearchRequest 类。
117 | */
118 | - (void)AMapBusLineIDSearch:(AMapBusLineIDSearchRequest *)request;
119 |
120 | /**
121 | * 公交线路关键字查询
122 | *
123 | * @param request 查询选项。具体属性字段请参考 AMapBusLineNameSearchRequest 类。
124 | */
125 | - (void)AMapBusLineNameSearch:(AMapBusLineNameSearchRequest *)request;
126 |
127 | /**
128 | * 行政区域查询接口
129 | *
130 | * @param request 查询选项。具体属性字段请参考 AMapDistrictSearchRequest 类。
131 | */
132 | - (void)AMapDistrictSearch:(AMapDistrictSearchRequest *)request;
133 |
134 | /**
135 | * 驾车路径规划查询接口
136 | *
137 | * @param request 查询选项。具体属性字段请参考 AMapDrivingRouteSearchRequest 类。
138 | */
139 | - (void)AMapDrivingRouteSearch:(AMapDrivingRouteSearchRequest *)request;
140 |
141 | /**
142 | * 步行路径规划查询接口
143 | *
144 | * @param request 查询选项。具体属性字段请参考 AMapWalkingRouteSearchRequest 类。
145 | */
146 | - (void)AMapWalkingRouteSearch:(AMapWalkingRouteSearchRequest *)request;
147 |
148 | /**
149 | * 公交路径规划查询接口
150 | *
151 | * @param request 查询选项。具体属性字段请参考 AMapTransitRouteSearchRequest 类。
152 | */
153 | - (void)AMapTransitRouteSearch:(AMapTransitRouteSearchRequest *)request;
154 |
155 | /**
156 | * 骑行路径规划查询接口 (v4.3.0)
157 | *
158 | * @param request 查询选项。具体属性字段请参考 AMapRidingRouteSearchRequest 类。
159 | */
160 | - (void)AMapRidingRouteSearch:(AMapRidingRouteSearchRequest *)request;
161 |
162 | /**
163 | * 天气查询接口
164 | *
165 | * @param request 查询选项。具体属性字段请参考 AMapWeatherSearchRequest 类。
166 | */
167 | - (void)AMapWeatherSearch:(AMapWeatherSearchRequest *)request;
168 |
169 | #pragma mark - 附近搜索相关
170 |
171 | /**
172 | * 附近搜索查询接口
173 | *
174 | * @param request 查询选项。具体属性字段请参考 AMapNearbySearchRequest 类。
175 | */
176 | - (void)AMapNearbySearch:(AMapNearbySearchRequest *)request;
177 |
178 | #pragma mark - 云图搜索相关
179 |
180 | /**
181 | * 云图周边查询接口
182 | *
183 | * @param request 查询选项。具体属性字段请参考 AMapCloudPOIAroundSearchRequest 类。
184 | */
185 | - (void)AMapCloudPOIAroundSearch:(AMapCloudPOIAroundSearchRequest *)request;
186 |
187 | /**
188 | * 云图polygon区域查询接口
189 | *
190 | * @param request 查询选项。具体属性字段请参考 AMapCloudPOIPolygonSearchRequest 类。
191 | */
192 | - (void)AMapCloudPOIPolygonSearch:(AMapCloudPOIPolygonSearchRequest *)request;
193 |
194 | /**
195 | * 云图ID查询接口
196 | *
197 | * @param request 查询选项。具体属性字段请参考 AMapCloudPOIIDSearchRequest 类。
198 | */
199 | - (void)AMapCloudPOIIDSearch:(AMapCloudPOIIDSearchRequest *)request;
200 |
201 | /**
202 | * 云图本地查询接口
203 | *
204 | * @param request 查询选项。具体属性字段请参考 AMapCloudPOILocalSearchRequest 类。
205 | */
206 | - (void)AMapCloudPOILocalSearch:(AMapCloudPOILocalSearchRequest *)request;
207 |
208 | #pragma mark - 短串分享相关
209 |
210 | /**
211 | * 位置短串分享接口
212 | *
213 | * @param request 查询选项。具体属性字段请参考 AMapLocationShareSearchRequest 类。
214 | */
215 | - (void)AMapLocationShareSearch:(AMapLocationShareSearchRequest *)request;
216 |
217 | /**
218 | * 兴趣点短串分享接口
219 | *
220 | * @param request 查询选项。具体属性字段请参考 AMapPOIShareSearchRequest 类。
221 | */
222 | - (void)AMapPOIShareSearch:(AMapPOIShareSearchRequest *)request;
223 |
224 | /**
225 | * 路线规划短串分享接口
226 | *
227 | * @param request 查询选项。具体属性字段请参考 AMapRouteShareSearchRequest 类。
228 | */
229 | - (void)AMapRouteShareSearch:(AMapRouteShareSearchRequest *)request;
230 |
231 | /**
232 | * 导航短串分享接口
233 | *
234 | * @param request 查询选项。具体属性字段请参考 AMapNavigationShareSearchRequest 类。
235 | */
236 | - (void)AMapNavigationShareSearch:(AMapNavigationShareSearchRequest *)request;
237 |
238 | @end
239 |
240 | #pragma mark - AMapSearchDelegate
241 |
242 | /**
243 | * AMapSearchDelegate协议
244 | * 定义了搜索结果的回调方法,发生错误时的错误回调方法。
245 | */
246 | @protocol AMapSearchDelegate
247 | @optional
248 |
249 | /**
250 | * 当请求发生错误时,会调用代理的此方法.
251 | *
252 | * @param request 发生错误的请求.
253 | * @param error 返回的错误.
254 | */
255 | - (void)AMapSearchRequest:(id)request didFailWithError:(NSError *)error;
256 |
257 | /**
258 | * POI查询回调函数
259 | *
260 | * @param request 发起的请求,具体字段参考 AMapPOISearchBaseRequest 及其子类。
261 | * @param response 响应结果,具体字段参考 AMapPOISearchResponse 。
262 | */
263 | - (void)onPOISearchDone:(AMapPOISearchBaseRequest *)request response:(AMapPOISearchResponse *)response;
264 |
265 | /**
266 | * 沿途查询回调函数 (v4.3.0)
267 | *
268 | * @param request 发起的请求,具体字段参考 AMapRoutePOISearchRequest 及其子类。
269 | * @param response 响应结果,具体字段参考 AMapRoutePOISearchResponse 。
270 | */
271 | - (void)onRoutePOISearchDone:(AMapRoutePOISearchRequest *)request response:(AMapRoutePOISearchResponse *)response;
272 |
273 | /**
274 | * 地理编码查询回调函数
275 | *
276 | * @param request 发起的请求,具体字段参考 AMapGeocodeSearchRequest 。
277 | * @param response 响应结果,具体字段参考 AMapGeocodeSearchResponse 。
278 | */
279 | - (void)onGeocodeSearchDone:(AMapGeocodeSearchRequest *)request response:(AMapGeocodeSearchResponse *)response;
280 |
281 | /**
282 | * 逆地理编码查询回调函数
283 | *
284 | * @param request 发起的请求,具体字段参考 AMapReGeocodeSearchRequest 。
285 | * @param response 响应结果,具体字段参考 AMapReGeocodeSearchResponse 。
286 | */
287 | - (void)onReGeocodeSearchDone:(AMapReGeocodeSearchRequest *)request response:(AMapReGeocodeSearchResponse *)response;
288 |
289 | /**
290 | * 输入提示查询回调函数
291 | *
292 | * @param request 发起的请求,具体字段参考 AMapInputTipsSearchRequest 。
293 | * @param response 响应结果,具体字段参考 AMapInputTipsSearchResponse 。
294 | */
295 | - (void)onInputTipsSearchDone:(AMapInputTipsSearchRequest *)request response:(AMapInputTipsSearchResponse *)response;
296 |
297 | /**
298 | * 公交站查询回调函数
299 | *
300 | * @param request 发起的请求,具体字段参考 AMapBusStopSearchRequest 。
301 | * @param response 响应结果,具体字段参考 AMapBusStopSearchResponse 。
302 | */
303 | - (void)onBusStopSearchDone:(AMapBusStopSearchRequest *)request response:(AMapBusStopSearchResponse *)response;
304 |
305 | /**
306 | * 公交线路关键字查询回调
307 | *
308 | * @param request 发起的请求,具体字段参考 AMapBusLineSearchRequest 。
309 | * @param response 响应结果,具体字段参考 AMapBusLineSearchResponse 。
310 | */
311 | - (void)onBusLineSearchDone:(AMapBusLineBaseSearchRequest *)request response:(AMapBusLineSearchResponse *)response;
312 |
313 | /**
314 | * 行政区域查询回调函数
315 | *
316 | * @param request 发起的请求,具体字段参考 AMapDistrictSearchRequest 。
317 | * @param response 响应结果,具体字段参考 AMapDistrictSearchResponse 。
318 | */
319 | - (void)onDistrictSearchDone:(AMapDistrictSearchRequest *)request response:(AMapDistrictSearchResponse *)response;
320 |
321 | /**
322 | * 路径规划查询回调
323 | *
324 | * @param request 发起的请求,具体字段参考 AMapRouteSearchBaseRequest 及其子类。
325 | * @param response 响应结果,具体字段参考 AMapRouteSearchResponse 。
326 | */
327 | - (void)onRouteSearchDone:(AMapRouteSearchBaseRequest *)request response:(AMapRouteSearchResponse *)response;
328 |
329 | /**
330 | * 天气查询回调
331 | *
332 | * @param request 发起的请求,具体字段参考 AMapWeatherSearchRequest 。
333 | * @param response 响应结果,具体字段参考 AMapWeatherSearchResponse 。
334 | */
335 | - (void)onWeatherSearchDone:(AMapWeatherSearchRequest *)request response:(AMapWeatherSearchResponse *)response;
336 |
337 | #pragma mark - 附近搜索回调
338 |
339 | /**
340 | * 附近搜索回调
341 | *
342 | * @param request 发起的请求,具体字段参考 AMapNearbySearchRequest 。
343 | * @param response 响应结果,具体字段参考 AMapNearbySearchResponse 。
344 | */
345 | - (void)onNearbySearchDone:(AMapNearbySearchRequest *)request response:(AMapNearbySearchResponse *)response;
346 |
347 | #pragma mark - 云图搜索回调
348 |
349 | /**
350 | * 云图查询回调函数
351 | *
352 | * @param request 发起的请求,具体字段参考 AMapCloudSearchBaseRequest 。
353 | * @param response 响应结果,具体字段参考 AMapCloudPOISearchResponse 。
354 | */
355 | - (void)onCloudSearchDone:(AMapCloudSearchBaseRequest *)request response:(AMapCloudPOISearchResponse *)response;
356 |
357 | #pragma mark - 短串分享搜索回调
358 |
359 | /**
360 | * 短串分享搜索回调
361 | *
362 | * @param request 发起的请求
363 | * @param response 相应结果,具体字段参考 AMapShareSearchResponse。
364 | */
365 | - (void)onShareSearchDone:(AMapShareSearchBaseRequest *)request response:(AMapShareSearchResponse *)response;
366 |
367 | @end
368 |
--------------------------------------------------------------------------------
/ios/frameworks/MAMapKit.framework/Headers/MAGeometry.h:
--------------------------------------------------------------------------------
1 | //
2 | // MAGeometry.h
3 | // MAMapKit
4 | //
5 | // Created by AutoNavi.
6 | // Copyright (c) 2013年 AutoNavi. All rights reserved.
7 | //
8 | #import
9 | #import
10 | #import
11 |
12 | #ifdef __cplusplus
13 | extern "C" {
14 | #endif
15 |
16 | struct MACoordinateBounds{
17 | CLLocationCoordinate2D northEast;
18 | CLLocationCoordinate2D southWest;
19 | };
20 | typedef struct MACoordinateBounds MACoordinateBounds;
21 |
22 | struct MACoordinateSpan{
23 | CLLocationDegrees latitudeDelta;
24 | CLLocationDegrees longitudeDelta;
25 | };
26 | typedef struct MACoordinateSpan MACoordinateSpan;
27 |
28 | struct MACoordinateRegion{
29 | CLLocationCoordinate2D center;
30 | MACoordinateSpan span;
31 | };
32 | typedef struct MACoordinateRegion MACoordinateRegion;
33 |
34 | static inline MACoordinateBounds MACoordinateBoundsMake(CLLocationCoordinate2D northEast,CLLocationCoordinate2D southWest)
35 | {
36 | return (MACoordinateBounds){northEast, southWest};
37 | }
38 |
39 | static inline MACoordinateSpan MACoordinateSpanMake(CLLocationDegrees latitudeDelta, CLLocationDegrees longitudeDelta)
40 | {
41 | return (MACoordinateSpan){latitudeDelta, longitudeDelta};
42 | }
43 |
44 | static inline MACoordinateRegion MACoordinateRegionMake(CLLocationCoordinate2D centerCoordinate, MACoordinateSpan span)
45 | {
46 | return (MACoordinateRegion){centerCoordinate, span};
47 | }
48 |
49 | /*!
50 | @brief 生成一个新的MACoordinateRegion
51 | @param centerCoordinate 中心点坐标
52 | @param latitudinalMeters 垂直跨度(单位 米)
53 | @param longitudinalMeters 水平跨度(单位 米)
54 | @return 新的MACoordinateRegion
55 | */
56 | extern MACoordinateRegion MACoordinateRegionMakeWithDistance(CLLocationCoordinate2D centerCoordinate, CLLocationDistance latitudinalMeters, CLLocationDistance longitudinalMeters);
57 |
58 | /**
59 | * 平面投影坐标结构定义
60 | */
61 | struct MAMapPoint{
62 | double x;
63 | double y;
64 | };
65 | typedef struct MAMapPoint MAMapPoint;
66 |
67 | /**
68 | * 平面投影大小结构定义
69 | */
70 | struct MAMapSize{
71 | double width;
72 | double height;
73 | };
74 | typedef struct MAMapSize MAMapSize;
75 | /**
76 | * 平面投影矩形结构定义
77 | */
78 | struct MAMapRect{
79 | MAMapPoint origin;
80 | MAMapSize size;
81 | };
82 | typedef struct MAMapRect MAMapRect;
83 |
84 | /**
85 | 比例关系:MAZoomScale = Screen Point / MAMapPoint, 当MAZoomScale = 1时, 1 screen point = 1 MAMapPoint, 当MAZoomScale = 0.5时, 1 screen point = 2 MAMapPoints
86 | */
87 | typedef double MAZoomScale;
88 |
89 | /*!
90 | const常量定义
91 | */
92 | extern const MAMapSize MAMapSizeWorld;
93 |
94 | extern const MAMapRect MAMapRectWorld;
95 |
96 | extern const MAMapRect MAMapRectNull;
97 |
98 | extern const MAMapRect MAMapRectZero;
99 |
100 | /*!
101 | @brief 经纬度坐标转平面投影坐标
102 | @param coordinate 要转化的经纬度坐标
103 | @return 平面投影坐标
104 | */
105 | extern MAMapPoint MAMapPointForCoordinate(CLLocationCoordinate2D coordinate);
106 |
107 | /*!
108 | @brief 平面投影坐标转经纬度坐标
109 | @param mapPoint 要转化的平面投影坐标
110 | @return 经纬度坐标
111 | */
112 | extern CLLocationCoordinate2D MACoordinateForMapPoint(MAMapPoint mapPoint);
113 |
114 | /*!
115 | @brief 平面投影矩形转region
116 | @param rect 要转化的平面投影矩形
117 | @return region
118 | */
119 | extern MACoordinateRegion MACoordinateRegionForMapRect(MAMapRect rect);
120 |
121 | /*!
122 | @brief region转平面投影矩形
123 | @param region 要转化的region
124 | @return 平面投影矩形
125 | */
126 | extern MAMapRect MAMapRectForCoordinateRegion(MACoordinateRegion region);
127 |
128 | /*!
129 | @brief 单位投影的距离
130 | */
131 | extern CLLocationDistance MAMetersPerMapPointAtLatitude(CLLocationDegrees latitude);
132 |
133 | /*!
134 | @brief 1米对应的投影
135 | */
136 | extern double MAMapPointsPerMeterAtLatitude(CLLocationDegrees latitude);
137 |
138 | /*!
139 | @brief 投影两点之间的距离
140 | */
141 | extern CLLocationDistance MAMetersBetweenMapPoints(MAMapPoint a, MAMapPoint b);
142 |
143 | /*!
144 | @brief 经纬度间的面积(单位 平方米)
145 | */
146 | extern double MAAreaBetweenCoordinates(CLLocationCoordinate2D northEast, CLLocationCoordinate2D southWest);
147 |
148 | /*!
149 | @brief 获取Inset后的MAMapRect
150 | */
151 | extern MAMapRect MAMapRectInset(MAMapRect rect, double dx, double dy);
152 |
153 | /*!
154 | @brief 合并两个MAMapRect
155 | */
156 | extern MAMapRect MAMapRectUnion(MAMapRect rect1, MAMapRect rect2);
157 |
158 | /*!
159 | @brief 判断size1是否包含size2
160 | */
161 | extern BOOL MAMapSizeContainsSize(MAMapSize size1, MAMapSize size2);
162 |
163 | /*!
164 | @brief 判断点是否在矩形内
165 | */
166 | extern BOOL MAMapRectContainsPoint(MAMapRect rect, MAMapPoint point);
167 |
168 | /*!
169 | @brief 判断两矩形是否相交
170 | */
171 | extern BOOL MAMapRectIntersectsRect(MAMapRect rect1, MAMapRect rect2);
172 |
173 | /*!
174 | @brief 判断矩形rect1是否包含矩形rect2
175 | */
176 | extern BOOL MAMapRectContainsRect(MAMapRect rect1, MAMapRect rect2);
177 |
178 | /*!
179 | @brief 判断点是否在圆内
180 | */
181 | extern BOOL MACircleContainsPoint(MAMapPoint point, MAMapPoint center, double radius);
182 |
183 | /*!
184 | @brief 判断经纬度点是否在圆内
185 | */
186 | extern BOOL MACircleContainsCoordinate(CLLocationCoordinate2D point, CLLocationCoordinate2D center, double radius);
187 |
188 | /*!
189 | @brief 判断点是否在多边形内
190 | */
191 | extern BOOL MAPolygonContainsPoint(MAMapPoint point, MAMapPoint *polygon, NSUInteger count);
192 | /*!
193 | @brief 判断经纬度点是否在多边形内
194 | */
195 | extern BOOL MAPolygonContainsCoordinate(CLLocationCoordinate2D point, CLLocationCoordinate2D *polygon, NSUInteger count);
196 |
197 | /*!
198 | 获取在lineStart和lineEnd组成的线段上距离point距离最近的点.
199 |
200 | @param lineStart 线段起点.
201 | @param lineEnd 线段终点.
202 | @param point 测试点.
203 | @return 距离point最近的点坐标.
204 | */
205 | extern MAMapPoint MAGetNearestMapPointFromLine(MAMapPoint lineStart, MAMapPoint lineEnd, MAMapPoint point);
206 |
207 | /*!
208 | 获取墨卡托投影切块回调block,如果是无效的映射,则返回(-1, -1, 0, 0, 0, 0).
209 |
210 | @param offsetX 左上点距离所属tile的位移X, 单位像素.
211 | @param offsetY 左上点距离所属tile的位移Y, 单位像素.
212 | @param minX 覆盖tile的最小x.
213 | @param maxX 覆盖tile的最大x.
214 | @param minY 覆盖tile的最小y.
215 | @param maxY 覆盖tile的最大y.
216 | */
217 | typedef void (^AMapTileProjectionBlock)(int offsetX, int offsetY, int minX, int maxX, int minY, int maxY);
218 |
219 | /*!
220 | 根据所给经纬度区域获取墨卡托投影切块信息.
221 |
222 | @param bounds 经纬度区域.
223 | @param levelOfDetails 对应缩放级别, 取值0-20。
224 | @param tileProjection 返回的切块信息block.
225 | */
226 | extern void MAGetTileProjectionFromBounds(MACoordinateBounds bounds, int levelOfDetails, AMapTileProjectionBlock tileProjection);
227 |
228 |
229 | static inline MAMapPoint MAMapPointMake(double x, double y)
230 | {
231 | return (MAMapPoint){x, y};
232 | }
233 |
234 | static inline MAMapSize MAMapSizeMake(double width, double height)
235 | {
236 | return (MAMapSize){width, height};
237 | }
238 |
239 | static inline MAMapRect MAMapRectMake(double x, double y, double width, double height)
240 | {
241 | return (MAMapRect){MAMapPointMake(x, y), MAMapSizeMake(width, height)};
242 | }
243 |
244 | static inline double MAMapRectGetMinX(MAMapRect rect)
245 | {
246 | return rect.origin.x;
247 | }
248 |
249 | static inline double MAMapRectGetMinY(MAMapRect rect)
250 | {
251 | return rect.origin.y;
252 | }
253 |
254 | static inline double MAMapRectGetMidX(MAMapRect rect)
255 | {
256 | return rect.origin.x + rect.size.width / 2.0;
257 | }
258 |
259 | static inline double MAMapRectGetMidY(MAMapRect rect)
260 | {
261 | return rect.origin.y + rect.size.height / 2.0;
262 | }
263 |
264 | static inline double MAMapRectGetMaxX(MAMapRect rect)
265 | {
266 | return rect.origin.x + rect.size.width;
267 | }
268 |
269 | static inline double MAMapRectGetMaxY(MAMapRect rect)
270 | {
271 | return rect.origin.y + rect.size.height;
272 | }
273 |
274 | static inline double MAMapRectGetWidth(MAMapRect rect)
275 | {
276 | return rect.size.width;
277 | }
278 |
279 | static inline double MAMapRectGetHeight(MAMapRect rect)
280 | {
281 | return rect.size.height;
282 | }
283 |
284 | static inline BOOL MAMapPointEqualToPoint(MAMapPoint point1, MAMapPoint point2) {
285 | return point1.x == point2.x && point1.y == point2.y;
286 | }
287 |
288 | static inline BOOL MAMapSizeEqualToSize(MAMapSize size1, MAMapSize size2) {
289 | return size1.width == size2.width && size1.height == size2.height;
290 | }
291 |
292 | static inline BOOL MAMapRectEqualToRect(MAMapRect rect1, MAMapRect rect2) {
293 | return
294 | MAMapPointEqualToPoint(rect1.origin, rect2.origin) &&
295 | MAMapSizeEqualToSize(rect1.size, rect2.size);
296 | }
297 |
298 | static inline BOOL MAMapRectIsNull(MAMapRect rect) {
299 | return isinf(rect.origin.x) || isinf(rect.origin.y);
300 | }
301 |
302 | static inline BOOL MAMapRectIsEmpty(MAMapRect rect) {
303 | return MAMapRectIsNull(rect) || (rect.size.width == 0.0 && rect.size.height == 0.0);
304 | }
305 |
306 | static inline NSString *MAStringFromMapPoint(MAMapPoint point) {
307 | return [NSString stringWithFormat:@"{%.1f, %.1f}", point.x, point.y];
308 | }
309 |
310 | static inline NSString *MAStringFromMapSize(MAMapSize size) {
311 | return [NSString stringWithFormat:@"{%.1f, %.1f}", size.width, size.height];
312 | }
313 |
314 | static inline NSString *MAStringFromMapRect(MAMapRect rect) {
315 | return [NSString stringWithFormat:@"{%@, %@}", MAStringFromMapPoint(rect.origin), MAStringFromMapSize(rect.size)];
316 | }
317 |
318 | #ifdef __cplusplus
319 | }
320 | #endif
321 |
322 | @interface NSValue (NSValueMAGeometryExtensions)
323 |
324 | + (NSValue *)valueWithMAMapPoint:(MAMapPoint)mapPoint;
325 | + (NSValue *)valueWithMAMapSize:(MAMapSize)mapSize;
326 | + (NSValue *)valueWithMAMapRect:(MAMapRect)mapRect;
327 | + (NSValue *)valueWithMACoordinate:(CLLocationCoordinate2D)coordinate;
328 |
329 | - (MAMapPoint)MAMapPointValue;
330 | - (MAMapSize)MAMapSizeValue;
331 | - (MAMapRect)MAMapRectValue;
332 | - (CLLocationCoordinate2D)MACoordinateValue;
333 |
334 | @end
335 |
--------------------------------------------------------------------------------
/ios/RCTAMap/RCTAMap.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 9F12EBCB1DD30C6600029EAF /* RCTAMapManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 9F12EBCA1DD30C6600029EAF /* RCTAMapManager.m */; };
11 | 9F12EBCC1DD30C6600029EAF /* RCTAMapManager.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9F12EBC91DD30C6600029EAF /* RCTAMapManager.h */; };
12 | 9FB04D8A1DD9987100A577E9 /* RCTAMap.m in Sources */ = {isa = PBXBuildFile; fileRef = 9FB04D891DD9987100A577E9 /* RCTAMap.m */; };
13 | /* End PBXBuildFile section */
14 |
15 | /* Begin PBXCopyFilesBuildPhase section */
16 | 9F12EBC41DD30C6600029EAF /* CopyFiles */ = {
17 | isa = PBXCopyFilesBuildPhase;
18 | buildActionMask = 2147483647;
19 | dstPath = "include/$(PRODUCT_NAME)";
20 | dstSubfolderSpec = 16;
21 | files = (
22 | 9F12EBCC1DD30C6600029EAF /* RCTAMapManager.h in CopyFiles */,
23 | );
24 | runOnlyForDeploymentPostprocessing = 0;
25 | };
26 | /* End PBXCopyFilesBuildPhase section */
27 |
28 | /* Begin PBXFileReference section */
29 | 9F12EBC61DD30C6600029EAF /* libRCTAMap.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRCTAMap.a; sourceTree = BUILT_PRODUCTS_DIR; };
30 | 9F12EBC91DD30C6600029EAF /* RCTAMapManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RCTAMapManager.h; sourceTree = ""; };
31 | 9F12EBCA1DD30C6600029EAF /* RCTAMapManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RCTAMapManager.m; sourceTree = ""; };
32 | 9FB04D881DD9987100A577E9 /* RCTAMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTAMap.h; sourceTree = ""; };
33 | 9FB04D891DD9987100A577E9 /* RCTAMap.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTAMap.m; sourceTree = ""; };
34 | /* End PBXFileReference section */
35 |
36 | /* Begin PBXFrameworksBuildPhase section */
37 | 9F12EBC31DD30C6600029EAF /* Frameworks */ = {
38 | isa = PBXFrameworksBuildPhase;
39 | buildActionMask = 2147483647;
40 | files = (
41 | );
42 | runOnlyForDeploymentPostprocessing = 0;
43 | };
44 | /* End PBXFrameworksBuildPhase section */
45 |
46 | /* Begin PBXGroup section */
47 | 9F12EBBD1DD30C6600029EAF = {
48 | isa = PBXGroup;
49 | children = (
50 | 9F12EBC81DD30C6600029EAF /* RCTAMap */,
51 | 9F12EBC71DD30C6600029EAF /* Products */,
52 | );
53 | sourceTree = "";
54 | };
55 | 9F12EBC71DD30C6600029EAF /* Products */ = {
56 | isa = PBXGroup;
57 | children = (
58 | 9F12EBC61DD30C6600029EAF /* libRCTAMap.a */,
59 | );
60 | name = Products;
61 | sourceTree = "";
62 | };
63 | 9F12EBC81DD30C6600029EAF /* RCTAMap */ = {
64 | isa = PBXGroup;
65 | children = (
66 | 9F12EBC91DD30C6600029EAF /* RCTAMapManager.h */,
67 | 9F12EBCA1DD30C6600029EAF /* RCTAMapManager.m */,
68 | 9FB04D881DD9987100A577E9 /* RCTAMap.h */,
69 | 9FB04D891DD9987100A577E9 /* RCTAMap.m */,
70 | );
71 | path = RCTAMap;
72 | sourceTree = "";
73 | };
74 | /* End PBXGroup section */
75 |
76 | /* Begin PBXNativeTarget section */
77 | 9F12EBC51DD30C6600029EAF /* RCTAMap */ = {
78 | isa = PBXNativeTarget;
79 | buildConfigurationList = 9F12EBCF1DD30C6600029EAF /* Build configuration list for PBXNativeTarget "RCTAMap" */;
80 | buildPhases = (
81 | 9F12EBC21DD30C6600029EAF /* Sources */,
82 | 9F12EBC31DD30C6600029EAF /* Frameworks */,
83 | 9F12EBC41DD30C6600029EAF /* CopyFiles */,
84 | );
85 | buildRules = (
86 | );
87 | dependencies = (
88 | );
89 | name = RCTAMap;
90 | productName = RCTAMap;
91 | productReference = 9F12EBC61DD30C6600029EAF /* libRCTAMap.a */;
92 | productType = "com.apple.product-type.library.static";
93 | };
94 | /* End PBXNativeTarget section */
95 |
96 | /* Begin PBXProject section */
97 | 9F12EBBE1DD30C6600029EAF /* Project object */ = {
98 | isa = PBXProject;
99 | attributes = {
100 | LastUpgradeCheck = 0810;
101 | ORGANIZATIONNAME = "react-native-component";
102 | TargetAttributes = {
103 | 9F12EBC51DD30C6600029EAF = {
104 | CreatedOnToolsVersion = 8.1;
105 | ProvisioningStyle = Automatic;
106 | };
107 | };
108 | };
109 | buildConfigurationList = 9F12EBC11DD30C6600029EAF /* Build configuration list for PBXProject "RCTAMap" */;
110 | compatibilityVersion = "Xcode 3.2";
111 | developmentRegion = English;
112 | hasScannedForEncodings = 0;
113 | knownRegions = (
114 | en,
115 | );
116 | mainGroup = 9F12EBBD1DD30C6600029EAF;
117 | productRefGroup = 9F12EBC71DD30C6600029EAF /* Products */;
118 | projectDirPath = "";
119 | projectRoot = "";
120 | targets = (
121 | 9F12EBC51DD30C6600029EAF /* RCTAMap */,
122 | );
123 | };
124 | /* End PBXProject section */
125 |
126 | /* Begin PBXSourcesBuildPhase section */
127 | 9F12EBC21DD30C6600029EAF /* Sources */ = {
128 | isa = PBXSourcesBuildPhase;
129 | buildActionMask = 2147483647;
130 | files = (
131 | 9FB04D8A1DD9987100A577E9 /* RCTAMap.m in Sources */,
132 | 9F12EBCB1DD30C6600029EAF /* RCTAMapManager.m in Sources */,
133 | );
134 | runOnlyForDeploymentPostprocessing = 0;
135 | };
136 | /* End PBXSourcesBuildPhase section */
137 |
138 | /* Begin XCBuildConfiguration section */
139 | 9F12EBCD1DD30C6600029EAF /* Debug */ = {
140 | isa = XCBuildConfiguration;
141 | buildSettings = {
142 | ALWAYS_SEARCH_USER_PATHS = NO;
143 | CLANG_ANALYZER_NONNULL = YES;
144 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
145 | CLANG_CXX_LIBRARY = "libc++";
146 | CLANG_ENABLE_MODULES = YES;
147 | CLANG_ENABLE_OBJC_ARC = YES;
148 | CLANG_WARN_BOOL_CONVERSION = YES;
149 | CLANG_WARN_CONSTANT_CONVERSION = YES;
150 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
151 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
152 | CLANG_WARN_EMPTY_BODY = YES;
153 | CLANG_WARN_ENUM_CONVERSION = YES;
154 | CLANG_WARN_INFINITE_RECURSION = YES;
155 | CLANG_WARN_INT_CONVERSION = YES;
156 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
157 | CLANG_WARN_SUSPICIOUS_MOVES = YES;
158 | CLANG_WARN_UNREACHABLE_CODE = YES;
159 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
160 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
161 | COPY_PHASE_STRIP = NO;
162 | DEBUG_INFORMATION_FORMAT = dwarf;
163 | ENABLE_STRICT_OBJC_MSGSEND = YES;
164 | ENABLE_TESTABILITY = YES;
165 | FRAMEWORK_SEARCH_PATHS = "$(SRCROOT)/../../../ios/Frameworks";
166 | GCC_C_LANGUAGE_STANDARD = gnu99;
167 | GCC_DYNAMIC_NO_PIC = NO;
168 | GCC_NO_COMMON_BLOCKS = YES;
169 | GCC_OPTIMIZATION_LEVEL = 0;
170 | GCC_PREFIX_HEADER = "";
171 | GCC_PREPROCESSOR_DEFINITIONS = (
172 | "DEBUG=1",
173 | "$(inherited)",
174 | );
175 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
176 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
177 | GCC_WARN_UNDECLARED_SELECTOR = YES;
178 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
179 | GCC_WARN_UNUSED_FUNCTION = YES;
180 | GCC_WARN_UNUSED_VARIABLE = YES;
181 | HEADER_SEARCH_PATHS = (
182 | "$(inherited)",
183 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
184 | "$(SRCROOT)/../../../react-native/React/**",
185 | );
186 | IPHONEOS_DEPLOYMENT_TARGET = 10.1;
187 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
188 | MTL_ENABLE_DEBUG_INFO = YES;
189 | ONLY_ACTIVE_ARCH = YES;
190 | SDKROOT = iphoneos;
191 | };
192 | name = Debug;
193 | };
194 | 9F12EBCE1DD30C6600029EAF /* Release */ = {
195 | isa = XCBuildConfiguration;
196 | buildSettings = {
197 | ALWAYS_SEARCH_USER_PATHS = NO;
198 | CLANG_ANALYZER_NONNULL = YES;
199 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
200 | CLANG_CXX_LIBRARY = "libc++";
201 | CLANG_ENABLE_MODULES = YES;
202 | CLANG_ENABLE_OBJC_ARC = YES;
203 | CLANG_WARN_BOOL_CONVERSION = YES;
204 | CLANG_WARN_CONSTANT_CONVERSION = YES;
205 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
206 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
207 | CLANG_WARN_EMPTY_BODY = YES;
208 | CLANG_WARN_ENUM_CONVERSION = YES;
209 | CLANG_WARN_INFINITE_RECURSION = YES;
210 | CLANG_WARN_INT_CONVERSION = YES;
211 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
212 | CLANG_WARN_SUSPICIOUS_MOVES = YES;
213 | CLANG_WARN_UNREACHABLE_CODE = YES;
214 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
215 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
216 | COPY_PHASE_STRIP = NO;
217 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
218 | ENABLE_NS_ASSERTIONS = NO;
219 | ENABLE_STRICT_OBJC_MSGSEND = YES;
220 | FRAMEWORK_SEARCH_PATHS = "$(SRCROOT)/../../../ios/Frameworks";
221 | GCC_C_LANGUAGE_STANDARD = gnu99;
222 | GCC_NO_COMMON_BLOCKS = YES;
223 | GCC_PREFIX_HEADER = "";
224 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
225 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
226 | GCC_WARN_UNDECLARED_SELECTOR = YES;
227 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
228 | GCC_WARN_UNUSED_FUNCTION = YES;
229 | GCC_WARN_UNUSED_VARIABLE = YES;
230 | HEADER_SEARCH_PATHS = (
231 | "$(inherited)",
232 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
233 | "$(SRCROOT)/../../../react-native/React/**",
234 | );
235 | IPHONEOS_DEPLOYMENT_TARGET = 10.1;
236 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
237 | MTL_ENABLE_DEBUG_INFO = NO;
238 | SDKROOT = iphoneos;
239 | VALIDATE_PRODUCT = YES;
240 | };
241 | name = Release;
242 | };
243 | 9F12EBD01DD30C6600029EAF /* Debug */ = {
244 | isa = XCBuildConfiguration;
245 | buildSettings = {
246 | FRAMEWORK_SEARCH_PATHS = (
247 | "$(SRCROOT)/../../../../ios/Pods/AMapFoundation",
248 | "$(SRCROOT)/../../../../ios/Pods/AMapSearch",
249 | "$(SRCROOT)/../../../../ios/Pods/AMap3DMap",
250 | "$(SRCROOT)/../../../../ios/Frameworks",
251 | );
252 | HEADER_SEARCH_PATHS = (
253 | "$(inherited)",
254 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
255 | "$(SRCROOT)/../../../react-native/React/**",
256 | );
257 | ONLY_ACTIVE_ARCH = YES;
258 | OTHER_LDFLAGS = "";
259 | PRODUCT_NAME = "$(TARGET_NAME)";
260 | SKIP_INSTALL = YES;
261 | };
262 | name = Debug;
263 | };
264 | 9F12EBD11DD30C6600029EAF /* Release */ = {
265 | isa = XCBuildConfiguration;
266 | buildSettings = {
267 | FRAMEWORK_SEARCH_PATHS = (
268 | "$(SRCROOT)/../../../../ios/Pods/AMapFoundation",
269 | "$(SRCROOT)/../../../../ios/Pods/AMapSearch",
270 | "$(SRCROOT)/../../../../ios/Pods/AMap3DMap",
271 | "$(SRCROOT)/../../../../ios/Frameworks",
272 | );
273 | HEADER_SEARCH_PATHS = (
274 | "$(inherited)",
275 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
276 | "$(SRCROOT)/../../../react-native/React/**",
277 | );
278 | OTHER_LDFLAGS = "";
279 | PRODUCT_NAME = "$(TARGET_NAME)";
280 | SKIP_INSTALL = YES;
281 | };
282 | name = Release;
283 | };
284 | /* End XCBuildConfiguration section */
285 |
286 | /* Begin XCConfigurationList section */
287 | 9F12EBC11DD30C6600029EAF /* Build configuration list for PBXProject "RCTAMap" */ = {
288 | isa = XCConfigurationList;
289 | buildConfigurations = (
290 | 9F12EBCD1DD30C6600029EAF /* Debug */,
291 | 9F12EBCE1DD30C6600029EAF /* Release */,
292 | );
293 | defaultConfigurationIsVisible = 0;
294 | defaultConfigurationName = Release;
295 | };
296 | 9F12EBCF1DD30C6600029EAF /* Build configuration list for PBXNativeTarget "RCTAMap" */ = {
297 | isa = XCConfigurationList;
298 | buildConfigurations = (
299 | 9F12EBD01DD30C6600029EAF /* Debug */,
300 | 9F12EBD11DD30C6600029EAF /* Release */,
301 | );
302 | defaultConfigurationIsVisible = 0;
303 | defaultConfigurationName = Release;
304 | };
305 | /* End XCConfigurationList section */
306 | };
307 | rootObject = 9F12EBBE1DD30C6600029EAF /* Project object */;
308 | }
309 |
--------------------------------------------------------------------------------
/android/src/main/java/com/reactnativecomponent/amap/RCTAMapView.java:
--------------------------------------------------------------------------------
1 | package com.reactnativecomponent.amap;
2 |
3 | import android.animation.ObjectAnimator;
4 | import android.content.res.Resources;
5 | import android.graphics.Bitmap;
6 | import android.graphics.BitmapFactory;
7 | import android.graphics.Color;
8 | import android.os.Parcelable;
9 | import android.util.DisplayMetrics;
10 | import android.util.Log;
11 | import android.view.ViewGroup;
12 | import android.widget.FrameLayout;
13 | import android.widget.ImageView;
14 |
15 | import com.amap.api.location.AMapLocation;
16 | import com.amap.api.location.AMapLocationClient;
17 | import com.amap.api.location.AMapLocationClientOption;
18 | import com.amap.api.location.AMapLocationListener;
19 | import com.amap.api.maps2d.AMap;
20 | import com.amap.api.maps2d.CameraUpdate;
21 | import com.amap.api.maps2d.CameraUpdateFactory;
22 | import com.amap.api.maps2d.LocationSource;
23 | import com.amap.api.maps2d.MapView;
24 | import com.amap.api.maps2d.UiSettings;
25 | import com.amap.api.maps2d.model.BitmapDescriptor;
26 | import com.amap.api.maps2d.model.BitmapDescriptorFactory;
27 | import com.amap.api.maps2d.model.CameraPosition;
28 | import com.amap.api.maps2d.model.Circle;
29 | import com.amap.api.maps2d.model.CircleOptions;
30 | import com.amap.api.maps2d.model.LatLng;
31 | import com.amap.api.maps2d.model.Marker;
32 | import com.amap.api.maps2d.model.MarkerOptions;
33 | import com.facebook.react.bridge.Arguments;
34 | import com.facebook.react.bridge.ReactContext;
35 | import com.facebook.react.bridge.WritableMap;
36 | import com.facebook.react.uimanager.ThemedReactContext;
37 | import com.facebook.react.uimanager.events.RCTEventEmitter;
38 | import com.reactnativecomponent.amap.util.SensorEventHelper;
39 |
40 | import static com.amap.api.maps2d.AMapOptions.LOGO_POSITION_BOTTOM_RIGHT;
41 | import static com.amap.api.maps2d.AMapOptions.ZOOM_POSITION_RIGHT_CENTER;
42 |
43 |
44 |
45 |
46 | public class RCTAMapView extends FrameLayout implements LocationSource, AMapLocationListener, AMap.OnCameraChangeListener {
47 | private String centerMarker = "";
48 | private String locationMarker = "";
49 | private static int SCROLL_BY_PX = 1;
50 | private MapView MAPVIEW;
51 | private LatLng latLng;
52 | private LocationSource.OnLocationChangedListener mListener;
53 | private AMapLocationClient mlocationClient;
54 | private AMapLocationClientOption mLocationOption;
55 | private SensorEventHelper mSensorHelper;
56 | private static final int STROKE_COLOR = Color.argb(180, 3, 145, 255);
57 | private static final int FILL_COLOR = Color.argb(10, 0, 0, 180);
58 | private AMap AMAP;
59 | private Marker mLocMarker;
60 | private Circle mCircle;
61 | private LatLng location;//定位标记
62 | private int PAGESIZE = 10;//每页显示数量
63 | private boolean isFirstMove = true;
64 | private UiSettings mapUiSettings;
65 |
66 | private MarkerOptions markerOption;
67 | private float RADIUS = 10;//定位圆圈
68 | private double zoomLevel = 18;
69 | private int HEIGHT, WIDTH, viewWidth, viewHeight;
70 | private ThemedReactContext CONTEXT;
71 | private ViewGroup.LayoutParams PARAM;
72 | private boolean hasLocationMarker = false;
73 | private boolean zoomControls = false;
74 | private boolean zoomGestures = true;
75 | private boolean scaleControls = false;
76 | private boolean compassEnable = false;
77 | private boolean onceLocation = true;
78 | private ImageView CenterView;
79 |
80 | private long startTime;
81 |
82 | public void setLatLng(LatLng latLng) {
83 | this.latLng = latLng;
84 | }
85 |
86 | public void setCenterMarker(String centerMarker) {
87 | this.centerMarker = centerMarker;
88 | }
89 |
90 | public void setLocationMarker(String locationMarker) {
91 | this.locationMarker = locationMarker;
92 | }
93 |
94 | public void setZoomLevel(double zoomLevel) {
95 | this.zoomLevel = zoomLevel;
96 | }
97 |
98 | public RCTAMapView(ThemedReactContext context) {
99 | super(context);
100 | this.CONTEXT = context;
101 | CenterView = new ImageView(context);
102 | Resources resources = context.getCurrentActivity().getResources();
103 | DisplayMetrics dm = resources.getDisplayMetrics();
104 |
105 | PARAM = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
106 | }
107 |
108 | @Override
109 | protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
110 | /**
111 | * 处理中心点控件位置
112 | */
113 | if(centerMarker !=null && centerMarker != "") {
114 | HEIGHT = getHeight();
115 | WIDTH = getWidth();
116 | LayoutParams params = (LayoutParams) CenterView.getLayoutParams();
117 |
118 | viewWidth = CenterView.getMeasuredWidth();
119 | viewHeight = CenterView.getMeasuredHeight();
120 |
121 | params.setMargins(WIDTH / 2 - viewWidth / 2, HEIGHT / 2 - viewHeight, 0, 0);
122 | CenterView.setLayoutParams(params);
123 | }
124 |
125 | super.onLayout(changed, left, top, right, bottom);
126 |
127 | }
128 |
129 | /**
130 | * Activity onResume后调用view的onAttachedToWindow
131 | */
132 | @Override
133 | protected void onAttachedToWindow() {
134 | init();
135 | super.onAttachedToWindow();
136 | }
137 |
138 | /**
139 | * 初始化控件,定位位置
140 | */
141 | private void init() {
142 | mSensorHelper = new SensorEventHelper(CONTEXT);
143 | if (mSensorHelper != null) {
144 | mSensorHelper.registerSensorListener();
145 | }
146 | MAPVIEW = new MapView(CONTEXT);
147 | MAPVIEW.setLayoutParams(PARAM);
148 | this.addView(MAPVIEW);
149 | MAPVIEW.onCreate(CONTEXT.getCurrentActivity().getIntent().getExtras());
150 |
151 | if(centerMarker !=null && centerMarker != "") {
152 | CenterView.setLayoutParams(new ViewGroup.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
153 | CenterView.setImageResource(getImageId(centerMarker));
154 | this.addView(CenterView, 1);
155 | }
156 |
157 | setMapOptions();
158 |
159 | }
160 |
161 |
162 | /**
163 | * 设置一些amap的属性
164 | */
165 | private void setMapOptions() {
166 |
167 | AMAP = MAPVIEW.getMap();
168 | AMAP.setMapType(AMap.MAP_TYPE_NORMAL);// 矢量地图模式
169 |
170 | mapUiSettings = AMAP.getUiSettings();//实例化UiSettings类
171 | mapUiSettings.setZoomControlsEnabled(zoomControls);//显示缩放按钮
172 | mapUiSettings.setZoomPosition(ZOOM_POSITION_RIGHT_CENTER);//缩放按钮 右边界中部:ZOOM_POSITION_RIGHT_CENTER 右下:ZOOM_POSITION_RIGHT_BUTTOM。
173 | mapUiSettings.setLogoPosition(LOGO_POSITION_BOTTOM_RIGHT);//Logo的位置 左下:LOGO_POSITION_BOTTOM_LEFT 底部居中:LOGO_POSITION_BOTTOM_CENTER 右下:LOGO_POSITION_BOTTOM_RIGHT
174 | mapUiSettings.setCompassEnabled(compassEnable);//指南针
175 | mapUiSettings.setZoomGesturesEnabled(zoomGestures);//手势缩放
176 | mapUiSettings.setScaleControlsEnabled(scaleControls);//比例尺
177 |
178 | changeCamera(
179 | CameraUpdateFactory.newCameraPosition(new CameraPosition(
180 | latLng, (float) zoomLevel, 30, 0)));
181 |
182 | hasLocationMarker = true;
183 | addLocationMarker(latLng, RADIUS, mLocMarker);
184 |
185 | AMAP.setLocationSource(this);// 设置定位监听
186 | AMAP.setOnCameraChangeListener(this);// 对amap添加移动地图事件监听器
187 | mapUiSettings.setMyLocationButtonEnabled(false);// 设置默认定位按钮是否显示
188 | AMAP.setMyLocationEnabled(true);// 设置为true表示显示定位层并可触发定位,false表示隐藏定位层并不可触发定位,默认是false
189 |
190 |
191 | }
192 |
193 | /**
194 | * 中心点添加定位标记
195 | *
196 | * @param latLng
197 | * @param RADIUS
198 | * @param mLocMarker
199 | */
200 | private void addLocationMarker(LatLng latLng, float RADIUS, Marker mLocMarker) {
201 | // addCircle(latLng, RADIUS);//添加定位精度圆
202 | // addMarker(latLng);//添加定位图标
203 | // mSensorHelper.setCurrentMarker(mLocMarker);//定位图标旋转
204 | }
205 |
206 | /**
207 | * 调用函数moveCamera来改变可视区域
208 | */
209 | private void changeCamera(CameraUpdate update) {
210 |
211 | AMAP.moveCamera(update);
212 |
213 | }
214 |
215 | /**
216 | * 获得图片资源ID
217 | *
218 | * @return
219 | */
220 | private int getImageId(String fileName) {
221 | int drawableId = CONTEXT.getCurrentActivity().getResources().getIdentifier(fileName, "drawable", CONTEXT.getCurrentActivity().getClass().getPackage().getName());
222 | if (drawableId == 0) {
223 | drawableId = CONTEXT.getCurrentActivity().getResources().getIdentifier("splash", "drawable", CONTEXT.getCurrentActivity().getPackageName());
224 | }
225 |
226 | return drawableId;
227 | }
228 |
229 | /**
230 | * 根据动画调用函数animateCamera来改变可视区域
231 | */
232 | private void animateCamera(CameraUpdate update, AMap.CancelableCallback callback) {
233 |
234 | AMAP.animateCamera(update, 1000, callback);
235 |
236 | }
237 |
238 | @Override
239 | protected Parcelable onSaveInstanceState() {
240 | if (CONTEXT.getCurrentActivity().getIntent() != null && CONTEXT.getCurrentActivity().getIntent().getExtras() != null) {
241 | MAPVIEW.onSaveInstanceState(CONTEXT.getCurrentActivity().getIntent().getExtras());
242 | }
243 | return super.onSaveInstanceState();
244 | }
245 |
246 | @Override
247 | protected void onDetachedFromWindow() {
248 | this.removeView(MAPVIEW);
249 | MAPVIEW.onDestroy();
250 | super.onDetachedFromWindow();
251 | }
252 |
253 | /**
254 | * 对应onResume、对应onPause
255 | *
256 | * @param hasWindowFocus
257 | */
258 | @Override
259 | public void onWindowFocusChanged(boolean hasWindowFocus) {
260 |
261 | super.onWindowFocusChanged(hasWindowFocus);
262 |
263 | if (hasWindowFocus) {
264 | // 对应onResume
265 | MAPVIEW.onResume();
266 | } else {
267 | //对应onPause
268 | MAPVIEW.onPause();
269 |
270 | }
271 |
272 | }
273 |
274 | @Override
275 | public void onLocationChanged(AMapLocation amapLocation) {
276 |
277 | // if (!isFirstMove) {
278 | // isFirstMove = true;
279 | // }
280 | //
281 | // if (mListener != null && amapLocation != null) {
282 | // if (amapLocation != null
283 | // && amapLocation.getErrorCode() == 0) {
284 | //
285 | // location = new LatLng(amapLocation.getLatitude(), amapLocation.getLongitude());
286 | //// Log.i("TEST", "getLatitude:"+amapLocation.getLatitude()+"getLongitude:"+amapLocation.getLongitude());
287 | // DEFAULTCITY = amapLocation.getCity();
288 | // if (!hasLocationMarker) {
289 | // hasLocationMarker = true;
290 | // addLocationMarker(location, RADIUS, mLocMarker);
291 | //// 首次定位到点location
292 | //// AMAP.moveCamera(CameraUpdateFactory.newLatLngZoom(location, zoomLevel));
293 | // } else {
294 | // mCircle.setCenter(location);
295 | // mCircle.setRadius(RADIUS);
296 | // mLocMarker.setPosition(location);
297 | // }
298 | // //移动镜头定位到点location
299 | // /*AMAP.moveCamera(CameraUpdateFactory.newLatLngZoom(location, zoomLevel));*/
300 | //
301 | // changeCamera(
302 | // CameraUpdateFactory.newCameraPosition(new CameraPosition(
303 | // location, zoomLevel, 30, 0)));
304 | // /* animateCamera(CameraUpdateFactory.newCameraPosition(new CameraPosition(
305 | // location, zoomLevel, 30, 0)),null);*/
306 | // changeCamera(CameraUpdateFactory.scrollBy(0, -SCROLL_BY_PX));
307 | // } else {
308 | // String errText = "定位失败," + amapLocation.getErrorCode() + ": " + amapLocation.getErrorInfo();
309 | // Log.i("TEST", errText);
310 | //
311 | // }
312 | // }
313 | // long endTime2 = System.currentTimeMillis();
314 | // Log.i("Test", "onLocationChangedFINISH:" + (endTime2 - startTime + ",getLatitude=" + amapLocation.getLatitude() + "getLongitude=" + amapLocation.getLongitude()));
315 | }
316 |
317 | /**
318 | * 获得当前控件中心点坐标
319 | */
320 | public LatLng getCenterLocation() {
321 | LatLng latlng = AMAP.getCameraPosition().target;
322 | // addMarkersToMap(latlng);
323 | return latlng;
324 | }
325 |
326 | /**
327 | * 获得当前控件中心点坐标
328 | */
329 | public void setCenterLocation(double latitude, double longitude) {
330 | LatLng latlng = new LatLng(latitude, longitude);
331 | AMAP.moveCamera(CameraUpdateFactory.newLatLngZoom(latlng, (float)zoomLevel));
332 | // addMarkersToMap(latlng);
333 | }
334 |
335 | /**
336 | * 在地图上添加marker
337 | */
338 | private void addMarkersToMap(LatLng latlng) {
339 |
340 | markerOption = new MarkerOptions().icon(BitmapDescriptorFactory
341 | .defaultMarker(BitmapDescriptorFactory.HUE_AZURE))
342 | .position(latlng)
343 | .draggable(true);
344 | AMAP.addMarker(markerOption);
345 | }
346 |
347 |
348 | /**
349 | * 定位到设备定位位置
350 | */
351 | public void startLocation() {
352 | startTime = System.currentTimeMillis();
353 | Log.i("Test", "startTime:" + startTime);
354 | if (mlocationClient == null) {
355 | Log.i("Test", "mlocationClient = null");
356 | mlocationClient = new AMapLocationClient(CONTEXT);
357 | mLocationOption = new AMapLocationClientOption();
358 | //设置定位监听
359 | mlocationClient.setLocationListener(this);
360 | //设置为高精度定位模式
361 | mLocationOption.setLocationMode(AMapLocationClientOption.AMapLocationMode.Hight_Accuracy);
362 | mLocationOption.setOnceLocation(onceLocation);
363 | // mLocationOption.setOnceLocationLatest(true);
364 | mLocationOption.setLocationCacheEnable(true);//定位缓存策略
365 | // mLocationOption.setInterval(10);
366 | // mLocationOption.setInterval(3*60*1000);
367 | //设置定位参数
368 | mlocationClient.setLocationOption(mLocationOption);
369 |
370 | // 此方法为每隔固定时间会发起一次定位请求,为了减少电量消耗或网络流量消耗,
371 | // 注意设置合适的定位时间的间隔(最小间隔支持为2000ms),并且在合适时间调用stopLocation()方法来取消定位请求
372 | // 在定位结束后,在合适的生命周期调用onDestroy()方法
373 | // 在单次定位情况下,定位无论成功与否,都无需调用stopLocation()方法移除请求,定位sdk内部会移除
374 |
375 | }
376 | mlocationClient.startLocation();
377 | }
378 |
379 | private void addCircle(LatLng latlng, float RADIUS) {
380 | CircleOptions options = new CircleOptions();
381 | options.strokeWidth(1f);
382 | options.fillColor(FILL_COLOR);
383 | options.strokeColor(STROKE_COLOR);
384 | options.center(latlng);
385 | options.radius(RADIUS);
386 | mCircle = AMAP.addCircle(options);
387 |
388 | /* ObjectAnimator radiusAnim = ObjectAnimator.ofFloat(mCircle, "radius", radius,0.0f,radius);
389 | radiusAnim.setDuration(1000);
390 | radiusAnim.setRepeatCount(ValueAnimator.INFINITE);//无限循环
391 | // translationYAnim.setRepeatMode(ValueAnimator.INFINITE);
392 | radiusAnim.start();*/
393 |
394 | }
395 |
396 | private void addMarker(LatLng latlng) {
397 | if (mLocMarker != null) {
398 | return;
399 | }
400 | // Bitmap bMap = BitmapFactory.decodeResource(this.getResources(),
401 | // R.drawable.navi_map_gps_locked);
402 | Bitmap bMap = BitmapFactory.decodeResource(this.getResources(),
403 | getImageId(locationMarker));
404 | BitmapDescriptor des = BitmapDescriptorFactory.fromBitmap(bMap);
405 |
406 | // BitmapDescriptor des = BitmapDescriptorFactory.fromResource(R.drawable.navi_map_gps_locked);
407 | MarkerOptions options = new MarkerOptions();
408 | options.icon(des);
409 | options.anchor(0.5f, 0.5f);
410 | options.position(latlng);
411 | // 将Marker设置为贴地显示,可以双指下拉看效果
412 |
413 | mLocMarker = AMAP.addMarker(options);
414 | }
415 |
416 |
417 | @Override
418 | public void activate(OnLocationChangedListener listener) {
419 | mListener = listener;
420 | // startLocation();
421 | }
422 |
423 | @Override
424 | public void deactivate() {
425 | mListener = null;
426 | if (mlocationClient != null) {
427 | mlocationClient.stopLocation();
428 | mlocationClient.onDestroy();
429 | }
430 | mlocationClient = null;
431 | }
432 |
433 | @Override
434 | public void onCameraChange(CameraPosition cameraPosition) {
435 |
436 |
437 | }
438 |
439 | /**
440 | * 控制中心点动画 获取中心点坐标 查询周边
441 | *
442 | * @param cameraPosition
443 | */
444 | @Override
445 | public void onCameraChangeFinish(CameraPosition cameraPosition) {
446 | /**
447 | * 中心点动画开始
448 | */
449 | ObjectAnimator translationYAnim = ObjectAnimator.ofFloat(CenterView, "translationY", 0.0f, -viewHeight / 2, 0.0f);
450 | translationYAnim.setDuration(600);
451 | // translationYAnim.setRepeatCount(ValueAnimator.RESTART);//重复一次
452 | // translationYAnim.setRepeatMode(ValueAnimator.INFINITE);
453 | translationYAnim.start();
454 | /**
455 | * 中心点动画结束
456 | */
457 |
458 |
459 | if (!isFirstMove) {
460 | return;
461 | }
462 | LatLng latlng = AMAP.getCameraPosition().target;//获取屏幕中心点
463 |
464 | WritableMap eventMap = Arguments.createMap();
465 | WritableMap dataMap = Arguments.createMap();
466 | WritableMap centerCoordinateMap = Arguments.createMap();
467 | centerCoordinateMap.putDouble("latitude", latlng.latitude);
468 | centerCoordinateMap.putDouble("longitude", latlng.longitude);
469 | dataMap.putMap("centerCoordinate", centerCoordinateMap);
470 | eventMap.putMap("data", dataMap);
471 | ReactContext reactContext = (ReactContext) getContext();
472 | reactContext.getJSModule(RCTEventEmitter.class).receiveEvent(
473 | getId(),
474 | "onDidMoveByUser",
475 | eventMap);
476 |
477 | }
478 | }
479 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # react-native-smart-amap
2 | A AMap Library for React Native apps.
3 |
4 | [](https://www.npmjs.com/package/react-native-smart-amap)
5 | [](https://www.npmjs.com/package/react-native-smart-amap)
6 | [](https://www.npmjs.com/package/react-native-smart-amap)
7 | [](https://github.com/react-native-component/react-native-smart-amap/blob/master/LICENSE)
8 |
9 | react-native 高德地图SDK 插件, 支持ios与android,
10 | 关于使用高德地图SDK, 申请应用key等详细信息请点击[这里][1]
11 |
12 | Mac下Android Studio中获取SHA1和MD5请点击[这里][3]
13 |
14 | ## 预览
15 |
16 | ![react-native-smart-amap-preview-ios][2]
17 |
18 | ## 安装
19 |
20 | ```
21 | npm install react-native-smart-amap --save
22 | ```
23 |
24 | ## Notice
25 |
26 | 这个版本仅支持react-native 0.40及以上, 如果你想使用旧版本,使用`npm install react-native-smart-amap@untilRN0.40 --save`
27 |
28 |
29 | ## 安装 (iOS)
30 |
31 | * 将RCTAMap.xcodeproj作为Library拖进你的Xcode里的project中.
32 |
33 | * 将RCTAMap目录里Frameworks目录拖进主project目录下, 选择copy items if needed, create groups, 另外add to target不要忘记选择主project.
34 |
35 | * 将RCTAMap目录里Frameworks目录里的AMap.bundle拖进主project目录下, 选择copy items if needed, create groups, 另外add to target不要忘记选择主project.
36 |
37 | * 点击你的主project, 选择Build Phases -> Link Binary With Libraries, 将RCTAMap.xcodeproj里Product目录下的libRCTAMap.a拖进去.
38 |
39 | * 同上位置, 选择Add items, 将系统库libstdc++.6.0.9.tbd加入.
40 |
41 | * 同上位置, 选择Add items, 将系统库libc++.tbd加入.
42 |
43 | * 同上位置, 选择Add items, 将系统库libz.tbd加入.
44 |
45 | * 同上位置, 选择Add items, 将系统库Security.framework加入.
46 |
47 | * 同上位置, 选择Add items, 将系统库CoreTelephony.framework加入.
48 |
49 | * 同上位置, 选择Add items, 将系统库SystemConfiguration.framework加入.
50 |
51 | * 同上位置, 选择Add items, 将系统库JavaScriptCore.framework加入.
52 |
53 | * 同上位置, 选择Add items, 将系统库CoreLocation.framework加入.
54 |
55 | * 选择Build Settings, 找到Header Search Paths, 确认其中包含$(SRCROOT)/../../../react-native/React, 模式为recursive.
56 |
57 | * 同上位置, 找到Framework Search Paths, 加入$(PROJECT_DIR)/Frameworks.
58 |
59 | * 点击在Libraries下已拖进来的RCTAMap.xcodeproj, 选择Build Settings, 找到Framework Search Paths, 将$(SRCROOT)/../../../ios/Frameworks替换成$(SRCROOT)/../../../../ios/Frameworks.
60 |
61 | * 在`info.plist`中加入`Privacy - Location When In Use Usage Description`属性(ios 10)
62 |
63 | * 在`info.plist`中加入`Allow Arbitrary Loads`属性, 并设置值为YES(ios 10)
64 |
65 | * 在`AppDelegate.m`中
66 |
67 | ```
68 |
69 | ...
70 | #import //引入高德地图核心包
71 | ...
72 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
73 | {
74 |
75 | [AMapServices sharedServices].apiKey = @"请填写您的key"; //设置高德地图SDK服务key
76 | ...
77 | }
78 | ...
79 |
80 | ```
81 |
82 | ## 安装 (Android)
83 |
84 | * 在`android/settings.gradle`中
85 |
86 | ```
87 | ...
88 | include ':react-native-smart-amap'
89 | project(':react-native-smart-amap').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-smart-amap/android')
90 | ```
91 |
92 | * 在`android/app/build.gradle`中
93 |
94 | ```
95 | ...
96 | dependencies {
97 | ...
98 | // From node_modules
99 | compile project(':react-native-smart-amap')
100 | }
101 | ```
102 |
103 | * 在`MainApplication.java`中
104 |
105 | ```
106 | ...
107 | import com.reactnativecomponent.amaplocation.RCTAMapPackage; //import package
108 | ...
109 | /**
110 | * A list of packages used by the app. If the app uses additional views
111 | * or modules besides the default ones, add more packages here.
112 | */
113 | @Override
114 | protected List getPackages() {
115 | return Arrays.asList(
116 | new MainReactPackage(),
117 | new RCTAMapPackage() //register Module
118 | );
119 | }
120 | ...
121 |
122 | ```
123 |
124 | * 在`AndroidManifest.xml`中, 加入所需权限
125 |
126 | ```
127 |
128 | ...
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 | ...
164 |
165 | ```
166 |
167 | * 在`AndroidManifest.xml`中, application标签内加入
168 |
169 | ```
170 |
171 | ...
172 |
173 |
176 |
177 |
178 |
179 | ...
180 |
181 | ```
182 |
183 | ## 完整示例
184 |
185 | 点击这里 [ReactNativeComponentDemos][0]
186 |
187 | ## 使用简介
188 |
189 | Install the package from npm with `npm install react-native-smart-amap --save`.
190 | Then, require it from your app's JavaScript files with `import Barcode from 'react-native-smart-amap'`.
191 |
192 | ```js
193 | import React, {
194 | Component,
195 | } from 'react'
196 | import {
197 | StyleSheet,
198 | View,
199 | Text,
200 | Image,
201 | NativeAppEventEmitter,
202 | TouchableHighlight,
203 | ListView,
204 | Dimensions,
205 | Alert,
206 | Platform,
207 | } from 'react-native'
208 |
209 | import AMapLocation from 'react-native-smart-amap-location'
210 | import AMap from 'react-native-smart-amap'
211 | import Button from 'react-native-smart-button'
212 | import AppEventListenerEnhance from 'react-native-smart-app-event-listener-enhance'
213 | import PullToRefreshListView from 'react-native-smart-pull-to-refresh-listview'
214 | import TimerEnhance from 'react-native-smart-timer-enhance'
215 | import AMapALoneNearByList from './amp-alone-nearby-list'
216 | import ListViewActivityIndicator from './ListViewActivityIndicator'
217 |
218 | const {width: deviceWidth, height: deviceHeight} = Dimensions.get('window')
219 |
220 | class AMapDemo extends Component {
221 |
222 | constructor(props) {
223 | super(props);
224 |
225 | this._amap = null
226 | this._page = 0
227 | this._coordinate = this.props.navigator.navigationContext._currentRoute.coordinate
228 | console.log(`this._coordinate -> `)
229 | console.log(this._coordinate)
230 | this._keywords = '商务住宅|学校'
231 | this._onDidMoveByUserTimer = null
232 | }
233 |
234 | componentDidMount() {
235 | this.addAppEventListener(
236 | NativeAppEventEmitter.addListener('amap.location.onLocationResult', this._onLocationResult),
237 | NativeAppEventEmitter.addListener('amap.onPOISearchDone', this._onPOISearchDone)
238 | //NativeAppEventEmitter.addListener('amap.onPOISearchFailed', this._onPOISearchFailed)
239 | )
240 | }
241 |
242 | render () {
243 | //console.log(`amap-alone render...`)
244 | return (
245 |
246 |
247 | this._amap = component }
249 | style={{flex: 1, }}
250 | options={{
251 | frame: {
252 | width: deviceWidth,
253 | height: (deviceHeight - 64) - 50 * 5
254 | },
255 | showsUserLocation: false,
256 | userTrackingMode: Platform.OS == 'ios' ? AMap.constants.userTrackingMode.none : null,
257 | centerCoordinate: {
258 | latitude: this._coordinate.latitude,
259 | longitude: this._coordinate.longitude,
260 | },
261 | zoomLevel: 18.1,
262 | centerMarker: Platform.OS == 'ios' ? 'icon_location' : 'poi_marker',
263 | }}
264 | onLayout={this._onLayout}
265 | onDidMoveByUser={this._onDidMoveByUser}
266 | />
267 |
278 |
279 |
280 | this._amapALoneNearByList = component }
282 | onRefresh={this._onRefresh}
283 | onLoadMore={this._onLoadMore}
284 | />
285 | this._activityIndicator = component }
287 | style={{marginRight: 10, position:'absolute', left: (deviceWidth - 20) / 2, top: (50 * 5 - 20) / 2, }}
288 | color={'#a9a9a9'}/>
289 |
290 |
291 | )
292 | }
293 |
294 | _onDidMoveByUser = (e) => {
295 | //console.log(`_onDidMoveByUser....`)
296 | if(this._onDidMoveByUserTimer) {
297 | this.clearTimeout(this._onDidMoveByUserTimer)
298 | this._onDidMoveByUserTimer = null
299 | }
300 | let { longitude, latitude, } = e.nativeEvent.data.centerCoordinate
301 | this._onDidMoveByUserTimer = this.setTimeout( ()=> {
302 | let {refresh_none, refresh_idle, load_more_none, load_more_idle, loaded_all,} = PullToRefreshListView.constants.viewState
303 | if((this._amapALoneNearByList._pullToRefreshListView._refreshState == refresh_none || this._amapALoneNearByList._pullToRefreshListView._refreshState == refresh_idle)
304 | && (this._amapALoneNearByList._pullToRefreshListView._loadMoreState == load_more_none
305 | || this._amapALoneNearByList._pullToRefreshListView._loadMoreState == load_more_idle
306 | || this._amapALoneNearByList._pullToRefreshListView._loadMoreState == loaded_all)) {
307 | console.log(`beginRefresh(true)....`)
308 | this._coordinate = {
309 | longitude,
310 | latitude,
311 | }
312 | this._activityIndicator.setState({ visible: true,})
313 | this._amapALoneNearByList._pullToRefreshListView._scrollView.scrollTo({ y: 0, animated: false, })
314 | this._amapALoneNearByList._pullToRefreshListView.beginRefresh(true)
315 | //this._amapALoneNearByList._pullToRefreshListView.beginRefresh()
316 | this._beginRefresh = true
317 | }
318 | }, 300)
319 | }
320 |
321 | _onLocationResult = (result) => {
322 | if(result.error) {
323 | console.log(`map-错误代码: ${result.error.code}, map-错误信息: ${result.error.localizedDescription}`)
324 | }
325 | else {
326 | if(result.formattedAddress) {
327 | console.log(`map-格式化地址 = ${result.formattedAddress}`)
328 | }
329 | else {
330 | console.log(`map-纬度 = ${result.coordinate.latitude}, map-经度 = ${result.coordinate.longitude}`)
331 | this._coordinate = {
332 | latitude: result.coordinate.latitude,
333 | longitude: result.coordinate.longitude,
334 | }
335 | this._amap.setOptions({
336 | zoomLevel: 18.1,
337 | })
338 | this._amap.setCenterCoordinate(this._coordinate)
339 | }
340 | }
341 | }
342 |
343 | //_onPOISearchFailed = (e) => {
344 | // //console.log(`_onPOISearchFailed...`)
345 | // //console.log(e)
346 | // //console.log(e.error)
347 | // this._page--;
348 | //}
349 |
350 | _onPOISearchDone = (result) => {
351 | console.log(`_onPOISearchDone...`)
352 |
353 | if(Platform.OS == 'ios') {
354 | this._endSearch(result)
355 | }
356 | else {
357 | this.setTimeout( () => {
358 | this._endSearch(result)
359 | }, 255)
360 | }
361 | }
362 |
363 | _endSearch = (result) => {
364 | let { searchResultList, error } = result
365 |
366 | console.log(result.error)
367 |
368 | if(error) {
369 | if(this._page == 1) {
370 | this._page--
371 | this._amapALoneNearByList._pullToRefreshListView.endRefresh(this._beginRefresh)
372 | //this._amapALoneNearByList._pullToRefreshListView.endRefresh()
373 | this._beginRefresh = false
374 | this._activityIndicator.setState({ visible: false,})
375 | }
376 | else {
377 | this._amapALoneNearByList._pullToRefreshListView.endLoadMore(false)
378 | }
379 | return
380 | }
381 |
382 | console.log(`this._page = ${this._page}`)
383 |
384 | //onRefresh
385 | if(this._page == 1) {
386 | this._amapALoneNearByList.setState({
387 | dataList: searchResultList,
388 | dataSource: this._amapALoneNearByList._dataSource.cloneWithRows(searchResultList),
389 | })
390 | this._amapALoneNearByList._pullToRefreshListView.endRefresh(this._beginRefresh)
391 | //this._amapALoneNearByList._pullToRefreshListView.endRefresh()
392 | this._beginRefresh = false
393 | this._activityIndicator.setState({ visible: false,})
394 | }
395 | //onLoadMore
396 | else {
397 | let newDataList = this._amapALoneNearByList.state.dataList.concat(searchResultList)
398 | this._amapALoneNearByList.setState({
399 | dataList: newDataList,
400 | dataSource: this._amapALoneNearByList._dataSource.cloneWithRows(newDataList),
401 | })
402 | let loadedAll
403 | if(searchResultList.length == 100) {
404 | loadedAll = true
405 | this._amapALoneNearByList._pullToRefreshListView.endLoadMore(loadedAll)
406 | }
407 | else {
408 | loadedAll = false
409 | this._amapALoneNearByList._pullToRefreshListView.endLoadMore(loadedAll)
410 | }
411 | }
412 | }
413 |
414 | _searchNearBy = (searchParams)=> {
415 | this._amap.searchPoiByCenterCoordinate(searchParams)
416 | }
417 |
418 | _onRefresh = () => {
419 | console.log(`outer _onRefresh...`)
420 | this._searchNearBy({
421 | page: (this._page = 1),
422 | coordinate: this._coordinate,
423 | keywords: this._keywords,
424 | })
425 | }
426 |
427 | _onLoadMore = () => {
428 | console.log(`outer _onLoadMore...`)
429 | this._searchNearBy({
430 | page: ++this._page,
431 | coordinate: this._coordinate,
432 | keywords: this._keywords,
433 | })
434 | }
435 |
436 | }
437 |
438 | export default TimerEnhance(AppEventListenerEnhance(AMapDemo))
439 | ```
440 |
441 | ## 属性
442 |
443 | Prop | Type | Optional | Default | Description
444 | --------------------------- | ------ | -------- | --------- | -----------
445 | options | object | No | | 地图参数对象
446 | options.frame | object | No | | ios设置地图宽(width), 高(height), 类型是number
447 | options.showTraffic | bool | Yes | | ios设置是否显示路况, 默认不显示
448 | options.showsUserLocation | bool | Yes | | ios设置是否显示用户位置,默认显示
449 | options.userTrackingMode | bool | Yes | | ios设置追踪用户位置更新的模式,默认不追踪
450 | options.zoomLevel | number | Yes | | 指定缩放级别, 默认为最大级别
451 | options.centerCoordinate | object | Yes | | 根据经度(latitude)纬度(longitude)指定地图的中心点, 类型是number
452 | options.centerMarker | string | Yes | | 设置中心点自定义图标的项目资源名称, 如为空则不显示中心点图标
453 |
454 | ## 方法
455 |
456 | * setOptions
457 | * 描述: 更改地图参数
458 | * 参数: reactTag 类型: number, 地图的native view id, 根据这个id可以获取到地图的实例
459 | * 参数: options 类型: object, 地图参数, 数据结构同上Props中的options
460 |
461 | * setCenterCoordinate
462 | * 描述: 根据经纬度在地图中心位置显示
463 | * 参数: reactTag 类型: number, 地图的native view id, 根据这个id可以获取到地图的实例
464 | * 参数: coordinate 类型: object, 经纬度坐标参数, 数据结构同上Props中的options.centerCoordinate
465 |
466 | * searchPoiByCenterCoordinate
467 | * 描述: 根据经纬度坐标来搜索周边的POI
468 | * 参数: params 类型: object, 搜索参数, 数据结构如下:
469 | * types 类型: string 表示搜索类型,多个类型用“|”分割 可选值:文本分类、分类代码
470 | * sortrule 类型: number 表示排序规则, 0-距离排序;1-综合排序, 默认1
471 | * offset 类型: number 表示每页记录数, 范围1-50, 默认20
472 | * page 类型: number 表示当前页数, 范围1-100, 默认1
473 | * keywords 类型: string 表示查询关键字,多个关键字用“|”分割
474 | * coordinate 类型: object 表示中心点经纬度, 数据结构同上Props中的options.centerCoordinate
475 | * radius 类型: int 表示辐射半径, 默认3000米
476 |
477 | ## 事件监听
478 |
479 | * 地图事件: onDidMoveByUser
480 | * 描述: 监听用户动作, 返回当前地图中心点的经纬度信息
481 |
482 | * 全局事件: amap.onPOISearchDone
483 | * 描述: 监听POI搜索回调, 返回周边的POI信息
484 |
485 | [0]: https://github.com/cyqresig/ReactNativeComponentDemos
486 | [1]: http://lbs.amap.com/api/
487 | [2]: http://cyqresig.github.io/img/react-native-smart-amap-preview-ios-v1.0.0.gif
488 | [3]: http://blog.csdn.net/jackymvc/article/details/50222503
--------------------------------------------------------------------------------
/ios/frameworks/AMapSearchKit.framework/Headers/AMapSearchObj.h:
--------------------------------------------------------------------------------
1 | //
2 | // AMapSearchObj.h
3 | // AMapSearchKit
4 | //
5 | // Created by xiaoming han on 15/7/22.
6 | // Copyright (c) 2015年 AutoNavi. All rights reserved.
7 | //
8 |
9 | /**
10 | * 该文件定义了搜索请求和返回对象。
11 | */
12 |
13 | #import
14 | #import "AMapCommonObj.h"
15 |
16 | #pragma mark - AMapPOISearchBaseRequest
17 |
18 | /// POI搜索请求基类
19 | @interface AMapPOISearchBaseRequest : AMapSearchObject
20 |
21 | @property (nonatomic, copy) NSString *types; //!< 类型,多个类型用“|”分割 可选值:文本分类、分类代码
22 | @property (nonatomic, assign) NSInteger sortrule; //!< 排序规则, 0-距离排序;1-综合排序, 默认1
23 | @property (nonatomic, assign) NSInteger offset; //!< 每页记录数, 范围1-50, [default = 20]
24 | @property (nonatomic, assign) NSInteger page; //!< 当前页数, 范围1-100, [default = 1]
25 |
26 | @property (nonatomic, assign) BOOL requireExtension; //!< 是否返回扩展信息,默认为 NO。
27 | @property (nonatomic, assign) BOOL requireSubPOIs; //!< 是否返子POI,默认为 NO。
28 |
29 | @end
30 |
31 | /// POI ID搜索请求
32 | @interface AMapPOIIDSearchRequest : AMapPOISearchBaseRequest
33 |
34 | @property (nonatomic, copy) NSString *uid; //!< POI全局唯一ID
35 |
36 | @end
37 |
38 | /// POI关键字搜索
39 | @interface AMapPOIKeywordsSearchRequest : AMapPOISearchBaseRequest
40 |
41 | @property (nonatomic, copy) NSString *keywords; //!< 查询关键字,多个关键字用“|”分割
42 | @property (nonatomic, copy) NSString *city; //!< 查询城市,可选值:cityname(中文或中文全拼)、citycode、adcode.(注:台湾地区一律设置为【台湾】,不具体到市。)
43 | @property (nonatomic, assign) BOOL cityLimit; //!< 强制城市限制功能 默认NO,例如:在上海搜索天安门,如果citylimit为true,将不返回北京的天安门相关的POI
44 |
45 | @end
46 |
47 | /// POI周边搜索
48 | @interface AMapPOIAroundSearchRequest : AMapPOISearchBaseRequest
49 |
50 | @property (nonatomic, copy) NSString *keywords; //!< 查询关键字,多个关键字用“|”分割
51 | @property (nonatomic, copy) AMapGeoPoint *location; //!< 中心点坐标
52 | @property (nonatomic, assign) NSInteger radius; //!< 查询半径,范围:0-50000,单位:米 [default = 3000]
53 |
54 | @end
55 |
56 | /// POI多边形搜索
57 | @interface AMapPOIPolygonSearchRequest : AMapPOISearchBaseRequest
58 |
59 | @property (nonatomic, copy) NSString *keywords; //!< 查询关键字,多个关键字用“|”分割
60 | @property (nonatomic, copy) AMapGeoPolygon *polygon; //!< 多边形
61 |
62 | @end
63 |
64 | /// POI搜索返回
65 | @interface AMapPOISearchResponse : AMapSearchObject
66 |
67 | @property (nonatomic, assign) NSInteger count; //!< 返回的POI数目
68 | @property (nonatomic, strong) AMapSuggestion *suggestion; //!< 关键字建议列表和城市建议列表
69 | @property (nonatomic, strong) NSArray *pois; //!< POI结果,AMapPOI 数组
70 |
71 | @end
72 |
73 | #pragma mark - AMapPOIRouteSearchRequest
74 |
75 | /// 沿途搜索类型
76 | typedef NS_ENUM(NSInteger, AMapRoutePOISearchType)
77 | {
78 | AMapRoutePOISearchTypeGasStation = 0,//!< 加油站
79 | AMapRoutePOISearchTypeMaintenanceStation = 1,//!< 维修站
80 | AMapRoutePOISearchTypeATM = 2,//!< ATM
81 | AMapRoutePOISearchTypeToilet = 3,//!< 厕所
82 | };
83 |
84 | /// 沿途搜索
85 | @interface AMapRoutePOISearchRequest : AMapSearchObject
86 |
87 | @property (nonatomic, copy) AMapGeoPoint *origin; //!< 中心点坐标
88 | @property (nonatomic, copy) AMapGeoPoint *destination; //!< 中心点坐标
89 | @property (nonatomic, assign) AMapRoutePOISearchType searchType; //!< 搜索类型
90 | @property (nonatomic, assign) NSInteger strategy; //!< 驾车导航策略,同驾车路径规划请求的策略(5 多策略除外) AMapDrivingRouteSearchRequest 。
91 | @property (nonatomic, assign) NSInteger range; //!< 道路周围搜索范围,单位米,[0-500],默认250。
92 |
93 | @end
94 |
95 | /// 沿途搜索返回
96 | @interface AMapRoutePOISearchResponse : AMapSearchObject
97 |
98 | @property (nonatomic, assign) NSInteger count; //!< 返回的POI数目
99 | @property (nonatomic, strong) NSArray *pois; //!< POI结果,AMapRoutePOI 数组
100 |
101 | @end
102 |
103 | #pragma mark - AMapInputTipsSearchRequest
104 |
105 | /// 搜索提示请求
106 | @interface AMapInputTipsSearchRequest : AMapSearchObject
107 |
108 | @property (nonatomic, copy) NSString *keywords; //!< 查询关键字
109 | @property (nonatomic, copy) NSString *city; //!< 查询城市,可选值:cityname(中文或中文全拼)、citycode、adcode.
110 | @property (nonatomic, copy) NSString *types; //!< 类型,多个类型用“|”分割 可选值:文本分类、分类代码
111 | @property (nonatomic, assign) BOOL cityLimit; //!< 强制城市限制功能,例如:在上海搜索天安门,如果citylimit为true,将不返回北京的天安门相关的POI
112 |
113 | @end
114 |
115 | /// 搜索提示返回
116 | @interface AMapInputTipsSearchResponse : AMapSearchObject
117 |
118 | @property (nonatomic, assign) NSInteger count; //!< 返回数目
119 | @property (nonatomic, strong) NSArray *tips; //!< 提示列表 AMapTip 数组
120 |
121 | @end
122 |
123 | #pragma mark - AMapGeocodeSearchRequest
124 |
125 | /// 地理编码请求
126 | @interface AMapGeocodeSearchRequest : AMapSearchObject
127 |
128 | @property (nonatomic, copy) NSString *address; //!< 地址
129 | @property (nonatomic, copy) NSString *city; //!< 查询城市,可选值:cityname(中文或中文全拼)、citycode、adcode.
130 |
131 | @end
132 |
133 | /// 地理编码请求
134 | @interface AMapGeocodeSearchResponse : AMapSearchObject
135 |
136 | @property (nonatomic, assign) NSInteger count; //!< 返回数目
137 | @property (nonatomic, strong) NSArray *geocodes; //!< 地理编码结果 AMapGeocode 数组
138 |
139 | @end
140 |
141 |
142 | #pragma mark - AMapReGeocodeSearchRequest
143 |
144 | /// 逆地理编码请求
145 | @interface AMapReGeocodeSearchRequest : AMapSearchObject
146 |
147 | @property (nonatomic, assign) BOOL requireExtension; //!< 是否返回扩展信息,默认NO。
148 | @property (nonatomic, copy) AMapGeoPoint *location; //!< 中心点坐标。
149 | @property (nonatomic, assign) NSInteger radius; //!< 查询半径,单位米,范围0~3000,默认1000。
150 |
151 | @end
152 |
153 | /// 逆地理编码返回
154 | @interface AMapReGeocodeSearchResponse : AMapSearchObject
155 |
156 | @property (nonatomic, strong) AMapReGeocode *regeocode; //!< 逆地理编码结果
157 |
158 | @end
159 |
160 | #pragma mark - AMapBusStopSearchRequest
161 |
162 | /// 公交站点请求
163 | @interface AMapBusStopSearchRequest : AMapSearchObject
164 |
165 | @property (nonatomic, copy) NSString *keywords; //!< 查询关键字
166 | @property (nonatomic, copy) NSString *city; //!< 城市 可选值:cityname(中文或中文全拼)、citycode、adcode
167 | @property (nonatomic, assign) NSInteger offset; //!< 每页记录数,默认为20,取值为:1-50
168 | @property (nonatomic, assign) NSInteger page; //!< 当前页数,默认值为1,取值为:1-100
169 |
170 | @end
171 |
172 | /// 公交站点返回
173 | @interface AMapBusStopSearchResponse : AMapSearchObject
174 |
175 | @property (nonatomic, assign) NSInteger count; //!< 公交站数目
176 | @property (nonatomic, strong) AMapSuggestion *suggestion; //!< 关键字建议列表和城市建议列表
177 | @property (nonatomic, strong) NSArray *busstops; //!< 公交站点数组,数组中存放AMapBusStop对象
178 |
179 | @end
180 |
181 | #pragma mark - AMapBusLineSearchRequest
182 |
183 | /// 公交线路查询请求基类,不可直接调用
184 | @interface AMapBusLineBaseSearchRequest : AMapSearchObject
185 |
186 | @property (nonatomic, copy) NSString *city; //!< 城市 可选值:cityname(中文或中文全拼)、citycode、adcode
187 | @property (nonatomic, assign) BOOL requireExtension; //!< 是否返回扩展信息,默认为NO
188 | @property (nonatomic, assign) NSInteger offset; //!< 每页记录数,默认为20,取值为1-50
189 | @property (nonatomic, assign) NSInteger page; //!< 当前页数,默认为1,取值为1-100
190 |
191 | @end
192 |
193 | /// 公交站线路根据名字请求
194 | @interface AMapBusLineNameSearchRequest : AMapBusLineBaseSearchRequest
195 |
196 | @property (nonatomic, copy) NSString *keywords; //!< 查询关键字
197 |
198 | @end
199 |
200 | /// 公交站线路根据ID请求
201 | @interface AMapBusLineIDSearchRequest : AMapBusLineBaseSearchRequest
202 |
203 | @property (nonatomic, copy) NSString *uid;
204 |
205 | @end
206 |
207 | /// 公交站线路返回
208 | @interface AMapBusLineSearchResponse : AMapSearchObject
209 |
210 | @property (nonatomic, assign) NSInteger count; //!< 返回公交站数目
211 | @property (nonatomic, strong) AMapSuggestion *suggestion; //!< 关键字建议列表和城市建议列表
212 | @property (nonatomic, strong) NSArray *buslines; //!< 公交线路数组,数组中存放 AMapBusLine 对象
213 |
214 | @end
215 |
216 | #pragma mark - AMapDistrictSearchRequest
217 |
218 | @interface AMapDistrictSearchRequest : AMapSearchObject
219 |
220 | @property (nonatomic, copy) NSString *keywords; //!< 查询关键字,只支持单关键字搜索,全国范围
221 | @property (nonatomic, assign) BOOL requireExtension; //!< 是否返回边界坐标,默认NO
222 | @property (nonatomic, assign) BOOL showBusinessArea; //!< 是否显示商圈信息,默认NO。
223 |
224 | @end
225 |
226 | @interface AMapDistrictSearchResponse : AMapSearchObject
227 |
228 | @property (nonatomic, assign) NSInteger count; //!< 返回数目
229 | @property (nonatomic, strong) NSArray *districts; //!< 行政区域 AMapDistrict 数组
230 |
231 | @end
232 |
233 | #pragma mark - AMapRouteSearchBaseRequest
234 |
235 | /// 路径规划基础类,不可直接调用
236 | @interface AMapRouteSearchBaseRequest : AMapSearchObject
237 |
238 | @property (nonatomic, copy) AMapGeoPoint *origin; //!< 出发点
239 | @property (nonatomic, copy) AMapGeoPoint *destination; //!< 目的地
240 |
241 | @end
242 |
243 | #pragma mark - AMapDrivingRouteSearchRequest
244 |
245 | /// 驾车路径规划
246 | @interface AMapDrivingRouteSearchRequest : AMapRouteSearchBaseRequest
247 |
248 | @property (nonatomic, assign) NSInteger strategy; //!< 驾车导航策略([default = 0]) 0-速度优先(时间);1-费用优先(不走收费路段的最快道路);2-距离优先;3-不走快速路;4-结合实时交通(躲避拥堵);5-多策略(同时使用速度优先、费用优先、距离优先三个策略);6-不走高速;7-不走高速且避免收费;8-躲避收费和拥堵;9-不走高速且躲避收费和拥堵
249 | @property (nonatomic, copy) NSArray *waypoints; //!< 途经点 AMapGeoPoint 数组,最多支持16个途经点
250 | @property (nonatomic, copy) NSArray *avoidpolygons; //!< 避让区域 AMapGeoPolygon 数组,最多支持100个避让区域,每个区域16个点
251 | @property (nonatomic, copy) NSString *avoidroad; //!< 避让道路名
252 |
253 | @property (nonatomic, copy) NSString *originId; //!< 出发点 POI ID
254 | @property (nonatomic, copy) NSString *destinationId; //!< 目的地 POI ID
255 |
256 | @property (nonatomic, copy) NSString *origintype; //!< 出发点POI类型编码
257 | @property (nonatomic, copy) NSString *destinationtype; //!< 目的地POI类型编码
258 |
259 | @property (nonatomic, assign) BOOL requireExtension; //!< 是否返回扩展信息,默认为 NO
260 |
261 | @end
262 |
263 | #pragma mark - AMapWalkingRouteSearchRequest
264 |
265 | /// 步行路径规划
266 | @interface AMapWalkingRouteSearchRequest : AMapRouteSearchBaseRequest
267 |
268 | @property (nonatomic, assign) NSInteger multipath; //!< 是否提供备选步行方案([default = 0])0-只提供一条步行方案; 1-提供备选步行方案(有可能无备选方案)
269 | @end
270 |
271 | #pragma mark - AMapTransitRouteSearchRequest
272 |
273 | /// 公交路径规划
274 | @interface AMapTransitRouteSearchRequest : AMapRouteSearchBaseRequest
275 |
276 | @property (nonatomic, assign) NSInteger strategy; //!< 公交换乘策略([default = 0])0-最快捷模式;1-最经济模式;2-最少换乘模式;3-最少步行模式;4-最舒适模式;5-不乘地铁模式
277 |
278 | @property (nonatomic, copy) NSString *city; //!< 城市, 必填
279 | @property (nonatomic, copy) NSString *destinationCity; //!< 目的城市, 跨城时需要填写,否则会出错
280 |
281 | @property (nonatomic, assign) BOOL nightflag; //!< 是否包含夜班车,默认为 NO
282 | @property (nonatomic, assign) BOOL requireExtension; //!< 是否返回扩展信息,默认为 NO
283 |
284 | @end
285 |
286 | #pragma mark - AMapRidingRouteSearchRequest
287 |
288 | /// 骑行路径规划
289 | @interface AMapRidingRouteSearchRequest : AMapRouteSearchBaseRequest
290 |
291 | @property (nonatomic, assign) NSInteger type; //!< 路径方案类型([default = 0])0-推荐路线及最快路线综合, 1-推荐路线, 2-最快路线
292 | @end
293 |
294 | #pragma mark - AMapRouteSearchResponse
295 |
296 | /// 路径规划返回
297 | @interface AMapRouteSearchResponse : AMapSearchObject
298 |
299 | @property (nonatomic, assign) NSInteger count; //!< 路径规划信息数目
300 | @property (nonatomic, strong) AMapRoute *route; //!< 路径规划信息
301 |
302 | @end
303 |
304 | #pragma mark - AMapWeatherSearchWeather
305 |
306 | /// 天气查询类型
307 | typedef NS_ENUM(NSInteger, AMapWeatherType)
308 | {
309 | AMapWeatherTypeLive = 1, //!< 实时
310 | AMapWeatherTypeForecast //!< 预报
311 | };
312 |
313 | /// 天气查询请求
314 | @interface AMapWeatherSearchRequest : AMapSearchObject
315 |
316 | @property (nonatomic, copy) NSString *city; //!< 城市名称,支持cityname及adcode
317 | @property (nonatomic, assign) AMapWeatherType type; //!< 气象类型,Live为实时天气,Forecast为后三天预报天气,默认为Live
318 |
319 | @end
320 |
321 | /// 天气查询返回
322 | @interface AMapWeatherSearchResponse : AMapSearchObject
323 |
324 | @property (nonatomic, strong) NSArray *lives; //!< 实时天气数据信息 AMapLocalWeatherLive 数组,仅在请求实时天气时有返回。
325 |
326 | @property (nonatomic, strong) NSArray *forecasts; //!< 预报天气数据信息 AMapLocalWeatherForecast 数组,仅在请求预报天气时有返回。
327 |
328 | @end
329 |
330 | #pragma mark - AMapNearbySearchRequest
331 |
332 | /// 附近搜索距离类型
333 | typedef NS_ENUM(NSInteger, AMapNearbySearchType)
334 | {
335 | AMapNearbySearchTypeLiner = 0, //!< 直线距离
336 | AMapNearbySearchTypeDriving = 1, //!< 驾车行驶距离
337 | };
338 |
339 | /// 附近搜索请求
340 | @interface AMapNearbySearchRequest : AMapSearchObject
341 |
342 | @property (nonatomic, copy) AMapGeoPoint *center; //!< 中心点坐标
343 | @property (nonatomic, assign) NSInteger radius; //!< 查询半径,范围:[0, 10000],单位:米 [default = 1000]
344 | @property (nonatomic, assign) AMapNearbySearchType searchType; //!< 搜索距离类型,默认为直线距离
345 | @property (nonatomic, assign) NSInteger timeRange; //!< 检索时间范围,超过24小时的数据无法返回,范围[5, 24*60*60] 单位:秒 [default = 1800]
346 | @property (nonatomic, assign) NSInteger limit; //!< 返回条数,范围[1, 100], 默认30
347 |
348 | @end
349 |
350 | /// 附近搜索返回
351 | @interface AMapNearbySearchResponse : AMapSearchObject
352 |
353 | @property (nonatomic, assign) NSInteger count; //!< 结果总条数
354 | @property (nonatomic, strong) NSArray *infos; //!< 周边用户信息 AMapNearbyUserInfo 数组
355 |
356 | @end
357 |
358 | #pragma mark - AMapCloudSearchBaseRequest
359 |
360 | /// 云图搜索结果排序
361 | typedef NS_ENUM(NSInteger, AMapCloudSortType)
362 | {
363 | AMapCloudSortTypeDESC = 0, //!< 降序
364 | AMapCloudSortTypeASC = 1 //!< 升序
365 | };
366 |
367 | /// 云图搜索请求基类
368 | @interface AMapCloudSearchBaseRequest : AMapSearchObject
369 |
370 | /// 要查询的表格ID, 必选
371 | @property (nonatomic, copy) NSString *tableID;
372 |
373 | /**
374 | * 筛选条件数组, 可选, 对建立了排序筛选索引的字段进行筛选(系统默认为:_id,_name,_address,_updatetime,_createtime建立排序筛选索引).
375 | * 说明:
376 | * 1.支持对文本字段的精确匹配;支持对整数和小数字段的连续区间筛选;
377 | * 2.示例:数组{@"type:酒店", @"star:[3,5]"}的含义,等同于SQL语句:WHERE type = "酒店" AND star BETWEEN 3 AND 5
378 | * 注意: 所设置的过滤条件中不能含有&、#、%等URL的特殊符号。
379 | */
380 | @property (nonatomic, strong) NSArray *filter;
381 |
382 | /**
383 | * 排序字段名, 可选.
384 | * 说明:
385 | * 1.支持按建立了排序筛选索引的整数或小数字段进行排序:sortFields = @"字段名";
386 | * 2.系统预设的字段(忽略sortType):
387 | * _distance:坐标与中心点距离升序排序,仅在周边检索时有效;
388 | * _weight:权重降序排序,当存在keywords时有效;
389 | * 3.默认值:
390 | * 当keywords存在时:默认按预设字段_weight排序;
391 | * 当keywords不存在时,默认按预设字段_distance排序;
392 | * 按建立了排序筛选索引的整数或小数字段进行排序时,若不填升降序,则默认按升序排列;
393 | */
394 | @property (nonatomic, copy) NSString *sortFields;
395 |
396 | /// 可选, 排序方式(默认升序)
397 | @property (nonatomic, assign) AMapCloudSortType sortType;
398 |
399 | /// 可选, 每页记录数(每页最大记录数100, 默认20)
400 | @property (nonatomic, assign) NSInteger offset;
401 |
402 | /// 可选, 当前页数(>=1, 默认1)
403 | @property (nonatomic, assign) NSInteger page;
404 |
405 | @end
406 |
407 | #pragma mark - AMapCloudPlaceAroundSearchRequest
408 |
409 | /// 云图周边搜请求
410 | @interface AMapCloudPOIAroundSearchRequest : AMapCloudSearchBaseRequest
411 |
412 | /// 必填,中心点坐标。
413 | @property (nonatomic, copy) AMapGeoPoint *center; //!< 必填, 中心点坐标
414 |
415 | /// 可选,查询半径(默认值为3000),单位:米。
416 | @property (nonatomic, assign) NSInteger radius; //!< 可选, 查询半径(单位:米;默认:3000)
417 |
418 | /**
419 | * 可选,搜索关键词。
420 | * 说明:
421 | * 1. 请先在云图数据管理台添加或删除文本索引字段,系统默认为 _name 和 _address 建立文本索引;
422 | * 2.支持关键字模糊检索,即对建立【文本索引字段】对应列内容进行模糊检索;如 keywords = @"工商银行",检索返回已建立文本索引列值中包含“工商”或者“银行”或者“工商银行”关键字的POI结果集。
423 | * 3. 支持关键字“或”精准检索,即对建立【文本索引字段】对应列内容进行多关键字检索;如 keywords = @"招商银行|华夏银行|工商银行",检索返回已建立索引列值中包含“招商银行”或者“华夏银行”或者“工商银行”的POI结果集,不会返回检索词切分后,如仅包含“招商”或者“银行”的POI集。
424 | * 4. 可赋值为空值,即 keywords = @" " 表示空值;
425 | * 5. 若 city = @"城市名",keywords = @" " 或者 keywords = @"关键字",返回对应城市的全部数据或对应关键字的数据;
426 | * 6. 一次请求最多返回2000条数据。
427 | * 注意: 所设置的keywords中不能含有&、#、%等URL的特殊符号。
428 | */
429 | @property (nonatomic, copy) NSString *keywords;
430 |
431 | @end
432 |
433 | /// 云图polygon区域查询请求
434 | @interface AMapCloudPOIPolygonSearchRequest : AMapCloudSearchBaseRequest
435 |
436 | /// 必填,多边形。
437 | @property (nonatomic, copy) AMapGeoPolygon *polygon; //!< 必填,多边形
438 |
439 | /**
440 | * 可选,搜索关键词。
441 | * 说明:
442 | * 1. 请先在云图数据管理台添加或删除文本索引字段,系统默认为 _name 和 _address 建立文本索引;
443 | * 2.支持关键字模糊检索,即对建立【文本索引字段】对应列内容进行模糊检索;如 keywords = @"工商银行",检索返回已建立文本索引列值中包含“工商”或者“银行”或者“工商银行”关键字的POI结果集。
444 | * 3. 支持关键字“或”精准检索,即对建立【文本索引字段】对应列内容进行多关键字检索;如 keywords = @"招商银行|华夏银行|工商银行",检索返回已建立索引列值中包含“招商银行”或者“华夏银行”或者“工商银行”的POI结果集,不会返回检索词切分后,如仅包含“招商”或者“银行”的POI集。
445 | * 4. 可赋值为空值,即 keywords = @" " 表示空值;
446 | * 5. 若 city = @"城市名",keywords = @" " 或者 keywords = @"关键字",返回对应城市的全部数据或对应关键字的数据;
447 | * 6. 一次请求最多返回2000条数据。
448 | * 注意: 所设置的keywords中不能含有&、#、%等URL的特殊符号。
449 | */
450 | @property (nonatomic, copy) NSString *keywords;
451 |
452 | @end
453 |
454 | /// 云图ID查询请求
455 | @interface AMapCloudPOIIDSearchRequest : AMapCloudSearchBaseRequest
456 |
457 | @property (nonatomic, assign) NSInteger uid; //!< 必填,POI的ID
458 |
459 | @end
460 |
461 | /// 云图本地查询请求
462 | @interface AMapCloudPOILocalSearchRequest : AMapCloudSearchBaseRequest
463 |
464 | /**
465 | * 必填,搜索关键词。
466 | * 说明:
467 | * 1. 请先在云图数据管理台添加或删除文本索引字段,系统默认为 _name 和 _address 建立文本索引;
468 | * 2.支持关键字模糊检索,即对建立【文本索引字段】对应列内容进行模糊检索;如 keywords = @"工商银行",检索返回已建立文本索引列值中包含“工商”或者“银行”或者“工商银行”关键字的POI结果集。
469 | * 3. 支持关键字“或”精准检索,即对建立【文本索引字段】对应列内容进行多关键字检索;如 keywords = @"招商银行|华夏银行|工商银行",检索返回已建立索引列值中包含“招商银行”或者“华夏银行”或者“工商银行”的POI结果集,不会返回检索词切分后,如仅包含“招商”或者“银行”的POI集。
470 | * 4. 可赋值为空值,即 keywords = @" " 表示空值;
471 | * 5. 若 city = @"城市名",keywords = @" " 或者 keywords = @"关键字",返回对应城市的全部数据或对应关键字的数据;
472 | * 6. 一次请求最多返回2000条数据。
473 | * 注意: 所设置的keywords中不能含有&、#、%等URL的特殊符号。
474 | */
475 | @property (nonatomic, copy) NSString *keywords;
476 |
477 | /// 必填,城市名称 说明:1. 支持全国/省/市/区县行政区划范围的检索;2. city = @"全国",即对用户全表搜索;3. 当city值设置非法或不正确时,按照 city = @"全国"返回。
478 | @property (nonatomic, copy) NSString *city; //!< 必填,POI所在城市
479 |
480 | @end
481 |
482 | #pragma mark - AMapCloudPOISearchResponse
483 |
484 | /// 云图搜索返回
485 | @interface AMapCloudPOISearchResponse : AMapSearchObject
486 |
487 | @property (nonatomic, assign) NSInteger count; //!< 返回结果总数目
488 | @property (nonatomic, strong) NSArray *POIs; //!< 返回的结果, AMapCloudPOI 数组
489 |
490 | @end
491 |
492 | #pragma mark - AMapShareSearchBaseRequest
493 |
494 | /// 短串分享搜索请求基类, 请使用具体的子类。
495 | @interface AMapShareSearchBaseRequest : AMapSearchObject
496 |
497 | @end
498 |
499 | /// 位置短串分享请求
500 | @interface AMapLocationShareSearchRequest : AMapShareSearchBaseRequest
501 |
502 | @property (nonatomic, copy) AMapGeoPoint *location; //!< 必填, 位置坐标
503 | @property (nonatomic, copy) NSString *name; //!< 位置名称,请不要包含【,%&@#】等特殊符号。
504 |
505 | @end
506 |
507 | /// 兴趣点短串分享请求
508 | @interface AMapPOIShareSearchRequest : AMapShareSearchBaseRequest
509 |
510 | @property (nonatomic, copy) NSString *uid; //!< POI的ID,如果有ID则指定POI,否则按name查询。
511 | @property (nonatomic, copy) AMapGeoPoint *location; //!< 坐标
512 | @property (nonatomic, copy) NSString *name; //!< 名称,请不要包含【,%&@#】等特殊符号。
513 | @property (nonatomic, copy) NSString *address; //!< 地址,请不要包含【,%&@#】等特殊符号。
514 |
515 | @end
516 |
517 | /// 路径规划短串分享请求
518 | @interface AMapRouteShareSearchRequest : AMapShareSearchBaseRequest
519 |
520 | /// 驾车:0-速度最快(时间); 1-避免收费(不走收费路段的最快道路); 2-距离优先; 3-不走高速; 4-结合实时交通(躲避拥堵); 5-不走高速且避免收费; 6-不走高速且躲避拥堵; 7-躲避收费和拥堵; 8-不走高速且躲避收费和拥堵
521 | /// 公交:0-最快捷; 1-最经济; 2-最少换乘; 3-最少步行; 4-最舒适; 5-不乘地铁;
522 | /// 步行,无策略,均一样
523 | @property (nonatomic, assign) NSInteger strategy; //!< 默认为0
524 | @property (nonatomic, assign) NSInteger type; //!< Route的type,0为驾车,1为公交,2为步行,默认为0,超出范围为0。
525 | @property (nonatomic, copy) AMapGeoPoint *startCoordinate; //!< 起点坐标
526 | @property (nonatomic, copy) AMapGeoPoint *destinationCoordinate; //!< 终点坐标
527 | @property (nonatomic, copy) NSString *startName; //!< 起点名称,默认为“已选择的位置”,请不要包含【,%&@#】等特殊符号
528 | @property (nonatomic, copy) NSString *destinationName; //!< 终点名称,默认为“已选择的位置”,请不要包含【,%&@#】等特殊符号
529 |
530 | @end
531 |
532 | /// 导航短串分享请求
533 | @interface AMapNavigationShareSearchRequest : AMapShareSearchBaseRequest
534 |
535 | /// 驾车:0-速度最快(时间); 1-避免收费(不走收费路段的最快道路); 2-距离优先; 3-不走高速; 4-结合实时交通(躲避拥堵); 5-不走高速且避免收费; 6-不走高速且躲避拥堵; 7-躲避收费和拥堵; 8-不走高速且躲避收费和拥堵
536 | @property (nonatomic, assign) NSInteger strategy; //!< 默认为0,超出范围为0
537 |
538 | @property (nonatomic, copy) AMapGeoPoint *startCoordinate; //!< 起点坐标,若跳转到高德地图,默认更换为定位坐标
539 | @property (nonatomic, copy) AMapGeoPoint *destinationCoordinate; //!< 终点坐标
540 |
541 | @end
542 |
543 | @interface AMapShareSearchResponse : AMapSearchObject
544 |
545 | @property (nonatomic, copy) NSString *shareURL; //!< 转换后的短串
546 |
547 | @end
548 |
--------------------------------------------------------------------------------
/ios/frameworks/MAMapKit.framework/Headers/MAMapView.h:
--------------------------------------------------------------------------------
1 | //
2 | // MAMapView.h
3 | // MAMapKit
4 | //
5 | // Created by AutoNavi.
6 | // Copyright (c) 2013年 AutoNavi. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "MAGeometry.h"
11 | #import "MAOverlay.h"
12 | #import "MAOverlayRenderer.h"
13 | #import "MAAnnotationView.h"
14 | #import "MAOverlayView.h"
15 |
16 | typedef NS_ENUM(NSInteger, MAMapLanguage)
17 | {
18 | MAMapLanguageZhCN = 0,
19 | MAMapLanguageEn = 1,
20 | };
21 |
22 | typedef NS_ENUM(NSInteger, MAMapType)
23 | {
24 | MAMapTypeStandard, // 普通地图
25 | MAMapTypeSatellite // 卫星地图
26 | };
27 |
28 | typedef NS_ENUM(NSInteger, MAUserTrackingMode)
29 | {
30 | MAUserTrackingModeNone = 0, // 不追踪用户的location更新
31 | MAUserTrackingModeFollow = 1, // 追踪用户的location更新
32 | MAUserTrackingModeFollowWithHeading = 2 // 追踪用户的location与heading更新
33 | };
34 |
35 | @protocol MAMapViewDelegate;
36 |
37 | @class MAUserLocation;
38 | @class MAAnnotationView;
39 | @class MAUserLocationRepresentation;
40 |
41 | @interface MAMapView : UIView
42 |
43 | #pragma mark - Properties
44 |
45 | /*!
46 | @brief 地图View的Delegate
47 | */
48 | @property (nonatomic, weak) id delegate;
49 |
50 | /*!
51 | @brief 地图类型
52 | */
53 | @property (nonatomic, assign) MAMapType mapType;
54 |
55 | /*!
56 | @brief 地图语言
57 | */
58 | @property (nonatomic, assign) MAMapLanguage language;
59 |
60 | /*!
61 | @brief 是否显示交通,默认为NO
62 | */
63 | @property (nonatomic, assign, getter = isShowTraffic) BOOL showTraffic;
64 |
65 | /*!
66 | @brief 是否支持平移,默认为YES
67 | */
68 | @property (nonatomic, assign, getter = isScrollEnabled) BOOL scrollEnabled;
69 |
70 | /*!
71 | @brief 是否支持缩放,默认为YES
72 | */
73 | @property (nonatomic, assign, getter = isZoomEnabled) BOOL zoomEnabled;
74 |
75 | /**
76 | * 标识当前地图中心位置是否在中国范围外。此属性不是精确判断,不能用于边界区域。
77 | */
78 | @property (nonatomic, readonly) BOOL isAbroad;
79 |
80 | /**
81 | * 是否允许对annotationView根据zIndex进行排序,默认为YES。
82 | * 当annotationView数量比较大时可能会引起性能问题,可以设置此属性为NO。
83 | */
84 | @property (nonatomic, assign) BOOL allowsAnnotationViewSorting;
85 |
86 | #pragma mark - Logo
87 |
88 | /*!
89 | @brief logo位置, 必须在mapView.bounds之内,否则会被忽略
90 | */
91 | @property (nonatomic) CGPoint logoCenter;
92 |
93 | /*!
94 | @brief logo的宽高
95 | */
96 | @property (nonatomic, readonly) CGSize logoSize;
97 |
98 | #pragma mark - Compass
99 |
100 | /*!
101 | @brief 是否显示罗盘,默认为YES
102 | */
103 | @property (nonatomic, assign) BOOL showsCompass;
104 |
105 | /*!
106 | @brief 罗盘原点位置
107 | */
108 | @property (nonatomic) CGPoint compassOrigin;
109 |
110 | /*!
111 | @brief 罗盘的宽高
112 | */
113 | @property (nonatomic, readonly) CGSize compassSize;
114 |
115 | /**
116 | * 设置罗盘的图像
117 | *
118 | * @param image 当设置图像非空时,指南针将呈现该图像,如果为nil时,则恢复默认。
119 | */
120 | - (void)setCompassImage:(UIImage *)image;
121 |
122 | #pragma mark - Scale
123 |
124 | /*!
125 | @brief 是否显示比例尺,默认为YES
126 | */
127 | @property (nonatomic) BOOL showsScale;
128 |
129 | /*!
130 | @brief 比例尺原点位置
131 | */
132 | @property (nonatomic) CGPoint scaleOrigin;
133 |
134 | /*!
135 | @brief 比例尺的最大宽高
136 | */
137 | @property (nonatomic, readonly) CGSize scaleSize;
138 |
139 |
140 | /*!
141 | @brief 在当前缩放级别下, 基于地图中心点, 1 screen point 对应的距离(单位是米). 支持KVO。
142 | @return 对应的距离(单位是米)
143 | */
144 | @property (nonatomic, readonly) CGFloat metersPerPointForCurrentZoomLevel;
145 |
146 | /*!
147 | @brief 在指定的缩放级别下, 基于地图中心点, 1 screen point 对应的距离(单位是米).
148 | @param zoomLevel 指定的缩放级别, 在[minZoomLevel, maxZoomLevel]范围内.
149 | @return 对应的距离(单位是米)
150 | */
151 | - (CGFloat)metersPerPointForZoomLevel:(CGFloat)zoomLevel;
152 |
153 | #pragma mark - Movement
154 |
155 | /*!
156 | @brief 当前地图的中心点经纬度坐标,改变该值时,地图缩放级别不会发生变化
157 | */
158 | @property (nonatomic, assign) CLLocationCoordinate2D centerCoordinate;
159 |
160 | /*!
161 | @brief 设定地图中心点经纬度
162 | @param centerCoordinate 要设定的地图中心点经纬度
163 | @param animated 是否采用动画效果
164 | */
165 | - (void)setCenterCoordinate:(CLLocationCoordinate2D)centerCoordinate animated:(BOOL)animated;
166 |
167 | /*!
168 | @brief 当前地图的经纬度范围,设定的该范围可能会被调整为适合地图窗口显示的范围
169 | */
170 | @property (nonatomic, assign) MACoordinateRegion region;
171 |
172 | /*!
173 | @brief 设定当前地图的region
174 | @param region 要设定的地图范围,用经纬度的方式表示
175 | @param animated 是否采用动画效果
176 | */
177 | - (void)setRegion:(MACoordinateRegion)region animated:(BOOL)animated;
178 |
179 | /*!
180 | @brief 根据当前地图视图frame的大小调整region范围,返回适合当前地图frame的region,调整过程中当前地图的中心点不会改变
181 | @param region 要调整的经纬度范围
182 | @return 调整后的经纬度范围
183 | */
184 | - (MACoordinateRegion)regionThatFits:(MACoordinateRegion)region;
185 |
186 | /*!
187 | @brief 当前地图可见范围的map rect
188 | */
189 | @property (nonatomic, assign) MAMapRect visibleMapRect;
190 |
191 | /*!
192 | @brief 设置当前地图可见范围的map rect
193 | @param mapRect 要调整的map rect
194 | @param animated 是否采用动画效果
195 | */
196 | - (void)setVisibleMapRect:(MAMapRect)mapRect animated:(BOOL)animated;
197 |
198 | /*!
199 | @brief 设置当前地图可见范围的map rect
200 | @param mapRect 要设置的map rect
201 | @param insets 嵌入边界
202 | @param animated 是否采用动画效果
203 | */
204 | - (void)setVisibleMapRect:(MAMapRect)mapRect edgePadding:(UIEdgeInsets)insets animated:(BOOL)animated;
205 |
206 | /*!
207 | @brief 调整map rect使其适合地图窗口显示的范围
208 | @param mapRect 要调整的map rect
209 | @return 调整后的maprect
210 | */
211 | - (MAMapRect)mapRectThatFits:(MAMapRect)mapRect;
212 |
213 | /*!
214 | @brief 调整map rect使其适合地图窗口显示的范围
215 | @param mapRect 要调整的map rect
216 | @param insets 嵌入边界
217 | @return 调整后的map rect
218 | */
219 | - (MAMapRect)mapRectThatFits:(MAMapRect)mapRect edgePadding:(UIEdgeInsets)insets;
220 |
221 | #pragma mark - Limitation
222 |
223 | /*!
224 | @brief 设置可见地图区域的矩形边界,如限制地图只显示北京市范围
225 | */
226 | @property (nonatomic, assign) MACoordinateRegion limitRegion;
227 |
228 | /*!
229 | @brief 设置可见地图区域的矩形边界,如限制地图只显示北京市范围
230 | */
231 | @property (nonatomic, assign) MAMapRect limitMapRect;
232 |
233 | #pragma mark - Zoom
234 |
235 | /*!
236 | @brief 缩放级别, [3, 20]
237 | */
238 | @property (nonatomic, assign) double zoomLevel;
239 |
240 | /*!
241 | @brief 最小缩放级别, 最小值为3
242 | */
243 | @property (nonatomic, assign) double minZoomLevel;
244 |
245 | /*!
246 | @brief 最大缩放级别,最大值为20
247 | */
248 | @property (nonatomic, assign) double maxZoomLevel;
249 |
250 | /*!
251 | @brief 设置当前地图的缩放级别zoom level
252 | @param newZoomLevel 要设置的zoom level
253 | @param animated 是否采用动画效果
254 | */
255 | - (void)setZoomLevel:(double)newZoomLevel animated:(BOOL)animated;
256 |
257 | /*!
258 | @brief 设置当前地图的缩放级别zoom level
259 | @param newZoomLevel 要设置的zoom level
260 | @param pivot 指定缩放的锚点,屏幕坐标
261 | @param animated 是否采用动画效果
262 | */
263 | - (void)setZoomLevel:(double)newZoomLevel atPivot:(CGPoint)pivot animated:(BOOL)animated;
264 |
265 |
266 | #pragma mark - Conversions
267 |
268 | /*!
269 | @brief 将经纬度坐标转化为相对于指定view的坐标
270 | @param coordinate 要转化的经纬度坐标
271 | @param view 指定的坐标系统的view
272 | */
273 | - (CGPoint)convertCoordinate:(CLLocationCoordinate2D)coordinate toPointToView:(UIView *)view;
274 |
275 | /*!
276 | @brief 将相对于view的坐标转化为经纬度坐标
277 | @param point 要转化的坐标
278 | @param view point所基于的view
279 | return 转化后的经纬度坐标
280 | */
281 | - (CLLocationCoordinate2D)convertPoint:(CGPoint)point toCoordinateFromView:(UIView *)view;
282 |
283 | /*!
284 | @brief 将map rect 转化为相对于view的坐标
285 | @param region 要转化的 map rect
286 | @param view 返回值所基于的view
287 | return 基于view的坐标
288 | */
289 | - (CGRect)convertRegion:(MACoordinateRegion)region toRectToView:(UIView *)view;
290 |
291 | /*!
292 | @brief 将相对于view的rectangle转化为region
293 | @param rect 要转化的rectangle
294 | @param view rectangle所基于的view
295 | return 转化后的region
296 | */
297 | - (MACoordinateRegion)convertRect:(CGRect)rect toRegionFromView:(UIView *)view;
298 |
299 | #pragma mark - UserLocation
300 |
301 | /*!
302 | @brief 是否显示用户位置
303 | */
304 | @property (nonatomic, assign, getter = isShowsUserLocation) BOOL showsUserLocation;
305 |
306 | /*!
307 | @brief 当前的位置数据
308 | */
309 | @property (nonatomic, readonly) MAUserLocation *userLocation;
310 |
311 | /*!
312 | @brief 定位用户位置的模式
313 | */
314 | @property (nonatomic) MAUserTrackingMode userTrackingMode;
315 |
316 | /*!
317 | @brief 设置追踪用户位置的模式
318 | @param mode 要使用的模式
319 | @param animated 是否采用动画效果
320 | */
321 | - (void)setUserTrackingMode:(MAUserTrackingMode)mode animated:(BOOL)animated;
322 |
323 | /*!
324 | @brief 当前位置再地图中是否可见
325 | */
326 | @property (nonatomic, readonly, getter=isUserLocationVisible) BOOL userLocationVisible;
327 |
328 | /*!
329 | @brief 设定UserLocationView样式。如果用户自定义了userlocation的annotationView,或者该annotationView还未添加到地图上,此方法将不起作用。
330 | @param representation 样式信息对象
331 | */
332 | - (void)updateUserLocationRepresentation:(MAUserLocationRepresentation *)representation;
333 |
334 | #pragma mark - Annotations
335 |
336 | /*!
337 | @brief 标注数组
338 | */
339 | @property (nonatomic, readonly) NSArray *annotations;
340 |
341 | /*!
342 | @brief 向地图窗口添加标注,需要实现MAMapViewDelegate的-mapView:viewForAnnotation:函数来生成标注对应的View
343 | @param annotation 要添加的标注
344 | */
345 | - (void)addAnnotation:(id )annotation;
346 |
347 | /*!
348 | @brief 向地图窗口添加一组标注,需要实现MAMapViewDelegate的-mapView:viewForAnnotation:函数来生成标注对应的View
349 | @param annotations 要添加的标注数组
350 | */
351 | - (void)addAnnotations:(NSArray *)annotations;
352 |
353 | /*!
354 | @brief 移除标注
355 | @param annotation 要移除的标注
356 | */
357 | - (void)removeAnnotation:(id )annotation;
358 |
359 | /*!
360 | @brief 移除一组标注
361 | @param annotations 要移除的标注数组
362 | */
363 | - (void)removeAnnotations:(NSArray *)annotations;
364 |
365 | /*!
366 | @brief 根据标注数据过去标注view
367 | @param annotation 标注数据
368 | @return 对应的标注view
369 | */
370 | - (MAAnnotationView *)viewForAnnotation:(id )annotation;
371 |
372 | /*!
373 | @brief 从复用内存池中获取制定复用标识的annotation view
374 | @param identifier 复用标识
375 | @return annotation view
376 | */
377 | - (MAAnnotationView *)dequeueReusableAnnotationViewWithIdentifier:(NSString *)identifier;
378 |
379 | /*!
380 | @brief 处于选中状态的标注数据数据(其count == 0 或 1)
381 | */
382 | @property (nonatomic, copy) NSArray *selectedAnnotations;
383 |
384 | /*!
385 | @brief 选中标注数据对应的view
386 | @param annotation 标注数据
387 | @param animated 是否有动画效果
388 | */
389 | - (void)selectAnnotation:(id )annotation animated:(BOOL)animated;
390 |
391 | /*!
392 | @brief 取消选中标注数据对应的view
393 | @param annotation 标注数据
394 | @param animated 是否有动画效果
395 | */
396 | - (void)deselectAnnotation:(id )annotation animated:(BOOL)animated;
397 |
398 | /*!
399 | @brief annotation 可见区域
400 | */
401 | @property (nonatomic, readonly) CGRect annotationVisibleRect;
402 |
403 | /*!
404 | @brief 获取指定投影矩形范围内的标注
405 | @param mapRect 投影矩形范围
406 | @return 标注集合
407 | */
408 | - (NSSet *)annotationsInMapRect:(MAMapRect)mapRect;
409 |
410 | /*!
411 | 设置地图使其可以显示数组中所有的annotation, 如果数组中只有一个则直接设置地图中心为annotation的位置。
412 | @param annotations 需要显示的annotation
413 | @param animated 是否执行动画
414 | */
415 | - (void)showAnnotations:(NSArray *)annotations animated:(BOOL)animated;
416 |
417 | /**
418 | * 设置地图使其可以显示数组中所有的annotation, 如果数组中只有一个则直接设置地图中心为annotation的位置。
419 | *
420 | * @param annotations 需要显示的annotation
421 | * @param insets insets 嵌入边界
422 | * @param animated 是否执行动画
423 | */
424 | - (void)showAnnotations:(NSArray *)annotations edgePadding:(UIEdgeInsets)insets animated:(BOOL)animated;
425 |
426 | #pragma mark - Overlays
427 |
428 | /*!
429 | @brief Overlay数组
430 | */
431 | @property (nonatomic, readonly) NSArray *overlays;
432 |
433 | /*!
434 | @brief 查找指定overlay对应的Renderer,如果该Renderer尚未创建,返回nil
435 | @param overlay 指定的overlay
436 | @return 指定overlay对应的Renderer
437 | */
438 | - (MAOverlayRenderer *)rendererForOverlay:(id )overlay;
439 |
440 | /*!
441 | @brief 查找指定overlay对应的View,如果该View尚未创建,返回nil
442 | @param overlay 指定的overlay
443 | @return 指定overlay对应的View
444 | */
445 | - (MAOverlayView *)viewForOverlay:(id )overlay __attribute__ ((deprecated("use - (MAOverlayRenderer *)rendererForOverlay:(id )overlay instead")));
446 |
447 | /*!
448 | @brief 向地图添加Overlay,需要实现MAMapViewDelegate的-mapView:rendererForOverlay:函数来生成标注对应的Renderer
449 | @param overlay 要添加的overlay
450 | */
451 | - (void)addOverlay:(id )overlay;
452 |
453 | /*!
454 | @brief 向地图添加一组Overlay,需要实现MAMapViewDelegate的-mapView:rendererForOverlay:函数来生成标注对应的Renderer
455 | @param overlays 要添加的overlay数组
456 | */
457 | - (void)addOverlays:(NSArray *)overlays;
458 |
459 | /*!
460 | @brief 移除Overlay
461 | @param overlay 要移除的overlay
462 | */
463 | - (void)removeOverlay:(id )overlay;
464 |
465 | /*!
466 | @brief 移除一组Overlay
467 | @param overlays 要移除的overlay数组
468 | */
469 | - (void)removeOverlays:(NSArray *)overlays;
470 |
471 | /*!
472 | @brief 在指定的索引处添加一个Overlay
473 | @param overlay 要添加的overlay
474 | @param index 指定的索引
475 | */
476 | - (void)insertOverlay:(id )overlay atIndex:(NSUInteger)index;
477 |
478 | /*!
479 | @brief 在交换指定索引处的Overlay
480 | @param index1 索引1
481 | @param index2 索引2
482 | */
483 | - (void)exchangeOverlayAtIndex:(NSUInteger)index1 withOverlayAtIndex:(NSUInteger)index2;
484 |
485 | /*!
486 | @brief 在指定的Overlay之上插入一个overlay
487 | @param overlay 带添加的Overlay
488 | @param sibling 用于指定相对位置的Overlay
489 | */
490 | - (void)insertOverlay:(id )overlay aboveOverlay:(id )sibling;
491 |
492 | /*!
493 | @brief 在指定的Overlay之下插入一个overlay
494 | @param overlay 带添加的Overlay
495 | @param sibling 用于指定相对位置的Overlay
496 | */
497 | - (void)insertOverlay:(id )overlay belowOverlay:(id )sibling;
498 |
499 | /**
500 | 设置地图使其可以显示数组中所有的overlay
501 | * @param overlays 需要显示的overlays
502 | * @param animated 是否执行动画
503 | */
504 | - (void)showOverlays:(NSArray *)overlays animated:(BOOL)animated;
505 |
506 | /**
507 | * 设置地图使其可以显示数组中所有的overlay
508 | *
509 | * @param overlays 需要显示的overlays
510 | * @param insets insets 嵌入边界
511 | * @param animated 是否执行动画
512 | */
513 | - (void)showOverlays:(NSArray *)overlays edgePadding:(UIEdgeInsets)insets animated:(BOOL)animated;
514 |
515 | #pragma mark - Cache
516 |
517 | /*!
518 | @brief 清除所有磁盘上缓存的地图数据。
519 | */
520 | - (void)clearDisk;
521 |
522 | @end
523 |
524 | #pragma mark - Snapshots
525 |
526 | /*!
527 | @brief 地图view关于截图的类别
528 | */
529 | @interface MAMapView (Snapshot)
530 |
531 | /*!
532 | @brief 在指定区域内截图(默认会包含该区域内的annotationView)
533 | @param rect 指定的区域
534 | @return 截图image
535 | */
536 | - (UIImage *)takeSnapshotInRect:(CGRect)rect;
537 |
538 | /*!
539 | @brief 获得地图当前可视区域截图
540 | @param rect 指定截图区域
541 | @param block 回调block
542 | */
543 | - (void)takeSnapshotInRect:(CGRect)rect withCompletionBlock:(void (^)(UIImage *resultImage, CGRect rect))block;
544 |
545 | @end
546 |
547 | #pragma mark - LocationOption
548 |
549 | /*!
550 | @brief 定位相关参数的类别
551 | */
552 | @interface MAMapView (LocationOption)
553 |
554 | /*!
555 | @brief 设定定位的最小更新距离。默认为kCLDistanceFilterNone,会提示任何移动。
556 | */
557 | @property (nonatomic) CLLocationDistance distanceFilter;
558 |
559 | /*!
560 | @brief 设定定位精度。默认为kCLLocationAccuracyBest。
561 | */
562 | @property (nonatomic) CLLocationAccuracy desiredAccuracy;
563 |
564 | /*!
565 | @brief 设定最小更新角度。默认为1度,设定为kCLHeadingFilterNone会提示任何角度改变。
566 | */
567 | @property (nonatomic) CLLocationDegrees headingFilter;
568 |
569 | /**
570 | * 指定定位是否会被系统自动暂停。默认为YES。只在iOS 6.0之后起作用。
571 | */
572 | @property (nonatomic) BOOL pausesLocationUpdatesAutomatically;
573 |
574 | /**
575 | * 是否允许后台定位。默认为NO。只在iOS 9.0之后起作用。
576 | * 设置为YES的时候必须保证 Background Modes 中的 Location updates处于选中状态,否则会抛出异常。
577 | */
578 | @property (nonatomic) BOOL allowsBackgroundLocationUpdates;
579 |
580 | @end
581 |
582 | #pragma mark - MAMapViewDelegate
583 |
584 | /*!
585 | @brief 地图view的delegate
586 | */
587 | @protocol MAMapViewDelegate
588 | @optional
589 |
590 | /*!
591 | @brief 地图区域即将改变时会调用此接口
592 | @param mapView 地图View
593 | @param animated 是否动画
594 | */
595 | - (void)mapView:(MAMapView *)mapView regionWillChangeAnimated:(BOOL)animated;
596 |
597 | /*!
598 | @brief 地图区域改变完成后会调用此接口
599 | @param mapView 地图View
600 | @param animated 是否动画
601 | */
602 | - (void)mapView:(MAMapView *)mapView regionDidChangeAnimated:(BOOL)animated;
603 |
604 | /**
605 | * 地图将要发生移动时调用此接口
606 | *
607 | * @param mapView 地图view
608 | * @param wasUserAction 标识是否是用户动作
609 | */
610 | - (void)mapView:(MAMapView *)mapView mapWillMoveByUser:(BOOL)wasUserAction;
611 |
612 | /**
613 | * 地图移动结束后调用此接口
614 | *
615 | * @param mapView 地图view
616 | * @param wasUserAction 标识是否是用户动作
617 | */
618 | - (void)mapView:(MAMapView *)mapView mapDidMoveByUser:(BOOL)wasUserAction;
619 |
620 | /**
621 | * 地图将要发生缩放时调用此接口
622 | *
623 | * @param mapView 地图view
624 | * @param wasUserAction 标识是否是用户动作
625 | */
626 | - (void)mapView:(MAMapView *)mapView mapWillZoomByUser:(BOOL)wasUserAction;
627 |
628 | /**
629 | * 地图缩放结束后调用此接口
630 | *
631 | * @param mapView 地图view
632 | * @param wasUserAction 标识是否是用户动作
633 | */
634 | - (void)mapView:(MAMapView *)mapView mapDidZoomByUser:(BOOL)wasUserAction;
635 |
636 | /**
637 | * 单击地图底图调用此接口
638 | *
639 | * @param mapView 地图View
640 | * @param coordinate 点击位置经纬度
641 | */
642 | - (void)mapView:(MAMapView *)mapView didSingleTappedAtCoordinate:(CLLocationCoordinate2D)coordinate;
643 |
644 | /**
645 | * 长按地图底图调用此接口
646 | *
647 | * @param mapView 地图View
648 | * @param coordinate 长按位置经纬度
649 | */
650 | - (void)mapView:(MAMapView *)mapView didLongPressedAtCoordinate:(CLLocationCoordinate2D)coordinate;
651 |
652 | /*!
653 | @brief 根据anntation生成对应的View
654 | @param mapView 地图View
655 | @param annotation 指定的标注
656 | @return 生成的标注View
657 | */
658 | - (MAAnnotationView*)mapView:(MAMapView *)mapView viewForAnnotation:(id )annotation;
659 |
660 | /*!
661 | @brief 当mapView新添加annotation views时调用此接口
662 | @param mapView 地图View
663 | @param views 新添加的annotation views
664 | */
665 | - (void)mapView:(MAMapView *)mapView didAddAnnotationViews:(NSArray *)views;
666 |
667 | /*!
668 | @brief 当选中一个annotation views时调用此接口
669 | @param mapView 地图View
670 | @param view 选中的annotationView
671 | */
672 | - (void)mapView:(MAMapView *)mapView didSelectAnnotationView:(MAAnnotationView *)view;
673 |
674 | /*!
675 | @brief 当取消选中一个annotation views时调用此接口
676 | @param mapView 地图View
677 | @param view 取消选中的annotationView
678 | */
679 | - (void)mapView:(MAMapView *)mapView didDeselectAnnotationView:(MAAnnotationView *)view;
680 |
681 | /*!
682 | @brief 标注view的accessory view(必须继承自UIControl)被点击时调用此接口
683 | @param mapView 地图View
684 | @param view callout所属的标注view
685 | @param control 对应的control
686 | */
687 | - (void)mapView:(MAMapView *)mapView annotationView:(MAAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control;
688 |
689 | /**
690 | * 标注view的calloutview整体点击时调用此接口
691 | *
692 | * @param mapView 地图的view
693 | * @param view calloutView所属的annotationView
694 | */
695 | - (void)mapView:(MAMapView *)mapView didAnnotationViewCalloutTapped:(MAAnnotationView *)view;
696 |
697 | /*!
698 | @brief 在地图View将要启动定位时调用此接口
699 | @param mapView 地图View
700 | */
701 | - (void)mapViewWillStartLocatingUser:(MAMapView *)mapView;
702 |
703 | /*!
704 | @brief 在地图View停止定位后调用此接口
705 | @param mapView 地图View
706 | */
707 | - (void)mapViewDidStopLocatingUser:(MAMapView *)mapView;
708 |
709 | /*!
710 | @brief 位置或者设备方向更新后调用此接口
711 | @param mapView 地图View
712 | @param userLocation 用户定位信息(包括位置与设备方向等数据)
713 | @param updatingLocation 标示是否是location数据更新, YES:location数据更新 NO:heading数据更新
714 | */
715 | - (void)mapView:(MAMapView *)mapView didUpdateUserLocation:(MAUserLocation *)userLocation updatingLocation:(BOOL)updatingLocation;
716 |
717 | /*!
718 | @brief 定位失败后调用此接口
719 | @param mapView 地图View
720 | @param error 错误号,参考CLError.h中定义的错误号
721 | */
722 | - (void)mapView:(MAMapView *)mapView didFailToLocateUserWithError:(NSError *)error;
723 |
724 | /*!
725 | @brief 当userTrackingMode改变时调用此接口
726 | @param mapView 地图View
727 | @param mode 改变后的mode
728 | @param animated 动画
729 | */
730 | - (void)mapView:(MAMapView *)mapView didChangeUserTrackingMode:(MAUserTrackingMode)mode animated:(BOOL)animated;
731 |
732 | /*!
733 | @brief 拖动annotation view时view的状态变化,ios3.2以后支持
734 | @param mapView 地图View
735 | @param view annotation view
736 | @param newState 新状态
737 | @param oldState 旧状态
738 | */
739 | - (void)mapView:(MAMapView *)mapView annotationView:(MAAnnotationView *)view didChangeDragState:(MAAnnotationViewDragState)newState fromOldState:(MAAnnotationViewDragState)oldState;
740 |
741 | /*!
742 | @brief 根据overlay生成对应的Renderer
743 | @param mapView 地图View
744 | @param overlay 指定的overlay
745 | @return 生成的覆盖物Renderer
746 | */
747 | - (MAOverlayRenderer *)mapView:(MAMapView *)mapView rendererForOverlay:(id )overlay;
748 |
749 | /*!
750 | @brief 当mapView新添加overlay renderer时调用此接口
751 | @param mapView 地图View
752 | @param renderers 新添加的overlay renderers
753 | */
754 | - (void)mapView:(MAMapView *)mapView didAddOverlayRenderers:(NSArray *)renderers;
755 |
756 | #pragma mark - Deprecated
757 |
758 | - (MAOverlayView *)mapView:(MAMapView *)mapView viewForOverlay:(id )overlay __attribute__ ((deprecated("use - (MAOverlayRenderer *)mapView:(MAMapView *)mapView rendererForOverlay:(id )overlay instead")));
759 | - (void)mapView:(MAMapView *)mapView didUpdateUserLocation:(MAUserLocation *)userLocation __attribute__ ((deprecated("use -(void)mapView:(MAMapView *)mapView didUpdateUserLocation:(MAUserLocation *)userLocation updatingLocation:(BOOL)updatingLocation instead")));
760 | - (void)mapView:(MAMapView *)mapView didAddOverlayViews:(NSArray *)overlayViews __attribute__ ((deprecated("use - (void)mapView:(MAMapView *)mapView didAddOverlayRenderers:(NSArray *)renderers instead")));
761 |
762 |
763 | @end
764 |
--------------------------------------------------------------------------------