├── .gitignore ├── .npmignore ├── README.md ├── android └── react-native-amap │ ├── .gitignore │ ├── build.gradle │ ├── libs │ └── AMap_2DMap_V2.8.1_20160202.jar │ ├── proguard-rules.pro │ ├── react-native-amap.iml │ └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── yiyang │ │ └── reactnativeamap │ │ └── ApplicationTest.java │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── yiyang │ │ └── reactnativeamap │ │ ├── MAMapViewManager.java │ │ ├── ReactMapMarker.java │ │ ├── ReactMapOverlay.java │ │ ├── ReactMapPackage.java │ │ └── ReactMapView.java │ ├── jniLibs │ ├── arm64-v8a │ │ ├── libgdinamapv4sdk752.so │ │ └── libgdinamapv4sdk752ex.so │ └── armeabi │ │ ├── libgdinamapv4sdk752.so │ │ └── libgdinamapv4sdk752ex.so │ └── res │ └── values │ └── strings.xml ├── index.js ├── ios └── RCTAMap │ ├── RCTAMap.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcuserdata │ │ │ └── yiyang.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcuserdata │ │ └── yiyang.xcuserdatad │ │ └── xcschemes │ │ ├── RCTAMap.xcscheme │ │ └── xcschememanagement.plist │ └── RCTAMap │ ├── AMap │ └── MAMapKit.framework │ │ ├── 3.3.0.e5e4560 │ │ ├── AMap.bundle │ │ └── images │ │ │ ├── greenPin.png │ │ │ ├── greenPin@2x.png │ │ │ ├── greenPin@3x.png │ │ │ ├── greenPin_lift.png │ │ │ ├── greenPin_lift@2x.png │ │ │ ├── greenPin_lift@3x.png │ │ │ ├── pin_shadow.png │ │ │ ├── pin_shadow@2x.png │ │ │ ├── pin_shadow@3x.png │ │ │ ├── purplePin.png │ │ │ ├── purplePin@2x.png │ │ │ ├── purplePin@3x.png │ │ │ ├── purplePin_lift.png │ │ │ ├── purplePin_lift@2x.png │ │ │ ├── purplePin_lift@3x.png │ │ │ ├── redPin.png │ │ │ ├── redPin@2x.png │ │ │ ├── redPin@3x.png │ │ │ ├── redPin_lift.png │ │ │ ├── redPin_lift@2x.png │ │ │ └── redPin_lift@3x.png │ │ ├── Headers │ │ ├── MAAnnotation.h │ │ ├── MAAnnotationView.h │ │ ├── MACircle.h │ │ ├── MACircleRenderer.h │ │ ├── MACircleView.h │ │ ├── MAGeodesicPolyline.h │ │ ├── MAGeometry.h │ │ ├── MAGroundOverlay.h │ │ ├── MAGroundOverlayRenderer.h │ │ ├── MAGroundOverlayView.h │ │ ├── MAHeatMapTileOverlay.h │ │ ├── MAMapKit.h │ │ ├── MAMapServices.h │ │ ├── MAMapURLSearch.h │ │ ├── MAMapURLSearchConfig.h │ │ ├── MAMapURLSearchType.h │ │ ├── MAMapView.h │ │ ├── MAMultiColoredPolylineRenderer.h │ │ ├── MAMultiPoint.h │ │ ├── MAMultiPolyline.h │ │ ├── MAOverlay.h │ │ ├── MAOverlayPathRenderer.h │ │ ├── MAOverlayPathView.h │ │ ├── MAOverlayRenderer.h │ │ ├── MAOverlayView.h │ │ ├── MAPinAnnotationView.h │ │ ├── MAPointAnnotation.h │ │ ├── MAPolygon.h │ │ ├── MAPolygonRenderer.h │ │ ├── MAPolygonView.h │ │ ├── MAPolyline.h │ │ ├── MAPolylineRenderer.h │ │ ├── MAPolylineView.h │ │ ├── MAShape.h │ │ ├── MATileOverlay.h │ │ ├── MATileOverlayRenderer.h │ │ ├── MATileOverlayView.h │ │ ├── MAUserLocation.h │ │ └── MAUserLocationRepresentation.h │ │ └── MAMapKit │ ├── RCTAMap.h │ ├── RCTAMap.m │ ├── RCTAMapAnnotation.h │ ├── RCTAMapAnnotation.m │ ├── RCTAMapManager.h │ ├── RCTAMapManager.m │ ├── RCTAMapOverlay.h │ ├── RCTAMapOverlay.m │ ├── RCTConvert+AMapKit.h │ └── RCTConvert+AMapKit.m └── package.json /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | npm-debug.log 3 | node_modules/ 4 | ReactAMapDemo 5 | *.xcuserstate 6 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | YYToastExample 2 | 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # react-native-yyamap 2 | AMap (Gaode map) sdk for react-native 3 | 4 | ## install 5 | 6 | `npm install react-native-yyamap --save` 7 | 8 | ### iOS 9 | 10 | 1. Open your project in XCode, right click on `Libraries` and click `Add 11 | Files to "Your Project Name"` Look under `node_modules/react-native-yyamap` and add `RCTAMap.xcodeproj`. 12 | 2. Add `libRCTAMap.a` to `Build Phases -> Link Binary With Libraries. 13 | 3. Click on `RCTAMap.xcodeproj` in `Libraries` and go the `Build 14 | Settings` tab. Double click the text to the right of `Header Search 15 | Paths` and verify that it has `$(SRCROOT)/../react-native/React` - if they 16 | aren't, then add them. This is so XCode is able to find the headers that 17 | the `RCTAMap` source files are referring to by pointing to the 18 | header files installed within the `react-native` `node_modules` 19 | directory. 20 | 4. Add `node_modules/react-native-yymap/RCTAMap/RCTAMap/AMap/MAMapkit.framework` and `MAMapkit.framework/AMap.bundle` to your project. 21 | 5. Set your project's framework Search Paths to include `$(PROJECT_DIR)/../node_modules/react-native-yyamap/ios/RCTAMap/RCTAMap/AMap`. 22 | 6. Set your project's Header Search paths to include `$(SRCROOT)/../node_modules/react-native-yyamap/ios/RCTAMap/RCTAMap`. 23 | 4. Whenever you want to use it within React code now you can: `var MapView = 24 | require('react-native-yyamap');` 25 | 26 | 27 | ### android 28 | 29 | 1. in `android/settings.gradle` 30 | 31 | ``` 32 | include ':app', ':react-native-amap' 33 | project(':react-native-amap').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-yyamap/android/react-native-amap') 34 | ``` 35 | 36 | 2. in `android/app/build.gradle` add: 37 | 38 | ``` 39 | dependencies { 40 | ... 41 | compile project(':react-native-amap') 42 | } 43 | ``` 44 | 3. in `MainActivity.java` add 45 | **Newer versions of React Native** 46 | ``` 47 | ... 48 | import com.yiyang.reactnativeamap.ReactMapPackage; // <--- This! 49 | ... 50 | public class MainActivity extends ReactActivity { 51 | 52 | @Override 53 | protected String getMainComponentName() { 54 | return "sample"; 55 | } 56 | 57 | @Override 58 | protected boolean getUseDeveloperSupport() { 59 | return BuildConfig.DEBUG; 60 | } 61 | 62 | @Override 63 | protected List getPackages() { 64 | return Arrays.asList( 65 | new MainReactPackage() 66 | new ReactMapPackage() // <---- and This! 67 | ); 68 | } 69 | } 70 | ``` 71 | 72 | **Older versions of React Native** 73 | ``` 74 | ... 75 | import com.yiyang.reactnativeamap.ReactMapPackage; // <--- This! 76 | ... 77 | @Override 78 | protected void onCreate(Bundle savedInstanceState) { 79 | super.onCreate(savedInstanceState); 80 | mReactRootView = new ReactRootView(this); 81 | 82 | mReactInstanceManager = ReactInstanceManager.builder() 83 | .setApplication(getApplication()) 84 | .setBundleAssetName("index.android.bundle") 85 | .setJSMainModuleName("index.android") 86 | .addPackage(new MainReactPackage()) 87 | .addPackage(new ReactMapPackage()) // <---- and This! 88 | .setUseDeveloperSupport(BuildConfig.DEBUG) 89 | .setInitialLifecycleState(LifecycleState.RESUMED) 90 | .build(); 91 | 92 | mReactRootView.startReactApplication(mReactInstanceManager, "MyApp", null); 93 | 94 | setContentView(mReactRootView); 95 | } 96 | ``` 97 | 4. specify your Gaode Maps API Key in your `AndroidManifest.xml`: 98 | 99 | ```xml 100 | 105 | 106 | 109 | 110 | ``` 111 | 112 | ## usage 113 | 114 | ``` 115 | ... 116 | import MapView from 'react-native-yyamap'; 117 | 118 | ... 119 | render() { 120 | 125 | } 126 | -------------------------------------------------------------------------------- /android/react-native-amap/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /android/react-native-amap/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | compileSdkVersion 23 5 | buildToolsVersion "23.0.1" 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.1.1' 24 | compile 'com.facebook.react:react-native:0.20.+' 25 | compile files('libs/AMap_2DMap_V2.8.1_20160202.jar') 26 | } 27 | -------------------------------------------------------------------------------- /android/react-native-amap/libs/AMap_2DMap_V2.8.1_20160202.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiyangest/react-native-yyamap/1303f9c9449e4a1fe0b9fc7a04c95dc17e904125/android/react-native-amap/libs/AMap_2DMap_V2.8.1_20160202.jar -------------------------------------------------------------------------------- /android/react-native-amap/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/yiyang/Documents/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 | -------------------------------------------------------------------------------- /android/react-native-amap/react-native-amap.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | 9 | 10 | 11 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | -------------------------------------------------------------------------------- /android/react-native-amap/src/androidTest/java/com/yiyang/reactnativeamap/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.yiyang.reactnativeamap; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /android/react-native-amap/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /android/react-native-amap/src/main/java/com/yiyang/reactnativeamap/MAMapViewManager.java: -------------------------------------------------------------------------------- 1 | package com.yiyang.reactnativeamap; 2 | 3 | import android.content.Context; 4 | import android.graphics.Color; 5 | import android.os.StrictMode; 6 | import android.support.annotation.Nullable; 7 | import android.util.Log; 8 | 9 | import com.amap.api.maps2d.AMap; 10 | import com.amap.api.maps2d.CameraUpdateFactory; 11 | import com.amap.api.maps2d.MapView; 12 | import com.amap.api.maps2d.model.CameraPosition; 13 | import com.amap.api.maps2d.model.CircleOptions; 14 | import com.amap.api.maps2d.model.LatLng; 15 | import com.facebook.react.bridge.ReadableArray; 16 | import com.facebook.react.bridge.ReadableMap; 17 | import com.facebook.react.uimanager.SimpleViewManager; 18 | import com.facebook.react.uimanager.ThemedReactContext; 19 | import com.facebook.react.uimanager.annotations.ReactProp; 20 | 21 | import java.util.ArrayList; 22 | import java.util.List; 23 | 24 | /** 25 | * Created by yiyang on 16/3/1. 26 | */ 27 | public class MAMapViewManager extends SimpleViewManager { 28 | public static final String RCT_CLASS = "RCTAMap"; 29 | 30 | private ReactMapView mMapView; 31 | 32 | private Context mContext; 33 | 34 | 35 | @Override 36 | public String getName() { 37 | return RCT_CLASS; 38 | } 39 | 40 | @Override 41 | protected ReactMapView createViewInstance(ThemedReactContext themedReactContext) { 42 | mMapView = new ReactMapView(themedReactContext); 43 | this.mContext = themedReactContext; 44 | mMapView.onCreate(null); 45 | StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build(); 46 | StrictMode.setThreadPolicy(policy); 47 | return mMapView; 48 | } 49 | 50 | public ReactMapView getMapView() { 51 | return mMapView; 52 | } 53 | 54 | @ReactProp(name="showsUserLocation", defaultBoolean = false) 55 | public void showsUserLocation(MapView mapView, Boolean show) { 56 | mapView.getMap().setMyLocationEnabled(show); 57 | } 58 | 59 | @ReactProp(name="showsCompass", defaultBoolean = false) 60 | public void showsCompass(MapView mapView, Boolean show) { 61 | mapView.getMap().getUiSettings().setCompassEnabled(show); 62 | } 63 | 64 | @ReactProp(name="zoomEnabled", defaultBoolean = true) 65 | public void setZoomEnabled(MapView mapView, Boolean enable) { 66 | mapView.getMap().getUiSettings().setZoomGesturesEnabled(enable); 67 | } 68 | 69 | @ReactProp(name="rotateEnabled", defaultBoolean = true) 70 | public void setRotateEnabled(MapView mapView, Boolean enable) { 71 | // mapView.getMap().getUiSettings().setRotateGesturesEnabled(enable); 72 | } 73 | 74 | @ReactProp(name="pitchEnabled", defaultBoolean = false) 75 | public void setTiltGestureEnabled(MapView mapView, Boolean enable) { 76 | // mapView.getMap().getUiSettings().setTiltGesturesEnabled(enable); 77 | } 78 | 79 | @ReactProp(name="scrollEnabled", defaultBoolean = false) 80 | public void setScrollEnabled(MapView mapView, Boolean enable) { 81 | mapView.getMap().getUiSettings().setScrollGesturesEnabled(enable); 82 | } 83 | 84 | @ReactProp(name = "mapType", defaultInt = AMap.MAP_TYPE_NORMAL) 85 | public void setMapType(MapView mapView, int mapType) { 86 | mapView.getMap().setMapType(mapType); 87 | } 88 | 89 | @ReactProp(name = "annotations") 90 | public void setAnnotations(ReactMapView mapView, @Nullable ReadableArray value) throws Exception{ 91 | AMap map = mapView.getMap(); 92 | if (value == null || value.size() == 0) { 93 | Log.e(RCT_CLASS, "Error: no annotation"); 94 | return; 95 | } 96 | 97 | List markers = new ArrayList(); 98 | int size = value.size(); 99 | for (int i = 0; i < size; i++) { 100 | ReadableMap annotation = value.getMap(i); 101 | ReactMapMarker marker = new ReactMapMarker(this.mContext); 102 | marker.buildMarker(annotation); 103 | markers.add(marker); 104 | } 105 | 106 | mapView.setMarker(markers); 107 | 108 | } 109 | 110 | @ReactProp(name = "overlays") 111 | public void setOverlays(ReactMapView mapView, @Nullable ReadableArray value) throws Exception{ 112 | if (value == null || value.size() == 0) { 113 | return; 114 | } 115 | 116 | List overlays = new ArrayList(); 117 | int size = value.size(); 118 | for(int i = 0; i < size; i++) { 119 | ReadableMap overlay = value.getMap(i); 120 | ReactMapOverlay polyline = new ReactMapOverlay(overlay); 121 | overlays.add(polyline); 122 | } 123 | 124 | mapView.setOverlays(overlays); 125 | } 126 | 127 | @ReactProp(name = "circle") 128 | public void setCircle(ReactMapView mapView, @Nullable ReadableMap circle) { 129 | if (circle != null) { 130 | double latitude = circle.getDouble("latitude"); 131 | double longitude = circle.getDouble("longitude"); 132 | int radius = circle.getInt("radius"); 133 | int strokeWidth = circle.getInt("strokeWidth"); 134 | mapView.getMap().addCircle(new CircleOptions().center(new LatLng(latitude, longitude)) 135 | .radius(radius).strokeColor(0xFFFF0000).fillColor(0x4400FF00) 136 | .strokeWidth(strokeWidth)); 137 | } 138 | } 139 | 140 | @ReactProp(name = "region") 141 | public void setRegion(ReactMapView mapView, @Nullable ReadableMap center) { 142 | if (center != null) { 143 | double latitude = center.getDouble("latitude"); 144 | double longitude = center.getDouble("longitude"); 145 | int zoomLevel = center.getInt("zoomLevel"); 146 | CameraPosition cameraPosition = new CameraPosition.Builder() 147 | .target(new LatLng(latitude, longitude)).zoom(zoomLevel) 148 | .build(); 149 | mapView.getMap().moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition)); 150 | } 151 | } 152 | } 153 | -------------------------------------------------------------------------------- /android/react-native-amap/src/main/java/com/yiyang/reactnativeamap/ReactMapMarker.java: -------------------------------------------------------------------------------- 1 | package com.yiyang.reactnativeamap; 2 | 3 | import android.content.Context; 4 | import android.graphics.Bitmap; 5 | import android.graphics.drawable.Animatable; 6 | import android.net.Uri; 7 | 8 | import com.amap.api.maps2d.AMap; 9 | import com.amap.api.maps2d.model.BitmapDescriptor; 10 | import com.amap.api.maps2d.model.BitmapDescriptorFactory; 11 | import com.amap.api.maps2d.model.LatLng; 12 | import com.amap.api.maps2d.model.Marker; 13 | import com.amap.api.maps2d.model.MarkerOptions; 14 | import com.facebook.common.references.CloseableReference; 15 | import com.facebook.datasource.DataSource; 16 | import com.facebook.drawee.backends.pipeline.Fresco; 17 | import com.facebook.drawee.controller.BaseControllerListener; 18 | import com.facebook.drawee.controller.ControllerListener; 19 | import com.facebook.drawee.drawable.ScalingUtils; 20 | import com.facebook.drawee.generic.GenericDraweeHierarchy; 21 | import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder; 22 | import com.facebook.drawee.interfaces.DraweeController; 23 | import com.facebook.drawee.view.DraweeHolder; 24 | import com.facebook.imagepipeline.core.ImagePipeline; 25 | import com.facebook.imagepipeline.image.CloseableImage; 26 | import com.facebook.imagepipeline.image.CloseableStaticBitmap; 27 | import com.facebook.imagepipeline.image.ImageInfo; 28 | import com.facebook.imagepipeline.request.ImageRequest; 29 | import com.facebook.imagepipeline.request.ImageRequestBuilder; 30 | import com.facebook.react.bridge.ReadableMap; 31 | 32 | /** 33 | * Created by yiyang on 16/3/1. 34 | */ 35 | public class ReactMapMarker { 36 | private Marker mMarker; 37 | private MarkerOptions mOptions; 38 | 39 | private String id; 40 | 41 | private Context mContext; 42 | 43 | 44 | private BitmapDescriptor iconBitmapDescriptor; 45 | private final DraweeHolder mLogoHolder; 46 | private DataSource> dataSource; 47 | 48 | private final ControllerListener mLogoControllerListener = 49 | new BaseControllerListener() { 50 | @Override 51 | public void onFinalImageSet(String id, ImageInfo imageInfo, Animatable animatable) { 52 | CloseableReference imageReference = null; 53 | try { 54 | imageReference = dataSource.getResult(); 55 | if (imageReference != null) { 56 | CloseableImage image = imageReference.get(); 57 | if (image != null && image instanceof CloseableStaticBitmap) { 58 | CloseableStaticBitmap closeableStaticBitmap = (CloseableStaticBitmap)image; 59 | Bitmap bitmap = closeableStaticBitmap.getUnderlyingBitmap(); 60 | if (bitmap != null) { 61 | bitmap = bitmap.copy(Bitmap.Config.ARGB_8888, true); 62 | iconBitmapDescriptor = BitmapDescriptorFactory.fromBitmap(bitmap); 63 | } 64 | } 65 | } 66 | } finally { 67 | dataSource.close(); 68 | if (imageReference != null) { 69 | CloseableReference.closeSafely(imageReference); 70 | } 71 | } 72 | update(); 73 | } 74 | }; 75 | 76 | public ReactMapMarker(Context context) { 77 | this.mContext = context; 78 | mLogoHolder = DraweeHolder.create(createDraweeHierarchy(), null); 79 | mLogoHolder.onAttach(); 80 | } 81 | 82 | public void buildMarker(ReadableMap annotation) throws Exception{ 83 | if (annotation == null) { 84 | throw new Exception("marker annotation must not be null"); 85 | } 86 | id = annotation.getString("id"); 87 | MarkerOptions options = new MarkerOptions(); 88 | double latitude = annotation.getDouble("latitude"); 89 | double longitude = annotation.getDouble("longitude"); 90 | 91 | options.position(new LatLng(latitude, longitude)); 92 | 93 | if (annotation.hasKey("draggable")) { 94 | 95 | boolean draggable = annotation.getBoolean("draggable"); 96 | options.draggable(draggable); 97 | } 98 | 99 | if (annotation.hasKey("title")) { 100 | options.title(annotation.getString("title")); 101 | } 102 | 103 | if (annotation.hasKey("subtitle")) { 104 | options.snippet(annotation.getString("subtitle")); 105 | } 106 | 107 | if (annotation.hasKey("image")) { 108 | String imgUri = annotation.getMap("image").getString("uri"); 109 | if (imgUri != null && imgUri.length() > 0) { 110 | if (imgUri.startsWith("http://") || imgUri.startsWith("https://")) { 111 | ImageRequest imageRequest = ImageRequestBuilder.newBuilderWithSource(Uri.parse(imgUri)).build(); 112 | ImagePipeline imagePipeline = Fresco.getImagePipeline(); 113 | dataSource = imagePipeline.fetchDecodedImage(imageRequest,this); 114 | DraweeController controller = Fresco.newDraweeControllerBuilder() 115 | .setImageRequest(imageRequest) 116 | .setControllerListener(mLogoControllerListener) 117 | .setOldController(mLogoHolder.getController()) 118 | .build(); 119 | mLogoHolder.setController(controller); 120 | } else { 121 | options.icon(BitmapDescriptorFactory.fromPath(imgUri)); 122 | } 123 | } 124 | } 125 | 126 | if(annotation.hasKey("color")) { 127 | float markerColor = (float)annotation.getDouble("color"); 128 | options.icon(BitmapDescriptorFactory.defaultMarker(markerColor)); 129 | } 130 | 131 | this.mOptions = options; 132 | 133 | } 134 | 135 | private GenericDraweeHierarchy createDraweeHierarchy() { 136 | return new GenericDraweeHierarchyBuilder(this.mContext.getResources()) 137 | .setActualImageScaleType(ScalingUtils.ScaleType.FIT_CENTER) 138 | .setFadeDuration(0) 139 | .build(); 140 | } 141 | 142 | public String getId() {return this.id;} 143 | public Marker getMarker() {return this.mMarker;} 144 | public MarkerOptions getOptions() {return this.mOptions;} 145 | 146 | public void addToMap(AMap map) { 147 | if (this.mMarker == null) { 148 | this.mMarker = map.addMarker(this.getOptions()); 149 | } 150 | } 151 | 152 | private BitmapDescriptor getIcon() { 153 | if (iconBitmapDescriptor != null) { 154 | return iconBitmapDescriptor; 155 | } else { 156 | return BitmapDescriptorFactory.defaultMarker(); 157 | } 158 | } 159 | 160 | public void update() { 161 | if (this.mMarker != null) { 162 | this.mMarker.setIcon(getIcon()); 163 | } else { 164 | this.mOptions.icon(getIcon()); 165 | } 166 | } 167 | 168 | 169 | 170 | } 171 | -------------------------------------------------------------------------------- /android/react-native-amap/src/main/java/com/yiyang/reactnativeamap/ReactMapOverlay.java: -------------------------------------------------------------------------------- 1 | package com.yiyang.reactnativeamap; 2 | 3 | import com.amap.api.maps2d.AMap; 4 | import com.amap.api.maps2d.model.LatLng; 5 | import com.amap.api.maps2d.model.Polyline; 6 | import com.amap.api.maps2d.model.PolylineOptions; 7 | import com.facebook.react.bridge.ReadableArray; 8 | import com.facebook.react.bridge.ReadableMap; 9 | 10 | import java.util.ArrayList; 11 | import java.util.List; 12 | 13 | /** 14 | * Created by yiyang on 16/3/1. 15 | */ 16 | public class ReactMapOverlay { 17 | private Polyline mPolyline; 18 | private PolylineOptions mOptions; 19 | 20 | private String id; 21 | 22 | public ReactMapOverlay(ReadableMap overlay) throws Exception{ 23 | if (overlay == null) { 24 | throw new Exception("overlay must not be null"); 25 | } 26 | 27 | id = overlay.getString("id"); 28 | 29 | mOptions = new PolylineOptions(); 30 | 31 | if (overlay.hasKey("lineWidth")) { 32 | mOptions.width((float)overlay.getDouble("lineWidth")); 33 | } 34 | 35 | if (overlay.hasKey("strokeColor")) { 36 | mOptions.color(overlay.getInt("strokeColor")); 37 | } 38 | 39 | List coordinateList = new ArrayList(); 40 | if (overlay.hasKey("coordinates")) { 41 | ReadableArray coordinates = overlay.getArray("coordinates"); 42 | int size = coordinates.size(); 43 | for (int i = 0; i < size; i++) { 44 | ReadableMap coordinate = coordinates.getMap(i); 45 | double latitude = coordinate.getDouble("latitude"); 46 | double longitude = coordinate.getDouble("longitude"); 47 | coordinateList.add(new LatLng(latitude, longitude)); 48 | } 49 | } 50 | 51 | if (coordinateList.size() > 0) { 52 | mOptions.addAll(coordinateList); 53 | } 54 | } 55 | 56 | public String getId() {return this.id;} 57 | public Polyline getPolyline() {return this.mPolyline;} 58 | public PolylineOptions getOptions() {return this.mOptions;} 59 | 60 | public void addToMap(AMap map) { 61 | if (this.mPolyline == null) { 62 | this.mPolyline = map.addPolyline(this.mOptions); 63 | } 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /android/react-native-amap/src/main/java/com/yiyang/reactnativeamap/ReactMapPackage.java: -------------------------------------------------------------------------------- 1 | package com.yiyang.reactnativeamap; 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 | * Created by yiyang on 16/3/1. 15 | */ 16 | public class ReactMapPackage implements ReactPackage { 17 | @Override 18 | public List createNativeModules(ReactApplicationContext reactApplicationContext) { 19 | return Collections.emptyList(); 20 | } 21 | 22 | @Override 23 | public List> createJSModules() { 24 | return Collections.emptyList(); 25 | } 26 | 27 | @Override 28 | public List createViewManagers(ReactApplicationContext reactApplicationContext) { 29 | return Arrays.asList( 30 | new MAMapViewManager() 31 | ); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /android/react-native-amap/src/main/java/com/yiyang/reactnativeamap/ReactMapView.java: -------------------------------------------------------------------------------- 1 | package com.yiyang.reactnativeamap; 2 | 3 | import android.content.Context; 4 | 5 | import com.amap.api.maps2d.MapView; 6 | 7 | import java.util.ArrayList; 8 | import java.util.List; 9 | 10 | /** 11 | * Created by yiyang on 16/2/29. 12 | */ 13 | public class ReactMapView extends MapView { 14 | private List mMarkers = new ArrayList(); 15 | private List mMarkerIds = new ArrayList(); 16 | 17 | private List mOverlays = new ArrayList(); 18 | private List mOverlayIds = new ArrayList(); 19 | 20 | public ReactMapView(Context context) { 21 | super(context); 22 | } 23 | 24 | public void setOverlays(List overlays) { 25 | List newOverlayIds = new ArrayList(); 26 | List overlaysToDelete = new ArrayList(); 27 | List overlaysToAdd = new ArrayList(); 28 | 29 | for (ReactMapOverlay overlay : 30 | overlays) { 31 | if (overlay instanceof ReactMapOverlay == false) { 32 | continue; 33 | } 34 | 35 | newOverlayIds.add(overlay.getId()); 36 | 37 | if (!mOverlayIds.contains(overlay.getId())) { 38 | overlaysToAdd.add(overlay); 39 | } 40 | } 41 | 42 | for (ReactMapOverlay overlay : 43 | this.mOverlays) { 44 | if (overlay instanceof ReactMapOverlay == false) { 45 | continue; 46 | } 47 | 48 | if (!newOverlayIds.contains(overlay.getId())) { 49 | overlaysToDelete.add(overlay); 50 | } 51 | } 52 | 53 | if (!overlaysToDelete.isEmpty()) { 54 | for (ReactMapOverlay overlay : 55 | overlaysToDelete) { 56 | overlay.getPolyline().remove(); 57 | this.mOverlays.remove(overlay); 58 | } 59 | } 60 | 61 | if (!overlaysToAdd.isEmpty()) { 62 | for (ReactMapOverlay overlay: 63 | overlaysToAdd) { 64 | if (overlay.getOptions() != null) { 65 | overlay.addToMap(this.getMap()); 66 | this.mOverlays.add(overlay); 67 | } 68 | } 69 | } 70 | 71 | this.mOverlayIds = newOverlayIds; 72 | 73 | } 74 | 75 | public void setMarker(List markers) { 76 | 77 | List newMarkerIds = new ArrayList(); 78 | List markersToDelete = new ArrayList(); 79 | List markersToAdd = new ArrayList(); 80 | 81 | for (ReactMapMarker marker : 82 | markers) { 83 | if (marker instanceof ReactMapMarker == false) { 84 | continue; 85 | } 86 | 87 | newMarkerIds.add(marker.getId()); 88 | 89 | if (!mMarkerIds.contains(marker.getId())) { 90 | markersToAdd.add(marker); 91 | } 92 | } 93 | 94 | for (ReactMapMarker marker : 95 | this.mMarkers) { 96 | if (marker instanceof ReactMapMarker == false) { 97 | continue; 98 | } 99 | 100 | if (!newMarkerIds.contains(marker.getId())) { 101 | markersToDelete.add(marker); 102 | } 103 | } 104 | 105 | if (!markersToDelete.isEmpty()) { 106 | for (ReactMapMarker marker : 107 | markersToDelete) { 108 | marker.getMarker().destroy(); 109 | this.mMarkers.remove(marker); 110 | } 111 | } 112 | 113 | if (!markersToAdd.isEmpty()) { 114 | for (ReactMapMarker marker : 115 | markersToAdd) { 116 | if (marker.getOptions() != null) { 117 | marker.addToMap(this.getMap()); 118 | this.mMarkers.add(marker); 119 | } 120 | } 121 | } 122 | 123 | this.mMarkerIds = newMarkerIds; 124 | } 125 | } 126 | -------------------------------------------------------------------------------- /android/react-native-amap/src/main/jniLibs/arm64-v8a/libgdinamapv4sdk752.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiyangest/react-native-yyamap/1303f9c9449e4a1fe0b9fc7a04c95dc17e904125/android/react-native-amap/src/main/jniLibs/arm64-v8a/libgdinamapv4sdk752.so -------------------------------------------------------------------------------- /android/react-native-amap/src/main/jniLibs/arm64-v8a/libgdinamapv4sdk752ex.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiyangest/react-native-yyamap/1303f9c9449e4a1fe0b9fc7a04c95dc17e904125/android/react-native-amap/src/main/jniLibs/arm64-v8a/libgdinamapv4sdk752ex.so -------------------------------------------------------------------------------- /android/react-native-amap/src/main/jniLibs/armeabi/libgdinamapv4sdk752.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiyangest/react-native-yyamap/1303f9c9449e4a1fe0b9fc7a04c95dc17e904125/android/react-native-amap/src/main/jniLibs/armeabi/libgdinamapv4sdk752.so -------------------------------------------------------------------------------- /android/react-native-amap/src/main/jniLibs/armeabi/libgdinamapv4sdk752ex.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiyangest/react-native-yyamap/1303f9c9449e4a1fe0b9fc7a04c95dc17e904125/android/react-native-amap/src/main/jniLibs/armeabi/libgdinamapv4sdk752ex.so -------------------------------------------------------------------------------- /android/react-native-amap/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | ReactNativeAMap 3 | 4 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | import React, { Component, PropTypes } from 'react'; 4 | import ReactNative from 'react-native'; 5 | 6 | var { 7 | EdgeInsetsPropType, 8 | Image, 9 | NativeMethodsMixin, 10 | Platform, 11 | requireNativeComponent, 12 | StyleSheet, 13 | View, 14 | UIManager, 15 | processColor, 16 | ColorPropType, 17 | } = require('react-native'); 18 | 19 | import deprecatedPropType from 'react-native/Libraries/Utilities/deprecatedPropType'; 20 | import resolveAssetSource from 'react-native/Libraries/Image/resolveAssetSource'; 21 | 22 | 23 | const RCTAMapConstants = UIManager.RCTAMap.Constants; 24 | 25 | type Event = Object; 26 | 27 | export type MAAnnotationDragState = $Enum<{ 28 | idle: string; 29 | starting: string; 30 | dragging: string; 31 | canceling: string; 32 | ending: string; 33 | }>; 34 | // class Fuck extends React.Component { 35 | // render() { 36 | // return ; 37 | // } 38 | // } 39 | const MAMapView= React.createClass({ 40 | 41 | mixins: [NativeMethodsMixin], 42 | 43 | propTypes: { 44 | ...View.propTypes, 45 | /** 46 | * Used to style and layout the `MapView`. See `StyleSheet.js` and 47 | * `ViewStylePropTypes.js` for more info. 48 | */ 49 | style: View.propTypes.style, 50 | 51 | /** 52 | * If `true` the app will ask for the user's location and display it on 53 | * the map. Default value is `false`. 54 | * 55 | * **NOTE**: on iOS, you need to add the `NSLocationWhenInUseUsageDescription` 56 | * key in Info.plist to enable geolocation, otherwise it will fail silently. 57 | */ 58 | showsUserLocation: React.PropTypes.bool, 59 | 60 | /** 61 | * If `true` the map will follow the user's location whenever it changes. 62 | * Note that this has no effect unless `showsUserLocation` is enabled. 63 | * Default value is `true`. 64 | * @platform ios 65 | */ 66 | followUserLocation: React.PropTypes.bool, 67 | 68 | /** 69 | * If `false` points of interest won't be displayed on the map. 70 | * Default value is `true`. 71 | * @platform ios 72 | */ 73 | showsPointsOfInterest: React.PropTypes.bool, 74 | 75 | /** 76 | * If `false` compass won't be displayed on the map. 77 | * Default value is `true`. 78 | * @platform ios 79 | */ 80 | showsCompass: React.PropTypes.bool, 81 | 82 | /** 83 | * If `false` the user won't be able to pinch/zoom the map. 84 | * Default value is `true`. 85 | */ 86 | zoomEnabled: React.PropTypes.bool, 87 | 88 | /** 89 | * When this property is set to `true` and a valid camera is associated with 90 | * the map, the camera’s heading angle is used to rotate the plane of the 91 | * map around its center point. When this property is set to `false`, the 92 | * camera’s heading angle is ignored and the map is always oriented so 93 | * that true north is situated at the top of the map view 94 | */ 95 | rotateEnabled: React.PropTypes.bool, 96 | 97 | /** 98 | * When this property is set to `true` and a valid camera is associated 99 | * with the map, the camera’s pitch angle is used to tilt the plane 100 | * of the map. When this property is set to `false`, the camera’s pitch 101 | * angle is ignored and the map is always displayed as if the user 102 | * is looking straight down onto it. 103 | */ 104 | pitchEnabled: React.PropTypes.bool, 105 | 106 | /** 107 | * If `false` the user won't be able to change the map region being displayed. 108 | * Default value is `true`. 109 | */ 110 | scrollEnabled: React.PropTypes.bool, 111 | 112 | /** 113 | * The map type to be displayed. 114 | * 115 | * - standard: standard road map (default) 116 | * - satellite: satellite view 117 | * - hybrid: satellite view with roads and points of interest overlaid 118 | * 119 | * @platform ios 120 | */ 121 | mapType: React.PropTypes.oneOf([ 122 | 'standard', 123 | 'satellite', 124 | 'hybrid', 125 | ]), 126 | 127 | /** 128 | * The region to be displayed by the map. 129 | * 130 | * The region is defined by the center coordinates and the span of 131 | * coordinates to display. 132 | */ 133 | region: React.PropTypes.shape({ 134 | /** 135 | * Coordinates for the center of the map. 136 | */ 137 | latitude: React.PropTypes.number.isRequired, 138 | longitude: React.PropTypes.number.isRequired, 139 | 140 | /** 141 | * Distance between the minimum and the maximum latitude/longitude 142 | * to be displayed. 143 | */ 144 | latitudeDelta: React.PropTypes.number, 145 | longitudeDelta: React.PropTypes.number, 146 | }), 147 | 148 | circle: React.PropTypes.shape({ 149 | /** 150 | * Coordinates for the center of the map. 151 | */ 152 | latitude: React.PropTypes.number.isRequired, 153 | longitude: React.PropTypes.number.isRequired, 154 | 155 | /** 156 | 157 | */ 158 | radius: React.PropTypes.number, 159 | strokeColor: React.PropTypes.number, 160 | fillColor: React.PropTypes.number, 161 | strokeWidth: React.PropTypes.number 162 | }), 163 | 164 | /** 165 | * Map annotations with title/subtitle. 166 | * @platform ios 167 | */ 168 | annotations: React.PropTypes.arrayOf(React.PropTypes.shape({ 169 | /** 170 | * The location of the annotation. 171 | */ 172 | latitude: React.PropTypes.number.isRequired, 173 | longitude: React.PropTypes.number.isRequired, 174 | 175 | /** 176 | * Whether the pin drop should be animated or not 177 | */ 178 | animateDrop: React.PropTypes.bool, 179 | 180 | /** 181 | * Whether the pin should be draggable or not 182 | */ 183 | draggable: React.PropTypes.bool, 184 | 185 | /** 186 | * Event that fires when the annotation drag state changes. 187 | */ 188 | onDragStateChange: React.PropTypes.func, 189 | 190 | /** 191 | * Event that fires when the annotation gets was tapped by the user 192 | * and the callout view was displayed. 193 | */ 194 | onFocus: React.PropTypes.func, 195 | 196 | /** 197 | * Event that fires when another annotation or the mapview itself 198 | * was tapped and a previously shown annotation will be closed. 199 | */ 200 | onBlur: React.PropTypes.func, 201 | 202 | /** 203 | * Annotation title/subtile. 204 | */ 205 | title: React.PropTypes.string, 206 | subtitle: React.PropTypes.string, 207 | 208 | /** 209 | * Callout views. 210 | */ 211 | leftCalloutView: React.PropTypes.element, 212 | rightCalloutView: React.PropTypes.element, 213 | 214 | /** 215 | * The pin color. This can be any valid color string, or you can use one 216 | * of the predefined PinColors constants. Applies to both standard pins 217 | * and custom pin images. 218 | * 219 | * Note that on iOS 8 and earlier, only the standard PinColor constants 220 | * are supported for regular pins. For custom pin images, any tintColor 221 | * value is supported on all iOS versions. 222 | */ 223 | tintColor: React.PropTypes.number, 224 | 225 | /** 226 | * Custom pin image. This must be a static image resource inside the app. 227 | */ 228 | image: Image.propTypes.source, 229 | 230 | /** 231 | * Custom pin view. If set, this replaces the pin or custom pin image. 232 | */ 233 | view: React.PropTypes.element, 234 | 235 | /** 236 | * annotation id 237 | */ 238 | id: React.PropTypes.string, 239 | 240 | /** 241 | * Deprecated. Use the left/right/detailsCalloutView props instead. 242 | */ 243 | hasLeftCallout: deprecatedPropType( 244 | React.PropTypes.bool, 245 | 'Use `leftCalloutView` instead.' 246 | ), 247 | hasRightCallout: deprecatedPropType( 248 | React.PropTypes.bool, 249 | 'Use `rightCalloutView` instead.' 250 | ), 251 | onLeftCalloutPress: deprecatedPropType( 252 | React.PropTypes.func, 253 | 'Use `leftCalloutView` instead.' 254 | ), 255 | onRightCalloutPress: deprecatedPropType( 256 | React.PropTypes.func, 257 | 'Use `rightCalloutView` instead.' 258 | ), 259 | })), 260 | 261 | /** 262 | * Map overlays 263 | * @platform ios 264 | */ 265 | overlays: React.PropTypes.arrayOf(React.PropTypes.shape({ 266 | /** 267 | * Polyline coordinates 268 | */ 269 | coordinates: React.PropTypes.arrayOf(React.PropTypes.shape({ 270 | latitude: React.PropTypes.number.isRequired, 271 | longitude: React.PropTypes.number.isRequired 272 | })), 273 | 274 | /** 275 | * Line attributes 276 | */ 277 | lineWidth: React.PropTypes.number, 278 | strokeColor: ColorPropType, 279 | fillColor: ColorPropType, 280 | 281 | /** 282 | * Overlay id 283 | */ 284 | id: React.PropTypes.string 285 | })), 286 | 287 | /** 288 | * Maximum size of area that can be displayed. 289 | * @platform ios 290 | */ 291 | maxDelta: React.PropTypes.number, 292 | 293 | /** 294 | * Minimum size of area that can be displayed. 295 | * @platform ios 296 | */ 297 | minDelta: React.PropTypes.number, 298 | 299 | /** 300 | * Insets for the map's legal label, originally at bottom left of the map. 301 | * See `EdgeInsetsPropType.js` for more information. 302 | * @platform ios 303 | */ 304 | legalLabelInsets: EdgeInsetsPropType, 305 | 306 | /** 307 | * Callback that is called continuously when the user is dragging the map. 308 | */ 309 | onRegionChange: React.PropTypes.func, 310 | 311 | /** 312 | * Callback that is called once, when the user is done moving the map. 313 | */ 314 | onRegionChangeComplete: React.PropTypes.func, 315 | 316 | /** 317 | * Deprecated. Use annotation onFocus and onBlur instead. 318 | */ 319 | onAnnotationPress: React.PropTypes.func, 320 | 321 | /** 322 | * @platform android 323 | */ 324 | active: React.PropTypes.bool, 325 | }, 326 | 327 | render: function() { 328 | let children = [], {annotations, overlays, followUserLocation} = this.props; 329 | annotations = annotations && annotations.map((annotation: Object) => { 330 | let { 331 | id, 332 | image, 333 | tintColor, 334 | view, 335 | leftCalloutView, 336 | rightCalloutView, 337 | } = annotation; 338 | 339 | if (!view && image && tintColor) { 340 | view = ; 346 | image = undefined; 347 | } 348 | if (view) { 349 | if (image) { 350 | console.warn('`image` and `view` both set on annotation. Image will be ignored.'); 351 | } 352 | var viewIndex = children.length; 353 | children.push(React.cloneElement(view, { 354 | style: [styles.annotationView, view.props.style || {}] 355 | })); 356 | } 357 | if (leftCalloutView) { 358 | var leftCalloutViewIndex = children.length; 359 | children.push(React.cloneElement(leftCalloutView, { 360 | style: [styles.calloutView, leftCalloutView.props.style || {}] 361 | })); 362 | } 363 | if (rightCalloutView) { 364 | var rightCalloutViewIndex = children.length; 365 | children.push(React.cloneElement(rightCalloutView, { 366 | style: [styles.calloutView, rightCalloutView.props.style || {}] 367 | })); 368 | } 369 | 370 | let result = { 371 | ...annotation, 372 | tintColor: tintColor && processColor(tintColor), 373 | image, 374 | viewIndex, 375 | leftCalloutViewIndex, 376 | rightCalloutViewIndex, 377 | view: undefined, 378 | leftCalloutView: undefined, 379 | rightCalloutView: undefined, 380 | }; 381 | result.id = id || encodeURIComponent(JSON.stringify(result)); 382 | result.image = image && resolveAssetSource(image); 383 | return result; 384 | }); 385 | overlays = overlays && overlays.map((overlay: Object) => { 386 | let {id, fillColor, strokeColor} = overlay; 387 | let result = { 388 | ...overlay, 389 | strokeColor: strokeColor && processColor(strokeColor), 390 | fillColor: fillColor && processColor(fillColor), 391 | }; 392 | result.id = id || encodeURIComponent(JSON.stringify(result)); 393 | return result; 394 | }); 395 | 396 | const findByAnnotationId = (annotationId: string) => { 397 | if (!annotations) { 398 | return null; 399 | } 400 | for (let i = 0, l = annotations.length; i < l; i++) { 401 | if (annotations[i].id === annotationId) { 402 | return annotations[i]; 403 | } 404 | } 405 | return null; 406 | }; 407 | 408 | // TODO: these should be separate events, to reduce bridge traffic 409 | let onPress, onAnnotationDragStateChange, onAnnotationFocus, onAnnotationBlur; 410 | if (annotations) { 411 | onPress = (event: Event) => { 412 | if (event.nativeEvent.action === 'annotation-click') { 413 | // TODO: Remove deprecated onAnnotationPress API call later. 414 | this.props.onAnnotationPress && 415 | this.props.onAnnotationPress(event.nativeEvent.annotation); 416 | } else if (event.nativeEvent.action === 'callout-click') { 417 | const annotation = findByAnnotationId(event.nativeEvent.annotationId); 418 | if (annotation) { 419 | // Pass the right function 420 | if (event.nativeEvent.side === 'left' && annotation.onLeftCalloutPress) { 421 | annotation.onLeftCalloutPress(event.nativeEvent); 422 | } else if (event.nativeEvent.side === 'right' && annotation.onRightCalloutPress) { 423 | annotation.onRightCalloutPress(event.nativeEvent); 424 | } 425 | } 426 | } 427 | }; 428 | onAnnotationDragStateChange = (event: Event) => { 429 | const annotation = findByAnnotationId(event.nativeEvent.annotationId); 430 | if (annotation) { 431 | // Update location 432 | annotation.latitude = event.nativeEvent.latitude; 433 | annotation.longitude = event.nativeEvent.longitude; 434 | // Call callback 435 | annotation.onDragStateChange && 436 | annotation.onDragStateChange(event.nativeEvent); 437 | } 438 | }; 439 | onAnnotationFocus = (event: Event) => { 440 | const annotation = findByAnnotationId(event.nativeEvent.annotationId); 441 | if (annotation && annotation.onFocus) { 442 | annotation.onFocus(event.nativeEvent); 443 | } 444 | }; 445 | onAnnotationBlur = (event: Event) => { 446 | const annotation = findByAnnotationId(event.nativeEvent.annotationId); 447 | if (annotation && annotation.onBlur) { 448 | annotation.onBlur(event.nativeEvent); 449 | } 450 | }; 451 | } 452 | 453 | // TODO: these should be separate events, to reduce bridge traffic 454 | if (this.props.onRegionChange || this.props.onRegionChangeComplete) { 455 | var onChange = (event: Event) => { 456 | if (event.nativeEvent.continuous) { 457 | this.props.onRegionChange && 458 | this.props.onRegionChange(event.nativeEvent.region); 459 | } else { 460 | this.props.onRegionChangeComplete && 461 | this.props.onRegionChangeComplete(event.nativeEvent.region); 462 | } 463 | }; 464 | } 465 | 466 | // followUserLocation defaults to true if showUserLocation is set 467 | if (followUserLocation === undefined) { 468 | followUserLocation = this.props.showUserLocation; 469 | } 470 | 471 | return ( 472 | 484 | ); 485 | }, 486 | }); 487 | 488 | const styles = StyleSheet.create({ 489 | annotationView: { 490 | position: 'absolute', 491 | backgroundColor: 'transparent', 492 | }, 493 | calloutView: { 494 | position: 'absolute', 495 | backgroundColor: 'white', 496 | }, 497 | }); 498 | 499 | /** 500 | * Standard iOS MapView pin color constants, to be used with the 501 | * `annotation.tintColor` property. On iOS 8 and earlier these are the 502 | * only supported values when using regular pins. On iOS 9 and later 503 | * you are not obliged to use these, but they are useful for matching 504 | * the standard iOS look and feel. 505 | */ 506 | let PinColors = RCTAMapConstants && RCTAMapConstants.PinColors; 507 | MAMapView.PinColors = PinColors && { 508 | RED: PinColors.RED, 509 | GREEN: PinColors.GREEN, 510 | PURPLE: PinColors.PURPLE, 511 | }; 512 | 513 | const RCTAMap = requireNativeComponent('RCTAMap', MAMapView, { 514 | nativeOnly: { 515 | onAnnotationDragStateChange: true, 516 | onAnnotationFocus: true, 517 | onAnnotationBlur: true, 518 | onChange: true, 519 | onPress: true 520 | } 521 | }); 522 | 523 | module.exports = MAMapView; 524 | -------------------------------------------------------------------------------- /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 | A52931AF1C804A8500CC7002 /* RCTAMap.h in Copy Files */ = {isa = PBXBuildFile; fileRef = A52931AE1C804A8500CC7002 /* RCTAMap.h */; }; 11 | A52931B11C804A8500CC7002 /* RCTAMap.m in Sources */ = {isa = PBXBuildFile; fileRef = A52931B01C804A8500CC7002 /* RCTAMap.m */; }; 12 | A52932191C805AE400CC7002 /* RCTAMapManager.m in Sources */ = {isa = PBXBuildFile; fileRef = A52932181C805AE400CC7002 /* RCTAMapManager.m */; }; 13 | A529321C1C83DA9A00CC7002 /* RCTAMapOverlay.m in Sources */ = {isa = PBXBuildFile; fileRef = A529321B1C83DA9A00CC7002 /* RCTAMapOverlay.m */; }; 14 | A529321F1C83DB7100CC7002 /* RCTAMapAnnotation.m in Sources */ = {isa = PBXBuildFile; fileRef = A529321E1C83DB7100CC7002 /* RCTAMapAnnotation.m */; }; 15 | A52932221C84185000CC7002 /* RCTConvert+AMapKit.m in Sources */ = {isa = PBXBuildFile; fileRef = A52932211C84185000CC7002 /* RCTConvert+AMapKit.m */; }; 16 | A52932841C843C0F00CC7002 /* MAMapKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A52932831C843C0F00CC7002 /* MAMapKit.framework */; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXCopyFilesBuildPhase section */ 20 | A52931A91C804A8500CC7002 /* Copy Files */ = { 21 | isa = PBXCopyFilesBuildPhase; 22 | buildActionMask = 2147483647; 23 | dstPath = "include/$(PRODUCT_NAME)"; 24 | dstSubfolderSpec = 16; 25 | files = ( 26 | A52931AF1C804A8500CC7002 /* RCTAMap.h in Copy Files */, 27 | ); 28 | name = "Copy Files"; 29 | runOnlyForDeploymentPostprocessing = 0; 30 | }; 31 | /* End PBXCopyFilesBuildPhase section */ 32 | 33 | /* Begin PBXFileReference section */ 34 | A52931AB1C804A8500CC7002 /* libRCTAMap.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRCTAMap.a; sourceTree = BUILT_PRODUCTS_DIR; }; 35 | A52931AE1C804A8500CC7002 /* RCTAMap.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RCTAMap.h; sourceTree = ""; }; 36 | A52931B01C804A8500CC7002 /* RCTAMap.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RCTAMap.m; sourceTree = ""; }; 37 | A52932171C805AE400CC7002 /* RCTAMapManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTAMapManager.h; sourceTree = ""; }; 38 | A52932181C805AE400CC7002 /* RCTAMapManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTAMapManager.m; sourceTree = ""; }; 39 | A529321A1C83DA9A00CC7002 /* RCTAMapOverlay.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTAMapOverlay.h; sourceTree = ""; }; 40 | A529321B1C83DA9A00CC7002 /* RCTAMapOverlay.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTAMapOverlay.m; sourceTree = ""; }; 41 | A529321D1C83DB7100CC7002 /* RCTAMapAnnotation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTAMapAnnotation.h; sourceTree = ""; }; 42 | A529321E1C83DB7100CC7002 /* RCTAMapAnnotation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTAMapAnnotation.m; sourceTree = ""; }; 43 | A52932201C84185000CC7002 /* RCTConvert+AMapKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "RCTConvert+AMapKit.h"; sourceTree = ""; }; 44 | A52932211C84185000CC7002 /* RCTConvert+AMapKit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "RCTConvert+AMapKit.m"; sourceTree = ""; }; 45 | A52932831C843C0F00CC7002 /* MAMapKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = MAMapKit.framework; sourceTree = ""; }; 46 | A52932851C843C3200CC7002 /* AMap.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; name = AMap.bundle; path = MAMapKit.framework/AMap.bundle; sourceTree = ""; }; 47 | /* End PBXFileReference section */ 48 | 49 | /* Begin PBXFrameworksBuildPhase section */ 50 | A52931A81C804A8500CC7002 /* Frameworks */ = { 51 | isa = PBXFrameworksBuildPhase; 52 | buildActionMask = 2147483647; 53 | files = ( 54 | A52932841C843C0F00CC7002 /* MAMapKit.framework in Frameworks */, 55 | ); 56 | runOnlyForDeploymentPostprocessing = 0; 57 | }; 58 | /* End PBXFrameworksBuildPhase section */ 59 | 60 | /* Begin PBXGroup section */ 61 | A52931A21C804A8500CC7002 = { 62 | isa = PBXGroup; 63 | children = ( 64 | A52931AD1C804A8500CC7002 /* RCTAMap */, 65 | A52931AC1C804A8500CC7002 /* Products */, 66 | ); 67 | sourceTree = ""; 68 | }; 69 | A52931AC1C804A8500CC7002 /* Products */ = { 70 | isa = PBXGroup; 71 | children = ( 72 | A52931AB1C804A8500CC7002 /* libRCTAMap.a */, 73 | ); 74 | name = Products; 75 | sourceTree = ""; 76 | }; 77 | A52931AD1C804A8500CC7002 /* RCTAMap */ = { 78 | isa = PBXGroup; 79 | children = ( 80 | A52931BD1C804AE800CC7002 /* AMap */, 81 | A52931AE1C804A8500CC7002 /* RCTAMap.h */, 82 | A52931B01C804A8500CC7002 /* RCTAMap.m */, 83 | A52932171C805AE400CC7002 /* RCTAMapManager.h */, 84 | A52932181C805AE400CC7002 /* RCTAMapManager.m */, 85 | A529321A1C83DA9A00CC7002 /* RCTAMapOverlay.h */, 86 | A529321B1C83DA9A00CC7002 /* RCTAMapOverlay.m */, 87 | A529321D1C83DB7100CC7002 /* RCTAMapAnnotation.h */, 88 | A529321E1C83DB7100CC7002 /* RCTAMapAnnotation.m */, 89 | A52932201C84185000CC7002 /* RCTConvert+AMapKit.h */, 90 | A52932211C84185000CC7002 /* RCTConvert+AMapKit.m */, 91 | ); 92 | path = RCTAMap; 93 | sourceTree = ""; 94 | }; 95 | A52931BD1C804AE800CC7002 /* AMap */ = { 96 | isa = PBXGroup; 97 | children = ( 98 | A52932851C843C3200CC7002 /* AMap.bundle */, 99 | A52932831C843C0F00CC7002 /* MAMapKit.framework */, 100 | ); 101 | path = AMap; 102 | sourceTree = ""; 103 | }; 104 | /* End PBXGroup section */ 105 | 106 | /* Begin PBXNativeTarget section */ 107 | A52931AA1C804A8500CC7002 /* RCTAMap */ = { 108 | isa = PBXNativeTarget; 109 | buildConfigurationList = A52931B41C804A8500CC7002 /* Build configuration list for PBXNativeTarget "RCTAMap" */; 110 | buildPhases = ( 111 | A52931A71C804A8500CC7002 /* Sources */, 112 | A52931A81C804A8500CC7002 /* Frameworks */, 113 | A52931A91C804A8500CC7002 /* Copy Files */, 114 | ); 115 | buildRules = ( 116 | ); 117 | dependencies = ( 118 | ); 119 | name = RCTAMap; 120 | productName = RCTAMap; 121 | productReference = A52931AB1C804A8500CC7002 /* libRCTAMap.a */; 122 | productType = "com.apple.product-type.library.static"; 123 | }; 124 | /* End PBXNativeTarget section */ 125 | 126 | /* Begin PBXProject section */ 127 | A52931A31C804A8500CC7002 /* Project object */ = { 128 | isa = PBXProject; 129 | attributes = { 130 | LastUpgradeCheck = 0720; 131 | ORGANIZATIONNAME = creditease; 132 | TargetAttributes = { 133 | A52931AA1C804A8500CC7002 = { 134 | CreatedOnToolsVersion = 7.2; 135 | }; 136 | }; 137 | }; 138 | buildConfigurationList = A52931A61C804A8500CC7002 /* Build configuration list for PBXProject "RCTAMap" */; 139 | compatibilityVersion = "Xcode 3.2"; 140 | developmentRegion = English; 141 | hasScannedForEncodings = 0; 142 | knownRegions = ( 143 | en, 144 | ); 145 | mainGroup = A52931A21C804A8500CC7002; 146 | productRefGroup = A52931AC1C804A8500CC7002 /* Products */; 147 | projectDirPath = ""; 148 | projectRoot = ""; 149 | targets = ( 150 | A52931AA1C804A8500CC7002 /* RCTAMap */, 151 | ); 152 | }; 153 | /* End PBXProject section */ 154 | 155 | /* Begin PBXSourcesBuildPhase section */ 156 | A52931A71C804A8500CC7002 /* Sources */ = { 157 | isa = PBXSourcesBuildPhase; 158 | buildActionMask = 2147483647; 159 | files = ( 160 | A529321C1C83DA9A00CC7002 /* RCTAMapOverlay.m in Sources */, 161 | A529321F1C83DB7100CC7002 /* RCTAMapAnnotation.m in Sources */, 162 | A52932191C805AE400CC7002 /* RCTAMapManager.m in Sources */, 163 | A52931B11C804A8500CC7002 /* RCTAMap.m in Sources */, 164 | A52932221C84185000CC7002 /* RCTConvert+AMapKit.m in Sources */, 165 | ); 166 | runOnlyForDeploymentPostprocessing = 0; 167 | }; 168 | /* End PBXSourcesBuildPhase section */ 169 | 170 | /* Begin XCBuildConfiguration section */ 171 | A52931B21C804A8500CC7002 /* Debug */ = { 172 | isa = XCBuildConfiguration; 173 | buildSettings = { 174 | ALWAYS_SEARCH_USER_PATHS = NO; 175 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 176 | CLANG_CXX_LIBRARY = "libc++"; 177 | CLANG_ENABLE_MODULES = YES; 178 | CLANG_ENABLE_OBJC_ARC = YES; 179 | CLANG_WARN_BOOL_CONVERSION = YES; 180 | CLANG_WARN_CONSTANT_CONVERSION = YES; 181 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 182 | CLANG_WARN_EMPTY_BODY = YES; 183 | CLANG_WARN_ENUM_CONVERSION = YES; 184 | CLANG_WARN_INT_CONVERSION = YES; 185 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 186 | CLANG_WARN_UNREACHABLE_CODE = YES; 187 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 188 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 189 | COPY_PHASE_STRIP = NO; 190 | DEBUG_INFORMATION_FORMAT = dwarf; 191 | ENABLE_STRICT_OBJC_MSGSEND = YES; 192 | ENABLE_TESTABILITY = YES; 193 | GCC_C_LANGUAGE_STANDARD = gnu99; 194 | GCC_DYNAMIC_NO_PIC = NO; 195 | GCC_NO_COMMON_BLOCKS = YES; 196 | GCC_OPTIMIZATION_LEVEL = 0; 197 | GCC_PREPROCESSOR_DEFINITIONS = ( 198 | "DEBUG=1", 199 | "$(inherited)", 200 | ); 201 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 202 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 203 | GCC_WARN_UNDECLARED_SELECTOR = YES; 204 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 205 | GCC_WARN_UNUSED_FUNCTION = YES; 206 | GCC_WARN_UNUSED_VARIABLE = YES; 207 | IPHONEOS_DEPLOYMENT_TARGET = 9.2; 208 | MTL_ENABLE_DEBUG_INFO = YES; 209 | ONLY_ACTIVE_ARCH = YES; 210 | SDKROOT = iphoneos; 211 | }; 212 | name = Debug; 213 | }; 214 | A52931B31C804A8500CC7002 /* Release */ = { 215 | isa = XCBuildConfiguration; 216 | buildSettings = { 217 | ALWAYS_SEARCH_USER_PATHS = NO; 218 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 219 | CLANG_CXX_LIBRARY = "libc++"; 220 | CLANG_ENABLE_MODULES = YES; 221 | CLANG_ENABLE_OBJC_ARC = YES; 222 | CLANG_WARN_BOOL_CONVERSION = YES; 223 | CLANG_WARN_CONSTANT_CONVERSION = YES; 224 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 225 | CLANG_WARN_EMPTY_BODY = YES; 226 | CLANG_WARN_ENUM_CONVERSION = YES; 227 | CLANG_WARN_INT_CONVERSION = YES; 228 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 229 | CLANG_WARN_UNREACHABLE_CODE = YES; 230 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 231 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 232 | COPY_PHASE_STRIP = NO; 233 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 234 | ENABLE_NS_ASSERTIONS = NO; 235 | ENABLE_STRICT_OBJC_MSGSEND = YES; 236 | GCC_C_LANGUAGE_STANDARD = gnu99; 237 | GCC_NO_COMMON_BLOCKS = YES; 238 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 239 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 240 | GCC_WARN_UNDECLARED_SELECTOR = YES; 241 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 242 | GCC_WARN_UNUSED_FUNCTION = YES; 243 | GCC_WARN_UNUSED_VARIABLE = YES; 244 | IPHONEOS_DEPLOYMENT_TARGET = 9.2; 245 | MTL_ENABLE_DEBUG_INFO = NO; 246 | SDKROOT = iphoneos; 247 | VALIDATE_PRODUCT = YES; 248 | }; 249 | name = Release; 250 | }; 251 | A52931B51C804A8500CC7002 /* Debug */ = { 252 | isa = XCBuildConfiguration; 253 | buildSettings = { 254 | ARCHS = "$(ARCHS_STANDARD)"; 255 | FRAMEWORK_SEARCH_PATHS = ( 256 | "$(inherited)", 257 | "$(PROJECT_DIR)/RCTAMap/AMap", 258 | ); 259 | HEADER_SEARCH_PATHS = ( 260 | "$(inherited)", 261 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, 262 | "$(SRCROOT)/../../node_modules/react-native/React/**", 263 | "$(SRCROOT)/../../../react-native/React", 264 | ); 265 | OTHER_LDFLAGS = "-ObjC"; 266 | PRODUCT_NAME = "$(TARGET_NAME)"; 267 | SKIP_INSTALL = YES; 268 | }; 269 | name = Debug; 270 | }; 271 | A52931B61C804A8500CC7002 /* Release */ = { 272 | isa = XCBuildConfiguration; 273 | buildSettings = { 274 | ARCHS = "$(ARCHS_STANDARD)"; 275 | FRAMEWORK_SEARCH_PATHS = ( 276 | "$(inherited)", 277 | "$(PROJECT_DIR)/RCTAMap/AMap", 278 | ); 279 | HEADER_SEARCH_PATHS = ( 280 | "$(inherited)", 281 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, 282 | "$(SRCROOT)/../../node_modules/react-native/React/**", 283 | "$(SRCROOT)/../../../react-native/React", 284 | ); 285 | OTHER_LDFLAGS = "-ObjC"; 286 | PRODUCT_NAME = "$(TARGET_NAME)"; 287 | SKIP_INSTALL = YES; 288 | }; 289 | name = Release; 290 | }; 291 | /* End XCBuildConfiguration section */ 292 | 293 | /* Begin XCConfigurationList section */ 294 | A52931A61C804A8500CC7002 /* Build configuration list for PBXProject "RCTAMap" */ = { 295 | isa = XCConfigurationList; 296 | buildConfigurations = ( 297 | A52931B21C804A8500CC7002 /* Debug */, 298 | A52931B31C804A8500CC7002 /* Release */, 299 | ); 300 | defaultConfigurationIsVisible = 0; 301 | defaultConfigurationName = Release; 302 | }; 303 | A52931B41C804A8500CC7002 /* Build configuration list for PBXNativeTarget "RCTAMap" */ = { 304 | isa = XCConfigurationList; 305 | buildConfigurations = ( 306 | A52931B51C804A8500CC7002 /* Debug */, 307 | A52931B61C804A8500CC7002 /* Release */, 308 | ); 309 | defaultConfigurationIsVisible = 0; 310 | defaultConfigurationName = Release; 311 | }; 312 | /* End XCConfigurationList section */ 313 | }; 314 | rootObject = A52931A31C804A8500CC7002 /* Project object */; 315 | } 316 | -------------------------------------------------------------------------------- /ios/RCTAMap/RCTAMap.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/RCTAMap/RCTAMap.xcodeproj/project.xcworkspace/xcuserdata/yiyang.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiyangest/react-native-yyamap/1303f9c9449e4a1fe0b9fc7a04c95dc17e904125/ios/RCTAMap/RCTAMap.xcodeproj/project.xcworkspace/xcuserdata/yiyang.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /ios/RCTAMap/RCTAMap.xcodeproj/xcuserdata/yiyang.xcuserdatad/xcschemes/RCTAMap.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 34 | 35 | 45 | 46 | 52 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 70 | 71 | 72 | 73 | 75 | 76 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /ios/RCTAMap/RCTAMap.xcodeproj/xcuserdata/yiyang.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | RCTAMap.xcscheme 8 | 9 | orderHint 10 | 16 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | A52931AA1C804A8500CC7002 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /ios/RCTAMap/RCTAMap/AMap/MAMapKit.framework/3.3.0.e5e4560: -------------------------------------------------------------------------------- 1 | 3.3.0.e5e4560 2 | -------------------------------------------------------------------------------- /ios/RCTAMap/RCTAMap/AMap/MAMapKit.framework/AMap.bundle/images/greenPin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiyangest/react-native-yyamap/1303f9c9449e4a1fe0b9fc7a04c95dc17e904125/ios/RCTAMap/RCTAMap/AMap/MAMapKit.framework/AMap.bundle/images/greenPin.png -------------------------------------------------------------------------------- /ios/RCTAMap/RCTAMap/AMap/MAMapKit.framework/AMap.bundle/images/greenPin@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiyangest/react-native-yyamap/1303f9c9449e4a1fe0b9fc7a04c95dc17e904125/ios/RCTAMap/RCTAMap/AMap/MAMapKit.framework/AMap.bundle/images/greenPin@2x.png -------------------------------------------------------------------------------- /ios/RCTAMap/RCTAMap/AMap/MAMapKit.framework/AMap.bundle/images/greenPin@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiyangest/react-native-yyamap/1303f9c9449e4a1fe0b9fc7a04c95dc17e904125/ios/RCTAMap/RCTAMap/AMap/MAMapKit.framework/AMap.bundle/images/greenPin@3x.png -------------------------------------------------------------------------------- /ios/RCTAMap/RCTAMap/AMap/MAMapKit.framework/AMap.bundle/images/greenPin_lift.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiyangest/react-native-yyamap/1303f9c9449e4a1fe0b9fc7a04c95dc17e904125/ios/RCTAMap/RCTAMap/AMap/MAMapKit.framework/AMap.bundle/images/greenPin_lift.png -------------------------------------------------------------------------------- /ios/RCTAMap/RCTAMap/AMap/MAMapKit.framework/AMap.bundle/images/greenPin_lift@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiyangest/react-native-yyamap/1303f9c9449e4a1fe0b9fc7a04c95dc17e904125/ios/RCTAMap/RCTAMap/AMap/MAMapKit.framework/AMap.bundle/images/greenPin_lift@2x.png -------------------------------------------------------------------------------- /ios/RCTAMap/RCTAMap/AMap/MAMapKit.framework/AMap.bundle/images/greenPin_lift@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiyangest/react-native-yyamap/1303f9c9449e4a1fe0b9fc7a04c95dc17e904125/ios/RCTAMap/RCTAMap/AMap/MAMapKit.framework/AMap.bundle/images/greenPin_lift@3x.png -------------------------------------------------------------------------------- /ios/RCTAMap/RCTAMap/AMap/MAMapKit.framework/AMap.bundle/images/pin_shadow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiyangest/react-native-yyamap/1303f9c9449e4a1fe0b9fc7a04c95dc17e904125/ios/RCTAMap/RCTAMap/AMap/MAMapKit.framework/AMap.bundle/images/pin_shadow.png -------------------------------------------------------------------------------- /ios/RCTAMap/RCTAMap/AMap/MAMapKit.framework/AMap.bundle/images/pin_shadow@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiyangest/react-native-yyamap/1303f9c9449e4a1fe0b9fc7a04c95dc17e904125/ios/RCTAMap/RCTAMap/AMap/MAMapKit.framework/AMap.bundle/images/pin_shadow@2x.png -------------------------------------------------------------------------------- /ios/RCTAMap/RCTAMap/AMap/MAMapKit.framework/AMap.bundle/images/pin_shadow@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiyangest/react-native-yyamap/1303f9c9449e4a1fe0b9fc7a04c95dc17e904125/ios/RCTAMap/RCTAMap/AMap/MAMapKit.framework/AMap.bundle/images/pin_shadow@3x.png -------------------------------------------------------------------------------- /ios/RCTAMap/RCTAMap/AMap/MAMapKit.framework/AMap.bundle/images/purplePin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiyangest/react-native-yyamap/1303f9c9449e4a1fe0b9fc7a04c95dc17e904125/ios/RCTAMap/RCTAMap/AMap/MAMapKit.framework/AMap.bundle/images/purplePin.png -------------------------------------------------------------------------------- /ios/RCTAMap/RCTAMap/AMap/MAMapKit.framework/AMap.bundle/images/purplePin@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiyangest/react-native-yyamap/1303f9c9449e4a1fe0b9fc7a04c95dc17e904125/ios/RCTAMap/RCTAMap/AMap/MAMapKit.framework/AMap.bundle/images/purplePin@2x.png -------------------------------------------------------------------------------- /ios/RCTAMap/RCTAMap/AMap/MAMapKit.framework/AMap.bundle/images/purplePin@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiyangest/react-native-yyamap/1303f9c9449e4a1fe0b9fc7a04c95dc17e904125/ios/RCTAMap/RCTAMap/AMap/MAMapKit.framework/AMap.bundle/images/purplePin@3x.png -------------------------------------------------------------------------------- /ios/RCTAMap/RCTAMap/AMap/MAMapKit.framework/AMap.bundle/images/purplePin_lift.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiyangest/react-native-yyamap/1303f9c9449e4a1fe0b9fc7a04c95dc17e904125/ios/RCTAMap/RCTAMap/AMap/MAMapKit.framework/AMap.bundle/images/purplePin_lift.png -------------------------------------------------------------------------------- /ios/RCTAMap/RCTAMap/AMap/MAMapKit.framework/AMap.bundle/images/purplePin_lift@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiyangest/react-native-yyamap/1303f9c9449e4a1fe0b9fc7a04c95dc17e904125/ios/RCTAMap/RCTAMap/AMap/MAMapKit.framework/AMap.bundle/images/purplePin_lift@2x.png -------------------------------------------------------------------------------- /ios/RCTAMap/RCTAMap/AMap/MAMapKit.framework/AMap.bundle/images/purplePin_lift@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiyangest/react-native-yyamap/1303f9c9449e4a1fe0b9fc7a04c95dc17e904125/ios/RCTAMap/RCTAMap/AMap/MAMapKit.framework/AMap.bundle/images/purplePin_lift@3x.png -------------------------------------------------------------------------------- /ios/RCTAMap/RCTAMap/AMap/MAMapKit.framework/AMap.bundle/images/redPin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiyangest/react-native-yyamap/1303f9c9449e4a1fe0b9fc7a04c95dc17e904125/ios/RCTAMap/RCTAMap/AMap/MAMapKit.framework/AMap.bundle/images/redPin.png -------------------------------------------------------------------------------- /ios/RCTAMap/RCTAMap/AMap/MAMapKit.framework/AMap.bundle/images/redPin@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiyangest/react-native-yyamap/1303f9c9449e4a1fe0b9fc7a04c95dc17e904125/ios/RCTAMap/RCTAMap/AMap/MAMapKit.framework/AMap.bundle/images/redPin@2x.png -------------------------------------------------------------------------------- /ios/RCTAMap/RCTAMap/AMap/MAMapKit.framework/AMap.bundle/images/redPin@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiyangest/react-native-yyamap/1303f9c9449e4a1fe0b9fc7a04c95dc17e904125/ios/RCTAMap/RCTAMap/AMap/MAMapKit.framework/AMap.bundle/images/redPin@3x.png -------------------------------------------------------------------------------- /ios/RCTAMap/RCTAMap/AMap/MAMapKit.framework/AMap.bundle/images/redPin_lift.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiyangest/react-native-yyamap/1303f9c9449e4a1fe0b9fc7a04c95dc17e904125/ios/RCTAMap/RCTAMap/AMap/MAMapKit.framework/AMap.bundle/images/redPin_lift.png -------------------------------------------------------------------------------- /ios/RCTAMap/RCTAMap/AMap/MAMapKit.framework/AMap.bundle/images/redPin_lift@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiyangest/react-native-yyamap/1303f9c9449e4a1fe0b9fc7a04c95dc17e904125/ios/RCTAMap/RCTAMap/AMap/MAMapKit.framework/AMap.bundle/images/redPin_lift@2x.png -------------------------------------------------------------------------------- /ios/RCTAMap/RCTAMap/AMap/MAMapKit.framework/AMap.bundle/images/redPin_lift@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiyangest/react-native-yyamap/1303f9c9449e4a1fe0b9fc7a04c95dc17e904125/ios/RCTAMap/RCTAMap/AMap/MAMapKit.framework/AMap.bundle/images/redPin_lift@3x.png -------------------------------------------------------------------------------- /ios/RCTAMap/RCTAMap/AMap/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/RCTAMap/RCTAMap/AMap/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 当从reuse队列里取出时被调用 41 | */ 42 | - (void)prepareForReuse; 43 | 44 | /*! 45 | @brief 关联的annotation 46 | */ 47 | @property (nonatomic, strong) id annotation; 48 | 49 | /*! 50 | @brief 显示的image 51 | */ 52 | @property (nonatomic, strong) UIImage *image; 53 | 54 | /*! 55 | @brief 默认情况下,annotation view的中心位于annotation的坐标位置,可以设置centerOffset改变view的位置,正的偏移使view朝右下方移动,负的朝左上方,单位是像素 56 | */ 57 | @property (nonatomic) CGPoint centerOffset; 58 | 59 | /*! 60 | @brief 默认情况下,弹出的气泡位于view正中上方,可以设置calloutOffset改变view的位置,正的偏移使view朝右下方移动,负的朝左上方,单位是像素 61 | */ 62 | @property (nonatomic) CGPoint calloutOffset; 63 | 64 | /*! 65 | @brief 默认为YES,当为NO时view忽略触摸事件 66 | */ 67 | @property (nonatomic, getter=isEnabled) BOOL enabled; 68 | 69 | /*! 70 | @brief annotationView是否突出显示(一般不需要手动设置) 71 | */ 72 | @property (nonatomic, getter=isHighlighted) BOOL highlighted; 73 | 74 | /*! 75 | @brief 设置是否处于选中状态, 外部如果要选中请使用mapView的selectAnnotation方法。 76 | */ 77 | @property (nonatomic, getter=isSelected) BOOL selected; 78 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated; 79 | 80 | /*! 81 | @brief 设置是否可以显示callout,默认为NO 82 | */ 83 | @property (nonatomic) BOOL canShowCallout; 84 | 85 | /*! 86 | @brief 显示在气泡左侧的view 87 | */ 88 | @property (retain, nonatomic) UIView *leftCalloutAccessoryView; 89 | 90 | /*! 91 | @brief 显示在气泡右侧的view 92 | */ 93 | @property (retain, nonatomic) UIView *rightCalloutAccessoryView; 94 | 95 | /*! 96 | @brief 是否支持拖动,默认为NO 97 | */ 98 | @property (nonatomic, getter=isDraggable) BOOL draggable; 99 | 100 | /*! 101 | @brief 当前view的拖动状态 102 | */ 103 | @property (nonatomic) MAAnnotationViewDragState dragState; 104 | - (void)setDragState:(MAAnnotationViewDragState)newDragState animated:(BOOL)animated; 105 | 106 | @end 107 | -------------------------------------------------------------------------------- /ios/RCTAMap/RCTAMap/AMap/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/RCTAMap/RCTAMap/AMap/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 | - (id)initWithCircle:(MACircle *)circle; 23 | 24 | /*! 25 | @brief 关联的MAcirlce model 26 | */ 27 | @property (nonatomic, readonly) MACircle *circle; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /ios/RCTAMap/RCTAMap/AMap/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/RCTAMap/RCTAMap/AMap/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/RCTAMap/RCTAMap/AMap/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 | typedef struct { 17 | CLLocationCoordinate2D northEast; 18 | CLLocationCoordinate2D southWest; 19 | } MACoordinateBounds; 20 | 21 | typedef struct { 22 | CLLocationDegrees latitudeDelta; 23 | CLLocationDegrees longitudeDelta; 24 | } MACoordinateSpan; 25 | 26 | typedef struct { 27 | CLLocationCoordinate2D center; 28 | MACoordinateSpan span; 29 | } MACoordinateRegion; 30 | 31 | static inline MACoordinateBounds MACoordinateBoundsMake(CLLocationCoordinate2D northEast,CLLocationCoordinate2D southWest) 32 | { 33 | return (MACoordinateBounds){northEast, southWest}; 34 | } 35 | 36 | static inline MACoordinateSpan MACoordinateSpanMake(CLLocationDegrees latitudeDelta, CLLocationDegrees longitudeDelta) 37 | { 38 | return (MACoordinateSpan){latitudeDelta, longitudeDelta}; 39 | } 40 | 41 | static inline MACoordinateRegion MACoordinateRegionMake(CLLocationCoordinate2D centerCoordinate, MACoordinateSpan span) 42 | { 43 | return (MACoordinateRegion){centerCoordinate, span}; 44 | } 45 | 46 | /*! 47 | @brief 生成一个新的MACoordinateRegion 48 | @param centerCoordinate 中心点坐标 49 | @param latitudinalMeters 垂直跨度(单位 米) 50 | @param longitudinalMeters 水平跨度(单位 米) 51 | @return 新的MACoordinateRegion 52 | */ 53 | extern MACoordinateRegion MACoordinateRegionMakeWithDistance(CLLocationCoordinate2D centerCoordinate, CLLocationDistance latitudinalMeters, CLLocationDistance longitudinalMeters); 54 | 55 | /** 平面投影坐标结构定义 */ 56 | typedef struct { 57 | double x; 58 | double y; 59 | } MAMapPoint; 60 | 61 | /** 平面投影大小结构定义 */ 62 | typedef struct { 63 | double width; 64 | double height; 65 | } MAMapSize; 66 | 67 | /** 平面投影矩形结构定义 */ 68 | typedef struct { 69 | MAMapPoint origin; 70 | MAMapSize size; 71 | } MAMapRect; 72 | 73 | /** 74 | 比例关系:MAZoomScale = Screen Point / MAMapPoint, 当MAZoomScale = 1时, 1 screen point = 1 MAMapPoint, 当MAZoomScale = 0.5时, 1 screen point = 2 MAMapPoints 75 | */ 76 | typedef double MAZoomScale; 77 | 78 | /*! 79 | const常量定义 80 | */ 81 | extern const MAMapSize MAMapSizeWorld; 82 | 83 | extern const MAMapRect MAMapRectWorld; 84 | 85 | extern const MAMapRect MAMapRectNull; 86 | 87 | extern const MAMapRect MAMapRectZero; 88 | 89 | /*! 90 | @brief 经纬度坐标转平面投影坐标 91 | @param coordinate 要转化的经纬度坐标 92 | @return 平面投影坐标 93 | */ 94 | extern MAMapPoint MAMapPointForCoordinate(CLLocationCoordinate2D coordinate); 95 | 96 | /*! 97 | @brief 平面投影坐标转经纬度坐标 98 | @param mapPoint 要转化的平面投影坐标 99 | @return 经纬度坐标 100 | */ 101 | extern CLLocationCoordinate2D MACoordinateForMapPoint(MAMapPoint mapPoint); 102 | 103 | /*! 104 | @brief 平面投影矩形转region 105 | @param mapPoint 要转化的平面投影矩形 106 | @return region 107 | */ 108 | extern MACoordinateRegion MACoordinateRegionForMapRect(MAMapRect rect); 109 | 110 | /*! 111 | @brief region转平面投影矩形 112 | @param region 要转化的region 113 | @return 平面投影矩形 114 | */ 115 | extern MAMapRect MAMapRectForCoordinateRegion(MACoordinateRegion region); 116 | 117 | /*! 118 | @brief 单位投影的距离 119 | */ 120 | extern CLLocationDistance MAMetersPerMapPointAtLatitude(CLLocationDegrees latitude); 121 | 122 | /*! 123 | @brief 1米对应的投影 124 | */ 125 | extern double MAMapPointsPerMeterAtLatitude(CLLocationDegrees latitude); 126 | 127 | /*! 128 | @brief 投影两点之间的距离 129 | */ 130 | extern CLLocationDistance MAMetersBetweenMapPoints(MAMapPoint a, MAMapPoint b); 131 | 132 | /*! 133 | @brief 经纬度间的面积(单位 平方米) 134 | */ 135 | extern double MAAreaBetweenCoordinates(CLLocationCoordinate2D northEast, CLLocationCoordinate2D southWest); 136 | 137 | /*! 138 | @brief 获取Inset后的MAMapRect 139 | */ 140 | extern MAMapRect MAMapRectInset(MAMapRect rect, double dx, double dy); 141 | 142 | /*! 143 | @brief 合并两个MAMapRect 144 | */ 145 | extern MAMapRect MAMapRectUnion(MAMapRect rect1, MAMapRect rect2); 146 | 147 | /*! 148 | @brief 判断size1是否包含size2 149 | */ 150 | extern BOOL MAMapSizeContainsSize(MAMapSize size1, MAMapSize size2); 151 | 152 | /*! 153 | @brief 判断点是否在矩形内 154 | */ 155 | extern BOOL MAMapRectContainsPoint(MAMapRect rect, MAMapPoint point); 156 | 157 | /*! 158 | @brief 判断两矩形是否相交 159 | */ 160 | extern BOOL MAMapRectIntersectsRect(MAMapRect rect1, MAMapRect rect2); 161 | 162 | /*! 163 | @brief 判断矩形rect1是否包含矩形rect2 164 | */ 165 | extern BOOL MAMapRectContainsRect(MAMapRect rect1, MAMapRect rect2); 166 | 167 | /*! 168 | @brief 判断点是否在圆内 169 | */ 170 | extern BOOL MACircleContainsPoint(MAMapPoint point, MAMapPoint center, double radius); 171 | 172 | /*! 173 | @brief 判断经纬度点是否在圆内 174 | */ 175 | extern BOOL MACircleContainsCoordinate(CLLocationCoordinate2D point, CLLocationCoordinate2D center, double radius); 176 | 177 | /*! 178 | @brief 判断点是否在多边形内 179 | */ 180 | extern BOOL MAPolygonContainsPoint(MAMapPoint point, MAMapPoint *polygon, NSUInteger count); 181 | /*! 182 | @brief 判断经纬度点是否在多边形内 183 | */ 184 | extern BOOL MAPolygonContainsCoordinate(CLLocationCoordinate2D point, CLLocationCoordinate2D *polygon, NSUInteger count); 185 | 186 | /*! 187 | 获取在lineStart和lineEnd组成的线段上距离point距离最近的点. 188 | 189 | @param lineStart 线段起点. 190 | @param lineEnd 线段终点. 191 | @param point 测试点. 192 | @return 距离point最近的点坐标. 193 | */ 194 | extern MAMapPoint MAGetNearestMapPointFromLine(MAMapPoint lineStart, MAMapPoint lineEnd, MAMapPoint point); 195 | 196 | /*! 197 | 获取墨卡托投影切块回调block,如果是无效的映射,则返回(-1, -1, 0, 0, 0, 0). 198 | 199 | @param offsetX 左上点距离所属tile的位移X, 单位像素. 200 | @param offsetY 左上点距离所属tile的位移Y, 单位像素. 201 | @param minX 覆盖tile的最小x. 202 | @param maxX 覆盖tile的最大x. 203 | @param minY 覆盖tile的最小y. 204 | @param maxY 覆盖tile的最大y. 205 | */ 206 | typedef void (^AMapTileProjectionBlock)(int offsetX, int offsetY, int minX, int maxX, int minY, int maxY); 207 | 208 | /*! 209 | 根据所给经纬度区域获取墨卡托投影切块信息. 210 | 211 | @param bounds 经纬度区域. 212 | @param levelOfDetails 对应缩放级别, 取值0-20。 213 | @param tileProjection 返回的切块信息block. 214 | */ 215 | extern void MAGetTileProjectionFromBounds(MACoordinateBounds bounds, int levelOfDetails, AMapTileProjectionBlock tileProjection); 216 | 217 | 218 | static inline MAMapPoint MAMapPointMake(double x, double y) 219 | { 220 | return (MAMapPoint){x, y}; 221 | } 222 | 223 | static inline MAMapSize MAMapSizeMake(double width, double height) 224 | { 225 | return (MAMapSize){width, height}; 226 | } 227 | 228 | static inline MAMapRect MAMapRectMake(double x, double y, double width, double height) 229 | { 230 | return (MAMapRect){MAMapPointMake(x, y), MAMapSizeMake(width, height)}; 231 | } 232 | 233 | static inline double MAMapRectGetMinX(MAMapRect rect) 234 | { 235 | return rect.origin.x; 236 | } 237 | 238 | static inline double MAMapRectGetMinY(MAMapRect rect) 239 | { 240 | return rect.origin.y; 241 | } 242 | 243 | static inline double MAMapRectGetMidX(MAMapRect rect) 244 | { 245 | return rect.origin.x + rect.size.width / 2.0; 246 | } 247 | 248 | static inline double MAMapRectGetMidY(MAMapRect rect) 249 | { 250 | return rect.origin.y + rect.size.height / 2.0; 251 | } 252 | 253 | static inline double MAMapRectGetMaxX(MAMapRect rect) 254 | { 255 | return rect.origin.x + rect.size.width; 256 | } 257 | 258 | static inline double MAMapRectGetMaxY(MAMapRect rect) 259 | { 260 | return rect.origin.y + rect.size.height; 261 | } 262 | 263 | static inline double MAMapRectGetWidth(MAMapRect rect) 264 | { 265 | return rect.size.width; 266 | } 267 | 268 | static inline double MAMapRectGetHeight(MAMapRect rect) 269 | { 270 | return rect.size.height; 271 | } 272 | 273 | static inline BOOL MAMapPointEqualToPoint(MAMapPoint point1, MAMapPoint point2) { 274 | return point1.x == point2.x && point1.y == point2.y; 275 | } 276 | 277 | static inline BOOL MAMapSizeEqualToSize(MAMapSize size1, MAMapSize size2) { 278 | return size1.width == size2.width && size1.height == size2.height; 279 | } 280 | 281 | static inline BOOL MAMapRectEqualToRect(MAMapRect rect1, MAMapRect rect2) { 282 | return 283 | MAMapPointEqualToPoint(rect1.origin, rect2.origin) && 284 | MAMapSizeEqualToSize(rect1.size, rect2.size); 285 | } 286 | 287 | static inline BOOL MAMapRectIsNull(MAMapRect rect) { 288 | return isinf(rect.origin.x) || isinf(rect.origin.y); 289 | } 290 | 291 | static inline BOOL MAMapRectIsEmpty(MAMapRect rect) { 292 | return MAMapRectIsNull(rect) || (rect.size.width == 0.0 && rect.size.height == 0.0); 293 | } 294 | 295 | static inline NSString *MAStringFromMapPoint(MAMapPoint point) { 296 | return [NSString stringWithFormat:@"{%.1f, %.1f}", point.x, point.y]; 297 | } 298 | 299 | static inline NSString *MAStringFromMapSize(MAMapSize size) { 300 | return [NSString stringWithFormat:@"{%.1f, %.1f}", size.width, size.height]; 301 | } 302 | 303 | static inline NSString *MAStringFromMapRect(MAMapRect rect) { 304 | return [NSString stringWithFormat:@"{%@, %@}", MAStringFromMapPoint(rect.origin), MAStringFromMapSize(rect.size)]; 305 | } 306 | 307 | /// 坐标类型枚举 308 | typedef NS_ENUM(NSUInteger, MACoordinateType) 309 | { 310 | MACoordinateTypeBaidu = 0, // Baidu 311 | MACoordinateTypeMapBar, // MapBar 312 | MACoordinateTypeMapABC, // MapABC 313 | MACoordinateTypeSoSoMap, // SoSoMap 314 | MACoordinateTypeAliYun, // AliYun 315 | MACoordinateTypeGoogle, // Google 316 | MACoordinateTypeGPS, // GPS 317 | }; 318 | 319 | /** 320 | * 转换目标经纬度为高德坐标系 321 | * 322 | * @param coordinate 待转换的经纬度 323 | * @param type 坐标系类型 324 | * 325 | * @return 高德坐标系经纬度 326 | */ 327 | extern CLLocationCoordinate2D MACoordinateConvert(CLLocationCoordinate2D coordinate, MACoordinateType type); 328 | 329 | 330 | #ifdef __cplusplus 331 | } 332 | #endif 333 | 334 | @interface NSValue (NSValueMAGeometryExtensions) 335 | 336 | + (NSValue *)valueWithMAMapPoint:(MAMapPoint)mapPoint; 337 | + (NSValue *)valueWithMAMapSize:(MAMapSize)mapSize; 338 | + (NSValue *)valueWithMAMapRect:(MAMapRect)mapRect; 339 | + (NSValue *)valueWithMACoordinate:(CLLocationCoordinate2D)coordinate; 340 | 341 | - (MAMapPoint)MAMapPointValue; 342 | - (MAMapSize)MAMapSizeValue; 343 | - (MAMapRect)MAMapRectValue; 344 | - (CLLocationCoordinate2D)MACoordinateValue; 345 | 346 | @end 347 | -------------------------------------------------------------------------------- /ios/RCTAMap/RCTAMap/AMap/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/RCTAMap/RCTAMap/AMap/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 | - (id)initWithGroundOverlay:(MAGroundOverlay *)groundOverlay; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /ios/RCTAMap/RCTAMap/AMap/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 | -------------------------------------------------------------------------------- /ios/RCTAMap/RCTAMap/AMap/MAMapKit.framework/Headers/MAHeatMapTileOverlay.h: -------------------------------------------------------------------------------- 1 | // 2 | // MAHeatMapTileOverlay.h 3 | // test2D 4 | // 5 | // Created by xiaoming han on 15/4/21. 6 | // Copyright (c) 2015年 AutoNavi. All rights reserved. 7 | // 8 | 9 | #import "MATileOverlay.h" 10 | 11 | /** 12 | * 热力图节点 13 | */ 14 | @interface MAHeatMapNode : NSObject 15 | 16 | @property (nonatomic, assign) CLLocationCoordinate2D coordinate; 17 | @property (nonatomic, assign) float intensity; 18 | 19 | @end 20 | 21 | /** 22 | * 热力图渐变属性 23 | */ 24 | @interface MAHeatMapGradient : NSObject 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/RCTAMap/RCTAMap/AMap/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 | 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 | #import 38 | #import 39 | #import 40 | #import 41 | 42 | #pragma mark - deprecated 43 | 44 | #import 45 | #import 46 | #import 47 | #import 48 | #import 49 | #import 50 | #import 51 | 52 | -------------------------------------------------------------------------------- /ios/RCTAMap/RCTAMap/AMap/MAMapKit.framework/Headers/MAMapServices.h: -------------------------------------------------------------------------------- 1 | // 2 | // MAMapServices.h 3 | // MapKit_static 4 | // 5 | // Created by AutoNavi. 6 | // Copyright (c) 2013年 AutoNavi. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface MAMapServices : NSObject 12 | 13 | + (MAMapServices *)sharedServices; 14 | 15 | /// API Key, 在创建MAMapView之前需要先绑定key. 16 | @property (nonatomic, copy) NSString *apiKey; 17 | 18 | /// SDK 版本号, 形式如v3.0.0 19 | @property (nonatomic, readonly) NSString *SDKVersion; 20 | 21 | /** 22 | * 是否启用崩溃日志上传。默认为YES。 23 | * 开启崩溃日志上传有助于我们更好的了解SDK的状况,可以帮助我们持续优化和改进SDK。 24 | * 需要注意的是,我是通过设置NSUncaughtExceptionHandler来捕获异常的,如果您的APP中使用了其他手机崩溃日志的SDK,或者自己有设置NSUncaughtExceptionHandler的话,请保证MAMapServices的初始化是在其他设置NSUncaughtExceptionHandler操作之后进行的,我们的handler会再处理完异常后调用前一次设置的handler,保证之前设置的handler会被执行。 25 | */ 26 | @property (nonatomic, assign) BOOL crashReportEnabled; 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /ios/RCTAMap/RCTAMap/AMap/MAMapKit.framework/Headers/MAMapURLSearch.h: -------------------------------------------------------------------------------- 1 | // 2 | // MAMapURLSearch.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 "MAMapURLSearchConfig.h" 11 | 12 | /// 调起高德地图URL进行搜索,若是调起失败,可使用`+ (void)getLatestAMapApp;`方法获取最新版高德地图app. 13 | @interface MAMapURLSearch : NSObject 14 | 15 | /// 打开高德地图AppStore页面 16 | + (void)getLatestAMapApp; 17 | 18 | /** 19 | * 调起高德地图app驾车导航. 20 | * 21 | * @param config 配置参数. 22 | * 23 | * @return 是否成功.若为YES则成功调起,若为NO则无法调起. 24 | */ 25 | + (BOOL)openAMapNavigation:(MANaviConfig *)config; 26 | 27 | /** 28 | * 调起高德地图app进行路径规划. 29 | * 30 | * @param config 配置参数. 31 | * 32 | * @return 是否成功. 33 | */ 34 | + (BOOL)openAMapRouteSearch:(MARouteConfig *)config; 35 | 36 | /** 37 | * 调起高德地图app进行POI搜索. 38 | * 39 | * @param config 配置参数. 40 | * 41 | * @return 是否成功. 42 | */ 43 | + (BOOL)openAMapPOISearch:(MAPOIConfig *)config; 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /ios/RCTAMap/RCTAMap/AMap/MAMapKit.framework/Headers/MAMapURLSearchConfig.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 "MAMapURLSearchType.h" 12 | 13 | /// 导航配置信息 14 | @interface MANaviConfig : 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) MADrivingStrategy strategy; 27 | 28 | @end 29 | 30 | #pragma mark - 31 | 32 | /// 路径搜索配置信息 33 | @interface MARouteConfig : 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) MADrivingStrategy drivingStrategy; 49 | 50 | /// 公交策略 51 | @property (nonatomic, assign) MATransitStrategy transitStrategy; 52 | 53 | /// 路径规划类型 54 | @property (nonatomic, assign) MARouteSearchType routeType; 55 | 56 | @end 57 | 58 | #pragma mark - 59 | 60 | /// POI搜索配置信息 61 | @interface MAPOIConfig : 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/RCTAMap/RCTAMap/AMap/MAMapKit.framework/Headers/MAMapURLSearchType.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 | #ifndef MAMapKitNew_MAMapURLSearchType_h 10 | #define MAMapKitNew_MAMapURLSearchType_h 11 | 12 | /// 驾车策略 13 | typedef NS_ENUM(NSInteger, MADrivingStrategy) 14 | { 15 | MADrivingStrategyFastest = 0, //速度最快 16 | MADrivingStrategyMinFare = 1, //避免收费 17 | MADrivingStrategyShortest = 2, //距离最短 18 | 19 | MADrivingStrategyNoHighways = 3, //不走高速 20 | MADrivingStrategyAvoidCongestion = 4, //躲避拥堵 21 | 22 | MADrivingStrategyAvoidHighwaysAndFare = 5, //不走高速且避免收费 23 | MADrivingStrategyAvoidHighwaysAndCongestion = 6, //不走高速且躲避拥堵 24 | MADrivingStrategyAvoidFareAndCongestion = 7, //躲避收费和拥堵 25 | MADrivingStrategyAvoidHighwaysAndFareAndCongestion = 8 //不走高速躲避收费和拥堵 26 | }; 27 | 28 | /// 公交策略 29 | typedef NS_ENUM(NSInteger, MATransitStrategy) 30 | { 31 | MATransitStrategyFastest = 0,//最快捷 32 | MATransitStrategyMinFare = 1,//最经济 33 | MATransitStrategyMinTransfer = 2,//最少换乘 34 | MATransitStrategyMinWalk = 3,//最少步行 35 | MATransitStrategyMostComfortable = 4,//最舒适 36 | MATransitStrategyAvoidSubway = 5,//不乘地铁 37 | }; 38 | 39 | /// 路径规划类型 40 | typedef NS_ENUM(NSInteger, MARouteSearchType) 41 | { 42 | MARouteSearchTypeDriving = 0, //驾车 43 | MARouteSearchTypeTransit = 1, //公交 44 | MARouteSearchTypeWalking = 2, //步行 45 | }; 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /ios/RCTAMap/RCTAMap/AMap/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 | #pragma mark - Logo 81 | 82 | /*! 83 | @brief logo位置, 必须在mapView.bounds之内,否则会被忽略 84 | */ 85 | @property (nonatomic) CGPoint logoCenter; 86 | 87 | /*! 88 | @brief logo的宽高 89 | */ 90 | @property (nonatomic, readonly) CGSize logoSize; 91 | 92 | #pragma mark - Compass 93 | 94 | /*! 95 | @brief 是否显示罗盘,默认为YES 96 | */ 97 | @property (nonatomic, assign) BOOL showsCompass; 98 | 99 | /*! 100 | @brief 罗盘原点位置 101 | */ 102 | @property (nonatomic) CGPoint compassOrigin; 103 | 104 | /*! 105 | @brief 罗盘的宽高 106 | */ 107 | @property (nonatomic, readonly) CGSize compassSize; 108 | 109 | /** 110 | * 设置罗盘的图像 111 | * 112 | * @param image 当设置图像非空时,指南针将呈现该图像,如果为nil时,则恢复默认。 113 | */ 114 | - (void)setCompassImage:(UIImage *)image; 115 | 116 | #pragma mark - Scale 117 | 118 | /*! 119 | @brief 是否显示比例尺,默认为YES 120 | */ 121 | @property (nonatomic) BOOL showsScale; 122 | 123 | /*! 124 | @brief 比例尺原点位置 125 | */ 126 | @property (nonatomic) CGPoint scaleOrigin; 127 | 128 | /*! 129 | @brief 比例尺的最大宽高 130 | */ 131 | @property (nonatomic, readonly) CGSize scaleSize; 132 | 133 | 134 | /*! 135 | @brief 在当前缩放级别下, 基于地图中心点, 1 screen point 对应的距离(单位是米). 支持KVO。 136 | @return 对应的距离(单位是米) 137 | */ 138 | @property (nonatomic, readonly) CGFloat metersPerPointForCurrentZoomLevel; 139 | 140 | /*! 141 | @brief 在指定的缩放级别下, 基于地图中心点, 1 screen point 对应的距离(单位是米). 142 | @param zoomLevel 指定的缩放级别, 在[minZoomLevel, maxZoomLevel]范围内. 143 | @return 对应的距离(单位是米) 144 | */ 145 | - (CGFloat)metersPerPointForZoomLevel:(CGFloat)zoomLevel; 146 | 147 | #pragma mark - Movement 148 | 149 | /*! 150 | @brief 当前地图的中心点经纬度坐标,改变该值时,地图缩放级别不会发生变化 151 | */ 152 | @property (nonatomic, assign) CLLocationCoordinate2D centerCoordinate; 153 | 154 | /*! 155 | @brief 设定地图中心点经纬度 156 | @param coordinate 要设定的地图中心点经纬度 157 | @param animated 是否采用动画效果 158 | */ 159 | - (void)setCenterCoordinate:(CLLocationCoordinate2D)centerCoordinate animated:(BOOL)animated; 160 | 161 | /*! 162 | @brief 当前地图的经纬度范围,设定的该范围可能会被调整为适合地图窗口显示的范围 163 | */ 164 | @property (nonatomic, assign) MACoordinateRegion region; 165 | 166 | /*! 167 | @brief 设定当前地图的region 168 | @param region 要设定的地图范围,用经纬度的方式表示 169 | @param animated 是否采用动画效果 170 | */ 171 | - (void)setRegion:(MACoordinateRegion)region animated:(BOOL)animated; 172 | 173 | /*! 174 | @brief 根据当前地图视图frame的大小调整region范围,返回适合当前地图frame的region,调整过程中当前地图的中心点不会改变 175 | @param region 要调整的经纬度范围 176 | @return 调整后的经纬度范围 177 | */ 178 | - (MACoordinateRegion)regionThatFits:(MACoordinateRegion)region; 179 | 180 | /*! 181 | @brief 当前地图可见范围的map rect 182 | */ 183 | @property (nonatomic, assign) MAMapRect visibleMapRect; 184 | 185 | /*! 186 | @brief 设置当前地图可见范围的map rect 187 | @param mapRect 要调整的map rect 188 | @param animated 是否采用动画效果 189 | */ 190 | - (void)setVisibleMapRect:(MAMapRect)mapRect animated:(BOOL)animated; 191 | 192 | /*! 193 | @brief 设置当前地图可见范围的map rect 194 | @param mapRect 要设置的map rect 195 | @param insets 嵌入边界 196 | @param animated 是否采用动画效果 197 | */ 198 | - (void)setVisibleMapRect:(MAMapRect)mapRect edgePadding:(UIEdgeInsets)insets animated:(BOOL)animated; 199 | 200 | /*! 201 | @brief 调整map rect使其适合地图窗口显示的范围 202 | @param mapRect 要调整的map rect 203 | @return 调整后的maprect 204 | */ 205 | - (MAMapRect)mapRectThatFits:(MAMapRect)mapRect; 206 | 207 | /*! 208 | @brief 调整map rect使其适合地图窗口显示的范围 209 | @param mapRect 要调整的map rect 210 | @param insets 嵌入边界 211 | @return 调整后的map rect 212 | */ 213 | - (MAMapRect)mapRectThatFits:(MAMapRect)mapRect edgePadding:(UIEdgeInsets)insets; 214 | 215 | #pragma mark - Zoom 216 | 217 | /*! 218 | @brief 缩放级别 219 | */ 220 | @property (nonatomic, assign) double zoomLevel; 221 | 222 | /*! 223 | @brief 最小缩放级别 224 | */ 225 | @property (nonatomic, readonly) double minZoomLevel; 226 | 227 | /*! 228 | @brief 最大缩放级别 229 | */ 230 | @property (nonatomic, readonly) double maxZoomLevel; 231 | 232 | /*! 233 | @brief 设置当前地图的缩放级别zoom level 234 | @param zoomLevel 要设置的zoom level 235 | @param animated 是否采用动画效果 236 | */ 237 | - (void)setZoomLevel:(double)newZoomLevel animated:(BOOL)animated; 238 | 239 | /*! 240 | @brief 设置当前地图的缩放级别zoom level 241 | @param zoomLevel 要设置的zoom level 242 | @param pivot 指定缩放的锚点,屏幕坐标 243 | @param animated 是否采用动画效果 244 | */ 245 | - (void)setZoomLevel:(double)newZoomLevel atPivot:(CGPoint)pivot animated:(BOOL)animated; 246 | 247 | #pragma mark - Conversions 248 | 249 | /*! 250 | @brief 将经纬度坐标转化为相对于指定view的坐标 251 | @param coordinate 要转化的经纬度坐标 252 | @param view 指定的坐标系统的view 253 | */ 254 | - (CGPoint)convertCoordinate:(CLLocationCoordinate2D)coordinate toPointToView:(UIView *)view; 255 | 256 | /*! 257 | @brief 将相对于view的坐标转化为经纬度坐标 258 | @param point 要转化的坐标 259 | @param view point所基于的view 260 | return 转化后的经纬度坐标 261 | */ 262 | - (CLLocationCoordinate2D)convertPoint:(CGPoint)point toCoordinateFromView:(UIView *)view; 263 | 264 | /*! 265 | @brief 将map rect 转化为相对于view的坐标 266 | @param region 要转化的 map rect 267 | @param view 返回值所基于的view 268 | return 基于view的坐标 269 | */ 270 | - (CGRect)convertRegion:(MACoordinateRegion)region toRectToView:(UIView *)view; 271 | 272 | /*! 273 | @brief 将相对于view的rectangle转化为region 274 | @param rect 要转化的rectangle 275 | @param view rectangle所基于的view 276 | return 转化后的region 277 | */ 278 | - (MACoordinateRegion)convertRect:(CGRect)rect toRegionFromView:(UIView *)view; 279 | 280 | #pragma mark - UserLocation 281 | 282 | /*! 283 | @brief 是否显示用户位置 284 | */ 285 | @property (nonatomic, assign, getter = isShowsUserLocation) BOOL showsUserLocation; 286 | 287 | /*! 288 | @brief 当前的位置数据 289 | */ 290 | @property (nonatomic, readonly) MAUserLocation *userLocation; 291 | 292 | /*! 293 | @brief 定位用户位置的模式 294 | */ 295 | @property (nonatomic) MAUserTrackingMode userTrackingMode; 296 | 297 | /*! 298 | @brief 设置追踪用户位置的模式 299 | @param mode 要使用的模式 300 | @param animated 是否采用动画效果 301 | */ 302 | - (void)setUserTrackingMode:(MAUserTrackingMode)mode animated:(BOOL)animated; 303 | 304 | /*! 305 | @brief 当前位置再地图中是否可见 306 | */ 307 | @property (nonatomic, readonly, getter=isUserLocationVisible) BOOL userLocationVisible; 308 | 309 | /*! 310 | @brief 设定UserLocationView样式。如果用户自定义了userlocation的annotationView,或者该annotationView还未添加到地图上,此方法将不起作用。 311 | @param representation 样式信息对象 312 | */ 313 | - (void)updateUserLocationRepresentation:(MAUserLocationRepresentation *)representation; 314 | 315 | #pragma mark - Annotations 316 | 317 | /*! 318 | @brief 标注数组 319 | */ 320 | @property (nonatomic, readonly) NSArray *annotations; 321 | 322 | /*! 323 | @brief 向地图窗口添加标注,需要实现MAMapViewDelegate的-mapView:viewForAnnotation:函数来生成标注对应的View 324 | @param annotation 要添加的标注 325 | */ 326 | - (void)addAnnotation:(id )annotation; 327 | 328 | /*! 329 | @brief 向地图窗口添加一组标注,需要实现MAMapViewDelegate的-mapView:viewForAnnotation:函数来生成标注对应的View 330 | @param annotations 要添加的标注数组 331 | */ 332 | - (void)addAnnotations:(NSArray *)annotations; 333 | 334 | /*! 335 | @brief 移除标注 336 | @param annotation 要移除的标注 337 | */ 338 | - (void)removeAnnotation:(id )annotation; 339 | 340 | /*! 341 | @brief 移除一组标注 342 | @param annotation 要移除的标注数组 343 | */ 344 | - (void)removeAnnotations:(NSArray *)annotations; 345 | 346 | /*! 347 | @brief 根据标注数据过去标注view 348 | @param annotation 标注数据 349 | @return 对应的标注view 350 | */ 351 | - (MAAnnotationView *)viewForAnnotation:(id )annotation; 352 | 353 | /*! 354 | @brief 从复用内存池中获取制定复用标识的annotation view 355 | @param identifier 复用标识 356 | @return annotation view 357 | */ 358 | - (MAAnnotationView *)dequeueReusableAnnotationViewWithIdentifier:(NSString *)identifier; 359 | 360 | /*! 361 | @brief 处于选中状态的标注数据数据(其count == 0 或 1) 362 | */ 363 | @property (nonatomic, copy) NSArray *selectedAnnotations; 364 | 365 | /*! 366 | @brief 选中标注数据对应的view 367 | @param annotation 标注数据 368 | @param animated 是否有动画效果 369 | */ 370 | - (void)selectAnnotation:(id )annotation animated:(BOOL)animated; 371 | 372 | /*! 373 | @brief 取消选中标注数据对应的view 374 | @param annotation 标注数据 375 | @param animated 是否有动画效果 376 | */ 377 | - (void)deselectAnnotation:(id )annotation animated:(BOOL)animated; 378 | 379 | /*! 380 | @brief annotation 可见区域 381 | */ 382 | @property (nonatomic, readonly) CGRect annotationVisibleRect; 383 | 384 | /*! 385 | @brief 获取指定投影矩形范围内的标注 386 | @param mapRect 投影矩形范围 387 | @return 标注集合 388 | */ 389 | - (NSSet *)annotationsInMapRect:(MAMapRect)mapRect; 390 | 391 | /*! 392 | 设置地图使其可以显示数组中所有的annotation, 如果数组中只有一个则直接设置地图中心为annotation的位置。 393 | @param annotations 需要显示的annotation 394 | @param animated 是否执行动画 395 | */ 396 | - (void)showAnnotations:(NSArray *)annotations animated:(BOOL)animated; 397 | 398 | /** 399 | * 设置地图使其可以显示数组中所有的annotation, 如果数组中只有一个则直接设置地图中心为annotation的位置。 400 | * 401 | * @param annotations 需要显示的annotation 402 | * @param insets insets 嵌入边界 403 | * @param animated 是否执行动画 404 | */ 405 | - (void)showAnnotations:(NSArray *)annotations edgePadding:(UIEdgeInsets)insets animated:(BOOL)animated; 406 | 407 | #pragma mark - Overlays 408 | 409 | /*! 410 | @brief Overlay数组 411 | */ 412 | @property (nonatomic, readonly) NSArray *overlays; 413 | 414 | /*! 415 | @brief 查找指定overlay对应的Renderer,如果该Renderer尚未创建,返回nil 416 | @param overlay 指定的overlay 417 | @return 指定overlay对应的Renderer 418 | */ 419 | - (MAOverlayRenderer *)rendererForOverlay:(id )overlay; 420 | 421 | /*! 422 | @brief 查找指定overlay对应的View,如果该View尚未创建,返回nil 423 | @param overlay 指定的overlay 424 | @return 指定overlay对应的View 425 | */ 426 | - (MAOverlayView *)viewForOverlay:(id )overlay __attribute__ ((deprecated("use - (MAOverlayRenderer *)rendererForOverlay:(id )overlay instead"))); 427 | 428 | /*! 429 | @brief 向地图窗口添加Overlay,需要实现MAMapViewDelegate的-mapView:rendererForOverlay:函数来生成标注对应的Renderer 430 | @param overlay 要添加的overlay 431 | */ 432 | - (void)addOverlay:(id )overlay; 433 | 434 | /*! 435 | @brief 向地图窗口添加一组Overlay,需要实现BMKMapViewDelegate的-mapView:rendererForOverlay:函数来生成标注对应的Renderer 436 | @param overlays 要添加的overlay数组 437 | */ 438 | - (void)addOverlays:(NSArray *)overlays; 439 | 440 | /*! 441 | @brief 移除Overlay 442 | @param overlay 要移除的overlay 443 | */ 444 | - (void)removeOverlay:(id )overlay; 445 | 446 | /*! 447 | @brief 移除一组Overlay 448 | @param overlays 要移除的overlay数组 449 | */ 450 | - (void)removeOverlays:(NSArray *)overlays; 451 | 452 | /*! 453 | @brief 在指定的索引处添加一个Overlay 454 | @param overlay 要添加的overlay 455 | @param index 指定的索引 456 | */ 457 | - (void)insertOverlay:(id )overlay atIndex:(NSUInteger)index; 458 | 459 | /*! 460 | @brief 在交换指定索引处的Overlay 461 | @param index1 索引1 462 | @param index2 索引2 463 | */ 464 | - (void)exchangeOverlayAtIndex:(NSUInteger)index1 withOverlayAtIndex:(NSUInteger)index2; 465 | 466 | /*! 467 | @brief 在指定的Overlay之上插入一个overlay 468 | @param overlay 带添加的Overlay 469 | @param sibling 用于指定相对位置的Overlay 470 | */ 471 | - (void)insertOverlay:(id )overlay aboveOverlay:(id )sibling; 472 | 473 | /*! 474 | @brief 在指定的Overlay之下插入一个overlay 475 | @param overlay 带添加的Overlay 476 | @param sibling 用于指定相对位置的Overlay 477 | */ 478 | - (void)insertOverlay:(id )overlay belowOverlay:(id )sibling; 479 | 480 | #pragma mark - Cache 481 | 482 | /*! 483 | @brief 清除所有磁盘上缓存的地图数据。 484 | */ 485 | - (void)clearDisk; 486 | 487 | @end 488 | 489 | #pragma mark - Snapshots 490 | 491 | /*! 492 | @brief 地图view关于截图的类别 493 | */ 494 | @interface MAMapView (Snapshot) 495 | 496 | /*! 497 | @brief 在指定区域内截图(默认会包含该区域内的annotationView) 498 | @param rect 指定的区域 499 | @return 截图image 500 | */ 501 | - (UIImage *)takeSnapshotInRect:(CGRect)rect; 502 | 503 | /*! 504 | @brief 获得地图当前可视区域截图 505 | @param rect 指定截图区域 506 | @param block 回调block 507 | */ 508 | - (void)takeSnapshotInRect:(CGRect)rect withCompletionBlock:(void (^)(UIImage *resultImage, CGRect rect))block; 509 | 510 | @end 511 | 512 | #pragma mark - LocationOption 513 | 514 | /*! 515 | @brief 定位相关参数的类别 516 | */ 517 | @interface MAMapView (LocationOption) 518 | 519 | /*! 520 | @brief 设定定位的最小更新距离。默认为kCLDistanceFilterNone,会提示任何移动。 521 | */ 522 | @property (nonatomic) CLLocationDistance distanceFilter; 523 | 524 | /*! 525 | @brief 设定定位精度。默认为kCLLocationAccuracyBest。 526 | */ 527 | @property (nonatomic) CLLocationAccuracy desiredAccuracy; 528 | 529 | /*! 530 | @brief 设定最小更新角度。默认为1度,设定为kCLHeadingFilterNone会提示任何角度改变。 531 | */ 532 | @property (nonatomic) CLLocationDegrees headingFilter; 533 | 534 | /** 535 | * 指定定位是否会被系统自动暂停。默认为YES。只在iOS 6.0之后起作用。 536 | */ 537 | @property (nonatomic) BOOL pausesLocationUpdatesAutomatically; 538 | 539 | /** 540 | * 是否允许后台定位。默认为NO。只在iOS 9.0之后起作用。 541 | * 设置为YES的时候必须保证 Background Modes 中的 Location updates处于选中状态,否则会抛出异常。 542 | */ 543 | @property (nonatomic) BOOL allowsBackgroundLocationUpdates; 544 | 545 | @end 546 | 547 | #pragma mark - MAMapViewDelegate 548 | 549 | /*! 550 | @brief 地图view的delegate 551 | */ 552 | @protocol MAMapViewDelegate 553 | @optional 554 | 555 | /*! 556 | @brief 地图区域即将改变时会调用此接口 557 | @param mapview 地图View 558 | @param animated 是否动画 559 | */ 560 | - (void)mapView:(MAMapView *)mapView regionWillChangeAnimated:(BOOL)animated; 561 | 562 | /*! 563 | @brief 地图区域改变完成后会调用此接口 564 | @param mapview 地图View 565 | @param animated 是否动画 566 | */ 567 | - (void)mapView:(MAMapView *)mapView regionDidChangeAnimated:(BOOL)animated; 568 | 569 | /** 570 | * 地图将要发生移动时调用此接口 571 | * 572 | * @param mapView 地图view 573 | * @param wasUserAction 标识是否是用户动作 574 | */ 575 | - (void)mapView:(MAMapView *)mapView mapWillMoveByUser:(BOOL)wasUserAction; 576 | 577 | /** 578 | * 地图移动结束后调用此接口 579 | * 580 | * @param mapView 地图view 581 | * @param wasUserAction 标识是否是用户动作 582 | */ 583 | - (void)mapView:(MAMapView *)mapView mapDidMoveByUser:(BOOL)wasUserAction; 584 | 585 | /** 586 | * 地图将要发生缩放时调用此接口 587 | * 588 | * @param mapView 地图view 589 | * @param wasUserAction 标识是否是用户动作 590 | */ 591 | - (void)mapView:(MAMapView *)mapView mapWillZoomByUser:(BOOL)wasUserAction; 592 | 593 | /** 594 | * 地图缩放结束后调用此接口 595 | * 596 | * @param mapView 地图view 597 | * @param wasUserAction 标识是否是用户动作 598 | */ 599 | - (void)mapView:(MAMapView *)mapView mapDidZoomByUser:(BOOL)wasUserAction; 600 | 601 | /** 602 | * 单击地图底图调用此接口 603 | * 604 | * @param mapView 地图View 605 | * @param coordinate 点击位置经纬度 606 | */ 607 | - (void)mapView:(MAMapView *)mapView didSingleTappedAtCoordinate:(CLLocationCoordinate2D)coordinate; 608 | 609 | /** 610 | * 长按地图底图调用此接口 611 | * 612 | * @param mapView 地图View 613 | * @param coordinate 长按位置经纬度 614 | */ 615 | - (void)mapView:(MAMapView *)mapView didLongPressedAtCoordinate:(CLLocationCoordinate2D)coordinate; 616 | 617 | /*! 618 | @brief 根据anntation生成对应的View 619 | @param mapView 地图View 620 | @param annotation 指定的标注 621 | @return 生成的标注View 622 | */ 623 | - (MAAnnotationView*)mapView:(MAMapView *)mapView viewForAnnotation:(id )annotation; 624 | 625 | /*! 626 | @brief 当mapView新添加annotation views时调用此接口 627 | @param mapView 地图View 628 | @param views 新添加的annotation views 629 | */ 630 | - (void)mapView:(MAMapView *)mapView didAddAnnotationViews:(NSArray *)views; 631 | 632 | /*! 633 | @brief 当选中一个annotation views时调用此接口 634 | @param mapView 地图View 635 | @param views 选中的annotation views 636 | */ 637 | - (void)mapView:(MAMapView *)mapView didSelectAnnotationView:(MAAnnotationView *)view; 638 | 639 | /*! 640 | @brief 当取消选中一个annotation views时调用此接口 641 | @param mapView 地图View 642 | @param views 取消选中的annotation views 643 | */ 644 | - (void)mapView:(MAMapView *)mapView didDeselectAnnotationView:(MAAnnotationView *)view; 645 | 646 | /*! 647 | @brief 标注view的accessory view(必须继承自UIControl)被点击时调用此接口 648 | @param mapView 地图View 649 | @param annotationView callout所属的标注view 650 | @param control 对应的control 651 | */ 652 | - (void)mapView:(MAMapView *)mapView annotationView:(MAAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control; 653 | 654 | /** 655 | * 标注view的calloutview整体点击时调用此接口 656 | * 657 | * @param mapView 地图的view 658 | * @param view calloutView所属的annotationView 659 | */ 660 | - (void)mapView:(MAMapView *)mapView didAnnotationViewCalloutTapped:(MAAnnotationView *)view; 661 | 662 | /*! 663 | @brief 在地图View将要启动定位时调用此接口 664 | @param mapView 地图View 665 | */ 666 | - (void)mapViewWillStartLocatingUser:(MAMapView *)mapView; 667 | 668 | /*! 669 | @brief 在地图View停止定位后调用此接口 670 | @param mapView 地图View 671 | */ 672 | - (void)mapViewDidStopLocatingUser:(MAMapView *)mapView; 673 | 674 | /*! 675 | @brief 位置或者设备方向更新后调用此接口 676 | @param mapView 地图View 677 | @param userLocation 用户定位信息(包括位置与设备方向等数据) 678 | @param updatingLocation 标示是否是location数据更新, YES:location数据更新 NO:heading数据更新 679 | */ 680 | - (void)mapView:(MAMapView *)mapView didUpdateUserLocation:(MAUserLocation *)userLocation updatingLocation:(BOOL)updatingLocation; 681 | 682 | /*! 683 | @brief 定位失败后调用此接口 684 | @param mapView 地图View 685 | @param error 错误号,参考CLError.h中定义的错误号 686 | */ 687 | - (void)mapView:(MAMapView *)mapView didFailToLocateUserWithError:(NSError *)error; 688 | 689 | /*! 690 | @brief 当userTrackingMode改变时调用此接口 691 | @param mapView 地图View 692 | @param mode 改变后的mode 693 | @param animated 动画 694 | */ 695 | - (void)mapView:(MAMapView *)mapView didChangeUserTrackingMode:(MAUserTrackingMode)mode animated:(BOOL)animated; 696 | 697 | /*! 698 | @brief 拖动annotation view时view的状态变化,ios3.2以后支持 699 | @param mapView 地图View 700 | @param view annotation view 701 | @param newState 新状态 702 | @param oldState 旧状态 703 | */ 704 | - (void)mapView:(MAMapView *)mapView annotationView:(MAAnnotationView *)view didChangeDragState:(MAAnnotationViewDragState)newState fromOldState:(MAAnnotationViewDragState)oldState; 705 | 706 | /*! 707 | @brief 根据overlay生成对应的Renderer 708 | @param mapView 地图View 709 | @param overlay 指定的overlay 710 | @return 生成的覆盖物Renderer 711 | */ 712 | - (MAOverlayRenderer *)mapView:(MAMapView *)mapView rendererForOverlay:(id )overlay; 713 | 714 | /*! 715 | @brief 当mapView新添加overlay renderer时调用此接口 716 | @param mapView 地图View 717 | @param renderers 新添加的overlay renderers 718 | */ 719 | - (void)mapView:(MAMapView *)mapView didAddOverlayRenderers:(NSArray *)renderers; 720 | 721 | #pragma mark - Deprecated 722 | 723 | - (MAOverlayView *)mapView:(MAMapView *)mapView viewForOverlay:(id )overlay __attribute__ ((deprecated("use - (MAOverlayRenderer *)mapView:(MAMapView *)mapView rendererForOverlay:(id )overlay instead"))); 724 | - (void)mapView:(MAMapView *)mapView didUpdateUserLocation:(MAUserLocation *)userLocation __attribute__ ((deprecated("use -(void)mapView:(MAMapView *)mapView didUpdateUserLocation:(MAUserLocation *)userLocation updatingLocation:(BOOL)updatingLocation instead"))); 725 | - (void)mapView:(MAMapView *)mapView didAddOverlayViews:(NSArray *)overlayViews __attribute__ ((deprecated("use - (void)mapView:(MAMapView *)mapView didAddOverlayRenderers:(NSArray *)renderers instead"))); 726 | 727 | 728 | @end 729 | -------------------------------------------------------------------------------- /ios/RCTAMap/RCTAMap/AMap/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 polyline 指定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/RCTAMap/RCTAMap/AMap/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/RCTAMap/RCTAMap/AMap/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/RCTAMap/RCTAMap/AMap/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/RCTAMap/RCTAMap/AMap/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 (retain) UIColor *fillColor; 21 | 22 | /*! 23 | @brief 笔触颜色,默认是[UIColor colorWithRed:1 green:0 blue:0 alpha:0.6] 24 | */ 25 | @property (retain) 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 | -------------------------------------------------------------------------------- /ios/RCTAMap/RCTAMap/AMap/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 (retain) UIColor *fillColor; 20 | 21 | /*! 22 | @brief 笔触颜色,默认是[UIColor colorWithRed:1 green:0 blue:0 alpha:0.6] 23 | */ 24 | @property (retain) 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/RCTAMap/RCTAMap/AMap/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/RCTAMap/RCTAMap/AMap/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/RCTAMap/RCTAMap/AMap/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/RCTAMap/RCTAMap/AMap/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 | @end 22 | -------------------------------------------------------------------------------- /ios/RCTAMap/RCTAMap/AMap/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/RCTAMap/RCTAMap/AMap/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 | -------------------------------------------------------------------------------- /ios/RCTAMap/RCTAMap/AMap/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/RCTAMap/AMap/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/RCTAMap/RCTAMap/AMap/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/RCTAMap/RCTAMap/AMap/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/RCTAMap/RCTAMap/AMap/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/RCTAMap/RCTAMap/AMap/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 | @brief 该类是覆盖在球面墨卡托投影上的图片tiles的数据源 13 | */ 14 | @interface MATileOverlay : NSObject 15 | 16 | /*! 17 | @brief 根据指定的URLTemplate生成tileOverlay 18 | @param URLTemplate是一个包含"{x}","{y}","{z}","{scale}"的字符串,"{x}","{y}","{z}","{scale}"会被tile path的值所替换,并生成用来加载tile图片数据的URL 。例如: http://server/path?x={x}&y={y}&z={z}&scale={scale}。 19 | @return 以指定的URLTemplate字符串生成tileOverlay 20 | */ 21 | - (id)initWithURLTemplate:(NSString *)URLTemplate; 22 | 23 | /*! 24 | @brief 默认tileSize 256x256 25 | */ 26 | @property CGSize tileSize; 27 | 28 | /*! 29 | @brief overlay可以渲染的最大/最小缩放级别。当0级时,一个tile覆盖整个世界范围,1级时覆盖 1/4th 世界,2级时1/16th,以此类推。 30 | */ 31 | @property NSInteger minimumZ; 32 | @property NSInteger maximumZ; 33 | 34 | @property (readonly) NSString *URLTemplate; 35 | 36 | /*! 37 | @brief 区域外接矩形,可用来设定tileOverlay的可渲染区域 38 | */ 39 | @property (nonatomic) MAMapRect boundingMapRect; 40 | 41 | @end 42 | 43 | /*! 44 | @brief 记录某特定tile的据结构。contentScaleFactor根据设备的ScrennScale而定, 为1.0或2.0。 45 | */ 46 | typedef struct { 47 | NSInteger x; 48 | NSInteger y; 49 | NSInteger z; 50 | CGFloat contentScaleFactor; 51 | } MATileOverlayPath; 52 | 53 | /*! 54 | @brief 子类可覆盖CustomLoading中的方法来自定义加载MATileOverlay的行为。 55 | */ 56 | @interface MATileOverlay (CustomLoading) 57 | 58 | /*! 59 | @brief 以tile path生成URL。用于加载tile, 此方法默认填充URLTemplate 60 | @param tile path 61 | @return path相应的url 62 | */ 63 | - (NSURL *)URLForTilePath:(MATileOverlayPath)path; 64 | 65 | /*! 66 | @brief 加载被请求的tile, 并以tile数据或加载tile失败error访问回调block; 默认实现为首先用 -URLForTilePath 去获取URL, 然后用异步NSURLConnection加载tile数据。当绘制大面积的tileOverlay时,建议重写此函数并实现缓存机制。 67 | @param tile path 68 | @param 用来传入tile数据或加载tile失败的error访问的回调block 69 | */ 70 | - (void)loadTileAtPath:(MATileOverlayPath)path result:(void (^)(NSData *tileData, NSError *error))result; 71 | 72 | @end -------------------------------------------------------------------------------- /ios/RCTAMap/RCTAMap/AMap/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 tileOverlay 数据源 25 | @return 初始化成功则返回overlay renderer,否则返回nil 26 | */ 27 | - (id)initWithTileOverlay:(MATileOverlay *)overlay; 28 | 29 | /*! 30 | @brief 清除所有tile的缓存,并刷新overlay 31 | */ 32 | - (void)reloadData; 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /ios/RCTAMap/RCTAMap/AMap/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 tileOverlay 数据源 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/RCTAMap/RCTAMap/AMap/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 (readonly, nonatomic, getter = isUpdating) BOOL updating; 24 | 25 | /*! 26 | @brief 位置信息, 如果MAMapView的showsUserLocation为NO, 或者尚未定位成功, 则该值为nil. 27 | */ 28 | @property (readonly, nonatomic, retain) CLLocation *location; 29 | 30 | /*! 31 | @brief heading信息. 32 | */ 33 | @property (readonly, nonatomic, retain) 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 | -------------------------------------------------------------------------------- /ios/RCTAMap/RCTAMap/AMap/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/RCTAMap/RCTAMap/AMap/MAMapKit.framework/MAMapKit: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiyangest/react-native-yyamap/1303f9c9449e4a1fe0b9fc7a04c95dc17e904125/ios/RCTAMap/RCTAMap/AMap/MAMapKit.framework/MAMapKit -------------------------------------------------------------------------------- /ios/RCTAMap/RCTAMap/RCTAMap.h: -------------------------------------------------------------------------------- 1 | // 2 | // RCTAMap.h 3 | // RCTAMap 4 | // 5 | // Created by yiyang on 16/2/26. 6 | // Copyright © 2016年 creditease. All rights reserved. 7 | // 8 | 9 | 10 | #import 11 | #import 12 | 13 | 14 | #import "RCTConvert+MapKit.h" 15 | #import "RCTComponent.h" 16 | #import "RCTAMapAnnotation.h" 17 | #import "RCTAMapOverlay.h" 18 | 19 | RCT_EXTERN const CLLocationDegrees RCTAMapDefaultSpan; 20 | RCT_EXTERN const NSTimeInterval RCTAMapRegionChangeObserveInterval; 21 | RCT_EXTERN const CGFloat RCTAMapZoomBoundBuffer; 22 | 23 | @interface RCTAMap : MAMapView 24 | 25 | @property (nonatomic, assign) BOOL followUserLocation; 26 | @property (nonatomic, assign) BOOL hasStartedRendering; 27 | @property (nonatomic, assign) CGFloat minDelta; 28 | @property (nonatomic, assign) CGFloat maxDelta; 29 | @property (nonatomic, assign) UIEdgeInsets legalLabelInsets; 30 | @property (nonatomic, strong) NSTimer *regionChangeObserveTimer; 31 | @property (nonatomic, copy) NSArray *annotationIDs; 32 | @property (nonatomic, copy) NSArray *overlayIDs; 33 | 34 | @property (nonatomic, copy) RCTBubblingEventBlock onChange; 35 | @property (nonatomic, copy) RCTBubblingEventBlock onPress; 36 | @property (nonatomic, copy) RCTBubblingEventBlock onAnnotationDragStateChange; 37 | @property (nonatomic, copy) RCTBubblingEventBlock onAnnotationFocus; 38 | @property (nonatomic, copy) RCTBubblingEventBlock onAnnotationBlur; 39 | 40 | - (void)setAnnotations:(NSArray *)annotations; 41 | - (void)setOverlays:(NSArray *)overlays; 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /ios/RCTAMap/RCTAMap/RCTAMap.m: -------------------------------------------------------------------------------- 1 | // 2 | // RCTAMap.m 3 | // RCTAMap 4 | // 5 | // Created by yiyang on 16/2/26. 6 | // Copyright © 2016年 creditease. All rights reserved. 7 | // 8 | 9 | #import "RCTAMap.h" 10 | 11 | #import "RCTEventDispatcher.h" 12 | #import "RCTLog.h" 13 | #import "RCTAMapAnnotation.h" 14 | #import "RCTAMapOverlay.h" 15 | #import "RCTUtils.h" 16 | 17 | const CLLocationDegrees RCTAMapDefaultSpan = 0.005; 18 | const NSTimeInterval RCTAMapRegionChangeObserveInterval = 0.1; 19 | const CGFloat RCTAMapZoomBoundBuffer = 0.01; 20 | 21 | @implementation RCTAMap 22 | { 23 | UIView *_legalLabel; 24 | CLLocationManager *_locationManager; 25 | NSMutableArray *_reactSubviews; 26 | } 27 | 28 | - (instancetype)init 29 | { 30 | if ((self = [super init])) { 31 | _hasStartedRendering = NO; 32 | _reactSubviews = [NSMutableArray new]; 33 | 34 | for (UIView *subview in self.subviews) { 35 | if ([NSStringFromClass(subview.class) isEqualToString:@"MKAttributionLabel"]) { 36 | _legalLabel = subview; 37 | break; 38 | } 39 | } 40 | } 41 | return self; 42 | } 43 | 44 | - (void)dealloc 45 | { 46 | [_regionChangeObserveTimer invalidate]; 47 | } 48 | 49 | - (void)insertReactSubview:(UIView *)subview atIndex:(NSInteger)atIndex 50 | { 51 | [_reactSubviews insertObject:subview atIndex:atIndex]; 52 | } 53 | 54 | - (void)removeReactSubviews: (UIView *)subview 55 | { 56 | [_reactSubviews removeObject:subview]; 57 | } 58 | 59 | - (NSArray *)reactSubviews 60 | { 61 | return _reactSubviews; 62 | } 63 | 64 | - (void)layoutSubviews 65 | { 66 | [super layoutSubviews]; 67 | 68 | if (_legalLabel) { 69 | dispatch_async(dispatch_get_main_queue(), ^{ 70 | CGRect frame = _legalLabel.frame; 71 | if (_legalLabelInsets.left) { 72 | frame.origin.x = _legalLabelInsets.left; 73 | } else if (_legalLabelInsets.right) { 74 | frame.origin.x = self.frame.size.width - _legalLabelInsets.right - frame.size.width; 75 | } 76 | if (_legalLabelInsets.top) { 77 | frame.origin.y = _legalLabelInsets.top; 78 | } else if (_legalLabelInsets.bottom) { 79 | frame.origin.y = self.frame.size.height - _legalLabelInsets.bottom - frame.size.height; 80 | } 81 | _legalLabel.frame = frame; 82 | }); 83 | } 84 | } 85 | 86 | #pragma mark - Accessors 87 | 88 | - (void)setShowsUserLocation:(BOOL)showsUserLocation 89 | { 90 | if (self.showsUserLocation != showsUserLocation) { 91 | if (showsUserLocation && !_locationManager) { 92 | _locationManager = [CLLocationManager new]; 93 | if ([_locationManager respondsToSelector:@selector(requestWhenInUseAuthorization)]) { 94 | [_locationManager requestWhenInUseAuthorization]; 95 | } 96 | } 97 | super.showsUserLocation = showsUserLocation; 98 | } 99 | } 100 | 101 | - (void)setRegion:(MACoordinateRegion)region animated:(BOOL)animated 102 | { 103 | if (!CLLocationCoordinate2DIsValid(region.center)) { 104 | return; 105 | } 106 | 107 | if (!region.span.latitudeDelta) { 108 | region.span.latitudeDelta = self.region.span.latitudeDelta; 109 | } 110 | if (!region.span.longitudeDelta) { 111 | region.span.longitudeDelta = self.region.span.longitudeDelta; 112 | } 113 | 114 | [super setRegion:region animated:animated]; 115 | } 116 | 117 | - (void)setAnnotations:(NSArray *)annotations 118 | { 119 | NSMutableArray *newAnnotationIDs = [NSMutableArray new]; 120 | NSMutableArray *annotationsToDelete = [NSMutableArray new]; 121 | NSMutableArray *annotationsToAdd = [NSMutableArray new]; 122 | 123 | for (RCTAMapAnnotation *annotation in annotations) { 124 | if (![annotation isKindOfClass:[RCTAMapAnnotation class]]) { 125 | continue; 126 | } 127 | 128 | [newAnnotationIDs addObject:annotation.identifier]; 129 | 130 | if (![_annotationIDs containsObject:annotation.identifier]) { 131 | [annotationsToAdd addObject:annotation]; 132 | } 133 | } 134 | for (RCTAMapAnnotation *annotation in self.annotations) { 135 | if (![annotations isKindOfClass:[RCTAMapAnnotation class]]) { 136 | continue; 137 | } 138 | 139 | if (![newAnnotationIDs containsObject:annotation.identifier]) { 140 | [annotationsToDelete addObject:annotation]; 141 | } 142 | } 143 | 144 | if (annotationsToDelete.count > 0) { 145 | [self removeAnnotations:(NSArray> *)annotationsToDelete]; 146 | } 147 | 148 | if (annotationsToAdd.count > 0) { 149 | [self addAnnotations:(NSArray> *)annotationsToAdd]; 150 | } 151 | 152 | self.annotationIDs = newAnnotationIDs; 153 | } 154 | 155 | - (void)setOverlays:(NSArray *)overlays 156 | { 157 | NSMutableArray *newOverlayIDs = [NSMutableArray new]; 158 | NSMutableArray *overlaysToDelete = [NSMutableArray new]; 159 | NSMutableArray *overlaysToAdd = [NSMutableArray new]; 160 | 161 | for (RCTAMapOverlay *overlay in overlays) { 162 | if (![overlay isKindOfClass:[RCTAMapOverlay class]]) { 163 | continue; 164 | } 165 | 166 | [newOverlayIDs addObject:overlay.identifier]; 167 | 168 | if (![_overlayIDs containsObject:overlay.identifier]) { 169 | [overlaysToAdd addObject:overlay]; 170 | } 171 | } 172 | 173 | for (RCTAMapOverlay *overlay in self.overlays) { 174 | if (![overlay isKindOfClass:[RCTAMapOverlay class]]) { 175 | continue; 176 | } 177 | 178 | if (![newOverlayIDs containsObject:overlay.identifier]) { 179 | [overlaysToDelete addObject:overlay]; 180 | } 181 | } 182 | 183 | if (overlaysToDelete.count > 0) { 184 | [self removeOverlays:(NSArray> *)overlaysToDelete]; 185 | } 186 | if (overlaysToAdd.count > 0) { 187 | [self addOverlays:(NSArray> *)overlaysToAdd]; 188 | } 189 | 190 | self.overlayIDs = newOverlayIDs; 191 | } 192 | 193 | - (BOOL)showsCompass { 194 | if ([MAMapView instancesRespondToSelector:@selector(showsCompass)]) { 195 | return super.showsCompass; 196 | } 197 | return NO; 198 | } 199 | 200 | - (void)setShowsCompass:(BOOL)showsCompass { 201 | if ([MAMapView instancesRespondToSelector:@selector(setShowsCompass:)]) { 202 | super.showsCompass = showsCompass; 203 | } 204 | } 205 | 206 | 207 | @end 208 | -------------------------------------------------------------------------------- /ios/RCTAMap/RCTAMap/RCTAMapAnnotation.h: -------------------------------------------------------------------------------- 1 | // 2 | // RCTAMapAnnotation.h 3 | // RCTAMap 4 | // 5 | // Created by yiyang on 16/2/29. 6 | // Copyright © 2016年 creditease. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface RCTAMapAnnotation : MAPointAnnotation 12 | 13 | @property (nonatomic, copy) NSString *identifier; 14 | @property (nonatomic, assign) BOOL hasLeftCallout; 15 | @property (nonatomic, assign) BOOL hasRightCallout; 16 | @property (nonatomic, assign) BOOL animateDrop; 17 | @property (nonatomic, assign) MAPinAnnotationColor tintColor; 18 | @property (nonatomic, strong) UIImage *image; 19 | @property (nonatomic, assign) NSInteger viewIndex; 20 | @property (nonatomic, assign) NSInteger leftCalloutViewIndex; 21 | @property (nonatomic, assign) NSInteger rightCalloutViewIndex; 22 | @property (nonatomic, assign) NSInteger detailCalloutViewIndex; 23 | @property (nonatomic, assign) BOOL draggable; 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /ios/RCTAMap/RCTAMap/RCTAMapAnnotation.m: -------------------------------------------------------------------------------- 1 | // 2 | // RCTAMapAnnotation.m 3 | // RCTAMap 4 | // 5 | // Created by yiyang on 16/2/29. 6 | // Copyright © 2016年 creditease. All rights reserved. 7 | // 8 | 9 | #import "RCTAMapAnnotation.h" 10 | 11 | @implementation RCTAMapAnnotation 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /ios/RCTAMap/RCTAMap/RCTAMapManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // RCTAMapManager.h 3 | // RCTAMap 4 | // 5 | // Created by yiyang on 16/2/26. 6 | // Copyright © 2016年 creditease. All rights reserved. 7 | // 8 | 9 | #import "RCTViewManager.h" 10 | 11 | @interface RCTAMapManager : RCTViewManager 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /ios/RCTAMap/RCTAMap/RCTAMapManager.m: -------------------------------------------------------------------------------- 1 | // 2 | // RCTAMapManager.m 3 | // RCTAMap 4 | // 5 | // Created by yiyang on 16/2/26. 6 | // Copyright © 2016年 creditease. All rights reserved. 7 | // 8 | 9 | #import "RCTAMapManager.h" 10 | 11 | #import "RCTBridge.h" 12 | #import "RCTConvert+CoreLocation.h" 13 | #import "RCTConvert+AMapKit.h" 14 | #import "RCTEventDispatcher.h" 15 | #import "RCTAMap.h" 16 | #import "RCTUtils.h" 17 | #import "UIView+React.h" 18 | #import "RCTAMapAnnotation.h" 19 | #import "RCTAMapOverlay.h" 20 | 21 | #import 22 | 23 | static NSString *const RCTAMapViewKey = @"AMapView"; 24 | 25 | #if __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_9_0 26 | 27 | static NSString *const RCTAMapPinRed = @"#ff3b30"; 28 | static NSString *const RCTAMapPinGreen = @"#4cd964"; 29 | static NSString *const RCTAMapPinPurple = @"#c969e0"; 30 | 31 | @implementation RCTConvert (MAPinAnnotationColor) 32 | 33 | RCT_ENUM_CONVERTER(MAPinAnnotationColor, (@{ 34 | RCTAMapPinRed: @(MAPinAnnotationColorRed), 35 | RCTAMapPinGreen: @(MAPinAnnotationColorGreen), 36 | RCTAMapPinPurple: @(MAPinAnnotationColorPurple) 37 | }), MAPinAnnotationColorRed, unsignedIntegerValue) 38 | 39 | @end 40 | 41 | #endif 42 | 43 | @interface RCTAMapAnnotationView : MAAnnotationView 44 | 45 | @property (nonatomic, strong) UIView *contentView; 46 | 47 | @end 48 | 49 | @implementation RCTAMapAnnotationView 50 | 51 | - (void)setContentView:(UIView *)contentView 52 | { 53 | [_contentView removeFromSuperview]; 54 | _contentView = contentView; 55 | [self addSubview:_contentView]; 56 | } 57 | 58 | - (void)layoutSubviews 59 | { 60 | [super layoutSubviews]; 61 | self.bounds = (CGRect){ 62 | CGPointZero, 63 | _contentView.frame.size, 64 | }; 65 | } 66 | 67 | @end 68 | 69 | @interface RCTAMapManager () 70 | 71 | @end 72 | 73 | @implementation RCTAMapManager 74 | 75 | RCT_EXPORT_MODULE() 76 | 77 | - (UIView *)view 78 | { 79 | RCTAMap *map = [RCTAMap new]; 80 | map.delegate = self; 81 | return map; 82 | } 83 | 84 | RCT_EXPORT_VIEW_PROPERTY(showsUserLocation, BOOL) 85 | RCT_EXPORT_VIEW_PROPERTY(showsPointsOfInterest, BOOL) 86 | RCT_EXPORT_VIEW_PROPERTY(showsCompass, BOOL) 87 | RCT_EXPORT_VIEW_PROPERTY(followUserLocation, BOOL) 88 | RCT_EXPORT_VIEW_PROPERTY(zoomEnabled, BOOL) 89 | RCT_EXPORT_VIEW_PROPERTY(rotateEnabled, BOOL) 90 | RCT_EXPORT_VIEW_PROPERTY(pitchEnabled, BOOL) 91 | RCT_EXPORT_VIEW_PROPERTY(scrollEnabled, BOOL) 92 | RCT_EXPORT_VIEW_PROPERTY(maxDelta, CGFloat) 93 | RCT_EXPORT_VIEW_PROPERTY(minDelta, CGFloat) 94 | RCT_EXPORT_VIEW_PROPERTY(legalLabelInsets, UIEdgeInsets) 95 | RCT_EXPORT_VIEW_PROPERTY(mapType, MAMapType) 96 | RCT_EXPORT_VIEW_PROPERTY(annotations, NSArray) 97 | RCT_EXPORT_VIEW_PROPERTY(overlays, NSArray) 98 | RCT_EXPORT_VIEW_PROPERTY(onAnnotationDragStateChange, RCTBubblingEventBlock) 99 | RCT_EXPORT_VIEW_PROPERTY(onAnnotationFocus, RCTBubblingEventBlock) 100 | RCT_EXPORT_VIEW_PROPERTY(onAnnotationBlur, RCTBubblingEventBlock) 101 | RCT_EXPORT_VIEW_PROPERTY(onChange, RCTBubblingEventBlock) 102 | RCT_EXPORT_VIEW_PROPERTY(onPress, RCTBubblingEventBlock) 103 | RCT_CUSTOM_VIEW_PROPERTY(region, MACoordinateRegion, RCTAMap) 104 | { 105 | [view setRegion:json ? [RCTConvert MACoordinateRegion:json] : defaultView.region animated:YES]; 106 | } 107 | 108 | - (NSDictionary *)constantsToExport 109 | { 110 | NSUInteger red, green, purple; 111 | 112 | red = MAPinAnnotationColorRed; 113 | green = MAPinAnnotationColorGreen; 114 | purple = MAPinAnnotationColorPurple; 115 | 116 | 117 | return @{ 118 | @"PinColors": @{ 119 | @"RED": @(red), 120 | @"GREEN": @(green), 121 | @"PURPLE": @(purple), 122 | } 123 | }; 124 | 125 | } 126 | 127 | #pragma mark - MAMapViewDelegate 128 | 129 | - (void)mapView:(RCTAMap *)mapView didSelectAnnotationView:(MAAnnotationView *)view 130 | { 131 | if (mapView.onPress && [view.annotation isKindOfClass:[RCTAMapAnnotation class]]) { 132 | RCTAMapAnnotation *annotation = (RCTAMapAnnotation *)view.annotation; 133 | mapView.onPress(@{ 134 | @"action": @"annotation-click", 135 | @"annotation": @{ 136 | @"id": annotation.identifier, 137 | @"title": annotation.title ?: @"", 138 | @"subtitle": annotation.subtitle ?: @"", 139 | @"latitude": @(annotation.coordinate.latitude), 140 | @"longitude": @(annotation.coordinate.longitude) 141 | } 142 | }); 143 | } 144 | 145 | if ([view.annotation isKindOfClass:[RCTAMapAnnotation class]]) { 146 | RCTAMapAnnotation *annotation = (RCTAMapAnnotation *)view.annotation; 147 | if (mapView.onAnnotationFocus) { 148 | mapView.onAnnotationFocus(@{ 149 | @"annotationId": annotation.identifier 150 | }); 151 | } 152 | } 153 | } 154 | 155 | - (void)mapView:(RCTAMap *)mapView didDeselectAnnotationView:(MAAnnotationView *)view 156 | { 157 | if ([view.annotation isKindOfClass:[RCTAMapAnnotation class]]) { 158 | RCTAMapAnnotation *annotation = (RCTAMapAnnotation *)view.annotation; 159 | if (mapView.onAnnotationBlur) { 160 | mapView.onAnnotationBlur(@{ 161 | @"annotationId": annotation.identifier 162 | }); 163 | } 164 | } 165 | } 166 | 167 | - (void)mapView:(RCTAMap *)mapView annotationView:(MAAnnotationView *)view didChangeDragState:(MAAnnotationViewDragState)newState fromOldState:(MAAnnotationViewDragState)oldState 168 | { 169 | static NSArray *states; 170 | static dispatch_once_t onceToken; 171 | dispatch_once(&onceToken, ^{ 172 | states = @[@"idle", @"starting", @"dragging", @"canceling", @"ending"]; 173 | }); 174 | 175 | if ([view.annotation isKindOfClass:[RCTAMapAnnotation class]]) { 176 | RCTAMapAnnotation *annotation = (RCTAMapAnnotation *)view.annotation; 177 | if (mapView.onAnnotationDragStateChange) { 178 | mapView.onAnnotationDragStateChange(@{ 179 | @"state": states[newState], 180 | @"oldState": states[oldState], 181 | @"annotationId": annotation.identifier, 182 | @"latitude": @(annotation.coordinate.latitude), 183 | @"longitude": @(annotation.coordinate.longitude), 184 | }); 185 | } 186 | } 187 | } 188 | 189 | - (MAAnnotationView *)mapView:(RCTAMap *)mapView viewForAnnotation:(RCTAMapAnnotation *)annotation 190 | { 191 | if (![annotation isKindOfClass:[RCTAMapAnnotation class]]) { 192 | return nil; 193 | } 194 | 195 | MAAnnotationView *annotationView; 196 | if (annotation.viewIndex != NSNotFound) { 197 | NSString *reuseIdentifier = NSStringFromClass([RCTAMapAnnotationView class]); 198 | annotationView = [mapView dequeueReusableAnnotationViewWithIdentifier:reuseIdentifier]; 199 | if (!annotationView) { 200 | annotationView = [[RCTAMapAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:reuseIdentifier]; 201 | } 202 | 203 | UIView *reactView = mapView.reactSubviews[annotation.viewIndex]; 204 | ((RCTAMapAnnotationView *)annotationView).contentView = reactView; 205 | } else if (annotation.image) { 206 | NSString *reuseIdentifier = NSStringFromClass([MAAnnotationView class]); 207 | annotationView = [mapView dequeueReusableAnnotationViewWithIdentifier:reuseIdentifier]; 208 | if (!annotationView) { 209 | annotationView = [[MAAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:reuseIdentifier]; 210 | } 211 | annotationView.image = annotation.image; 212 | } else { 213 | 214 | NSString *reuseIdentifier = NSStringFromClass([MAPinAnnotationView class]); 215 | annotationView = 216 | [mapView dequeueReusableAnnotationViewWithIdentifier:reuseIdentifier] ?: 217 | [[MAPinAnnotationView alloc] initWithAnnotation:annotation 218 | reuseIdentifier:reuseIdentifier]; 219 | ((MAPinAnnotationView *)annotationView).animatesDrop = annotation.animateDrop; 220 | 221 | ((MAPinAnnotationView *)annotationView).pinColor = annotation.tintColor; 222 | 223 | 224 | } 225 | 226 | annotationView.canShowCallout = (annotation.title.length > 0); 227 | 228 | if (annotation.leftCalloutViewIndex != NSNotFound) { 229 | annotationView.leftCalloutAccessoryView = mapView.reactSubviews[annotation.leftCalloutViewIndex]; 230 | } else if (annotation.hasLeftCallout) { 231 | annotationView.leftCalloutAccessoryView = [UIButton buttonWithType:UIButtonTypeDetailDisclosure]; 232 | } else { 233 | annotationView.leftCalloutAccessoryView = nil; 234 | } 235 | 236 | if (annotation.rightCalloutViewIndex != NSNotFound) { 237 | annotationView.rightCalloutAccessoryView = mapView.reactSubviews[annotation.rightCalloutViewIndex]; 238 | } else if (annotation.hasRightCallout) { 239 | annotationView.rightCalloutAccessoryView = [UIButton buttonWithType:UIButtonTypeDetailDisclosure]; 240 | } else { 241 | annotationView.rightCalloutAccessoryView = nil; 242 | } 243 | 244 | annotationView.draggable = annotation.draggable; 245 | return annotationView; 246 | } 247 | 248 | - (MAOverlayRenderer *)mapView:(RCTAMap *)mapView rendererForOverlay:(RCTAMapOverlay *)overlay 249 | { 250 | if ([overlay isKindOfClass:[RCTAMapOverlay class]]) { 251 | MAPolylineRenderer *polylineRenderer = [[MAPolylineRenderer alloc] initWithPolyline:overlay]; 252 | polylineRenderer.strokeColor = overlay.strokeColor; 253 | polylineRenderer.lineWidth = overlay.lineWidth; 254 | return polylineRenderer; 255 | } 256 | 257 | return nil; 258 | } 259 | 260 | - (void)mapView:(RCTAMap *)mapView annotationView:(MAAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control 261 | { 262 | if (mapView.onPress) { 263 | // Pass to JS 264 | RCTAMapAnnotation *annotation = (RCTAMapAnnotation *)view.annotation; 265 | mapView.onPress(@{ 266 | @"side": (control == view.leftCalloutAccessoryView) ? @"left" : @"right", 267 | @"action": @"callout-click", 268 | @"annotationId": annotation.identifier 269 | }); 270 | } 271 | } 272 | 273 | - (void)mapView:(RCTAMap *)mapView didUpdateUserLocation:(MAUserLocation *)userLocation updatingLocation:(BOOL)updatingLocation 274 | { 275 | if (mapView.followUserLocation) { 276 | MACoordinateRegion region; 277 | region.span.latitudeDelta = RCTAMapDefaultSpan; 278 | region.span.longitudeDelta = RCTAMapDefaultSpan; 279 | region.center = userLocation.coordinate; 280 | [mapView setRegion:region animated:YES]; 281 | } 282 | } 283 | 284 | - (void)mapView:(RCTAMap *)mapView regionWillChangeAnimated:(BOOL)animated 285 | { 286 | [self _regionChanged:mapView]; 287 | mapView.regionChangeObserveTimer = [NSTimer timerWithTimeInterval:RCTAMapRegionChangeObserveInterval target:self selector:@selector(_onTick:) userInfo:@{RCTAMapViewKey: mapView} repeats:YES]; 288 | 289 | [[NSRunLoop mainRunLoop] addTimer:mapView.regionChangeObserveTimer forMode:NSRunLoopCommonModes]; 290 | mapView.hasStartedRendering = YES; 291 | } 292 | 293 | - (void)mapView:(RCTAMap *)mapView regionDidChangeAnimated:(BOOL)animated 294 | { 295 | [mapView.regionChangeObserveTimer invalidate]; 296 | mapView.regionChangeObserveTimer = nil; 297 | 298 | [self _regionChanged:mapView]; 299 | 300 | if (mapView.hasStartedRendering) { 301 | [self _emitRegionChangeEvent:mapView continuous:NO]; 302 | } 303 | } 304 | 305 | - (void)mapViewWillStartLoadingMap:(RCTAMap *)mapView 306 | { 307 | mapView.hasStartedRendering = YES; 308 | [self _emitRegionChangeEvent:mapView continuous:NO]; 309 | } 310 | 311 | #pragma mark - Private 312 | 313 | - (void)_onTick:(NSTimer *)timer 314 | { 315 | [self _regionChanged:timer.userInfo[RCTAMapViewKey]]; 316 | } 317 | 318 | - (void)_regionChanged:(RCTAMap *)mapView 319 | { 320 | BOOL needZoom = NO; 321 | CGFloat newLongitudeDelta = 0.0f; 322 | MACoordinateRegion region = mapView.region; 323 | 324 | if (!CLLocationCoordinate2DIsValid(region.center)) { 325 | return; 326 | } 327 | 328 | if (mapView.maxDelta > FLT_EPSILON && region.span.longitudeDelta > mapView.maxDelta) { 329 | needZoom = YES; 330 | newLongitudeDelta = mapView.maxDelta * (1 - RCTAMapZoomBoundBuffer); 331 | } else if (mapView.minDelta > FLT_EPSILON && region.span.longitudeDelta < mapView.minDelta) { 332 | needZoom = YES; 333 | newLongitudeDelta = mapView.minDelta * (1 + RCTAMapZoomBoundBuffer); 334 | } 335 | if (needZoom) { 336 | region.span.latitudeDelta = region.span.latitudeDelta / region.span.longitudeDelta * newLongitudeDelta; 337 | region.span.longitudeDelta = newLongitudeDelta; 338 | mapView.region = region; 339 | } 340 | 341 | [self _emitRegionChangeEvent:mapView continuous:YES]; 342 | } 343 | 344 | - (void)_emitRegionChangeEvent:(RCTAMap *)mapView continuous:(BOOL)continuous 345 | { 346 | if (mapView.onChange) { 347 | MACoordinateRegion region = mapView.region; 348 | if (!CLLocationCoordinate2DIsValid(region.center)) { 349 | return; 350 | } 351 | 352 | mapView.onChange(@{ 353 | @"continuous": @(continuous), 354 | @"region": @{ 355 | @"latitude": @(RCTZeroIfNaN(region.center.latitude)), 356 | @"longitude": @(RCTZeroIfNaN(region.center.longitude)), 357 | @"latitudeDelta": @(RCTZeroIfNaN(region.span.latitudeDelta)), 358 | @"longitudeDelta": @(RCTZeroIfNaN(region.span.longitudeDelta)), 359 | } 360 | }); 361 | } 362 | } 363 | 364 | @end 365 | -------------------------------------------------------------------------------- /ios/RCTAMap/RCTAMap/RCTAMapOverlay.h: -------------------------------------------------------------------------------- 1 | // 2 | // RCTAMapOverlay.h 3 | // RCTAMap 4 | // 5 | // Created by yiyang on 16/2/29. 6 | // Copyright © 2016年 creditease. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface RCTAMapOverlay : MAPolyline 12 | 13 | @property (nonatomic, copy) NSString *identifier; 14 | @property (nonatomic, strong) UIColor *strokeColor; 15 | @property (nonatomic, assign) CGFloat lineWidth; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /ios/RCTAMap/RCTAMap/RCTAMapOverlay.m: -------------------------------------------------------------------------------- 1 | // 2 | // RCTAMapOverlay.m 3 | // RCTAMap 4 | // 5 | // Created by yiyang on 16/2/29. 6 | // Copyright © 2016年 creditease. All rights reserved. 7 | // 8 | 9 | #import "RCTAMapOverlay.h" 10 | 11 | @implementation RCTAMapOverlay 12 | 13 | /* 14 | // Only override drawRect: if you perform custom drawing. 15 | // An empty implementation adversely affects performance during animation. 16 | - (void)drawRect:(CGRect)rect { 17 | // Drawing code 18 | } 19 | */ 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /ios/RCTAMap/RCTAMap/RCTConvert+AMapKit.h: -------------------------------------------------------------------------------- 1 | // 2 | // RCTConvert+AMapKit.h 3 | // RCTAMap 4 | // 5 | // Created by yiyang on 16/2/29. 6 | // Copyright © 2016年 creditease. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "RCTConvert.h" 12 | 13 | @class RCTAMapAnnotation; 14 | @class RCTAMapOverlay; 15 | 16 | @interface RCTConvert (AMapKit) 17 | 18 | + (MACoordinateSpan)MACoordinateSpan:(id)json; 19 | + (MACoordinateRegion)MACoordinateRegion:(id)json; 20 | + (MAMapType)MAMapType:(id)json; 21 | 22 | + (RCTAMapAnnotation *)RCTAMapAnnotation:(id)json; 23 | + (RCTAMapOverlay *)RCTAMapOverlay:(id)json; 24 | 25 | + (NSArray *)RCTAMapAnnotationArray:(id)json; 26 | + (NSArray *)RCTAMapOverlayArray:(id)json; 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /ios/RCTAMap/RCTAMap/RCTConvert+AMapKit.m: -------------------------------------------------------------------------------- 1 | // 2 | // RCTConvert+AMapKit.m 3 | // RCTAMap 4 | // 5 | // Created by yiyang on 16/2/29. 6 | // Copyright © 2016年 creditease. All rights reserved. 7 | // 8 | 9 | #import "RCTConvert+AMapKit.h" 10 | #import "RCTConvert+CoreLocation.h" 11 | #import "RCTAMapAnnotation.h" 12 | #import "RCTAMapOverlay.h" 13 | 14 | @implementation RCTConvert (AMapKit) 15 | 16 | + (MACoordinateSpan)MACoordinateSpan:(id)json 17 | { 18 | json = [self NSDictionary:json]; 19 | return (MACoordinateSpan){ 20 | [self CLLocationDegrees:json[@"latitudeDelta"]], 21 | [self CLLocationDegrees:json[@"longitudeDelta"]] 22 | }; 23 | } 24 | 25 | + (MACoordinateRegion)MACoordinateRegion:(id)json 26 | { 27 | return (MACoordinateRegion) { 28 | [self CLLocationCoordinate2D:json], 29 | [self MACoordinateSpan:json] 30 | }; 31 | } 32 | 33 | RCT_ENUM_CONVERTER(MAMapType, (@{ 34 | @"standard": @(MAMapTypeStandard), 35 | @"satellite": @(MAMapTypeSatellite), 36 | }), MAMapTypeStandard, integerValue) 37 | 38 | + (RCTAMapAnnotation *)RCTAMapAnnotation:(id)json 39 | { 40 | json = [self NSDictionary:json]; 41 | RCTAMapAnnotation *annotation = [RCTAMapAnnotation new]; 42 | annotation.coordinate = [self CLLocationCoordinate2D:json]; 43 | annotation.draggable = [self BOOL:json[@"draggable"]]; 44 | annotation.title = [self NSString:json[@"title"]]; 45 | annotation.subtitle = [self NSString:json[@"subtitle"]]; 46 | annotation.identifier = [self NSString:json[@"id"]]; 47 | annotation.hasLeftCallout = [self BOOL:json[@"hasLeftCallout"]]; 48 | annotation.hasRightCallout = [self BOOL:json[@"hasRightCallout"]]; 49 | annotation.animateDrop = [self BOOL:json[@"animateDrop"]]; 50 | annotation.tintColor = [self NSUInteger:json[@"tintColor"]]; 51 | annotation.image = [self UIImage:json[@"image"]]; 52 | annotation.viewIndex = [self NSInteger:json[@"viewIndex"] ? :@(NSNotFound)]; 53 | annotation.leftCalloutViewIndex = 54 | [self NSInteger:json[@"leftCalloutViewIndex"] ?: @(NSNotFound)]; 55 | annotation.rightCalloutViewIndex = 56 | [self NSInteger:json[@"rightCalloutViewIndex"] ?: @(NSNotFound)]; 57 | annotation.detailCalloutViewIndex = 58 | [self NSInteger:json[@"detailCalloutViewIndex"] ?: @(NSNotFound)]; 59 | return annotation; 60 | } 61 | 62 | RCT_ARRAY_CONVERTER(RCTAMapAnnotation) 63 | 64 | + (RCTAMapOverlay *)RCTAMapOverlay:(id)json 65 | { 66 | json = [self NSDictionary:json]; 67 | 68 | NSArray *locations = [self NSDictionaryArray:json[@"coordinates"]]; 69 | CLLocationCoordinate2D coordinates[locations.count]; 70 | NSUInteger index = 0; 71 | for (NSDictionary *location in locations) { 72 | coordinates[index++] = [self CLLocationCoordinate2D:location]; 73 | } 74 | 75 | RCTAMapOverlay *overlay = [RCTAMapOverlay polylineWithCoordinates:coordinates 76 | count:locations.count]; 77 | 78 | overlay.strokeColor = [self UIColor:json[@"strokeColor"]]; 79 | overlay.identifier = [self NSString:json[@"id"]]; 80 | overlay.lineWidth = [self CGFloat:json[@"lineWidth"] ?: @1]; 81 | return overlay; 82 | 83 | } 84 | 85 | RCT_ARRAY_CONVERTER(RCTAMapOverlay) 86 | 87 | @end 88 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-native-yyamap", 3 | "version": "0.0.1", 4 | "description": "amap(gaode map) sdk for react-native", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "git+https://github.com/yiyangest/react-native-yyamap.git%22.git" 12 | }, 13 | "keywords": [ 14 | "amap", 15 | "react-native" 16 | ], 17 | "author": "yiyangest", 18 | "license": "MIT", 19 | "bugs": { 20 | "url": "https://github.com/yiyangest/react-native-yyamap.git%22/issues" 21 | }, 22 | "homepage": "https://github.com/yiyangest/react-native-yyamap.git%22#readme" 23 | } 24 | --------------------------------------------------------------------------------