diff --git a/lib/Modules/hyzp_yibin_bmfmap b/lib/Modules/hyzp_yibin_bmfmap index 8e791a4..a069f17 160000 --- a/lib/Modules/hyzp_yibin_bmfmap +++ b/lib/Modules/hyzp_yibin_bmfmap @@ -1 +1 @@ -Subproject commit 8e791a4e987ac0dfeae2bd81a0ec24c9603580b7 +Subproject commit a069f17fade5e24926cb14b566aa0cff00526cf8 diff --git a/lib/my_flutter_bmfmap-1.0.2/.vscode/launch.json b/lib/my_flutter_bmfmap-1.0.2/.vscode/launch.json deleted file mode 100644 index 3287bb6..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/.vscode/launch.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "name": "Flutter", - "request": "launch", - "type": "dart" - } - ] -} \ No newline at end of file diff --git a/lib/my_flutter_bmfmap-1.0.2/CHANGELOG.md b/lib/my_flutter_bmfmap-1.0.2/CHANGELOG.md deleted file mode 100644 index 0fe55ac..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/CHANGELOG.md +++ /dev/null @@ -1,9 +0,0 @@ -## 1.0.0 - -* TODO: Describe initial release. - -## 1.0.1 -提升版本号 - -## 1.0.2 -解决了与其它Flutter插件冲突的问题 diff --git a/lib/my_flutter_bmfmap-1.0.2/LICENSE b/lib/my_flutter_bmfmap-1.0.2/LICENSE deleted file mode 100644 index 4eb6358..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/LICENSE +++ /dev/null @@ -1,13 +0,0 @@ -Copyright (C) 2020 Baidu, Inc. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. \ No newline at end of file diff --git a/lib/my_flutter_bmfmap-1.0.2/README.md b/lib/my_flutter_bmfmap-1.0.2/README.md deleted file mode 100644 index abbf597..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/README.md +++ /dev/null @@ -1,14 +0,0 @@ -# flutter_bmfmap - -A new Flutter plugin for BaiDuMap. - -## Getting Started - -This project is a starting point for a Flutter -[plug-in package](https://flutter.dev/developing-packages/), -a specialized package that includes platform-specific implementation code for -Android and/or iOS. - -For help getting started with Flutter, view our -[online documentation](https://flutter.dev/docs), which offers tutorials, -samples, guidance on mobile development, and a full API reference. diff --git a/lib/my_flutter_bmfmap-1.0.2/analysis_options.yaml b/lib/my_flutter_bmfmap-1.0.2/analysis_options.yaml deleted file mode 100644 index 2d54aab..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/analysis_options.yaml +++ /dev/null @@ -1,27 +0,0 @@ -# include: package:pedantic/analysis_options.1.9.0.yaml - -analyzer: - errors: - unused_import: warning - unused_shown_name: warning - exclude: - - 'doc/**' - - 'lib/src/third_party/pkg/**' - - 'lib/templates/*.html' - - 'pub.dartlang.org/**' - - 'testing/**' - - 'testing/test_package_flutter_plugin/**' - - 'testing/test_package_export_error/**' -linter: - rules: - # - always_declare_return_types - - annotate_overrides - - avoid_init_to_null - - directives_ordering - - no_adjacent_strings_in_list - - package_api_docs - - prefer_final_fields - - prefer_generic_function_type_aliases - - slash_for_doc_comments - - unawaited_futures -# - unnecessary_brace_in_string_interps diff --git a/lib/my_flutter_bmfmap-1.0.2/android/.gitignore b/lib/my_flutter_bmfmap-1.0.2/android/.gitignore deleted file mode 100644 index c6cbe56..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/android/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -*.iml -.gradle -/local.properties -/.idea/workspace.xml -/.idea/libraries -.DS_Store -/build -/captures diff --git a/lib/my_flutter_bmfmap-1.0.2/android/build.gradle b/lib/my_flutter_bmfmap-1.0.2/android/build.gradle deleted file mode 100644 index ac19be4..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/android/build.gradle +++ /dev/null @@ -1,46 +0,0 @@ -group 'com.baidu.flutter_bmfmap' -version '1.0' - - -buildscript { - repositories { - google() - jcenter() - } - - dependencies { - classpath 'com.android.tools.build:gradle:3.5.0' - } -} - -rootProject.allprojects { - repositories { - google() - jcenter() - } -} - -apply plugin: 'com.android.library' - -android { - compileSdkVersion 28 - - defaultConfig { - minSdkVersion 16 - } - lintOptions { - disable 'InvalidPackage' - } - -} - -repositories { - mavenLocal() -} - - -dependencies { - implementation fileTree(includes: ['*.jar'], dir: 'libs') - implementation rootProject.findProject(":flutter_bmfbase") - implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0' -} diff --git a/lib/my_flutter_bmfmap-1.0.2/android/gradle.properties b/lib/my_flutter_bmfmap-1.0.2/android/gradle.properties deleted file mode 100644 index 38c8d45..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/android/gradle.properties +++ /dev/null @@ -1,4 +0,0 @@ -org.gradle.jvmargs=-Xmx1536M -android.enableR8=true -android.useAndroidX=true -android.enableJetifier=true diff --git a/lib/my_flutter_bmfmap-1.0.2/android/gradle/wrapper/gradle-wrapper.properties b/lib/my_flutter_bmfmap-1.0.2/android/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 01a286e..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/android/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip diff --git a/lib/my_flutter_bmfmap-1.0.2/android/settings.gradle b/lib/my_flutter_bmfmap-1.0.2/android/settings.gradle deleted file mode 100644 index 3cd351e..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/android/settings.gradle +++ /dev/null @@ -1 +0,0 @@ -rootProject.name = 'flutter_bmfmap' diff --git a/lib/my_flutter_bmfmap-1.0.2/android/src/main/AndroidManifest.xml b/lib/my_flutter_bmfmap-1.0.2/android/src/main/AndroidManifest.xml deleted file mode 100644 index 863f1f7..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/android/src/main/AndroidManifest.xml +++ /dev/null @@ -1,3 +0,0 @@ - - diff --git a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/BMFEventHandler.java b/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/BMFEventHandler.java deleted file mode 100644 index 722a6cd..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/BMFEventHandler.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.baidu.flutter_bmfmap; - -import android.content.Context; - -import com.baidu.mapapi.map.MapView; - -import io.flutter.plugin.common.BinaryMessenger; -import io.flutter.plugin.common.EventChannel; -import io.flutter.plugin.common.MethodChannel; - -public class BMFEventHandler implements EventChannel.StreamHandler { - - private Context mContext; - - private ViewType mMapView; - - private BinaryMessenger mMessager; - - private MethodChannel mMethodChannel; - private EventChannel mEventChannel; - - public BMFEventHandler(Context context, ViewType mapView, MethodChannel methodChannel, EventChannel eventChannel){ - mContext = context; - mMapView = mapView; - mMethodChannel = methodChannel; - mEventChannel = eventChannel; - } - - @Override - public void onListen(Object arguments, EventChannel.EventSink events) { - - } - - @Override - public void onCancel(Object arguments) { - - } -} diff --git a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/BMFHandlerHelper.java b/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/BMFHandlerHelper.java deleted file mode 100644 index dc35c0b..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/BMFHandlerHelper.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.baidu.flutter_bmfmap; - -import android.content.Context; - -import com.baidu.flutter_bmfmap.map.FlutterCommonMapView; - -import io.flutter.plugin.common.EventChannel; -import io.flutter.plugin.common.MethodChannel; - -public class BMFHandlerHelper { - - private MethodChannel mMethodChannel; - - private BMFMethodHandler mBMFMethodHandler; - - private EventChannel mEventChannel; - - private BMFEventHandler mBMFEventHandler; - - public BMFHandlerHelper(Context context - , FlutterCommonMapView mapView - , MethodChannel methodChannel - , EventChannel eventChannel){ - init(context, mapView, methodChannel, eventChannel); - } - - private void init(Context context, FlutterCommonMapView mapView, MethodChannel methodChannel, EventChannel eventChannel){ - mMethodChannel = methodChannel; - mBMFMethodHandler = new BMFMethodHandler(context, mapView, methodChannel, eventChannel); - mMethodChannel.setMethodCallHandler(mBMFMethodHandler); - - mEventChannel = eventChannel; - mBMFEventHandler = new BMFEventHandler(context, mapView, methodChannel, eventChannel); - mEventChannel.setStreamHandler(mBMFEventHandler); - } -} diff --git a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/BMFMethodHandler.java b/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/BMFMethodHandler.java deleted file mode 100644 index 820f926..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/BMFMethodHandler.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.baidu.flutter_bmfmap; - -import android.content.Context; -import android.util.Log; - -import com.baidu.flutter_bmfmap.map.mapHandler.BMapHandlerFactory; -import com.baidu.flutter_bmfmap.map.FlutterCommonMapView; -import com.baidu.flutter_bmfmap.map.overlayHandler.OverlayHandlerFactory; -import com.baidu.flutter_bmfmap.utils.Env; -import com.baidu.mapapi.map.BaiduMap; - -import io.flutter.plugin.common.EventChannel; -import io.flutter.plugin.common.MethodCall; -import io.flutter.plugin.common.MethodChannel; - -public class BMFMethodHandler implements MethodChannel.MethodCallHandler { - private static final String TAG = "BMFMethodHandler"; - - private Context mContext; - private FlutterCommonMapView mMapView; - private final BaiduMap mBaiduMap; - private MethodChannel mMethodChannel; - private EventChannel mEventChannel; - - public BMFMethodHandler(Context context - ,FlutterCommonMapView mapView - ,MethodChannel methodChannel - ,EventChannel eventChannel){ - mContext = context; - mMapView = mapView; - mBaiduMap = mapView.getBaiduMap(); - mMethodChannel = methodChannel; - mEventChannel = eventChannel; - } - - - - @Override - public void onMethodCall(MethodCall call, MethodChannel.Result result) { - if(Env.DEBUG){ - Log.d(TAG,"onMethodCall enter"); - } - - if(null == call || null == result){ - Log.d(TAG,"null == call || null == result"); - return; - } - - if (null == mMapView || null == mBaiduMap) { - Log.d(TAG,"mMapView == call || mBaiduMap == result"); - return; - } - - boolean ret = OverlayHandlerFactory.getInstance(mBaiduMap).dispatchMethodHandler(call, - result); - - if (!ret) { - BMapHandlerFactory.getInstance(mMapView).dispatchMethodHandler(mContext,call, - result, mMethodChannel); - } - } -} diff --git a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/FlutterBmfmapPlugin.java b/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/FlutterBmfmapPlugin.java deleted file mode 100644 index 8cd6288..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/FlutterBmfmapPlugin.java +++ /dev/null @@ -1,127 +0,0 @@ -package com.baidu.flutter_bmfmap; - -import android.util.Log; - -import androidx.annotation.NonNull; - -import com.baidu.flutter_bmfmap.map.OfflineHandler; -import com.baidu.flutter_bmfmap.utils.Constants; - -import io.flutter.embedding.engine.plugins.FlutterPlugin; -import io.flutter.embedding.engine.plugins.activity.ActivityAware; -import io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding; -import io.flutter.plugin.common.BinaryMessenger; -import io.flutter.plugin.common.MethodCall; -import io.flutter.plugin.common.MethodChannel.MethodCallHandler; -import io.flutter.plugin.common.MethodChannel.Result; -import io.flutter.plugin.common.PluginRegistry.Registrar; -import io.flutter.plugin.platform.PlatformViewRegistry; - -/** FlutterBmfmapPlugin */ -public class FlutterBmfmapPlugin implements FlutterPlugin, ActivityAware, MethodCallHandler { - private static final String TAG = FlutterBmfmapPlugin.class.getSimpleName(); - - private OfflineHandler mOfflineHandler; - private PlatformViewRegistry mPlatformViewRegistry; - private BinaryMessenger mMessenger; - - @Override - public void onAttachedToEngine(@NonNull FlutterPluginBinding flutterPluginBinding) { - if(null == flutterPluginBinding){ - return; - } - - mMessenger = flutterPluginBinding.getBinaryMessenger(); - if (null == mMessenger) { - return; - } - - mOfflineHandler = new OfflineHandler(); - mOfflineHandler.init(mMessenger); - - mPlatformViewRegistry = flutterPluginBinding.getPlatformViewRegistry(); - } - - // This static function is optional and equivalent to onAttachedToEngine. It supports the old - // pre-Flutter-1.12 Android projects. You are encouraged to continue supporting - // plugin registration via this function while apps migrate to use the new Android APIs - // post-flutter-1.12 via https://flutter.dev/go/android-project-migration. - // - // It is encouraged to share logic between onAttachedToEngine and registerWith to keep - // them functionally equivalent. Only one of onAttachedToEngine or registerWith will be called - // depending on the user's project. onAttachedToEngine or registerWith must both be defined - // in the same class. - public static void registerWith(Registrar registrar) { - OfflineHandler offlineHandler = new OfflineHandler(); - offlineHandler.init(registrar.messenger()); - - registrar.platformViewRegistry().registerViewFactory( - Constants.ViewType.sMapView, - new MapViewFactory(registrar.activity() - , registrar.messenger() - , Constants.ViewType.sMapView)); - - registrar.platformViewRegistry().registerViewFactory( - Constants.ViewType.sTextureMapView, - new TextureMapViewFactory(registrar.activity() - , registrar.messenger() - , Constants.ViewType.sTextureMapView)); - } - - @Override - public void onMethodCall(@NonNull MethodCall call, @NonNull Result result) { - if (call.method.equals("getPlatformVersion")) { - result.success("Android " + android.os.Build.VERSION.RELEASE); - }else{ - - } - } - - @Override - public void onDetachedFromEngine(@NonNull FlutterPluginBinding binding) { - if(null == binding){ - return; - } - - BinaryMessenger binaryMessenger = binding.getBinaryMessenger(); - if(null == binaryMessenger){ - return; - } - - mOfflineHandler.unInit(binding.getBinaryMessenger()); - } - - @Override - public void onAttachedToActivity(ActivityPluginBinding binding) { - if(null == binding || null == mPlatformViewRegistry || null == mMessenger){ - return; - } - - mPlatformViewRegistry.registerViewFactory( - Constants.ViewType.sMapView, - new MapViewFactory(binding.getActivity() - , mMessenger - , Constants.ViewType.sMapView)); - - mPlatformViewRegistry.registerViewFactory( - Constants.ViewType.sTextureMapView, - new TextureMapViewFactory(binding.getActivity() - , mMessenger - , Constants.ViewType.sTextureMapView)); - } - - @Override - public void onDetachedFromActivityForConfigChanges() { - Log.d(TAG, "onDetachedFromActivityForConfigChanges"); - } - - @Override - public void onReattachedToActivityForConfigChanges(ActivityPluginBinding binding) { - Log.d(TAG, "onReattachedToActivityForConfigChanges"); - } - - @Override - public void onDetachedFromActivity() { - Log.d(TAG, "onDetachedFromActivity"); - } -} diff --git a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/MapViewFactory.java b/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/MapViewFactory.java deleted file mode 100644 index b64cfdf..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/MapViewFactory.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.baidu.flutter_bmfmap; - -import android.content.Context; -import android.util.Log; - -import io.flutter.plugin.common.BinaryMessenger; -import io.flutter.plugin.common.StandardMessageCodec; -import io.flutter.plugin.platform.PlatformView; -import io.flutter.plugin.platform.PlatformViewFactory; - -import com.baidu.flutter_bmfmap.map.FlutterMapView; -import com.baidu.flutter_bmfmap.utils.Env; - -public class MapViewFactory extends PlatformViewFactory { - - private static final String TAG = "ViewFactory"; - private BinaryMessenger mMessenger; - private Context mContext; - private String mViewType; - /** - * @param messenger the codec used to decode the args parameter of {@link #create}. - */ - public MapViewFactory(Context context, BinaryMessenger messenger, String viewType) { - super(StandardMessageCodec.INSTANCE); - if(Env.DEBUG){ - Log.d(TAG, "ViewFactory"); - } - mContext = context; - mMessenger = messenger; - mViewType = viewType; - } - - @Override - public PlatformView create(Context context, int viewId, Object args) { - if(Env.DEBUG){ - Log.d(TAG, "create"); - } - return new FlutterMapView(mContext, mMessenger, viewId, args, mViewType); - } -} diff --git a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/TextureMapViewFactory.java b/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/TextureMapViewFactory.java deleted file mode 100644 index b24cd16..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/TextureMapViewFactory.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.baidu.flutter_bmfmap; - -import android.content.Context; -import android.util.Log; - -import com.baidu.flutter_bmfmap.map.FlutterMapView; -import com.baidu.flutter_bmfmap.map.FlutterTextureMapView; -import com.baidu.flutter_bmfmap.utils.Env; - -import io.flutter.plugin.common.BinaryMessenger; -import io.flutter.plugin.common.MessageCodec; -import io.flutter.plugin.common.StandardMessageCodec; -import io.flutter.plugin.platform.PlatformView; -import io.flutter.plugin.platform.PlatformViewFactory; - -public class TextureMapViewFactory extends PlatformViewFactory { - - private static final String TAG = "ViewFactory"; - private BinaryMessenger mMessenger; - private Context mContext; - private String mViewType; - /** - * @param messenger the codec used to decode the args parameter of {@link #create}. - */ - public TextureMapViewFactory(Context context, BinaryMessenger messenger, String viewType) { - super(StandardMessageCodec.INSTANCE); - if(Env.DEBUG){ - Log.d(TAG, "ViewFactory"); - } - mContext = context; - mMessenger = messenger; - mViewType = viewType; - } - - @Override - public PlatformView create(Context context, int viewId, Object args) { - if(Env.DEBUG){ - Log.d(TAG, "create"); - } - return new FlutterTextureMapView(mContext, mMessenger, viewId, args, mViewType); - } -} \ No newline at end of file diff --git a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/FlutterBaseMapView.java b/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/FlutterBaseMapView.java deleted file mode 100644 index 7733f8c..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/FlutterBaseMapView.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.baidu.flutter_bmfmap.map; - -import java.util.Map; - -public abstract class FlutterBaseMapView { - - protected String mViewType; - - protected boolean mResume = false; - - protected int mGetViewCount = 0; - - protected abstract void init(int viewId, Object args); - - protected abstract void initMapView(Object args, FlutterCommonMapView flutterCommonMapView); - - protected void initMapStatus(Map mapOptionsMap, - FlutterCommonMapView flutterCommonMapView) { - if (null == mapOptionsMap) { - return; - } - - MapStateUpdateImp.getInstance() - .setCommView(flutterCommonMapView) - .updateMapState(mapOptionsMap); - } -} \ No newline at end of file diff --git a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/FlutterCommonMapView.java b/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/FlutterCommonMapView.java deleted file mode 100644 index 35205f0..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/FlutterCommonMapView.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.baidu.flutter_bmfmap.map; - -import com.baidu.flutter_bmfmap.utils.Constants; -import com.baidu.mapapi.map.BaiduMap; -import com.baidu.mapapi.map.MapView; -import com.baidu.mapapi.map.TextureMapView; - -import java.util.Map; - -public abstract class FlutterCommonMapView{ - protected String mViewType; - public String getViewType(){ - return mViewType; - } - - - - public void setmViewType(String viewType){ - mViewType = viewType; - } - - abstract public MapView getMapView(); - abstract public TextureMapView getTextureMapView(); - - public BaiduMap getBaiduMap(){ - BaiduMap baiduMap = null; - switch (mViewType){ - case Constants.ViewType.sMapView: - baiduMap = getBaiduMapFromMapView(); - break; - case Constants.ViewType.sTextureMapView: - baiduMap = getBaiduMapFromTextureMapView(); - break; - default: - break; - } - - return baiduMap; - } - - private BaiduMap getBaiduMapFromMapView(){ - MapView mapView = this.getMapView(); - if(null == mapView){ - return null; - } - - return mapView.getMap(); - } - - private BaiduMap getBaiduMapFromTextureMapView(){ - TextureMapView textureMapView = this.getTextureMapView(); - if(null == textureMapView){ - return null; - } - - return textureMapView.getMap(); - } -} \ No newline at end of file diff --git a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/FlutterMapView.java b/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/FlutterMapView.java deleted file mode 100644 index 8dec263..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/FlutterMapView.java +++ /dev/null @@ -1,170 +0,0 @@ -package com.baidu.flutter_bmfmap.map; - -import static com.baidu.flutter_bmfmap.utils.Constants.MAX_GET_VIEW_CNT_BY_FLUTTER_RESIZE; - -import java.util.Map; - -import com.baidu.flutter_bmfmap.BMFHandlerHelper; -import com.baidu.flutter_bmfmap.map.mapHandler.BMapHandlerFactory; -import com.baidu.flutter_bmfmap.map.overlayHandler.OverlayHandlerFactory; -import com.baidu.flutter_bmfmap.utils.Constants; -import com.baidu.flutter_bmfmap.utils.Env; -import com.baidu.mapapi.map.MapView; - -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.Intent; -import android.content.IntentFilter; -import android.util.Log; -import android.view.View; -import androidx.annotation.NonNull; -import androidx.localbroadcastmanager.content.LocalBroadcastManager; -import io.flutter.plugin.common.BinaryMessenger; -import io.flutter.plugin.common.EventChannel; -import io.flutter.plugin.common.MethodChannel; -import io.flutter.plugin.platform.PlatformView; - -public class FlutterMapView extends FlutterBaseMapView implements PlatformView { - - private static final String TAG = "FlutterMapView"; - - private MapView mMapView; - - private Context mContext; - - private BinaryMessenger mMessager; - - private BMFHandlerHelper mBMFHandlerHelper; - - private MethodChannel mMethodChannel; - - private EventChannel mEventChannel; - - private BroadcastReceiver mReceiver = new BroadcastReceiver() { - @Override - public void onReceive(Context context, Intent intent) { - String action = intent.getAction(); - if (Constants.sConfigChangedAction.equals(action) && !mResume) { - mResume = true; - } - } - }; - - public FlutterMapView(Context context, - BinaryMessenger messenger, - int viewId, - Object args, - String viewType) { - if (Env.DEBUG) { - Log.d(TAG, "FlutterMapView"); - } - mContext = context; - mMessager = messenger; - mViewType = viewType; - init(viewId, args); - } - - protected void init(int viewId, Object args) { - if (Env.DEBUG) { - Log.d(TAG, "init"); - } - - mMapView = new MapView(mContext); - FlutterCommonMapView mapViewWrapper = new MapViewWrapper(this, mViewType); - initMapView(args, mapViewWrapper); - - mMethodChannel = new MethodChannel(mMessager, - Constants.VIEW_METHOD_CHANNEL_PREFIX + (char) (viewId + 97)); - - mEventChannel = new EventChannel(mMessager, - Constants.VIEW_EVENT_CHANNEL_PREFIX + (char) (viewId + 97)); - - mBMFHandlerHelper = - new BMFHandlerHelper(mContext, mapViewWrapper, mMethodChannel, mEventChannel); - - new MapListener(new MapViewWrapper(this, mViewType), mMethodChannel); - - IntentFilter intentFilter = new IntentFilter(Constants.sConfigChangedAction); - LocalBroadcastManager.getInstance(mContext).registerReceiver(mReceiver, intentFilter); - - if (Env.DEBUG) { - Log.d(TAG, "init success"); - } - } - - protected void initMapView(Object args, FlutterCommonMapView flutterCommonMapView) { - if (null == mContext) { - return; - } - - Map mapOptionsMap = (Map) args; - if (null == mapOptionsMap) { - return; - } - - initMapStatus(mapOptionsMap, flutterCommonMapView); - } - - @Override - public View getView() { - if (Env.DEBUG) { - Log.d(TAG, "getView"); - } - - if (mResume) { - mGetViewCount++; - } - - if (mGetViewCount >= MAX_GET_VIEW_CNT_BY_FLUTTER_RESIZE - 1) { - mMapView.onResume(); - mResume = false; - mGetViewCount = 0; - } - - return mMapView; - } - - @Override - public void onFlutterViewAttached(@NonNull View flutterView) { - if (Env.DEBUG) { - Log.d(TAG, "onFlutterViewAttached"); - } - if (null != mMapView) { - mMapView.onResume(); - } - } - - @Override - public void onFlutterViewDetached() { - if (Env.DEBUG) { - Log.d(TAG, "onFlutterViewDetached"); - } - if (null != mMapView) { - mMapView.onPause(); - } - } - - @Override - public void dispose() { - if (Env.DEBUG) { - Log.d(TAG, "dispose"); - } - - LocalBroadcastManager.getInstance(mContext).unregisterReceiver(mReceiver); - - BMapHandlerFactory.getInstance(null).clean(); - OverlayHandlerFactory.getInstance(null).clean(); - - if (null != mMapView) { - mMapView.onDestroy(); - } - } - - public void setResumeState(boolean resume) { - mResume = true; - } - - public MapView getMapView() { - return mMapView; - } -} diff --git a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/FlutterTextureMapView.java b/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/FlutterTextureMapView.java deleted file mode 100644 index aaea82b..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/FlutterTextureMapView.java +++ /dev/null @@ -1,152 +0,0 @@ -package com.baidu.flutter_bmfmap.map; - -import static com.baidu.flutter_bmfmap.utils.Constants.MAX_GET_VIEW_CNT_BY_FLUTTER_RESIZE; - -import java.util.Map; - -import com.baidu.flutter_bmfmap.BMFHandlerHelper; -import com.baidu.flutter_bmfmap.utils.Constants; -import com.baidu.flutter_bmfmap.utils.Env; -import com.baidu.mapapi.map.TextureMapView; - -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.Intent; -import android.content.IntentFilter; -import android.util.Log; -import android.view.View; -import androidx.annotation.NonNull; -import androidx.localbroadcastmanager.content.LocalBroadcastManager; -import io.flutter.plugin.common.BinaryMessenger; -import io.flutter.plugin.common.EventChannel; -import io.flutter.plugin.common.MethodChannel; -import io.flutter.plugin.platform.PlatformView; - -public class FlutterTextureMapView extends FlutterBaseMapView implements PlatformView { - - private static final String TAG = "FlutterMapView"; - - private TextureMapView mTextureMapView; - - private Context mContext; - - private BinaryMessenger mMessager; - - private BMFHandlerHelper mBMFHandlerHelper; - - private MethodChannel mMethodChannel; - - private EventChannel mEventChannel; - - private BroadcastReceiver mReceiver = new BroadcastReceiver() { - @Override - public void onReceive(Context context, Intent intent) { - String action = intent.getAction(); - if (Constants.sConfigChangedAction.equals(action) && !mResume) { - mResume = true; - } - } - }; - - public FlutterTextureMapView(Context context, - BinaryMessenger messenger, - int viewId, - Object args, - String viewType) { - Log.d(TAG, "FlutterMapView"); - mContext = context; - mMessager = messenger; - mViewType = viewType; - init(viewId, args); - } - - protected void init(int viewId, Object args) { - if (Env.DEBUG) { - Log.d(TAG, "init"); - } - - mTextureMapView = new TextureMapView(mContext); - FlutterCommonMapView flutterCommonMapView = - new TextureMapViewWrapper(mTextureMapView, mViewType); - initMapView(args, flutterCommonMapView); - - mMethodChannel = new MethodChannel(mMessager, - Constants.VIEW_METHOD_CHANNEL_PREFIX + (char) (viewId + 97)); - - mEventChannel = new EventChannel(mMessager, - Constants.VIEW_EVENT_CHANNEL_PREFIX + (char) (viewId + 97)); - - mBMFHandlerHelper = - new BMFHandlerHelper(mContext, flutterCommonMapView, mMethodChannel, mEventChannel); - - new MapListener(new TextureMapViewWrapper(mTextureMapView, mViewType), mMethodChannel); - - IntentFilter intentFilter = new IntentFilter(Constants.sConfigChangedAction); - LocalBroadcastManager.getInstance(mContext).registerReceiver(mReceiver, intentFilter); - - if (Env.DEBUG) { - Log.d(TAG, "init success"); - } - } - - protected void initMapView(Object args, FlutterCommonMapView flutterCommonMapView) { - if (null == mContext) { - return; - } - - Map mapOptionsMap = (Map) args; - if (null == mapOptionsMap) { - return; - } - - initMapStatus(mapOptionsMap, flutterCommonMapView); - } - - @Override - public View getView() { - if (Env.DEBUG) { - Log.d(TAG, "getView"); - } - - if (mResume) { - mGetViewCount++; - } - - if (mGetViewCount >= MAX_GET_VIEW_CNT_BY_FLUTTER_RESIZE - 1) { - mTextureMapView.onResume(); - mResume = false; - mGetViewCount = 0; - } - - return mTextureMapView; - } - - @Override - public void onFlutterViewAttached(@NonNull View flutterView) { - if (null != mTextureMapView) { - mTextureMapView.onResume(); - } - - } - - @Override - public void onFlutterViewDetached() { - if (null != mTextureMapView) { - mTextureMapView.onPause(); - } - - } - - @Override - public void dispose() { - if (Env.DEBUG) { - Log.d(TAG, "dispose"); - } - - LocalBroadcastManager.getInstance(mContext).unregisterReceiver(mReceiver); - - if (null != mTextureMapView) { - mTextureMapView.onDestroy(); - } - } -} diff --git a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/MapListener.java b/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/MapListener.java deleted file mode 100644 index d0fa805..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/MapListener.java +++ /dev/null @@ -1,696 +0,0 @@ -package com.baidu.flutter_bmfmap.map; - -import android.graphics.Point; -import android.os.Bundle; -import android.text.TextUtils; -import android.util.Log; - -import com.baidu.flutter_bmfmap.utils.Constants; -import com.baidu.flutter_bmfmap.utils.Env; -import android.os.Message; - -import com.baidu.mapapi.map.BaiduMap; -import com.baidu.mapapi.map.MapBaseIndoorMapInfo; -import com.baidu.mapapi.map.MapPoi; -import com.baidu.mapapi.map.MapStatus; -import com.baidu.mapapi.map.Marker; -import com.baidu.mapapi.map.Polyline; -import com.baidu.mapapi.model.LatLng; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import android.os.Handler; -import javax.microedition.khronos.opengles.GL10; - -import io.flutter.plugin.common.MethodChannel; -import com.baidu.flutter_bmfmap.utils.ThreadPoolUtil; -import com.baidu.mapapi.model.LatLngBounds; - - -@SuppressWarnings("unchecked") -public class MapListener implements BaiduMap.OnMapClickListener ,BaiduMap.OnMapLoadedCallback, - BaiduMap.OnMapStatusChangeListener ,BaiduMap.OnMapRenderCallback,BaiduMap.OnMapDrawFrameCallback, - BaiduMap.OnBaseIndoorMapListener ,BaiduMap.OnMarkerClickListener,BaiduMap.OnPolylineClickListener, - BaiduMap.OnMapDoubleClickListener,BaiduMap.OnMapLongClickListener,BaiduMap.OnMarkerDragListener, - BaiduMap.OnMapRenderValidDataListener,BaiduMap.OnMyLocationClickListener { - - private static final int DRAW_FRAME_MESSAGE = 0; - private static final String TAG = "MapListener"; - private BaiduMap mBaiduMap; - private MethodChannel mMethodChannel; - private int mReason; - private HashMap mStatusMap; - - private final Handler mHandler = new Handler(){ - public void handleMessage(Message msg) { - super.handleMessage(msg); - if (msg.what == DRAW_FRAME_MESSAGE) { - if (null != mStatusMap){ - mMethodChannel.invokeMethod( - Constants.MethodProtocol.MapStateProtocol.sMapOnDrawMapFrameCallback,mStatusMap); - } - } - } - }; - - - public MapListener(FlutterCommonMapView mapView, MethodChannel methodChannel) { - this.mMethodChannel = methodChannel; - - if (null == mapView) { - return; - } - mBaiduMap = mapView.getBaiduMap(); - initListener(); - } - - private void initListener() { - if (null == mBaiduMap) { - return; - } - mBaiduMap.setOnMapClickListener(this); - mBaiduMap.setOnMapLoadedCallback(this); - mBaiduMap.setOnMapStatusChangeListener(this); - mBaiduMap.setOnMapDrawFrameCallback(this); - mBaiduMap.setOnMapRenderCallbadk(this); - mBaiduMap.setOnBaseIndoorMapListener(this); - mBaiduMap.setOnMarkerClickListener(this); - mBaiduMap.setOnPolylineClickListener(this); - mBaiduMap.setOnMapDoubleClickListener(this); - mBaiduMap.setOnMapLongClickListener(this); - mBaiduMap.setOnMarkerDragListener(this); - mBaiduMap.setOnMapRenderValidDataListener(this); - mBaiduMap.setOnMyLocationClickListener(this); - } - - @Override - public void onMapClick(LatLng latLng) { - if (null == latLng || mMethodChannel == null) { - return; - } - HashMap coordinateMap = new HashMap<>(); - HashMap coord = new HashMap<>(); - coord.put("latitude",latLng.latitude); - coord.put("longitude",latLng.longitude); - coordinateMap.put("coord",coord); - mMethodChannel.invokeMethod(Constants.MethodProtocol.MapStateProtocol.sMapOnClickedMapBlankCallback,coordinateMap); - } - - @Override - public void onMapPoiClick(MapPoi mapPoi) { - if (null == mapPoi || mMethodChannel == null) { - return; - } - HashMap pt = new HashMap<>(); - LatLng position = mapPoi.getPosition(); - if (null != position) { - pt.put("latitude",mapPoi.getPosition().latitude); - pt.put("longitude",mapPoi.getPosition().longitude); - } - HashMap poiMap = new HashMap<>(); - HashMap poi = new HashMap(); - poi.put("text",mapPoi.getName()); - poi.put("uid",mapPoi.getUid()); - poi.put("pt",pt); - poiMap.put("poi",poi); - mMethodChannel.invokeMethod(Constants.MethodProtocol.MapStateProtocol.sMapOnClickedMapPoiCallback,poiMap); - } - - @Override - public void onMapLoaded() { - mMethodChannel.invokeMethod(Constants.MethodProtocol.MapStateProtocol.sMapDidLoadCallback,""); - } - - @Override - public void onMapStatusChangeStart(MapStatus mapStatus) { - if (null == mapStatus || mMethodChannel == null) { - return; - } - HashMap targetScreenMap = new HashMap<>(); - Point targetScreen = mapStatus.targetScreen; - if (null == targetScreen) { - return; - } - targetScreenMap.put("x", (double) targetScreen.x); - targetScreenMap.put("y", (double) targetScreen.y); - HashMap targetMap = new HashMap<>(); - LatLng latLng = mapStatus.target; - if (null == latLng){ - return; - } - targetMap.put("latitude", latLng.latitude); - targetMap.put("longitude", latLng.longitude); - - LatLngBounds bound = mapStatus.bound; - if (null == bound) { - return; - } - HashMap latLngBoundMap = latLngBounds(bound); - if (null == latLngBoundMap) { - return; - } - HashMap statusMap = new HashMap<>(); - HashMap status = new HashMap(); - status.put("fLevel",((double)mapStatus.zoom)); - double rotate = mapStatus.rotate; - if (rotate > 180) { - rotate = rotate - 360; - } - status.put("fRotation", rotate); - status.put("fOverlooking",((double) mapStatus.overlook)); - status.put("targetScreenPt",targetScreenMap); - status.put("targetGeoPt",targetMap); - status.put("visibleMapBounds",latLngBoundMap); - statusMap.put("mapStatus",status); - mMethodChannel.invokeMethod(Constants.MethodProtocol.MapStateProtocol.sMapRegionWillChangeCallback,statusMap); - } - - @Override - public void onMapStatusChangeStart(MapStatus mapStatus, int reason) { - if (null == mapStatus || mMethodChannel == null) { - return; - } - mReason = reason; - HashMap targetScreenMap = new HashMap<>(); - Point targetScreen = mapStatus.targetScreen; - if (null == targetScreen) { - return; - } - targetScreenMap.put("x", (double) targetScreen.x); - targetScreenMap.put("y", (double) targetScreen.y); - HashMap targetMap = new HashMap<>(); - LatLng latLng = mapStatus.target; - if (null == latLng){ - return; - } - targetMap.put("latitude", latLng.latitude); - targetMap.put("longitude", latLng.longitude); - - LatLngBounds bound = mapStatus.bound; - if (null == bound) { - return; - } - HashMap latLngBoundMap = latLngBounds(bound); - if (null == latLngBoundMap) { - return; - } - HashMap statusMap = new HashMap<>(); - HashMap status = new HashMap(); - status.put("fLevel",((double)mapStatus.zoom)); - double rotate = mapStatus.rotate; - if (rotate > 180) { - rotate = rotate - 360; - } - status.put("fRotation", rotate); - status.put("fOverlooking",((double) mapStatus.overlook)); - status.put("targetScreenPt",targetScreenMap); - status.put("targetGeoPt",targetMap); - status.put("visibleMapBounds",latLngBoundMap); - statusMap.put("mapStatus",status); - statusMap.put("reason",mReason); - mMethodChannel.invokeMethod(Constants.MethodProtocol.MapStateProtocol. - sMapRegionWillChangeWithReasonCallback,statusMap); - } - - @Override - public void onMapStatusChange(MapStatus mapStatus) { - if (null == mapStatus || mMethodChannel == null) { - return; - } - HashMap targetScreenMap = new HashMap<>(); - Point targetScreen = mapStatus.targetScreen; - if (null == targetScreen) { - return; - } - targetScreenMap.put("x", (double) targetScreen.x); - targetScreenMap.put("y", (double) targetScreen.y); - HashMap targetMap = new HashMap<>(); - LatLng latLng = mapStatus.target; - if (null == latLng){ - return; - } - targetMap.put("latitude", latLng.latitude); - targetMap.put("longitude", latLng.longitude); - - LatLngBounds bound = mapStatus.bound; - if (null == bound) { - return; - } - HashMap latLngBoundMap = latLngBounds(bound); - if (null == latLngBoundMap) { - return; - } - HashMap statusMap = new HashMap<>(); - HashMap status = new HashMap(); - status.put("fLevel",((double)mapStatus.zoom)); - double rotate = mapStatus.rotate; - if (rotate > 180) { - rotate = rotate - 360; - } - status.put("fRotation", rotate); - status.put("fOverlooking",((double) mapStatus.overlook)); - status.put("targetScreenPt",targetScreenMap); - status.put("targetGeoPt",targetMap); - status.put("visibleMapBounds",latLngBoundMap); - statusMap.put("mapStatus",status); - - mMethodChannel.invokeMethod( - Constants.MethodProtocol.MapStateProtocol.sMapRegionDidChangeCallback,statusMap); - } - - @Override - public void onMapStatusChangeFinish(MapStatus mapStatus) { - if (null == mapStatus || mMethodChannel == null) { - return; - } - HashMap targetScreenMap = new HashMap<>(); - Point targetScreen = mapStatus.targetScreen; - if (null == targetScreen) { - return; - } - targetScreenMap.put("x", (double) targetScreen.x); - targetScreenMap.put("y", (double) targetScreen.y); - HashMap targetMap = new HashMap<>(); - LatLng latLng = mapStatus.target; - if (null == latLng){ - return; - } - targetMap.put("latitude", latLng.latitude); - targetMap.put("longitude", latLng.longitude); - - LatLngBounds bound = mapStatus.bound; - if (null == bound) { - return; - } - HashMap latLngBoundMap = latLngBounds(bound); - if (null == latLngBoundMap) { - return; - } - HashMap statusMap = new HashMap<>(); - HashMap status = new HashMap(); - status.put("fLevel",((double)mapStatus.zoom)); - double rotate = mapStatus.rotate; - if (rotate > 180) { - rotate = rotate - 360; - } - status.put("fRotation", rotate); - status.put("fOverlooking",((double) mapStatus.overlook)); - status.put("targetScreenPt",targetScreenMap); - status.put("targetGeoPt",targetMap); - status.put("visibleMapBounds",latLngBoundMap); - statusMap.put("mapStatus",status); - statusMap.put("reason",mReason); - mMethodChannel.invokeMethod(Constants.MethodProtocol.MapStateProtocol.sMapRegionDidChangeWithReasonCallback,statusMap); - mMethodChannel.invokeMethod(Constants.MethodProtocol.MapStateProtocol.sMapStatusDidChangedCallback,""); - } - - @Override - public void onMapRenderFinished() { - HashMap hashMap = new HashMap(); - hashMap.put("success",true); - mMethodChannel.invokeMethod(Constants.MethodProtocol.MapStateProtocol.sMapDidFinishRenderCallback,hashMap); - } - - @Override - public void onMapDrawFrame(GL10 gl10, MapStatus mapStatus) { - - } - - @Override - public void onMapDrawFrame(MapStatus mapStatus) { - if (null == mapStatus || mMethodChannel == null) { - return; - } - HashMap targetScreenMap = new HashMap<>(); - Point targetScreen = mapStatus.targetScreen; - if (null == targetScreen) { - return; - } - targetScreenMap.put("x", (double) targetScreen.x); - targetScreenMap.put("y", (double) targetScreen.y); - HashMap targetMap = new HashMap<>(); - LatLng latLng = mapStatus.target; - if (null == latLng){ - return; - } - targetMap.put("latitude", latLng.latitude); - targetMap.put("longitude", latLng.longitude); - - LatLngBounds bound = mapStatus.bound; - if (null == bound) { - return; - } - - HashMap latLngBoundMap = latLngBounds(bound); - if (null == latLngBoundMap) { - return; - } - mStatusMap = new HashMap<>(); - HashMap status = new HashMap(); - status.put("fLevel",((double)mapStatus.zoom)); - double rotate = mapStatus.rotate; - if (rotate > 180) { - rotate = rotate - 360; - } - status.put("fRotation", rotate); - status.put("fOverlooking",((double) mapStatus.overlook)); - status.put("targetScreenPt",targetScreenMap); - status.put("targetGeoPt",targetMap); - status.put("visibleMapBounds",latLngBoundMap); - mStatusMap.put("mapStatus",status); - - ThreadPoolUtil.getInstance().execute(new Runnable() { - @Override - public void run() { - Message msg = Message.obtain(); - msg.arg1 = DRAW_FRAME_MESSAGE; - mHandler.sendMessage(msg); - } - }); - - } - - @Override - public void onBaseIndoorMapMode(boolean isIndoorMap, MapBaseIndoorMapInfo mapBaseIndoorMapInfo) { - if (mMethodChannel == null) { - return; - } - HashMap indoorHashMap = new HashMap(); - indoorHashMap.put("flag",isIndoorMap); - HashMap indoorMap = new HashMap(); - if (isIndoorMap) { - if (null == mapBaseIndoorMapInfo) { - return; - } - String curFloor = mapBaseIndoorMapInfo.getCurFloor(); - String id = mapBaseIndoorMapInfo.getID(); - ArrayList floors = mapBaseIndoorMapInfo.getFloors(); - indoorMap.put("strFloor", curFloor); - indoorMap.put("strID", id); - indoorMap.put("listStrFloors", floors); - } - indoorHashMap.put("info",indoorMap); - mMethodChannel.invokeMethod(Constants.MethodProtocol.MapStateProtocol.sMapInOrOutBaseIndoorMapCallback - ,indoorHashMap); - } - - - @Override - public boolean onMarkerClick(Marker marker) { - if(Env.DEBUG){ - Log.d(TAG, "onMarkerClick"); - } - if(null == mMethodChannel){ - return false; - } - - Bundle bundle = marker.getExtraInfo(); - if(null == bundle){ - if(Env.DEBUG){ - Log.d(TAG, "bundle is null"); - } - return false; - } - - String id = bundle.getString("id"); - if(TextUtils.isEmpty(id)){ - if(Env.DEBUG){ - Log.d(TAG, "marker id is null "); - } - return false; - } - - - Map clickMap = new HashMap<>(); - clickMap.put("id", id); - - mMethodChannel.invokeMethod(Constants.MethodProtocol.MarkerProtocol.sMapClickedmarkedMethod, clickMap); - - return true; - } - - @Override - public boolean onPolylineClick(Polyline polyline) { - - Log.d("polyline", "polyline click"); - - HashMap hashMap = polylineClick(polyline); - HashMap polyLineMap = new HashMap<>(); - polyLineMap.put("polyline", hashMap); - mMethodChannel.invokeMethod(Constants.MethodProtocol.PolylineProtocol.sMapOnClickedOverlayCallback, polyLineMap); - - return true; - } - - private HashMap polylineClick(Polyline polyline) { - if (null == polyline) { - return null; - } - - Bundle bundle = polyline.getExtraInfo(); - String id = bundle.getString("id"); - - HashMap polylineMap = new HashMap(); - - List points = polyline.getPoints(); - List latlngLists = new ArrayList<>(); - if (null != points){ - for (int i = 0; i < points.size(); i++) { - HashMap latlngHashMap = new HashMap<>(); - latlngHashMap.put("latitude",points.get(i).latitude); - latlngHashMap.put("longitude",points.get(i).longitude); - latlngLists.add(latlngHashMap); - } - } - polylineMap.put("id", id); - polylineMap.put("coordinates",latlngLists); - - ArrayList colorList = new ArrayList<>(); - int[] colors = polyline.getColorList(); - if(null != colors){ - for(int i = 0; i < colors.length; i++){ - colorList.add(Integer.toHexString(colors[i])); - } - } - - - polylineMap.put("colors", colorList); - - polylineMap.put("color", polyline.getColor()); - polylineMap.put("lineDashType", polyline.getDottedLineType()); - polylineMap.put("lineCapType", 0); - polylineMap.put("lineJoinType", 0); - polylineMap.put("width", polyline.getWidth()); - polylineMap.put("zIndex", polyline.getZIndex()); - - return polylineMap; - } - - @Override - public void onMapDoubleClick(LatLng latLng) { - if (null == latLng || mMethodChannel == null) { - return; - } - HashMap coordinateMap = new HashMap<>(); - HashMap coord = new HashMap<>(); - coord.put("latitude",latLng.latitude); - coord.put("longitude",latLng.longitude); - coordinateMap.put("coord",coord); - mMethodChannel.invokeMethod(Constants.MethodProtocol.MapStateProtocol.sMapOnDoubleClickCallback,coordinateMap); - } - - @Override - public void onMapLongClick(LatLng latLng) { - if (null == latLng || mMethodChannel == null) { - return; - } - HashMap coordinateMap = new HashMap<>(); - HashMap coord = new HashMap<>(); - coord.put("latitude",latLng.latitude); - coord.put("longitude",latLng.longitude); - coordinateMap.put("coord",coord); - mMethodChannel.invokeMethod(Constants.MethodProtocol.MapStateProtocol.sMapOnLongClickCallback,coordinateMap); - } - - @Override - public void onMarkerDrag(Marker marker) { - if(Env.DEBUG){ - Log.d(TAG, "onMarkerDrag"); - } - if(null == mMethodChannel){ - return; - } - - Bundle bundle = marker.getExtraInfo(); - if(null == bundle){ - return; - } - - String id = bundle.getString("id"); - - if(null == mMethodChannel){ - return; - } - - if(TextUtils.isEmpty(id)){ - if(Env.DEBUG){ - Log.d(TAG, "id is null"); - } - return; - } - - if(TextUtils.isEmpty(id)){ - if(Env.DEBUG){ - Log.d(TAG, "id is null"); - } - return; - } - - - Map dragMap = new HashMap<>(); - dragMap.put("id", id); - Map extraInfoMap = new HashMap<>(); - extraInfoMap.put("state", Constants.MethodProtocol.MarkerProtocol.MarkerDragState.sDragging); - dragMap.put("extra", extraInfoMap); - - mMethodChannel.invokeMethod(Constants.MethodProtocol.MarkerProtocol.sMapDragMarkerMethod, dragMap); - } - - @Override - public void onMarkerDragEnd(Marker marker) { - if(Env.DEBUG){ - Log.d(TAG, "onMarkerDrag"); - } - if(null == mMethodChannel){ - return; - } - - Bundle bundle = marker.getExtraInfo(); - if(null == bundle){ - return; - } - - String id = bundle.getString("id"); - - if(null == mMethodChannel){ - return; - } - - if(TextUtils.isEmpty(id)){ - if(Env.DEBUG){ - Log.d(TAG, "id is null"); - } - return; - } - - LatLng center = marker.getPosition(); - if(null == center){ - return; - } - - Map dragMap = new HashMap<>(); - dragMap.put("id", id); - - Map centerMap = new HashMap<>(); - centerMap.put("latitude", center.latitude); - centerMap.put("longitude", center.longitude); - - Map extraInfoMap = new HashMap<>(); - extraInfoMap.put("center", centerMap); - extraInfoMap.put("state", Constants.MethodProtocol.MarkerProtocol.MarkerDragState.sDragEnd); - dragMap.put("extra", extraInfoMap); - - mMethodChannel.invokeMethod(Constants.MethodProtocol.MarkerProtocol.sMapDragMarkerMethod, dragMap); - } - - @Override - public void onMarkerDragStart(Marker marker) { - if(Env.DEBUG){ - Log.d(TAG, "onMarkerDrag"); - } - - Bundle bundle = marker.getExtraInfo(); - if(null == bundle){ - return; - } - - String id = bundle.getString("id"); - - if(null == mMethodChannel){ - return; - } - - if(TextUtils.isEmpty(id)){ - if(Env.DEBUG){ - Log.d(TAG, "id is null"); - } - return; - } - - LatLng center = marker.getPosition(); - if(null == center){ - return; - } - - Map dragMap = new HashMap<>(); - dragMap.put("id", id); - - Map centerMap = new HashMap<>(); - centerMap.put("latitude", center.latitude); - centerMap.put("longitude", center.longitude); - - Map extraInfoMap = new HashMap<>(); - extraInfoMap.put("center", centerMap); - extraInfoMap.put("state", Constants.MethodProtocol.MarkerProtocol.MarkerDragState.sDragStart); - dragMap.put("extra", extraInfoMap); - - mMethodChannel.invokeMethod(Constants.MethodProtocol.MarkerProtocol.sMapDragMarkerMethod, dragMap); - } - - @Override - public void onMapRenderValidData(boolean isValid, int errorCode, String errorMessage) { - HashMap hashMap = new HashMap(); - hashMap.put("isValid",isValid); - hashMap.put("errorCode",errorCode); - hashMap.put("errorMessage",errorMessage); - mMethodChannel.invokeMethod(Constants.MethodProtocol.MapStateProtocol.sMapRenderValidDataCallback,hashMap); - } - - - @Override - public boolean onMyLocationClick() { - return false; - } - - private HashMap latLngBounds(LatLngBounds latLngBounds) { - if (null == latLngBounds) { - return null; - } - // 该地理范围东北坐标 - LatLng northeast = latLngBounds.northeast; - // 该地理范围西南坐标 - LatLng southwest = latLngBounds.southwest; - - HashMap boundsMap = new HashMap(); - HashMap northeastMap = new HashMap(); - if (null == northeast){ - return null; - } - northeastMap.put("latitude", northeast.latitude); - northeastMap.put("longitude",northeast.longitude); - HashMap southwestMap = new HashMap(); - if (null == southwest) { - return null; - } - southwestMap.put("latitude",southwest.latitude); - southwestMap.put("longitude", southwest.longitude); - boundsMap.put("northeast",northeastMap); - boundsMap.put("southwest",southwestMap); - return boundsMap; - } -} - diff --git a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/MapStateUpdateImp.java b/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/MapStateUpdateImp.java deleted file mode 100644 index b3feafb..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/MapStateUpdateImp.java +++ /dev/null @@ -1,363 +0,0 @@ -package com.baidu.flutter_bmfmap.map; - -import java.util.Map; - -import com.baidu.flutter_bmfmap.map.mapHandler.BMFMapStatus; -import com.baidu.flutter_bmfmap.utils.Constants; -import com.baidu.flutter_bmfmap.utils.Env; -import com.baidu.flutter_bmfmap.utils.converter.FlutterDataConveter; -import com.baidu.flutter_bmfmap.utils.converter.TypeConverter; -import com.baidu.mapapi.map.BaiduMap; -import com.baidu.mapapi.map.LogoPosition; -import com.baidu.mapapi.map.MapStatus; -import com.baidu.mapapi.map.MapStatusUpdate; -import com.baidu.mapapi.map.MapStatusUpdateFactory; -import com.baidu.mapapi.map.MapView; -import com.baidu.mapapi.map.TextureMapView; -import com.baidu.mapapi.map.UiSettings; -import com.baidu.mapapi.model.LatLng; -import com.baidu.mapapi.model.LatLngBounds; - -import android.graphics.Point; -import android.text.TextUtils; - -/** - * 地图状态更新 - */ -public class MapStateUpdateImp { - private static MapStateUpdateImp sInstance = null; - - private String mViewType; - - private FlutterCommonMapView mFlutterCommonMapView; - - private BaiduMap mBaiduMap; - - private UiSettings mUiSettings; - - public static MapStateUpdateImp getInstance() { - if (null == sInstance) { - sInstance = new MapStateUpdateImp(); - } - - return sInstance; - } - - - public MapStateUpdateImp setCommView(FlutterCommonMapView commonMapView) { - if(null == commonMapView){ - return sInstance; - } - - if( mFlutterCommonMapView == commonMapView){ - return sInstance; - } - - mFlutterCommonMapView = commonMapView; - - mBaiduMap = commonMapView.getBaiduMap(); - mViewType = mFlutterCommonMapView.getViewType(); - mBaiduMap = mFlutterCommonMapView.getBaiduMap(); - mUiSettings = mBaiduMap.getUiSettings(); - return sInstance; - } - - public boolean updateMapState(Map mapOptionsMap) { - if (null == mapOptionsMap) { - return false; - } - - if (null == mFlutterCommonMapView || - null == mBaiduMap || - null == mUiSettings || - TextUtils.isEmpty(mViewType)) { - return false; - } - - // 设置地图类型 - Integer mapType = new TypeConverter().getValue(mapOptionsMap, "mapType"); - if (null != mapType) { - setMapType(mapType); - } - - // 设置指南针显示位置 - Map compassPosMap = new TypeConverter>().getValue(mapOptionsMap, "compassPosition"); - Point compassPos = FlutterDataConveter.mapToPoint(compassPosMap); - if (null != compassPos) { - mBaiduMap.setCompassPosition(compassPos); - } - - // 设置地图中心点 - Map centerMap = new TypeConverter>().getValue(mapOptionsMap, "center"); - LatLng center = FlutterDataConveter.mapToLatlng(centerMap); - if (null != center) { - MapStatusUpdate mapStatusUpdate = MapStatusUpdateFactory.newLatLng(center); - mBaiduMap.setMapStatus(mapStatusUpdate); - } - - // 设置地图缩放级别 - Integer zoomLevel = new TypeConverter().getValue(mapOptionsMap, "zoomLevel"); - if (null != zoomLevel) { - MapStatusUpdate mapStatusUpdate = MapStatusUpdateFactory.zoomTo(zoomLevel.floatValue()); - mBaiduMap.setMapStatus(mapStatusUpdate); - } - - // 设置地图最大、最小缩放级别 - Integer minZoomLevel = new TypeConverter().getValue(mapOptionsMap, "minZoomLevel"); - Integer maxZoomLevel = new TypeConverter().getValue(mapOptionsMap, "maxZoomLevel"); - if (null != minZoomLevel && null != maxZoomLevel) { - mBaiduMap.setMaxAndMinZoomLevel(maxZoomLevel.floatValue(), minZoomLevel.floatValue()); - } else if (null == minZoomLevel && null != maxZoomLevel ) { - mBaiduMap.setMaxAndMinZoomLevel(maxZoomLevel.floatValue(),mBaiduMap.getMinZoomLevel()); - } else if (null != minZoomLevel && null == maxZoomLevel) { - mBaiduMap.setMaxAndMinZoomLevel(mBaiduMap.getMaxZoomLevel(), minZoomLevel.floatValue()); - } - - // 设置地图旋转角度 - Double rotation = new TypeConverter().getValue(mapOptionsMap, "rotation"); - if (null != rotation) { - setRotation(rotation.floatValue()); - } - - // 设置地图俯仰角度 - if (mapOptionsMap.containsKey("overlooking")) { - Double overlooking = (Double) mapOptionsMap.get("overlooking"); - if (overlooking != null) { - MapStatus build = new MapStatus.Builder().overlook(overlooking.floatValue()).build(); - MapStatusUpdate mapStatusUpdate = MapStatusUpdateFactory.newMapStatus(build); - mBaiduMap.setMapStatus(mapStatusUpdate); - } - } - - - // 是否显示3d建筑物 - Boolean buildingsEnabled = new TypeConverter().getValue(mapOptionsMap, "buildingsEnabled"); - if (null != buildingsEnabled) { - mBaiduMap.setBuildingsEnabled(buildingsEnabled); - } - - // 设置是否显示poi信息 - Boolean showMapPoi = new TypeConverter().getValue(mapOptionsMap, "showMapPoi"); - if (null != showMapPoi) { - mBaiduMap.showMapPoi(showMapPoi); - } - - // 设置是否显示路况信息 - Boolean trafficEnabled = new TypeConverter().getValue(mapOptionsMap, "trafficEnabled"); - if (null != trafficEnabled) { - mBaiduMap.setTrafficEnabled(trafficEnabled); - } - - // 限制地图的显示范围 - if (mapOptionsMap.containsKey("limitMapBounds")) { - Map limitMapRegion = (Map) mapOptionsMap.get("limitMapBounds"); - if (null != limitMapRegion) { - setMapLimits(limitMapRegion); - } - } - - // 设置是否显示百度自有热力图 - Boolean baiduHeatMapEnabled = new TypeConverter().getValue(mapOptionsMap, "baiduHeatMapEnabled"); - if (null != baiduHeatMapEnabled) { - mBaiduMap.setBaiduHeatMapEnabled(baiduHeatMapEnabled); - } - - // 设置是否启用手势 - Boolean gesturesEnabled = new TypeConverter().getValue(mapOptionsMap, "gesturesEnabled"); - if (null != gesturesEnabled) { - mUiSettings.setAllGesturesEnabled(gesturesEnabled); - } - - // 设置是否开启放大缩小 - Boolean zoomEnabled = new TypeConverter().getValue(mapOptionsMap, "zoomEnabled"); - if (null != zoomEnabled) { - mUiSettings.setZoomGesturesEnabled(zoomEnabled); - } - - // 设置地图是否可滑动 - Boolean scrollEnabled = new TypeConverter().getValue(mapOptionsMap, "scrollEnabled"); - if (null != scrollEnabled) { - mUiSettings.setScrollGesturesEnabled(scrollEnabled); - } - - // 设置是否开启俯仰角 - Boolean overlookEnabled = new TypeConverter().getValue(mapOptionsMap, "overlookEnabled"); - if (null != overlookEnabled) { - mUiSettings.setOverlookingGesturesEnabled(overlookEnabled); - } - - // 设置是否开启旋转角 - Boolean rotateEnabled = new TypeConverter().getValue(mapOptionsMap, "rotateEnabled"); - if (null != rotateEnabled) { - mUiSettings.setRotateGesturesEnabled(rotateEnabled); - } - - // 设置比例尺是否显示 - Boolean showMapScaleBar = new TypeConverter().getValue(mapOptionsMap, "showMapScaleBar"); - if (null != showMapScaleBar) { - showScaleControl(showMapScaleBar); - } - - // 设置比例尺显示位置 - Map mapScaleBarPosMap = new TypeConverter>().getValue(mapOptionsMap, "mapScaleBarPosition"); - Point mapScaleBarPos = FlutterDataConveter.mapToPoint(mapScaleBarPosMap); - if (null != mapScaleBarPos) { - setScaleControlPosition(mapScaleBarPos); - } - - // 设置百度logo显示位置 - Integer logoPosition = new TypeConverter().getValue(mapOptionsMap, "logoPosition"); - if (null != logoPosition - && logoPosition >= LogoPosition.logoPostionleftBottom.ordinal() - && logoPosition <= LogoPosition.logoPostionRightTop.ordinal()) { - setLogoPosition(LogoPosition.values()[logoPosition.intValue()]); - } - - // 设置地图padding - Map mapPadding = new TypeConverter>().getValue(mapOptionsMap, "mapPadding"); - if (null != mapPadding) { - if (mapPadding.containsKey("top") && mapPadding.containsKey("left") - && mapPadding.containsKey("bottom") && mapPadding.containsKey("right")) { - Double top = mapPadding.get("top"); - Double left = mapPadding.get("left"); - Double bottom = mapPadding.get("bottom"); - Double right = mapPadding.get("right"); - - if (top != null && left != null && bottom != null && right != null) { - int iTop = top.intValue(); - int iLeft = left.intValue(); - int iBottom = bottom.intValue(); - int iRight = right.intValue(); - mBaiduMap.setViewPadding(iLeft, iTop, iRight, iBottom); - } - } - } - - - // 设置双击屏幕放大地图时,是否改变地图中心点为当前点击点 - Boolean changeCenterWithDoubleTouchPointEnabled = new TypeConverter().getValue(mapOptionsMap, "changeCenterWithDoubleTouchPointEnabled"); - if (null != changeCenterWithDoubleTouchPointEnabled) { - // 这个值,sdk好像取的是反的,这个设个反值 - mUiSettings.setEnlargeCenterWithDoubleClickEnable(!changeCenterWithDoubleTouchPointEnabled); - } - - // 设置是否开启室内图 - Boolean baseIndoorMapEnabled = new TypeConverter().getValue(mapOptionsMap, "baseIndoorMapEnabled"); - if (null != baseIndoorMapEnabled) { - mBaiduMap.setIndoorEnable(baseIndoorMapEnabled); - BMFMapStatus.getsInstance().setBaseIndoorEnable(baseIndoorMapEnabled); - } - - // 设置是否开启室内图poi - Boolean showIndoorMapPoi = new TypeConverter().getValue(mapOptionsMap, "showIndoorMapPoi"); - if (null != showIndoorMapPoi) { - mBaiduMap.showMapIndoorPoi(showIndoorMapPoi); - BMFMapStatus.getsInstance().setIndoorMapPoiEnable(showIndoorMapPoi); - } - - // 设置地图可视区域 - Map visibleMapBounds = new TypeConverter>().getValue(mapOptionsMap, "visibleMapBounds"); - LatLngBounds latLngBounds = FlutterDataConveter.mapToLatlngBounds(visibleMapBounds); - if (null != latLngBounds) { - MapStatusUpdate mapStatusUpdate = MapStatusUpdateFactory.newLatLngBounds(latLngBounds); - mBaiduMap.setMapStatus(mapStatusUpdate); - } - - return true; - } - - private void setMapType(Integer mapType) { - switch (mapType) { - case Env.MAP_TYPE_NONE: - mBaiduMap.setMapType(BaiduMap.MAP_TYPE_NONE); - break; - case Env.MAP_TYPE_NORMAL: - mBaiduMap.setMapType(BaiduMap.MAP_TYPE_NORMAL); - break; - case Env.MAP_TYPE_SATELLITE: - mBaiduMap.setMapType(BaiduMap.MAP_TYPE_SATELLITE); - break; - default: - break; - } - } - - private void setRotation(float rotation) { - if (rotation < 0) { - rotation = rotation + 360; - } - MapStatus mapStatus = new MapStatus.Builder().rotate(rotation).build(); - MapStatusUpdate mapStatusUpdate = MapStatusUpdateFactory.newMapStatus(mapStatus); - mBaiduMap.setMapStatus(mapStatusUpdate); - } - - private void showScaleControl(boolean showScaleControl) { - switch(mViewType){ - case Constants.ViewType.sMapView: - MapView mapView = mFlutterCommonMapView.getMapView(); - if (null != mapView) { - mapView.showScaleControl(showScaleControl); - } - break; - case Constants.ViewType.sTextureMapView: - TextureMapView textureMapView = mFlutterCommonMapView.getTextureMapView(); - if (null != textureMapView) { - textureMapView.showScaleControl(showScaleControl); - } - break; - default: - break; - } - } - - private void setScaleControlPosition(Point mapScaleBarPos) { - switch (mViewType) { - case Constants.ViewType.sMapView: - MapView mapView = mFlutterCommonMapView.getMapView(); - if (null != mapView) { - mapView.setScaleControlPosition(mapScaleBarPos); - } - break; - case Constants.ViewType.sTextureMapView: - TextureMapView textureMapView = mFlutterCommonMapView.getTextureMapView(); - if (null != textureMapView) { - textureMapView.setScaleControlPosition(mapScaleBarPos); - } - break; - default: - break; - } - } - - private void setLogoPosition(LogoPosition logoPos) { - switch (mViewType) { - case Constants.ViewType.sMapView: - MapView mapView = mFlutterCommonMapView.getMapView(); - if(null != mapView){ - mapView.setLogoPosition(logoPos); - } - break; - case Constants.ViewType.sTextureMapView: - TextureMapView textureMapView = mFlutterCommonMapView.getTextureMapView(); - if (null != textureMapView) { - textureMapView.setLogoPosition(logoPos); - } - break; - default: - break; - } - } - - /** - * 限制地图的显示范围 - */ - private void setMapLimits(Map limitMapBounds) { - LatLngBounds latLngBounds = FlutterDataConveter.mapToLatlngBounds(limitMapBounds); - if (null == latLngBounds) { - return; - } - mBaiduMap.setMapStatusLimits(latLngBounds); - } - - -} diff --git a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/MapViewWrapper.java b/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/MapViewWrapper.java deleted file mode 100644 index 115e6f3..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/MapViewWrapper.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.baidu.flutter_bmfmap.map; - -import com.baidu.mapapi.map.MapView; -import com.baidu.mapapi.map.TextureMapView; - -public class MapViewWrapper extends FlutterCommonMapView { - FlutterMapView mFlutterMapView; - - public MapViewWrapper(FlutterMapView mapView, String viewType) { - mFlutterMapView = mapView; - mViewType = viewType; - } - - @Override - public MapView getMapView() { - return mFlutterMapView.getMapView(); - } - - public FlutterMapView getFlutterMapView() { - return mFlutterMapView; - } - - @Override - public TextureMapView getTextureMapView() { - return null; - } -} \ No newline at end of file diff --git a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/OfflineHandler.java b/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/OfflineHandler.java deleted file mode 100644 index d99b523..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/OfflineHandler.java +++ /dev/null @@ -1,451 +0,0 @@ -package com.baidu.flutter_bmfmap.map; - - -import android.text.TextUtils; - -import com.baidu.flutter_bmfmap.utils.Constants; -import com.baidu.mapapi.map.offline.MKOLSearchRecord; -import com.baidu.mapapi.map.offline.MKOLUpdateElement; -import com.baidu.mapapi.map.offline.MKOfflineMap; -import com.baidu.mapapi.map.offline.MKOfflineMapListener; -import com.baidu.mapapi.model.LatLng; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; - -import io.flutter.embedding.engine.plugins.FlutterPlugin; -import io.flutter.plugin.common.BinaryMessenger; -import io.flutter.plugin.common.MethodCall; -import io.flutter.plugin.common.MethodChannel; - -/** - * 离线地图handler - */ -public class OfflineHandler implements MethodChannel.MethodCallHandler { - private MKOfflineMap mMKOfflineMap; - private MethodChannel channel; - - public void init(BinaryMessenger messenger) { - channel = new MethodChannel(messenger, "flutter_bmfmap/offlineMap"); - channel.setMethodCallHandler(this); - } - - public void unInit(BinaryMessenger messenger) { - - } - - @Override - public void onMethodCall(MethodCall call, MethodChannel.Result result) { - if (null == call) { - return; - } - String methodId = call.method; - if (TextUtils.isEmpty(methodId)) { - return; - } - - switch (methodId) { - case Constants.MethodProtocol.BMFOfflineMethodId.sMapInitOfflineMethod: - initOfflineMap(result); - break; - case Constants.MethodProtocol.BMFOfflineMethodId.sMapStartOfflineMethod: - statOfflineMap(call,result); - break; - case Constants.MethodProtocol.BMFOfflineMethodId.sMapPauseOfflineMethod: - pauseOfflineMap(call,result); - break; - case Constants.MethodProtocol.BMFOfflineMethodId.sMapRemoveOfflineMethod: - removeOfflineMap(call,result); - break; - case Constants.MethodProtocol.BMFOfflineMethodId.sMapUpdateOfflineMethod: - updateOffline(call,result); - break; - case Constants.MethodProtocol.BMFOfflineMethodId.sMapDestroyOfflineMethod: - destroyOffline(result); - break; - case Constants.MethodProtocol.BMFOfflineMethodId.sMapGetHotCityListMethod: - getHotCityList(result); - break; - case Constants.MethodProtocol.BMFOfflineMethodId.sMapGetOfflineCityListMethod: - getOfflineCityList(result); - break; - case Constants.MethodProtocol.BMFOfflineMethodId.sMapSearchCityMethod: - seachCityList(call, result); - break; - case Constants.MethodProtocol.BMFOfflineMethodId.sMapGetAllUpdateInfoMethod: - getAllUpdateInfo(result); - break; - case Constants.MethodProtocol.BMFOfflineMethodId.sMapGetUpdateInfoMethod: - getUpdateInfo(call,result); - break; - default: - break; - } - } - - /** - * 初始化 - */ - private void initOfflineMap(MethodChannel.Result result) { - mMKOfflineMap = new MKOfflineMap(); - - mMKOfflineMap.init(new MKOfflineMapListener() { - - @Override - public void onGetOfflineMapState(int type, int state) { - HashMap hashMap = new HashMap(); - hashMap.put("type",type); - hashMap.put("state",state); - channel.invokeMethod(Constants.MethodProtocol.BMFOfflineMethodId.sMapOfflineCallBackMethod,hashMap); - } - }); - result.success(true); - } - - /** - * 销毁离线地图管理模块,不用时调用 - */ - private void destroyOffline(MethodChannel.Result result) { - if (null == mMKOfflineMap) { - result.success(false); - return; - } - mMKOfflineMap.destroy(); - result.success(true); - } - - /** - * 启动更新指定城市ID的离线地图 - */ - private void updateOffline(MethodCall call, MethodChannel.Result result) { - Map argument = call.arguments(); - if (null == argument || null == mMKOfflineMap) { - result.success(false); - return; - } - if (!argument.containsKey("cityID")) { - result.success(false); - return; - } - Integer cityID = (Integer) argument.get("cityID"); - if (null != cityID) { - boolean update = mMKOfflineMap.update(cityID); - result.success(update); - } - } - - /** - * 删除指定城市ID的离线地图 - */ - private void removeOfflineMap(MethodCall call, MethodChannel.Result result) { - Map argument = call.arguments(); - if (null == argument || null == mMKOfflineMap) { - result.success(false); - return; - } - if (!argument.containsKey("cityID")) { - result.success(false); - return; - } - - Integer cityID = (Integer) argument.get("cityID"); - if (null != cityID) { - boolean remove = mMKOfflineMap.remove(cityID); - result.success(remove); - } - } - - /** - * 暂停下载或更新指定城市ID的离线地图 - */ - private void pauseOfflineMap(MethodCall call, MethodChannel.Result result) { - Map argument = call.arguments(); - if (null == argument || null == mMKOfflineMap) { - result.success(false); - return; - } - if (!argument.containsKey("cityID")) { - result.success(false); - return; - } - - Integer cityID = (Integer) argument.get("cityID"); - if (null != cityID) { - boolean pause = mMKOfflineMap.pause(cityID); - result.success(pause); - } - - } - - /** - * 启动下载指定城市ID的离线地图,或在暂停更新某城市后继续更新下载某城市离线地图 - */ - private void statOfflineMap(MethodCall call,MethodChannel.Result result) { - Map argument = call.arguments(); - if (null == argument || null == mMKOfflineMap) { - result.success(false); - return; - } - if (!argument.containsKey("cityID")) { - result.success(false); - return; - } - - Integer cityID = (Integer) argument.get("cityID"); - if (null != cityID) { - boolean start = mMKOfflineMap.start(cityID); - result.success(start); - } - } - - /** - * 返回指定城市ID离线地图更新信息 - */ - private void getUpdateInfo(MethodCall call, MethodChannel.Result result) { - Map argument = call.arguments(); - if (null == argument || null == mMKOfflineMap) { - result.success(null); - return; - } - - if (!argument.containsKey("cityID")) { - result.success(null); - return; - } - - Integer id = (Integer) argument.get("cityID"); - MKOLUpdateElement updateInfo = mMKOfflineMap.getUpdateInfo(id); - if (null != id && null != updateInfo) { - Map map = new HashMap(); - int cityID = updateInfo.cityID; - int ratio = updateInfo.ratio; - int status = updateInfo.status; - String cityName = updateInfo.cityName; - int size = updateInfo.size; - int serversize = updateInfo.serversize; - int level = updateInfo.level; - boolean update = updateInfo.update; - LatLng latLng = updateInfo.geoPt; - HashMap geoPt = new HashMap<>(); - geoPt.put("latitude", latLng.latitude); - geoPt.put("longitude", latLng.longitude); - map.put("cityID", cityID); - map.put("ratio", ratio); - map.put("status", status); - map.put("cityName", cityName); - map.put("geoPt", geoPt); - map.put("size", size); - map.put("serversize", serversize); - map.put("level", level); - map.put("update", update); - result.success(map); - } else { - result.success(null); - return; - } - } - - /** - * 返回各城市离线地图更新信息 - */ - private void getAllUpdateInfo(MethodChannel.Result result) { - if (null == mMKOfflineMap) { - result.success(null); - return; - } - ArrayList allUpdateInfo = mMKOfflineMap.getAllUpdateInfo(); - if (null == allUpdateInfo || allUpdateInfo.size() == 0) { - result.success(null); - return; - } - ArrayList arrayMap = new ArrayList<>(); - - HashMap offlineCityMap = new HashMap<>(); - for (int i = 0; i < allUpdateInfo.size(); i++) { - Map map = new HashMap(); - int cityID = allUpdateInfo.get(i).cityID; - int ratio = allUpdateInfo.get(i).ratio; - String cityName = allUpdateInfo.get(i).cityName; - int size = allUpdateInfo.get(i).size; - int serversize = allUpdateInfo.get(i).serversize; - int level = allUpdateInfo.get(i).level; - boolean update = allUpdateInfo.get(i).update; - LatLng latLng = allUpdateInfo.get(i).geoPt; - HashMap geoPt = new HashMap<>(); - geoPt.put("latitude",latLng.latitude); - geoPt.put("longitude",latLng.longitude); - map.put("cityID",cityID); - map.put("ratio",ratio); - map.put("cityName",cityName); - map.put("geoPt",geoPt); - map.put("size",size); - map.put("serversize",serversize); - map.put("level",level); - map.put("update",update); - arrayMap.add(map); - } - offlineCityMap.put("updateElements", arrayMap); - result.success(offlineCityMap); - } - - /** - * 根据城市名搜索该城市离线地图记录 - */ - private void seachCityList(MethodCall call,MethodChannel.Result result) { - if (null == mMKOfflineMap) { - result.success(null); - return; - } - Map argument = call.arguments(); - if (null == argument || null == mMKOfflineMap) { - result.success(null); - return; - } - - if (!argument.containsKey("cityName")) { - result.success(null); - return; - } - - String sCityName = (String) argument.get("cityName"); - if (null == sCityName) { - result.success(null); - return; - } - ArrayList seachCityList = mMKOfflineMap.searchCity(sCityName); - if (null == seachCityList){ - result.success(null); - return; - } - ArrayList arrayMap = new ArrayList<>(); - HashMap offlineCityMap = new HashMap<>(); - for (int i = 0; i < seachCityList.size(); i++) { - Map map = new HashMap(); - int cityID = seachCityList.get(i).cityID; - int cityType = seachCityList.get(i).cityType; - int dataSize = (int) seachCityList.get(i).dataSize; - String cityName = seachCityList.get(i).cityName; - ArrayList childCities = seachCityList.get(i).childCities; - ArrayList childArray = new ArrayList<>(); - if (null != childCities && childCities.size() > 0) { - for (int j = 0; j < childCities.size(); j++) { - HashMap childMap = new HashMap(); - int childCityID = childCities.get(j).cityID; - int childCityType = childCities.get(j).cityType; - int childDataSize = (int) childCities.get(j).dataSize; - String childCityName = childCities.get(j).cityName; - childMap.put("cityID",childCityID); - childMap.put("cityType",childCityType); - childMap.put("dataSize",childDataSize); - childMap.put("cityName",childCityName); - childArray.add(childMap); - } - } - map.put("cityID",cityID); - map.put("dataSize",dataSize); - map.put("cityName",cityName); - map.put("cityType",cityType); - map.put("childCities",childArray); - arrayMap.add(map); - } - offlineCityMap.put("searchCityRecord", arrayMap); - result.success(offlineCityMap); - } - - /** - * 返回热门城市列表 - */ - private void getHotCityList(MethodChannel.Result result) { - if (null == mMKOfflineMap) { - result.success(null); - return; - } - ArrayList hotCityList = mMKOfflineMap.getHotCityList(); - if (null == hotCityList){ - result.success(null); - return; - } - ArrayList arrayMap = new ArrayList<>(); - HashMap hotCityMap = new HashMap<>(); - for (int i = 0; i < hotCityList.size(); i++) { - Map map = new HashMap(); - int cityID = hotCityList.get(i).cityID; - int cityType = hotCityList.get(i).cityType; - int dataSize = (int) hotCityList.get(i).dataSize; - String cityName = hotCityList.get(i).cityName; - ArrayList childCities = hotCityList.get(i).childCities; - ArrayList childArray = new ArrayList<>(); - if (null != childCities && childCities.size() > 0) { - for (int j = 0; j < childCities.size(); j++) { - HashMap childMap = new HashMap(); - int childCityID = childCities.get(j).cityID; - int childCityType = childCities.get(j).cityType; - int childDataSize = (int) childCities.get(j).dataSize; - String childCityName = childCities.get(j).cityName; - childMap.put("cityID",childCityID); - childMap.put("cityType",childCityType); - childMap.put("dataSize",childDataSize); - childMap.put("cityName",childCityName); - childArray.add(childMap); - } - } - map.put("cityID",cityID); - map.put("dataSize",dataSize); - map.put("cityName",cityName); - map.put("cityType",cityType); - map.put("childCities",childArray); - arrayMap.add(map); - } - hotCityMap.put("searchCityRecord", arrayMap); - result.success(hotCityMap); - } - - /** - * 返回支持离线地图城市列表 - */ - private void getOfflineCityList(MethodChannel.Result result) { - if (null == mMKOfflineMap) { - result.success(null); - return; - } - ArrayList offlineCityList = mMKOfflineMap.getOfflineCityList(); - if (null == offlineCityList){ - result.success(null); - return; - } - ArrayList arrayMap = new ArrayList<>(); - HashMap offlineCityMap = new HashMap<>(); - for (int i = 0; i < offlineCityList.size(); i++) { - Map map = new HashMap(); - int cityID = offlineCityList.get(i).cityID; - int cityType = offlineCityList.get(i).cityType; - int dataSize = (int) offlineCityList.get(i).dataSize; - String cityName = offlineCityList.get(i).cityName; - ArrayList childCities = offlineCityList.get(i).childCities; - ArrayList childArray = new ArrayList<>(); - if (null != childCities && childCities.size() > 0) { - for (int j = 0; j < childCities.size(); j++) { - HashMap childMap = new HashMap(); - int childCityID = childCities.get(j).cityID; - int childCityType = childCities.get(j).cityType; - int childDataSize = (int) childCities.get(j).dataSize; - String childCityName = childCities.get(j).cityName; - childMap.put("cityID",childCityID); - childMap.put("cityType",childCityType); - childMap.put("dataSize",childDataSize); - childMap.put("cityName",childCityName); - childArray.add(childMap); - } - } - map.put("cityID",cityID); - map.put("dataSize",dataSize); - map.put("cityName",cityName); - map.put("cityType",cityType); - map.put("childCities",childArray); - arrayMap.add(map); - } - offlineCityMap.put("searchCityRecord", arrayMap); - result.success(offlineCityMap); - } -} diff --git a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/TextureMapViewWrapper.java b/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/TextureMapViewWrapper.java deleted file mode 100644 index 5f8194b..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/TextureMapViewWrapper.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.baidu.flutter_bmfmap.map; - -import com.baidu.mapapi.map.MapView; -import com.baidu.mapapi.map.TextureMapView; - -class TextureMapViewWrapper extends FlutterCommonMapView { - - private TextureMapView mTextureMapView; - - public TextureMapViewWrapper(TextureMapView textureMapView, String viewType){ - mTextureMapView = textureMapView; - mViewType = viewType; - } - - @Override - public MapView getMapView() { - return null; - } - - @Override - public TextureMapView getTextureMapView() { - return mTextureMapView; - } -} \ No newline at end of file diff --git a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/mapHandler/BMFMapStatus.java b/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/mapHandler/BMFMapStatus.java deleted file mode 100644 index 5a02031..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/mapHandler/BMFMapStatus.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.baidu.flutter_bmfmap.map.mapHandler; - -/** - * 地图有些属性没有get接口,这个lei就用来暂存这些属性状态,供flutter端获取 - */ -public class BMFMapStatus { - - private static volatile BMFMapStatus sInstance; - - public static BMFMapStatus getsInstance(){ - if (null == sInstance) { - synchronized(BMFMapStatus.class) { - if (null == sInstance) { - sInstance = new BMFMapStatus(); - } - } - } - - return sInstance; - } - - public boolean isBaseIndoorEnable() { - return mBaseIndoorEnable; - } - - public void setBaseIndoorEnable(boolean mBaseIndoorEnable) { - this.mBaseIndoorEnable = mBaseIndoorEnable; - } - - public boolean isIndoorMapPoiEnable() { - return mIndoorMapPoiEnable; - } - - public void setIndoorMapPoiEnable(boolean mIndoorMapPoiEnable) { - this.mIndoorMapPoiEnable = mIndoorMapPoiEnable; - } - - /** - * 室内图状态 - */ - private boolean mBaseIndoorEnable = false; - - - private boolean mIndoorMapPoiEnable = true; -} diff --git a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/mapHandler/BMapHandler.java b/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/mapHandler/BMapHandler.java deleted file mode 100644 index d073488..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/mapHandler/BMapHandler.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.baidu.flutter_bmfmap.map.mapHandler; - -import android.content.Context; - -import com.baidu.flutter_bmfmap.map.FlutterCommonMapView; - -import io.flutter.plugin.common.MethodCall; -import io.flutter.plugin.common.MethodChannel; - -public abstract class BMapHandler{ - protected FlutterCommonMapView mMapView; - - public BMapHandler(FlutterCommonMapView mapView){ - this.mMapView = mapView; - } - - public abstract void handlerMethodCallResult(Context context,MethodCall call, MethodChannel.Result result); - - public void updateMapView(FlutterCommonMapView mapView){ - mMapView = mapView; - } - - public void clean(){} -} diff --git a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/mapHandler/BMapHandlerFactory.java b/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/mapHandler/BMapHandlerFactory.java deleted file mode 100644 index f2b45af..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/mapHandler/BMapHandlerFactory.java +++ /dev/null @@ -1,200 +0,0 @@ -package com.baidu.flutter_bmfmap.map.mapHandler; - -import android.content.Context; -import android.util.Log; - -import com.baidu.flutter_bmfmap.map.FlutterCommonMapView; -import com.baidu.flutter_bmfmap.utils.Constants; - -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; - -import io.flutter.plugin.common.MethodCall; -import io.flutter.plugin.common.MethodChannel; -import com.baidu.flutter_bmfmap.utils.Constants.MethodProtocol.CustomMapProtocol; -import com.baidu.flutter_bmfmap.utils.Constants.MethodProtocol.MapStateProtocol; -import com.baidu.flutter_bmfmap.utils.Constants.MethodProtocol.HeatMapProtocol; -import com.baidu.flutter_bmfmap.utils.Constants.MethodProtocol.TileMapProtocol; -import com.baidu.flutter_bmfmap.utils.Constants.MethodProtocol.MarkerProtocol; -import com.baidu.flutter_bmfmap.utils.Constants.MethodProtocol.InfoWindowProtocol; -import com.baidu.flutter_bmfmap.utils.Constants.MethodProtocol.ProjectionMethodId; -import com.baidu.flutter_bmfmap.utils.Env; - -public class BMapHandlerFactory{ - - private static volatile BMapHandlerFactory sInstance; - private HashMap mMapHandlerHashMap; - - public static BMapHandlerFactory getInstance(FlutterCommonMapView mapView) { - - if (null == sInstance) { - synchronized (BMapHandlerFactory.class) { - if (null == sInstance) { - sInstance = new BMapHandlerFactory(mapView); - } else { - sInstance.updateMapView(mapView); - } - } - } else { - sInstance.updateMapView(mapView); - } - - return sInstance; - } - - private void updateMapView(FlutterCommonMapView mapView) { - if (null == mapView) { - return; - } - - if(null == mMapHandlerHashMap || mMapHandlerHashMap.isEmpty()){ - init(mapView); - } - - Iterator it = mMapHandlerHashMap.entrySet().iterator(); - while (it.hasNext()) { - Map.Entry entry = (Map.Entry) it.next(); - BMapHandler bMapHandler = entry.getValue(); - if (null != bMapHandler) { - bMapHandler.updateMapView(mapView); - } - } - } - - private BMapHandlerFactory(FlutterCommonMapView mapView) { - init(mapView); - } - - private void init(FlutterCommonMapView mapView) { - if (null == mapView) { - return; - } - - mMapHandlerHashMap = new HashMap<>(); - - mMapHandlerHashMap.put(Constants.BMapHandlerType.CUSTOM_MAP,new CustomMapHandler(mapView)); - mMapHandlerHashMap.put(Constants.BMapHandlerType.MAP_STATE,new MapStateHandler(mapView)); - mMapHandlerHashMap.put(Constants.BMapHandlerType.INDOOR_MAP, new IndoorMapHandler(mapView)); - mMapHandlerHashMap.put(Constants.BMapHandlerType.MAP_UPDATE, new MapUpdateHandler(mapView)); - mMapHandlerHashMap.put(Constants.BMapHandlerType.HEAT_MAP, new HeatMapHandler(mapView)); - mMapHandlerHashMap.put(Constants.BMapHandlerType.TILE_MAP, new TileMapHandler(mapView)); - mMapHandlerHashMap.put(Constants.BMapHandlerType.INFOWINDOW_HANDLER, new InfoWindowHandler(mapView)); - mMapHandlerHashMap.put(Constants.BMapHandlerType.MARKER_HANDLER, new MarkerHandler(mapView)); - mMapHandlerHashMap.put(Constants.BMapHandlerType.LOCATION_LAYER, new LocationLayerHandler(mapView)); - mMapHandlerHashMap.put(Constants.BMapHandlerType.PROJECTION, new ProjectionHandler(mapView)); - } - - public boolean dispatchMethodHandler(Context context, MethodCall call, MethodChannel.Result result, - MethodChannel methodChannel) { - if (null == call) { - return false; - } - - String methodId = call.method; - if(Env.DEBUG){ - Log.d("BMapHandlerFactory", "dispatchMethodHandler: " + methodId); - } - BMapHandler bMapHandler = null; - switch (methodId) { - case CustomMapProtocol.sMapSetCustomMapStyleEnableMethod: - case CustomMapProtocol.sMapSetCustomMapStylePathMethod: - case CustomMapProtocol.sMapSetCustomMapStyleWithOptionMethod: - bMapHandler = mMapHandlerHashMap.get(Constants.BMapHandlerType.CUSTOM_MAP); - break; - case Constants.MethodProtocol.IndoorMapProtocol.sShowBaseIndoorMapMethod: - case Constants.MethodProtocol.IndoorMapProtocol.sShowBaseIndoorMapPoiMethod: - case Constants.MethodProtocol.IndoorMapProtocol.sSwitchBaseIndoorMapFloorMethod: - case Constants.MethodProtocol.IndoorMapProtocol.sGetFocusedBaseIndoorMapInfoMethod: - bMapHandler = mMapHandlerHashMap.get(Constants.BMapHandlerType.INDOOR_MAP); - break; - case MapStateProtocol.sMapUpdateMethod: - case MapStateProtocol.sMapSetVisibleMapBoundsMethod: - case MapStateProtocol.sMapSetVisibleMapBoundsWithPaddingMethod: - case MapStateProtocol.sMapSetCompassImageMethod: - case MapStateProtocol.sMapSetCustomTrafficColorMethod: - case MapStateProtocol.sMapTakeSnapshotMethod: - case MapStateProtocol.sMapTakeSnapshotWithRectMethod: - case MapStateProtocol.sMapDidUpdateWidget: - case MapStateProtocol.sMapReassemble: - bMapHandler = mMapHandlerHashMap.get(Constants.BMapHandlerType.MAP_STATE); - break; - case MapStateProtocol.sMapZoomInMethod: - case MapStateProtocol.sMapZoomOutMethod: - case MapStateProtocol.sMapSetCenterCoordinateMethod: - case MapStateProtocol.sMapSetCenterZoomMethod: - case MapStateProtocol.sMapSetMapStatusMethod: - case MapStateProtocol.sMapSetScrollByMethod: - case MapStateProtocol.sMapSetZoomByMethod: - case MapStateProtocol.sMapSetZoomPointByMethod: - case MapStateProtocol.sMapSetZoomToMethod: - case MapStateProtocol.sMapGetMapStatusMethod: - bMapHandler = mMapHandlerHashMap.get(Constants.BMapHandlerType.MAP_UPDATE); - break; - case HeatMapProtocol.sMapAddHeatMapMethod: - case HeatMapProtocol.sMapRemoveHeatMapMethod: - case HeatMapProtocol.sShowHeatMapMethod: - bMapHandler = mMapHandlerHashMap.get(Constants.BMapHandlerType.HEAT_MAP); - break; - case TileMapProtocol.sAddTileMapMethod: - case TileMapProtocol.sRemoveTileMapMethod: - bMapHandler = mMapHandlerHashMap.get(Constants.BMapHandlerType.TILE_MAP); - break; - case MarkerProtocol.sMapAddMarkerMethod: - case MarkerProtocol.sMapAddMarkersMethod: - case MarkerProtocol.sMapRemoveMarkerMethod: - case MarkerProtocol.sMapRemoveMarkersMethod: - case MarkerProtocol.sMapDidSelectMarkerMethod: - case MarkerProtocol.sMapDidDeselectMarkerMethod: - case MarkerProtocol.sMapCleanAllMarkersMethod: - case MarkerProtocol.sMapUpdateMarkerMemberMethod: - bMapHandler = mMapHandlerHashMap.get(Constants.BMapHandlerType.MARKER_HANDLER); - break; - case InfoWindowProtocol.sAddInfoWindowMapMethod: - case InfoWindowProtocol.sRemoveInfoWindowMapMethod: - case InfoWindowProtocol.sAddInfoWindowsMapMethod: - bMapHandler = mMapHandlerHashMap.get(Constants.BMapHandlerType.INFOWINDOW_HANDLER); - break; - case Constants.LocationLayerMethodId.sMapShowUserLocationMethod: - case Constants.LocationLayerMethodId.sMapUpdateLocationDataMethod: - case Constants.LocationLayerMethodId.sMapUserTrackingModeMethod: - case Constants.LocationLayerMethodId.sMapUpdateLocationDisplayParamMethod: - bMapHandler = mMapHandlerHashMap.get(Constants.BMapHandlerType.LOCATION_LAYER); - break; - case ProjectionMethodId.sFromScreenLocation: - case ProjectionMethodId.sToScreenLocation: - bMapHandler = mMapHandlerHashMap.get(Constants.BMapHandlerType.PROJECTION); - break; - default: - if(methodId.startsWith("flutter_bmfmap/map/get")){ - bMapHandler = mMapHandlerHashMap.get(Constants.BMapHandlerType.MAP_UPDATE); - } - break; - } - - if (null == bMapHandler) { - return false; - } - - bMapHandler.handlerMethodCallResult(context,call, result); - - return true; - } - - public void clean(){ - if (null == mMapHandlerHashMap || mMapHandlerHashMap.size() == 0) { - return; - } - - BMapHandler bMapHandler = null; - Iterator iterator = mMapHandlerHashMap.values().iterator(); - while (iterator.hasNext()){ - bMapHandler = (BMapHandler) iterator.next(); - if(null == bMapHandler){ - continue; - } - - bMapHandler.clean(); - } - } -} diff --git a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/mapHandler/CustomMapHandler.java b/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/mapHandler/CustomMapHandler.java deleted file mode 100644 index b0a41c6..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/mapHandler/CustomMapHandler.java +++ /dev/null @@ -1,437 +0,0 @@ -package com.baidu.flutter_bmfmap.map.mapHandler; - -import android.content.Context; -import android.text.TextUtils; -import android.util.Log; - -import com.baidu.flutter_bmfmap.map.FlutterCommonMapView; -import com.baidu.flutter_bmfmap.utils.Constants; -import com.baidu.mapapi.map.CustomMapStyleCallBack; -import com.baidu.mapapi.map.MapCustomStyleOptions; -import com.baidu.mapapi.map.MapView; -import com.baidu.mapapi.map.TextureMapView; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.HashMap; -import java.util.Map; - -import io.flutter.plugin.common.MethodCall; -import io.flutter.plugin.common.MethodChannel; -import io.flutter.view.FlutterMain; - -public class CustomMapHandler extends BMapHandler { - - private MapViewCustomMapHandler mMapViewCustomMapHandler; - private TextureMapViewCustomMapHandler mTextureMapViewCustomMapHandler; - - public CustomMapHandler(FlutterCommonMapView mapView) { - super(mapView); - mMapViewCustomMapHandler = new MapViewCustomMapHandler(mMapView); - mTextureMapViewCustomMapHandler = new TextureMapViewCustomMapHandler(mMapView); - } - - @Override - public void updateMapView(FlutterCommonMapView mapView){ - mMapView = mapView; - mMapViewCustomMapHandler.updateMapView(mapView); - mTextureMapViewCustomMapHandler.updateMapView(mapView); - } - - @Override - public void handlerMethodCallResult(Context context,MethodCall call, MethodChannel.Result result) { - switch (mMapView.getViewType()){ - case Constants.ViewType.sMapView: - mMapViewCustomMapHandler.handlerMethodCallResult(context, call, result); - break; - case Constants.ViewType.sTextureMapView: - mTextureMapViewCustomMapHandler.handlerMethodCallResult(context, call, result); - break; - default: - break; - } - } - - class MapViewCustomMapHandler extends BMapHandler { - - private MapView mRealMapView; - - public MapViewCustomMapHandler(FlutterCommonMapView mapView) { - super(mapView); - mRealMapView = mMapView.getMapView(); - } - - @Override - public void updateMapView(FlutterCommonMapView mapView){ - mMapView = mapView; - if(null != mMapView){ - mRealMapView = mMapView.getMapView(); - } - } - - @Override - public void handlerMethodCallResult(Context context, MethodCall call, MethodChannel.Result result) { - if (null == call) { - result.success(false); - return; - } - - String methodId = call.method; - if (TextUtils.isEmpty(methodId)) { - result.success(false); - return; - } - - switch (methodId) { - case Constants.MethodProtocol.CustomMapProtocol.sMapSetCustomMapStyleEnableMethod: - setCustomMapStyleEnable(call, result); - break; - case Constants.MethodProtocol.CustomMapProtocol.sMapSetCustomMapStylePathMethod: - setCustomMapStylePath(context,call,result); - break; - case Constants.MethodProtocol.CustomMapProtocol.sMapSetCustomMapStyleWithOptionMethod: - setMapCustomStyle(call,result); - break; - default: - break; - } - } - - /** - * 个性化地图开关 - */ - private void setCustomMapStyleEnable(MethodCall call, MethodChannel.Result result) { - Map argument = call.arguments(); - if (null == argument || null == mMapView) { - result.success(false); - return; - } - if (!argument.containsKey("enable")) { - result.success(false); - return; - } - boolean enable = (boolean) argument.get("enable"); - mRealMapView.setMapCustomStyleEnable(enable); - result.success(true); - } - - /** - * 设置个性化地图样式文件的路径 - */ - private void setCustomMapStylePath(Context context, MethodCall call, MethodChannel.Result result) { - Map argument = call.arguments(); - if (null == argument || null == mMapView || context == null) { - result.success(false); - return; - } - - if (!argument.containsKey("path") || !argument.containsKey("mode")) { - result.success(false); - return; - } - - String path = (String) argument.get("path"); - if (path.isEmpty()) { - result.success(false); - return; - } - - String customStyleFilePath = getCustomStyleFilePath(context, path); - if(TextUtils.isEmpty(customStyleFilePath)){ - result.success(false); - return; - } - mRealMapView.setMapCustomStylePath(customStyleFilePath); - result.success(true); - } - - private String getCustomStyleFilePath(Context context, String customStyleFilePath) { - if (customStyleFilePath.isEmpty()) { - return null; - } - - FileOutputStream outputStream = null; - InputStream inputStream = null; - String parentPath = null; - String customStyleFileName = null; - try { - customStyleFileName = FlutterMain.getLookupKeyForAsset(customStyleFilePath); - inputStream = context.getAssets().open(customStyleFileName); - byte[] buffer = new byte[inputStream.available()]; - inputStream.read(buffer); - - parentPath = context.getCacheDir().getAbsolutePath(); - String substr = customStyleFileName.substring(0, customStyleFileName.lastIndexOf("/")); - File customStyleFile = new File(parentPath + "/" + customStyleFileName); - if (customStyleFile.exists()) { - customStyleFile.delete(); - } - File dirFile = new File(parentPath + "/" + substr); - if (!dirFile.exists()) { - dirFile.mkdirs(); - } - customStyleFile.createNewFile(); - outputStream = new FileOutputStream(customStyleFile); - outputStream.write(buffer); - } catch (IOException e) { - Log.e("TAG", "Copy file failed", e); - } finally { - try { - if (inputStream != null) { - inputStream.close(); - } - if (outputStream != null) { - outputStream.close(); - } - } catch (IOException e) { - Log.e("TAG", "Close stream failed", e); - } - } - return parentPath + "/" + customStyleFileName; - } - - /** - * 在线个性化样式加载状态回调接口 - */ - private void setMapCustomStyle(MethodCall call, final MethodChannel.Result result) { - Map argument = call.arguments(); - if (null == argument || null == mMapView) { - result.success(false); - return; - } - if (!argument.containsKey("customMapStyleOption")) { - return; - } - Map customMapStyleOption = (Map) argument.get("customMapStyleOption"); - if (!customMapStyleOption.containsKey("customMapStyleID") - || !customMapStyleOption.containsKey("customMapStyleFilePath")) { - return; - } - - String customMapStyleID = (String) customMapStyleOption.get("customMapStyleID"); - String customMapStyleFilePath = (String) customMapStyleOption.get("customMapStyleFilePath"); - if (customMapStyleID.isEmpty() && customMapStyleFilePath.isEmpty()) { - return; - } - MapCustomStyleOptions mapCustomStyleOptions = new MapCustomStyleOptions(); - mapCustomStyleOptions.customStyleId(customMapStyleID); - mapCustomStyleOptions.localCustomStylePath(customMapStyleFilePath); - final HashMap reslutMap = new HashMap<>(); - mRealMapView.setMapCustomStyle(mapCustomStyleOptions, new CustomMapStyleCallBack() { - @Override - public boolean onPreLoadLastCustomMapStyle(String path) { - reslutMap.put("preloadPath", path); - result.success(reslutMap); - return false; - } - - @Override - public boolean onCustomMapStyleLoadSuccess(boolean b, String path) { - // TODO: 2020-03-05 回调的 boolean 类型没有返回之后补齐 - reslutMap.put("successPath", path); - result.success(reslutMap); - return false; - } - - @Override - public boolean onCustomMapStyleLoadFailed(int status, String message, String path) { - String sStatus = String.valueOf(status); - reslutMap.put("errorCode", sStatus); - reslutMap.put("successPath", path); - result.success(reslutMap); - return false; - } - }); - } - } - - class TextureMapViewCustomMapHandler extends BMapHandler { - - private TextureMapView mTextureMapView; - - public TextureMapViewCustomMapHandler(FlutterCommonMapView mapView) { - super(mapView); - mTextureMapView = mMapView.getTextureMapView(); - } - - @Override - public void updateMapView(FlutterCommonMapView mapView){ - mMapView = mapView; - if(null != mMapView){ - mTextureMapView = mMapView.getTextureMapView(); - } - } - - @Override - public void handlerMethodCallResult(Context context, MethodCall call, MethodChannel.Result result) { - if (null == call) { - return; - } - - String methodId = call.method; - if (TextUtils.isEmpty(methodId)) { - return; - } - - switch (methodId) { - case Constants.MethodProtocol.CustomMapProtocol.sMapSetCustomMapStyleEnableMethod: - setCustomMapStyleEnable(call, result); - break; - case Constants.MethodProtocol.CustomMapProtocol.sMapSetCustomMapStylePathMethod: - setCustomMapStylePath(context,call,result); - break; - case Constants.MethodProtocol.CustomMapProtocol.sMapSetCustomMapStyleWithOptionMethod: - setMapCustomStyle(context, call,result); - break; - default: - break; - } - } - - /** - * 个性化地图开关 - */ - private void setCustomMapStyleEnable(MethodCall call, MethodChannel.Result result) { - Map argument = call.arguments(); - if (null == argument || null == mMapView) { - result.success(false); - return; - } - if (!argument.containsKey("enable")) { - result.success(false); - return; - } - boolean enable = (boolean) argument.get("enable"); - mTextureMapView.setMapCustomStyleEnable(enable); - result.success(true); - } - - /** - * 设置个性化地图样式文件的路径 - */ - private void setCustomMapStylePath(Context context, MethodCall call, MethodChannel.Result result) { - Map argument = call.arguments(); - if (null == argument || null == mMapView || context == null) { - result.success(false); - return; - } - - if (!argument.containsKey("path") || !argument.containsKey("mode")) { - result.success(false); - return; - } - - String path = (String) argument.get("path"); - if (path.isEmpty()) { - result.success(false); - return; - } - String customStyleFilePath = getCustomStyleFilePath(context, path); - mTextureMapView.setMapCustomStylePath(customStyleFilePath); - result.success(true); - } - - private String getCustomStyleFilePath(Context context, String customStyleFilePath) { - if (customStyleFilePath.isEmpty()) { - return null; - } - - FileOutputStream outputStream = null; - InputStream inputStream = null; - String parentPath = null; - String customStyleFileName = null; - try { - customStyleFileName = FlutterMain.getLookupKeyForAsset(customStyleFilePath); - inputStream = context.getAssets().open(customStyleFileName); - byte[] buffer = new byte[inputStream.available()]; - inputStream.read(buffer); - - parentPath = context.getCacheDir().getAbsolutePath(); - String substr = customStyleFileName.substring(0, customStyleFileName.lastIndexOf("/")); - File customStyleFile = new File(parentPath + "/" + customStyleFileName); - if (customStyleFile.exists()) { - customStyleFile.delete(); - } - File dirFile = new File(parentPath + "/" + substr); - if (!dirFile.exists()) { - dirFile.mkdirs(); - } - customStyleFile.createNewFile(); - outputStream = new FileOutputStream(customStyleFile); - outputStream.write(buffer); - } catch (IOException e) { - Log.e("TAG", "Copy file failed", e); - } finally { - try { - if (inputStream != null) { - inputStream.close(); - } - if (outputStream != null) { - outputStream.close(); - } - } catch (IOException e) { - Log.e("TAG", "Close stream failed", e); - } - } - return parentPath + "/" + customStyleFileName; - } - - /** - * 在线个性化样式加载状态回调接口 - */ - private void setMapCustomStyle(Context context, MethodCall call, - final MethodChannel.Result result) { - Map argument = call.arguments(); - if (null == argument || null == mMapView) { - result.success(false); - return; - } - if (!argument.containsKey("customMapStyleOption")) { - return; - } - Map customMapStyleOption = (Map) argument.get("customMapStyleOption"); - if (!customMapStyleOption.containsKey("customMapStyleID") - || !customMapStyleOption.containsKey("customMapStyleFilePath")) { - return; - } - - String customMapStyleID = (String) customMapStyleOption.get("customMapStyleID"); - String customMapStyleFilePath = (String) customMapStyleOption.get("customMapStyleFilePath"); - customMapStyleFilePath = getCustomStyleFilePath(context, customMapStyleFilePath); - if (customMapStyleID.isEmpty() && customMapStyleFilePath.isEmpty()) { - return; - } - MapCustomStyleOptions mapCustomStyleOptions = new MapCustomStyleOptions(); - mapCustomStyleOptions.customStyleId(customMapStyleID); - mapCustomStyleOptions.localCustomStylePath(customMapStyleFilePath); - final HashMap reslutMap = new HashMap<>(); - mTextureMapView.setMapCustomStyle(mapCustomStyleOptions, new CustomMapStyleCallBack() { - @Override - public boolean onPreLoadLastCustomMapStyle(String path) { - reslutMap.put("preloadPath", path); - result.success(reslutMap); - return false; - } - - @Override - public boolean onCustomMapStyleLoadSuccess(boolean b, String path) { - // TODO: 2020-03-05 回调的 boolean 类型没有返回之后补齐 - reslutMap.put("successPath", path); - result.success(reslutMap); - return false; - } - - @Override - public boolean onCustomMapStyleLoadFailed(int status, String message, String path) { - String sStatus = String.valueOf(status); - reslutMap.put("errorCode", sStatus); - reslutMap.put("successPath", path); - result.success(reslutMap); - return false; - } - }); - } - } -} diff --git a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/mapHandler/HeatMapHandler.java b/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/mapHandler/HeatMapHandler.java deleted file mode 100644 index 574783d..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/mapHandler/HeatMapHandler.java +++ /dev/null @@ -1,270 +0,0 @@ -package com.baidu.flutter_bmfmap.map.mapHandler; - -import android.content.Context; -import android.text.TextUtils; -import android.util.Log; - -import com.baidu.flutter_bmfmap.map.FlutterCommonMapView; -import com.baidu.flutter_bmfmap.utils.Env; -import com.baidu.flutter_bmfmap.utils.converter.FlutterDataConveter; -import com.baidu.flutter_bmfmap.utils.converter.TypeConverter; -import com.baidu.mapapi.map.BaiduMap; -import com.baidu.mapapi.map.Gradient; -import com.baidu.mapapi.map.HeatMap; -import com.baidu.mapapi.map.WeightedLatLng; - -import java.util.List; -import java.util.Map; -import java.util.Iterator; - -import io.flutter.plugin.common.MethodCall; -import io.flutter.plugin.common.MethodChannel; - -import com.baidu.flutter_bmfmap.utils.Constants.MethodProtocol.HeatMapProtocol; - -class HeatMapHandler extends BMapHandler { - private static final String TAG = "HeapMapHandler"; - - HeatMap mHeatMap = null; - - public HeatMapHandler(FlutterCommonMapView mapView) { - super(mapView); - } - - @Override - public void handlerMethodCallResult(Context context,MethodCall call, MethodChannel.Result result) { - if (null == call) { - result.success(false); - return; - } - - String methodId = call.method; - if (TextUtils.isEmpty(methodId)) { - result.success(false); - return; - } - - boolean ret = false; - switch (methodId) { - case HeatMapProtocol.sMapAddHeatMapMethod: - ret = addHeapMap(context, call); - break; - case HeatMapProtocol.sMapRemoveHeatMapMethod: - ret = switchHeatMap(context, call); - break; - case HeatMapProtocol.sShowHeatMapMethod: - ret = isShowBaiduHeatMap(call); - break; - default: - break; - } - - result.success(ret); - } - - /** - * 是否显示百度热力图 - */ - public boolean isShowBaiduHeatMap(MethodCall call) { - Map argument = call.arguments(); - if (argument == null || !argument.containsKey("show")) { - return false; - } - Boolean show = (Boolean) argument.get("show"); - if (null == show) { - return false; - } - if (null == mMapView) { - return false; - } - BaiduMap baiduMap = mMapView.getBaiduMap(); - baiduMap.setBaiduHeatMapEnabled(show); - - return true; - } - - public boolean addHeapMap(Context context,MethodCall call){ - if(Env.DEBUG){ - Log.d(TAG, "addHeapMap enter"); - } - Map argument = call.arguments(); - if(null == argument){ - if(Env.DEBUG){ - Log.d(TAG, "argument is null"); - } - return false; - } - - Object heatMapObj = argument.get("heatMap"); - if(null == heatMapObj){ - if(Env.DEBUG){ - Log.d(TAG, "null == heatMapObj"); - } - return false; - } - - Map heatMapMap = (Map)heatMapObj; - if(null == heatMapMap){ - if(Env.DEBUG){ - Log.d(TAG, "null == heatMapMap"); - } - return false; - } - - if(!heatMapMap.containsKey("data") - || !heatMapMap.containsKey("radius") - || !heatMapMap.containsKey("opacity") - || !heatMapMap.containsKey("gradient")) { - if (Env.DEBUG) { - Log.d(TAG, "argument does not contain"+ argument.toString()); - - } - return false; - } - - - HeatMap.Builder builder = new HeatMap.Builder(); - - List weightedLatLngList = getData(heatMapMap); - if(null == weightedLatLngList){ - if(Env.DEBUG){ - Log.d(TAG, "null == weightedLatLngList"); - } - return false; - } - builder.weightedData(weightedLatLngList); - - Object gradientObj = heatMapMap.get("gradient"); - if(null == gradientObj){ - if(Env.DEBUG){ - Log.d(TAG, "null == gradientObj"); - } - return false; - } - Map gradientMap = (Map)gradientObj; - if(null == gradientMap){ - if(Env.DEBUG){ - Log.d(TAG, "null == gradientMap"); - } - return false; - } - - Gradient gradient = getGradient(gradientMap); - builder.gradient(gradient); - - Double opacity = new TypeConverter().getValue(heatMapMap, "opacity"); - if(null == opacity){ - if(Env.DEBUG){ - Log.d(TAG, "null == opacity"); - } - return false; - } - - builder.opacity(opacity); - - Integer radius = new TypeConverter().getValue(heatMapMap, "radius"); - if(null == radius) { - if(Env.DEBUG){ - Log.d(TAG, "null == radius"); - } - return false; - } - builder.radius(radius); - - mHeatMap = builder.build(); - - if(null == mHeatMap){ - if(Env.DEBUG){ - Log.d(TAG, "null == mHeatMap"); - } - return false; - } - - BaiduMap baiduMap = mMapView.getBaiduMap(); - if(null == baiduMap){ - return false; - } - - baiduMap.addHeatMap(mHeatMap); - return true; - } - - private List getData(Map heatMapMap){ - List weightedLatLngList = null; - Object dataObj = heatMapMap.get("data"); - if(null == dataObj){ - return null; - } - - List > dataList = (List >)dataObj; - if(null == dataList){ - return null; - } - - weightedLatLngList = FlutterDataConveter.mapToWeightedLatLngList(dataList); - - return weightedLatLngList; - } - - private Gradient getGradient(Map heatMapMap){ - if(!heatMapMap.containsKey("colors") || !heatMapMap.containsKey("startPoints")){ - return null; - } - - Object colorsObj = heatMapMap.get("colors"); - Object startPointsObj = heatMapMap.get("startPoints"); - if(null == colorsObj || null == startPointsObj){ - return null; - } - - List colorsList = (List)colorsObj; - List startPointsList = (List)startPointsObj; - if(null == colorsList || null == startPointsList){ - return null; - } - - int[] intColors = new int[colorsList.size()]; - Iterator itr = colorsList.iterator(); - int i = 0; - while (itr.hasNext()){ - String colorStr = itr.next(); - int color = FlutterDataConveter.strColorToInteger(colorStr); - intColors[i++] = color; - } - - float[] startPoints = new float[startPointsList.size()]; - Iterator startPointsItr = startPointsList.iterator(); - i = 0; - while (startPointsItr.hasNext()){ - startPoints[i++] = startPointsItr.next().floatValue(); - } - - Gradient gradient = new Gradient(intColors, startPoints); - return gradient; - } - - public boolean switchHeatMap(Context context,MethodCall call){ - if(Env.DEBUG){ - Log.d(TAG, "switchHeatMap enter"); - } - - if(null == mHeatMap){ - return false; - } - - BaiduMap baiduMap = mMapView.getBaiduMap(); - if(null == baiduMap){ - if (Env.DEBUG) { - Log.d(TAG, "baiduMap is null"); - - } - return false; - } - - mHeatMap.removeHeatMap(); - mHeatMap = null; - - return true; - } - -} \ No newline at end of file diff --git a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/mapHandler/IndoorMapHandler.java b/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/mapHandler/IndoorMapHandler.java deleted file mode 100644 index b68b282..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/mapHandler/IndoorMapHandler.java +++ /dev/null @@ -1,195 +0,0 @@ -package com.baidu.flutter_bmfmap.map.mapHandler; - -import android.content.Context; -import android.text.TextUtils; -import android.util.Log; - -import com.baidu.flutter_bmfmap.map.FlutterCommonMapView; -import com.baidu.flutter_bmfmap.utils.Constants; -import com.baidu.flutter_bmfmap.utils.Env; -import com.baidu.mapapi.map.BaiduMap; -import com.baidu.mapapi.map.MapBaseIndoorMapInfo; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; - -import io.flutter.plugin.common.MethodCall; -import io.flutter.plugin.common.MethodChannel; - - -public class IndoorMapHandler extends BMapHandler { - - private static final String TAG = "IndoorMapHandler"; - - private BaiduMap mBaiduMap; - - public IndoorMapHandler(FlutterCommonMapView mapView) { - super(mapView); - if(null != mapView){ - mBaiduMap = mapView.getBaiduMap(); - } - } - - @Override - public void updateMapView(FlutterCommonMapView mapView) { - super.updateMapView(mapView); - if(null != mapView){ - mBaiduMap = mapView.getBaiduMap(); - } - } - - @Override - public void handlerMethodCallResult(Context context, MethodCall call, MethodChannel.Result result) { - if(Env.DEBUG){ - Log.d(TAG, "handlerMethodCallResult enter"); - } - if (null == call) { - result.success(false); - return; - } - - String methodId = call.method; - if (TextUtils.isEmpty(methodId)) { - result.success(false); - return; - } - switch (methodId) { - case Constants.MethodProtocol.IndoorMapProtocol.sShowBaseIndoorMapMethod: - setIndoorMap(call, result); - break; - case Constants.MethodProtocol.IndoorMapProtocol.sShowBaseIndoorMapPoiMethod: - setIndoorMapPoi(call, result); - break; - case Constants.MethodProtocol.IndoorMapProtocol.sSwitchBaseIndoorMapFloorMethod: - switchIndoorMapFloor(call, result); - break; - case Constants.MethodProtocol.IndoorMapProtocol.sGetFocusedBaseIndoorMapInfoMethod: - getFocusedBaseIndoorMapInfo(call, result); - break; - default: - break; - } - } - - - /** - * 室内图开关 - */ - private void setIndoorMap(MethodCall call, MethodChannel.Result result) { - Map argument = call.arguments(); - if (null == argument || null == mBaiduMap) { - result.success(false); - return; - } - if (!argument.containsKey("show")) { - result.success(false); - } - boolean showIndoorMap = (boolean) argument.get("show"); - mBaiduMap.setIndoorEnable(showIndoorMap); - BMFMapStatus.getsInstance().setBaseIndoorEnable(showIndoorMap); - result.success(true); - } - - /** - * 室内图poi开关 - */ - private void setIndoorMapPoi(MethodCall call, MethodChannel.Result result) { - Map argument = call.arguments(); - if (null == argument || null == mMapView) { - result.success(false); - return; - } - - if(null == mBaiduMap){ - return; - } - - if (!argument.containsKey("showIndoorPoi")) { - result.success(false); - } - boolean showIndoorPoi = (boolean) argument.get("showIndoorPoi"); - mBaiduMap.showMapIndoorPoi(showIndoorPoi); - BMFMapStatus.getsInstance().setIndoorMapPoiEnable(showIndoorPoi); - result.success(true); - } - - /** - * 室内图楼层切换 - */ - private void switchIndoorMapFloor(MethodCall call, MethodChannel.Result result) { - HashMap errorMap = new HashMap<>(); - int switchIndoorFloorSuccess = Constants.SwitchIndoorFloorError.FAILED; - - Map argument = call.arguments(); - if (null == argument || null == mBaiduMap) { - errorMap.put("result", switchIndoorFloorSuccess); - result.success(errorMap); - return; - } - - if (!argument.containsKey("floorId") || !argument.containsKey("indoorId")) { - errorMap.put("result", switchIndoorFloorSuccess); - result.success(errorMap); - return; - } - String floorId = (String) argument.get("floorId"); - String indoorId = (String) argument.get("indoorId"); - if (floorId.isEmpty() || indoorId.isEmpty()) { - return; - } - - MapBaseIndoorMapInfo.SwitchFloorError switchFloorError = mBaiduMap.switchBaseIndoorMapFloor(floorId, indoorId); - switch (switchFloorError) { - case SWITCH_OK: - switchIndoorFloorSuccess = Constants.SwitchIndoorFloorError.SUCCESS; - break; - case SWITCH_ERROR: - switchIndoorFloorSuccess = Constants.SwitchIndoorFloorError.FAILED; - break; - case FOCUSED_ID_ERROR: - switchIndoorFloorSuccess = Constants.SwitchIndoorFloorError.NOT_FOCUSED; - break; - case FLOOR_OVERLFLOW: - switchIndoorFloorSuccess = Constants.SwitchIndoorFloorError.NOT_EXIST; - break; - case FLOOR_INFO_ERROR: - switchIndoorFloorSuccess = Constants.SwitchIndoorFloorError.SWICH_FLOOR_INFO_ERROR; - break; - default: - break; - } - - errorMap.put("result", switchIndoorFloorSuccess); - result.success(errorMap); - } - - /** - * 获取当前聚焦的室内图信息 - */ - private void getFocusedBaseIndoorMapInfo(MethodCall call, MethodChannel.Result result) { - if (null == mBaiduMap) { - return; - } - MapBaseIndoorMapInfo focusedBaseIndoorMapInfo = mBaiduMap.getFocusedBaseIndoorMapInfo(); - BMFBaseIndoorMapInfo bmfBaseIndoorMapInfo = new BMFBaseIndoorMapInfo(); - if (null != focusedBaseIndoorMapInfo) { - bmfBaseIndoorMapInfo.strFloor = focusedBaseIndoorMapInfo.getCurFloor(); - bmfBaseIndoorMapInfo.strID = focusedBaseIndoorMapInfo.getID(); - bmfBaseIndoorMapInfo.listStrFloors = focusedBaseIndoorMapInfo.getFloors(); - } - - HashMap stringObjectHashMap = new HashMap<>(); - stringObjectHashMap.put("listStrFloors", bmfBaseIndoorMapInfo.listStrFloors); - stringObjectHashMap.put("strFloor", bmfBaseIndoorMapInfo.strFloor); - stringObjectHashMap.put("strID", bmfBaseIndoorMapInfo.strID); - result.success(stringObjectHashMap); - } - - - class BMFBaseIndoorMapInfo { - private String strID = ""; - private String strFloor = ""; - private ArrayList listStrFloors; - } -} diff --git a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/mapHandler/InfoWindowHandler.java b/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/mapHandler/InfoWindowHandler.java deleted file mode 100644 index 0d88d15..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/mapHandler/InfoWindowHandler.java +++ /dev/null @@ -1,306 +0,0 @@ -package com.baidu.flutter_bmfmap.map.mapHandler; - - -import android.content.Context; -import android.text.TextUtils; -import android.util.Log; - -import com.baidu.flutter_bmfmap.map.mapHandler.BMapHandler; -import com.baidu.flutter_bmfmap.map.FlutterCommonMapView; -import com.baidu.flutter_bmfmap.utils.Env; -import com.baidu.flutter_bmfmap.utils.converter.FlutterDataConveter; -import com.baidu.flutter_bmfmap.utils.converter.TypeConverter; -import com.baidu.mapapi.map.BaiduMap; - -import java.util.AbstractMap; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import io.flutter.plugin.common.MethodCall; -import io.flutter.plugin.common.MethodChannel; -import com.baidu.flutter_bmfmap.utils.Constants.MethodProtocol.InfoWindowProtocol; -import com.baidu.mapapi.map.BitmapDescriptor; -import com.baidu.mapapi.map.BitmapDescriptorFactory; -import com.baidu.mapapi.map.InfoWindow; -import com.baidu.mapapi.model.LatLng; - -public class InfoWindowHandler extends BMapHandler{ - - private static final String TAG = "InfoWindowHandler"; - - private HashMap mInfoWindows; - private HashMap mBitmapMap = new HashMap<>(); - private MethodChannel mMethodChannel; - private BaiduMap mBaiduMap; - - public InfoWindowHandler(FlutterCommonMapView mapView){ - super(mapView); - if(null != mMapView){ - mBaiduMap = mMapView.getBaiduMap(); - } - mInfoWindows = new HashMap<>(); - } - - @Override - public void updateMapView(FlutterCommonMapView mapView){ - mMapView = mapView; - if(null != mMapView){ - mBaiduMap = mMapView.getBaiduMap(); - } - } - - @Override - public void handlerMethodCallResult(Context context, MethodCall call, MethodChannel.Result result) { - if(Env.DEBUG){ - Log.d(TAG, "handlerMethodCallResult enter"); - } - if(null == mBaiduMap){ - if(Env.DEBUG){ - Log.d(TAG, "mBaidumap is null"); - } - return; - } - - String methodId = call.method; - - switch (methodId){ - case InfoWindowProtocol.sAddInfoWindowMapMethod: - addInfoWindow(call, result); - break; - case InfoWindowProtocol.sAddInfoWindowsMapMethod: - addInfoWindows(call,result); - break; - case InfoWindowProtocol.sRemoveInfoWindowMapMethod: - removeInfoWindow(call, result); - break; - default: - break; - } - } - - - /** - * 添加单个infoWindow - * @param call - * @param result - */ - private void addInfoWindow(MethodCall call, MethodChannel.Result result){ - if(Env.DEBUG){ - Log.d(TAG, "addInfoWindow enter"); - } - Map argument = call.arguments(); - if(null == argument){ - if(Env.DEBUG){ - Log.d(TAG, "argument is null"); - } - return; - } - - - addOneInfoWindowImp(argument); - } - - /** - * 具体添加一个infowindow - * @param infoWindowMap - */ - private void addOneInfoWindowImp(Map infoWindowMap){ - - AbstractMap.SimpleEntry infoWindowEntry = MaptoInfoWindowEntry(infoWindowMap); - - if(null == infoWindowEntry){ - return; - } - - mInfoWindows.put(infoWindowEntry.getKey(), infoWindowEntry.getValue()); - mBaiduMap.showInfoWindow(infoWindowEntry.getValue()); - } - - private AbstractMap.SimpleEntry MaptoInfoWindowEntry(Map infoWindowMap){ - if(null == infoWindowMap){ - return null; - } - if(!infoWindowMap.containsKey("id")){ - if(Env.DEBUG){ - Log.d(TAG, "argument does not contain"); - } - return null; - } - - final String id = new TypeConverter().getValue(infoWindowMap, "id"); - if(TextUtils.isEmpty(id)){ - if(Env.DEBUG){ - Log.d(TAG, "TextUtils.isEmpty(id)"); - } - return null; - } - - if(mInfoWindows.containsKey(id)){ - if(Env.DEBUG){ - Log.d(TAG, "infowindow already added"); - } - return null; - } - - String image = new TypeConverter().getValue(infoWindowMap, "image"); - if(TextUtils.isEmpty(image)){ - if(Env.DEBUG){ - Log.d(TAG, "TextUtils.isEmpty(image)"); - } - return null; - } - Map latLngMap = new TypeConverter>().getValue(infoWindowMap, "coordinate"); - LatLng latLng = FlutterDataConveter.mapToLatlng(latLngMap); - if(null == latLng){ - if(Env.DEBUG){ - Log.d(TAG, "null == latLng"); - } - return null; - } - - - Double yOffSet = new TypeConverter().getValue(infoWindowMap, "yOffset"); - if(null == yOffSet){ - if(Env.DEBUG){ - Log.d(TAG, "null == yOffSet"); - } - return null; - } - - Boolean isAddWithBitmapDescriptor = new TypeConverter().getValue(infoWindowMap, "isAddWithBitmapDescriptor"); - if(null == isAddWithBitmapDescriptor){ - if(Env.DEBUG){ - Log.d(TAG, "null == isAddWithBitmapDescriptor"); - } - return null; - } - - BitmapDescriptor bitmap = BitmapDescriptorFactory.fromAsset("flutter_assets/" + image); - if(null == bitmap){ - if(Env.DEBUG){ - Log.d(TAG, "null == bitmap"); - } - return null; - } - - mBitmapMap.put(id, bitmap); - - InfoWindow infoWindow = new InfoWindow(bitmap, latLng, yOffSet.intValue(), new InfoWindow.OnInfoWindowClickListener(){ - - @Override - public void onInfoWindowClick() { - if(null == mMethodChannel){ - return; - } - Map infoWindowMap = new HashMap<>(); - - infoWindowMap.put("id", id); - - mMethodChannel.invokeMethod(InfoWindowProtocol.sMapDidClickedInfoWindowMethod, infoWindowMap); - } - } ); - - return new AbstractMap.SimpleEntry(id, infoWindow); - } - - /** - * 批量添加infowindow - * @param call - * @param result - */ - private void addInfoWindows(MethodCall call, MethodChannel.Result result) { - if(Env.DEBUG){ - Log.d(TAG, "addInfoWindows enter"); - } - List arguments = (List)call.arguments; - if(null == arguments){ - if(Env.DEBUG){ - Log.d(TAG, "arguments is null"); - } - return; - } - - List infoWindowList = new ArrayList<>(); - Iterator itr = arguments.iterator(); - while (itr.hasNext()){ - Map infoWindowMap = (Map )itr.next(); - if(null == infoWindowMap){ - continue; - } - - AbstractMap.SimpleEntry infoWindowEntry = MaptoInfoWindowEntry(infoWindowMap); - if(null == infoWindowEntry){ - continue; - } - - infoWindowList.add(infoWindowEntry.getValue()); - mInfoWindows.put(infoWindowEntry.getKey(), infoWindowEntry.getValue()); - } - - if(infoWindowList.size() > 0){ - mBaiduMap.showInfoWindows(infoWindowList); - } - } - - private void removeInfoWindow(MethodCall call, MethodChannel.Result result){ - if(null == mBaiduMap){ - return; - } - Map argument = call.arguments(); - if(null == argument){ - if(Env.DEBUG){ - Log.d(TAG, "argument is null"); - } - return; - } - - - String id = new TypeConverter().getValue(argument, "id"); - if(TextUtils.isEmpty(id)){ - if(Env.DEBUG){ - Log.d(TAG, "TextUtils.isEmpty(id)"); - } - return; - } - - InfoWindow infoWindow = mInfoWindows.get(id); - if(null == infoWindow){ - if(Env.DEBUG){ - Log.d(TAG, "null == infoWindow"); - } - return; - } - - if(Env.DEBUG){ - Log.d(TAG, "removeInfoWindow success"); - } - mBaiduMap.hideInfoWindow(infoWindow); - - mInfoWindows.remove(id); - - BitmapDescriptor bitmapDescriptor = mBitmapMap.get(id); - if(null != bitmapDescriptor){ - bitmapDescriptor.recycle(); - } - } - - @Override - public void clean(){ - super.clean(); - Iterator iterator = mBitmapMap.values().iterator(); - BitmapDescriptor bitmapDescriptor; - while (iterator.hasNext()){ - bitmapDescriptor = (BitmapDescriptor)iterator.next(); - if(null != bitmapDescriptor){ - bitmapDescriptor.recycle(); - } - } - - if(null != mInfoWindows) { - mInfoWindows.clear(); - } - } -} diff --git a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/mapHandler/LocationLayerHandler.java b/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/mapHandler/LocationLayerHandler.java deleted file mode 100644 index ed5dc20..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/mapHandler/LocationLayerHandler.java +++ /dev/null @@ -1,330 +0,0 @@ -package com.baidu.flutter_bmfmap.map.mapHandler; - -import android.content.Context; -import android.graphics.Color; -import android.text.TextUtils; - -import com.baidu.flutter_bmfmap.map.FlutterCommonMapView; -import com.baidu.flutter_bmfmap.utils.Constants; -import com.baidu.mapapi.map.BaiduMap; -import com.baidu.mapapi.map.BitmapDescriptor; -import com.baidu.mapapi.map.BitmapDescriptorFactory; -import com.baidu.mapapi.map.MyLocationConfiguration; -import com.baidu.mapapi.map.MyLocationData; -import com.baidu.flutter_bmfmap.utils.Env; - -import java.util.Map; - -import io.flutter.plugin.common.MethodCall; -import io.flutter.plugin.common.MethodChannel; - - -public class LocationLayerHandler extends BMapHandler { - private BaiduMap mBaiduMap; - - public LocationLayerHandler(FlutterCommonMapView mapView) { - super(mapView); - if (null != mapView) { - mBaiduMap = mapView.getBaiduMap(); - } - } - - @Override - public void updateMapView(FlutterCommonMapView mapView) { - super.updateMapView(mapView); - if (null != mapView) { - mBaiduMap = mapView.getBaiduMap(); - } - } - - @Override - public void handlerMethodCallResult(Context context, MethodCall call, MethodChannel.Result result) { - if (null == call) { - result.success(false); - return; - } - String methodId = call.method; - if (TextUtils.isEmpty(methodId)) { - result.success(false); - return; - } - switch (methodId) { - case Constants.LocationLayerMethodId.sMapShowUserLocationMethod: - setLocationEnabled(call, result); - break; - - case Constants.LocationLayerMethodId.sMapUpdateLocationDataMethod: - setUpdateLocationData(call, result); - break; - - case Constants.LocationLayerMethodId.sMapUserTrackingModeMethod: - setLoctype(call, result); - - break; - case Constants.LocationLayerMethodId.sMapUpdateLocationDisplayParamMethod: - setCustomLocation(call, result); - break; - default: - break; - } - } - - /** - * 自定义定位图层 - */ - private void setCustomLocation(MethodCall call, MethodChannel.Result result) { - Map argument = call.arguments(); - if (null == argument || null == mBaiduMap) { - result.success(false); - return; - } - if (!argument.containsKey("userlocationDisplayParam")) { - result.success(false); - return; - } - - Map locationDisplayParam = (Map) argument.get("userlocationDisplayParam"); - - if (null == locationDisplayParam) { - result.success(false); - return; - } - - if (!locationDisplayParam.containsKey("userTrackingMode") - || !locationDisplayParam.containsKey("enableDirection") - || !locationDisplayParam.containsKey("accuracyCircleStrokeColor") - || !locationDisplayParam.containsKey("accuracyCircleFillColor") - || !locationDisplayParam.containsKey("locationViewImage") - || !locationDisplayParam.containsKey("locationViewHierarchy")) { - result.success(false); - return; - } - - Integer userTrackingMode = (Integer) locationDisplayParam.get("userTrackingMode"); - Boolean enableDirection = (Boolean) locationDisplayParam.get("enableDirection"); - String locationViewImage = (String) locationDisplayParam.get("locationViewImage"); - String accuracyCircleStrokeColor = (String) locationDisplayParam.get("accuracyCircleStrokeColor"); - String accuracyCircleFillColor = (String) locationDisplayParam.get("accuracyCircleFillColor"); - - - BitmapDescriptor bitmap = null; - if (!TextUtils.isEmpty(locationViewImage)) { - bitmap = BitmapDescriptorFactory.fromAsset("flutter_assets/" + locationViewImage); - } - - int strokeColor = 0; - String color = "#"; - if (!TextUtils.isEmpty(accuracyCircleStrokeColor)) { - strokeColor = Color.parseColor(color.concat(accuracyCircleStrokeColor)); - } - - int fillColor = 0; - if (!TextUtils.isEmpty(accuracyCircleFillColor)) { - fillColor = Color.parseColor(color.concat(accuracyCircleFillColor)); - } - - if (null != userTrackingMode && null != enableDirection && null != bitmap - && strokeColor != 0 && fillColor != 0) { - switch (userTrackingMode) { - case Env.LocationMode.NORMAL: - case Env.LocationMode.MODEHEADING: - mBaiduMap.setMyLocationConfiguration(new MyLocationConfiguration( - MyLocationConfiguration.LocationMode.NORMAL, enableDirection, - bitmap,fillColor,strokeColor)); - break; - case Env.LocationMode.FOLLOWING: - mBaiduMap.setMyLocationConfiguration(new MyLocationConfiguration( - MyLocationConfiguration.LocationMode.FOLLOWING, enableDirection, - bitmap,fillColor,strokeColor)); - break; - case Env.LocationMode.COMPASS: - mBaiduMap.setMyLocationConfiguration(new MyLocationConfiguration( - MyLocationConfiguration.LocationMode.COMPASS, enableDirection, - bitmap,fillColor,strokeColor)); - break; - default: - break; - } - - } else if (null != userTrackingMode && null != enableDirection && strokeColor != 0 && fillColor != 0) { - switch (userTrackingMode) { - case Env.LocationMode.NORMAL: - case Env.LocationMode.MODEHEADING: - mBaiduMap.setMyLocationConfiguration(new MyLocationConfiguration( - MyLocationConfiguration.LocationMode.NORMAL, enableDirection, - null,fillColor,strokeColor)); - break; - case Env.LocationMode.FOLLOWING: - mBaiduMap.setMyLocationConfiguration(new MyLocationConfiguration( - MyLocationConfiguration.LocationMode.FOLLOWING, enableDirection, - null,fillColor,strokeColor)); - break; - case Env.LocationMode.COMPASS: - mBaiduMap.setMyLocationConfiguration(new MyLocationConfiguration( - MyLocationConfiguration.LocationMode.COMPASS, enableDirection, - null,fillColor,strokeColor)); - break; - default: - break; - } - } - } - - /** - * 设置定位模式 - */ - private void setLoctype(MethodCall call, MethodChannel.Result result) { - Map argument = call.arguments(); - if (null == argument || null == mBaiduMap) { - result.success(false); - return; - } - - if (!argument.containsKey("userTrackingMode") - || !argument.containsKey("enableDirection") - || !argument.containsKey("customMarker")) { - result.success(false); - return; - } - Integer userTrackingMode = (Integer) argument.get("userTrackingMode"); - Boolean enableDirection = (Boolean) argument.get("enableDirection"); - String customMarker = (String) argument.get("customMarker"); - - BitmapDescriptor bitmap = BitmapDescriptorFactory.fromAsset("flutter_assets/" + customMarker); - if (null != userTrackingMode && null != enableDirection && null != bitmap) { - switch (userTrackingMode) { - case Env.LocationMode.NORMAL: - case Env.LocationMode.MODEHEADING: - mBaiduMap.setMyLocationConfiguration(new MyLocationConfiguration( - MyLocationConfiguration.LocationMode.NORMAL, enableDirection, bitmap)); - break; - case Env.LocationMode.FOLLOWING: - mBaiduMap.setMyLocationConfiguration(new MyLocationConfiguration( - MyLocationConfiguration.LocationMode.FOLLOWING, enableDirection, bitmap)); - break; - case Env.LocationMode.COMPASS: - mBaiduMap.setMyLocationConfiguration(new MyLocationConfiguration( - MyLocationConfiguration.LocationMode.COMPASS, enableDirection, bitmap)); - break; - default: - break; - } - result.success(true); - } else if (null != userTrackingMode && null != enableDirection) { - switch (userTrackingMode) { - case Env.LocationMode.NORMAL: - case Env.LocationMode.MODEHEADING: - mBaiduMap.setMyLocationConfiguration(new MyLocationConfiguration( - MyLocationConfiguration.LocationMode.NORMAL, enableDirection, null)); - break; - case Env.LocationMode.FOLLOWING: - mBaiduMap.setMyLocationConfiguration(new MyLocationConfiguration( - MyLocationConfiguration.LocationMode.FOLLOWING, enableDirection, null)); - break; - case Env.LocationMode.COMPASS: - mBaiduMap.setMyLocationConfiguration(new MyLocationConfiguration( - MyLocationConfiguration.LocationMode.COMPASS, enableDirection, null)); - break; - default: - break; - } - result.success(true); - } - result.success(false); - } - - /** - * 定位数据 - */ - private void setUpdateLocationData(MethodCall call, MethodChannel.Result result) { - Map argument = call.arguments(); - MyLocationData.Builder builder = new MyLocationData.Builder(); - if (null == argument || null == mBaiduMap) { - result.success(false); - return; - } - if (!argument.containsKey("userLocation")) { - result.success(false); - return; - } - - Map userLocation = (Map) argument.get("userLocation"); - if (null == userLocation) { - result.success(false); - return; - } - if (!userLocation.containsKey("location")) { - result.success(false); - return; - } - - Map location = (Map) userLocation.get("location"); - if (null == location) { - result.success(false); - return; - } - if (!location.containsKey("coordinate") || !location.containsKey("course") - || !location.containsKey("speed") || !location.containsKey("accuracy") - || !location.containsKey("satellitesNum")) { - result.success(false); - return; - } - Map coordinate = (Map) location.get("coordinate"); - if (null != coordinate) { - if (coordinate.containsKey("latitude") && coordinate.containsKey("longitude")) { - Double latitude = coordinate.get("latitude"); - Double longitude = coordinate.get("longitude"); - if (null != latitude && null != longitude) { - builder.latitude(latitude); - builder.longitude(longitude); - } - } - } - Double course = (Double) location.get("course"); - if (null != course) { - builder.accuracy(course.floatValue()); - } - - Double speed = (Double) location.get("speed"); - if (null != speed) { - builder.speed(speed.floatValue()); - } - - Double accuracy = (Double) location.get("accuracy"); - if (null != accuracy) { - builder.speed(accuracy.floatValue()); - } - - Integer satellitesNum = (Integer) location.get("satellitesNum"); - if (null != satellitesNum) { - builder.satellitesNum(satellitesNum); - } - - mBaiduMap.setMyLocationData(builder.build()); - result.success(true); - } - - /** - * 开启定位图层 - */ - private void setLocationEnabled(MethodCall call, MethodChannel.Result result) { - Map argument = call.arguments(); - if (null == argument || null == mBaiduMap) { - result.success(false); - return; - } - - if (!argument.containsKey("show")) { - result.success(false); - return; - } - - Boolean show = (Boolean) argument.get("show"); - if (null == show) { - result.success(false); - return; - } - mBaiduMap.setMyLocationEnabled(show); - result.success(true); - } -} diff --git a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/mapHandler/MapStateHandler.java b/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/mapHandler/MapStateHandler.java deleted file mode 100644 index f3e6049..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/mapHandler/MapStateHandler.java +++ /dev/null @@ -1,409 +0,0 @@ -package com.baidu.flutter_bmfmap.map.mapHandler; - -import java.io.ByteArrayOutputStream; -import java.util.HashMap; -import java.util.Map; - -import com.baidu.flutter_bmfmap.map.FlutterCommonMapView; -import com.baidu.flutter_bmfmap.map.FlutterMapView; -import com.baidu.flutter_bmfmap.map.MapStateUpdateImp; -import com.baidu.flutter_bmfmap.map.MapViewWrapper; -import com.baidu.flutter_bmfmap.utils.Constants; -import com.baidu.flutter_bmfmap.utils.converter.FlutterDataConveter; -import com.baidu.mapapi.map.BaiduMap; -import com.baidu.mapapi.map.BitmapDescriptor; -import com.baidu.mapapi.map.BitmapDescriptorFactory; -import com.baidu.mapapi.map.MapStatus; -import com.baidu.mapapi.map.MapStatusUpdate; -import com.baidu.mapapi.map.MapStatusUpdateFactory; -import com.baidu.mapapi.map.MapView; -import com.baidu.mapapi.map.TextureMapView; -import com.baidu.mapapi.map.WinRound; -import com.baidu.mapapi.model.LatLng; -import com.baidu.mapapi.model.LatLngBounds; - -import android.content.Context; -import android.graphics.Bitmap; -import android.graphics.Rect; -import android.text.TextUtils; -import io.flutter.plugin.common.MethodCall; -import io.flutter.plugin.common.MethodChannel; - -public class MapStateHandler extends BMapHandler { - private static final String TAG = MapStateHandler.class.getSimpleName(); - private BaiduMap mBaiduMap; - - private String mViewType; - - public MapStateHandler(FlutterCommonMapView mapView) { - super(mapView); - mViewType = mapView.getViewType(); - mBaiduMap = mapView.getBaiduMap(); - } - - @Override - public void updateMapView(FlutterCommonMapView mapView) { - super.updateMapView(mapView); - if (null != mapView) { - mBaiduMap = mapView.getBaiduMap(); - } - } - - @Override - public void handlerMethodCallResult(Context context, MethodCall call, - MethodChannel.Result result) { - if (null == call) { - return; - } - String methodId = call.method; - if (TextUtils.isEmpty(methodId)) { - return; - } - - switch (methodId) { - case Constants.MethodProtocol.MapStateProtocol.sMapUpdateMethod: - setMapUpdate(call, result); - break; - case Constants.MethodProtocol.MapStateProtocol.sMapTakeSnapshotMethod: - mapSnapshot(result); - break; - case Constants.MethodProtocol.MapStateProtocol.sMapTakeSnapshotWithRectMethod: - snapShotRect(call, result); - break; - case Constants.MethodProtocol.MapStateProtocol.sMapSetCompassImageMethod: - setCompassImage(call, result); - break; - case Constants.MethodProtocol.MapStateProtocol.sMapSetCustomTrafficColorMethod: - setCustomTrafficColor(call, result); - break; - case Constants.MethodProtocol.MapStateProtocol.sMapSetVisibleMapBoundsMethod: - setNewCoordinateBounds(call, result); - break; - case Constants.MethodProtocol.MapStateProtocol.sMapSetVisibleMapBoundsWithPaddingMethod: - setVisibleMapBoundsWithPaddingMethod(call, result); - break; - case Constants.MethodProtocol.MapStateProtocol.sMapDidUpdateWidget: - case Constants.MethodProtocol.MapStateProtocol.sMapReassemble: - resumeMap(); - break; - default: - break; - } - } - - /** - * 自定义路况颜色 - */ - private void setCustomTrafficColor(MethodCall call, MethodChannel.Result result) { - Map argument = call.arguments(); - if (null == argument || null == mBaiduMap) { - result.success(false); - return; - } - if (!argument.containsKey("smooth") || !argument.containsKey("slow") - || !argument.containsKey("congestion") || !argument - .containsKey("severeCongestion")) { - result.success(false); - return; - } - - String smooth = (String) argument.get("smooth"); - String slow = (String) argument.get("slow"); - String congestion = (String) argument.get("congestion"); - String severeCongestion = (String) argument.get("severeCongestion"); - if (smooth == null || slow == null || congestion == null || severeCongestion == null) { - result.success(false); - return; - } - String color = "#"; - String severeCongestionColor = color.concat(severeCongestion); - String congestionColor = color.concat(congestion); - String slowColor = color.concat(slow); - String smoothColor = color.concat(smooth); - - mBaiduMap.setCustomTrafficColor(severeCongestionColor, congestionColor, slowColor, - smoothColor); - result.success(true); - } - - /** - * 设置罗盘图片 - */ - private void setCompassImage(MethodCall call, MethodChannel.Result result) { - Map argument = call.arguments(); - if (null == argument || null == mBaiduMap) { - result.success(false); - return; - } - - if (!argument.containsKey("imagePath")) { - result.success(false); - return; - } - - String imagePath = (String) argument.get("imagePath"); - if (imagePath == null) { - result.success(false); - return; - } - BitmapDescriptor bitmapDescriptor = - BitmapDescriptorFactory.fromAsset("flutter_assets/" + imagePath); - Bitmap bitmap = bitmapDescriptor.getBitmap(); - mBaiduMap.setCompassIcon(bitmap); - result.success(true); - } - - /** - * 选取区域截图 - */ - private void snapShotRect(MethodCall call, final MethodChannel.Result result) { - Map argument = call.arguments(); - if (null == argument || null == mBaiduMap) { - result.success(null); - return; - } - if (!argument.containsKey("rect")) { - result.success(null); - return; - } - Map rect = (Map) argument.get("rect"); - - WinRound winRound = FlutterDataConveter.BMFRectToWinRound(rect); - if (null == winRound) { - result.success(null); - return; - } - - if (winRound.left > winRound.right || winRound.top > winRound.bottom) { - result.success(null); - return; - } - - if (winRound.right - winRound.left > getMapViewWidth() - || winRound.bottom - winRound.top > getMapViewHeight()) { - result.success(null); - return; - } - - // 矩形区域保证left <= right top <= bottom 否则截屏失败 - Rect recta = new Rect(winRound.left, winRound.top, winRound.right, winRound.bottom); - mBaiduMap.snapshotScope(recta, new BaiduMap.SnapshotReadyCallback() { - @Override - public void onSnapshotReady(Bitmap bitmap) { - if (null == bitmap) { - result.success(null); - return; - } - ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); - bitmap.compress(Bitmap.CompressFormat.PNG, 100, byteArrayOutputStream); - result.success(byteArrayOutputStream.toByteArray()); - } - }); - } - - private int getMapViewWidth() { - int width = 0; - switch (mViewType) { - case Constants.ViewType.sMapView: - MapView mapView = mMapView.getMapView(); - width = null != mapView ? mapView.getWidth() : 0; - break; - case Constants.ViewType.sTextureMapView: - TextureMapView textureMapView = mMapView.getTextureMapView(); - width = null != textureMapView ? textureMapView.getWidth() : 0; - break; - default: - break; - } - - return width; - } - - private int getMapViewHeight() { - int height = 0; - switch (mViewType) { - case Constants.ViewType.sMapView: - MapView mapView = mMapView.getMapView(); - height = null != mapView ? mapView.getHeight() : 0; - break; - case Constants.ViewType.sTextureMapView: - TextureMapView textureMapView = mMapView.getTextureMapView(); - height = null != textureMapView ? textureMapView.getHeight() : 0; - break; - default: - break; - } - - return height; - } - - /** - * 截图 全部地图展示区域 - */ - private void mapSnapshot(final MethodChannel.Result result) { - if (null == mBaiduMap) { - result.success(null); - return; - } - mBaiduMap.snapshot(new BaiduMap.SnapshotReadyCallback() { - @Override - public void onSnapshotReady(Bitmap bitmap) { - if (null == bitmap) { - result.success(null); - return; - } - ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); - bitmap.compress(Bitmap.CompressFormat.PNG, 100, byteArrayOutputStream); - result.success(byteArrayOutputStream.toByteArray()); - } - }); - } - - /** - * 更新地图 - */ - private void setMapUpdate(MethodCall call, MethodChannel.Result result) { - Map argument = call.arguments(); - if (null == argument || null == mBaiduMap) { - result.success(false); - return; - } - - boolean ret = MapStateUpdateImp.getInstance() - .setCommView(mMapView) - .updateMapState(argument); - - result.success(ret); - } - - /** - * 设置显示在屏幕中的地图地理范围 - */ - private void setNewCoordinateBounds(MethodCall call, MethodChannel.Result result) { - Map argument = call.arguments(); - if (null == argument || null == mBaiduMap) { - result.success(false); - return; - } - - if (!argument.containsKey("visibleMapBounds")) { - result.success(false); - return; - } - - Map visibleMapBounds = - (Map) argument.get("visibleMapBounds"); - if (null == visibleMapBounds) { - result.success(false); - return; - } - - LatLngBounds latLngBounds = visibleMapBoundsImp(visibleMapBounds); - if (null == latLngBounds) { - result.success(false); - return; - } - - mBaiduMap.setMapStatus(MapStatusUpdateFactory.newLatLngBounds(latLngBounds)); - result.success(true); - } - - private LatLngBounds visibleMapBoundsImp(Map visibleMapBounds) { - if (!visibleMapBounds.containsKey("northeast") || !visibleMapBounds - .containsKey("southwest")) { - return null; - } - HashMap northeast = - (HashMap) visibleMapBounds.get("northeast"); - HashMap southwest = - (HashMap) visibleMapBounds.get("southwest"); - if (null == northeast || null == southwest) { - return null; - } - if (!northeast.containsKey("latitude") || !northeast.containsKey("longitude") - || !southwest.containsKey("latitude") || !southwest.containsKey("longitude")) { - return null; - } - - Double northeastLatitude = northeast.get("latitude"); - Double northeastLongitude = northeast.get("longitude"); - Double southwestLatitude = southwest.get("latitude"); - Double southwestLongitude = southwest.get("longitude"); - - if (null == northeastLatitude || null == northeastLongitude - || null == southwestLatitude || null == southwestLongitude) { - return null; - } - - LatLng northeastLatLng = new LatLng(northeastLatitude, northeastLongitude); - LatLng southwestLatLng = new LatLng(southwestLatitude, southwestLongitude); - LatLngBounds.Builder builder = new LatLngBounds.Builder(); - builder.include(northeastLatLng); - builder.include(southwestLatLng); - - return builder.build(); - } - - /** - * 根据Padding设置地理范围的合适缩放级别 - */ - private void setVisibleMapBoundsWithPaddingMethod(MethodCall call, - MethodChannel.Result result) { - Map argument = call.arguments(); - if (null == argument || null == mBaiduMap) { - result.success(false); - return; - } - - if (!argument.containsKey("visibleMapBounds") || !argument.containsKey("insets")) { - result.success(false); - return; - } - - Map visibleMapBounds = - (Map) argument.get("visibleMapBounds"); - Map insets = (Map) argument.get("insets"); - if (null == visibleMapBounds || null == insets) { - result.success(false); - return; - } - - LatLngBounds latLngBounds = visibleMapBoundsImp(visibleMapBounds); - if (null == latLngBounds) { - result.success(false); - return; - } - - if (!insets.containsKey("left") || !insets.containsKey("top") - || !insets.containsKey("right") || !insets.containsKey("bottom")) { - result.success(false); - return; - } - Double left = insets.get("left"); - Double top = insets.get("top"); - Double right = insets.get("right"); - Double bottom = insets.get("bottom"); - - if (null == left || null == top || null == right || null == bottom) { - result.success(false); - return; - } - MapStatusUpdate mapStatusUpdate = MapStatusUpdateFactory.newLatLngBounds(latLngBounds, - left.intValue(), top.intValue(), right.intValue(), bottom.intValue()); - mBaiduMap.setMapStatus(mapStatusUpdate); - result.success(true); - } - - private void updateMap() { - MapStatus.Builder builder = new MapStatus.Builder(); - MapStatusUpdate mapStatusUpdate = MapStatusUpdateFactory.newMapStatus(builder.build()); - mBaiduMap.setMapStatus(mapStatusUpdate); - } - - private void resumeMap() { - MapViewWrapper mapViewWrapper = (MapViewWrapper) mMapView; - FlutterMapView flutterMapView = mapViewWrapper.getFlutterMapView(); - flutterMapView.setResumeState(true); - } - -} diff --git a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/mapHandler/MapUpdateHandler.java b/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/mapHandler/MapUpdateHandler.java deleted file mode 100644 index 7fe7cbc..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/mapHandler/MapUpdateHandler.java +++ /dev/null @@ -1,1002 +0,0 @@ -package com.baidu.flutter_bmfmap.map.mapHandler; - -import android.content.Context; -import android.graphics.Point; -import android.text.TextUtils; -import android.util.Log; - -import com.baidu.flutter_bmfmap.map.FlutterCommonMapView; -import com.baidu.flutter_bmfmap.utils.Constants; -import com.baidu.flutter_bmfmap.utils.Env; -import com.baidu.flutter_bmfmap.utils.converter.FlutterDataConveter; -import com.baidu.mapapi.map.BaiduMap; -import com.baidu.mapapi.map.LogoPosition; -import com.baidu.mapapi.map.MapStatus; -import com.baidu.mapapi.map.MapStatusUpdate; -import com.baidu.mapapi.map.MapStatusUpdateFactory; -import com.baidu.mapapi.map.MapView; -import com.baidu.mapapi.map.TextureMapView; -import com.baidu.mapapi.map.UiSettings; -import com.baidu.mapapi.model.LatLng; -import com.baidu.mapapi.model.LatLngBounds; - -import java.util.HashMap; -import java.util.Map; - -import io.flutter.plugin.common.MethodCall; -import io.flutter.plugin.common.MethodChannel; - -public class MapUpdateHandler extends BMapHandler { - - private static final String TAG = "MapUpdateHandler"; - private BaiduMap mBaiduMap; - - public MapUpdateHandler(FlutterCommonMapView mapView) { - super(mapView); - if (null != mapView) { - mBaiduMap = mapView.getBaiduMap(); - } - } - - @Override - public void updateMapView(FlutterCommonMapView mapView) { - super.updateMapView(mapView); - if (null != mapView) { - mBaiduMap = mapView.getBaiduMap(); - } - } - - @Override - public void handlerMethodCallResult(Context context, MethodCall call, MethodChannel.Result result) { - if (null == call) { - result.success(false); - return; - } - String methodId = call.method; - if (TextUtils.isEmpty(methodId)) { - result.success(false); - return; - } - - switch (methodId) { - case Constants.MethodProtocol.MapStateProtocol.sMapZoomInMethod: - zoomIN(result); - break; - case Constants.MethodProtocol.MapStateProtocol.sMapZoomOutMethod: - zoomOut(result); - break; - case Constants.MethodProtocol.MapStateProtocol.sMapSetCenterCoordinateMethod: - setNewLatlng(call, result); - break; - case Constants.MethodProtocol.MapStateProtocol.sMapSetCenterZoomMethod: - setNewLatLngZoom(call, result); - break; - case Constants.MethodProtocol.MapStateProtocol.sMapSetMapStatusMethod: - setMapStatus(call, result); - break; - case Constants.MethodProtocol.MapStateProtocol.sMapSetScrollByMethod: - setScrollBy(call, result); - break; - case Constants.MethodProtocol.MapStateProtocol.sMapSetZoomByMethod: - setZoomBy(call, result); - break; - case Constants.MethodProtocol.MapStateProtocol.sMapSetZoomPointByMethod: - setZoomPointBy(call, result); - break; - case Constants.MethodProtocol.MapStateProtocol.sMapSetZoomToMethod: - setZoomTo(call, result); - break; - case Constants.MethodProtocol.MapStateProtocol.sMapGetMapStatusMethod: - getMapStatus(call, result); - break; - case Constants.MethodProtocol.BMFMapGetPropertyMethodId.sMapGetMapTypeMethod: - getMapType(result); - break; - case Constants.MethodProtocol.BMFMapGetPropertyMethodId.sMapGetZoomLevelMethod: - getZoomLevel(result); - break; - case Constants.MethodProtocol.BMFMapGetPropertyMethodId.sMapGetMinZoomLevelMethod: - getMinZoomLevel(result); - break; - case Constants.MethodProtocol.BMFMapGetPropertyMethodId.sMapGetMaxZoomLevelMethod: - getMaxZoomLevel(result); - break; - case Constants.MethodProtocol.BMFMapGetPropertyMethodId.sMapGetRotationMethod: - getRotation(result); - break; - case Constants.MethodProtocol.BMFMapGetPropertyMethodId.sMapGetOverlookingMethod: - getOverlooking(result); - break; - case Constants.MethodProtocol.BMFMapGetPropertyMethodId.sMapGetBuildingsEnabledMethod: - getBuildingsEnable(result); - break; - case Constants.MethodProtocol.BMFMapGetPropertyMethodId.sMapGetTrafficEnabledMethod: - getTrafficEnabled(result); - break; - case Constants.MethodProtocol.BMFMapGetPropertyMethodId.sMapGetBaiduHeatMapEnabledMethod: - getBaiduHeatMapEnabled(result); - break; - case Constants.MethodProtocol.BMFMapGetPropertyMethodId.sMapGetGesturesEnabledMethod: - getGesturesEnabled(result); - break; - case Constants.MethodProtocol.BMFMapGetPropertyMethodId.sMapGetZoomEnabledMethod: - getZoomEnabled(result); - break; - case Constants.MethodProtocol.BMFMapGetPropertyMethodId.sMapGetScrollEnabledMethod: - getScrollEnabled(result); - break; - case Constants.MethodProtocol.BMFMapGetPropertyMethodId.sMapGetOverlookEnabledMethod: - getOverlookEnabled(result); - break; - case Constants.MethodProtocol.BMFMapGetPropertyMethodId.sMapGetRotateEnabledMethod: - getRotateEnabled(result); - break; - case Constants.MethodProtocol.BMFMapGetPropertyMethodId.sMapGetMapScaleBarPositionMethod: - getScaleControlPosition(result); - break; - case Constants.MethodProtocol.BMFMapGetPropertyMethodId.sMapGetLogoPositionMethod: - getLogoPosition(result); - break; - case Constants.MethodProtocol.BMFMapGetPropertyMethodId.sMapGetVisibleMapBoundsMethod: - getVisibleMapBounds(result); - break; - case Constants.MethodProtocol.BMFMapGetPropertyMethodId.sMapGetBaseIndoorMapEnabledMethod: - getBaseIndoorMapEnable(result); - break; - case Constants.MethodProtocol.BMFMapGetPropertyMethodId.sMapGetShowIndoorMapPoiMethod: - getShowIndoorMapPoiEnable(result); - break; - default: - break; - } - } - - /** - * 获取map的显示室内图 - */ - private void getBaseIndoorMapEnable(MethodChannel.Result result) { - if (null == result) { - return; - } - HashMap baseIndoorMapEnabledHashMap = new HashMap<>(); - - boolean baseIndoorMapMode = BMFMapStatus.getsInstance().isBaseIndoorEnable(); - baseIndoorMapEnabledHashMap.put("baseIndoorMapEnabled",baseIndoorMapMode); - result.success(baseIndoorMapEnabledHashMap); - } - - /** - * 获取map的显示室内图 - */ - private void getShowIndoorMapPoiEnable(MethodChannel.Result result) { - if (null == result) { - return; - } - HashMap showIndoorMapPoiEnabledHashMap = new HashMap<>(); - - boolean indoorMapPoiEnable = BMFMapStatus.getsInstance().isIndoorMapPoiEnable(); - showIndoorMapPoiEnabledHashMap.put("showIndoorMapPoi",indoorMapPoiEnable); - result.success(showIndoorMapPoiEnabledHashMap); - } - - /** - * 获取map的可视范围 - */ - private void getVisibleMapBounds(MethodChannel.Result result) { - if (null == result || null == mBaiduMap) { - return; - } - HashMap latLngBoundsHashMap = new HashMap<>(); - MapStatus mapStatus = mBaiduMap.getMapStatus(); - if (null == mapStatus) { - return; - } - LatLngBounds bound = mapStatus.bound; - HashMap latLngBounds = latLngBounds(bound); - if (null == latLngBoundsHashMap) { - return; - } - latLngBoundsHashMap.put("visibleMapBounds",latLngBounds); - result.success(latLngBoundsHashMap); - } - - private HashMap latLngBounds(LatLngBounds latLngBounds) { - if (null == latLngBounds) { - return null; - } - // 该地理范围东北坐标 - LatLng northeast = latLngBounds.northeast; - // 该地理范围西南坐标 - LatLng southwest = latLngBounds.southwest; - - HashMap boundsMap = new HashMap(); - HashMap northeastMap = new HashMap(); - if (null == northeast){ - return null; - } - northeastMap.put("latitude", northeast.latitude); - northeastMap.put("longitude",northeast.longitude); - HashMap southwestMap = new HashMap(); - if (null == southwest) { - return null; - } - southwestMap.put("latitude",southwest.latitude); - southwestMap.put("longitude", southwest.longitude); - boundsMap.put("northeast",northeastMap); - boundsMap.put("southwest",southwestMap); - return boundsMap; - } - - /** - * 获取map的logo位置 - */ - private void getLogoPosition(MethodChannel.Result result) { - if (null == result) { - return; - } - if(null == mMapView) { - result.success(null); - return; - } - HashMap logoPositionHashMap = new HashMap<>(); - String viewType = mMapView.getViewType(); - LogoPosition logoPosition = null; - if (viewType.equals(Constants.ViewType.sMapView)) { - MapView mapView = mMapView.getMapView(); - logoPosition = mapView.getLogoPosition(); - } else if (viewType.equals(Constants.ViewType.sTextureMapView)) { - TextureMapView textureMapView = mMapView.getTextureMapView(); - logoPosition = textureMapView.getLogoPosition(); - } - if (null == logoPosition) { - result.success(null); - return; - } - switch (logoPosition) { - case logoPostionleftBottom: - logoPositionHashMap.put("logoPosition",0); - break; - case logoPostionleftTop: - logoPositionHashMap.put("logoPosition",1); - break; - case logoPostionCenterBottom: - logoPositionHashMap.put("logoPosition",2); - break; - case logoPostionCenterTop: - logoPositionHashMap.put("logoPosition",3); - break; - case logoPostionRightBottom: - logoPositionHashMap.put("logoPosition",4); - break; - case logoPostionRightTop: - logoPositionHashMap.put("logoPosition",5); - break; - default: - break; - } - result.success(logoPositionHashMap); - } - - /** - * 获取map的比例尺的位置 - * - * 要在setScaleControlPosition后才可以获取否则返回null - */ - private void getScaleControlPosition(final MethodChannel.Result result) { - if (null == result) { - return; - } - if(null == mMapView) { - result.success(null); - return; - } - HashMap scaleControlPositionHashMap = new HashMap<>(); - HashMap pointHashMap = new HashMap<>(); - Point scaleControlPosition = null; - String viewType = mMapView.getViewType(); - if (viewType.equals(Constants.ViewType.sMapView)) { - MapView mapView = mMapView.getMapView(); - scaleControlPosition = mapView.getScaleControlPosition(); - } else if (viewType.equals(Constants.ViewType.sTextureMapView)) { - result.success(null); - return; - } - if (null == scaleControlPosition) { - result.success(null); - return; - } - double x = scaleControlPosition.x; - double y = scaleControlPosition.y; - pointHashMap.put("x",x); - pointHashMap.put("y",y); - scaleControlPositionHashMap.put("mapScaleBarPosition",pointHashMap); - result.success(scaleControlPositionHashMap); - } - - /** - * 获取map是否支持旋转 - */ - private void getRotateEnabled(MethodChannel.Result result) { - if (null == result || null == mBaiduMap) { - return; - } - HashMap rotateGesturesEnabledHashMap = new HashMap<>(); - MapStatus mapStatus = mBaiduMap.getMapStatus(); - if(null == mapStatus) { - return; - } - - UiSettings uiSettings = mBaiduMap.getUiSettings(); - boolean rotateGesturesEnabled = uiSettings.isRotateGesturesEnabled(); - rotateGesturesEnabledHashMap.put("rotateEnabled",rotateGesturesEnabled); - result.success(rotateGesturesEnabledHashMap); - } - - /** - * 获取map是否支持俯仰角 - */ - private void getOverlookEnabled(MethodChannel.Result result) { - if (null == result || null == mBaiduMap) { - return; - } - HashMap scrollEnabledHashMap = new HashMap<>(); - MapStatus mapStatus = mBaiduMap.getMapStatus(); - if(null == mapStatus) { - return; - } - - UiSettings uiSettings = mBaiduMap.getUiSettings(); - boolean overlookingGesturesEnabled = uiSettings.isOverlookingGesturesEnabled(); - scrollEnabledHashMap.put("overlookEnabled",overlookingGesturesEnabled); - result.success(scrollEnabledHashMap); - } - - /** - * 获取map是否支持拖拽手势 - */ - private void getScrollEnabled(MethodChannel.Result result) { - if (null == result || null == mBaiduMap) { - return; - } - HashMap scrollEnabledHashMap = new HashMap<>(); - MapStatus mapStatus = mBaiduMap.getMapStatus(); - if(null == mapStatus) { - return; - } - - UiSettings uiSettings = mBaiduMap.getUiSettings(); - boolean scrollGesturesEnabled = uiSettings.isScrollGesturesEnabled(); - scrollEnabledHashMap.put("scrollEnabled",scrollGesturesEnabled); - result.success(scrollEnabledHashMap); - } - - /** - * 获取map是否支持缩放 - */ - private void getZoomEnabled(MethodChannel.Result result) { - if (null == result || null == mBaiduMap) { - return; - } - HashMap zoomGesturesEnabledHashMap = new HashMap<>(); - MapStatus mapStatus = mBaiduMap.getMapStatus(); - if(null == mapStatus) { - return; - } - - UiSettings uiSettings = mBaiduMap.getUiSettings(); - boolean zoomGesturesEnabled = uiSettings.isZoomGesturesEnabled(); - zoomGesturesEnabledHashMap.put("zoomEnabled",zoomGesturesEnabled); - result.success(zoomGesturesEnabledHashMap); - } - - /** - * 获取地图的所有手势 - */ - private void getGesturesEnabled(MethodChannel.Result result) { - if (null == result || null == mBaiduMap) { - return; - } - HashMap gesturesEnabledHashMap = new HashMap<>(); - MapStatus mapStatus = mBaiduMap.getMapStatus(); - if(null == mapStatus) { - return; - } - - UiSettings uiSettings = mBaiduMap.getUiSettings(); - if (uiSettings.isRotateGesturesEnabled() && uiSettings.isScrollGesturesEnabled() - && uiSettings.isOverlookingGesturesEnabled() && uiSettings.isZoomGesturesEnabled()) { - gesturesEnabledHashMap.put("gesturesEnabled",true); - result.success(gesturesEnabledHashMap); - } else { - gesturesEnabledHashMap.put("gesturesEnabled",false); - result.success(gesturesEnabledHashMap); - } - } - - /** - * 获取是否开启百度热力图 - */ - private void getBaiduHeatMapEnabled(MethodChannel.Result result) { - if (null == result || null == mBaiduMap) { - return; - } - HashMap baiduHeatMapEnabledHashMap = new HashMap<>(); - MapStatus mapStatus = mBaiduMap.getMapStatus(); - if(null == mapStatus) { - return; - } - boolean baiduHeatMapEnabled = mBaiduMap.isBaiduHeatMapEnabled(); - baiduHeatMapEnabledHashMap.put("baiduHeatMapEnabled",baiduHeatMapEnabled); - result.success(baiduHeatMapEnabledHashMap); - } - - /** - * 获取是否开启路况 - */ - private void getTrafficEnabled(MethodChannel.Result result) { - if (null == result || null == mBaiduMap) { - return; - } - HashMap trafficEnabledHashMap = new HashMap<>(); - MapStatus mapStatus = mBaiduMap.getMapStatus(); - if(null == mapStatus) { - return; - } - boolean trafficEnabled = mBaiduMap.isTrafficEnabled(); - trafficEnabledHashMap.put("trafficEnabled",trafficEnabled); - result.success(trafficEnabledHashMap); - } - - - /** - * 获取map是否现显示3D楼块效果 - */ - private void getBuildingsEnable(MethodChannel.Result result) { - if (null == result || null == mBaiduMap) { - return; - } - HashMap buildingsEnabledHashMap = new HashMap<>(); - MapStatus mapStatus = mBaiduMap.getMapStatus(); - if(null == mapStatus) { - return; - } - boolean isBuildingsEnabled = mBaiduMap.isBuildingsEnabled(); - buildingsEnabledHashMap.put("buildingsEnabled",isBuildingsEnabled); - result.success(buildingsEnabledHashMap); - } - - /** - * 获取map的地图俯视角度 - */ - private void getOverlooking(MethodChannel.Result result) { - if (null == result || null == mBaiduMap) { - return; - } - HashMap overlookHashMap = new HashMap<>(); - MapStatus mapStatus = mBaiduMap.getMapStatus(); - if(null == mapStatus) { - return; - } - double overlook = mapStatus.overlook; - overlookHashMap.put("overlooking",overlook); - result.success(overlookHashMap); - } - - /** - * 获取map的旋转角度 - */ - private void getRotation(MethodChannel.Result result) { - if (null == result || null == mBaiduMap) { - return; - } - HashMap rotationHashMap = new HashMap<>(); - MapStatus mapStatus = mBaiduMap.getMapStatus(); - if(null == mapStatus) { - return; - } - double rotate = mapStatus.rotate; - if (rotate > 180) { - rotate = rotate - 360; - } - rotationHashMap.put("rotation",rotate); - result.success(rotationHashMap); - } - - /** - * 获取地图最大缩放级别 - */ - private void getMaxZoomLevel(MethodChannel.Result result) { - if (null == result || null == mBaiduMap) { - return; - } - HashMap maxZoomLevelHashMap = new HashMap<>(); - int maxZoomLevel = (int) mBaiduMap.getMaxZoomLevel(); - maxZoomLevelHashMap.put("maxZoomLevel",maxZoomLevel); - result.success(maxZoomLevelHashMap); - } - - /** - * 获取地图最小缩放级别 - */ - private void getMinZoomLevel(MethodChannel.Result result) { - if (null == result || null == mBaiduMap) { - return; - } - HashMap minZoomLevelHashMap = new HashMap<>(); - int minZoomLevel = (int) mBaiduMap.getMinZoomLevel(); - minZoomLevelHashMap.put("minZoomLevel",minZoomLevel); - result.success(minZoomLevelHashMap); - } - - /** - * 获取地图缩放级别 - */ - private void getZoomLevel(MethodChannel.Result result) { - if (null == result || null == mBaiduMap) { - return; - } - HashMap zoomHashMap = new HashMap<>(); - MapStatus mapStatus = mBaiduMap.getMapStatus(); - if(null == mapStatus) { - return; - } - int zoom = (int) mapStatus.zoom; - zoomHashMap.put("zoomLevel",zoom); - result.success(zoomHashMap); - } - - /** - * 获取地图类型 - */ - private void getMapType(MethodChannel.Result result) { - if (null == result || null == mBaiduMap) { - return; - } - HashMap mapTypeHashMap = new HashMap<>(); - int mapType = mBaiduMap.getMapType(); - if(mapType == BaiduMap.MAP_TYPE_NONE) { - mapTypeHashMap.put("mapType",0); - }else if (mapType == BaiduMap.MAP_TYPE_NORMAL) { - mapTypeHashMap.put("mapType",1); - }else if (mapType == BaiduMap.MAP_TYPE_SATELLITE) { - mapTypeHashMap.put("mapType",2); - } - result.success(mapTypeHashMap); - } - - /** - * 设置地图缩放级别 - */ - private void setZoomTo(MethodCall call, MethodChannel.Result result) { - Map argument = call.arguments(); - if (null == argument || null == mBaiduMap) { - result.success(false); - return; - } - - if (!argument.containsKey("zoom") || !argument.containsKey("animateDurationMs")) { - result.success(false); - return; - } - - Double zoom = (Double) argument.get("zoom"); - Integer animateDurationMs = (Integer) argument.get("animateDurationMs"); - - if (null != zoom && null != animateDurationMs) { - MapStatusUpdate mapStatusUpdate = MapStatusUpdateFactory.zoomTo(zoom.floatValue()); - mBaiduMap.animateMapStatus(mapStatusUpdate, animateDurationMs); - result.success(true); - } else if (null != zoom) { - MapStatusUpdate mapStatusUpdate = MapStatusUpdateFactory.zoomTo(zoom.floatValue()); - mBaiduMap.setMapStatus(mapStatusUpdate); - result.success(true); - } else { - result.success(false); - } - } - - /** - * 缩小地图缩放级别 - */ - private void zoomOut(MethodChannel.Result result) { - if (null == mBaiduMap) { - result.success(false); - return; - } - MapStatusUpdate mapStatusUpdate = MapStatusUpdateFactory.zoomOut(); - mBaiduMap.setMapStatus(mapStatusUpdate); - result.success(true); - } - - /** - * 放大地图缩放级别 - */ - private void zoomIN(MethodChannel.Result result) { - if (null == mBaiduMap) { - result.success(false); - return; - } - MapStatusUpdate mapStatusUpdate = MapStatusUpdateFactory.zoomIn(); - mBaiduMap.setMapStatus(mapStatusUpdate); - result.success(true); - } - - /** - * 根据给定增量以及给定的屏幕坐标缩放地图级别 - */ - private void setZoomPointBy(MethodCall call, MethodChannel.Result result) { - Map argument = call.arguments(); - if (null == argument || null == mBaiduMap) { - result.success(false); - return; - } - - if (!argument.containsKey("amount") || !argument.containsKey("focus") - || !argument.containsKey("animateDurationMs")) { - result.success(false); - return; - } - - Double amount = (Double) argument.get("amount"); - Map focus = (Map) argument.get("focus"); - Integer animateDurationMs = (Integer) argument.get("animateDurationMs"); - - if (null != amount && null != focus && null != animateDurationMs) { - Double x = focus.get("x"); - Double y = focus.get("y"); - if (x == null || y == null) { - result.success(false); - return ; - } - - Point point = new Point(x.intValue(), y.intValue()); - MapStatusUpdate mapStatusUpdate = MapStatusUpdateFactory.zoomBy(amount.floatValue(),point); - mBaiduMap.animateMapStatus(mapStatusUpdate, animateDurationMs); - result.success(true); - } else if (null != amount && null != focus) { - Double x = focus.get("x"); - Double y = focus.get("y"); - if (x == null || y == null) { - result.success(false); - return; - } - - Point point = new Point(x.intValue(), y.intValue()); - MapStatusUpdate mapStatusUpdate = MapStatusUpdateFactory.zoomBy(amount.floatValue(),point); - mBaiduMap.setMapStatus(mapStatusUpdate); - result.success(true); - } else { - result.success(false); - } - - } - - /** - * 根据给定增量缩放地图级别 - */ - private void setZoomBy(MethodCall call, MethodChannel.Result result) { - Map argument = call.arguments(); - if (null == argument || null == mBaiduMap) { - result.success(false); - return; - } - - if (!argument.containsKey("amount") || !argument.containsKey("animateDurationMs")) { - result.success(false); - return; - } - - Double amount = (Double) argument.get("amount"); - Integer animateDurationMs = (Integer) argument.get("animateDurationMs"); - if (null != amount && null != animateDurationMs) { - MapStatusUpdate mapStatusUpdate = MapStatusUpdateFactory.zoomBy(amount.floatValue()); - mBaiduMap.animateMapStatus(mapStatusUpdate, animateDurationMs); - result.success(true); - } else if (null != amount) { - MapStatusUpdate mapStatusUpdate = MapStatusUpdateFactory.zoomBy(amount.floatValue()); - mBaiduMap.setMapStatus(mapStatusUpdate); - result.success(true); - } else { - result.success(false); - } - } - - /** - * 按像素移动地图中心点 - */ - private void setScrollBy(MethodCall call, MethodChannel.Result result) { - Map argument = call.arguments(); - if (null == argument || null == mBaiduMap) { - result.success(false); - return; - } - - if (!argument.containsKey("xPixel") - || !argument.containsKey("yPixel") - || !argument.containsKey("animateDurationMs")) { - result.success(false); - return; - } - Integer xPixel = (Integer) argument.get("xPixel"); - Integer yPixel = (Integer) argument.get("yPixel"); - Integer animateDurationMs = (Integer) argument.get("animateDurationMs"); - - if (null != xPixel && null != yPixel && null != animateDurationMs) { - MapStatusUpdate mapStatusUpdate = MapStatusUpdateFactory.scrollBy(xPixel,yPixel); - mBaiduMap.animateMapStatus(mapStatusUpdate, animateDurationMs); - result.success(true); - } else if (null != xPixel && null != yPixel) { - MapStatusUpdate mapStatusUpdate = MapStatusUpdateFactory.scrollBy(xPixel,yPixel); - mBaiduMap.setMapStatus(mapStatusUpdate); - result.success(true); - } else { - result.success(false); - } - } - - /** - * 设置地图新状态 - */ - private void setMapStatus(MethodCall call, MethodChannel.Result result) { - Map argument = call.arguments(); - if (null == argument || null == mBaiduMap) { - result.success(false); - return; - } - - if (!argument.containsKey("mapStatus") || !argument.containsKey("animateDurationMs")) { - result.success(false); - return; - } - - Map mapStatus = (Map) argument.get("mapStatus"); - Integer animateDurationMs = (Integer) argument.get("animateDurationMs"); - if (null != mapStatus && null != animateDurationMs) { - boolean b = setAnimateMapStatusImp(mapStatus, animateDurationMs); - result.success(b); - } if (null != mapStatus) { - boolean b = setMapStatusImp(mapStatus); - result.success(b); - }else { - result.success(false); - } - } - - /** - * 获取地图新状态 - */ - private void getMapStatus(MethodCall call, MethodChannel.Result result) { - MapStatus mapStatus = mBaiduMap.getMapStatus(); - - final HashMap mapStatusMap = new HashMap<>(); - mapStatusMap.put("fLevel", mapStatus.zoom); - mapStatusMap.put("fRotation", mapStatus.rotate); - mapStatusMap.put("fOverlooking", mapStatus.overlook); - mapStatusMap.put("targetScreenPt", FlutterDataConveter.pointToMap(mapStatus.targetScreen)); - mapStatusMap.put("targetGeoPt", FlutterDataConveter.latLngToMap(mapStatus.target)); - mapStatusMap.put("visibleMapBounds", FlutterDataConveter.latlngBoundsToMap(mapStatus.bound)); - - result.success(new HashMap(){ - { - put("mapStatus", mapStatusMap); - } - }); - } - - /** - * 动画形式更新地图状态参数配置 - */ - private boolean setAnimateMapStatusImp(Map mapStatusParameter, Integer animateDurationMs) { - if (!mapStatusParameter.containsKey("fLevel") - || !mapStatusParameter.containsKey("fRotation") - || !mapStatusParameter.containsKey("fOverlooking") - || !mapStatusParameter.containsKey("targetScreenPt") - || !mapStatusParameter.containsKey("targetGeoPt")) { - return false; - } - MapStatus mapStatus = mapStatusImp(mapStatusParameter); - - MapStatusUpdate mapStatusUpdate = MapStatusUpdateFactory.newMapStatus(mapStatus); - mBaiduMap.animateMapStatus(mapStatusUpdate, animateDurationMs); - return true; - } - - /** - * 更新地图状态参数配置 - */ - private boolean setMapStatusImp(Map mapStatusParameter) { - if (!mapStatusParameter.containsKey("fLevel") - || !mapStatusParameter.containsKey("fRotation") - || !mapStatusParameter.containsKey("fOverlooking") - || !mapStatusParameter.containsKey("targetScreenPt") - || !mapStatusParameter.containsKey("targetGeoPt")) { - return false; - } - MapStatus mapStatus = mapStatusImp(mapStatusParameter); - MapStatusUpdate mapStatusUpdate = MapStatusUpdateFactory.newMapStatus(mapStatus); - mBaiduMap.setMapStatus(mapStatusUpdate); - return true; - } - - private MapStatus mapStatusImp(Map mapStatusParameter){ - MapStatus.Builder builder = new MapStatus.Builder(); - Double fLevel = (Double) mapStatusParameter.get("fLevel"); - if (null != fLevel) { - builder.zoom(fLevel.floatValue()); - } - Double fRotation = (Double) mapStatusParameter.get("fRotation"); - if (null != fRotation) { - builder.rotate(fRotation.floatValue()); - } - Double fOverlooking = (Double) mapStatusParameter.get("fOverlooking"); - if (null != fOverlooking) { - builder.overlook(fOverlooking.floatValue()); - } - Map targetScreenPt = (Map) mapStatusParameter.get("targetScreenPt"); - if (null != targetScreenPt) { - if (targetScreenPt.containsKey("x") && targetScreenPt.containsKey("y")) { - Double x = targetScreenPt.get("x"); - Double y = targetScreenPt.get("y"); - if (null != x && null != y) { - Point point = new Point(x.intValue(), y.intValue()); - builder.targetScreen(point); - } - } - } - - Map targetGeoPt = (Map) mapStatusParameter.get("targetGeoPt"); - if (null != targetGeoPt) { - if (targetGeoPt.containsKey("latitude") && targetGeoPt.containsKey("longitude")) { - Double latitude = targetGeoPt.get("latitude"); - Double longitude = targetGeoPt.get("longitude"); - if (null != latitude && null != longitude) { - LatLng latLng = new LatLng(latitude, longitude); - builder.target(latLng); - } - } - } - - return builder.build(); - } - - /** - * 设置地图中心点以及缩放级别 - */ - private void setNewLatLngZoom(MethodCall call, MethodChannel.Result result) { - Map argument = call.arguments(); - if (null == argument || null == mBaiduMap) { - result.success(false); - return; - } - - if (!argument.containsKey("coordinate") || !argument.containsKey("zoom") || !argument.containsKey( - "animateDurationMs")) { - result.success(false); - return; - } - Map coordinate = (Map) argument.get("coordinate"); - Double zoom = (Double) argument.get("zoom"); - Integer animateDurationMs = (Integer) argument.get("animateDurationMs"); - if (null != coordinate && zoom != null && animateDurationMs != null) { - boolean b = setAnimateNewLatLngZoomImp(coordinate, zoom, animateDurationMs); - result.success(b); - } else if (null != coordinate && zoom != null) { - boolean b = setNewLatLngZoomImp(coordinate, zoom); - result.success(b); - } else { - result.success(false); - } - } - - /** - * 动画形式更新地图中心点以及缩放级别 - * - * @return 成功则返回true 否则返回false - */ - private boolean setAnimateNewLatLngZoomImp(Map coordinate, Double zoom, Integer animateDurationMs) { - if (!coordinate.containsKey("latitude") || !coordinate.containsKey("longitude")) { - return false; - } - Double latitude = coordinate.get("latitude"); - Double longitude = coordinate.get("longitude"); - if (null == latitude || null == longitude) { - return false; - } - LatLng latLng = new LatLng(latitude, longitude); - float zoomValue = zoom.floatValue(); - MapStatusUpdate mapStatusUpdate = MapStatusUpdateFactory.newLatLngZoom(latLng, zoomValue); - mBaiduMap.animateMapStatus(mapStatusUpdate, animateDurationMs); - return true; - } - - /** - * 更新地图中心点以及缩放级别 - * - * @return 成功则返回true 否则返回false - */ - private boolean setNewLatLngZoomImp(Map coordinate, Double zoom) { - if (!coordinate.containsKey("latitude") || !coordinate.containsKey("longitude")) { - return false; - } - Double latitude = coordinate.get("latitude"); - Double longitude = coordinate.get("longitude"); - if (null == latitude || null == longitude) { - return false; - } - LatLng latLng = new LatLng(latitude, longitude); - float zoomValue = zoom.floatValue(); - MapStatusUpdate mapStatusUpdate = MapStatusUpdateFactory.newLatLngZoom(latLng, zoomValue); - mBaiduMap.setMapStatus(mapStatusUpdate); - return true; - } - - /** - * 更新地图中心点 - */ - private void setNewLatlng(MethodCall call, MethodChannel.Result result) { - if(Env.DEBUG){ - Log.d(TAG, "setNewLatlng"); - } - Map argument = call.arguments(); - if (null == argument || null == mBaiduMap) { - result.success(false); - return; - } - - if (!argument.containsKey("coordinate") || !argument.containsKey("animateDurationMs")) { - result.success(false); - return; - } - Map coordinate = (Map) argument.get("coordinate"); - Integer animateDurationMs = (Integer) argument.get("animateDurationMs"); - if (null != coordinate && null != animateDurationMs) { - boolean b = setAnimateNewLatlngImp(coordinate, animateDurationMs); - result.success(b); - } else if (null != coordinate) { - boolean b = setNewLatlngImp(coordinate); - result.success(b); - } else { - result.success(false); - } - } - - /** - * 动画更新地图中心点 - * - * @return 成功则返回true 否则返回false - */ - private boolean setAnimateNewLatlngImp(Map coordinate, Integer animateDurationMs) { - if (!coordinate.containsKey("latitude") || !coordinate.containsKey("longitude")) { - return false; - } - Double latitude = coordinate.get("latitude"); - Double longitude = coordinate.get("longitude"); - if (null == latitude || null == longitude) { - return false; - } - LatLng latLng = new LatLng(latitude, longitude); - MapStatusUpdate mapStatusUpdate = MapStatusUpdateFactory.newLatLng(latLng); - mBaiduMap.animateMapStatus(mapStatusUpdate, animateDurationMs); - return true; - } - - /** - * 更新地图中心点 - * - * @return 成功则返回true 否则返回false - */ - private boolean setNewLatlngImp(Map coordinate) { - if (!coordinate.containsKey("latitude") || !coordinate.containsKey("longitude")) { - return false; - } - Double latitude = coordinate.get("latitude"); - Double longitude = coordinate.get("longitude"); - if (null == latitude || null == longitude) { - return false; - } - LatLng latLng = new LatLng(latitude, longitude); - MapStatusUpdate mapStatusUpdate = MapStatusUpdateFactory.newLatLng(latLng); - mBaiduMap.setMapStatus(mapStatusUpdate); - return true; - } -} diff --git a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/mapHandler/MarkerHandler.java b/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/mapHandler/MarkerHandler.java deleted file mode 100644 index 8f54b37..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/mapHandler/MarkerHandler.java +++ /dev/null @@ -1,616 +0,0 @@ -package com.baidu.flutter_bmfmap.map.mapHandler; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import com.baidu.flutter_bmfmap.map.FlutterCommonMapView; -import com.baidu.flutter_bmfmap.map.mapHandler.BMapHandler; -import com.baidu.flutter_bmfmap.utils.Constants; -import com.baidu.flutter_bmfmap.utils.Env; -import com.baidu.flutter_bmfmap.utils.converter.FlutterDataConveter; -import com.baidu.flutter_bmfmap.utils.converter.TypeConverter; -import com.baidu.mapapi.BMapManager; -import com.baidu.mapapi.map.BaiduMap; -import com.baidu.mapapi.map.BitmapDescriptor; -import com.baidu.mapapi.map.BitmapDescriptorFactory; -import com.baidu.mapapi.map.Marker; -import com.baidu.mapapi.map.MarkerOptions; -import com.baidu.mapapi.map.Overlay; -import com.baidu.mapapi.model.LatLng; - -import android.content.Context; -import android.graphics.Bitmap; -import android.graphics.BitmapFactory; -import android.graphics.Point; -import android.os.Bundle; -import android.text.TextUtils; -import android.util.Log; - -import io.flutter.plugin.common.MethodCall; -import io.flutter.plugin.common.MethodChannel; - -public class MarkerHandler extends BMapHandler { - - private static final String TAG = "MarkerHandler"; - - private HashMap mOverlayMap = new HashMap<>(); - private HashMap mMarkerBitmapMap = new HashMap<>(); - - private BaiduMap mBaiduMap; - - public MarkerHandler(FlutterCommonMapView mapView) { - super(mapView); - if (null != mMapView) { - mBaiduMap = mMapView.getBaiduMap(); - } - } - - @Override - public void updateMapView(FlutterCommonMapView mapView) { - mMapView = mapView; - if (null != mMapView) { - mBaiduMap = mMapView.getBaiduMap(); - } - } - - @Override - public void clean() { - super.clean(); - Iterator iterator = mMarkerBitmapMap.values().iterator(); - BitmapDescriptor bitmapDescriptor; - while (iterator.hasNext()) { - bitmapDescriptor = (BitmapDescriptor) iterator.next(); - if (null != bitmapDescriptor) { - bitmapDescriptor.recycle(); - } - } - - mMarkerBitmapMap.clear(); - mOverlayMap.clear(); - } - - @Override - public void handlerMethodCallResult(Context context, MethodCall call, - MethodChannel.Result result) { - if (null == call) { - result.success(false); - return; - } - - if (null == mBaiduMap) { - result.success(false); - return; - } - - String methodId = call.method; - if (TextUtils.isEmpty(methodId)) { - result.success(false); - return; - } - - boolean ret = false; - switch (methodId) { - case Constants.MethodProtocol.MarkerProtocol.sMapAddMarkerMethod: - ret = addMarker(call); - break; - case Constants.MethodProtocol.MarkerProtocol.sMapAddMarkersMethod: - ret = addMarkers(call); - break; - case Constants.MethodProtocol.MarkerProtocol.sMapRemoveMarkerMethod: - ret = removeMarker(call); - break; - case Constants.MethodProtocol.MarkerProtocol.sMapRemoveMarkersMethod: - ret = removeMarkers(call); - break; - case Constants.MethodProtocol.MarkerProtocol.sMapDidSelectMarkerMethod: - break; - case Constants.MethodProtocol.MarkerProtocol.sMapDidDeselectMarkerMethod: - break; - case Constants.MethodProtocol.MarkerProtocol.sMapCleanAllMarkersMethod: - ret = cleanAllMarker(call); - break; - case Constants.MethodProtocol.MarkerProtocol.sMapUpdateMarkerMemberMethod: - ret = updateMarkerMember(call, result); - break; - default: - break; - } - - result.success(ret); - - return; - } - - private boolean addMarker(MethodCall call) { - Map argument = call.arguments(); - if (null == argument) { - return false; - } - - return addMarkerImp(argument); - } - - private boolean addMarkerImp(Map argument) { - if (Env.DEBUG) { - Log.d(TAG, "addMarkerImp enter"); - } - if (null == argument) { - return false; - } - - if (!argument.containsKey("id") - || !argument.containsKey("position") - || !argument.containsKey("icon")) { - return false; - } - - String id = new TypeConverter().getValue(argument, "id"); - if (TextUtils.isEmpty(id)) { - return false; - } - - if (mOverlayMap.containsKey(id)) { - return false; - } - - Map latlngMap = (Map) argument.get("position"); - String title = (String) argument.get("title"); - String subTitle = (String) argument.get("subtitle"); - - LatLng latLng = FlutterDataConveter.mapToLatlng(latlngMap); - if (null == latLng) { - if (Env.DEBUG) { - Log.d(TAG, "latLng is null"); - } - return false; - } - - MarkerOptions markerOptions = new MarkerOptions(); - - markerOptions.position(latLng); - - setScreenLockPoint(argument, markerOptions); - - if (!setMarkerOptions(argument, markerOptions, id)) { - return false; - } - - Overlay overlay = mBaiduMap.addOverlay(markerOptions); - - Bundle bundle = new Bundle(); - bundle.putString("id", id); - - overlay.setExtraInfo(bundle); - - mOverlayMap.put(id, overlay); - - return true; - } - - private boolean setScreenLockPoint(Map argumentMap, - MarkerOptions markerOptions) { - if (null == argumentMap || null == markerOptions) { - return false; - } - - Boolean isLockedToScreen = - new TypeConverter().getValue(argumentMap, "isLockedToScreen"); - if (null == isLockedToScreen || false == isLockedToScreen) { - return false; - } - - Map screenPointToLockMap = - new TypeConverter>().getValue(argumentMap, "screenPointToLock"); - if (null == screenPointToLockMap - || !screenPointToLockMap.containsKey("x") - || !screenPointToLockMap.containsKey("y")) { - return false; - } - - Double x = new TypeConverter().getValue(screenPointToLockMap, "x"); - Double y = new TypeConverter().getValue(screenPointToLockMap, "y"); - if (null == x || null == y) { - return false; - } - - Point point = new Point(x.intValue(), y.intValue()); - - markerOptions.fixedScreenPosition(point); - return true; - } - - /// Add Begin - /* - http://blog.csdn.net/alex_zhuang/article/details/7340901 - 对以下错误: - Java.lang.RuntimeException: java.lang.IllegalArgumentException: File /data/data/com.alex.datasave/files/user.txt contains a path separator - - 原先代码: - fis = this.context.openFileInput("/data/data/com.alex.datasave/files/user.txt"); - - // 正确代码: - File file = new File("/data/data/com.alex.datasave/files/user.txt"); - fis = new FileInputStream(file); // 注意: 1.FileInputStream 与 openFileInput - */ - - public BitmapDescriptor my_fromFile(String var0) { -// System.out.println("my_fromFile var0 = " + var0); - if (var0 != null && !var0.equals("")) { - Context var1 = BMapManager.getContext(); - if (null == var1) { - return null; - } else { - try { -// FileInputStream var2 = var1.openFileInput(var0); -// System.out.print("my_fromFile : var0 = %s, var1 = %s", var0, var1); -// System.out.println("my_fromFile in var0 = " + var0); -// System.out.println("my_fromFile in var1 = " + var1); - // 正确代码: - File file = new File(var0); - FileInputStream var2 = new FileInputStream(file); // 注意: 1.FileInputStream 与 openFileInput - - Bitmap var3 = BitmapFactory.decodeStream(var2); - var2.close(); - if (var3 != null) { - BitmapDescriptor var4 = BitmapDescriptorFactory.fromBitmap(var3); - var3.recycle(); - return var4; - } - } catch (FileNotFoundException var5) { - Log.e("my_fromFile", "FileNotFoundException happened", var5); - } catch (IOException var6) { - Log.e("my_fromFile", "IOException happened", var6); - } - - return null; - } - } else { - return null; - } - } - /// Add End - - /** - * 解析并设置markertions里的信息 - * - * @return - */ - private boolean setMarkerOptions(Map markerOptionsMap, - MarkerOptions markerOptions, String id) { - - //icon是必须的 - String icon = new TypeConverter().getValue(markerOptionsMap, "icon"); - if (TextUtils.isEmpty(icon)) { - return false; - } - - /// Add Begin - BitmapDescriptor bitmapDescriptor; -// System.out.println("my log:" + icon.substring(0, 1)); - if (icon.substring(0, 1).equals("/")) { -// System.out.println("my log in"); - // bitmapDescriptor = BitmapDescriptorFactory.fromAsset("flutter_assets/" + icon); - bitmapDescriptor = my_fromFile(icon); - } else { - bitmapDescriptor = BitmapDescriptorFactory.fromAsset("flutter_assets/" + icon); - } - /// Add End - -// BitmapDescriptor bitmapDescriptor = -// BitmapDescriptorFactory.fromAsset("flutter_assets/" + icon); - if (null == bitmapDescriptor) { - return false; - } - - markerOptions.icon(bitmapDescriptor); - mMarkerBitmapMap.put(id, bitmapDescriptor); - - //centerOffset - Map centerOffset = - new TypeConverter>().getValue(markerOptionsMap, "centerOffset"); - if (null != centerOffset) { - Double y = new TypeConverter().getValue(centerOffset, "y"); - if (null != y) { - markerOptions.yOffset(y.intValue()); - } - } - - Boolean enable = new TypeConverter().getValue(markerOptionsMap, "enabled"); - if (markerOptionsMap.containsKey("enabled")) { - if (Env.DEBUG) { - Log.d(TAG, "enbale" + enable); - } - markerOptions.clickable(enable); - } - - Boolean draggable = new TypeConverter().getValue(markerOptionsMap, "draggable"); - if (null != draggable) { - markerOptions.draggable(draggable); - } - - Integer zIndex = new TypeConverter().getValue(markerOptionsMap, "zIndex"); - if (null != zIndex) { - markerOptions.zIndex(zIndex); - } - - Boolean visible = new TypeConverter().getValue(markerOptionsMap, "visible"); - if (null != visible) { - markerOptions.visible(visible); - } - - Double scaleX = new TypeConverter().getValue(markerOptionsMap, "scaleX"); - if (null != scaleX) { - markerOptions.scaleX(scaleX.floatValue()); - } - - Double scaleY = new TypeConverter().getValue(markerOptionsMap, "scaleY"); - if (null != scaleY) { - markerOptions.scaleX(scaleY.floatValue()); - } - - Double alpha = new TypeConverter().getValue(markerOptionsMap, "alpha"); - if (null != alpha) { - markerOptions.alpha(alpha.floatValue()); - } - - Boolean isPerspective = new TypeConverter().getValue(markerOptionsMap, "isPerspective"); - if (null != isPerspective) { - markerOptions.perspective(isPerspective); - } - - return true; - } - - private boolean addMarkers(MethodCall call) { - - if (Env.DEBUG) { - Log.d(TAG, "addMarkers enter"); - } - if (null == call) { - return false; - } - - List arguments = call.arguments(); - if (null == arguments) { - return false; - } - - Iterator itr = arguments.iterator(); - while (itr.hasNext()) { - Map argument = (Map) itr.next(); - addMarkerImp(argument); - - } - return true; - } - - private boolean removeMarker(MethodCall call) { - Map argument = call.arguments(); - if (null == argument) { - return false; - } - - removeMarkerImp(argument); - return true; - } - - private boolean removeMarkerImp(Map argument) { - String id = new TypeConverter().getValue(argument, "id"); - Overlay overlay = mOverlayMap.get(id); - BitmapDescriptor bitmapDescriptor = mMarkerBitmapMap.get(id); - - boolean ret = true; - if (null != overlay) { - overlay.remove(); - mOverlayMap.remove(id); - } else { - ret = false; - } - - if (null != bitmapDescriptor) { - bitmapDescriptor.recycle(); - mMarkerBitmapMap.remove(id); - } else { - ret = false; - } - - return ret; - } - - private boolean removeMarkers(MethodCall call) { - List markersList = call.arguments(); - if (null == markersList) { - return false; - } - - Iterator itr = markersList.iterator(); - while (itr.hasNext()) { - Map marker = (Map) itr.next(); - if (null != marker) { - removeMarkerImp(marker); - } - - } - - return true; - } - - private boolean selectMarker(MethodCall call) { - return true; - } - - private boolean deSelectMarker(MethodCall call) { - return true; - } - - private boolean cleanAllMarker(MethodCall call) { - mBaiduMap.clear(); - this.clean(); - return true; - } - - /** - * 更新marker属性 - * - * @param call - * @param result - * @return - */ - private boolean updateMarkerMember(MethodCall call, MethodChannel.Result result) { - Map argument = call.arguments(); - if (null == argument) { - return false; - } - - String id = new TypeConverter().getValue(argument, "id"); - if (TextUtils.isEmpty(id)) { - return false; - } - - if (!mMarkerBitmapMap.containsKey(id)) { - return false; - } - - Marker marker = (Marker) mOverlayMap.get(id); - if (null == marker) { - return false; - } - - String member = new TypeConverter().getValue(argument, "member"); - if (TextUtils.isEmpty(member)) { - return false; - } - - Object value = argument.get("value"); - if (null == value) { - return false; - } - - boolean ret = false; - switch (member) { - case "title": - String titile = (String) value; - if (!TextUtils.isEmpty(titile)) { - marker.setTitle(titile); - ret = true; - } - break; - case "position": - Map position = (Map) value; - LatLng latLng = FlutterDataConveter.mapToLatlng(position); - if (null != latLng) { - marker.setPosition(latLng); - ret = true; - } - break; - case "isLockedToScreen": - Boolean isLockedToScreen = (Boolean) value; - if (null != isLockedToScreen && isLockedToScreen) { - - - Map pointMap = - new TypeConverter>().getValue(argument, - "screenPointToLock"); - - Point point = FlutterDataConveter.mapToPoint(pointMap); - if (null != point) { - marker.setFixedScreenPosition(point); - ret = true; - } - } - break; - case "icon": - String icon = (String) value; - BitmapDescriptor bitmapDescriptor = mMarkerBitmapMap.get(id); - - if (null != bitmapDescriptor) { - bitmapDescriptor.recycle(); - } - - bitmapDescriptor = BitmapDescriptorFactory.fromAsset("flutter_assets/" + icon); - - if (null != bitmapDescriptor) { - marker.setIcon(bitmapDescriptor); - mMarkerBitmapMap.put(id, bitmapDescriptor); - ret = true; - } - break; - case "centerOffset": - Map centerOffset = (Map) value; - if (null != centerOffset) { - Double y = new TypeConverter().getValue(centerOffset, "y"); - if (null != y) { - marker.setYOffset(y.intValue()); - ret = true; - } - } - break; - case "enabled": - Boolean enabled = (Boolean) value; - if (null != enabled) { - marker.setClickable(enabled); - ret = true; - } - break; - case "draggable": - Boolean draggable = (Boolean) value; - if (null != draggable) { - marker.setDraggable(draggable); - ret = true; - } - break; - case "visible": - Boolean visible = (Boolean) value; - if (null != visible) { - marker.setVisible(visible); - ret = true; - } - break; - case "zIndex": - Integer zIndex = (Integer) value; - if (null != zIndex) { - marker.setZIndex(zIndex); - ret = true; - } - break; - case "scaleX": - Double scaleX = (Double) value; - if (null != scaleX) { - marker.setScaleX(scaleX.floatValue()); - ret = true; - } - break; - case "scaleY": - Double scaleY = (Double) value; - if (null != scaleY) { - marker.setScaleY(scaleY.floatValue()); - ret = true; - } - break; - case "alpha": - Double alpha = (Double) value; - if (null != alpha) { - marker.setAlpha(alpha.floatValue()); - ret = true; - } - break; - case "isPerspective": - Boolean isPerspective = (Boolean) value; - if (null != isPerspective) { - marker.setPerspective(isPerspective); - ret = true; - } - break; - default: - break; - } - - return ret; - } -} diff --git a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/mapHandler/ProjectionHandler.java b/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/mapHandler/ProjectionHandler.java deleted file mode 100644 index a26de40..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/mapHandler/ProjectionHandler.java +++ /dev/null @@ -1,212 +0,0 @@ -package com.baidu.flutter_bmfmap.map.mapHandler; - -import android.content.Context; -import android.graphics.Point; -import android.text.TextUtils; -import android.util.Log; - -import com.baidu.flutter_bmfmap.map.FlutterCommonMapView; -import com.baidu.flutter_bmfmap.utils.Constants; -import com.baidu.flutter_bmfmap.utils.Env; -import com.baidu.flutter_bmfmap.utils.converter.FlutterDataConveter; -import com.baidu.mapapi.map.Projection; -import com.baidu.mapapi.model.LatLng; - -import java.util.HashMap; -import java.util.Map; - -import io.flutter.plugin.common.MethodCall; -import io.flutter.plugin.common.MethodChannel; - -import static com.baidu.flutter_bmfmap.utils.Constants.ErrorCode; - -class ProjectionHandler extends BMapHandler { - - private static final String TAG = "ProjectionHandler"; - private Projection mProjection = null; - - public ProjectionHandler(FlutterCommonMapView mapView) { - super(mapView); - if(null != mapView && null != mapView.getBaiduMap()){ - mProjection = mapView.getBaiduMap().getProjection(); - } - } - - - @Override - public void handlerMethodCallResult(Context context, MethodCall call, MethodChannel.Result result){ - if(Env.DEBUG){ - Log.d(TAG, "handlerMethodCallResult"); - } - if (null == call) { - result.success(null); - return; - } - - String methodId = call.method; - if (TextUtils.isEmpty(methodId)) { - if(Env.DEBUG){ - Log.d(TAG, "methodId is null"); - } - result.success(null); - return; - } - - switch (methodId) { - case Constants.MethodProtocol.ProjectionMethodId.sFromScreenLocation: - fromScreenLocation(call, result); - break; - case Constants.MethodProtocol.ProjectionMethodId.sToScreenLocation: - toScreenLocation(call, result); - break; - default: - break; - } - } - - /** - * 将屏幕坐标转换成地理坐标 - * - * @param call - * @param result - * @return 地理坐标 - */ - public boolean fromScreenLocation(MethodCall call, MethodChannel.Result result) { - if(Env.DEBUG){ - Log.d(TAG, "fromScreenLocation enter"); - } - Map argument = call.arguments(); - if(null == argument){ - if(Env.DEBUG){ - Log.d(TAG, "argument is null"); - } - - result.error(String.valueOf(ErrorCode.sErrorNullFlutterParam) - , "MethodCall arguments is null" - ,null); - return false; - } - - Map pointMap = (Map )argument.get("point"); - - Point point = FlutterDataConveter.mapToPoint(pointMap); - - if(null == point){ - result.error(String.valueOf(ErrorCode.sErrorParamConvertFailed) - , "conver pointMap failed" - ,null); - if(Env.DEBUG){ - Log.d(TAG, "conver pointMap failed"); - } - return false; - } - - - LatLng latLng = mProjection.fromScreenLocation(point); - - if(null == latLng){ - result.error(String.valueOf(ErrorCode.sErrorEngineError) - , "引擎调用失败" - ,null); - if(Env.DEBUG){ - Log.d(TAG, "fromScreenLocation failed"); - } - return false; - } - - - final Map resultMap = FlutterDataConveter.latLngToMap(latLng); - - if(Env.DEBUG){ - Log.d(TAG, "handlerMethodCallResult success"); - } - - result.success(new HashMap(){ - { - put("coordinate",resultMap); - } - }); - - return true; - } - - /** - * 将地理坐标转换成屏幕坐标 - * - * @return 屏幕坐标 - */ - public boolean toScreenLocation(MethodCall call, MethodChannel.Result result) { - Map argument = call.arguments(); - if(null == argument){ - if(Env.DEBUG){ - Log.d(TAG, "argument is null"); - } - - result.error(String.valueOf(ErrorCode.sErrorNullFlutterParam) - , "MethodCall arguments is null" - ,null); - return false; - } - - Map coordinateMap = (Map )argument.get("coordinate"); - - LatLng latLng = FlutterDataConveter.mapToLatlng(coordinateMap); - if(null == latLng){ - result.error(String.valueOf(ErrorCode.sErrorParamConvertFailed) - , "MethodCall arguments is null" - ,null); - if(Env.DEBUG){ - Log.d(TAG, "null == latLng"); - } - return false; - } - - Point point = mProjection.toScreenLocation(latLng); - if(null == point){ - result.error(String.valueOf(ErrorCode.sErrorEngineError) - , "MethodCall arguments is null" - ,null); - if(Env.DEBUG){ - Log.d(TAG, "null == point"); - } - return false; - } - - final Map pointMap = FlutterDataConveter.pointToMap(point); - - if(Env.DEBUG){ - Log.d(TAG, "toScreenLocation success"); - } - - - result.success(new HashMap(){ - { - put("point",pointMap); - } - }); - - return true; - } - -// /** -// * 该方法把以米为计量单位的距离(沿赤道)在当前缩放水平下转换到一个以像素(水平)为计量单位的距离。 在默认的Mercator投影变换下,对于给定的距离,当远离赤道时,变换后确切的像素数量会增加。 -// * -// * @param meters 以米为单位的距离 -// * @return 相对给定距离的像素数量。在当前的缩放水平,如果沿赤道测量,返回值可能是个近似值 -// */ -// public float metersToEquatorPixels(MethodCall call, MethodChannel.Result result) { -// if (meters <= 0) { -// return 0; -// } -// -// return (float) (meters / (mBaseMap.getZoomUnitsInMeter())); -// } - - public void updateMapView(FlutterCommonMapView mapView){ - mMapView = mapView; - if(null != mapView && null != mapView.getBaiduMap()){ - mProjection = mapView.getBaiduMap().getProjection(); - } - } - -} \ No newline at end of file diff --git a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/mapHandler/TileMapHandler.java b/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/mapHandler/TileMapHandler.java deleted file mode 100644 index 3950d5d..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/mapHandler/TileMapHandler.java +++ /dev/null @@ -1,378 +0,0 @@ -package com.baidu.flutter_bmfmap.map.mapHandler; - -import android.content.Context; -import android.content.res.AssetManager; -import android.graphics.Bitmap; -import android.graphics.BitmapFactory; -import android.text.TextUtils; -import android.util.Log; - -import com.baidu.flutter_bmfmap.map.FlutterCommonMapView; -import com.baidu.flutter_bmfmap.utils.Env; -import com.baidu.flutter_bmfmap.utils.IOStreamUtils; -import com.baidu.flutter_bmfmap.utils.converter.TypeConverter; -import com.baidu.mapapi.map.BaiduMap; -import com.baidu.mapapi.map.FileTileProvider; -import com.baidu.mapapi.map.Projection; -import com.baidu.mapapi.map.Tile; -import com.baidu.mapapi.map.TileOverlay; -import com.baidu.mapapi.map.TileOverlayOptions; -import com.baidu.mapapi.map.TileProvider; -import com.baidu.mapapi.map.UrlTileProvider; - -import java.io.InputStream; -import java.nio.ByteBuffer; -import java.util.HashMap; -import java.util.Map; - -import io.flutter.plugin.common.MethodCall; -import io.flutter.plugin.common.MethodChannel; - -import com.baidu.flutter_bmfmap.utils.Constants.MethodProtocol.TileMapProtocol; -import com.baidu.mapapi.model.LatLng; -import com.baidu.mapapi.model.LatLngBounds; - - -class TileMapHandler extends BMapHandler { - - private Tile mOfflineTile; - // 设置瓦片图的在线缓存大小,默认为20 M - private static final int TILE_TMP = 20 * 1024 * 1024; - private static final int MAX_LEVEL = 21; - private static final int MIN_LEVEL = 4; - - private int mMaxLevel = MAX_LEVEL; - private int mMinLevel = MIN_LEVEL; - private int mTileTmp = TILE_TMP; - private String mUrlString; - - private Projection mProjection; - - private BaiduMap mBaiduMap; - - private HashMap mTileOverlayMap = new HashMap<>(); - - public static class TileType{ - public static final int URL_TILE_PROVIDER = 0; - public static final int FILE_TILE_PROVIDER_ASYNC = 1; - public static final int FILE_TILE_PROVIDER_SYNC = 2; - } - - private static final String TAG = "TileMapHandler"; - - public TileMapHandler(FlutterCommonMapView mapView) { - super(mapView); - if(null != mapView){ - mBaiduMap = mapView.getBaiduMap(); - if(null != mBaiduMap){ - mProjection = mBaiduMap.getProjection(); - } - } - } - - @Override - public void updateMapView(FlutterCommonMapView mapView){ - mMapView = mapView; - if(null != mMapView){ - mBaiduMap = mMapView.getBaiduMap(); - if(null != mBaiduMap){ - mProjection = mBaiduMap.getProjection(); - } - } - } - - @Override - public void handlerMethodCallResult(Context context, MethodCall call, MethodChannel.Result result) { - if(Env.DEBUG){ - Log.d(TAG, "handlerMethodCallResult enter"); - } - String methodID = call.method; - switch (methodID){ - case TileMapProtocol.sAddTileMapMethod: - addTile(context, call, result); - break; - case TileMapProtocol.sRemoveTileMapMethod: - removeTile(context, call, result); - break; - default: - break; - } - } - - private void addTile(Context context, MethodCall call, MethodChannel.Result result){ - if(Env.DEBUG){ - Log.d(TAG, "addTile enter"); - } - if(null == mProjection || null == mBaiduMap){ - if(Env.DEBUG){ - Log.d(TAG, "null == mProjection || null == mBaiduMap"); - } - result.success(false); - return; - } - - Map argument = call.arguments(); - if(null == argument){ - if(Env.DEBUG){ - Log.d(TAG, "argument is null"); - } - result.success(false); - return; - } - - TileOverlayOptions tileOverlayOptions = new TileOverlayOptions(); - - String id = new TypeConverter().getValue(argument, "id"); - if(null == id){ - result.success(false); - return; - } - - Integer maxZoom = new TypeConverter().getValue(argument, "maxZoom"); - if(null != maxZoom){ - mMaxLevel = maxZoom.intValue(); - if(Env.DEBUG) { - Log.d(TAG, "maxZoom:" + maxZoom); - } - } - - - Integer minZoom = new TypeConverter().getValue(argument, "minZoom"); - if(null != maxZoom){ - mMinLevel = minZoom.intValue(); - if(Env.DEBUG) { - Log.d(TAG, "minZoom:" + minZoom); - } - } - - Integer maxTileTmp = new TypeConverter().getValue(argument, "maxTileTmp"); - if(null != maxTileTmp){ - mTileTmp = maxTileTmp.intValue(); - } - - Map visibleMapBounds = new TypeConverter>().getValue(argument, - "visibleMapBounds"); - if(null == visibleMapBounds){ - if(Env.DEBUG){ - Log.d(TAG, "null == visibleMapBounds"); - } - return; - } - - LatLngBounds latLngBounds = visibleMapBoundsImp(visibleMapBounds); - if (null == latLngBounds) { - if(Env.DEBUG){ - Log.d(TAG, "null == latLngBounds"); - } - return; - } - tileOverlayOptions.setPositionFromBounds(latLngBounds); - - TileProvider tileProvider = getTileProvider(context, argument); - if(null == tileProvider){ - if(Env.DEBUG){ - Log.d(TAG, "null == tileProvider"); - } - result.success(false); - return; - } - - tileOverlayOptions.tileProvider(tileProvider); - - if(Env.DEBUG){ - Log.d(TAG, "addTile success"); - } - TileOverlay tileOverlay = mBaiduMap.addTileLayer(tileOverlayOptions); - mTileOverlayMap.put(id, tileOverlay); - result.success(true); - } - - private LatLngBounds visibleMapBoundsImp(Map visibleMapBounds) { - if (!visibleMapBounds.containsKey("northeast") || !visibleMapBounds.containsKey("southwest")) { - return null; - } - HashMap northeast = (HashMap) visibleMapBounds.get("northeast"); - HashMap southwest = (HashMap) visibleMapBounds.get("southwest"); - if (null == northeast || null == southwest) { - return null; - } - if (!northeast.containsKey("latitude") || !northeast.containsKey("longitude") - || !southwest.containsKey("latitude") || !southwest.containsKey("longitude")) { - return null; - } - - Double northeastLatitude = northeast.get("latitude"); - Double northeastLongitude = northeast.get("longitude"); - Double southwestLatitude = southwest.get("latitude"); - Double southwestLongitude = southwest.get("longitude"); - - if (null == northeastLatitude || null == northeastLongitude - || null == southwestLatitude || null == southwestLongitude) { - return null; - } - - LatLng northeastLatLng = new LatLng(northeastLatitude, northeastLongitude); - LatLng southwestLatLng = new LatLng(southwestLatitude, southwestLongitude); - LatLngBounds.Builder builder = new LatLngBounds.Builder(); - builder.include(northeastLatLng); - builder.include(southwestLatLng); - - return builder.build(); - } - - private TileProvider getTileProvider(Context context, Map tileProviderMap){ - Integer tileType = new TypeConverter().getValue(tileProviderMap, "tileLoadType"); - if(null == tileType){ - return null; - } - - TileProvider tileProvider = null; - switch (tileType){ - case TileType.FILE_TILE_PROVIDER_ASYNC: - case TileType.FILE_TILE_PROVIDER_SYNC: - tileProvider = getFileTileProvider(context); - break; - case TileType.URL_TILE_PROVIDER: - tileProvider = getUrlTileProvider(context, tileProviderMap); - break; - default: - break; - } - return tileProvider; - } - - private TileProvider getFileTileProvider(final Context context){ - TileProvider tileProvider = new FileTileProvider() { - @Override - public Tile getTile(int x, int y, int z) { - // 根据地图某一状态下x、y、z加载指定的瓦片图 - String filedir = "flutter_assets/resoures/bmflocaltileimage/" + z + "/" + z + "_" + x + "_" + y + ".jpg"; -// FlutterMain.getLookupKeyForAsset(); - Bitmap bm = getFromAssets(context, filedir); - if (bm == null) { - return null; - } - // 瓦片图尺寸必须满足256 * 256 - mOfflineTile = new Tile(bm.getWidth(), bm.getHeight(), toRawData(bm)); - bm.recycle(); - return mOfflineTile; - } - - @Override - public int getMaxDisLevel() { - return 0; - } - - @Override - public int getMinDisLevel() { - return 0; - } - }; - - return tileProvider; - } - - private TileProvider getUrlTileProvider(Context context, Map tileProviderMap){ - TileProvider tileProvider = null; - if(tileProviderMap.containsKey("url")){ - Object urlObj = tileProviderMap.get("url"); - if(null != urlObj){ - mUrlString = (String)urlObj; - /*定义瓦片图的在线Provider,并实现相关接口 - MAX_LEVEL、MIN_LEVEL 表示地图显示瓦片图的最大、最小级别 - urlString 表示在线瓦片图的URL地址*/ - tileProvider = new UrlTileProvider() { - @Override - public int getMaxDisLevel() { - return mMaxLevel; - } - - @Override - public int getMinDisLevel() { - return mMinLevel; - } - - @Override - public String getTileUrl() { - return mUrlString; - } - }; - } - } - - return tileProvider; - } - - /** - * 瓦片文件解析为Bitmap - * - * @param fileName - * @return 瓦片文件的Bitmap - */ - public Bitmap getFromAssets(Context context, String fileName) { - AssetManager assetManager = context.getAssets(); - InputStream inputStream = null; - Bitmap bitmap; - - try { - if(Env.DEBUG){ - Log.d(TAG, fileName); - } - - inputStream = assetManager.open(fileName); - - bitmap = BitmapFactory.decodeStream(inputStream); - return bitmap; - } catch (Exception e) { - e.printStackTrace(); - return null; - } finally { - IOStreamUtils.closeSilently(inputStream); - } - } - - /** - * 解析Bitmap - * - * @param bitmap - * @return - */ - byte[] toRawData(Bitmap bitmap) { - ByteBuffer buffer = ByteBuffer.allocate(bitmap.getWidth() * bitmap.getHeight() * 4); - bitmap.copyPixelsToBuffer(buffer); - byte[] data = buffer.array(); - buffer.clear(); - return data; - } - - private void removeTile(Context context, MethodCall call, MethodChannel.Result result){ - if(Env.DEBUG){ - Log.d(TAG, "removeTile enter"); - } - Map argument = call.arguments(); - if(null == argument){ - if(Env.DEBUG){ - Log.d(TAG, "argument is null"); - } - result.success(false); - return; - } - - String id = new TypeConverter().getValue(argument, "id"); - if(TextUtils.isEmpty(id)){ - result.success(false); - return; - } - - TileOverlay tileOverlay = mTileOverlayMap.get(id); - if(null != tileOverlay){ - if(Env.DEBUG){ - Log.d(TAG, "remove tile success"); - } - tileOverlay.removeTileOverlay(); - result.success(true); - }else { - result.success(false); - } - } -} \ No newline at end of file diff --git a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/overlayHandler/ArcLineHandler.java b/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/overlayHandler/ArcLineHandler.java deleted file mode 100644 index 34c9381..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/overlayHandler/ArcLineHandler.java +++ /dev/null @@ -1,102 +0,0 @@ -package com.baidu.flutter_bmfmap.map.overlayHandler; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import com.baidu.flutter_bmfmap.utils.Env; -import com.baidu.flutter_bmfmap.utils.converter.FlutterDataConveter; -import com.baidu.mapapi.map.ArcOptions; -import com.baidu.mapapi.map.BaiduMap; -import com.baidu.mapapi.map.Overlay; -import com.baidu.mapapi.model.LatLng; - -import android.text.TextUtils; -import android.util.Log; -import io.flutter.plugin.common.MethodCall; -import io.flutter.plugin.common.MethodChannel; - -public class ArcLineHandler extends OverlayHandler { - private static final String TAG = "ArcLineHandler"; - - public ArcLineHandler(BaiduMap baiduMap) { - super(baiduMap); - } - - @Override - public Map handlerMethodCall(MethodCall call, MethodChannel.Result result) { - Map argument = call.arguments(); - if (null == argument) { - return null; - } - - if (!argument.containsKey("id") - || !argument.containsKey("coordinates")) { - if (Env.DEBUG) { - Log.d(TAG, "argument does not contain"); - } - return null; - } - - ArcOptions arcOptions = new ArcOptions(); - - final String id = (String) argument.get("id"); - if (TextUtils.isEmpty(id)) { - return null; - } - List> coordinates = - (List>) argument.get("coordinates"); - - if (coordinates.size() < 3) { - if (Env.DEBUG) { - Log.d(TAG, "atlngs.size() < 3"); - } - return null; - } - - LatLng latLngStart = FlutterDataConveter.mapToLatlng(coordinates.get(0)); - LatLng latLngMiddle = FlutterDataConveter.mapToLatlng(coordinates.get(1)); - LatLng latLngEnd = FlutterDataConveter.mapToLatlng(coordinates.get(2)); - - if (null == latLngStart - || null == latLngMiddle - || null == latLngEnd) { - if (Env.DEBUG) { - Log.d(TAG, "null == latLngStart\n" + - " || null == latLngMiddle\n" + - " || null == latLngEnd"); - } - return null; - } - - arcOptions.points(latLngStart, latLngMiddle, latLngEnd); - - if (argument.containsKey("width")) { - int width = (Integer) argument.get("width"); - arcOptions.width(width); - } - - if (argument.containsKey("color")) { - String strokeColorStr = (String) argument.get("color"); - int strokeColor = FlutterDataConveter.strColorToInteger(strokeColorStr); - arcOptions.color(strokeColor); - } - - if (argument.containsKey("zIndex")) { - int zIndex = (Integer) argument.get("zIndex"); - arcOptions.zIndex(zIndex); - } - - if (argument.containsKey("visible")) { - boolean visible = (Boolean) argument.get("visible"); - arcOptions.visible(visible); - } - - final Overlay overlay = mBaiduMap.addOverlay(arcOptions); - return new HashMap() { - { - put(id, overlay); - } - }; - } -} diff --git a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/overlayHandler/CircleHandler.java b/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/overlayHandler/CircleHandler.java deleted file mode 100644 index 4d48df7..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/overlayHandler/CircleHandler.java +++ /dev/null @@ -1,130 +0,0 @@ -package com.baidu.flutter_bmfmap.map.overlayHandler; - -import java.util.HashMap; -import java.util.Map; - -import com.baidu.flutter_bmfmap.utils.Env; -import com.baidu.flutter_bmfmap.utils.converter.FlutterDataConveter; -import com.baidu.flutter_bmfmap.utils.converter.TypeConverter; -import com.baidu.mapapi.map.BaiduMap; -import com.baidu.mapapi.map.CircleDottedStrokeType; -import com.baidu.mapapi.map.CircleOptions; -import com.baidu.mapapi.map.Overlay; -import com.baidu.mapapi.map.Stroke; -import com.baidu.mapapi.model.LatLng; - -import android.text.TextUtils; -import android.util.Log; -import io.flutter.plugin.common.MethodCall; -import io.flutter.plugin.common.MethodChannel; - -public class CircleHandler extends OverlayHandler { - - private static final String TAG = "CircleHandler"; - - public CircleHandler(BaiduMap baiduMap) { - super(baiduMap); - } - - @Override - public Map handlerMethodCall(MethodCall call, MethodChannel.Result result) { - Map argument = call.arguments(); - if (null == argument) { - if (Env.DEBUG) { - Log.d(TAG, "argument is null"); - } - return null; - } - - if (!argument.containsKey("id") - || !argument.containsKey("center") - || !argument.containsKey("radius")) { - if (Env.DEBUG) { - Log.d(TAG, "argument does not contain"); - } - return null; - } - - CircleOptions circleOptions = new CircleOptions(); - - final String id = new TypeConverter().getValue(argument, "id"); - if (TextUtils.isEmpty(id)) { - return null; - } - - Map centerMap = (Map) argument.get("center"); - LatLng center = FlutterDataConveter.mapToLatlng(centerMap); - if (null != center) { - circleOptions.center(center); - } - - double radius = (Double) argument.get("radius"); - circleOptions.radius((int) radius); - - - if (argument.containsKey("width") && argument.containsKey("strokeColor")) { - int width = (Integer) argument.get("width"); - String strokeColorStr = (String) argument.get("strokeColor"); - if (!TextUtils.isEmpty(strokeColorStr)) { - int strokeColor = FlutterDataConveter.strColorToInteger(strokeColorStr); - Stroke stroke = new Stroke(width, strokeColor); - circleOptions.stroke(stroke); - } - - } - - if (argument.containsKey("fillColor")) { - String fillColorStr = (String) argument.get("fillColor"); - int fillColor = FlutterDataConveter.strColorToInteger(fillColorStr); - circleOptions.fillColor(fillColor); - } - - if (argument.containsKey("zIndex")) { - int zIndex = (Integer) argument.get("zIndex"); - circleOptions.zIndex(zIndex); - } - - if (argument.containsKey("visible")) { - boolean visible = (Boolean) argument.get("visible"); - circleOptions.visible(visible); - } - - setLineDashType(argument, circleOptions); - - final Overlay overlay = mBaiduMap.addOverlay(circleOptions); - return new HashMap() { - { - put(id, overlay); - } - }; - } - - private void setLineDashType(Map circleOptionsMap, - CircleOptions circleOptions) { - if (null == circleOptionsMap || null == circleOptions) { - return; - } - - Integer lineDashType = - new TypeConverter().getValue(circleOptionsMap, "lineDashType"); - if (null == lineDashType) { - return; - } - - switch (lineDashType) { - case OverlayCommon.LineDashType.sLineDashTypeNone: - circleOptions.dottedStroke(false); - break; - case OverlayCommon.LineDashType.sLineDashTypeSquare: - circleOptions.dottedStroke(true); - circleOptions.dottedStrokeType(CircleDottedStrokeType.DOTTED_LINE_SQUARE); - break; - case OverlayCommon.LineDashType.sLineDashTypeDot: - circleOptions.dottedStroke(true); - circleOptions.dottedStrokeType(CircleDottedStrokeType.DOTTED_LINE_CIRCLE); - break; - default: - break; - } - } -} diff --git a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/overlayHandler/DotHandler.java b/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/overlayHandler/DotHandler.java deleted file mode 100644 index 7548806..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/overlayHandler/DotHandler.java +++ /dev/null @@ -1,99 +0,0 @@ -package com.baidu.flutter_bmfmap.map.overlayHandler; - -import java.util.HashMap; -import java.util.Map; - -import com.baidu.flutter_bmfmap.utils.Env; -import com.baidu.flutter_bmfmap.utils.converter.FlutterDataConveter; -import com.baidu.flutter_bmfmap.utils.converter.TypeConverter; -import com.baidu.mapapi.map.BaiduMap; -import com.baidu.mapapi.map.DotOptions; -import com.baidu.mapapi.map.Overlay; -import com.baidu.mapapi.model.LatLng; - -import android.text.TextUtils; -import android.util.Log; -import io.flutter.plugin.common.MethodCall; -import io.flutter.plugin.common.MethodChannel; - -public class DotHandler extends OverlayHandler { - - public static final String TAG = "DotHandler"; - - public DotHandler(BaiduMap baiduMap) { - super(baiduMap); - } - - @Override - public Map handlerMethodCall(MethodCall call, MethodChannel.Result result) { - Map argument = call.arguments(); - if (null == argument) { - if (Env.DEBUG) { - Log.d(TAG, "argument is null"); - } - return null; - } - - if (!argument.containsKey("id")) { - if (Env.DEBUG) { - Log.d(TAG, "argument does not contain" + argument.toString()); - - } - return null; - } - - final String id = new TypeConverter().getValue(argument, "id"); - if (TextUtils.isEmpty(id)) { - return null; - } - - DotOptions dotOptions = new DotOptions(); - - Map centerMap = - new TypeConverter>().getValue(argument, "center"); - LatLng center = FlutterDataConveter.mapToLatlng(centerMap); - if (null == center) { - if (Env.DEBUG) { - Log.d(TAG, "center is null"); - } - return null; - } - dotOptions.center(center); - - Double radius = new TypeConverter().getValue(argument, "radius"); - if (null == radius) { - if (Env.DEBUG) { - Log.d(TAG, "radius is null"); - } - return null; - } - dotOptions.radius(radius.intValue()); - - String colorStr = new TypeConverter().getValue(argument, "color"); - if (TextUtils.isEmpty(colorStr)) { - if (Env.DEBUG) { - Log.d(TAG, "colorStr is null"); - } - return null; - } - int color = FlutterDataConveter.strColorToInteger(colorStr); - dotOptions.color(color); - - Integer zIndex = new TypeConverter().getValue(argument, "zIndex"); - if (null != zIndex) { - dotOptions.zIndex(zIndex); - } - - Boolean visible = new TypeConverter().getValue(argument, "visible"); - if (null != visible) { - dotOptions.visible(visible); - } - - final Overlay overlay = mBaiduMap.addOverlay(dotOptions); - return new HashMap() { - { - put(id, overlay); - } - }; - } -} diff --git a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/overlayHandler/GroundHandler.java b/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/overlayHandler/GroundHandler.java deleted file mode 100644 index a507bd9..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/overlayHandler/GroundHandler.java +++ /dev/null @@ -1,177 +0,0 @@ -package com.baidu.flutter_bmfmap.map.overlayHandler; - -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; - -import com.baidu.flutter_bmfmap.utils.Env; -import com.baidu.flutter_bmfmap.utils.converter.FlutterDataConveter; -import com.baidu.flutter_bmfmap.utils.converter.TypeConverter; -import com.baidu.mapapi.map.BaiduMap; -import com.baidu.mapapi.map.BitmapDescriptor; -import com.baidu.mapapi.map.BitmapDescriptorFactory; -import com.baidu.mapapi.map.GroundOverlay; -import com.baidu.mapapi.map.GroundOverlayOptions; -import com.baidu.mapapi.map.Overlay; -import com.baidu.mapapi.model.LatLng; -import com.baidu.mapapi.model.LatLngBounds; - -import android.text.TextUtils; -import android.util.Log; -import io.flutter.plugin.common.MethodCall; -import io.flutter.plugin.common.MethodChannel; - -class GroundHandler extends OverlayHandler { - - private static final String TAG = "GroundHandler"; - - private HashMap mBitmapMap = new HashMap<>(); - - public GroundHandler(BaiduMap baiduMap) { - super(baiduMap); - } - - @Override - public Map handlerMethodCall(MethodCall call, MethodChannel.Result result) { - if (Env.DEBUG) { - Log.d(TAG, "handlerMethodCall enter"); - } - Map argument = call.arguments(); - if (null == argument) { - if (Env.DEBUG) { - Log.d(TAG, "argument is null"); - } - return null; - } - - if (!argument.containsKey("id")) { - if (Env.DEBUG) { - Log.d(TAG, "argument does not contain" + argument.toString()); - - } - return null; - } - - final String id = new TypeConverter().getValue(argument, "id"); - if (TextUtils.isEmpty(id)) { - return null; - } - - GroundOverlayOptions groundOverlayOptions = new GroundOverlayOptions(); - - setGroundOptions(id, argument, groundOverlayOptions); - - final Overlay overlay = mBaiduMap.addOverlay(groundOverlayOptions); - - return new HashMap() { - { - put(id, overlay); - } - }; - } - - /** - * - */ - private void setGroundOptions(String id, Map groundOptionsMap, - GroundOverlayOptions groundOverlayOptions) { - if (null == groundOptionsMap) { - return; - } - - String image = new TypeConverter().getValue(groundOptionsMap, "image"); - if (!TextUtils.isEmpty(image)) { - BitmapDescriptor bitmap = BitmapDescriptorFactory.fromAsset("flutter_assets/" + image); - if (null != bitmap) { - if (Env.DEBUG) { - Log.d(TAG, "image"); - - } - groundOverlayOptions.image(bitmap); - mBitmapMap.put(id, bitmap); - } - - } - - Double anchorX = new TypeConverter().getValue(groundOptionsMap, "anchorX"); - Double anchorY = new TypeConverter().getValue(groundOptionsMap, "anchorY"); - if (null != anchorX && null != anchorY) { - groundOverlayOptions.anchor(anchorX.floatValue(), anchorY.floatValue()); - } - - Map centerMap = - new TypeConverter>().getValue(groundOptionsMap, "position"); - if (null != centerMap) { - LatLng center = FlutterDataConveter.mapToLatlng(centerMap); - if (null != center) { - if (Env.DEBUG) { - Log.d(TAG, "position"); - - } - groundOverlayOptions.position(center); - } - } - - Double width = new TypeConverter().getValue(groundOptionsMap, "width"); - Double height = new TypeConverter().getValue(groundOptionsMap, "height"); - if(null != width && null != height){ - groundOverlayOptions.dimensions(width.intValue(), height.intValue()); - } - - Map boundsMap = - new TypeConverter>().getValue(groundOptionsMap, "bounds"); - LatLngBounds latLngBounds = FlutterDataConveter.mapToLatlngBounds(boundsMap); - if (null != latLngBounds) { - if (Env.DEBUG) { - Log.d(TAG, "bounds"); - - } - groundOverlayOptions.positionFromBounds(latLngBounds); - } - - Double transparency = - new TypeConverter().getValue(groundOptionsMap, "transparency"); - if (null != transparency) { - groundOverlayOptions.transparency(transparency.floatValue()); - } - - Integer zIndex = new TypeConverter().getValue(groundOptionsMap, "zIndex"); - if (null != zIndex) { - groundOverlayOptions.zIndex(zIndex); - } - - Boolean visible = new TypeConverter().getValue(groundOptionsMap, "visible"); - if (null != visible) { - groundOverlayOptions.visible(visible); - } - - } - - - public void clean(){ - super.clean(); - Iterator iterator = mBitmapMap.values().iterator(); - BitmapDescriptor bitmapDescriptor; - while (iterator.hasNext()){ - bitmapDescriptor = (BitmapDescriptor)iterator.next(); - if(null != bitmapDescriptor){ - bitmapDescriptor.recycle(); - } - } - - mBitmapMap.clear(); - } - - public void clean(String id) { - if (TextUtils.isEmpty(id)) { - return; - } - - BitmapDescriptor bitmapDescriptor = mBitmapMap.get(id); - if (null != bitmapDescriptor) { - bitmapDescriptor.recycle(); - } - - mBitmapMap.remove(id); - } -} \ No newline at end of file diff --git a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/overlayHandler/OverlayCommon.java b/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/overlayHandler/OverlayCommon.java deleted file mode 100644 index 5ea136f..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/overlayHandler/OverlayCommon.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.baidu.flutter_bmfmap.map.overlayHandler; - -public class OverlayCommon{ - - public static class LineDashType{ - /** - * 实折线 - */ - public static final int sLineDashTypeNone = 0; - - /** - * 方块样式 - */ - public static final int sLineDashTypeSquare = 1; - - /** - * 圆点样式 - */ - public static final int sLineDashTypeDot = 2; - } -} \ No newline at end of file diff --git a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/overlayHandler/OverlayHandler.java b/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/overlayHandler/OverlayHandler.java deleted file mode 100644 index d8bebab..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/overlayHandler/OverlayHandler.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.baidu.flutter_bmfmap.map.overlayHandler; - -import java.util.Map; - -import com.baidu.mapapi.map.BaiduMap; -import com.baidu.mapapi.map.Overlay; - -import io.flutter.plugin.common.MethodCall; -import io.flutter.plugin.common.MethodChannel; - -public abstract class OverlayHandler { - protected BaiduMap mBaiduMap; - - protected Overlay mCurrentOverlay; - - public OverlayHandler(BaiduMap baiduMap) { - this.mBaiduMap = baiduMap; - } - - public abstract Map handlerMethodCall(MethodCall call, - MethodChannel.Result result); - - public void updateBaiduMap(BaiduMap baiduMap) { - mBaiduMap = baiduMap; - } - - public void setCurrentOverlay(Overlay overlay){ - mCurrentOverlay = overlay; - } - - /** - * 清理所有 - */ - public void clean(){} - - /** - * 清理指定id的overlay - * @param id - */ - public void clean(String id) { - - } -} diff --git a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/overlayHandler/OverlayHandlerFactory.java b/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/overlayHandler/OverlayHandlerFactory.java deleted file mode 100644 index e6a3d13..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/overlayHandler/OverlayHandlerFactory.java +++ /dev/null @@ -1,235 +0,0 @@ -package com.baidu.flutter_bmfmap.map.overlayHandler; - -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; - -import com.baidu.flutter_bmfmap.utils.Constants.MethodProtocol.ArclineProtocol; -import com.baidu.flutter_bmfmap.utils.Constants.MethodProtocol.CirclelineProtocol; -import com.baidu.flutter_bmfmap.utils.Constants.MethodProtocol.DotProtocol; -import com.baidu.flutter_bmfmap.utils.Constants.MethodProtocol.GroundProtocol; -import com.baidu.flutter_bmfmap.utils.Constants.MethodProtocol.OverlayProtocol; -import com.baidu.flutter_bmfmap.utils.Constants.MethodProtocol.PolygonProtocol; -import com.baidu.flutter_bmfmap.utils.Constants.MethodProtocol.PolylineProtocol; -import com.baidu.flutter_bmfmap.utils.Constants.MethodProtocol.TextProtocol; -import com.baidu.flutter_bmfmap.utils.Constants.OverlayHandlerType; -import com.baidu.flutter_bmfmap.utils.Env; -import com.baidu.mapapi.map.Arc; -import com.baidu.mapapi.map.BaiduMap; -import com.baidu.mapapi.map.Circle; -import com.baidu.mapapi.map.Dot; -import com.baidu.mapapi.map.GroundOverlay; -import com.baidu.mapapi.map.Overlay; -import com.baidu.mapapi.map.Polygon; -import com.baidu.mapapi.map.Polyline; -import com.baidu.mapapi.map.Text; - -import android.util.Log; -import io.flutter.plugin.common.MethodCall; -import io.flutter.plugin.common.MethodChannel; - -public class OverlayHandlerFactory { - private static final String TAG = "OverlayHandlerFactory"; - - private static volatile OverlayHandlerFactory sInstance; - - private HashMap overlayHandlerHashMap; - - private OverlayManagerHandler mOverlayManagerHandler; - - private OverlayHandlerFactory(BaiduMap baiduMap) { - init(baiduMap); - } - - public static OverlayHandlerFactory getInstance(BaiduMap baiduMap) { - - if (null == sInstance) { - synchronized(OverlayHandlerFactory.class) { - if (null == sInstance) { - sInstance = new OverlayHandlerFactory(baiduMap); - } else { - sInstance.updateBaiduMap(baiduMap); - } - } - } else { - sInstance.updateBaiduMap(baiduMap); - } - - return sInstance; - } - - private void updateBaiduMap(BaiduMap baiduMap) { - if (null == baiduMap) { - return; - } - - if(null == overlayHandlerHashMap || overlayHandlerHashMap.isEmpty()){ - init(baiduMap); - } - - Iterator it = overlayHandlerHashMap.entrySet().iterator(); - while (it.hasNext()) { - Map.Entry entry = - (Map.Entry) it.next(); - OverlayHandler overlayHandler = entry.getValue(); - if (null != overlayHandler) { - overlayHandler.updateBaiduMap(baiduMap); - } - } - } - - private void init(BaiduMap baiduMap) { - if (null == baiduMap) { - return; - } - - mOverlayManagerHandler = new OverlayManagerHandler(baiduMap); - overlayHandlerHashMap = new HashMap<>(); - overlayHandlerHashMap.put(OverlayHandlerType.CIRCLE_HANDLER, new CircleHandler(baiduMap)); - overlayHandlerHashMap.put(OverlayHandlerType.DOT_HANDLER, new DotHandler(baiduMap)); - overlayHandlerHashMap.put(OverlayHandlerType.POLYGON_HANDLER, new PolygonHandler(baiduMap)); - overlayHandlerHashMap - .put(OverlayHandlerType.POLYLINE_HANDLER, new PolylineHandler(baiduMap)); - overlayHandlerHashMap.put(OverlayHandlerType.TEXT_HANDLER, new TextHandler(baiduMap)); - overlayHandlerHashMap.put(OverlayHandlerType.ARCLINE_HANDLER, new ArcLineHandler(baiduMap)); - overlayHandlerHashMap.put(OverlayHandlerType.CIRCLE_HANDLER, new CircleHandler(baiduMap)); - overlayHandlerHashMap.put(OverlayHandlerType.GROUND_HANDLER, new GroundHandler(baiduMap)); - } - - public boolean dispatchMethodHandler(MethodCall call, MethodChannel.Result result) { - if (null == call) { - if (Env.DEBUG) { - Log.d(TAG, "dispatchMethodHandler: null == call"); - } - return false; - } - - String methodId = call.method; - Log.d(TAG, "dispatchMethodHandler: " + methodId); - OverlayHandler overlayHandler = null; - Overlay overlay; - int handlerType = -1; - switch (methodId) { - case ArclineProtocol.sMapAddArclinelineMethod: - overlayHandler = overlayHandlerHashMap.get(OverlayHandlerType.ARCLINE_HANDLER); - break; - case PolygonProtocol.sMapAddPolygonMethod: - overlayHandler = overlayHandlerHashMap.get(OverlayHandlerType.POLYGON_HANDLER); - break; - case CirclelineProtocol.sMapAddCirclelineMethod: - overlayHandler = overlayHandlerHashMap.get(OverlayHandlerType.CIRCLE_HANDLER); - break; - case PolylineProtocol.sMapAddPolylineMethod: - overlayHandler = overlayHandlerHashMap.get(OverlayHandlerType.POLYLINE_HANDLER); - break; - case DotProtocol.sMapAddDotMethod: - overlayHandler = overlayHandlerHashMap.get(OverlayHandlerType.DOT_HANDLER); - break; - case TextProtocol.sMapAddTextMethod: - overlayHandler = overlayHandlerHashMap.get(OverlayHandlerType.TEXT_HANDLER); - break; - case GroundProtocol.sMapAddGroundMethod: - overlayHandler = overlayHandlerHashMap.get(OverlayHandlerType.GROUND_HANDLER); - break; - case OverlayProtocol.sMapRemoveOverlayMethod: - OverlayHandler specOverlayHandler = getCurrentOverlayHandler(call); - mOverlayManagerHandler.setCurrentOverlayHandler(specOverlayHandler); - overlayHandler = mOverlayManagerHandler; - break; - case PolylineProtocol.sMapUpdatePolylineMemberMethod: - overlayHandler = getCurrentOverlayHandler(call); - break; - default: - break; - } - - if (null == overlayHandler) { - return false; - } - - Map overlayMap = overlayHandler.handlerMethodCall(call, result); - - if (null == overlayMap) { - return false; - } - - mOverlayManagerHandler.addOverlay(overlayMap); - return true; - } - - private Overlay getCurrentOverlay(MethodCall call) { - Map argument = call.arguments(); - if (null == argument) { - if (Env.DEBUG) { - Log.d(TAG, "argument is null"); - } - - return null; - } - - if (!argument.containsKey("id")) { - return null; - } - - String id = (String) argument.get("id"); - - return mOverlayManagerHandler.getOverlay(id); - } - - private int getHandlerType(Overlay overlay) { - int handlerType = -1; - if (overlay instanceof Polyline) { - handlerType = OverlayHandlerType.POLYLINE_HANDLER; - } else if (overlay instanceof Polygon) { - handlerType = OverlayHandlerType.POLYGON_HANDLER; - } else if (overlay instanceof Arc) { - handlerType = OverlayHandlerType.ARCLINE_HANDLER; - } else if (overlay instanceof Circle) { - handlerType = OverlayHandlerType.CIRCLE_HANDLER; - } else if (overlay instanceof Dot) { - handlerType = OverlayHandlerType.DOT_HANDLER; - } else if (overlay instanceof GroundOverlay) { - handlerType = OverlayHandlerType.GROUND_HANDLER; - } else if (overlay instanceof Text) { - handlerType = OverlayHandlerType.TEXT_HANDLER; - } - - return handlerType; - } - - public void clean(){ - if(null == overlayHandlerHashMap || overlayHandlerHashMap.size() == 0) { - return; - } - - OverlayHandler overlayHandler= null; - Iterator iterator = overlayHandlerHashMap.values().iterator(); - while (iterator.hasNext()){ - overlayHandler = (OverlayHandler) iterator.next(); - if(null == overlayHandler){ - continue; - } - - overlayHandler.clean(); - } - } - - private OverlayHandler getCurrentOverlayHandler(MethodCall call) { - if (null == call) { - return null; - } - - Overlay overlay = getCurrentOverlay(call); - if (null == overlay) { - return null; - } - int handlerType = getHandlerType(overlay); - OverlayHandler overlayHandler = overlayHandlerHashMap.get(handlerType); - if( null != overlayHandler) { - overlayHandler.setCurrentOverlay(overlay); - } - - return overlayHandler; - } - -} \ No newline at end of file diff --git a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/overlayHandler/OverlayManagerHandler.java b/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/overlayHandler/OverlayManagerHandler.java deleted file mode 100644 index 2261dbf..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/overlayHandler/OverlayManagerHandler.java +++ /dev/null @@ -1,103 +0,0 @@ -package com.baidu.flutter_bmfmap.map.overlayHandler; - -import java.util.HashMap; -import java.util.Map; - -import com.baidu.flutter_bmfmap.utils.Constants.MethodProtocol.OverlayProtocol; -import com.baidu.flutter_bmfmap.utils.Env; -import com.baidu.flutter_bmfmap.utils.converter.TypeConverter; -import com.baidu.mapapi.map.BaiduMap; -import com.baidu.mapapi.map.Overlay; - -import android.text.TextUtils; -import android.util.Log; -import io.flutter.plugin.common.MethodCall; -import io.flutter.plugin.common.MethodChannel; - -public class OverlayManagerHandler extends OverlayHandler { - private static final String TAG = "OverlayManagerHandler"; - - private HashMap mOverlayMap = new HashMap<>(); - - private OverlayHandler mCurrentOverlayHandler; - - public OverlayManagerHandler(BaiduMap baiduMap) { - super(baiduMap); - } - - @Override - public Map handlerMethodCall(MethodCall call, MethodChannel.Result result) { - if (Env.DEBUG) { - Log.d(TAG, "handlerMethodCall enter"); - //result.success(false); - } - - Map argument = call.arguments(); - if (null == argument) { - if (Env.DEBUG) { - Log.d(TAG, "argument is null"); - } - result.success(false); - return null; - } - - boolean ret = false; - String methodId = call.method; - switch (methodId) { - case OverlayProtocol.sMapRemoveOverlayMethod: - ret = removeOverlay(argument); - break; - default: - break; - } - - result.success(ret); - - return null; - } - - public void addOverlay(Map overlayMap) { - mOverlayMap.putAll(overlayMap); - } - - public Overlay getOverlay(String id) { - return mOverlayMap.get(id); - } - - public void setCurrentOverlayHandler(OverlayHandler overlayHandler) { - mCurrentOverlayHandler = overlayHandler; - } - - /** - * 移除overlay - * - * @param argument - * @return - */ - private boolean removeOverlay(Map argument) { - String id = new TypeConverter().getValue(argument, "id"); - if (TextUtils.isEmpty(id)) { - return false; - } - - Overlay overlay = mOverlayMap.get(id); - if (null == overlay) { - if (Env.DEBUG) { - Log.d(TAG, "not found overlay with id:" + id); - } - return false; - } - - overlay.remove(); - mOverlayMap.remove(id); - if(null != mCurrentOverlayHandler) { - mCurrentOverlayHandler.clean(id); - mCurrentOverlayHandler = null; - } - - if (Env.DEBUG) { - Log.d(TAG, "remove Overlay success"); - } - return true; - } -} \ No newline at end of file diff --git a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/overlayHandler/PolygonHandler.java b/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/overlayHandler/PolygonHandler.java deleted file mode 100644 index ade9abb..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/overlayHandler/PolygonHandler.java +++ /dev/null @@ -1,117 +0,0 @@ -package com.baidu.flutter_bmfmap.map.overlayHandler; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import com.baidu.flutter_bmfmap.utils.Env; -import com.baidu.flutter_bmfmap.utils.converter.FlutterDataConveter; -import com.baidu.mapapi.map.BaiduMap; -import com.baidu.mapapi.map.Overlay; -import com.baidu.mapapi.map.PolygonOptions; -import com.baidu.mapapi.map.Stroke; -import com.baidu.mapapi.model.LatLng; - -import android.text.TextUtils; -import android.util.Log; -import io.flutter.plugin.common.MethodCall; -import io.flutter.plugin.common.MethodChannel; - -public class PolygonHandler extends OverlayHandler { - private static final String TAG = "PolygonHandler"; - - public PolygonHandler(BaiduMap baiduMap) { - super(baiduMap); - } - - @Override - public Map handlerMethodCall(MethodCall call, MethodChannel.Result result) { - if (Env.DEBUG) { - Log.d(TAG, "handlerMethodCall enter0"); - } - Map argument = call.arguments(); - if (null == argument) { - if (Env.DEBUG) { - Log.d(TAG, "argument is null"); - } - return null; - } - - if (!argument.containsKey("id") - || !argument.containsKey("coordinates")) { - if (Env.DEBUG) { - Log.d(TAG, "argument does not contain"); - } - return null; - } - - final String id = (String) argument.get("id"); - if (TextUtils.isEmpty(id)) { - return null; - } - List> coordinates = - (List>) argument.get("coordinates"); - - if (coordinates.size() < 1) { - if (Env.DEBUG) { - Log.d(TAG, "coordinates.size() < 1"); - } - return null; - } - - PolygonOptions polygonOptions = new PolygonOptions(); - - List coordinatesList = FlutterDataConveter.mapToLatlngs(coordinates); - if (null == coordinatesList) { - if (Env.DEBUG) { - Log.d(TAG, "coordinatesList is null"); - } - return null; - } - - polygonOptions.points(coordinatesList); - - if (argument.containsKey("width") && argument - .containsKey("strokeColor")) { - int width = (Integer) argument.get("width"); - String strokeColorStr = (String) argument.get("strokeColor"); - if (Env.DEBUG) { - Log.d(TAG, "strokeColorStr:" + strokeColorStr); - } - if (!TextUtils.isEmpty(strokeColorStr)) { - int strokeColor = FlutterDataConveter.strColorToInteger(strokeColorStr); - Stroke stroke = new Stroke(width, strokeColor); - polygonOptions.stroke(stroke); - } - } - - if (argument.containsKey("fillColor")) { - String fillColorStr = (String) argument.get("fillColor"); - if (Env.DEBUG) { - Log.d(TAG, "fillColorStr:" + fillColorStr); - } - if (!TextUtils.isEmpty(fillColorStr)) { - int fillColor = FlutterDataConveter.strColorToInteger(fillColorStr); - polygonOptions.fillColor(fillColor); - } - } - - if (argument.containsKey("zIndex")) { - int zIndex = (Integer) argument.get("zIndex"); - polygonOptions.zIndex(zIndex); - } - - if (argument.containsKey("visible")) { - boolean visible = (Boolean) argument.get("visible"); - polygonOptions.visible(visible); - } - - final Overlay overlay = mBaiduMap.addOverlay(polygonOptions); - - return new HashMap() { - { - put(id, overlay); - } - }; - } -} diff --git a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/overlayHandler/PolylineHandler.java b/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/overlayHandler/PolylineHandler.java deleted file mode 100644 index fa1c26d..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/overlayHandler/PolylineHandler.java +++ /dev/null @@ -1,620 +0,0 @@ -package com.baidu.flutter_bmfmap.map.overlayHandler; - -import java.text.BreakIterator; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import com.baidu.flutter_bmfmap.utils.Constants; -import com.baidu.flutter_bmfmap.utils.Env; -import com.baidu.flutter_bmfmap.utils.converter.FlutterDataConveter; -import com.baidu.flutter_bmfmap.utils.converter.TypeConverter; -import com.baidu.mapapi.map.BaiduMap; -import com.baidu.mapapi.map.BaiduMap.OnPolylineClickListener; -import com.baidu.mapapi.map.BitmapDescriptor; -import com.baidu.mapapi.map.Overlay; -import com.baidu.mapapi.map.Polyline; -import com.baidu.mapapi.map.PolylineDottedLineType; -import com.baidu.mapapi.map.PolylineOptions; -import com.baidu.mapapi.model.LatLng; - -import android.os.Bundle; -import android.text.TextUtils; -import android.util.Log; -import io.flutter.plugin.common.MethodCall; -import io.flutter.plugin.common.MethodChannel; - -public class PolylineHandler extends OverlayHandler { - private static final String TAG = "PolylineHandler"; - - private HashMap> mBitmapMap = new HashMap<>(); - - private OnPolylineClickListener mOnPolylineClickListener = new OnPolylineClickListener() { - @Override - public boolean onPolylineClick(Polyline polyline) { - return false; - } - }; - - public PolylineHandler(BaiduMap baiduMap) { - super(baiduMap); - } - - @Override - public Map handlerMethodCall(MethodCall call, MethodChannel.Result result) { - if (Env.DEBUG) { - Log.d(TAG, "handlerMethodCall enter"); - } - Map argument = call.arguments(); - if (null == argument) { - if (Env.DEBUG) { - Log.d(TAG, "argument is null"); - } - return null; - } - - String methodId = call.method; - Map overlayMap = null; - switch (methodId) { - case Constants.MethodProtocol.PolylineProtocol.sMapAddPolylineMethod: - overlayMap = addPolyLine(argument); - break; - case Constants.MethodProtocol.PolylineProtocol.sMapUpdatePolylineMemberMethod: - overlayMap = updateMember(argument); - break; - default: - break; - } - - return overlayMap; - } - - private Map addPolyLine(Map argument) { - if (!argument.containsKey("id") - || !argument.containsKey("coordinates") - || !argument.containsKey("indexs")) { - if (Env.DEBUG) { - Log.d(TAG, "argument does not contain"); - } - return null; - } - - final String id = new TypeConverter().getValue(argument, "id"); - if (TextUtils.isEmpty(id)) { - if (Env.DEBUG) { - Log.d(TAG, "id is null"); - } - return null; - } - - List> coordinates = - new TypeConverter>>().getValue(argument, "coordinates"); - List latLngList = FlutterDataConveter.mapToLatlngs(coordinates); - if (null == latLngList) { - if (Env.DEBUG) { - Log.d(TAG, "latLngList is null"); - } - return null; - } - - PolylineOptions polylineOptions = new PolylineOptions().points(latLngList); - - int pointNum = coordinates.size(); - List indexs = new TypeConverter>().getValue(argument, "indexs"); - setOptions(id, argument, polylineOptions, indexs, pointNum); - - if (Env.DEBUG) { - Log.d(TAG, "addOverlay success"); - } - - final Polyline polyline = (Polyline) mBaiduMap.addOverlay(polylineOptions); - Bundle bundle = new Bundle(); - bundle.putCharArray("id", id.toCharArray()); - polyline.setExtraInfo(bundle); - - if (null != polyline) { - mBaiduMap.setOnPolylineClickListener(mOnPolylineClickListener); - - return new HashMap() { - { - put(id, polyline); - } - }; - } - - return null; - } - - private void setOptions(String id, Map polylineOptionsMap, - PolylineOptions polylineOptions, - List indexs, - int pointNumn) { - if (null == polylineOptionsMap || null == polylineOptions || null == indexs) { - return; - } - - Integer width = new TypeConverter().getValue(polylineOptionsMap, "width"); - if (null != width) { - polylineOptions.width(width); - } - - Boolean clickable = new TypeConverter().getValue(polylineOptionsMap, "clickable"); - if (null != clickable) { - polylineOptions.clickable(clickable); - } - - Boolean isKeepScale = - new TypeConverter().getValue(polylineOptionsMap, "isKeepScale"); - if (null != isKeepScale) { - polylineOptions.keepScale(isKeepScale); - } - - Boolean isFocus = new TypeConverter().getValue(polylineOptionsMap, "isFocus"); - if (null != isFocus) { - polylineOptions.focus(isFocus); - } - - Integer zIndex = new TypeConverter().getValue(polylineOptionsMap, "zIndex"); - if (null != zIndex) { - polylineOptions.zIndex(zIndex); - } - - Boolean visible = new TypeConverter().getValue(polylineOptionsMap, "visible"); - if (null != visible) { - polylineOptions.visible(visible); - } - - Boolean isThined = new TypeConverter().getValue(polylineOptionsMap, "isThined"); - if(null != isThined){ - polylineOptions.isThined(isThined); - } - - Boolean dottedLine = new TypeConverter().getValue(polylineOptionsMap, "dottedLine"); - if (null != dottedLine) { - polylineOptions.dottedLine(dottedLine); - } - - List colors = - new TypeConverter>().getValue(polylineOptionsMap, "colors"); - if (null != colors && colors.size() > 0) { - List intColors = FlutterDataConveter.getColors(colors); - - if (null != intColors) { - if (intColors.size() == 1) { - polylineOptions.color(intColors.get(0)); - } else { - List correctColors = correctColors(indexs, intColors, pointNumn); - polylineOptions.colorsValues(correctColors); - } - } - } - - /* - *colors和icons不能共存 - */ - if (null == colors || colors.size() <= 0) { - List icons = - new TypeConverter>().getValue(polylineOptionsMap, "textures"); - if (null != icons && icons.size() > 0) { - List bitmapDescriptors = FlutterDataConveter.getIcons(icons); - if (null != bitmapDescriptors) { - if (bitmapDescriptors.size() == 1) { - polylineOptions.customTexture(bitmapDescriptors.get(0)); - } else { - polylineOptions.textureIndex(indexs); - polylineOptions.customTextureList(bitmapDescriptors); - } - - clearTextureBitMap(id); - mBitmapMap.put(id, bitmapDescriptors); - } - } - } - - setLineDashType(polylineOptionsMap, polylineOptions); - } - - /** - * android polyline多颜色只需要设置colors - * 但flutter传过来的colors只是一个颜色数组,没有索引的概念,需要根据indexs对其进行修正 - * 正常情况indexs的数目应该等于pointNum -1,如果indexs小于次值,则余下段的索引按照索引数组最后一个补齐,反之则按照poinNum - 1处理 - */ - private List correctColors(List indexs, - List colors, - int pointNum) { - - // 通过colors的size对索引数组进行修正 - List tmpIndexs = new ArrayList<>(); - for (Integer i : indexs) { - if (i < colors.size()) { - tmpIndexs.add(i); - } else { - tmpIndexs.add(colors.size() - 1); - } - } - - int tmpIndexSize = tmpIndexs.size(); - int lastIndexValue = tmpIndexs.get(tmpIndexSize - 1); - // 通过pointNum对索引数组进行修正 - if (tmpIndexSize < pointNum - 1) { - for (int i = tmpIndexSize; i < pointNum - 1; i++) { - tmpIndexs.add(lastIndexValue); - } - } - - List tmpColors = new ArrayList<>(); - for (int i = 0; i < pointNum - 1; i++) { - tmpColors.add(colors.get(tmpIndexs.get(i))); - } - - return tmpColors; - } - - private void setLineDashType(Map polylineOptionsMap, - PolylineOptions polylineOptions) { - if (null == polylineOptionsMap || null == polylineOptions) { - return; - } - - Integer lineDashType = - new TypeConverter().getValue(polylineOptionsMap, "lineDashType"); - if (null == lineDashType) { - return; - } - - switch (lineDashType) { - case OverlayCommon.LineDashType.sLineDashTypeSquare: - polylineOptions.dottedLineType(PolylineDottedLineType.DOTTED_LINE_SQUARE); - break; - case OverlayCommon.LineDashType.sLineDashTypeDot: - polylineOptions.dottedLineType(PolylineDottedLineType.DOTTED_LINE_CIRCLE); - break; - default: - break; - } - } - - /** - * 更新polyline属性 - * - * @param argument - * @return - */ - private Map updateMember(Map argument) { - if (null == mCurrentOverlay || !(mCurrentOverlay instanceof Polyline)) { - return null; - } - - final Polyline polyline = (Polyline) mCurrentOverlay; - - final String id = new TypeConverter().getValue(argument, "id"); - if (TextUtils.isEmpty(id)) { - return null; - } - - String member = new TypeConverter().getValue(argument, "member"); - if (TextUtils.isEmpty(member)) { - return null; - } - - switch (member) { - case "coordinates": - if (!updateCoordinates(argument, polyline)) { - return null; - } - break; - case "width": - Integer width = new TypeConverter().getValue(argument, "value"); - if (null == width) { - return null; - } - - polyline.setWidth(width); - break; - case "indexs": - if (!updateIndexs(argument, polyline)) { - return null; - } - break; - case "colors": - if (!updateColors(argument, polyline)) { - return null; - } - break; - case "textures": - if (!updateTextures(argument, polyline)) { - return null; - } - break; - case "lineDashType": - if (!updateLinashType(argument, polyline)) { - return null; - } - break; - case "lineCapType": - case "lineJoinType": - return null; - case "clickable": - Boolean clickable = new TypeConverter().getValue(argument, "value"); - if (null == clickable) { - return null; - } - - polyline.setClickable(clickable); - break; - case "isKeepScale": - Boolean isKeepScale = new TypeConverter().getValue(argument, "value"); - if (null == isKeepScale) { - return null; - } - - polyline.setIsKeepScale(isKeepScale); - break; - case "isFocus": - Boolean isFocus = new TypeConverter().getValue(argument, "value"); - if (null == isFocus) { - return null; - } - - polyline.setFocus(isFocus); - break; - case "visible": - Boolean visible = new TypeConverter().getValue(argument, "value"); - if (null == visible) { - return null; - } - - polyline.setVisible(visible); - break; - case "zIndex": - Integer zIndex = new TypeConverter().getValue(argument, "value"); - if (null == zIndex) { - return null; - } - - polyline.setZIndex(zIndex); - break; - case "isThined": - Boolean isThined = new TypeConverter().getValue(argument, "value"); - if(null != isThined){ - polyline.setThined(isThined); - } - break; - case "dottedLine": - Boolean dottedLine = new TypeConverter().getValue(argument, "value"); - if (null != dottedLine) { - polyline.setDottedLine(dottedLine); - } - break; - default: - break; - } - - return new HashMap() { - { - put(id, polyline); - } - }; - } - - private boolean updateCoordinates(Map argument, Polyline polyline) { - List> coordinates = - new TypeConverter>>().getValue(argument, - "value"); - - if (null == coordinates) { - return false; - } - - List latLngList = FlutterDataConveter.mapToLatlngs(coordinates); - if (null == latLngList) { - return false; - } - polyline.setPoints(latLngList); - - - List indexs = new TypeConverter>().getValue(argument, "indexs"); - if (null != indexs) { - int[] nIndexs = new int[indexs.size()]; - for (int i = 0; i < indexs.size(); i++) { - nIndexs[i] = indexs.get(i); - } - - polyline.setIndexs(nIndexs); - } - - return true; - } - - private boolean updateIndexs(Map argument, Polyline polyline) { - List indexs = new TypeConverter>().getValue(argument, "value"); - if (null == indexs) { - return false; - } - - int[] nIndexs = new int[indexs.size()]; - for (int i = 0; i < indexs.size(); i++) { - nIndexs[i] = indexs.get(i); - } - - polyline.setIndexs(nIndexs); - - List points = polyline.getPoints(); - if (null != points) { - polyline.setPoints(points); - } - - return true; - } - - - private boolean updateColors(Map argument, Polyline polyline) { - boolean ret = false; - List colors = - new TypeConverter>().getValue(argument, "value"); - List indexs = - new TypeConverter>().getValue(argument, "indexs"); - - List points = polyline.getPoints(); - - if (null != colors && - colors.size() > 0 && - null != indexs && - indexs.size() > 0 && - null != points && - points.size() > 0) { - List intColors = FlutterDataConveter.getColors(colors); - List correctColors = correctColors(indexs, intColors, points.size()); - - if (null != correctColors) { - if (correctColors.size() == 1) { - polyline.setColor(correctColors.get(0)); - ret = true; - } else { - int[] nColors = new int[correctColors.size()]; - for (int i = 0; i < correctColors.size(); i++) { - nColors[i] = correctColors.get(i); - } - polyline.setColorList(nColors); - ret = true; - } - - polyline.setPoints(points); - } - } - - return ret; - } - - private boolean updateTextures(Map argument, Polyline polyline) { - List icons = - new TypeConverter>().getValue(argument, "value"); - - if (null == icons) { - return false; - } - - boolean ret = false; - if (null != icons && icons.size() > 0) { - List bitmapDescriptors = FlutterDataConveter.getIcons(icons); - if (null != bitmapDescriptors) { - if (bitmapDescriptors.size() == 1) { - polyline.setTexture(bitmapDescriptors.get(0)); - ret = true; - } else { - polyline.setTextureList(bitmapDescriptors); - ret = true; - } - - List points = polyline.getPoints(); - if (null != points) { - polyline.setPoints(points); - } - - Bundle bundle = polyline.getExtraInfo(); - String id = bundle.getString("id"); - clearTextureBitMap(id); - mBitmapMap.put(id, bitmapDescriptors); - } - } - - return ret; - } - - private boolean updateLinashType(Map argument, Polyline polyline) { - Integer lineDashType = new TypeConverter().getValue(argument, "value"); - - if (null == lineDashType) { - return false; - } - - switch (lineDashType) { - case OverlayCommon.LineDashType.sLineDashTypeNone: - break; - case OverlayCommon.LineDashType.sLineDashTypeSquare: - polyline.setDottedLineType(PolylineDottedLineType.DOTTED_LINE_SQUARE); - break; - case OverlayCommon.LineDashType.sLineDashTypeDot: - polyline.setDottedLineType(PolylineDottedLineType.DOTTED_LINE_CIRCLE); - break; - default: - break; - } - - return true; - } - - private void clearTextureBitMap(String id) { - if (TextUtils.isEmpty(id)) { - return; - } - - List bitmapDescriptors = mBitmapMap.get(id); - if (null == bitmapDescriptors) { - return; - } - - Iterator itr = bitmapDescriptors.iterator(); - BitmapDescriptor bitmapDescriptor; - while (itr.hasNext()) { - bitmapDescriptor = (BitmapDescriptor) itr.next(); - if (null == bitmapDescriptor) { - continue; - } - - bitmapDescriptor.recycle(); - } - - mBitmapMap.remove(id); - } - - public void clean(){ - Iterator itr = mBitmapMap.values().iterator(); - List bitmapDescriptors; - BitmapDescriptor bitmapDescriptor; - while (itr.hasNext()) { - bitmapDescriptors = (List) itr.next(); - if (null == bitmapDescriptors) { - continue; - } - - Iterator listItr = bitmapDescriptors.iterator(); - while (listItr.hasNext()) { - bitmapDescriptor = (BitmapDescriptor)listItr.next(); - if (null == bitmapDescriptor) { - continue; - } - - bitmapDescriptor.recycle(); - } - } - - mBitmapMap.clear(); - } - - public void clean(String id) { - if (TextUtils.isEmpty(id)) { - return; - } - - List bitmapDescriptors = mBitmapMap.get(id); - if (null == bitmapDescriptors) { - return; - } - - Iterator itr = bitmapDescriptors.iterator(); - BitmapDescriptor bitmapDescriptor; - while (itr.hasNext()) { - bitmapDescriptor = (BitmapDescriptor)itr.next(); - if (null == bitmapDescriptor) { - continue; - } - - bitmapDescriptor.recycle(); - } - - mBitmapMap.remove(id); - } -} diff --git a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/overlayHandler/TextHandler.java b/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/overlayHandler/TextHandler.java deleted file mode 100644 index aa44350..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/map/overlayHandler/TextHandler.java +++ /dev/null @@ -1,137 +0,0 @@ -package com.baidu.flutter_bmfmap.map.overlayHandler; - -import java.util.HashMap; -import java.util.Map; - -import com.baidu.flutter_bmfmap.utils.Env; -import com.baidu.flutter_bmfmap.utils.converter.FlutterDataConveter; -import com.baidu.flutter_bmfmap.utils.converter.TypeConverter; -import com.baidu.mapapi.map.BaiduMap; -import com.baidu.mapapi.map.Overlay; -import com.baidu.mapapi.map.TextOptions; -import com.baidu.mapapi.model.LatLng; - -import android.graphics.Typeface; -import android.text.TextUtils; -import android.util.Log; -import io.flutter.plugin.common.MethodCall; -import io.flutter.plugin.common.MethodChannel; - -public class TextHandler extends OverlayHandler { - private static final String TAG = "TextHandler"; - - public TextHandler(BaiduMap baiduMap) { - super(baiduMap); - } - - @Override - public Map handlerMethodCall(MethodCall call, MethodChannel.Result result) { - - Map argument = call.arguments(); - if (null == argument) { - if (Env.DEBUG) { - Log.d(TAG, "argument is null"); - } - return null; - } - - if (!argument.containsKey("id") - || !argument.containsKey("text") - || !argument.containsKey("position")) { - if (Env.DEBUG) { - Log.d(TAG, "argument does not contain" + argument.toString()); - - } - return null; - } - - final String id = new TypeConverter().getValue(argument, "id"); - if (TextUtils.isEmpty(id)) { - return null; - } - - TextOptions textOptions = new TextOptions(); - - Object posObj = (argument.get("position")); - if (null != posObj) { - Map posMap = (Map) posObj; - LatLng pos = FlutterDataConveter.mapToLatlng(posMap); - if (null != pos) { - if (Env.DEBUG) { - Log.d(TAG, "pos"); - } - textOptions.position(pos); - } - } - - String text = new TypeConverter().getValue(argument, "text"); - if (TextUtils.isEmpty(text)) { - return null; - } - textOptions.text(text); - - setTextOptions(argument, textOptions); - - final Overlay overlay = mBaiduMap.addOverlay(textOptions); - return new HashMap() { - { - put(id, overlay); - } - }; - } - - private void setTextOptions(Map textOptionsMap, TextOptions textOptions) { - if (null == textOptionsMap || null == textOptions) { - return; - } - - String bgColorStr = new TypeConverter().getValue(textOptionsMap, "bgColor"); - if (!TextUtils.isEmpty(bgColorStr)) { - int bgColor = FlutterDataConveter.strColorToInteger(bgColorStr); - textOptions.bgColor(bgColor); - } - - String fongColorStr = new TypeConverter().getValue(textOptionsMap, "fontColor"); - if (!TextUtils.isEmpty(fongColorStr)) { - int fontColor = FlutterDataConveter.strColorToInteger(fongColorStr); - textOptions.fontColor(fontColor); - } - - Integer fontSize = new TypeConverter().getValue(textOptionsMap, "fontSize"); - if (null != fontSize) { - textOptions.fontSize(fontSize); - } - - Integer alignx = new TypeConverter().getValue(textOptionsMap, "alignX"); - Integer aligny = new TypeConverter().getValue(textOptionsMap, "alignY"); - if (null != alignx && null != aligny) { - textOptions.align(alignx, aligny); - } - - Double roate = new TypeConverter().getValue(textOptionsMap, "rotate"); - if (null != roate) { - textOptions.rotate(roate.floatValue()); - } - - Integer zIndex = new TypeConverter().getValue(textOptionsMap, "zIndex"); - if (null != zIndex) { - textOptions.zIndex(zIndex); - } - - Boolean visible = new TypeConverter().getValue(textOptionsMap, "visible"); - if (null != visible) { - textOptions.visible(visible); - } - - Map typeFaceMap = - new TypeConverter>().getValue(textOptionsMap, "typeFace"); - if (null != typeFaceMap) { - String familyName = new TypeConverter().getValue(typeFaceMap, "familyName"); - Integer textStype = new TypeConverter().getValue(typeFaceMap, "textStype"); - if (!TextUtils.isEmpty(familyName) && textStype >= 0 && textStype <= 4) { - Typeface typeface = Typeface.create(familyName, textStype); - textOptions.typeface(typeface); - } - } - } -} diff --git a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/utils/Constants.java b/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/utils/Constants.java deleted file mode 100644 index ca5f3ff..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/utils/Constants.java +++ /dev/null @@ -1,623 +0,0 @@ -package com.baidu.flutter_bmfmap.utils; - -public class Constants { - public static final String VIEW_METHOD_CHANNEL_PREFIX = "flutter_bmfmap/map_"; - public static final String VIEW_EVENT_CHANNEL_PREFIX = "flutter_bmfmap/event_"; - - public static final String sConfigChangedAction = "com.baidu.flutter_bmfmap.configChanged"; - - /** - * flutter widget update 或者 热重载导致的 FlutterMapView 和FlutterTextureMapView 被调用的次数 - */ - public static final int MAX_GET_VIEW_CNT_BY_FLUTTER_RESIZE = 3; - - /** - * view类型 - */ - public static class ViewType{ - public static final String sMapView = "flutter_bmfmap/map/BMKMapView"; - public static final String sTextureMapView = "flutter_bmfmap/map/BMKTextureMapView"; - } - - /** - * overlayHandler类型 - */ - public static class OverlayHandlerType{ - public static final int CIRCLE_HANDLER = 0; - public static final int DOT_HANDLER = 1; - public static final int POLYGON_HANDLER = 2; - public static final int POLYLINE_HANDLER = 3; - public static final int TEXT_HANDLER = 4; - public static final int ARCLINE_HANDLER = 5; - public static final int GROUND_HANDLER = 6; - } - - /** - * MapHandler类型 - */ - public static class BMapHandlerType{ - public static final int CUSTOM_MAP = 0; - public static final int MAP_STATE = 1; - public static final int INDOOR_MAP = 2; - public static final int MAP_SNAPSHOT = 3; - public static final int CUSTOM_COMPASS = 4; - public static final int CUSTOM_TRAFFIC_COLOR = 5; - public static final int MAP_UPDATE = 6; - public static final int HEAT_MAP = 7; - public static final int TILE_MAP = 8; - public static final int INFOWINDOW_HANDLER = 9; - public static final int MARKER_HANDLER = 10; - public static final int LOCATION_LAYER = 11; - public static final int PROJECTION = 12; - } - - /** - * 与flutter method协议约定 - */ - public static class MethodProtocol { - /** - * 室内图状态协议 - */ - public static class IndoorMapProtocol { - /** - * map展示室内地图 - */ - public static final String sShowBaseIndoorMapMethod = "flutter_bmfmap/map/showBaseIndoorMap"; - - /** - * map室内图标注是否显示 - */ - public static final String sShowBaseIndoorMapPoiMethod = "flutter_bmfmap/map/showBaseIndoorMapPoi"; - - /** - * map设置室内图楼层 - */ - public static final String sSwitchBaseIndoorMapFloorMethod = "flutter_bmfmap/map/switchBaseIndoorMapFloor"; - - /** - * map获取当前聚焦的室内图信息 - */ - public static final String sGetFocusedBaseIndoorMapInfoMethod= "flutter_bmfmap/map/getFocusedBaseIndoorMapInfo"; - } - - /** - * 个性化地图 - */ - public static class CustomMapProtocol { - /** - * 开启个性化地图 - */ - public static final String sMapSetCustomMapStyleEnableMethod = "flutter_bmfmap/map/setCustomMapStyleEnable"; - - /** - * 设置个性化地图样式路径 - */ - public static final String sMapSetCustomMapStylePathMethod = "flutter_bmfmap/map/setCustomMapStylePath"; - - /** - * 在线个性化样式加载状态回调接口 - */ - public static final String sMapSetCustomMapStyleWithOptionMethod = "flutter_bmfmap/map/setCustomMapStyleWithOption"; - } - - /** - * overlay协议 - */ - public static class OverlayProtocol{ - /** - * 删除overlay - */ - public static final String sMapRemoveOverlayMethod = "flutter_bmfmap/overlay/removeOverlay"; - } - - /** - * marker协议 - */ - public static class MarkerProtocol { - /** - * 添加marker - */ - public static final String sMapAddMarkerMethod = "flutter_bmfmap/marker/addMarker"; - - /** - * 添加markers - */ - public static final String sMapAddMarkersMethod = "flutter_bmfmap/marker/addMarkers"; - - /** - * 删除marker - */ - public static final String sMapRemoveMarkerMethod = "flutter_bmfmap/marker/removeMarker"; - - /** - * 删除markers - */ - public static final String sMapRemoveMarkersMethod = "flutter_bmfmap/marker/removeMarkers"; - - /** - * 清除所有的markers - */ - public static final String sMapCleanAllMarkersMethod = "flutter_bmfmap/marker/cleanAllMarkers"; - - /** - * marker点击回调 - */ - public static final String sMapClickedmarkedMethod = "flutter_bmfmap/marker/clickedMarker"; - - /** - * marker 选中回调 - */ - public static final String sMapDidSelectMarkerMethod = "flutter_bmfmap/marker/didSelectedMarker"; - - /** - * marker取消选中回调 - */ - public static final String sMapDidDeselectMarkerMethod = "flutter_bmfmap/marker/didDeselectMarker"; - - /** - * marker拖拽 - */ - public static final String sMapDragMarkerMethod = "flutter_bmfmap/marker/dragMarker"; - - /** - * marker拖拽 - */ - public static final String sMapUpdateMarkerMemberMethod = "flutter_bmfmap/marker/updateMarkerMember"; - - /** - * marker拖拽状态 - */ - public static class MarkerDragState{ - /** - * 开始拖拽 - */ - public static final String sDragStart = "dragStart"; - - /** - * 正在拖拽 - */ - public static final String sDragging = "dragging"; - - /** - * 拖拽完成 - */ - public static final String sDragEnd = "dragEnd"; - - } - } - - - /** - * infowindow协议 - */ - public static class InfoWindowProtocol { - /** - * marker的infoWindow(iOS paopaoView)点击回调 - */ - public static final String sMapDidClickedInfoWindowMethod = "flutter_bmfmap/map/didClickedInfoWindow"; - - // 添加infoWindow - public static final String sAddInfoWindowMapMethod = "flutter_bmfmap/map/addInfoWindow"; - - // 添加infoWindow - public static final String sAddInfoWindowsMapMethod = "flutter_bmfmap/map/addInfoWindows"; - - // 移除infoWindow - public static final String sRemoveInfoWindowMapMethod = "flutter_bmfmap/map/removeInfoWindow"; - } - - /** - * polyline协议 - */ - public static class PolylineProtocol { - /** - * 添加polyline - */ - public static final String sMapAddPolylineMethod = "flutter_bmfmap/overlay/addPolyline"; - /** - * polyline点击事件 - */ - public static final String sMapOnClickedOverlayCallback = "flutter_bmfmap/overlay/onClickedOverlay"; - - /** - * 更新polyline属 - */ - public static final String sMapUpdatePolylineMemberMethod = "flutter_bmfmap/overlay/updatePolylineMember"; - } - - /** - * polygon协议 - */ - public static class PolygonProtocol { - /** - * 添加polyline - */ - public static final String sMapAddPolygonMethod = "flutter_bmfmap/overlay/addPolygon"; - } - - - /** - * arline协议 - */ - public static class ArclineProtocol { - /** - * 添加arcline - */ - public static final String sMapAddArclinelineMethod = "flutter_bmfmap/overlay/addArcline"; - } - - - /** - * circleline协议 - */ - public static class CirclelineProtocol { - /** - * 添加circlr - */ - public static final String sMapAddCirclelineMethod = "flutter_bmfmap/overlay/addCircle"; - } - - - /** - * dot协议 - */ - public static class DotProtocol { - /** - * 添加Dot - */ - public static final String sMapAddDotMethod = "flutter_bmfmap/overlay/addDot"; - } - - /** - * text协议 - */ - public static class TextProtocol { - /** - * 添加text - */ - - // 添加dot - public static final String sMapAddTextMethod = "flutter_bmfmap/overlay/addText"; - } - - /** - * dot协议 - */ - public static class GroundProtocol { - /** - * 添加Ground - */ - public static final String sMapAddGroundMethod = "flutter_bmfmap/overlay/addGround"; - } - - public static class HeatMapProtocol { - /** - * 添加HeapMap - */ - public static final String sMapAddHeatMapMethod = "flutter_bmfmap/heatMap/addHeatMap"; - - /** - * 开关 - */ - public static final String sMapRemoveHeatMapMethod = "flutter_bmfmap/heatMap/removeHeatMap"; - - /** - * 是否展示热力图 - */ - public static final String sShowHeatMapMethod = "flutter_bmfmap/heatMap/showHeatMap"; - } - - /** - * mapState协议 - */ - public static class MapStateProtocol { - // 更新地图参数 - public static final String sMapUpdateMethod = "flutter_bmfmap/map/updateMapOptions"; - - // map放大一级比例尺 - public static final String sMapZoomInMethod = "flutter_bmfmap/map/zoomIn"; - - // map缩小一级比例尺 - public static final String sMapZoomOutMethod = "flutter_bmfmap/map/zoomOut"; - - // 设置路况颜色 - public static final String sMapSetCustomTrafficColorMethod = - "flutter_bmfmap/map/setCustomTrafficColor"; - - // 更新地图状态 - public static final String sMapSetMapStatusMethod = "flutter_bmfmap/map/setMapStatus"; - - // 获取地图状态 - public static final String sMapGetMapStatusMethod = "flutter_bmfmap/map/getMapStatus"; - - // 按像素移动地图中心点 - public static final String sMapSetScrollByMethod = "flutter_bmfmap/map/setScrollBy"; - - // 根据给定增量缩放地图级别 - public static final String sMapSetZoomByMethod = "flutter_bmfmap/map/setZoomBy"; - - // 根据给定增量以及给定的屏幕坐标缩放地图级别 - public static final String sMapSetZoomPointByMethod = "flutter_bmfmap/map/setZoomPointBy"; - - // 设置地图缩放级别 - public static final String sMapSetZoomToMethod = "flutter_bmfmap/map/setZoomTo"; - - // 设定地图中心点坐标 - public static final String sMapSetCenterCoordinateMethod = - "flutter_bmfmap/map/setCenterCoordinate"; - - // 设置地图中心点以及缩放级别 - public static final String sMapSetCenterZoomMethod = "flutter_bmfmap/map/setMapCenterZoom"; - - // 获得地图当前可视区域截图 - public static final String sMapTakeSnapshotMethod = "flutter_bmfmap/map/takeSnapshot"; - - // 获得地图指定区域截图 - public static final String sMapTakeSnapshotWithRectMethod = - "flutter_bmfmap/map/takeSnapshotWithRect"; - - // 设置罗盘的图片 - public static final String sMapSetCompassImageMethod = "flutter_bmfmap/map/setCompassImage"; - - // 设置显示在屏幕中的地图地理范围 - public static final String sMapSetVisibleMapBoundsMethod = "flutter_bmfmap/map/setVisibleMapBounds"; - - // 设定地图的显示范围,并使mapRect四周保留insets指定的边界区域 - public static final String sMapSetVisibleMapBoundsWithPaddingMethod = - "flutter_bmfmap/map/setVisibleMapBoundsWithPadding"; - - // map加载完成 - public static final String sMapDidLoadCallback = "flutter_bmfmap/map/mapViewDidFinishLoad"; - - // map渲染完成 - public static final String sMapDidFinishRenderCallback = - "flutter_bmfmap/map/mapViewDidFinishRender"; - - // 地图渲染每一帧画面过程中,以及每次需要重绘地图时(例如添加覆盖物)都会调用此接口 - public static final String sMapOnDrawMapFrameCallback = - "flutter_bmfmap/map/mapViewOnDrawMapFrame"; - - // 地图绘制出有效数据的监听 - public static final String sMapRenderValidDataCallback = "flutter_bmfmap/map/mapRenderValidDataCallback"; - - // 地图View进入/移出室内图 - public static final String sMapInOrOutBaseIndoorMapCallback = - "flutter_bmfmap/map/mapViewInOrOutBaseIndoorMap"; - - // 地图区域即将改变时会调用此接口 - public static final String sMapRegionWillChangeCallback = - "flutter_bmfmap/map/mapViewRegionWillChange"; - - // 地图区域即将改变时会调用此接口reason - public static final String sMapRegionWillChangeWithReasonCallback = - "flutter_bmfmap/map/mapViewRegionWillChangeWithReason"; - - // 地图区域改变完成后会调用此接口 - public static final String sMapRegionDidChangeCallback = - "flutter_bmfmap/map/mapViewRegionDidChange"; - - // 地图区域改变完成后会调用此接口reason - public static final String sMapRegionDidChangeWithReasonCallback = - "flutter_bmfmap/map/mapViewRegionDidChangeWithReason"; - - // 点中底图空白处会回调此接口 - public static final String sMapOnClickedMapBlankCallback = - "flutter_bmfmap/map/mapViewOnClickedMapBlank"; - - // 点中底图标注后会回调此接口 - public static final String sMapOnClickedMapPoiCallback = - "flutter_bmfmap/map/mapViewonClickedMapPoi"; - - // 双击地图时会回调此接口 - public static final String sMapOnDoubleClickCallback = - "flutter_bmfmap/map/mapViewOnDoubleClick"; - - // 长按地图时会回调此接口 - public static final String sMapOnLongClickCallback = - "flutter_bmfmap/map/mapViewOnLongClick"; - - // 地图状态改变完成后会调用此接口 - public static final String sMapStatusDidChangedCallback = - "flutter_bmfmap/map/mapViewStatusDidChanged"; - - // widget 状态更新 - public static final String sMapDidUpdateWidget = "flutter_bmfmap/map/didUpdateWidget"; - - // widget 热重载 - public static final String sMapReassemble = "flutter_bmfmap/map/reassemble"; - - } - - /** - * 地图获取属性方法id集合 - */ - public static class BMFMapGetPropertyMethodId { - - // 获取map的展示类型 - public static final String sMapGetMapTypeMethod = "flutter_bmfmap/map/getMapType"; - - // 获取map的比例尺级别 - public static final String sMapGetZoomLevelMethod = "flutter_bmfmap/map/getZoomLevel"; - - // 获取map的自定义最小比例尺级别 - public static final String sMapGetMinZoomLevelMethod = "flutter_bmfmap/map/getMinZoomLevel"; - - // 获取map的自定义最大比例尺级别 - public static final String sMapGetMaxZoomLevelMethod = "flutter_bmfmap/map/getMaxZoomLevel"; - - // 获取map的旋转角度 - public static final String sMapGetRotationMethod = "flutter_bmfmap/map/getRotation"; - - // 获取map的地图俯视角度 - public static final String sMapGetOverlookingMethod = "flutter_bmfmap/map/getOverlooking"; - - // 获取map的是否现显示3D楼块效果 - public static final String sMapGetBuildingsEnabledMethod = "flutter_bmfmap/map/getBuildingsEnabled"; - - // 获取map的是否打开路况图层 - public static final String sMapGetTrafficEnabledMethod = "flutter_bmfmap/map/getTrafficEnabled"; - - // 获取map的是否打开百度城市热力图图层 - public static final String sMapGetBaiduHeatMapEnabledMethod = "flutter_bmfmap/map/getBaiduHeatMapEnabled"; - - // 获取map的是否支持所有手势操作 - public static final String sMapGetGesturesEnabledMethod = "flutter_bmfmap/map/getGesturesEnabled"; - - // 获取map是否支持缩放 - public static final String sMapGetZoomEnabledMethod = "flutter_bmfmap/map/getZoomEnabled"; - - // 获取map是否支持拖拽手势 - public static final String sMapGetScrollEnabledMethod = "flutter_bmfmap/map/getScrollEnabled"; - - // 获取map是否支持俯仰角 - public static final String sMapGetOverlookEnabledMethod = "flutter_bmfmap/map/getOverlookEnabled"; - - // 获取map是否支持旋转 - public static final String sMapGetRotateEnabledMethod = "flutter_bmfmap/map/getRotateEnabled"; - - // 获取map的比例尺的位置 - public static final String sMapGetMapScaleBarPositionMethod = "flutter_bmfmap/map/getMapScaleBarPosition"; - - // 获取map的logo位置 - public static final String sMapGetLogoPositionMethod = "flutter_bmfmap/map/getLogoPosition"; - - // 获取map的可视范围 - public static final String sMapGetVisibleMapBoundsMethod = "flutter_bmfmap/map/getVisibleMapBounds"; - - // 获取map的显示室内图 - public static final String sMapGetBaseIndoorMapEnabledMethod = "flutter_bmfmap/map/getBaseIndoorMapEnabled"; - - // 获取map的室内图标注是否显示 - public static final String sMapGetShowIndoorMapPoiMethod = "flutter_bmfmap/map" - + "/getShowIndoorMapPoi"; - } - - public static class BMFOfflineMethodId { - // 初使化 - public static final String sMapInitOfflineMethod = "flutter_bmfmap/offlineMap/initOfflineMap"; - - // 状态回调 - public static final String sMapOfflineCallBackMethod = "flutter_bmfmap/offlineMap/offlineCallBack"; - - // 启动下载指定城市ID的离线地图,或在暂停更新某城市后继续更新下载某城市离线地图 - public static final String sMapStartOfflineMethod = "flutter_bmfmap/offlineMap/startOfflineMap"; - - // 启动更新指定城市ID的离线地图 - public static final String sMapUpdateOfflineMethod = "flutter_bmfmap/offlineMap/updateOfflineMap"; - - // 暂停下载或更新指定城市ID的离线地图 - public static final String sMapPauseOfflineMethod = "flutter_bmfmap/offlineMap/pauseOfflineMap"; - - // 删除指定城市ID的离线地图 - public static final String sMapRemoveOfflineMethod = "flutter_bmfmap/offlineMap/removeOfflineMap"; - - // 销毁离线地图管理模块,不用时调用 - public static final String sMapDestroyOfflineMethod = "flutter_bmfmap/offlineMap/destroyOfflineMap"; - - // 返回热门城市列表 - public static final String sMapGetHotCityListMethod = "flutter_bmfmap/offlineMap/getHotCityList"; - - // 返回支持离线地图城市列表 - public static final String sMapGetOfflineCityListMethod = "flutter_bmfmap/offlineMap/getOfflineCityList"; - - // 根据城市名搜索该城市离线地图记录 - public static final String sMapSearchCityMethod = "flutter_bmfmap/offlineMap/searchCityList"; - - // 返回各城市离线地图更新信息 - public static final String sMapGetAllUpdateInfoMethod = "flutter_bmfmap/offlineMap/getAllUpdateInfo"; - - // 返回指定城市ID离线地图更新信息 - public static final String sMapGetUpdateInfoMethod = "flutter_bmfmap/offlineMap/getUpdateInfo"; - } - - public static class ProjectionMethodId { - //屏幕坐标转地理坐标ID - public static final String sFromScreenLocation = "flutter_bmfmap/projection/screenPointfromCoordinate"; - - //将地理坐标转换成屏幕坐标 - public static final String sToScreenLocation = "flutter_bmfmap/projection/coordinateFromScreenPoint"; - - //米为计量单位的距离(沿赤道)在当前缩放水平下转换到一个以像素(水平)为计量单位的距离 - public static final String sMetersToEquatorPixels = "flutter_bmfmap/map/metersToEquatorPixels"; - } - - public static class TileMapProtocol { - // 添加室内地图 - public static final String sAddTileMapMethod = "flutter_bmfmap/overlay/addTile"; - - // 展示室内地图 - public static final String sRemoveTileMapMethod = "flutter_bmfmap/overlay/removeTile"; - } - } - - public static class ErrorCode{ - - /** - * 没有错误 - */ - public static final int sErrorNon = 0; - - /** - * flutter传递参数为空 - */ - public static final int sErrorNullFlutterParam = 1; - - /** - * flutter参数缺少指定内容 - */ - public static final int sErrorFlutterParamMissingContent = 2; - - /** - * flutter参数类型不对 - */ - public static final int sErrorFlutterParamType= 3; - - /** - * flutter参数转换出错 - */ - public static final int sErrorParamConvertFailed= 4; - - /** - * flutter参数转换出错 - */ - public static final int sErrorEngineError= 5; - } - // 定位图层 - public static class LocationLayerMethodId { - // 设定是否显示定位图层 - public static final String sMapShowUserLocationMethod = - "flutter_bmfmap/userLocation/showUserLocation"; - - // 设定定位模式,取值为:BMFUserTrackingMode - public static final String sMapUserTrackingModeMethod = - "flutter_bmfmap/userLocation/userTrackingMode"; - - // 动态定制我的位置样式 - public static final String sMapUpdateLocationDisplayParamMethod = - "flutter_bmfmap/userLocation/updateLocationDisplayParam"; - - // 动态更新我的位置数据 - public static final String sMapUpdateLocationDataMethod = - "flutter_bmfmap/userLocation/updateLocationData"; - } - - /** - * 枚举:室内图切换楼层结果 - */ - public class SwitchIndoorFloorError { - /** 切换楼层成功 */ - public static final int SUCCESS = 0; - - /** 切换楼层失败 */ - public static final int FAILED = 1; - - /** 地图还未聚焦到传入的室内图 */ - public static final int NOT_FOCUSED = 2; - - /** 当前室内图不存在该楼层 */ - public static final int NOT_EXIST = 3; - - /** 切换楼层, 室内ID信息错误 [android] 独有 */ - public static final int SWICH_FLOOR_INFO_ERROR = 4; - } -} diff --git a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/utils/Env.java b/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/utils/Env.java deleted file mode 100644 index bd51a4a..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/utils/Env.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.baidu.flutter_bmfmap.utils; - -public class Env { - public static Boolean DEBUG = false; - - /** - * 空白地图 - */ - public static final int MAP_TYPE_NONE = 0; - - /** - * 普通地图 - */ - public static final int MAP_TYPE_NORMAL = 1; - - /** - * 卫星地图 - */ - public static final int MAP_TYPE_SATELLITE = 2; - - - /** - * 地图左下方 - */ - public static final int LOGO_POSITION_LEFT_BOTTOM = 0; - - /** - * 地图左下方 - */ - public static final int LOGO_POSITION_LEFT_TOP = 1; - - /** - * 地图中下方 - */ - public static final int LOGO_POSITION_CENTER_BOTTOM = 2; - - /** - * 地图中上方 - */ - public static final int LOGO_POSITION_CENTER_TOP = 3; - - /** - * 地图右下方 - */ - public static final int LOGO_POSITION_RIGTH_BOTTOM = 4; - - /** - * 地图右上方 - */ - public static final int LOGO_POSITION_RIGTH_TOP = 5; - - /** - * 定位图层显示方式 - */ - public static class LocationMode { - /** - * 普通态: 更新定位数据时不对地图做任何操作 - */ - public static final int NORMAL = 0; - - /** - * 定位方向模式 - */ - public static final int MODEHEADING = 1; - - /** - * 跟随态,保持定位图标在地图中心 - */ - public static final int FOLLOWING = 2; - - /** - * 罗盘态,显示定位方向圈,保持定位图标在地图中心 - */ - public static final int COMPASS = 3; - } -} diff --git a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/utils/IOStreamUtils.java b/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/utils/IOStreamUtils.java deleted file mode 100644 index f07f9bd..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/utils/IOStreamUtils.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.baidu.flutter_bmfmap.utils; - -import android.os.Build; - -import androidx.annotation.RequiresApi; - -import java.io.Closeable; -import java.io.IOException; - -/** - * 用于安全的关闭closeable对象 - */ -public class IOStreamUtils{ - public static void closeSilently(Closeable o){ - if(null == o){ - return; - } - - try { - o.close(); - } catch (IOException e) { - e.printStackTrace(); - } - } - - @RequiresApi(api = Build.VERSION_CODES.KITKAT) - public static void closeSilently(AutoCloseable o){ - if(null == o){ - return; - } - - try { - o.close(); - } catch (Exception e) { - e.printStackTrace(); - } - } -} \ No newline at end of file diff --git a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/utils/ThreadPoolUtil.java b/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/utils/ThreadPoolUtil.java deleted file mode 100644 index 824d3c5..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/utils/ThreadPoolUtil.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.baidu.flutter_bmfmap.utils; - - -import java.util.concurrent.ArrayBlockingQueue; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.ScheduledFuture; -import java.util.concurrent.ScheduledThreadPoolExecutor; -import java.util.concurrent.ThreadFactory; -import java.util.concurrent.ThreadPoolExecutor; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicInteger; - -public class ThreadPoolUtil { - private ThreadFactory mThreadFactory = new ThreadFactory() { - @Override - public Thread newThread(Runnable r) { - Thread t = new Thread(r,"mapThread"+mAtomicInteger.getAndIncrement()); - return t; - } - }; - - private AtomicInteger mAtomicInteger = new AtomicInteger(0); - - private final int CORE_POOL_SIZE = Runtime.getRuntime().availableProcessors(); - - private final int MAX_POLL_SIZE = CORE_POOL_SIZE*2; - - private final int KEEP_ALIVE = 3; //空线程alive时间 - - private ExecutorService mExecutorService; - - private ScheduledExecutorService mScheduleExecutorService; - - private static volatile ThreadPoolUtil sInstance; - - public static ThreadPoolUtil getInstance(){ - if(null == sInstance){ - synchronized (ThreadPoolUtil.class){ - if(null == sInstance){ - sInstance = new ThreadPoolUtil(); - } - } - } - - return sInstance; - } - - public ThreadPoolUtil(){ - mExecutorService = new ThreadPoolExecutor(CORE_POOL_SIZE, MAX_POLL_SIZE, KEEP_ALIVE, - TimeUnit.SECONDS, - new ArrayBlockingQueue(1000), - mThreadFactory, new ThreadPoolExecutor.DiscardOldestPolicy()); - - mScheduleExecutorService = new ScheduledThreadPoolExecutor(CORE_POOL_SIZE, mThreadFactory); - } - - public void execute(Runnable runnable){ - if(null == mExecutorService){ - return; - } - - mExecutorService.execute(runnable); - } - - public ScheduledFuture execute(Runnable runnable, int delayTime){ - if(null == mScheduleExecutorService){ - return null; - } - - return mScheduleExecutorService.schedule(runnable, delayTime, TimeUnit.MILLISECONDS); - } - -} diff --git a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/utils/converter/FlutterDataConveter.java b/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/utils/converter/FlutterDataConveter.java deleted file mode 100644 index c1ece1c..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/utils/converter/FlutterDataConveter.java +++ /dev/null @@ -1,435 +0,0 @@ -package com.baidu.flutter_bmfmap.utils.converter; - -import android.graphics.Color; -import android.graphics.Point; -import android.text.TextUtils; -import android.util.Size; - -import com.baidu.mapapi.map.BaiduMap; -import com.baidu.mapapi.map.BitmapDescriptor; -import com.baidu.mapapi.map.BitmapDescriptorFactory; -import com.baidu.mapapi.map.Projection; -import com.baidu.mapapi.map.WeightedLatLng; -import com.baidu.mapapi.map.WinRound; -import com.baidu.mapapi.model.LatLng; -import com.baidu.mapapi.model.LatLngBounds; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -public class FlutterDataConveter { - - /** - * 将map形式的经纬度信息转换为结构化的经纬度数据 - * @param latlngMap - * @return - */ - public static LatLng mapToLatlng(Map latlngMap){ - if(null == latlngMap){ - return null; - } - - if(!latlngMap.containsKey("latitude") - || !latlngMap.containsKey("longitude")){ - return null; - } - - Object latitudeObj = latlngMap.get("latitude"); - Object longitudeObj = latlngMap.get("longitude"); - if(null == latitudeObj || null == longitudeObj){ - return null; - } - LatLng latLng = new LatLng((double)latitudeObj, (double)longitudeObj); - return latLng; - } - - /** - * 将多个map形式的经纬度信息转换为结构化的经纬度数据 - * @param latlngList - * @return - */ - public static List mapToLatlngs(List > latlngList) { - if (null == latlngList) { - return null; - } - - Iterator itr = latlngList.iterator(); - ArrayList latLngs = new ArrayList<>(); - while (itr.hasNext()){ - Map latlngMap = (Map)itr.next(); - LatLng latLng = mapToLatlng(latlngMap); - if(null == latLng){ - break; - } - - latLngs.add(latLng); - } - - if(latLngs.size() != latlngList.size()){ - return null; - } - - return latLngs; - } - - - /** - * 将整形转换为16进制字符串 - * @param number - * @return - */ - private static String intToHexValue(int number) { - String result = Integer.toHexString(number & 0xff); - while (result.length() < 2) { - result = "0" + result; - } - return result.toUpperCase(); - } - - /** - * 将16进制颜色转换为整形颜色值 - * @param str 16进制颜色值 - * @return - */ - public static int strColorToInteger(String str) { - if(TextUtils.isEmpty(str) || str.length() < 8){ - return 0; - } - String str1 = str.substring(0, 2); - String str2 = str.substring(2, 4); - String str3 = str.substring(4, 6); - String str4 = str.substring(6, 8); - int alpha = Integer.parseInt(str1, 16); - int red = Integer.parseInt(str2, 16); - int green = Integer.parseInt(str3, 16); - int blue = Integer.parseInt(str4, 16); - - - return Color.argb(alpha, red, green, blue); - } - - /** - * 批量根据icon名称获取BitmapDescriptor - * @param icons - * @return - */ - public static List getIcons(List icons){ - if(null == icons){ - return null; - } - - List bitmapIcons = new ArrayList<>(); - Iterator itr = icons.iterator(); - while (itr.hasNext()){ - String icon = (String) itr.next(); - BitmapDescriptor bitmapDescriptor = BitmapDescriptorFactory.fromAsset("flutter_assets/" + icon); - bitmapIcons.add(bitmapDescriptor); - } - - return bitmapIcons; - } - - /** - * 批量将16进制字符串颜色值转换为整形颜色值 - * @param colors - * @return - */ - public static List getColors(List colors){ - if(null == colors || colors.size() <= 0){ - return null; - } - - List intColors = new ArrayList<>(); - Iterator iterator = colors.iterator(); - while (iterator.hasNext()){ - String colorStr = (String)iterator.next(); - if(TextUtils.isEmpty(colorStr)){ - return null; - } - - int color = FlutterDataConveter.strColorToInteger(colorStr); - intColors.add(color); - } - - return intColors; - } - - /** - * 将map形式的bounds转换为LatLngBounds - * @param boundsMap - * @return - */ - public static LatLngBounds mapToLatlngBounds(Map boundsMap){ - if(null == boundsMap){ - return null; - } - if(!boundsMap.containsKey("northeast") || !boundsMap.containsKey("southwest")){ - return null; - } - - Map northeastMap = (Map)boundsMap.get("northeast"); - Map southwestMap = (Map)boundsMap.get("southwest"); - if(null == northeastMap || null == southwestMap){ - return null; - } - - LatLng northeast = mapToLatlng(northeastMap); - LatLng southwest = mapToLatlng(southwestMap); - return new LatLngBounds.Builder().include(northeast).include(southwest).build(); - } - - /** - * 将LatLngBounds转换为map - * @param latLngBounds - * @return - */ - public static Map latlngBoundsToMap(LatLngBounds latLngBounds){ - if(null == latLngBounds){ - return null; - } - - LatLng southwest = latLngBounds.southwest; - LatLng northeast = latLngBounds.northeast; - - Map southwestMap = FlutterDataConveter.latLngToMap(southwest); - Map northeastMap = FlutterDataConveter.latLngToMap(northeast); - - HashMap latLngBoundsMap = new HashMap<>(); - latLngBoundsMap.put("southwest", southwestMap); - latLngBoundsMap.put("northeast", northeastMap); - - return latLngBoundsMap; - } - - /** - * 将map形式的带权值经纬度数据转换为结构化的带权值的经纬度数据 - * @param dataList - * @return - */ - public static List mapToWeightedLatLngList(List > dataList) { - if(null == dataList){ - return null; - } - - List weightedLatLngList = new ArrayList(); - Iterator itr = dataList.iterator(); - while (itr.hasNext()){ - Map data = ( Map )itr.next(); - if(null == data){ - return null; - } - - if(!data.containsKey("pt") - || !data.containsKey("intensity")){ - return null; - } - - Object intensityObj = data.get("intensity"); - if(null == intensityObj){ - return null; - } - - double intensity = (double)intensityObj; - - Object ptObj = data.get("pt"); - if(null == ptObj){ - return null; - } - - Map ptMap = (Map)ptObj; - if(null == ptMap){ - return null; - } - - LatLng latLng = FlutterDataConveter.mapToLatlng(ptMap); - - WeightedLatLng weightedLatLng = new WeightedLatLng(latLng, intensity); - weightedLatLngList.add(weightedLatLng); - } - - return weightedLatLngList; - } - - /** - * 将map形式的屏幕点坐标转换为Point - * @param pointMap - * @return - */ - public static Point mapToPoint(Map pointMap){ - if(null == pointMap){ - return null; - } - - if(!pointMap.containsKey("x") || !pointMap.containsKey("y")){ - return null; - } - - Object xObj = pointMap.get("x"); - Object yObj = pointMap.get("y"); - if(null == xObj || null == yObj){ - return null; - } - - double x = (double)xObj; - double y = (double)yObj; - - Point point = new Point((int)x, (int)y); - - return point; - } - - /** - * 将LatLng转成map存储 - * @param latLng - * @return - */ - public static Map latLngToMap(LatLng latLng){ - if(null == latLng){ - return null; - } - - Map resultMap = new HashMap(); - resultMap.put("latitude", latLng.latitude); - resultMap.put("longitude", latLng.longitude); - resultMap.put("latitudeE6", latLng.latitudeE6); - resultMap.put("longitudeE6", latLng.longitudeE6); - - return resultMap; - } - - /** - * 将Point转成map存储 - * @param point - * @return - */ - public static Map pointToMap(Point point){ - if(null == point){ - return null; - } - - Map resultMap = new HashMap(); - resultMap.put("x", (double)point.x); - resultMap.put("y", (double)point.y); - - return resultMap; - } - - /** - * 将flutter传过来的BMFRect转换为WinRound - * BMFRect结构: - * /// 屏幕左上点对应的直角地理坐标 - * final BMFPoint origin; - * - * /// 坐标范围 - * final BMFSize size; - * - * WinRound结构: - * public int left = 0; - * public int right = 0; - * public int top = 0; - * public int bottom = 0; - */ - public static WinRound BMFRectToWinRound(Map bmfRect){ - if(null == bmfRect){ - return null; - } - - if(!bmfRect.containsKey("origin") || !bmfRect.containsKey("size")){ - return null; - } - - Map pointMap = (Map)bmfRect.get("origin"); - Point point = FlutterDataConveter.mapToPoint(pointMap); - if(null == point){ - return null; - } - - Map sizeMap = (Map)bmfRect.get("size"); - if(null == sizeMap){ - return null; - } - - if(null == sizeMap){ - return null; - } - - Double width = new TypeConverter().getValue(sizeMap, "width"); - Double height = new TypeConverter().getValue(sizeMap, "height"); - - if(null == width || null == height){ - return null; - } - - WinRound winRound = new WinRound(); - winRound.left = point.x; - winRound.top = point.y; - winRound.right = point.x + width.intValue(); - winRound.bottom = point.y + height.intValue(); - return winRound; - - } - - - public static WinRound insetsToWinRound(Map insets){ - if(null == insets){ - return null; - } - - if(!insets.containsKey("top") - ||!insets.containsKey("left") - || !insets.containsKey("bottom") - || !insets.containsKey("right")){ - return null; - } - - Double top = new TypeConverter().getValue(insets, "top"); - Double left = new TypeConverter().getValue(insets, "left"); - Double bottom = new TypeConverter().getValue(insets, "bottom"); - Double right = new TypeConverter().getValue(insets, "right"); - if(null == top - || null == left - || null == bottom - || null == right){ - return null; - } - - WinRound winRound = new WinRound(); - winRound.left = left.intValue(); - winRound.top = top.intValue(); - winRound.right = right.intValue(); - winRound.bottom = bottom.intValue(); - return winRound; - - } - - public static LatLngBounds BMFRectToLatLngBounds(BaiduMap baiduMap, Map bmfRect){ - if(null == baiduMap || null == bmfRect){ - return null; - } - - WinRound winRound = FlutterDataConveter.BMFRectToWinRound(bmfRect); - if(null == bmfRect){ - return null; - } - - Point notrhEastPoint = new Point(); - notrhEastPoint.x = winRound.left; - notrhEastPoint.y = winRound.top; - Point southWestPoint = new Point(); - southWestPoint.x = winRound.right; - southWestPoint.y = winRound.bottom; - - Projection projection = baiduMap.getProjection(); - LatLng northEast = projection.fromScreenLocation(notrhEastPoint); - LatLng southWest = projection.fromScreenLocation(southWestPoint); - - - LatLngBounds latLngBounds = new LatLngBounds.Builder().include(northEast).include(southWest).build(); - - return latLngBounds; - - } -} diff --git a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/utils/converter/TypeConverter.java b/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/utils/converter/TypeConverter.java deleted file mode 100644 index 6620818..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/android/src/main/java/com/baidu/flutter_bmfmap/utils/converter/TypeConverter.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.baidu.flutter_bmfmap.utils.converter; - -import java.util.Map; - -/** - * 主要用于快速的送map中获取元素value,并进行类型转换 - * @param 目标转换类型 - */ -public class TypeConverter{ - public T getValue(Map map, String key){ //泛型方法getKey的返回值类型为T,T的类型由外部指定 - if(null == map){ - return null; - } - - Object valueObj = map.get(key); - if(null == valueObj){ - return null; - } - - T value = (T)valueObj; - return value; - } -} diff --git a/lib/my_flutter_bmfmap-1.0.2/android/src/main/res/drawable/bg_edittext_focused.xml b/lib/my_flutter_bmfmap-1.0.2/android/src/main/res/drawable/bg_edittext_focused.xml deleted file mode 100644 index 0b39c92..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/android/src/main/res/drawable/bg_edittext_focused.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/lib/my_flutter_bmfmap-1.0.2/android/src/main/res/drawable/bg_edittext_normal.xml b/lib/my_flutter_bmfmap-1.0.2/android/src/main/res/drawable/bg_edittext_normal.xml deleted file mode 100644 index f8f5db8..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/android/src/main/res/drawable/bg_edittext_normal.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/lib/my_flutter_bmfmap-1.0.2/android/src/main/res/drawable/icon_en.png b/lib/my_flutter_bmfmap-1.0.2/android/src/main/res/drawable/icon_en.png deleted file mode 100644 index 48933b4..0000000 Binary files a/lib/my_flutter_bmfmap-1.0.2/android/src/main/res/drawable/icon_en.png and /dev/null differ diff --git a/lib/my_flutter_bmfmap-1.0.2/android/src/main/res/drawable/icon_marka.png b/lib/my_flutter_bmfmap-1.0.2/android/src/main/res/drawable/icon_marka.png deleted file mode 100644 index 152ab6d..0000000 Binary files a/lib/my_flutter_bmfmap-1.0.2/android/src/main/res/drawable/icon_marka.png and /dev/null differ diff --git a/lib/my_flutter_bmfmap-1.0.2/android/src/main/res/drawable/icon_markb.png b/lib/my_flutter_bmfmap-1.0.2/android/src/main/res/drawable/icon_markb.png deleted file mode 100644 index f7d3396..0000000 Binary files a/lib/my_flutter_bmfmap-1.0.2/android/src/main/res/drawable/icon_markb.png and /dev/null differ diff --git a/lib/my_flutter_bmfmap-1.0.2/android/src/main/res/drawable/icon_markc.png b/lib/my_flutter_bmfmap-1.0.2/android/src/main/res/drawable/icon_markc.png deleted file mode 100644 index 28522b7..0000000 Binary files a/lib/my_flutter_bmfmap-1.0.2/android/src/main/res/drawable/icon_markc.png and /dev/null differ diff --git a/lib/my_flutter_bmfmap-1.0.2/android/src/main/res/drawable/icon_markd.png b/lib/my_flutter_bmfmap-1.0.2/android/src/main/res/drawable/icon_markd.png deleted file mode 100644 index 57a1a11..0000000 Binary files a/lib/my_flutter_bmfmap-1.0.2/android/src/main/res/drawable/icon_markd.png and /dev/null differ diff --git a/lib/my_flutter_bmfmap-1.0.2/android/src/main/res/drawable/icon_marke.png b/lib/my_flutter_bmfmap-1.0.2/android/src/main/res/drawable/icon_marke.png deleted file mode 100644 index 3372997..0000000 Binary files a/lib/my_flutter_bmfmap-1.0.2/android/src/main/res/drawable/icon_marke.png and /dev/null differ diff --git a/lib/my_flutter_bmfmap-1.0.2/android/src/main/res/drawable/icon_markf.png b/lib/my_flutter_bmfmap-1.0.2/android/src/main/res/drawable/icon_markf.png deleted file mode 100644 index cbb6173..0000000 Binary files a/lib/my_flutter_bmfmap-1.0.2/android/src/main/res/drawable/icon_markf.png and /dev/null differ diff --git a/lib/my_flutter_bmfmap-1.0.2/android/src/main/res/drawable/icon_markg.png b/lib/my_flutter_bmfmap-1.0.2/android/src/main/res/drawable/icon_markg.png deleted file mode 100644 index 89943ba..0000000 Binary files a/lib/my_flutter_bmfmap-1.0.2/android/src/main/res/drawable/icon_markg.png and /dev/null differ diff --git a/lib/my_flutter_bmfmap-1.0.2/android/src/main/res/drawable/icon_markh.png b/lib/my_flutter_bmfmap-1.0.2/android/src/main/res/drawable/icon_markh.png deleted file mode 100644 index cb839a7..0000000 Binary files a/lib/my_flutter_bmfmap-1.0.2/android/src/main/res/drawable/icon_markh.png and /dev/null differ diff --git a/lib/my_flutter_bmfmap-1.0.2/android/src/main/res/drawable/icon_marki.png b/lib/my_flutter_bmfmap-1.0.2/android/src/main/res/drawable/icon_marki.png deleted file mode 100644 index d2dd2bf..0000000 Binary files a/lib/my_flutter_bmfmap-1.0.2/android/src/main/res/drawable/icon_marki.png and /dev/null differ diff --git a/lib/my_flutter_bmfmap-1.0.2/android/src/main/res/drawable/icon_markj.png b/lib/my_flutter_bmfmap-1.0.2/android/src/main/res/drawable/icon_markj.png deleted file mode 100644 index d45490e..0000000 Binary files a/lib/my_flutter_bmfmap-1.0.2/android/src/main/res/drawable/icon_markj.png and /dev/null differ diff --git a/lib/my_flutter_bmfmap-1.0.2/android/src/main/res/drawable/icon_st.png b/lib/my_flutter_bmfmap-1.0.2/android/src/main/res/drawable/icon_st.png deleted file mode 100644 index 680d135..0000000 Binary files a/lib/my_flutter_bmfmap-1.0.2/android/src/main/res/drawable/icon_st.png and /dev/null differ diff --git a/lib/my_flutter_bmfmap-1.0.2/android/src/main/res/drawable/launch_background.xml b/lib/my_flutter_bmfmap-1.0.2/android/src/main/res/drawable/launch_background.xml deleted file mode 100644 index 304732f..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/android/src/main/res/drawable/launch_background.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - diff --git a/lib/my_flutter_bmfmap-1.0.2/android/src/main/res/drawable/popup.png b/lib/my_flutter_bmfmap-1.0.2/android/src/main/res/drawable/popup.png deleted file mode 100644 index 3dd9e51..0000000 Binary files a/lib/my_flutter_bmfmap-1.0.2/android/src/main/res/drawable/popup.png and /dev/null differ diff --git a/lib/my_flutter_bmfmap-1.0.2/dartdoc_options.yaml b/lib/my_flutter_bmfmap-1.0.2/dartdoc_options.yaml deleted file mode 100644 index 3bafcc0..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/dartdoc_options.yaml +++ /dev/null @@ -1,23 +0,0 @@ -# This file is used by dartdoc when generating API documentation for Flutter. -dartdoc: - include: ['bmfmap_map'] - - # linkToSource: - # root: '.' - # uriTemplate: - showUndocumentedCategories: true - ignore: - - ambiguous-doc-reference - errors: - - unresolved-doc-reference - warnings: - - tool-error - # Before you can run dartdoc, the snippets tool needs to have a snapshot built. - # The dev/tools/dartdoc.dart script does this automatically. - tools: - snippet: - command: ["dev/snippets/lib/main.dart", "--type=application"] - description: "Creates application sample code documentation output from embedded documentation samples." - sample: - command: ["dev/snippets/lib/main.dart", "--type=sample"] - description: "Creates sample code documentation output from embedded documentation samples." \ No newline at end of file diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Common/BMFFileManager.h b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Common/BMFFileManager.h deleted file mode 100644 index a5be664..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Common/BMFFileManager.h +++ /dev/null @@ -1,30 +0,0 @@ -// -// BMFFileManager.h -// flutter_bmfmap -// -// Created by zbj on 2020/2/12. -// - -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface BMFFileManager : NSObject - -/// registar -@property (nonatomic, strong) NSObject *registar; - -/// BMFFileManagerCenter -+ (instancetype)defaultCenter; - -/// 获取flutter端图片资源路径 -- (NSString *)pathForFlutterImageName:(NSString *)imageName; - -/// 获取flutter端文件资源路径 -- (NSString *)pathForFlutterFileName:(NSString *)fileName; - -/// 获取flutter端瓦片图路径 -- (NSString *)pathForFlutterTileResources:(NSString *)tileName; -@end - -NS_ASSUME_NONNULL_END diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Common/BMFFileManager.m b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Common/BMFFileManager.m deleted file mode 100644 index aeaab29..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Common/BMFFileManager.m +++ /dev/null @@ -1,39 +0,0 @@ -// -// BMFFileManager.m -// flutter_bmfmap -// -// Created by zbj on 2020/2/12. -// - -#import "BMFFileManager.h" - -@implementation BMFFileManager - -static BMFFileManager *_instance = nil; -+ (instancetype)defaultCenter{ - if (!_instance) { - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - _instance = [[BMFFileManager alloc] init]; - }); - } - return _instance; -} -/// 获取flutter端图片资源路径 -- (NSString *)pathForFlutterImageName:(NSString *)imageName{ - if (!_registar) return nil; - return [[NSBundle mainBundle] pathForResource:[_registar lookupKeyForAsset:imageName] ofType:nil]; -} -/// 获取flutter端文件资源路径 -- (NSString *)pathForFlutterFileName:(NSString *)fileName{ - if (!_registar) return nil; - return [[NSBundle mainBundle] pathForResource:[_registar lookupKeyForAsset:fileName] ofType:nil]; -} - -/// 获取flutter端瓦片图路径 -- (NSString *)pathForFlutterTileResources:(NSString *)tileName{ - if (!_registar) return nil; - // 指定resoures/bmflocaltileimage/目录下存放瓦片图资源 - return [[NSBundle mainBundle] pathForResource:[_registar lookupKeyForAsset:[NSString stringWithFormat:@"resoures/bmflocaltileimage/%@", tileName]] ofType:nil]; -} -@end diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/FlutterBmfmapPlugin.h b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/FlutterBmfmapPlugin.h deleted file mode 100644 index 7bddfb9..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/FlutterBmfmapPlugin.h +++ /dev/null @@ -1,7 +0,0 @@ -#import - -@interface FlutterBmfmapPlugin : NSObject - -//@property (nonatomic, strong) FlutterMethodChannel *channel; - -@end diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/FlutterBmfmapPlugin.m b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/FlutterBmfmapPlugin.m deleted file mode 100644 index f5add60..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/FlutterBmfmapPlugin.m +++ /dev/null @@ -1,30 +0,0 @@ -#import "FlutterBmfmapPlugin.h" -#import -#import -#import "BMFMapViewController.h" -#import "BMFFileManager.h" -#import "BMFOfflineMapManager.h" - - - -static NSString *kBMFMapIdentifier = @"flutter_bmfmap/map/BMKMapView"; -@interface FlutterBmfmapPlugin() - - -@end - -@implementation FlutterBmfmapPlugin -/// 注册 -+ (void)registerWithRegistrar:(NSObject*)registrar { - // 初始化BMFFileManagerCenter - [BMFFileManager defaultCenter].registar = registrar; - - // mapView - [registrar registerViewFactory:[[FlutterMapViewFactory alloc] initWithMessenger:registrar.messenger] withId:kBMFMapIdentifier]; - - // 离线地图 - [BMFOfflineMapManager registerWithRegistrar:registrar]; - -} - -@end diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/BMFAnnotationHandles.h b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/BMFAnnotationHandles.h deleted file mode 100644 index 8d7a0c2..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/BMFAnnotationHandles.h +++ /dev/null @@ -1,44 +0,0 @@ -// -// BMFAnnotationHandles.h -// flutter_bmfmap -// -// Created by zhangbaojin on 2020/2/11. -// - -#import "BMFMapViewHandle.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface BMFAnnotationHandles : NSObject -/// BMFAnnotationHandler管理中心 -+ (instancetype)defalutCenter; - -- (NSDictionary *)annotationHandles; -@end -#pragma mark - marker - -@interface BMFAddAnnotation : NSObject - -@end - -@interface BMFAddAnnotations : NSObject - -@end - -@interface BMFRemoveAnnotation : NSObject - -@end - -@interface BMFRemoveAnnotations : NSObject - -@end - -@interface BMFCleanAllAnnotations : NSObject - -@end - -@interface BMFUpdateAnnotation : NSObject - -@end - -NS_ASSUME_NONNULL_END diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/BMFAnnotationHandles.m b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/BMFAnnotationHandles.m deleted file mode 100644 index 619fa9a..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/BMFAnnotationHandles.m +++ /dev/null @@ -1,280 +0,0 @@ -// -// BMFAnnotationHandles.m -// flutter_bmfmap -// -// Created by zhangbaojin on 2020/2/11. -// - -#import "BMFAnnotationHandles.h" -#import "BMFMapView.h" -#import "NSObject+BMFVerify.h" -#import "BMFAnnotationMethodConst.h" -#import "BMFFileManager.h" -#import "UIColor+BMFString.h" -#import "BMFAnnotation.h" -#import "BMFMapModels.h" - -@interface BMFAnnotationHandles () -{ - NSDictionary *_handles; -} -@end -@implementation BMFAnnotationHandles - -static BMFAnnotationHandles *_instance = nil; -+ (instancetype)defalutCenter{ - if (!_instance) { - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - _instance = [[BMFAnnotationHandles alloc] init]; - }); - } - return _instance; -} - -- (NSDictionary *)annotationHandles{ - if (!_handles) { - _handles = @{ - kBMFMapAddMarkerMethod: NSStringFromClass([BMFAddAnnotation class]), - kBMFMapAddMarkersMethod: NSStringFromClass([BMFAddAnnotations class]), - kBMFMapRemoveMarkerMethod: NSStringFromClass([BMFRemoveAnnotation class]), - kBMFMapRemoveMarkersMethod: NSStringFromClass([BMFRemoveAnnotations class]), - kBMFMapCleanAllMarkersMethod: NSStringFromClass([BMFCleanAllAnnotations class]), - kBMFMapUpdateMarkerMemberMethod: NSStringFromClass([BMFUpdateAnnotation class]) - }; - } - return _handles; -} -@end - -#pragma mark - marker - -@implementation BMFAddAnnotation - -@synthesize _mapView; - -- (nonnull NSObject *)initWith:(nonnull BMFMapView *)mapView { - _mapView = mapView; - return self; -} - -- (void)handleMethodCall:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult)result { - BMKPointAnnotation *annotation = [BMKPointAnnotation annotationWith:call.arguments]; - if (annotation) { - [_mapView addAnnotation:annotation]; - result(@YES); - } else { - result(@NO); - } -} - -@end - -@implementation BMFAddAnnotations - -@synthesize _mapView; - -- (nonnull NSObject *)initWith:(nonnull BMFMapView *)mapView { - _mapView = mapView; - return self; -} - -- (void)handleMethodCall:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult)result { - if (!call.arguments) { - result(@NO); - return; - } - - NSMutableArray *annotations = @[].mutableCopy; - for (NSDictionary *dic in (NSArray *)call.arguments) { - BMKPointAnnotation *an = [BMKPointAnnotation annotationWith:dic]; - [annotations addObject:an]; - } - [_mapView addAnnotations:annotations]; - result(@YES); -} - -@end - - -@implementation BMFRemoveAnnotation - -@synthesize _mapView; - -- (nonnull NSObject *)initWith:(nonnull BMFMapView *)mapView { - _mapView = mapView; - return self; -} - -- (void)handleMethodCall:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult)result { - if (!call.arguments || ![call.arguments safeObjectForKey:@"id"]) { - result(@NO); - return; - } - NSString *ID = [call.arguments safeObjectForKey:@"id"]; - __weak __typeof__(_mapView) weakMapView = _mapView; - [_mapView.annotations enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { - if ([ID isEqualToString:((BMKPointAnnotation *) obj).Id]) { - [weakMapView removeAnnotation:obj]; - result(@YES); - *stop = YES; - } - }]; - -} - -@end - - -@implementation BMFRemoveAnnotations - -@synthesize _mapView; - -- (nonnull NSObject *)initWith:(nonnull BMFMapView *)mapView { - _mapView = mapView; - return self; -} - -- (void)handleMethodCall:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult)result { - if (!call.arguments) { - result(@NO); - return; - } - - __block NSMutableArray *annotations = @[].mutableCopy; - for (NSDictionary *dic in (NSArray *)call.arguments) { - [_mapView.annotations enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { - if ([[dic safeObjectForKey:@"id"] isEqualToString:((BMKPointAnnotation *) obj).Id]) { - [annotations addObject:obj]; - *stop = YES; - } - }]; - } - [_mapView removeAnnotations:annotations]; - result(@YES); -} - -@end - -@implementation BMFCleanAllAnnotations - -@synthesize _mapView; - -- (nonnull NSObject *)initWith:(nonnull BMFMapView *)mapView { - _mapView = mapView; - return self; -} - -- (void)handleMethodCall:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult)result { - [_mapView removeAnnotations:_mapView.annotations]; - result(@YES); -} - -@end - -@implementation BMFUpdateAnnotation - -@synthesize _mapView; - -- (nonnull NSObject *)initWith:(nonnull BMFMapView *)mapView { - _mapView = mapView; - return self; -} - -- (void)handleMethodCall:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult)result { - if (!call.arguments || ![call.arguments safeObjectForKey:@"id"]) { - result(@NO); - return; - } - NSString *ID = [call.arguments safeObjectForKey:@"id"]; - __block BMKPointAnnotation *annotation; -// __weak __typeof__(_mapView) weakMapView = _mapView; - [_mapView.annotations enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { - if ([ID isEqualToString:((BMKPointAnnotation *) obj).Id]) { - annotation = (BMKPointAnnotation *) obj; - *stop = YES; - } - }]; - if (!annotation) { - NSLog(@"根据ID(%@)未找到对应的marker", ID); - result(@NO); - } - - NSString *member = [call.arguments safeObjectForKey:@"member"]; - - if ([member isEqualToString:@"title"]) { - annotation.title = [call.arguments safeObjectForKey:@"value"]; - result(@YES); - return; - - } else if ([member isEqualToString:@"subtitle"]) { - annotation.subtitle = [call.arguments safeObjectForKey:@"value"]; - result(@YES); - return; - - } else if ([member isEqualToString:@"position"]) { - BMFCoordinate *coord = [BMFCoordinate bmf_modelWith:[call.arguments safeObjectForKey:@"value"]]; - annotation.coordinate = [coord toCLLocationCoordinate2D]; - result(@YES); - return; - - } else if ([member isEqualToString:@"isLockedToScreen"]) { - annotation.isLockedToScreen = [[call.arguments safeObjectForKey:@"value"] boolValue]; - if (annotation.isLockedToScreen) { - annotation.screenPointToLock = [[BMFMapPoint bmf_modelWith:[call.arguments safeObjectForKey:@"screenPointToLock"]] toCGPoint]; - } - [_mapView setMapStatus:_mapView.getMapStatus]; - result(@YES); - return; - - } else if ([member isEqualToString:@"icon"]) { - BMKPinAnnotationView *view = (BMKPinAnnotationView *)[_mapView viewForAnnotation:annotation]; - view.image = [UIImage imageWithContentsOfFile:[[BMFFileManager defaultCenter] pathForFlutterImageName:[call.arguments safeObjectForKey:@"value"]]]; - result(@YES); - return; - - } else if ([member isEqualToString:@"centerOffset"]) { - BMKPinAnnotationView *view = (BMKPinAnnotationView *)[_mapView viewForAnnotation:annotation]; - BMFMapPoint *point = [BMFMapPoint bmf_modelWith:[call.arguments safeObjectForKey:@"value"]]; - view.centerOffset = [point toCGPoint]; - result(@YES); - return; - - } else if ([member isEqualToString:@"enabled3D"]) { - BMKPinAnnotationView *view = (BMKPinAnnotationView *)[_mapView viewForAnnotation:annotation]; - BOOL value = [[call.arguments safeObjectForKey:@"value"] boolValue]; - view.enabled3D = value; - result(@YES); - return; - - } else if ([member isEqualToString:@"enabled"]) { - BMKPinAnnotationView *view = (BMKPinAnnotationView *)[_mapView viewForAnnotation:annotation]; - BOOL value = [[call.arguments safeObjectForKey:@"value"] boolValue]; - view.enabled = value; - result(@YES); - return; - - } else if ([member isEqualToString:@"draggable"]) { - BMKPinAnnotationView *view = (BMKPinAnnotationView *)[_mapView viewForAnnotation:annotation]; - BOOL value = [[call.arguments safeObjectForKey:@"value"] boolValue]; - view.draggable = value; - result(@YES); - return; - - } else if ([member isEqualToString:@"zIndex"]) { - NSLog(@"ios - 暂不支持设置zIndex"); - result(@YES); - return; - - } else if ([member isEqualToString:@"visible"]) { - NSLog(@"ios - 暂不支持设置visible"); - result(@YES); - return; - - } else { - result(@YES); - } - -} - -@end diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/BMFHeatMapHandles.h b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/BMFHeatMapHandles.h deleted file mode 100644 index c2c159b..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/BMFHeatMapHandles.h +++ /dev/null @@ -1,32 +0,0 @@ -// -// BMFHeatMapHandles.h -// flutter_bmfmap -// -// Created by zhangbaojin on 2020/4/3. -// - -#import "BMFMapViewHandle.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface BMFHeatMapHandles : NSObject -/// BMFHeatMapHandles管理中心 -+ (instancetype)defalutCenter; - -- (NSDictionary *)heatMapHandles; -@end -#pragma mark - heatMap - -@interface BMFShowHeatMap : NSObject - -@end - -@interface BMFAddHeatMap : NSObject - -@end - -@interface BMFRemoveHeatMap : NSObject - -@end - -NS_ASSUME_NONNULL_END diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/BMFHeatMapHandles.m b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/BMFHeatMapHandles.m deleted file mode 100644 index 06fc07d..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/BMFHeatMapHandles.m +++ /dev/null @@ -1,100 +0,0 @@ -// -// BMFHeatMapHandles.m -// flutter_bmfmap -// -// Created by zhangbaojin on 2020/4/3. -// - -#import "BMFHeatMapHandles.h" -#import "BMFMapView.h" -#import "BMFHeatMapConst.h" -#import "NSObject+BMFVerify.h" -#import "BMFHeatMapModel.h" -@interface BMFHeatMapHandles () -{ - NSDictionary *_handles; -} -@end - -@implementation BMFHeatMapHandles -static BMFHeatMapHandles *_instance = nil; -+ (instancetype)defalutCenter{ - if (!_instance) { - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - _instance = [[BMFHeatMapHandles alloc] init]; - }); - } - return _instance; -} - -- (NSDictionary *)heatMapHandles{ - if (!_handles) { - _handles = @{ - kBMFMapShowHeatMapMethod: NSStringFromClass([BMFShowHeatMap class]), - kBMFMapAddHeatMapMethod: NSStringFromClass([BMFAddHeatMap class]), - kBMFMapRemoveHeatMapMethod: NSStringFromClass([BMFRemoveHeatMap class]), - }; - } - return _handles; -} -@end - -#pragma mark - heatMap - -@implementation BMFShowHeatMap - -@synthesize _mapView; - -- (nonnull NSObject *)initWith:(nonnull BMFMapView *)mapView { - _mapView = mapView; - return self; -} - -- (void)handleMethodCall:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult)result { - if (!call.arguments || !call.arguments[@"show"]) { - result(@NO); - return; - } - _mapView.baiduHeatMapEnabled = [[call.arguments safeValueForKey:@"show"] boolValue]; - result(@YES); -} - -@end - -@implementation BMFAddHeatMap - -@synthesize _mapView; - -- (nonnull NSObject *)initWith:(nonnull BMFMapView *)mapView { - _mapView = mapView; - return self; -} - -- (void)handleMethodCall:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult)result { - if (!call.arguments || !call.arguments[@"heatMap"]) { - result(@NO); - return; - } - BMFHeatMapModel *heatMap = [BMFHeatMapModel bmf_modelWith:[call.arguments safeObjectForKey:@"heatMap"]]; - [_mapView addHeatMap:[heatMap toBMKHeatMap]]; - result(@YES); -} - -@end - -@implementation BMFRemoveHeatMap - -@synthesize _mapView; - -- (nonnull NSObject *)initWith:(nonnull BMFMapView *)mapView { - _mapView = mapView; - return self; -} - -- (void)handleMethodCall:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult)result { - [_mapView removeHeatMap]; - result(@YES); -} - -@end diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/BMFMapView.h b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/BMFMapView.h deleted file mode 100644 index c3bee9c..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/BMFMapView.h +++ /dev/null @@ -1,27 +0,0 @@ -// -// BMFMapView.h -// flutter_bmfmap -// -// Created by zbj on 2020/2/10. -// -#ifndef __BMFMapView__H__ -#define __BMFMapView__H__ -#ifdef __OBJC__ -#import -#endif -#endif - -NS_ASSUME_NONNULL_BEGIN - -@interface BMFMapView : BMKMapView -+ (instancetype)viewWithFrame:(CGRect)frame; -+ (instancetype)viewWithFrame:(CGRect)frame dic:(NSDictionary *)dic; - - -/// 更新地图属性(初始化时,部分参数会不生效),在地图加载完成时调用 -- (BOOL)updateMapOptions; - -- (BOOL)updateMapViewWith:(NSDictionary *)dic; -@end - -NS_ASSUME_NONNULL_END diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/BMFMapView.m b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/BMFMapView.m deleted file mode 100644 index f71eacf..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/BMFMapView.m +++ /dev/null @@ -1,205 +0,0 @@ -// -// BMFMapView.m -// flutter_bmfmap -// -// Created by zbj on 2020/2/10. -// - -#import "BMFMapView.h" -#import "BMFMapModels.h" -#import "BMFEdgeInsets.h" -@interface BMFMapView () - -/// map属性集合 -@property (nonatomic, strong) NSDictionary *mapViewOptions; -@end - -@implementation BMFMapView -+ (instancetype)viewWithFrame:(CGRect)frame { - return [[BMFMapView alloc] initWithFrame:frame]; -} -+ (instancetype)viewWithFrame:(CGRect)frame dic:(NSDictionary *)dic{ - BMFMapView *map = [[BMFMapView alloc] initWithFrame:frame]; - map.mapViewOptions = dic; - [map updateMapViewWith:dic]; - return map; -} -// 此方法解决初始时设置的属性不生效问题 -- (BOOL)updateMapOptions { - if (_mapViewOptions) { - // logo位置 默认BMKLogoPositionLeftBottom - if ([_mapViewOptions[@"logoPosition"] isValidParam]) { - self.logoPosition = [_mapViewOptions[@"logoPosition"] intValue]; - } - // 指南针的位置,设定坐标以BMKMapView左上角为原点,向右向下增长 - if ([_mapViewOptions[@"compassPosition"] isValidParam]) { - BMFMapPoint *point = [BMFMapPoint bmf_modelWith:_mapViewOptions[@"compassPosition"]]; - self.compassPosition = [point toCGPoint]; - } - // 设定地图是否打开百度城市热力图图层(百度自有数据) - if ([_mapViewOptions[@"baiduHeatMapEnabled"] isValidParam]) { - self.baiduHeatMapEnabled = [_mapViewOptions[@"baiduHeatMapEnabled"] boolValue]; - } - // 设定是否显式比例尺 - if ([_mapViewOptions[@"showMapScaleBar"] isValidParam]) { - self.showMapScaleBar = [_mapViewOptions[@"showMapScaleBar"] boolValue]; - } - // 比例尺的位置,设定坐标以BMKMapView左上角为原点,向右向下增长 - if ([_mapViewOptions[@"mapScaleBarPosition"] isValidParam]) { - self.mapScaleBarPosition = [[BMFMapPoint bmf_modelWith:_mapViewOptions[@"mapScaleBarPosition"]] toCGPoint]; - } - return YES; - } - return NO; -} -- (BOOL)updateMapViewWith:(NSDictionary *)dic { - BOOL result = NO; - if (dic) { - // 当前地图类型,可设定为标准地图、卫星地图 - if ([dic[@"mapType"] isValidParam]) { - self.mapType = [dic[@"mapType"] intValue]; - } - // 限制地图的显示范围(地图状态改变时,该范围不会在地图显示范围外。设置成功后,会调整地图显示该范围) - if ([dic[@"limitMapBounds"] isValidParam]) { - BMFCoordinateBounds *limitMapBounds = [BMFCoordinateBounds bmf_modelWith:dic[@"limitMapBounds"]]; - self.limitMapRegion = [limitMapBounds toCoordinateRegion]; - } - // logo位置 默认BMKLogoPositionLeftBottom - if ([_mapViewOptions[@"logoPosition"] isValidParam]) { - self.logoPosition = [dic[@"logoPosition"] intValue]; - } - // 指南针的位置,设定坐标以BMKMapView左上角为原点,向右向下增长 - if ([dic[@"compassPosition"] isValidParam]) { - BMFMapPoint *point = [BMFMapPoint bmf_modelWith:dic[@"compassPosition"]]; - self.compassPosition = [point toCGPoint]; - } - // 当前地图的中心点,改变该值时,地图的比例尺级别不会发生变化 - if ([dic[@"center"] isValidParam]) { - BMFCoordinate *coord = [BMFCoordinate bmf_modelWith:dic[@"center"]]; - [self setCenterCoordinate:[coord toCLLocationCoordinate2D]]; - } - // 地图比例尺级别,在手机上当前可使用的级别为4-21级 - if ([dic[@"zoomLevel"] isValidParam]) { - self.zoomLevel = [dic[@"zoomLevel"] intValue]; - } - // 地图的自定义最大比例尺级别 - if ([dic[@"minZoomLevel"] isValidParam]) { - self.minZoomLevel = [dic[@"minZoomLevel"] intValue]; - } - // 地图的自定义最大比例尺级别 - if ([dic[@"maxZoomLevel"] isValidParam]) { - self.maxZoomLevel = [dic[@"maxZoomLevel"] intValue]; - } - // 地图旋转角度,在手机上当前可使用的范围为-180~180度 - if ([dic[@"rotation"] isValidParam]) { - self.rotation = [dic[@"rotation"] intValue]; - } - // 地图俯视角度,在手机上当前可使用的范围为-45~0度 - if ([dic[@"overlooking"] isValidParam]) { - self.overlooking = [dic[@"overlooking"] intValue]; - } - // 地图俯视角度最小值(即角度最大值),在手机上当前可设置的范围为-79~0度 - if ([dic[@"minOverlooking"] isValidParam]) { - self.minOverlooking = [dic[@"minOverlooking"] intValue]; - } - // 设定地图是否现显示3D楼块效果 - if ([dic[@"buildingsEnabled"] isValidParam]) { - self.buildingsEnabled = [dic[@"buildingsEnabled"] boolValue]; - [self setMapStatus:[self getMapStatus]]; - } - // 设定地图是否显示底图poi标注(不包含室内图标注),默认YES - if ([dic[@"showMapPoi"] isValidParam]) { - self.showMapPoi = [dic[@"showMapPoi"] boolValue]; - } - // 设定地图是否打开路况图层 - if ([dic[@"trafficEnabled"] isValidParam]) { - self.trafficEnabled = [dic[@"trafficEnabled"] boolValue]; - } - // 设定地图是否打开百度城市热力图图层(百度自有数据) - if ([dic[@"baiduHeatMapEnabled"] isValidParam]) { - self.baiduHeatMapEnabled = [dic[@"baiduHeatMapEnabled"] boolValue]; - } - // 设定地图View能否支持所有手势操作 - if ([dic[@"gesturesEnabled"] isValidParam]) { - self.gesturesEnabled = [dic[@"gesturesEnabled"] boolValue]; - } - // 设定地图View能否支持用户多点缩放(双指) - if ([dic[@"zoomEnabled"] isValidParam]) { - self.zoomEnabled = [dic[@"zoomEnabled"] boolValue]; - } - // 设定地图View能否支持用户缩放(双击或双指单击) - if ([dic[@"zoomEnabledWithTap"] isValidParam]) { - self.zoomEnabledWithTap = [dic[@"zoomEnabledWithTap"] boolValue]; - } - // 设定地图View能否支持用户移动地图 - if ([dic[@"scrollEnabled"] isValidParam]) { - self.scrollEnabled = [dic[@"scrollEnabled"] boolValue]; - } - // 设定地图View能否支持俯仰角 - if ([dic[@"overlookEnabled"] isValidParam]) { - self.overlookEnabled = [dic[@"overlookEnabled"] boolValue]; - } - // 设定地图View能否支持旋转 - if ([dic[@"rotateEnabled"] isValidParam]) { - self.rotateEnabled = [dic[@"rotateEnabled"] boolValue]; - } - // 设定地图是否回调force touch事件,默认为NO,仅适用于支持3D Touch的情况, - // 开启后会回调 - mapview:onForceTouch:force:maximumPossibleForce: - if ([dic[@"forceTouchEnabled"] isValidParam]) { - self.forceTouchEnabled = [dic[@"forceTouchEnabled"] boolValue]; - } - // 设定是否显式比例尺 - if ([dic[@"showMapScaleBar"] isValidParam]) { - self.showMapScaleBar = [dic[@"showMapScaleBar"] boolValue]; - } - // 比例尺的位置,设定坐标以BMKMapView左上角为原点,向右向下增长 - if ([dic[@"mapScaleBarPosition"] isValidParam]) { - self.mapScaleBarPosition = [[BMFMapPoint bmf_modelWith:dic[@"mapScaleBarPosition"]] toCGPoint]; - } - - // 当前地图范围,采用直角坐标系表示,向右向下增长 - if ([dic[@"visibleMapBounds"] isValidParam]) { - BMFCoordinateBounds *visibleMapBounds = [BMFCoordinateBounds bmf_modelWith:dic[@"visibleMapBounds"]]; - [self setVisibleMapRect:[visibleMapBounds toBMKMapRect] animated:YES]; - } - // 地图预留边界 - if ([dic[@"mapPadding"] isValidParam]) { - BMFEdgeInsets *edge = [BMFEdgeInsets bmf_modelWith:dic[@"mapPadding"]]; - self.mapPadding = [edge toUIEdgeInsets]; - } - // 设置mapPadding时,地图中心(屏幕坐标:BMKMapStatus.targetScreenPt)是否跟着改变,默认YES - if ([dic[@"updateTargetScreenPtWhenMapPaddingChanged"] isValidParam]) { - self.updateTargetScreenPtWhenMapPaddingChanged = [dic[@"updateTargetScreenPtWhenMapPaddingChanged"] boolValue]; - } - // 设定双指手势操作时,BMKMapView的旋转和缩放效果的中心点。 - // 设置为YES时,以手势的中心点(二个指头的中心点)为中心进行旋转和缩放,地图中心点会改变; - // 设置为NO时,以当前地图的中心点为中心进行旋转和缩放,地图中心点不变; - // 默认值为NO。 - if ([dic[@"changeWithTouchPointCenterEnabled"] isValidParam]) { - self.ChangeWithTouchPointCenterEnabled = [dic[@"changeWithTouchPointCenterEnabled"] boolValue]; - } - // 设定双击手势放大地图时,BMKMapView的放大效果的中心点。 - // 设置为YES时,以双击的位置为中心点进行放大,地图中心点会改变; - // 设置为NO时,以当前地图的中心点为中心进行放大,地图中心点不变; - // 默认值为YES。 - if ([dic[@"changeCenterWithDoubleTouchPointEnabled"] isValidParam]) { - self.ChangeCenterWithDoubleTouchPointEnabled = [dic[@"changeCenterWithDoubleTouchPointEnabled"] boolValue]; - } - // 设定地图是否显示室内图 - if ([dic[@"baseIndoorMapEnabled"] isValidParam]) { - self.baseIndoorMapEnabled = [dic[@"baseIndoorMapEnabled"] boolValue]; - } - // 设定室内图标注是否显示,默认YES,仅当显示室内图(baseIndoorMapEnabled为YES)时生效 - if ([dic[@"showIndoorMapPoi"] isValidParam] && self.baseIndoorMapEnabled) { - self.showIndoorMapPoi = [dic[@"showIndoorMapPoi"] boolValue]; - } - result = YES; - } - return result; -} - -- (void)dealloc { - _mapViewOptions = nil; -// NSLog(@"-mapView-dealloc"); -} -@end diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/BMFMapViewController.h b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/BMFMapViewController.h deleted file mode 100644 index f564095..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/BMFMapViewController.h +++ /dev/null @@ -1,27 +0,0 @@ -// -// BMFMapViewController.h -// flutter_bmfmap -// -// Created by zbj on 2020/2/6. -// - -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface BMFMapViewController : NSObject - -- (instancetype)initWithWithFrame:(CGRect)frame - viewIdentifier:(int64_t)viewId - arguments:(id _Nullable)args - binaryMessenger:(NSObject*)messenger; - -@end - - -@interface FlutterMapViewFactory : NSObject - -- (instancetype)initWithMessenger:(NSObject*)messager; - -@end -NS_ASSUME_NONNULL_END diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/BMFMapViewController.m b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/BMFMapViewController.m deleted file mode 100644 index 581a25a..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/BMFMapViewController.m +++ /dev/null @@ -1,506 +0,0 @@ -// -// BMFMapViewController.m -// flutter_bmfmap -// -// Created by zbj on 2020/2/6. -// - -#import "BMFMapViewController.h" -#import "BMFMapView.h" -#import "BMFMapCallBackConst.h" -#import "BMFMapViewHandles.h" -#import "BMFAnnotationHandles.h" -#import "BMFOverlayHandles.h" -#import "BMFHeatMapHandles.h" -#import "BMFUserLocationHandles.h" -#import "BMFProjectionHandles.h" -#import "BMFMapModels.h" -#import "BMFMapStatusModel.h" -#import "BMFMapPoiModel.h" -#import "BMFIndoorMapInfoModel.h" -#import "BMFAnnotation.h" -#import "BMFFileManager.h" -#import "BMFPolyline.h" -#import "BMFArcline.h" -#import "BMFCircle.h" -#import "BMFPolygon.h" -#import "UIColor+BMFString.h" - -static NSString *kBMFMapChannelName = @"flutter_bmfmap/map_"; -static NSString *kMapMethods = @"flutter_bmfmap/map/"; -static NSString *kMarkerMethods = @"flutter_bmfmap/marker/"; -static NSString *kOverlayMethods = @"flutter_bmfmap/overlay/"; -static NSString *kHeatMapMethods = @"flutter_bmfmap/heatMap/"; -static NSString *kUserLocationMethods = @"flutter_bmfmap/userLocation/"; -static NSString *kProjectionMethods = @"flutter_bmfmap/projection/"; - -@interface BMFMapViewController() -{ - FlutterMethodChannel *_channel; - BMFMapView *_mapView; - -} - -@end -@implementation BMFMapViewController - -- (instancetype)initWithWithFrame:(CGRect)frame - viewIdentifier:(int64_t)viewId - arguments:(id _Nullable)args - binaryMessenger:(NSObject*)messenger{ - if ([super init]) { - int Id = (int)(viewId + 97); - NSString *channelName = [NSString stringWithFormat:@"%@%@", kBMFMapChannelName, [NSString stringWithFormat:@"%c", Id]]; - _channel = [FlutterMethodChannel methodChannelWithName:channelName binaryMessenger:messenger]; - _mapView = [BMFMapView viewWithFrame:frame dic:(NSDictionary*)args]; - _mapView.delegate = self; - -#pragma mark - flutter -> ios - __weak __typeof__(_mapView) weakMapView = _mapView; - [_channel setMethodCallHandler:^(FlutterMethodCall * _Nonnull call, FlutterResult _Nonnull result) { - NSObject *handler; - // map - if ([call.method hasPrefix:kMapMethods]) { - handler = [NSClassFromString([BMFMapViewHandles defalutCenter].mapViewHandles[call.method]) new]; - } - // marker - if ([call.method hasPrefix:kMarkerMethods]) { - handler = [NSClassFromString([BMFAnnotationHandles defalutCenter].annotationHandles[call.method]) new]; - } - // overlay - if ([call.method hasPrefix:kOverlayMethods]) { - handler = [NSClassFromString([BMFOverlayHandles defalutCenter].overlayHandles[call.method]) new]; - } - // 热力图 - if ([call.method hasPrefix:kHeatMapMethods]) { - handler = [NSClassFromString([BMFHeatMapHandles defalutCenter].heatMapHandles[call.method]) new]; - } - // 定位图层 - if ([call.method hasPrefix:kUserLocationMethods]) { - handler = [NSClassFromString([BMFUserLocationHandles defalutCenter].userLocationHandles[call.method]) new]; - } - // 数据转换 - if ([call.method hasPrefix:kProjectionMethods]) { - handler = [NSClassFromString([BMFProjectionHandles defalutCenter].projectionHandles[call.method]) new]; - } - - - if (handler) { - [[handler initWith:weakMapView] handleMethodCall:call result:result]; - } else { - if ([call.method isEqualToString:@"flutter_bmfmap/map/didUpdateWidget"]) { -// NSLog(@"native - didUpdateWidget"); - return; - } - if ([call.method isEqualToString:@"flutter_bmfmap/map/reassemble"]) { -// NSLog(@"native - reassemble"); - return; - } - result(FlutterMethodNotImplemented); - } - }]; - } - return self; -} -- (nonnull UIView *)view { - return _mapView; -} -- (void)dealloc { - _channel = nil; - _mapView.delegate = nil; - _mapView = nil; -// NSLog(@"-BMFMapViewController-dealloc"); -} -#pragma mark - ios -> flutter -#pragma mark - BMKMapViewDelegate -/// 地图加载完成 -- (void)mapViewDidFinishLoading:(BMKMapView *)mapView{ - if (_mapView) { - // 对初始时不生效的属性,在此再调用一次.暂时这么解决 - [_mapView updateMapOptions]; - } - if (!_channel) return; - [_channel invokeMethod:kBMFMapDidLoadCallback arguments:@{@"success": @YES} result:nil]; -} -/// 地图渲染完成 -- (void)mapViewDidFinishRendering:(BMKMapView *)mapView{ - if (!_channel) return; - [_channel invokeMethod:kBMFMapDidRenderCallback arguments:@{@"success": @YES} result:nil]; -} - -/// 地图渲染每一帧画面过程中,以及每次需要重绘地图时(例如添加覆盖物)都会调用此接口 -- (void)mapView:(BMKMapView *)mapView onDrawMapFrame:(BMKMapStatus*)status{ - if (!_channel) return; - BMFMapStatusModel *mapStatus = [BMFMapStatusModel fromMapStatus:status]; - [_channel invokeMethod:kBMFMapOnDrawMapFrameCallback - arguments:@{@"mapStatus": [mapStatus bmf_toDictionary]} - result:nil]; - -} - -/// 地图区域即将改变时会调用此接口 -- (void)mapView:(BMKMapView *)mapView regionWillChangeAnimated:(BOOL)animated{ - if (!_channel) return; - BMFMapStatusModel *mapStatus = [BMFMapStatusModel fromMapStatus:[_mapView getMapStatus]]; - [_channel invokeMethod:kBMFMapRegionWillChangeCallback - arguments:@{@"mapStatus": [mapStatus bmf_toDictionary]} - result:nil]; -} - -/// 地图区域即将改变时会调用此接口 -- (void)mapView:(BMKMapView *)mapView regionWillChangeAnimated:(BOOL)animated reason:(BMKRegionChangeReason)reason{ - if (!_channel) return; - BMFMapStatusModel *mapStatus = [BMFMapStatusModel fromMapStatus:[_mapView getMapStatus]]; - [_channel invokeMethod:kBMFMapRegionWillChangeWithReasonCallback - arguments:@{@"mapStatus": [mapStatus bmf_toDictionary], @"reason": @(reason)} - result:nil]; -} - -/// 地图区域改变完成后会调用此接口 -- (void)mapView:(BMKMapView *)mapView regionDidChangeAnimated:(BOOL)animated{ - if (!_channel) return; - BMFMapStatusModel *mapStatus = [BMFMapStatusModel fromMapStatus:[_mapView getMapStatus]]; - [_channel invokeMethod:kBMFMapRegionDidChangeCallback - arguments:@{@"mapStatus": [mapStatus bmf_toDictionary]} - result:nil]; -} - -/// 地图区域改变完成后会调用此接口 -- (void)mapView:(BMKMapView *)mapView regionDidChangeAnimated:(BOOL)animated reason:(BMKRegionChangeReason)reason{ - if (!_channel) return; - BMFMapStatusModel *mapStatus = [BMFMapStatusModel fromMapStatus:[_mapView getMapStatus]]; - [_channel invokeMethod:kBMFMapRegionDidChangeWithReasonCallback - arguments:@{@"mapStatus": [mapStatus bmf_toDictionary], @"reason": @(reason)} - result:nil]; -} -/// 点中底图标注后会回调此接口 -- (void)mapView:(BMKMapView *)mapView onClickedMapPoi:(BMKMapPoi *)mapPoi{ - if (!_channel) return; - BMFMapPoiModel *model = [BMFMapPoiModel fromBMKMapPoi:mapPoi]; - [_channel invokeMethod:kBMFMapOnClickedMapPoiCallback arguments:@{@"poi": [model bmf_toDictionary]} result:nil]; -} -/// 点中底图空白处会回调此接口 -- (void)mapView:(BMKMapView *)mapView onClickedMapBlank:(CLLocationCoordinate2D)coordinate{ - if (!_channel) return; - BMFCoordinate *coord = [BMFCoordinate fromCLLocationCoordinate2D:coordinate]; - [_channel invokeMethod:kBMFMapOnClickedMapBlankCallback arguments:@{@"coord": [coord bmf_toDictionary]} result:nil]; -} - -/// 双击地图时会回调此接口 -- (void)mapview:(BMKMapView *)mapView onDoubleClick:(CLLocationCoordinate2D)coordinate{ - if (!_channel) return; - BMFCoordinate *coord = [BMFCoordinate fromCLLocationCoordinate2D:coordinate]; - [_channel invokeMethod:kBMFMapOnDoubleClickCallback arguments:@{@"coord": [coord bmf_toDictionary]} result:nil]; -} - -/// 长按地图时会回调此接口 -- (void)mapview:(BMKMapView *)mapView onLongClick:(CLLocationCoordinate2D)coordinate{ - if (!_channel) return; - BMFCoordinate *coord = [BMFCoordinate fromCLLocationCoordinate2D:coordinate]; - [_channel invokeMethod:kBMFMapOnLongClickCallback arguments:@{@"coord": [coord bmf_toDictionary]} result:nil]; -} - -/// 3DTouch 按地图时会回调此接口(仅在支持3D Touch,且fouchTouchEnabled属性为YES时,会回调此接口) -/// force 触摸该点的力度(参考UITouch的force属性) -/// maximumPossibleForce 当前输入机制下的最大可能力度(参考UITouch的maximumPossibleForce属性) -- (void)mapview:(BMKMapView *)mapView onForceTouch:(CLLocationCoordinate2D)coordinate force:(CGFloat)force maximumPossibleForce:(CGFloat)maximumPossibleForce{ - if (!_channel) return; - BMFCoordinate *coord = [BMFCoordinate fromCLLocationCoordinate2D:coordinate]; - [_channel invokeMethod:kBMFMapOnForceTouchCallback arguments:@{@"coord": [coord bmf_toDictionary], @"force": @(force), @"maximumPossibleForce": @(maximumPossibleForce)} result:nil]; -} - -///地图状态改变完成后会调用此接口 -- (void)mapStatusDidChanged:(BMKMapView *)mapView{ - if (!_channel) return; - [_channel invokeMethod:kBMFMapStatusDidChangedCallback arguments:nil result:nil]; -} - -- (void)mapview:(BMKMapView *)mapView baseIndoorMapWithIn:(BOOL)flag baseIndoorMapInfo:(BMKBaseIndoorMapInfo *)info{ - if (!_channel) return; - BMFIndoorMapInfoModel *model = [BMFIndoorMapInfoModel new]; - model.strID = info.strID; - model.strFloor = info.strFloor; - model.listStrFloors = info.arrStrFloors; - [_channel invokeMethod:kBMFMapInOrOutBaseIndoorMapCallback arguments:@{@"flag": @(flag), @"info": [model bmf_toDictionary]} result:nil]; -} -#pragma mark - annotationView -- (BMFAnnotationModel *)annotationModelfromAnnotionView:(BMKAnnotationView *)view{ - BMFAnnotationModel *model = [BMFAnnotationModel new]; - BMKPointAnnotation *an = (BMKPointAnnotation *)view.annotation; - model.Id = an.Id; - model.title = an.title; - model.subtitle = an.subtitle; - model.position = [BMFCoordinate fromCLLocationCoordinate2D:an.coordinate]; - model.isLockedToScreen = an.isLockedToScreen; - model.screenPointToLock = [BMFMapPoint fromCGPoint:an.screenPointToLock]; - model.annotationViewOptions = an.annotationViewOptions; - return model; -} -/// 根据anntation生成对应的View -- (BMKAnnotationView *)mapView:(BMKMapView *)mapView viewForAnnotation:(id)annotation{ - if ([annotation isKindOfClass:[BMKPointAnnotation class]]) { - BMFAnnotationViewOptions *options =((BMKPointAnnotation *)annotation).annotationViewOptions; - NSString *identifier = options.identifier ? options.identifier : NSStringFromClass([BMKPointAnnotation class]); - BMKPinAnnotationView *annotationView = (BMKPinAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:identifier]; - - if (!annotationView) { - annotationView = [[BMKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:identifier]; - } - - if (options.icon) { - //TODO:image加入空值判断 - if ([[options.icon substringToIndex:1] isEqualToString:@"/"]) { - annotationView.image = [UIImage imageWithData:[NSData dataWithContentsOfFile:options.icon] scale:[[UIScreen mainScreen] scale]]; - } else { - annotationView.image = [UIImage imageWithContentsOfFile:[[BMFFileManager defaultCenter] pathForFlutterImageName:options.icon]]; - } - } - - if (options.centerOffset) { - annotationView.centerOffset = [options.centerOffset toCGPoint]; - } - annotationView.selected = options.selected; - annotationView.draggable = options.draggable; - annotationView.enabled = options.enabled; - annotationView.enabled3D = options.enabled3D; - - return annotationView; - } - return nil; -} - -/// 当mapView新添加annotation views时,调用此接口 -- (void)mapView:(BMKMapView *)mapView didAddAnnotationViews:(NSArray *)views{ - if (!_channel) return; -} - -/// 每次点击BMKAnnotationView都会回调此接口。 -- (void)mapView:(BMKMapView *)mapView clickAnnotationView:(BMKAnnotationView *)view{ - if (!_channel) return; - if ([view isKindOfClass:NSClassFromString(@"BMKUserLocationView")]) { - return; - } - // 改为回调id - BMFAnnotationModel *model = [self annotationModelfromAnnotionView:view]; - [_channel invokeMethod:kBMFMapClickedMarkerCallback arguments:@{@"id": model.Id} result:^(id _Nullable result) { - - }]; -} -/// 当选中一个annotation views时,调用此接口 -/// @param mapView 地图View -/// @param view 选中的annotation views -- (void)mapView:(BMKMapView *)mapView didSelectAnnotationView:(BMKAnnotationView *)view{ - if (!_channel) return; - if ([view isKindOfClass:NSClassFromString(@"BMKUserLocationView")]) { - return; - } - // 改为回调id - BMFAnnotationModel *model = [self annotationModelfromAnnotionView:view]; - [_channel invokeMethod:kBMFMapDidSelectMarkerCallback arguments:@{@"id": model.Id} result:nil]; -} - -/// 当取消选中一个annotationView时,调用此接口 -- (void)mapView:(BMKMapView *)mapView didDeselectAnnotationView:(BMKAnnotationView *)view{ - if (!_channel) return; - // 改为回调id - BMFAnnotationModel *model = [self annotationModelfromAnnotionView:view]; - [_channel invokeMethod:kBMFMapDidDeselectMarkerCallback arguments:@{@"id": model.Id} result:nil]; -} - -/// 拖动annotation view时,若view的状态发生变化,会调用此函数。ios3.2以后支持 -- (void)mapView:(BMKMapView *)mapView annotationView:(BMKAnnotationView *)view didChangeDragState:(BMKAnnotationViewDragState)newState - fromOldState:(BMKAnnotationViewDragState)oldState{ - if (!_channel) return; - // 改为回调id - BMFAnnotationModel *model = [self annotationModelfromAnnotionView:view]; - [_channel invokeMethod:kBMFMapDidDragMarkerCallback arguments:@{@"id": model.Id} result:nil]; - -} - -/// 当点击annotationView的泡泡view时,调用此接口 -- (void)mapView:(BMKMapView *)mapView annotationViewForBubble:(BMKAnnotationView *)view{ - if (!_channel) return; - // 改为回调id - BMFAnnotationModel *model = [self annotationModelfromAnnotionView:view]; - [_channel invokeMethod:kBMFMapDidClickedPaoPaoCallback arguments:@{@"id": model.Id} result:nil]; -} -#pragma mark - overlayView - -- (BMFPolylineModel *)polylineModelWith:(BMKPolylineView *)view{ - BMFPolylineModel *model = [BMFPolylineModel new]; - BMKPolyline *line = view.polyline; - model = line.polylineModel; - return model; -} -- (BMKPolylineView *)viewForPolyline:(BMKPolyline *)polyline{ - BMFPolylineViewOptions *options = polyline.polylineModel.polylineOptions; - BMKPolylineView *polylineView = [[BMKPolylineView alloc] initWithPolyline:polyline]; - polylineView.lineWidth = options.width; - polylineView.lineDashType = options.lineDashType; - polylineView.lineCapType = options.lineCapType; - polylineView.lineJoinType = options.lineJoinType; - - switch (polyline.lineType) { - case kBMFDashLine: - case kBMFColorLine:{ - if ([options.colors firstObject]) { - polylineView.strokeColor = [UIColor fromColorString:[options.colors firstObject]]; - } else { - // TODO:strokeColor 默认值 - } - break; - } - case kBMFMultiDashLine: - case kBMFColorsLine:{ - size_t colorsCount = options.colors.count; - NSMutableArray *colors = [NSMutableArray array]; - for (size_t i = 0; i < colorsCount; i++) { - // TODO:colors加入空值判断 - [colors addObject:[UIColor fromColorString:options.colors[i]]]; - } - polylineView.colors = colors; - break; - } - case kBMFTextureLine:{ - // TODO:iamge加入空值判断 - NSString *imagePath = [[BMFFileManager defaultCenter] pathForFlutterImageName:[options.textures firstObject]]; - [polylineView loadStrokeTextureImage:[UIImage imageWithContentsOfFile:imagePath]]; - break; - } - case kBMFTexturesLine:{ - NSMutableArray *images = [NSMutableArray array]; - size_t imagesCount = options.textures.count; - NSString *imagePath = nil; - for (size_t i = 0; i < imagesCount; i++) { - //TODO:image加入空值判断 - imagePath = options.textures[i]; - UIImage *image = [UIImage imageWithContentsOfFile:[[BMFFileManager defaultCenter] pathForFlutterImageName:imagePath]]; - [images addObject:image]; - } - [polylineView loadStrokeTextureImages:images]; - break; - } - default: - break; - } - - return polylineView; -} - -- (BMKArclineView *)viewForArcline:(BMKArcline *)arcline{ - BMFArclineViewOptions *options = arcline.arclineViewOptions; - BMKArclineView *arclineView = [[BMKArclineView alloc] initWithArcline:arcline]; - if (options.color) { - arclineView.strokeColor = [UIColor fromColorString:options.color]; - } else { - arclineView.strokeColor = [UIColor colorWithRed:0.f green:0.f blue:1.f alpha:1.f]; - } - arclineView.lineWidth = options.width; - arclineView.lineDashType = options.lineDashType; - return arclineView; -} - -- (BMKPolygonView *)viewForPolygon:(BMKPolygon *)polygon{ - BMFPolygonViewOptions *options = polygon.polygonViewOptions; - BMKPolygonView *polygonView = [[BMKPolygonView alloc] initWithPolygon:polygon]; - if (options.strokeColor) { - polygonView.strokeColor = [UIColor fromColorString:options.strokeColor]; - } else { - polygonView.strokeColor = [UIColor colorWithRed:0.f green:0.f blue:1.f alpha:1.f]; - } - if (options.fillColor) { - polygonView.fillColor = [UIColor fromColorString:options.fillColor]; - } - polygonView.lineWidth = options.width; - polygonView.lineDashType = options.lineDashType; - return polygonView; -} - -- (BMKCircleView *)viewForCircleline:(BMKCircle *)circle{ - BMFCircleViewOptions *options = circle.circleViewOptions; - BMKCircleView *circleView = [[BMKCircleView alloc] initWithCircle:circle]; - if (options.strokeColor) { - circleView.strokeColor = [UIColor fromColorString:options.strokeColor]; - } else { - circleView.strokeColor = [UIColor colorWithRed:0.f green:0.f blue:1.f alpha:1.f]; - } - if (options.fillColor) { - circleView.fillColor = [UIColor fromColorString:options.fillColor]; - } - circleView.lineWidth = options.width; - circleView.lineDashType = options.lineDashType; - return circleView; -} -- (BMKOverlayView *)mapView:(BMKMapView *)mapView viewForOverlay:(id)overlay{ - if ([overlay isKindOfClass:[BMKPolyline class]]) { - return [self viewForPolyline:(BMKPolyline *)overlay]; - - } else if ([overlay isKindOfClass:[BMKArcline class]]) { - return [self viewForArcline:(BMKArcline *)overlay]; - - } else if ([overlay isKindOfClass:[BMKPolygon class]]){ - return [self viewForPolygon:(BMKPolygon *)overlay]; - - } else if ([overlay isKindOfClass:[BMKCircle class]]) { - return [self viewForCircleline:(BMKCircle *)overlay]; - - } else if ([overlay isKindOfClass:[BMKTileLayer class]]){ - return [[BMKTileLayerView alloc] initWithTileLayer:overlay]; - - } else if ([overlay isKindOfClass:[BMKGroundOverlay class]]) { - return [[BMKGroundOverlayView alloc] initWithGroundOverlay:overlay]; - } - - return nil; -} -/** - *当mapView新添加overlay views时,调用此接口 - *@param mapView 地图View - *@param overlayViews 新添加的overlay views - */ -- (void)mapView:(BMKMapView *)mapView didAddOverlayViews:(NSArray *)overlayViews{ - if (!_channel) return; - - //TODO:didAddOverlayViews -} -/** -*点中覆盖物后会回调此接口,目前只支持点中BMKPolylineView时回调 -*@param mapView 地图View -*@param overlayView 覆盖物view信息 -*/ --(void)mapView:(BMKMapView *)mapView onClickedBMKOverlayView:(BMKOverlayView *)overlayView{ - if (!_channel) return; - - if ([overlayView isKindOfClass:[BMKPolylineView class]]) { - BMFPolylineModel *model = [self polylineModelWith:(BMKPolylineView *)overlayView]; -// NSLog(@"%@", [model bmf_toDictionary]); - // 暂时只传id - [_channel invokeMethod:kMapOnClickedOverlayCallback arguments:@{@"polyline": @{@"id" :model.Id}} result:nil]; - } -} -@end - -@interface FlutterMapViewFactory() -{ - NSObject *_messenger; -} -@end -@implementation FlutterMapViewFactory -- (instancetype)initWithMessenger:(NSObject *)messager{ - if ([super init]) { - _messenger = messager; - } - return self; -} - -- (NSObject *)createArgsCodec{ - return [FlutterStandardMessageCodec sharedInstance]; -} - -- (NSObject *)createWithFrame:(CGRect)frame viewIdentifier:(int64_t)viewId arguments:(id)args{ - BMFMapViewController *mapViewController = [[BMFMapViewController alloc] initWithWithFrame:frame viewIdentifier:viewId arguments:args binaryMessenger:_messenger]; - return mapViewController; -} - - -@end diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/BMFMapViewHandle.h b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/BMFMapViewHandle.h deleted file mode 100644 index 520f8e6..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/BMFMapViewHandle.h +++ /dev/null @@ -1,29 +0,0 @@ -// -// BMFMapViewHandle.h -// flutter_bmfmap -// -// Created by zbj on 2020/2/11. -// - -#import - -@class BMFMapView; - -NS_ASSUME_NONNULL_BEGIN - -@protocol BMFMapViewHandler - -@required - -/// mapView (弱引用) -@property(nonatomic, weak) BMFMapView *_mapView; - -/// 创建协议实例 -- (NSObject *)initWith:(BMFMapView *)mapView; - -/// flutter --> ios -- (void)handleMethodCall:(FlutterMethodCall *)call result:(FlutterResult)result; - -@end - -NS_ASSUME_NONNULL_END diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/BMFMapViewHandles.h b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/BMFMapViewHandles.h deleted file mode 100644 index 6b836f1..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/BMFMapViewHandles.h +++ /dev/null @@ -1,197 +0,0 @@ -// -// BMFMapViewHandles.h -// flutter_bmfmap -// -// Created by zbj on 2020/2/11. -// - -#import "BMFMapViewHandle.h" - -NS_ASSUME_NONNULL_BEGIN -@interface BMFMapViewHandles : NSObject - -/// BMFMapViewHandler管理中心 -+ (instancetype)defalutCenter; - -- (NSDictionary *)mapViewHandles; - -@end - -#pragma mark - map - -@interface BMFUpdateMap : NSObject - -@end - -@interface BMFShowBaseIndoorMap : NSObject - -@end - -@interface BMFShowBaseIndoorMapPoi : NSObject - -@end - -@interface BMFSwitchBaseIndoorMapFloor : NSObject - -@end - -@interface BMFGetFocusedBaseIndoorMapInfo : NSObject - -@end - -@interface BMFSetCustomMapStyleEnable : NSObject - -@end - -@interface BMFSetCustomMapStylePath : NSObject - -@end - -@interface BMFSetCustomMapStyleWithOption : NSObject - -@end - -@interface BMFZoomIn : NSObject - -@end - -@interface BMFZoomOut : NSObject - -@end - -@interface BMFSetCustomTrafficColor : NSObject - -@end - -@interface BMFSetCenterCoordinate : NSObject - -@end - -@interface BMFTakeSnapshot : NSObject - -@end - -@interface BMFTakeSnapshotWithRect : NSObject - -@end - -@interface BMFSetCompassImage : NSObject - -@end - -@interface BMFSetVisibleMapBounds : NSObject - -@end - -@interface BMFSetVisibleMapBoundsWithPadding : NSObject - -@end - - -@interface BMFSetMapStatus : NSObject - -@end - -#pragma mark - Get - -@interface BMFGetMapStatus : NSObject - -@end - -@interface BMFGetMapType : NSObject - -@end - -@interface BMFGetZoomLevel : NSObject - -@end - -@interface BMFGetMinZoomLevel : NSObject - -@end - -@interface BMFGetMaxZoomLevel : NSObject - -@end - -@interface BMFGetRotation : NSObject - -@end - -@interface BMFGetOverlooking : NSObject - -@end - - -@interface BMFGetMinOverlooking : NSObject - -@end - -@interface BMFGetBuildingsEnabled : NSObject - -@end - -@interface BMFGetShowMapPoi : NSObject - -@end - -@interface BMFGetTrafficEnabled : NSObject - -@end - -@interface BMFGetBaiduHeatMapEnabled : NSObject - -@end - -@interface BMFGetGesturesEnabled : NSObject - -@end - -@interface BMFGetZoomEnabled : NSObject - -@end - -@interface BMFGetZoomEnabledWithTap : NSObject - -@end - -@interface BMFGetScrollEnabled : NSObject - -@end - -@interface BMFGetOverlookEnabled : NSObject - -@end - -@interface BMFGetRotateEnabled : NSObject - -@end - -@interface BMFGetForceTouchEnabled : NSObject - -@end - -@interface BMFGetShowMapScaleBar : NSObject - -@end - -@interface BMFGetMapScaleBarPosition : NSObject - -@end - -@interface BMFGetLogoPosition : NSObject - -@end - -@interface BMFGetVisibleMapBounds : NSObject - -@end - -@interface BMFGetBaseIndoorMapEnabled : NSObject - -@end - -@interface BMFGetShowIndoorMapPoi : NSObject - -@end -NS_ASSUME_NONNULL_END diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/BMFMapViewHandles.m b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/BMFMapViewHandles.m deleted file mode 100644 index 110cbb8..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/BMFMapViewHandles.m +++ /dev/null @@ -1,886 +0,0 @@ -// -// BMFMapViewHandles.m -// flutter_bmfmap -// -// Created by zbj on 2020/2/11. -// - -#import "BMFMapViewHandles.h" -#import "BMFMapView.h" -#import "BMFMapMethodConst.h" -#import "BMFAnnotationMethodConst.h" -#import "BMFFileManager.h" -#import "UIColor+BMFString.h" -#import "BMFMapModels.h" -#import "BMFEdgeInsets.h" -#import "BMFIndoorMapInfoModel.h" -#import "BMFMapStatusModel.h" - -@interface BMFMapViewHandles () -{ - NSDictionary *_handles; -} -@end - -@implementation BMFMapViewHandles - -static BMFMapViewHandles *_instance = nil; -+ (instancetype)defalutCenter{ - if (!_instance) { - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - _instance = [[BMFMapViewHandles alloc] init]; - }); - } - return _instance; -} -- (NSDictionary *)mapViewHandles{ - if (!_handles) { - _handles = @{ - kBMFMapUpdateMethod: NSStringFromClass([BMFUpdateMap class]), - kBMFMapShowBaseIndoorMapMethod: NSStringFromClass([BMFShowBaseIndoorMap class]), - kBMFMapShowBaseIndoorMapPoiMethod: NSStringFromClass([BMFShowBaseIndoorMapPoi class]), - kBMFMapSwitchBaseIndoorMapFloorMethod: NSStringFromClass([BMFSwitchBaseIndoorMapFloor class]), - kBMFMapGetFocusedBaseIndoorMapInfoMethod: NSStringFromClass([BMFGetFocusedBaseIndoorMapInfo class]), - kBMFMapSetCustomMapStyleEnableMethod: NSStringFromClass([BMFSetCustomMapStyleEnable class]), - kBMFMapSetCustomMapStylePathMethod: NSStringFromClass([BMFSetCustomMapStylePath class]), - kBMFMapSetCustomMapStyleWithOptionMethod: NSStringFromClass([BMFSetCustomMapStyleWithOption class]), - kBMFMapZoomInMethod: NSStringFromClass([BMFZoomIn class]), - kBMFMapZoomOutMethod: NSStringFromClass([BMFZoomOut class]), - kBMFMapSetCustomTrafficColorMethod: NSStringFromClass([BMFSetCustomTrafficColor class]), - kBMFMapSetCenterCoordinateMethod: NSStringFromClass([BMFSetCenterCoordinate class]), - kBMFMapTakeSnapshotMethod: NSStringFromClass([BMFTakeSnapshot class]), - kBMFMapTakeSnapshotWithRectMethod: NSStringFromClass([BMFTakeSnapshotWithRect class]), - kBMFMapSetCompassImageMethod: NSStringFromClass([BMFSetCompassImage class]), - kBMFMapSetVisibleMapBoundsMethod: NSStringFromClass([BMFSetVisibleMapBounds class]), - kBMFMapSetVisibleMapBoundsWithPaddingMethod: NSStringFromClass([BMFSetVisibleMapBoundsWithPadding class]), - kBMFMapSetMapStatusMethod: NSStringFromClass([BMFSetMapStatus class]), - kBMFMapGetMapStatusMethod: NSStringFromClass([BMFGetMapStatus class]), - kBMFMapGetMapTypeMethod: NSStringFromClass([BMFGetMapType class]), - kBMFMapGetZoomLevelMethod: NSStringFromClass([BMFGetZoomLevel class]), - kBMFMapGetMinZoomLevelMethod: NSStringFromClass([BMFGetMinZoomLevel class]), - kBMFMapGetMaxZoomLevelMethod: NSStringFromClass([BMFGetMaxZoomLevel class]), - kBMFMapGetRotationMethod: NSStringFromClass([BMFGetRotation class]), - kBMFMapGetOverlookingMethod: NSStringFromClass([BMFGetOverlooking class]), - kBMFMapGetMinOverlookingMethod: NSStringFromClass([BMFGetMinOverlooking class]), - kBMFMapGetBuildingsEnabledMethod: NSStringFromClass([BMFGetBuildingsEnabled class]), - kBMFMapGetShowMapPoiMethod: NSStringFromClass([BMFGetShowMapPoi class]), - kBMFMapGetTrafficEnabledMethod: NSStringFromClass([BMFGetTrafficEnabled class]), - kBMFMapGetBaiduHeatMapEnabledMethod: NSStringFromClass([BMFGetBaiduHeatMapEnabled class]), - kBMFMapGetGesturesEnabledMethod: NSStringFromClass([BMFGetGesturesEnabled class]), - kBMFMapGetZoomEnabledMethod: NSStringFromClass([BMFGetZoomEnabled class]), - kBMFMapGetZoomEnabledWithTapMethod: NSStringFromClass([BMFGetZoomEnabledWithTap class]), - kBMFMapGetScrollEnabledMethod: NSStringFromClass([BMFGetScrollEnabled class]), - kBMFMapGetOverlookEnabledMethod: NSStringFromClass([BMFGetOverlookEnabled class]), - kBMFMapGetRotateEnabledMethod: NSStringFromClass([BMFGetRotateEnabled class]), - kBMFMapGetForceTouchEnabledMethod: NSStringFromClass([BMFGetForceTouchEnabled class]), - kBMFMapGetShowMapScaleBarMethod: NSStringFromClass([BMFGetShowMapScaleBar class]), - kBMFMapGetMapScaleBarPositionMethod: NSStringFromClass([BMFGetMapScaleBarPosition class]), - kBMFMapGetLogoPositionMethod: NSStringFromClass([BMFGetLogoPosition class]), - kBMFMapGetVisibleMapBoundsMethod: NSStringFromClass([BMFGetVisibleMapBounds class]), - kBMFMapGetBaseIndoorMapEnabledMethod: NSStringFromClass([BMFGetBaseIndoorMapEnabled class]), - kBMFMapGetShowIndoorMapPoiMethod: NSStringFromClass([BMFGetShowIndoorMapPoi class]) - - }; - } - return _handles; -} - -@end - -#pragma mark - map - -@implementation BMFUpdateMap - -@synthesize _mapView; - -- (nonnull NSObject *)initWith:(nonnull BMFMapView *)mapView { - _mapView = mapView; - return self; -} - -- (void)handleMethodCall:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult)result { - if (!call.arguments) { - result(@NO); - return; - } - BOOL success = [_mapView updateMapViewWith:call.arguments]; - result(@(success)); -} - -@end - -@implementation BMFShowBaseIndoorMap - -@synthesize _mapView; - -- (nonnull NSObject *)initWith:(nonnull BMFMapView *)mapView { - _mapView = mapView; - return self; -} - -- (void)handleMethodCall:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult)result { - if (!call.arguments) { - result(@NO); - return; - } - _mapView.baseIndoorMapEnabled = [[call.arguments safeValueForKey:@"show"] boolValue]; - [_mapView setMapStatus:[_mapView getMapStatus]]; - result(@YES); -} - -@end - -@implementation BMFShowBaseIndoorMapPoi - -@synthesize _mapView; - -- (nonnull NSObject *)initWith:(nonnull BMFMapView *)mapView { - _mapView = mapView; - return self; -} - -- (void)handleMethodCall:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult)result { - if (!call.arguments || !_mapView.baseIndoorMapEnabled) { - result(@NO); - return; - } - _mapView.showIndoorMapPoi = [[call.arguments safeValueForKey:@"showIndoorPoi"] boolValue]; - result(@YES); -} - -@end - -@implementation BMFSwitchBaseIndoorMapFloor - -@synthesize _mapView; - -- (nonnull NSObject *)initWith:(nonnull BMFMapView *)mapView { - _mapView = mapView; - return self; -} - -- (void)handleMethodCall:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult)result { - BMKSwitchIndoorFloorError error; - if (!call.arguments || !call.arguments[@"floorId"] || !call.arguments[@"indoorId"] || !_mapView.baseIndoorMapEnabled) { - error = BMKSwitchIndoorFloorFailed; - result(@{@"result":@(error)}); - return; - } - - error = [_mapView switchBaseIndoorMapFloor:[call.arguments safeValueForKey:@"floorId"] withID:[call.arguments safeValueForKey:@"indoorId"]]; - result(@{@"result":@(error)}); -} - -@end - -@implementation BMFGetFocusedBaseIndoorMapInfo - -@synthesize _mapView; - -- (nonnull NSObject *)initWith:(nonnull BMFMapView *)mapView { - _mapView = mapView; - return self; -} - -- (void)handleMethodCall:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult)result { - if (!_mapView.baseIndoorMapEnabled) { - result(@{@"result": [NSNull null]}); - return; - } - BMKBaseIndoorMapInfo *info = [_mapView getFocusedBaseIndoorMapInfo]; - BMFIndoorMapInfoModel *model = [BMFIndoorMapInfoModel new]; - model.strID = info.strID; - model.strFloor = info.strFloor; - model.listStrFloors = info.arrStrFloors; - result([model bmf_toDictionary]); -} - -@end - -@implementation BMFSetCustomMapStyleEnable - -@synthesize _mapView; - -- (nonnull NSObject *)initWith:(nonnull BMFMapView *)mapView { - _mapView = mapView; - return self; -} - -- (void)handleMethodCall:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult)result { - if (!call.arguments) { - result(@NO); - return; - } - [_mapView setCustomMapStyleEnable:[[call.arguments safeValueForKey:@"enable"] boolValue]]; - result(@YES); -} - -@end - -@implementation BMFSetCustomMapStylePath - -@synthesize _mapView; - -- (nonnull NSObject *)initWith:(nonnull BMFMapView *)mapView { - _mapView = mapView; - return self; -} - -- (void)handleMethodCall:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult)result { - if (!call.arguments) { - result(@NO); - return; - } - NSString *path = [[BMFFileManager defaultCenter] pathForFlutterFileName:[call.arguments safeValueForKey:@"path"]]; - [_mapView setCustomMapStylePath:path mode:[[call.arguments safeValueForKey:@"mode"] intValue]]; - result(@YES); -} -@end - -@implementation BMFSetCustomMapStyleWithOption - -@synthesize _mapView; - -- (nonnull NSObject *)initWith:(nonnull BMFMapView *)mapView { - _mapView = mapView; - return self; -} - -- (void)handleMethodCall:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult)result { - if (!call.arguments) { - result(@NO); - return; - } - BMKCustomMapStyleOption *options = [BMKCustomMapStyleOption new]; - options.customMapStyleID = [[call.arguments safeObjectForKey:@"customMapStyleOption"] safeValueForKey:@"customMapStyleID"]; - NSString *localPath = [[call.arguments safeObjectForKey:@"customMapStyleOption"] safeValueForKey:@"customMapStyleFilePath"]; - if (localPath && localPath.length > 0) { - options.customMapStyleFilePath = [[BMFFileManager defaultCenter] pathForFlutterFileName:localPath]; - } - [_mapView setCustomMapStyleWithOption:options preLoad:^(NSString *path) { - if (path) { - result(@{@"preloadPath": path}); - } - } success:^(NSString *path) { - if (path) { - result(@{@"successPath": path}); - } - } failure:^(NSError *error, NSString *path) { - if (error) { - result(@{@"errorCode": @(error.code), @"errorPath": path ? path : [NSNull null]}); - } -// NSLog(@"failure-error=%@,path=%@", error, path); - }]; - -} - -@end - -@implementation BMFZoomIn - -@synthesize _mapView; - -- (nonnull NSObject *)initWith:(nonnull BMFMapView *)mapView { - _mapView = mapView; - return self; -} - -- (void)handleMethodCall:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult)result { - BOOL flag = [_mapView zoomIn]; - result(@(flag)); -} - -@end - -@implementation BMFZoomOut - -@synthesize _mapView; - -- (nonnull NSObject *)initWith:(nonnull BMFMapView *)mapView { - _mapView = mapView; - return self; -} - -- (void)handleMethodCall:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult)result { - BOOL flag = [_mapView zoomOut]; - result(@(flag)); -} - -@end - -@implementation BMFSetCustomTrafficColor - -@synthesize _mapView; - -- (nonnull NSObject *)initWith:(nonnull BMFMapView *)mapView { - _mapView = mapView; - return self; -} - -- (void)handleMethodCall:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult)result { - if (!call.arguments) { - result(@NO); - return; - } - UIColor *smooth = [UIColor fromColorString:[call.arguments safeValueForKey:@"smooth"]]; - UIColor *slow = [UIColor fromColorString:[call.arguments safeValueForKey:@"slow"]]; - UIColor *congestion = [UIColor fromColorString:[call.arguments safeValueForKey:@"congestion"]]; - UIColor *severeCongestion = [UIColor fromColorString:[call.arguments safeValueForKey:@"severeCongestion"]]; - if (smooth && slow && congestion && severeCongestion) { - BOOL flag = [_mapView setCustomTrafficColorForSmooth:smooth slow:slow congestion:congestion severeCongestion:severeCongestion]; - result(@(flag)); - return; - } else { - result(@NO); - } -} -@end - -@implementation BMFSetCenterCoordinate - -@synthesize _mapView; - -- (nonnull NSObject *)initWith:(nonnull BMFMapView *)mapView { - _mapView = mapView; - return self; -} - -- (void)handleMethodCall:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult)result { - if (!call.arguments) { - result(@NO); - return; - } - BMFCoordinate *coordinate = [BMFCoordinate bmf_modelWith:[call.arguments safeObjectForKey:@"coordinate"]]; - if (coordinate) { - [_mapView setCenterCoordinate:[coordinate toCLLocationCoordinate2D] animated:[[call.arguments safeValueForKey:@"animated"] boolValue]]; - result(@YES); - return; - } else { - result(@NO); - } -} -@end - -@implementation BMFTakeSnapshot - -@synthesize _mapView; - -- (nonnull NSObject *)initWith:(nonnull BMFMapView *)mapView { - _mapView = mapView; - return self; -} - -- (void)handleMethodCall:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult)result { - UIImage *image = [_mapView takeSnapshot]; - if (!image) { - result(@[]); - return; - } - NSData *data = UIImageJPEGRepresentation(image, 100); - FlutterStandardTypedData *fData = [FlutterStandardTypedData typedDataWithBytes:data]; - result(fData); -} - -@end - -@implementation BMFTakeSnapshotWithRect - -@synthesize _mapView; - -- (nonnull NSObject *)initWith:(nonnull BMFMapView *)mapView { - _mapView = mapView; - return self; -} - -- (void)handleMethodCall:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult)result { - if (!call.arguments || !call.arguments[@"rect"]) { - result(@[]); - return; - } - - CGRect rect = [[BMFMapRect bmf_modelWith:[call.arguments safeObjectForKey:@"rect"]] toCGRect]; - UIImage *image = [_mapView takeSnapshot:rect]; - if (!image) { - result(@[]); - return; - } - NSData *data = UIImageJPEGRepresentation(image, 100); - FlutterStandardTypedData *fData = [FlutterStandardTypedData typedDataWithBytes:data]; - result(fData); -} - -@end - -@implementation BMFSetCompassImage - -@synthesize _mapView; - -- (nonnull NSObject *)initWith:(nonnull BMFMapView *)mapView { - _mapView = mapView; - return self; -} - -- (void)handleMethodCall:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult)result { - if (!call.arguments || !call.arguments[@"imagePath"]) { - result(@NO); - return; - } - UIImage *image = [UIImage imageWithContentsOfFile:[[BMFFileManager defaultCenter] pathForFlutterImageName:[call.arguments safeValueForKey:@"imagePath"]]]; - [_mapView setCompassImage:image]; - result(@YES); -} - -@end - -@implementation BMFSetVisibleMapBounds - -@synthesize _mapView; - -- (nonnull NSObject *)initWith:(nonnull BMFMapView *)mapView { - _mapView = mapView; - return self; -} - -- (void)handleMethodCall:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult)result { - if (!call.arguments || !call.arguments[@"visibleMapBounds"] || !call.arguments[@"animated"]) { - result(@NO); - return; - } - BMFCoordinateBounds *bounds = [BMFCoordinateBounds bmf_modelWith:[call.arguments safeObjectForKey:@"visibleMapBounds"]]; - [_mapView setVisibleMapRect:[bounds toBMKMapRect] animated:[[call.arguments safeValueForKey:@"animated"] boolValue]]; - result(@YES); -} - -@end - -@implementation BMFSetVisibleMapBoundsWithPadding - -@synthesize _mapView; - -- (nonnull NSObject *)initWith:(nonnull BMFMapView *)mapView { - _mapView = mapView; - return self; -} - -- (void)handleMethodCall:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult)result { - if (!call.arguments || !call.arguments[@"visibleMapBounds"] || !call.arguments[@"insets"] || !call.arguments[@"animated"]) { - result(@NO); - return; - } - BMFCoordinateBounds *bounds = [BMFCoordinateBounds bmf_modelWith:[call.arguments safeObjectForKey:@"visibleMapBounds"]]; - BMFEdgeInsets *insets = [BMFEdgeInsets bmf_modelWith:[call.arguments safeObjectForKey:@"insets"]]; - [_mapView setVisibleMapRect:[bounds toBMKMapRect] edgePadding:[insets toUIEdgeInsets] animated:[[call.arguments safeValueForKey:@"animated"] boolValue]]; - result(@YES); -} - -@end - - -@implementation BMFSetMapStatus - -@synthesize _mapView; - -- (nonnull NSObject *)initWith:(nonnull BMFMapView *)mapView { - _mapView = mapView; - return self; -} - -- (void)handleMethodCall:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult)result { - if (!call.arguments || !call.arguments[@"mapStatus"] || !call.arguments[@"animateDurationMs"] ) { - result(@NO); - return; - } - BMFMapStatusModel *status = [BMFMapStatusModel bmf_modelWith:[call.arguments safeObjectForKey:@"mapStatus"]]; - int animate = [[call.arguments safeValueForKey:@"animateDurationMs"] intValue]; - [_mapView setMapStatus:[status toMapStatus] withAnimation: animate!=0 ? YES : NO]; - result(@YES); -} - - - -@end - -#pragma mark - Get - -@implementation BMFGetMapStatus - -@synthesize _mapView; - -- (nonnull NSObject *)initWith:(nonnull BMFMapView *)mapView { - _mapView = mapView; - return self; -} - -- (void)handleMethodCall:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult)result { - BMFMapStatusModel *status = [BMFMapStatusModel fromMapStatus:[_mapView getMapStatus]]; - status ? result(@{@"mapStatus":[status bmf_toDictionary]}) : result(@{@"mapStatus":[NSNull null]}); -} - -@end - - -@implementation BMFGetMapType - -@synthesize _mapView; - -- (nonnull NSObject *)initWith:(nonnull BMFMapView *)mapView { - _mapView = mapView; - return self; -} - -- (void)handleMethodCall:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult)result { - result(@{@"mapType" : @(_mapView.mapType)}); -} - -@end - -@implementation BMFGetZoomLevel - -@synthesize _mapView; - -- (nonnull NSObject *)initWith:(nonnull BMFMapView *)mapView { - _mapView = mapView; - return self; -} - -- (void)handleMethodCall:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult)result { - - result(@{@"zoomLevel": @((int)_mapView.zoomLevel)}); -} - -@end - -@implementation BMFGetMinZoomLevel - -@synthesize _mapView; - -- (nonnull NSObject *)initWith:(nonnull BMFMapView *)mapView { - _mapView = mapView; - return self; -} - -- (void)handleMethodCall:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult)result { - result(@{@"minZoomLevel": @((int)_mapView.minZoomLevel)}); -} - -@end - -@implementation BMFGetMaxZoomLevel - -@synthesize _mapView; - -- (nonnull NSObject *)initWith:(nonnull BMFMapView *)mapView { - _mapView = mapView; - return self; -} - -- (void)handleMethodCall:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult)result { - result(@{@"maxZoomLevel" : @((int)_mapView.maxZoomLevel)}); -} - -@end - -@implementation BMFGetRotation - -@synthesize _mapView; - -- (nonnull NSObject *)initWith:(nonnull BMFMapView *)mapView { - _mapView = mapView; - return self; -} - -- (void)handleMethodCall:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult)result { - result(@{@"rotation" : @((float)_mapView.rotation)}); -} - -@end - -@implementation BMFGetOverlooking - -@synthesize _mapView; - -- (nonnull NSObject *)initWith:(nonnull BMFMapView *)mapView { - _mapView = mapView; - return self; -} - -- (void)handleMethodCall:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult)result { - result(@{@"overlooking": @((float)_mapView.overlooking)}); -} - -@end - -@implementation BMFGetMinOverlooking - -@synthesize _mapView; - -- (nonnull NSObject *)initWith:(nonnull BMFMapView *)mapView { - _mapView = mapView; - return self; -} - -- (void)handleMethodCall:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult)result { - result(@{@"minOverlooking" : @(_mapView.minOverlooking)}); -} - -@end - -@implementation BMFGetBuildingsEnabled - -@synthesize _mapView; - -- (nonnull NSObject *)initWith:(nonnull BMFMapView *)mapView { - _mapView = mapView; - return self; -} - -- (void)handleMethodCall:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult)result { - result(@{@"buildingsEnabled": @(_mapView.buildingsEnabled)}); -} - -@end - -@implementation BMFGetShowMapPoi - -@synthesize _mapView; - -- (nonnull NSObject *)initWith:(nonnull BMFMapView *)mapView { - _mapView = mapView; - return self; -} - -- (void)handleMethodCall:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult)result { - result(@{@"showMapPoi" : @(_mapView.showMapPoi)}); -} - -@end - -@implementation BMFGetTrafficEnabled - -@synthesize _mapView; - -- (nonnull NSObject *)initWith:(nonnull BMFMapView *)mapView { - _mapView = mapView; - return self; -} - -- (void)handleMethodCall:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult)result { - result(@{@"trafficEnabled": @(_mapView.trafficEnabled)}); -} - -@end - -@implementation BMFGetBaiduHeatMapEnabled - -@synthesize _mapView; - -- (nonnull NSObject *)initWith:(nonnull BMFMapView *)mapView { - _mapView = mapView; - return self; -} - -- (void)handleMethodCall:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult)result { - result(@{@"baiduHeatMapEnabled": @(_mapView.baiduHeatMapEnabled)}); -} - -@end - -@implementation BMFGetGesturesEnabled - -@synthesize _mapView; - -- (nonnull NSObject *)initWith:(nonnull BMFMapView *)mapView { - _mapView = mapView; - return self; -} - -- (void)handleMethodCall:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult)result { - result(@{@"gesturesEnabled" : @(_mapView.gesturesEnabled)}); -} - -@end - -@implementation BMFGetZoomEnabled - -@synthesize _mapView; - -- (nonnull NSObject *)initWith:(nonnull BMFMapView *)mapView { - _mapView = mapView; - return self; -} - -- (void)handleMethodCall:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult)result { - result(@{@"zoomEnabled": @(_mapView.zoomEnabled)}); -} - -@end - -@implementation BMFGetZoomEnabledWithTap - -@synthesize _mapView; - -- (nonnull NSObject *)initWith:(nonnull BMFMapView *)mapView { - _mapView = mapView; - return self; -} - -- (void)handleMethodCall:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult)result { - result(@{@"zoomEnabledWithTap" : @(_mapView.zoomEnabledWithTap)}); -} - -@end - -@implementation BMFGetScrollEnabled - -@synthesize _mapView; - -- (nonnull NSObject *)initWith:(nonnull BMFMapView *)mapView { - _mapView = mapView; - return self; -} - -- (void)handleMethodCall:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult)result { - result(@{@"scrollEnabled" : @(_mapView.scrollEnabled)}); -} - -@end - -@implementation BMFGetOverlookEnabled - -@synthesize _mapView; - -- (nonnull NSObject *)initWith:(nonnull BMFMapView *)mapView { - _mapView = mapView; - return self; -} - -- (void)handleMethodCall:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult)result { - result(@{@"overlookEnabled": @(_mapView.overlookEnabled)}); -} - -@end - -@implementation BMFGetRotateEnabled - -@synthesize _mapView; - -- (nonnull NSObject *)initWith:(nonnull BMFMapView *)mapView { - _mapView = mapView; - return self; -} - -- (void)handleMethodCall:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult)result { - result(@{@"rotateEnabled": @(_mapView.rotateEnabled)}); -} - -@end - -@implementation BMFGetForceTouchEnabled - -@synthesize _mapView; - -- (nonnull NSObject *)initWith:(nonnull BMFMapView *)mapView { - _mapView = mapView; - return self; -} - -- (void)handleMethodCall:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult)result { - result(@{@"forceTouchEnabled": @(_mapView.forceTouchEnabled)}); -} - -@end - -@implementation BMFGetShowMapScaleBar - -@synthesize _mapView; - -- (nonnull NSObject *)initWith:(nonnull BMFMapView *)mapView { - _mapView = mapView; - return self; -} - -- (void)handleMethodCall:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult)result { - result(@{@"showMapScaleBar" : @(_mapView.showMapScaleBar)}); -} - -@end - -@implementation BMFGetMapScaleBarPosition - -@synthesize _mapView; - -- (nonnull NSObject *)initWith:(nonnull BMFMapView *)mapView { - _mapView = mapView; - return self; -} - -- (void)handleMethodCall:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult)result { - BMFMapPoint *point = [BMFMapPoint fromCGPoint:_mapView.mapScaleBarPosition]; - result(@{@"mapScaleBarPosition": [point bmf_toDictionary]}); -} - -@end - -@implementation BMFGetLogoPosition - -@synthesize _mapView; - -- (nonnull NSObject *)initWith:(nonnull BMFMapView *)mapView { - _mapView = mapView; - return self; -} - -- (void)handleMethodCall:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult)result { - result(@{@"logoPosition" : @(_mapView.logoPosition)}); -} - -@end - -@implementation BMFGetVisibleMapBounds - -@synthesize _mapView; - -- (nonnull NSObject *)initWith:(nonnull BMFMapView *)mapView { - _mapView = mapView; - return self; -} - -- (void)handleMethodCall:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult)result { - BMFMapRect *mapRect = [BMFMapRect fromBMKMapRect:_mapView.visibleMapRect]; - BMFCoordinateBounds *visibleMapBounds = [mapRect toBMFCoordinateBounds]; - result(@{@"visibleMapBounds": [visibleMapBounds bmf_toDictionary]}); -} - -@end - -@implementation BMFGetBaseIndoorMapEnabled - -@synthesize _mapView; - -- (nonnull NSObject *)initWith:(nonnull BMFMapView *)mapView { - _mapView = mapView; - return self; -} - -- (void)handleMethodCall:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult)result { - result(@{@"baseIndoorMapEnabled" : @(_mapView.baseIndoorMapEnabled)}); -} - -@end - -@implementation BMFGetShowIndoorMapPoi - -@synthesize _mapView; - -- (nonnull NSObject *)initWith:(nonnull BMFMapView *)mapView { - _mapView = mapView; - return self; -} - -- (void)handleMethodCall:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult)result { - result(@{@"showIndoorMapPoi" : @(_mapView.showIndoorMapPoi)}); -} - - -@end diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/BMFOverlayHandles.h b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/BMFOverlayHandles.h deleted file mode 100644 index 43fe416..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/BMFOverlayHandles.h +++ /dev/null @@ -1,57 +0,0 @@ -// -// BMFOverlayHandles.h -// flutter_bmfmap -// -// Created by zhangbaojin on 2020/2/12. -// - -#import "BMFMapViewHandle.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface BMFOverlayHandles : NSObject -/// BMFOverlayHandler管理中心 -+ (instancetype)defalutCenter; - -- (NSDictionary *)overlayHandles; -@end - - -#pragma mark - overlay - -@interface BMFAddPolyline : NSObject - -@end - -@interface BMFAddArcline : NSObject - -@end - -@interface BMFAddPolygon : NSObject - -@end - -@interface BMFAddCircle : NSObject - -@end - -@interface BMFAddTile : NSObject - -@end - -@interface BMFAddGround : NSObject - -@end - -@interface BMFRemoveOverlay : NSObject - -@end - -@interface BMFRemoveTileOverlay : NSObject - -@end - -@interface BMFUpdatePolyline : NSObject - -@end -NS_ASSUME_NONNULL_END diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/BMFOverlayHandles.m b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/BMFOverlayHandles.m deleted file mode 100644 index 4e7131a..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/BMFOverlayHandles.m +++ /dev/null @@ -1,576 +0,0 @@ -// -// BMFOverlayHandles.m -// flutter_bmfmap -// -// Created by zhangbaojin on 2020/2/12. -// - -#import "BMFOverlayHandles.h" -#import "BMFMapView.h" -#import "BMFOverlayMethodConst.h" -#import "BMFFileManager.h" -#import "UIColor+BMFString.h" -#import "BMFMapModels.h" -#import "BMFPolyline.h" -#import "BMFArcline.h" -#import "BMFPolygon.h" -#import "BMFCircle.h" -#import "BMFTileModel.h" -#import "BMFURLTileLayer.h" -#import "BMFAsyncTileLayer.h" -#import "BMFSyncTileLayer.h" -#import "BMFGroundOverlay.h" - -@interface BMFOverlayHandles () -{ - NSDictionary *_handles; -} -@end - -@implementation BMFOverlayHandles - -static BMFOverlayHandles *_instance = nil; -+ (instancetype)defalutCenter{ - if (!_instance) { - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - _instance = [[BMFOverlayHandles alloc] init]; - }); - } - return _instance; -} - -- (NSDictionary *)overlayHandles{ - if (!_handles) { - _handles = @{ - kBMFMapAddPolylineMethod: NSStringFromClass([BMFAddPolyline class]), - kBMFMapAddArcineMethod: NSStringFromClass([BMFAddArcline class]), - kBMFMapAddPolygonMethod: NSStringFromClass([BMFAddPolygon class]), - kBMFMapAddCircleMethod: NSStringFromClass([BMFAddCircle class]), - kBMFMapAddTileMethod: NSStringFromClass([BMFAddTile class]), - kBMFMapAddGroundMethod: NSStringFromClass([BMFAddGround class]), - kBMFMapRemoveOverlayMethod: NSStringFromClass([BMFRemoveOverlay class]), - kBMFMapRemoveTileMethod: NSStringFromClass([BMFRemoveTileOverlay class]), - kBMFMapUpdatePolylineMemberMethod: NSStringFromClass([BMFUpdatePolyline class]) - }; - } - return _handles; -} -@end - - -#pragma mark - overlay - -@implementation BMFAddPolyline - -@synthesize _mapView; - -- (nonnull NSObject *)initWith:(nonnull BMFMapView *)mapView { - _mapView = mapView; - return self; -} - -- (void)handleMethodCall:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult)result { - BMKPolyline *polyline = [BMKPolyline polylineWith:call.arguments]; - if (polyline) { - [_mapView addOverlay:polyline]; - result(@YES); - } else { - result(@NO); - } -} - -@end - -@implementation BMFAddArcline - -@synthesize _mapView; - -- (nonnull NSObject *)initWith:(nonnull BMFMapView *)mapView { - _mapView = mapView; - return self; -} - -- (void)handleMethodCall:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult)result { - BMKArcline *arcline = [BMKArcline arclineWith:call.arguments]; - if (arcline) { - [_mapView addOverlay:arcline]; - result(@YES); - } else { - result(@NO); - } -} - -@end - - -@implementation BMFAddPolygon - -@synthesize _mapView; - -- (nonnull NSObject *)initWith:(nonnull BMFMapView *)mapView { - _mapView = mapView; - return self; -} - -- (void)handleMethodCall:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult)result { - BMKPolygon *polygon = [BMKPolygon polygonWith:call.arguments]; - if (polygon) { - [_mapView addOverlay:polygon]; - result(@YES); - } else { - result(@NO); - } -} - -@end - - -@implementation BMFAddCircle - -@synthesize _mapView; - -- (nonnull NSObject *)initWith:(nonnull BMFMapView *)mapView { - _mapView = mapView; - return self; -} - -- (void)handleMethodCall:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult)result { - BMKCircle *circle = [BMKCircle circlelineWith:call.arguments]; - if (circle) { - [_mapView addOverlay:circle]; - result(@YES); - return; - } else { - result(@NO); - } -} - -@end - -@implementation BMFAddTile - -@synthesize _mapView; - -- (nonnull NSObject *)initWith:(nonnull BMFMapView *)mapView { - _mapView = mapView; - return self; -} - -- (void)handleMethodCall:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult)result { - if (!call.arguments) { - result(@NO); - return; - } - BMFTileModel *model = [BMFTileModel bmf_modelWith:call.arguments]; - model.tileOptions = [BMFTileModelOptions bmf_modelWith:call.arguments]; -// NSLog(@"%@", [model bmf_toDictionary]); - if (!model) { - result(@NO); - return; - } - if (model.tileOptions.tileLoadType == kBMFTileLoadUrl && model.tileOptions.url) { - BMFURLTileLayer *urlTileLayer = [BMFURLTileLayer urlTileLayerWith:model]; - [_mapView addOverlay:urlTileLayer]; - result(@YES); - return; - } else if (model.tileOptions.tileLoadType == kBMFTileLoadLocalAsync) { - BMFAsyncTileLayer *asyncTileLayer = [BMFAsyncTileLayer asyncTileLayerWith:model]; - [_mapView addOverlay:asyncTileLayer]; - result(@YES); - return; - } else if (model.tileOptions.tileLoadType == kBMFTileLoadLocalSync) { - BMFSyncTileLayer *syncTileLayer = [BMFSyncTileLayer syncTileLayerWith:model]; - [_mapView addOverlay:syncTileLayer]; - result(@YES); - return; - } else { - result(@NO); - return; - } -} - -@end - -@implementation BMFAddGround - -@synthesize _mapView; - -- (nonnull NSObject *)initWith:(nonnull BMFMapView *)mapView { - _mapView = mapView; - return self; -} - -- (void)handleMethodCall:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult)result { - BMKGroundOverlay *ground = [BMKGroundOverlay groundOverlayWith:call.arguments]; - if (ground) { - [_mapView addOverlay:ground]; - result(@YES); - return; - } else { - result(@NO); - } -} - - - -@end - -@implementation BMFRemoveOverlay - -@synthesize _mapView; - -- (nonnull NSObject *)initWith:(nonnull BMFMapView *)mapView { - _mapView = mapView; - return self; -} - -- (void)handleMethodCall:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult)result { - if (!call.arguments || !call.arguments[@"id"]) { - result(@NO); - return; - } - NSString *ID = [call.arguments safeValueForKey:@"id"]; - __weak __typeof__(_mapView) weakMapView = _mapView; - [_mapView.overlays enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { - // 折线 - if ([obj isKindOfClass:[BMKPolyline class]]) { - BMKPolyline *overlay = (BMKPolyline *)obj; - if ([ID isEqualToString:overlay.Id]) { - [weakMapView removeOverlay:obj]; - result(@YES); - *stop = YES; - return; - } - } - // 多边形 - if ([obj isKindOfClass:[BMKPolygon class]]) { - BMKPolygon *overlay = (BMKPolygon *)obj; - if ([ID isEqualToString:overlay.Id]) { - [weakMapView removeOverlay:obj]; - result(@YES); - *stop = YES; - return; - } - } - // 弧线 - if ([obj isKindOfClass:[BMKArcline class]]) { - BMKArcline *overlay = (BMKArcline *)obj; - if ([ID isEqualToString:overlay.Id]) { - [weakMapView removeOverlay:obj]; - result(@YES); - *stop = YES; - return; - } - } - // 圆 - if ([obj isKindOfClass:[BMKCircle class]]) { - BMKCircle *overlay = (BMKCircle *)obj; - if ([ID isEqualToString:overlay.Id]) { - [weakMapView removeOverlay:obj]; - result(@YES); - *stop = YES; - return; - } - } - // ground - if ([obj isKindOfClass:[BMKGroundOverlay class]]) { - BMKGroundOverlay *overlay = (BMKGroundOverlay *)obj; - if ([ID isEqualToString:overlay.Id]) { - [weakMapView removeOverlay:obj]; - result(@YES); - *stop = YES; - return; - } - } - // 瓦片图 - if ([obj isKindOfClass:[BMFURLTileLayer class]]) { - BMFURLTileLayer *overlay = (BMFURLTileLayer *)obj; - if ([ID isEqualToString:overlay.Id]) { - [weakMapView removeOverlay:obj]; - result(@YES); - *stop = YES; - return; - } - } - if ([obj isKindOfClass:[BMFAsyncTileLayer class]]) { - BMFAsyncTileLayer *overlay = (BMFAsyncTileLayer *)obj; - if ([ID isEqualToString:overlay.Id]) { - [weakMapView removeOverlay:obj]; - result(@YES); - *stop = YES; - return; - } - } - if ([obj isKindOfClass:[BMFSyncTileLayer class]]) { - BMFSyncTileLayer *overlay = (BMFSyncTileLayer *)obj; - if ([ID isEqualToString:overlay.Id]) { - [weakMapView removeOverlay:obj]; - result(@YES); - *stop = YES; - return; - } - } - - }]; -} - - -@end - -@implementation BMFRemoveTileOverlay - -@synthesize _mapView; - -- (nonnull NSObject *)initWith:(nonnull BMFMapView *)mapView { - _mapView = mapView; - return self; -} - -- (void)handleMethodCall:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult)result { - - if (!call.arguments || !call.arguments[@"id"]) { - result(@NO); - return; - } - NSString *ID = [call.arguments safeValueForKey:@"id"]; - __weak __typeof__(_mapView) weakMapView = _mapView; - [_mapView.overlays enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { - // 瓦片图 - if ([obj isKindOfClass:[BMFURLTileLayer class]]) { - BMFURLTileLayer *overlay = (BMFURLTileLayer *)obj; - if ([ID isEqualToString:overlay.Id]) { - [weakMapView removeOverlay:obj]; - result(@YES); - *stop = YES; - return; - } - } - if ([obj isKindOfClass:[BMFAsyncTileLayer class]]) { - BMFAsyncTileLayer *overlay = (BMFAsyncTileLayer *)obj; - if ([ID isEqualToString:overlay.Id]) { - [weakMapView removeOverlay:obj]; - result(@YES); - *stop = YES; - return; - } - } - if ([obj isKindOfClass:[BMFSyncTileLayer class]]) { - BMFSyncTileLayer *overlay = (BMFSyncTileLayer *)obj; - if ([ID isEqualToString:overlay.Id]) { - [weakMapView removeOverlay:obj]; - result(@YES); - *stop = YES; - return; - } - } - - }]; -} - - -@end - -#pragma mark - Update -@implementation BMFUpdatePolyline - -@synthesize _mapView; - -- (nonnull NSObject *)initWith:(nonnull BMFMapView *)mapView { - _mapView = mapView; - return self; -} - -- (void)handleMethodCall:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult)result { - if (!call.arguments || !call.arguments[@"id"]) { - result(@NO); - return; - } - NSString *ID = [call.arguments safeValueForKey:@"id"]; - __block BMKPolyline *polyline; - [_mapView.overlays enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { - if ([obj isKindOfClass:[BMKPolyline class]]) { - BMKPolyline *line = (BMKPolyline *)obj; - if ([ID isEqualToString:line.Id]) { - polyline = line; - *stop = YES; - } - } - }]; - if (!polyline) { - result(@NO); - return; - } - NSString *member = [call.arguments safeValueForKey:@"member"]; - -// kBMFColorLine = 0, ///< 单色折线 -// kBMFColorsLine, ///< 多色折线 -// kBMFTextureLine, ///< 单纹理折线 -// kBMFTexturesLine, ///< 多纹理折线 -// kBMFDashLine, ///< 虚线 -// kBMFMultiDashLine ///< 多色虚线 - - if ([member isEqualToString:@"coordinates"]) { - - NSArray *coordinates = [call.arguments safeObjectForKey:@"value"]; - if (!coordinates || coordinates.count <= 1) { - result(@NO); - return; - } - - CLLocationCoordinate2D coords[coordinates.count]; - for (size_t i = 0, count = coordinates.count; i < count; i++) { - BMFCoordinate *coord = [BMFCoordinate bmf_modelWith:coordinates[i]]; - coords[i] = [coord toCLLocationCoordinate2D]; - } - switch (polyline.lineType) { - case kBMFColorLine: - case kBMFTextureLine: - case kBMFDashLine: { - [polyline setPolylineWithCoordinates:coords count:coordinates.count]; - [_mapView setMapStatus:_mapView.getMapStatus]; - result(@YES); - } - break; - case kBMFColorsLine: - case kBMFTexturesLine: - case kBMFMultiDashLine: { - if (![call.arguments safeObjectForKey:@"indexs"]) { - result(@NO); - return; - } - NSMutableArray *indexs = [NSMutableArray array]; - for (NSNumber *value in call.arguments[@"indexs"]) { - [indexs addObject:value]; - } - [polyline setPolylineWithCoordinates:coords count:coordinates.count textureIndex:indexs]; - [_mapView setMapStatus:_mapView.getMapStatus]; - result(@YES); - } - - break; - default: - break; - } - - } else if ([member isEqualToString:@"width"]) { - BMKPolylineView *view = (BMKPolylineView *)[_mapView viewForOverlay:polyline]; - view.lineWidth = [[call.arguments safeValueForKey:@"value"] floatValue]; - [_mapView setMapStatus:_mapView.getMapStatus]; - result(@YES); - return; - - } else if ([member isEqualToString:@"colors"]) { - NSArray *colorsData = [call.arguments safeObjectForKey:@"value"]; - if (!colorsData || colorsData.count <= 0) { - result(@NO); - return; - } - BMKPolylineView *view = (BMKPolylineView *)[_mapView viewForOverlay:polyline]; - NSMutableArray *colors = [NSMutableArray array]; - for (NSString *color in colorsData) { - [colors addObject:[UIColor fromColorString:color]]; - } - if (polyline.lineType == kBMFColorsLine || polyline.lineType == kBMFMultiDashLine) { - view.colors = [colors copy]; - [_mapView setMapStatus:_mapView.getMapStatus]; - result(@YES); - return; - - } else if (polyline.lineType ==kBMFColorLine || polyline.lineType == kBMFDashLine) { - view.strokeColor = [colors firstObject]; - [_mapView setMapStatus:_mapView.getMapStatus]; - result(@YES); - return; - } else { - NSLog(@"ios - 纹理折线不支持更新colors"); - result(@NO); - return; - } - - - } else if ([member isEqualToString:@"lineDashType"]) { - if (polyline.lineType == kBMFTextureLine || polyline.lineType == kBMFTexturesLine) { - NSLog(@"ios - 纹理折线不支持虚线类型"); - result(@NO); - return; - } - BMFPolylineModel *model = polyline.polylineModel; - model.polylineOptions.lineDashType = [[call.arguments safeValueForKey:@"value"] intValue]; - [_mapView removeOverlay:polyline]; - - BMKPolyline *dashLine = [BMKPolyline polylineWithModel:model]; - [_mapView addOverlay:dashLine]; -// BMKPolylineView *view = (BMKPolylineView *)[_mapView viewForOverlay:polyline]; -// view.lineDashType = [[call.arguments safeValueForKey:@"value"] intValue]; -// [_mapView setMapStatus:_mapView.getMapStatus]; - result(@YES); - return; - - } else if ([member isEqualToString:@"lineCapType"]) { - if (polyline.lineType == kBMFDashLine || polyline.lineType == kBMFMultiDashLine) { - NSLog(@"ios - lineCapType不支持虚线"); - result(@NO); - return; - } - BMKPolylineView *view = (BMKPolylineView *)[_mapView viewForOverlay:polyline]; - view.lineCapType = [[call.arguments safeValueForKey:@"value"] intValue]; - [_mapView setMapStatus:_mapView.getMapStatus]; - result(@YES); - return; - - } else if ([member isEqualToString:@"lineJoinType"]) { - if (polyline.lineType == kBMFDashLine || polyline.lineType == kBMFMultiDashLine) { - NSLog(@"ios - lineJoinType不支持虚线"); - result(@NO); - return; - } - BMKPolylineView *view = (BMKPolylineView *)[_mapView viewForOverlay:polyline]; - view.lineJoinType = [[call.arguments safeValueForKey:@"value"] intValue]; - [_mapView setMapStatus:_mapView.getMapStatus]; - result(@YES); - return; - - } else if ([member isEqualToString:@"isThined"]) { - polyline.isThined = [[call.arguments safeValueForKey:@"value"] boolValue]; - [_mapView setMapStatus:_mapView.getMapStatus]; - result(@YES); - return; - - } else if ([member isEqualToString:@"textures"]) { - NSLog(@"ios - 暂不支持更新textures"); - result(@YES); - return; - - } else if ([member isEqualToString:@"clickable"]) { - NSLog(@"ios - 暂不支持设置clickable"); - result(@YES); - return; - - } else if ([member isEqualToString:@"isKeepScale"]) { - NSLog(@"ios - 暂不支持设置isKeepScale"); - result(@YES); - return; - - } else if ([member isEqualToString:@"isFocus"]) { - NSLog(@"ios - 暂不支持设置isFocus"); - result(@YES); - return; - - } else if ([member isEqualToString:@"visible"]) { - NSLog(@"ios - 暂不支持设置visible"); - result(@YES); - return; - - } else if ([member isEqualToString:@"zIndex"]) { - NSLog(@"ios - 暂不支持设置zIndex"); - result(@YES); - return; - - } else { - result(@YES); - } - -} - -@end diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/BMFProjectionHandles.h b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/BMFProjectionHandles.h deleted file mode 100644 index 7ea333d..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/BMFProjectionHandles.h +++ /dev/null @@ -1,28 +0,0 @@ -// -// BMFProjectionHandles.h -// flutter_bmfmap -// -// Created by zhangbaojin on 2020/4/1. -// - -#import "BMFMapViewHandle.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface BMFProjectionHandles : NSObject -/// BMFProjectionHandles管理中心 -+ (instancetype)defalutCenter; - -- (NSDictionary *)projectionHandles; -@end - -#pragma mark - convert - -@interface BMFCoordinateFromBMFPoint : NSObject - -@end - -@interface BMFPointFromBMFCoordinate : NSObject - -@end -NS_ASSUME_NONNULL_END diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/BMFProjectionHandles.m b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/BMFProjectionHandles.m deleted file mode 100644 index eae912f..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/BMFProjectionHandles.m +++ /dev/null @@ -1,86 +0,0 @@ -// -// BMFProjectionHandles.m -// flutter_bmfmap -// -// Created by zhangbaojin on 2020/4/1. -// - -#import "BMFProjectionHandles.h" -#import "BMFProjectionConst.h" -#import "BMFMapView.h" -#import "BMFMapModels.h" - -@interface BMFProjectionHandles () -{ - NSDictionary *_handles; -} -@end - -@implementation BMFProjectionHandles -static BMFProjectionHandles *_instance = nil; -+ (instancetype)defalutCenter{ - if (!_instance) { - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - _instance = [[BMFProjectionHandles alloc] init]; - }); - } - return _instance; -} - -- (NSDictionary *)projectionHandles{ - if (!_handles) { - _handles = @{ - kBMFCoordinateFromScreenPointMethod: NSStringFromClass([BMFCoordinateFromBMFPoint class]), - kBMFScreenPointFromCoordinateMethod: NSStringFromClass([BMFPointFromBMFCoordinate class]), - }; - } - return _handles; -} -@end - -#pragma mark - convert -@implementation BMFCoordinateFromBMFPoint - -@synthesize _mapView; - -- (nonnull NSObject *)initWith:(nonnull BMFMapView *)mapView { - _mapView = mapView; - return self; -} - -- (void)handleMethodCall:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult)result { - if (!call.arguments || call.arguments[@"point"]) { - result([NSNull null]); - return; - } - BMFMapPoint *point = [BMFMapPoint bmf_modelWith:[call.arguments safeObjectForKey:@"point"]]; - CLLocationCoordinate2D coord = [_mapView convertPoint:[point toCGPoint] toCoordinateFromView:_mapView]; - BMFCoordinate *coordinate = [BMFCoordinate fromCLLocationCoordinate2D:coord]; - result(@{@"coordinate" : [coordinate bmf_toDictionary]}); -} - -@end - - -@implementation BMFPointFromBMFCoordinate - -@synthesize _mapView; - -- (nonnull NSObject *)initWith:(nonnull BMFMapView *)mapView { - _mapView = mapView; - return self; -} - -- (void)handleMethodCall:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult)result { - if (!call.arguments || call.arguments[@"coordinate"]) { - result([NSNull null]); - return; - } - BMFCoordinate *coord = [BMFCoordinate bmf_modelWith:[call.arguments safeObjectForKey:@"coordinate"]]; - CGPoint p = [_mapView convertCoordinate:[coord toCLLocationCoordinate2D] toPointToView:_mapView]; - BMFMapPoint *point = [BMFMapPoint fromCGPoint:p]; - result(@{@"point" : [point bmf_toDictionary]}); -} - -@end diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/BMFUserLocationHandles.h b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/BMFUserLocationHandles.h deleted file mode 100644 index b283c71..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/BMFUserLocationHandles.h +++ /dev/null @@ -1,40 +0,0 @@ -// -// BMFUserLocationHandles.h -// flutter_bmfmap -// -// Created by zhangbaojin on 2020/3/01. -// - -#import "BMFMapViewHandle.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface BMFUserLocationHandles : NSObject -/// BMFUserLocationHandler管理中心 -+ (instancetype)defalutCenter; - -- (NSDictionary *)userLocationHandles; -@end -#pragma mark - userLocation - -@interface BMFShowUserLocation : NSObject - - -@end - -@interface BMFSetUserTrackingMode : NSObject - -@end - -@interface BMFIsUserLocationVisible : NSObject - -@end - -@interface BMFUpdateLocationData : NSObject - -@end - -@interface BMFUpdateLocationDisplayParam : NSObject - -@end -NS_ASSUME_NONNULL_END diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/BMFUserLocationHandles.m b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/BMFUserLocationHandles.m deleted file mode 100644 index e8d1c4a..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/BMFUserLocationHandles.m +++ /dev/null @@ -1,151 +0,0 @@ -// -// BMFUserLocationHandles.m -// flutter_bmfmap -// -// Created by zhangbaojin on 2020/3/01. -// - -#import "BMFUserLocationHandles.h" -#import "BMFMapView.h" -#import "BMFUserLocationConst.h" -#import "NSObject+BMFVerify.h" -#import "BMFUserLocationModel.h" - -@interface BMFUserLocationHandles () -{ - NSDictionary *_handles; -} -@end -@implementation BMFUserLocationHandles -static BMFUserLocationHandles *_instance = nil; -+ (instancetype)defalutCenter{ - if (!_instance) { - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - _instance = [[BMFUserLocationHandles alloc] init]; - }); - } - return _instance; -} - -- (NSDictionary *)userLocationHandles{ - if (!_handles) { - _handles = @{ - kBMFMapShowUserLocationMethod: NSStringFromClass([BMFShowUserLocation class]), - kBMFMapUserTrackingModeMethod: NSStringFromClass([BMFSetUserTrackingMode class]), - kBMFMapIsUserLocationVisibleMethod : NSStringFromClass([BMFIsUserLocationVisible class]), - kBMFMapUpdateLocationDataMethod: NSStringFromClass([BMFUpdateLocationData class]), - kBMFMapUpdateLocationDisplayParamMethod : NSStringFromClass([BMFUpdateLocationDisplayParam class]), - }; - } - return _handles; -} -@end - -#pragma mark - userLocation - -@implementation BMFShowUserLocation - -@synthesize _mapView; - -- (nonnull NSObject *)initWith:(nonnull BMFMapView *)mapView { - _mapView = mapView; - return self; -} - -- (void)handleMethodCall:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult)result { - if (!call.arguments || !call.arguments[@"show"]) { - result(@NO); - return; - } -// NSLog(@"ios-call.arguments=%@", call.arguments); - _mapView.showsUserLocation = [[call.arguments safeValueForKey:@"show"] boolValue]; - result(@YES); -} - -@end - -@implementation BMFSetUserTrackingMode - -@synthesize _mapView; - -- (nonnull NSObject *)initWith:(nonnull BMFMapView *)mapView { - _mapView = mapView; - return self; -} - -- (void)handleMethodCall:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult)result { - if (!call.arguments || !call.arguments[@"userTrackingMode"]) { - result(@NO); - return; - } - _mapView.userTrackingMode = [[call.arguments safeValueForKey:@"userTrackingMode"] intValue]; - result(@YES); -} - -@end - -@implementation BMFIsUserLocationVisible - -@synthesize _mapView; - -- (nonnull NSObject *)initWith:(nonnull BMFMapView *)mapView { - _mapView = mapView; - return self; -} - -- (void)handleMethodCall:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult)result { -// NSLog(@"ios-BMFIsUserLocationVisible"); - if (!_mapView.showsUserLocation) { - result(@{@"userLocationVisible": @NO}); - return; - } - - result(@{@"userLocationVisible": @(_mapView.userLocationVisible)}); -} - -@end - -@implementation BMFUpdateLocationData - -@synthesize _mapView; - -- (nonnull NSObject *)initWith:(nonnull BMFMapView *)mapView { - _mapView = mapView; - return self; -} - -- (void)handleMethodCall:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult)result { -// NSLog(@"ios-BMFUpdateLocationData-call.arguments=%@", call.arguments); - if (!call.arguments || !call.arguments[@"userLocation"]) { - result(@NO); - return; - } - BMFUserLocationModel *userLocation = [BMFUserLocationModel bmf_modelWith:[call.arguments safeObjectForKey:@"userLocation"]]; - [_mapView updateLocationData:[userLocation toBMKUserLocation]]; - result(@YES); -} - -@end - -@implementation BMFUpdateLocationDisplayParam - -@synthesize _mapView; - -- (nonnull NSObject *)initWith:(nonnull BMFMapView *)mapView { - _mapView = mapView; - return self; -} - -- (void)handleMethodCall:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult)result { -// NSLog(@"ios-BMFUpdateLocationDisplayParam-call.arguments=%@", call.arguments); - if (!call.arguments || !call.arguments[@"userlocationDisplayParam"]) { - result(@NO); - return; - } - BMFLocationViewDisplayParam *displayParam = [BMFLocationViewDisplayParam bmf_modelWith:[call.arguments safeObjectForKey:@"userlocationDisplayParam"]]; - [_mapView updateLocationViewWithParam:[displayParam toBMKLocationViewDisplayParam]]; - result(@YES); -} - -@end diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/marker/BMFAnnotation.h b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/marker/BMFAnnotation.h deleted file mode 100644 index 69589e4..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/marker/BMFAnnotation.h +++ /dev/null @@ -1,32 +0,0 @@ -// -// BMFAnnotation.h -// flutter_bmfmap -// -// Created by zbj on 2020/2/11. -// - -#ifndef __BMFAnnotation__H__ -#define __BMFAnnotation__H__ -#ifdef __OBJC__ -#import -#endif -#endif -#import "BMFAnnotationModel.h" - -NS_ASSUME_NONNULL_BEGIN - -// 改为分类,继承会出现固定屏幕不生效 -@interface BMKPointAnnotation (BMFAnnotation) - -/// BMFAnnotation -+ (instancetype)annotationWith:(NSDictionary *)dic; - -/// annotation唯一id -@property (nonatomic, copy,readonly) NSString *Id; - -/// annotationView的属性配置model -@property (nonatomic, strong,readonly) BMFAnnotationViewOptions *annotationViewOptions; - -@end - -NS_ASSUME_NONNULL_END diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/marker/BMFAnnotation.m b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/marker/BMFAnnotation.m deleted file mode 100644 index 6dc248b..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/marker/BMFAnnotation.m +++ /dev/null @@ -1,65 +0,0 @@ -// -// BMFAnnotation.m -// flutter_bmfmap -// -// Created by zbj on 2020/2/11. -// - -#import "BMFAnnotation.h" -#import -#import "BMFMapModels.h" - -static const void *IDKey = &IDKey; -static const void *annotationViewOptionsKey = &annotationViewOptionsKey; - -@implementation BMKPointAnnotation (BMFAnnotation) -- (NSString *)Id{ - return objc_getAssociatedObject(self, IDKey); -} -- (void)setId:(NSString * _Nonnull)Id{ - objc_setAssociatedObject(self, IDKey, Id, OBJC_ASSOCIATION_COPY); -} - -- (BMFAnnotationViewOptions *)annotationViewOptions{ - return objc_getAssociatedObject(self, annotationViewOptionsKey); -} -- (void)setAnnotationViewOptions:(BMFAnnotationViewOptions * _Nonnull)annotationViewOptions { - objc_setAssociatedObject(self, annotationViewOptionsKey, annotationViewOptions, OBJC_ASSOCIATION_RETAIN_NONATOMIC); -} - -+ (instancetype)annotationWith:(NSDictionary *)dic{ - return [[self alloc] initWith:dic]; -} -- (instancetype)initWith:(NSDictionary *)dic{ - if ([super init]) { - if (dic) { - BMFAnnotationModel *model = [BMFAnnotationModel bmf_modelWith:dic]; - model.annotationViewOptions = [BMFAnnotationViewOptions bmf_modelWith:dic]; - [self configAnnotation:model]; - } - } - return self; -} - -- (void)configAnnotation:(BMFAnnotationModel*)model{ - if (model.Id) { - self.Id = model.Id; - } - if (model.title) { - self.title = model.title; - } - if (model.subtitle) { - self.subtitle = model.subtitle; - } - if (model.position) { - self.coordinate = [model.position toCLLocationCoordinate2D]; - } - self.isLockedToScreen = model.isLockedToScreen; - if (model.screenPointToLock) { - self.screenPointToLock = [model.screenPointToLock toCGPoint]; - } - - self.annotationViewOptions = model.annotationViewOptions; -} - -@end diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/overlay/BMFArcline.h b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/overlay/BMFArcline.h deleted file mode 100644 index ef32772..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/overlay/BMFArcline.h +++ /dev/null @@ -1,31 +0,0 @@ -// -// BMFArcline.h -// flutter_bmfmap -// -// Created by zbj on 2020/2/15. -// - -#ifndef __BMFArcline__H__ -#define __BMFArcline__H__ -#ifdef __OBJC__ -#import -#endif -#endif -#import "BMFArclineModel.h" -NS_ASSUME_NONNULL_BEGIN - -@interface BMKArcline (BMFArcline) - -/// arclineView唯一id -@property (nonatomic, copy, readonly) NSString *Id; - -/// arclineViewOptions -@property (nonatomic, strong, readonly) BMFArclineViewOptions *arclineViewOptions; - -+ (BMKArcline *)arclineWith:(NSDictionary *)dic; - - - -@end - -NS_ASSUME_NONNULL_END diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/overlay/BMFArcline.mm b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/overlay/BMFArcline.mm deleted file mode 100644 index fea3806..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/overlay/BMFArcline.mm +++ /dev/null @@ -1,51 +0,0 @@ -// -// BMFArcline.m -// flutter_bmfmap -// -// Created by zbj on 2020/2/15. -// - -#import "BMFArcline.h" -#import -#import "BMFMapModels.h" - -static const void *IDKey = &IDKey; -static const void *arclineViewOptionsKey = &arclineViewOptionsKey; - -@implementation BMKArcline (BMFArcline) -+ (BMKArcline *)arclineWith:(NSDictionary *)dic{ - if (dic) { - BMFArclineModel *model = [BMFArclineModel bmf_modelWith:dic]; - model.arclineOptions = [BMFArclineViewOptions bmf_modelWith:dic]; - int _coordsCount = (int)model.coordinates.count; - if (_coordsCount < 3) { - return nil; - } - - CLLocationCoordinate2D *coords = new CLLocationCoordinate2D[_coordsCount]; - for (int i = 0; i < _coordsCount; i++) { - coords[i] = [model.coordinates[i] toCLLocationCoordinate2D]; - } - BMKArcline *arcline = [BMKArcline arclineWithCoordinates:coords]; - arcline.Id = model.Id; - arcline.arclineViewOptions = model.arclineOptions; - return arcline; - } - return nil; -} - -- (NSString *)Id{ - return objc_getAssociatedObject(self, IDKey); -} -- (void)setId:(NSString * _Nonnull)Id{ - objc_setAssociatedObject(self, IDKey, Id, OBJC_ASSOCIATION_COPY); -} - -- (BMFArclineViewOptions *)arclineViewOptions{ - return objc_getAssociatedObject(self, arclineViewOptionsKey); -} -- (void)setArclineViewOptions:(BMFArclineViewOptions * _Nonnull)arclineViewOptions{ - objc_setAssociatedObject(self, arclineViewOptionsKey, arclineViewOptions, OBJC_ASSOCIATION_RETAIN_NONATOMIC); -} - -@end diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/overlay/BMFCircle.h b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/overlay/BMFCircle.h deleted file mode 100644 index e05ae44..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/overlay/BMFCircle.h +++ /dev/null @@ -1,30 +0,0 @@ -// -// BMFCircle.h -// flutter_bmfmap -// -// Created by zbj on 2020/2/15. -// - -#ifndef __BMFCircle__H__ -#define __BMFCircle__H__ -#ifdef __OBJC__ -#import -#endif -#endif -#import "BMFCircleModel.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface BMKCircle (BMFCircle) - -/// circleView唯一id -@property (nonatomic, copy, readonly) NSString *Id; - -/// circleViewOptions -@property (nonatomic, strong, readonly) BMFCircleViewOptions *circleViewOptions; - -+ (BMKCircle *)circlelineWith:(NSDictionary *)dic; - -@end - -NS_ASSUME_NONNULL_END diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/overlay/BMFCircle.mm b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/overlay/BMFCircle.mm deleted file mode 100644 index 5241246..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/overlay/BMFCircle.mm +++ /dev/null @@ -1,45 +0,0 @@ -// -// BMFCircle.m -// flutter_bmfmap -// -// Created by zbj on 2020/2/15. -// - -#import "BMFCircle.h" -#import -#import "BMFMapModels.h" - -static const void *IDKey = &IDKey; -static const void *circleViewOptionsKey = &circleViewOptionsKey; -@implementation BMKCircle (BMFCircle) - -+ (BMKCircle *)circlelineWith:(NSDictionary *)dic{ - if (dic) { - BMFCircleModel *model = [BMFCircleModel bmf_modelWith:dic]; - model.circleOptions = [BMFCircleViewOptions bmf_modelWith:dic]; - if (model.center) { - BMKCircle *circle = [BMKCircle circleWithCenterCoordinate:[model.center toCLLocationCoordinate2D] radius:model.radius]; - circle.circleViewOptions = model.circleOptions; - circle.Id = model.Id; - return circle; - } - - } - return nil; -} - -- (NSString *)Id{ - return objc_getAssociatedObject(self, IDKey); -} -- (void)setId:(NSString * _Nonnull)Id{ - objc_setAssociatedObject(self, IDKey, Id, OBJC_ASSOCIATION_COPY); -} - -- (BMFCircleViewOptions *)circleViewOptions{ - return objc_getAssociatedObject(self, circleViewOptionsKey); -} -- (void)setCircleViewOptions:(BMFCircleViewOptions * _Nonnull)circleViewOptions{ - objc_setAssociatedObject(self, circleViewOptionsKey, circleViewOptions, OBJC_ASSOCIATION_RETAIN_NONATOMIC); -} - -@end diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/overlay/BMFGroundOverlay.h b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/overlay/BMFGroundOverlay.h deleted file mode 100644 index 237e5b1..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/overlay/BMFGroundOverlay.h +++ /dev/null @@ -1,25 +0,0 @@ -// -// BMFGroundOverlay.h -// flutter_bmfmap -// -// Created by zhangbaojin on 2020/3/22. -// - -#ifndef __BMFGroundOverlay__H__ -#define __BMFGroundOverlay__H__ -#ifdef __OBJC__ -#import -#endif -#endif - -NS_ASSUME_NONNULL_BEGIN - -@interface BMKGroundOverlay (BMFGroundOverlay) - -/// 唯一id -@property (nonatomic, copy, readonly) NSString *Id; - -+ (BMKGroundOverlay *)groundOverlayWith:(NSDictionary *)dic; -@end - -NS_ASSUME_NONNULL_END diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/overlay/BMFGroundOverlay.m b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/overlay/BMFGroundOverlay.m deleted file mode 100644 index 4283d6f..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/overlay/BMFGroundOverlay.m +++ /dev/null @@ -1,62 +0,0 @@ -// -// BMFGroundOverlay.m -// flutter_bmfmap -// -// Created by zhangbaojin on 2020/3/22. -// - -#import "BMFGroundOverlay.h" -#import -#import "BMFMapModels.h" -#import "BMFGroundModel.h" -#import "BMFFileManager.h" - -static const void *IDKey = &IDKey; -@implementation BMKGroundOverlay (BMFGroundOverlay) - -+ (BMKGroundOverlay *)groundOverlayWith:(NSDictionary *)dic{ - if (dic) { - BMFGroundModel *model = [BMFGroundModel bmf_modelWith:dic]; - model.groundOptions = [BMFGroundModelOptions bmf_modelWith:dic]; - if (!model || !model.Id || !model.groundOptions || !model.groundOptions.image) { - return nil; - } - // 构造一 - if (model.groundOptions.position) { - CLLocationCoordinate2D position = [model.groundOptions.position toCLLocationCoordinate2D]; - CGPoint point = CGPointMake(model.groundOptions.anchorX, model.groundOptions.anchorY); - NSString *imagePath = [[BMFFileManager defaultCenter] pathForFlutterFileName:model.groundOptions.image]; - - BMKGroundOverlay *groundOverlay = [BMKGroundOverlay groundOverlayWithPosition:position - zoomLevel:model.groundOptions.zoomLevel - anchor:point - icon:[UIImage imageWithContentsOfFile:imagePath]]; - groundOverlay.alpha = model.groundOptions.transparency; - groundOverlay.Id = model.Id; - return groundOverlay; - } - // 构造二 - if (model.groundOptions.bounds) { - BMKCoordinateBounds bounds = [model.groundOptions.bounds toBMKCoordinateBounds]; - NSString *imagePath = [[BMFFileManager defaultCenter] pathForFlutterFileName:model.groundOptions.image]; - - BMKGroundOverlay *groundOverlay = [BMKGroundOverlay groundOverlayWithBounds:bounds - icon:[UIImage imageWithContentsOfFile:imagePath]]; - groundOverlay.alpha = model.groundOptions.transparency; - groundOverlay.Id = model.Id; - return groundOverlay; - } - - } - return nil; -} - -- (NSString *)Id{ - return objc_getAssociatedObject(self, IDKey); -} -- (void)setId:(NSString * _Nonnull)Id{ - objc_setAssociatedObject(self, IDKey, Id, OBJC_ASSOCIATION_COPY); -} - - -@end diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/overlay/BMFPolygon.h b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/overlay/BMFPolygon.h deleted file mode 100644 index 67fa9e9..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/overlay/BMFPolygon.h +++ /dev/null @@ -1,31 +0,0 @@ -// -// BMFPolygon.h -// flutter_bmfmap -// -// Created by zhangbaojin on 2020/2/27. -// - -#ifndef __BMFPolygon__H__ -#define __BMFPolygon__H__ -#ifdef __OBJC__ -#import -#endif -#endif -#import "BMFPolygonModel.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface BMKPolygon (BMFPolygon) - -/// polylgonView唯一id -@property (nonatomic, copy, readonly) NSString *Id; - -/// BMKPolygonView参数集合 -@property (nonatomic, strong, readonly) BMFPolygonViewOptions *polygonViewOptions; - -/// BMKPolygon -+ (BMKPolygon *)polygonWith:(NSDictionary *)dic; - -@end - -NS_ASSUME_NONNULL_END diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/overlay/BMFPolygon.mm b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/overlay/BMFPolygon.mm deleted file mode 100644 index 7268053..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/overlay/BMFPolygon.mm +++ /dev/null @@ -1,48 +0,0 @@ -// -// BMFPolygon.m -// flutter_bmfmap -// -// Created by zhangbaojin on 2020/2/27. -// - -#import "BMFPolygon.h" -#import -#import "BMFMapModels.h" - -static const void *IDKey = &IDKey; -static const void *polygonViewOptionsKey = &polygonViewOptionsKey; -@implementation BMKPolygon (BMFPolygon) - -+ (BMKPolygon *)polygonWith:(NSDictionary *)dic{ - if (dic) { - BMFPolygonModel *model = [BMFPolygonModel bmf_modelWith:dic]; - model.polygonOptions = [BMFPolygonViewOptions bmf_modelWith:dic]; - size_t _coordsCount = model.coordinates.count; - CLLocationCoordinate2D *coords = new CLLocationCoordinate2D[_coordsCount]; - for (size_t i = 0; i < _coordsCount; i++) { - coords[i] = [model.coordinates[i] toCLLocationCoordinate2D]; - } - - BMKPolygon *polygon = [BMKPolygon polygonWithCoordinates:coords count:_coordsCount]; - polygon.polygonViewOptions = model.polygonOptions; - polygon.Id = model.Id; - return polygon; - } - return nil; -} - -- (NSString *)Id{ - return objc_getAssociatedObject(self, IDKey); -} -- (void)setId:(NSString * _Nonnull)Id{ - objc_setAssociatedObject(self, IDKey, Id, OBJC_ASSOCIATION_COPY); -} - -- (BMFPolygonViewOptions *)polygonViewOptions{ - return objc_getAssociatedObject(self, polygonViewOptionsKey); -} -- (void)setPolygonViewOptions:(BMFPolygonViewOptions * _Nonnull)polygonViewOptions{ - objc_setAssociatedObject(self, polygonViewOptionsKey, polygonViewOptions, OBJC_ASSOCIATION_RETAIN_NONATOMIC); -} - -@end diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/overlay/BMFPolyline.h b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/overlay/BMFPolyline.h deleted file mode 100644 index bcde729..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/overlay/BMFPolyline.h +++ /dev/null @@ -1,45 +0,0 @@ -// -// BMFPolyline.h -// flutter_bmfmap -// -// Created by zbj on 2020/2/12. -// - -#ifndef __BMFPolyline__H__ -#define __BMFPolyline__H__ -#ifdef __OBJC__ -#import -#endif -#endif -#import "BMFPolylineModel.h" - - -typedef NS_ENUM(NSUInteger, BMFLineType){ - kBMFColorLine = 0, ///< 单色折线 - kBMFColorsLine, ///< 多色折线 - kBMFTextureLine, ///< 单纹理折线 - kBMFTexturesLine, ///< 多纹理折线 - kBMFDashLine, ///< 虚线 - kBMFMultiDashLine ///< 多色虚线 -}; -NS_ASSUME_NONNULL_BEGIN - -@interface BMKPolyline (BMFPolyline) - -/// polylineView唯一id -@property (nonatomic, copy, readonly) NSString *Id; - -@property (nonatomic, strong, readonly) BMFPolylineModel *polylineModel; - -/// 折线类型标记 -@property (nonatomic, assign, readonly) NSUInteger lineType; - -/// BMKPolyline -+ (BMKPolyline *)polylineWith:(NSDictionary *)dic; - - -/// BMKPolyline -+ (BMKPolyline *)polylineWithModel:(BMFPolylineModel *)model; -@end - -NS_ASSUME_NONNULL_END diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/overlay/BMFPolyline.mm b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/overlay/BMFPolyline.mm deleted file mode 100644 index 6115902..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/overlay/BMFPolyline.mm +++ /dev/null @@ -1,126 +0,0 @@ -// -// BMFPolyline.m -// flutter_bmfmap -// -// Created by zbj on 2020/2/12. -// - -#import "BMFPolyline.h" -#import -#import "BMFMapModels.h" - -static const void *IDKey = &IDKey; -static const void *lineTypeKey = &lineTypeKey; -static const void *polylineModelKey = &polylineModelKey; - -@implementation BMKPolyline (BMFPolyline) - -+ (BMKPolyline *)polylineWith:(NSDictionary *)dic { - if (dic) { - BMFPolylineModel *model = [BMFPolylineModel bmf_modelWith:dic]; - model.polylineOptions = [BMFPolylineViewOptions bmf_modelWith:dic]; - size_t _coordsCount = model.coordinates.count; - size_t _indexsCount = model.indexs.count; - - if (_coordsCount > 0) { - CLLocationCoordinate2D *coords = new CLLocationCoordinate2D[_coordsCount]; - - for (size_t i = 0; i < _coordsCount; i++) { - coords[i] = [model.coordinates[i] toCLLocationCoordinate2D]; - } - - if (_indexsCount > 0) { //多 - BMKPolyline *polyline = [BMKPolyline polylineWithCoordinates:coords count:_coordsCount textureIndex:model.indexs]; - if (model.polylineOptions.lineDashType == 0) { - polyline.lineType = [model.polylineOptions.textures count] > 0 ? kBMFTexturesLine : kBMFColorsLine; - } else { - polyline.lineType = kBMFMultiDashLine; - } - polyline.Id = model.Id; - polyline.isThined = model.isThined; - polyline.polylineModel = model; - return polyline; - } else { //单 - BMKPolyline *polyline = [BMKPolyline polylineWithCoordinates:coords count:_coordsCount]; - if (model.polylineOptions.lineDashType == 0) { - polyline.lineType = [model.polylineOptions.textures count] > 0 ? kBMFTextureLine : kBMFColorLine; - } else { - polyline.lineType = kBMFDashLine; - } - polyline.Id = model.Id; - polyline.isThined = model.isThined; - polyline.polylineModel = model; - return polyline; - } - - } - } - return nil; -} - -/// BMKPolyline -+ (BMKPolyline *)polylineWithModel:(BMFPolylineModel *)model { - if (model) { - size_t _coordsCount = model.coordinates.count; - size_t _indexsCount = model.indexs.count; - - if (_coordsCount > 0) { - CLLocationCoordinate2D *coords = new CLLocationCoordinate2D[_coordsCount]; - - for (size_t i = 0; i < _coordsCount; i++) { - coords[i] = [model.coordinates[i] toCLLocationCoordinate2D]; - } - - if (_indexsCount > 0) { //多 - BMKPolyline *polyline = [BMKPolyline polylineWithCoordinates:coords count:_coordsCount textureIndex:model.indexs]; - if (model.polylineOptions.lineDashType == 0) { - polyline.lineType = [model.polylineOptions.textures count] > 0 ? kBMFTexturesLine : kBMFColorsLine; - } else { - polyline.lineType = kBMFMultiDashLine; - } - polyline.Id = model.Id; - polyline.isThined = model.isThined; - polyline.polylineModel = model; - return polyline; - } else { //单 - BMKPolyline *polyline = [BMKPolyline polylineWithCoordinates:coords count:_coordsCount]; - if (model.polylineOptions.lineDashType == 0) { - polyline.lineType = [model.polylineOptions.textures count] > 0 ? kBMFTextureLine : kBMFColorLine; - } else { - polyline.lineType = kBMFDashLine; - } - polyline.Id = model.Id; - polyline.isThined = model.isThined; - polyline.polylineModel = model; - return polyline; - } - - } - } - return nil; -} -- (NSString *)Id{ - return objc_getAssociatedObject(self, IDKey); -} -- (void)setId:(NSString * _Nonnull)Id{ - objc_setAssociatedObject(self, IDKey, Id, OBJC_ASSOCIATION_COPY); -} - -- (NSUInteger)lineType{ - NSNumber *value = objc_getAssociatedObject(self, lineTypeKey); - return [value unsignedIntegerValue]; -} - -- (void)setLineType:(BMFLineType)lineType{ - objc_setAssociatedObject(self, lineTypeKey, @(lineType), OBJC_ASSOCIATION_ASSIGN); -} - -- (BMFPolylineModel *)polylineModel { - return objc_getAssociatedObject(self, polylineModelKey); -} - -- (void)setPolylineModel:(BMFPolylineModel * _Nonnull)polylineModel { - objc_setAssociatedObject(self, polylineModelKey, polylineModel, OBJC_ASSOCIATION_RETAIN_NONATOMIC); -} - -@end diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/tileLayer/BMFAsyncTileLayer.h b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/tileLayer/BMFAsyncTileLayer.h deleted file mode 100644 index 75f847d..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/tileLayer/BMFAsyncTileLayer.h +++ /dev/null @@ -1,31 +0,0 @@ -// -// BMFAsyncTileLayer.h -// flutter_bmfmap -// -// Created by zhangbaojin on 2020/3/20. -// - -#ifndef __BMFAsyncTileLayer__H__ -#define __BMFAsyncTileLayer__H__ -#ifdef __OBJC__ -#import -#endif -#endif - -@class BMFTileModel; - -NS_ASSUME_NONNULL_BEGIN - -@interface BMFAsyncTileLayer : BMKAsyncTileLayer - -/// 唯一id -@property (nonatomic, copy, readonly) NSString *Id; - -///// title参数集合 -//@property (nonatomic, strong, readonly) BMFTileModelOptions *tileOptions; - -+ (instancetype)asyncTileLayerWith:(BMFTileModel *)model; - -@end - -NS_ASSUME_NONNULL_END diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/tileLayer/BMFAsyncTileLayer.m b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/tileLayer/BMFAsyncTileLayer.m deleted file mode 100644 index 6c2ade7..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/tileLayer/BMFAsyncTileLayer.m +++ /dev/null @@ -1,50 +0,0 @@ -// -// BMFAsyncTileLayer.m -// flutter_bmfmap -// -// Created by zhangbaojin on 2020/3/20. -// - -#import "BMFAsyncTileLayer.h" -#import "BMFMapModels.h" -#import "BMFTileModel.h" -#import "BMFFileManager.h" - -@interface BMFAsyncTileLayer () - -/// 唯一id -@property (nonatomic, copy, readwrite) NSString *Id; - -@end - -@implementation BMFAsyncTileLayer - -+ (instancetype)asyncTileLayerWith:(BMFTileModel *)model{ - if (!model.Id || !model.tileOptions) { - return nil; - } - - BMFAsyncTileLayer *tileLayer = [BMFAsyncTileLayer new]; - tileLayer.Id = model.Id; - tileLayer.maxZoom = model.maxZoom; - tileLayer.minZoom = model.minZoom; - tileLayer.visibleMapRect = [model.visibleMapBounds toBMKMapRect]; - return tileLayer; -} - -/// 通过异步方法获取瓦片数据 -/// x 瓦片图层x坐标 -/// y 瓦片图层y坐标 -/// zoom 瓦片图层的比例尺大小 -/// result block回调:(x, y, zoom)对应瓦片的UIImage对象和error信息 -- (void)loadTileForX:(NSInteger)x y:(NSInteger)y zoom:(NSInteger)zoom result:(void (^)(UIImage *tileImage, NSError *error))result { - // 拼接图片名称 - NSString *imageName = [NSString stringWithFormat:@"%ld_%ld_%ld.jpg", (long)zoom, (long)x, (long)y]; - // 此处应拼接flutter端瓦片图资源路径 - NSString *path = [NSString stringWithFormat:@"%ld/%@", (long)zoom, imageName]; - // 最终瓦片图路径 - path = [[BMFFileManager defaultCenter] pathForFlutterTileResources:path]; - UIImage *image = [UIImage imageWithContentsOfFile:path]; - result(image, nil); -} -@end diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/tileLayer/BMFSyncTileLayer.h b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/tileLayer/BMFSyncTileLayer.h deleted file mode 100644 index 4dfd99c..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/tileLayer/BMFSyncTileLayer.h +++ /dev/null @@ -1,28 +0,0 @@ -// -// BMFSyncTileLayer.h -// flutter_bmfmap -// -// Created by zhangbaojin on 2020/3/20. -// - -#ifndef __BMFSyncTileLayer__H__ -#define __BMFSyncTileLayer__H__ -#ifdef __OBJC__ -#import -#endif -#endif - -@class BMFTileModel; - -NS_ASSUME_NONNULL_BEGIN - -@interface BMFSyncTileLayer : BMKSyncTileLayer - -/// 唯一id -@property (nonatomic, copy, readonly) NSString *Id; - -+ (instancetype)syncTileLayerWith:(BMFTileModel *)model; - -@end - -NS_ASSUME_NONNULL_END diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/tileLayer/BMFSyncTileLayer.m b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/tileLayer/BMFSyncTileLayer.m deleted file mode 100644 index 4cc0b17..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/tileLayer/BMFSyncTileLayer.m +++ /dev/null @@ -1,51 +0,0 @@ -// -// BMFSyncTileLayer.m -// flutter_bmfmap -// -// Created by zhangbaojin on 2020/3/20. -// - -#import "BMFSyncTileLayer.h" -#import "BMFMapModels.h" -#import "BMFTileModel.h" -#import "BMFFileManager.h" -@interface BMFSyncTileLayer () - -/// 唯一id -@property (nonatomic, copy, readwrite) NSString *Id; - -@end - -@implementation BMFSyncTileLayer - -+ (instancetype)syncTileLayerWith:(BMFTileModel *)model{ - if (!model.Id || !model.tileOptions) { - return nil; - } - - BMFSyncTileLayer *tileLayer = [BMFSyncTileLayer new]; - tileLayer.Id = model.Id; - tileLayer.maxZoom = model.maxZoom; - tileLayer.minZoom = model.minZoom; - tileLayer.visibleMapRect = [model.visibleMapBounds toBMKMapRect]; - return tileLayer; -} - -/// 通过同步方法获取瓦片数据 -/// x 瓦片图层x坐标 -/// y 瓦片图层y坐标 -/// zoom 瓦片图层的比例尺大小 -/// result block回调:(x, y, zoom)对应瓦片的UIImage对象和error信息 -- (UIImage *)tileForX:(NSInteger)x y:(NSInteger)y zoom:(NSInteger)zoom { - // 拼接图片名称 - NSString *imageName = [NSString stringWithFormat:@"%ld_%ld_%ld.jpg", (long)zoom, (long)x, (long)y]; - // 此处应拼接flutter端瓦片图资源路径 - NSString *path = [NSString stringWithFormat:@"%ld/%@", (long)zoom, imageName]; - // 最终瓦片图路径 - path = [[BMFFileManager defaultCenter] pathForFlutterTileResources:path]; - - UIImage *image = [UIImage imageNamed:imageName]; - return image; -} - -@end diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/tileLayer/BMFURLTileLayer.h b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/tileLayer/BMFURLTileLayer.h deleted file mode 100644 index 0f7f6e7..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/tileLayer/BMFURLTileLayer.h +++ /dev/null @@ -1,27 +0,0 @@ -// -// BMFURLTileLayer.h -// flutter_bmfmap -// -// Created by zhangbaojin on 2020/3/20. -// - -#ifndef __BMFURLTileLayer__H__ -#define __BMFURLTileLayer__H__ -#ifdef __OBJC__ -#import -#endif -#endif -@class BMFTileModel; - -NS_ASSUME_NONNULL_BEGIN - -@interface BMFURLTileLayer : BMKURLTileLayer - -/// 唯一id -@property (nonatomic, copy, readonly) NSString *Id; - -+ (instancetype)urlTileLayerWith:(BMFTileModel *)model; - -@end - -NS_ASSUME_NONNULL_END diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/tileLayer/BMFURLTileLayer.m b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/tileLayer/BMFURLTileLayer.m deleted file mode 100644 index 819372e..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Map/tileLayer/BMFURLTileLayer.m +++ /dev/null @@ -1,34 +0,0 @@ -// -// BMFURLTileLayer.m -// flutter_bmfmap -// -// Created by zhangbaojin on 2020/3/20. -// - -#import "BMFURLTileLayer.h" -#import "BMFMapModels.h" -#import "BMFTileModel.h" - -@interface BMFURLTileLayer () - -/// 唯一id -@property (nonatomic, copy, readwrite) NSString *Id; - -@end - -@implementation BMFURLTileLayer - -+ (instancetype)urlTileLayerWith:(BMFTileModel *)model{ - if (!model.Id || !model.tileOptions || !model.tileOptions.url) { - return nil; - } - BMFURLTileLayer *urlTileLayer = [[BMFURLTileLayer alloc] initWithURLTemplate:model.tileOptions.url]; - urlTileLayer.Id = model.Id; - urlTileLayer.maxZoom = model.maxZoom; - urlTileLayer.minZoom = model.minZoom; - urlTileLayer.visibleMapRect = [model.visibleMapBounds toBMKMapRect]; - - return urlTileLayer; - -} -@end diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/MethodConst/BMFAnnotationMethodConst.h b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/MethodConst/BMFAnnotationMethodConst.h deleted file mode 100644 index 7ae986e..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/MethodConst/BMFAnnotationMethodConst.h +++ /dev/null @@ -1,21 +0,0 @@ - -#ifndef __BMFAnnotationMethodConst__H__ -#define __BMFAnnotationMethodConst__H__ - -#import - -/// map添加marker -FOUNDATION_EXPORT NSString *const kBMFMapAddMarkerMethod; -/// map批量添加marker -FOUNDATION_EXPORT NSString *const kBMFMapAddMarkersMethod; -/// map删除marker -FOUNDATION_EXPORT NSString *const kBMFMapRemoveMarkerMethod; -/// map批量删除markers -FOUNDATION_EXPORT NSString *const kBMFMapRemoveMarkersMethod; -/// map清除所有的markers -FOUNDATION_EXPORT NSString *const kBMFMapCleanAllMarkersMethod; -/// marker添加完成 -FOUNDATION_EXPORT NSString *const kBMFMapDidAddMarkerMethod; -/// 更新marker属性 -FOUNDATION_EXPORT NSString *const kBMFMapUpdateMarkerMemberMethod; -#endif diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/MethodConst/BMFAnnotationMethodConst.m b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/MethodConst/BMFAnnotationMethodConst.m deleted file mode 100644 index cf653ec..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/MethodConst/BMFAnnotationMethodConst.m +++ /dev/null @@ -1,14 +0,0 @@ - -#ifndef __BMFAnnotationMethodConst__M__ -#define __BMFAnnotationMethodConst__M__ - -#import -// marker -NSString *const kBMFMapAddMarkerMethod = @"flutter_bmfmap/marker/addMarker"; -NSString *const kBMFMapAddMarkersMethod = @"flutter_bmfmap/marker/addMarkers"; -NSString *const kBMFMapRemoveMarkerMethod = @"flutter_bmfmap/marker/removeMarker"; -NSString *const kBMFMapRemoveMarkersMethod = @"flutter_bmfmap/marker/removeMarkers"; -NSString *const kBMFMapCleanAllMarkersMethod = @"flutter_bmfmap/marker/cleanAllMarkers"; -NSString *const kBMFMapDidAddMarkerMethod = @"flutter_bmfmap/marker/didAddMarker"; -NSString *const kBMFMapUpdateMarkerMemberMethod = @"flutter_bmfmap/marker/updateMarkerMember"; -#endif diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/MethodConst/BMFHeatMapConst.h b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/MethodConst/BMFHeatMapConst.h deleted file mode 100644 index 67975bb..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/MethodConst/BMFHeatMapConst.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef __BMFHeatMapConst__H__ -#define __BMFHeatMapConst__H__ -#import -// 热力图 -/// 设定是否展示热力图 -FOUNDATION_EXPORT NSString *const kBMFMapShowHeatMapMethod; -/// 添加热力图 -FOUNDATION_EXPORT NSString *const kBMFMapAddHeatMapMethod; -/// 删除热力图 -FOUNDATION_EXPORT NSString *const kBMFMapRemoveHeatMapMethod; - -#endif diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/MethodConst/BMFHeatMapConst.m b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/MethodConst/BMFHeatMapConst.m deleted file mode 100644 index 7bbb4f8..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/MethodConst/BMFHeatMapConst.m +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef __BMFHeatMapConst__M__ -#define __BMFHeatMapConst__M__ -#import - -// 热力图 - NSString *const kBMFMapShowHeatMapMethod = @"flutter_bmfmap/heatMap/showHeatMap"; - NSString *const kBMFMapAddHeatMapMethod = @"flutter_bmfmap/heatMap/addHeatMap"; - NSString *const kBMFMapRemoveHeatMapMethod = @"flutter_bmfmap/heatMap/removeHeatMap"; -#endif diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/MethodConst/BMFMapCallBackConst.h b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/MethodConst/BMFMapCallBackConst.h deleted file mode 100644 index 7ba9667..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/MethodConst/BMFMapCallBackConst.h +++ /dev/null @@ -1,61 +0,0 @@ -#ifndef __BMFMapCallBackConst__H__ -#define __BMFMapCallBackConst__H__ - -#import - -// invoke - -/// map加载完成 -FOUNDATION_EXPORT NSString *const kBMFMapDidLoadCallback; -/// map渲染完成 -FOUNDATION_EXPORT NSString *const kBMFMapDidRenderCallback; -/// 地图渲染每一帧画面过程中,以及每次需要重绘地图时(例如添加覆盖物)都会调用此接口 -FOUNDATION_EXPORT NSString *const kBMFMapOnDrawMapFrameCallback; - - -/// 地图区域即将改变时会调用此接口 -FOUNDATION_EXPORT NSString *const kBMFMapRegionWillChangeCallback; -/// 地图区域即将改变时会调用此接口reason -FOUNDATION_EXPORT NSString *const kBMFMapRegionWillChangeWithReasonCallback; -/// 地图区域改变完成后会调用此接口 -FOUNDATION_EXPORT NSString *const kBMFMapRegionDidChangeCallback; -/// 地图区域改变完成后会调用此接口reason -FOUNDATION_EXPORT NSString *const kBMFMapRegionDidChangeWithReasonCallback; - -/// 点中底图标注后会回调此接口 -FOUNDATION_EXPORT NSString *const kBMFMapOnClickedMapPoiCallback; -/// 点中底图空白处会回调此接口 -FOUNDATION_EXPORT NSString *const kBMFMapOnClickedMapBlankCallback; -/// 双击地图时会回调此接口 -FOUNDATION_EXPORT NSString *const kBMFMapOnDoubleClickCallback; -/// 长按地图时会回调此接口 -FOUNDATION_EXPORT NSString *const kBMFMapOnLongClickCallback; -/// 3DTouch 按地图时会回调此接口 -///(仅在支持3D Touch,且fouchTouchEnabled属性为YES时,会回调此接口) -FOUNDATION_EXPORT NSString *const kBMFMapOnForceTouchCallback; - - -/// 地图状态改变完成后会调用此接口 -FOUNDATION_EXPORT NSString *const kBMFMapStatusDidChangedCallback; - -/// 地图View进入/移出室内图 -FOUNDATION_EXPORT NSString *const kBMFMapInOrOutBaseIndoorMapCallback; - -/// marker点击 -FOUNDATION_EXPORT NSString *const kBMFMapClickedMarkerCallback; -/// marker选中 -FOUNDATION_EXPORT NSString *const kBMFMapDidSelectMarkerCallback; -/// marker取消选中 -FOUNDATION_EXPORT NSString *const kBMFMapDidDeselectMarkerCallback; -/// marker的泡泡点击 -FOUNDATION_EXPORT NSString *const kBMFMapDidClickedPaoPaoCallback; -/// marker的拖拽回调 -FOUNDATION_EXPORT NSString *const kBMFMapDidDragMarkerCallback; - - -/// 当mapView新添加overlay views时,调用此接口 -FOUNDATION_EXPORT NSString *const kBMFMapDidAddOverlayCallback; -/// 点中覆盖物后会回调此接口,目前只支持点中Polyline时回调 -FOUNDATION_EXPORT NSString *const kMapOnClickedOverlayCallback; - -#endif diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/MethodConst/BMFMapCallBackConst.m b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/MethodConst/BMFMapCallBackConst.m deleted file mode 100644 index c2db80d..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/MethodConst/BMFMapCallBackConst.m +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef __BMFMapCallBackConst__M__ -#define __BMFMapCallBackConst__M__ - -#import - -// invoke -NSString *const kBMFMapDidLoadCallback = @"flutter_bmfmap/map/mapViewDidFinishLoad"; -NSString *const kBMFMapDidRenderCallback = @"flutter_bmfmap/map/mapViewDidFinishRender"; -NSString *const kBMFMapOnDrawMapFrameCallback = @"flutter_bmfmap/map/mapViewOnDrawMapFrame"; - -NSString *const kBMFMapRegionWillChangeCallback = @"flutter_bmfmap/map/mapViewRegionWillChange"; -NSString *const kBMFMapRegionWillChangeWithReasonCallback = @"flutter_bmfmap/map/mapViewRegionWillChangeWithReason"; -NSString *const kBMFMapRegionDidChangeCallback = @"flutter_bmfmap/map/mapViewRegionDidChange"; -NSString *const kBMFMapRegionDidChangeWithReasonCallback = @"flutter_bmfmap/map/mapViewRegionDidChangeWithReason"; - -NSString *const kBMFMapOnClickedMapPoiCallback = @"flutter_bmfmap/map/mapViewonClickedMapPoi"; -NSString *const kBMFMapOnClickedMapBlankCallback = @"flutter_bmfmap/map/mapViewOnClickedMapBlank"; -NSString *const kBMFMapOnDoubleClickCallback = @"flutter_bmfmap/map/mapViewOnDoubleClick"; -NSString *const kBMFMapOnLongClickCallback = @"flutter_bmfmap/map/mapViewOnLongClick"; -NSString *const kBMFMapOnForceTouchCallback = @"flutter_bmfmap/map/mapViewOnForceTouch"; - -NSString *const kBMFMapStatusDidChangedCallback = @"flutter_bmfmap/map/mapViewStatusDidChanged"; - -NSString *const kBMFMapInOrOutBaseIndoorMapCallback = @"flutter_bmfmap/map/mapViewInOrOutBaseIndoorMap"; - -// marker -NSString *const kBMFMapClickedMarkerCallback = @"flutter_bmfmap/marker/clickedMarker"; -NSString *const kBMFMapDidSelectMarkerCallback = @"flutter_bmfmap/marker/didSelectedMarker"; -NSString *const kBMFMapDidDeselectMarkerCallback = @"flutter_bmfmap/marker/didDeselectMarker"; -NSString *const kBMFMapDidClickedPaoPaoCallback = @"flutter_bmfmap/map/didClickedInfoWindow"; -NSString *const kBMFMapDidDragMarkerCallback = @"flutter_bmfmap/marker/dragMarker"; - - -// overlay -NSString *const kBMFMapDidAddOverlayCallback = @"flutter_bmfmap/overlay/didAddOverlay"; -NSString *const kMapOnClickedOverlayCallback = @"flutter_bmfmap/overlay/onClickedOverlay"; - -#endif diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/MethodConst/BMFMapMethodConst.h b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/MethodConst/BMFMapMethodConst.h deleted file mode 100644 index 2dce6ba..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/MethodConst/BMFMapMethodConst.h +++ /dev/null @@ -1,111 +0,0 @@ -#ifndef __BMFMapMethodConst__H__ -#define __BMFMapMethodConst__H__ - -#import - -// Map - -/// mapChannelName -FOUNDATION_EXPORT NSString *const kBMFMapChannelName; -/// flutter与原生交互时map唯一标识符 -FOUNDATION_EXPORT NSString *const kBMFMapIdentifier; - -// get -/// 获取map的展示类型 -FOUNDATION_EXPORT NSString *const kBMFMapGetMapTypeMethod; - /// 获取map的比例尺级别 -FOUNDATION_EXPORT NSString *const kBMFMapGetZoomLevelMethod; - /// 获取map的自定义最小比例尺级别 -FOUNDATION_EXPORT NSString *const kBMFMapGetMinZoomLevelMethod; - /// 获取map的自定义最大比例尺级别 -FOUNDATION_EXPORT NSString *const kBMFMapGetMaxZoomLevelMethod; - /// 获取map的旋转角度 -FOUNDATION_EXPORT NSString *const kBMFMapGetRotationMethod; - /// 获取map的地图俯视角度 -FOUNDATION_EXPORT NSString *const kBMFMapGetOverlookingMethod; - /// 获取map的俯视角度最小值 -FOUNDATION_EXPORT NSString *const kBMFMapGetMinOverlookingMethod; - /// 获取map的是否现显示3D楼块效果 -FOUNDATION_EXPORT NSString *const kBMFMapGetBuildingsEnabledMethod; - /// 获取map的是否显示底图poi标注 -FOUNDATION_EXPORT NSString *const kBMFMapGetShowMapPoiMethod; - /// 获取map的是否打开路况图层 -FOUNDATION_EXPORT NSString *const kBMFMapGetTrafficEnabledMethod; - /// 获取map的是否打开百度城市热力图图层 -FOUNDATION_EXPORT NSString *const kBMFMapGetBaiduHeatMapEnabledMethod; - /// 获取map的是否支持所有手势操作 -FOUNDATION_EXPORT NSString *const kBMFMapGetGesturesEnabledMethod; - /// 获取map的是否支持用户多点缩放(双指) -FOUNDATION_EXPORT NSString *const kBMFMapGetZoomEnabledMethod; - /// 获取map的是否支持用户缩放(双击或双指单击) -FOUNDATION_EXPORT NSString *const kBMFMapGetZoomEnabledWithTapMethod; - /// 获取map的是否支持用户移动地图 -FOUNDATION_EXPORT NSString *const kBMFMapGetScrollEnabledMethod; - /// 获取map的是否支持俯仰角 -FOUNDATION_EXPORT NSString *const kBMFMapGetOverlookEnabledMethod; - /// 获取map的是否支持旋转 -FOUNDATION_EXPORT NSString *const kBMFMapGetRotateEnabledMethod; - /// 获取map的是否支持3Dtouch -FOUNDATION_EXPORT NSString *const kBMFMapGetForceTouchEnabledMethod; - /// 获取map的是否显式比例尺 -FOUNDATION_EXPORT NSString *const kBMFMapGetShowMapScaleBarMethod; - /// 获取map的比例尺的位置 -FOUNDATION_EXPORT NSString *const kBMFMapGetMapScaleBarPositionMethod; - /// 获取map的logo位置 -FOUNDATION_EXPORT NSString *const kBMFMapGetLogoPositionMethod; - /// 获取map的可视范围 -FOUNDATION_EXPORT NSString *const kBMFMapGetVisibleMapBoundsMethod; - /// 获取map的显示室内图 -FOUNDATION_EXPORT NSString *const kBMFMapGetBaseIndoorMapEnabledMethod; - /// 获取map的室内图标注是否显示 -FOUNDATION_EXPORT NSString *const kBMFMapGetShowIndoorMapPoiMethod; - -// set -/// map更新参数 -FOUNDATION_EXPORT NSString *const kBMFMapUpdateMethod; -/// map放大一级比例尺 -FOUNDATION_EXPORT NSString *const kBMFMapZoomInMethod; -/// map缩小一级比例尺 -FOUNDATION_EXPORT NSString *const kBMFMapZoomOutMethod; -/// map设置路况颜色 -FOUNDATION_EXPORT NSString *const kBMFMapSetCustomTrafficColorMethod; -/// map设定地图中心点坐标 -FOUNDATION_EXPORT NSString *const kBMFMapSetCenterCoordinateMethod; -/// 获得地图当前可视区域截图 -FOUNDATION_EXPORT NSString *const kBMFMapTakeSnapshotMethod; -/// 获得地图指定区域截图 -FOUNDATION_EXPORT NSString *const kBMFMapTakeSnapshotWithRectMethod; -/// 设置罗盘的图片 -FOUNDATION_EXPORT NSString *const kBMFMapSetCompassImageMethod; -/// 设定当前地图的显示范围 -FOUNDATION_EXPORT NSString *const kBMFMapSetVisibleMapBoundsMethod; -/// 设定地图的显示范围,并使bounds四周保留insets指定的边界区域 -FOUNDATION_EXPORT NSString *const kBMFMapSetVisibleMapBoundsWithPaddingMethod; -/// 设置mapStatus -FOUNDATION_EXPORT NSString *const kBMFMapSetMapStatusMethod; -/// 获取mapStatus -FOUNDATION_EXPORT NSString *const kBMFMapGetMapStatusMethod; - - -// 室内地图 -/// map展示室内地图 -FOUNDATION_EXPORT NSString *const kBMFMapShowBaseIndoorMapMethod; -/// map室内图标注是否显示 -FOUNDATION_EXPORT NSString *const kBMFMapShowBaseIndoorMapPoiMethod; -/// map设置室内图楼层 -FOUNDATION_EXPORT NSString *const kBMFMapSwitchBaseIndoorMapFloorMethod; -/// map获取当前聚焦的室内图信息 -FOUNDATION_EXPORT NSString *const kBMFMapGetFocusedBaseIndoorMapInfoMethod; - - - -// 个性化地图 -/// 开启个性化地图 -FOUNDATION_EXPORT NSString *const kBMFMapSetCustomMapStyleEnableMethod; -/// 设置个性化地图样式路径 -FOUNDATION_EXPORT NSString *const kBMFMapSetCustomMapStylePathMethod; -/// 在线个性化样式加载状态回调接口 -FOUNDATION_EXPORT NSString *const kBMFMapSetCustomMapStyleWithOptionMethod; - - -#endif diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/MethodConst/BMFMapMethodConst.m b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/MethodConst/BMFMapMethodConst.m deleted file mode 100644 index b18951a..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/MethodConst/BMFMapMethodConst.m +++ /dev/null @@ -1,59 +0,0 @@ - -#ifndef __BMFMapMethodConst__M__ -#define __BMFMapMethodConst__M__ - -#import - -// get - NSString *const kBMFMapGetMapTypeMethod = @"flutter_bmfmap/map/getMapType"; - NSString *const kBMFMapGetZoomLevelMethod = @"flutter_bmfmap/map/getZoomLevel"; - NSString *const kBMFMapGetMinZoomLevelMethod = @"flutter_bmfmap/map/getMinZoomLevel"; - NSString *const kBMFMapGetMaxZoomLevelMethod = @"flutter_bmfmap/map/getMaxZoomLevel"; - NSString *const kBMFMapGetRotationMethod = @"flutter_bmfmap/map/getRotation"; - NSString *const kBMFMapGetOverlookingMethod = @"flutter_bmfmap/map/getOverlooking"; - NSString *const kBMFMapGetMinOverlookingMethod = @"flutter_bmfmap/map/getMinOverlooking"; - NSString *const kBMFMapGetBuildingsEnabledMethod = @"flutter_bmfmap/map/getBuildingsEnabled"; - NSString *const kBMFMapGetShowMapPoiMethod = @"flutter_bmfmap/map/getShowMapPoi"; - NSString *const kBMFMapGetTrafficEnabledMethod = @"flutter_bmfmap/map/getTrafficEnabled"; - NSString *const kBMFMapGetBaiduHeatMapEnabledMethod = @"flutter_bmfmap/map/getBaiduHeatMapEnabled"; - NSString *const kBMFMapGetGesturesEnabledMethod = @"flutter_bmfmap/map/getGesturesEnabled"; - NSString *const kBMFMapGetZoomEnabledMethod = @"flutter_bmfmap/map/getZoomEnabled"; - NSString *const kBMFMapGetZoomEnabledWithTapMethod = @"flutter_bmfmap/map/getZoomEnabledWithTap"; - NSString *const kBMFMapGetScrollEnabledMethod = @"flutter_bmfmap/map/getScrollEnabled"; - NSString *const kBMFMapGetOverlookEnabledMethod = @"flutter_bmfmap/map/getOverlookEnabled"; - NSString *const kBMFMapGetRotateEnabledMethod = @"flutter_bmfmap/map/getRotateEnabled"; - NSString *const kBMFMapGetForceTouchEnabledMethod = @"flutter_bmfmap/map/getForceTouchEnabled"; - NSString *const kBMFMapGetShowMapScaleBarMethod = @"flutter_bmfmap/map/getShowMapScaleBar"; - NSString *const kBMFMapGetMapScaleBarPositionMethod = @"flutter_bmfmap/map/getMapScaleBarPosition"; - NSString *const kBMFMapGetLogoPositionMethod = @"flutter_bmfmap/map/getLogoPosition"; - NSString *const kBMFMapGetVisibleMapBoundsMethod = @"flutter_bmfmap/map/getVisibleMapBounds"; - NSString *const kBMFMapGetBaseIndoorMapEnabledMethod = @"flutter_bmfmap/map/getBaseIndoorMapEnabled"; - NSString *const kBMFMapGetShowIndoorMapPoiMethod = @"flutter_bmfmap/map/getShowIndoorMapPoi"; - -// set -NSString *const kBMFMapUpdateMethod = @"flutter_bmfmap/map/updateMapOptions"; -NSString *const kBMFMapZoomInMethod = @"flutter_bmfmap/map/zoomIn"; -NSString *const kBMFMapZoomOutMethod = @"flutter_bmfmap/map/zoomOut"; -NSString *const kBMFMapSetCustomTrafficColorMethod = @"flutter_bmfmap/map/setCustomTrafficColor"; -NSString *const kBMFMapSetCenterCoordinateMethod = @"flutter_bmfmap/map/setCenterCoordinate"; -NSString *const kBMFMapTakeSnapshotMethod = @"flutter_bmfmap/map/takeSnapshot"; -NSString *const kBMFMapTakeSnapshotWithRectMethod = @"flutter_bmfmap/map/takeSnapshotWithRect"; -NSString *const kBMFMapSetCompassImageMethod = @"flutter_bmfmap/map/setCompassImage"; -NSString *const kBMFMapSetVisibleMapBoundsMethod = @"flutter_bmfmap/map/setVisibleMapBounds"; -NSString *const kBMFMapSetVisibleMapBoundsWithPaddingMethod = @"flutter_bmfmap/map/setVisibleMapBoundsWithPadding"; -NSString *const kBMFMapSetMapStatusMethod = @"flutter_bmfmap/map/setMapStatus"; -NSString *const kBMFMapGetMapStatusMethod = @"flutter_bmfmap/map/getMapStatus"; - -// 室内地图 -NSString *const kBMFMapShowBaseIndoorMapMethod = @"flutter_bmfmap/map/showBaseIndoorMap"; -NSString *const kBMFMapShowBaseIndoorMapPoiMethod = @"flutter_bmfmap/map/showBaseIndoorMapPoi"; -NSString *const kBMFMapSwitchBaseIndoorMapFloorMethod = @"flutter_bmfmap/map/switchBaseIndoorMapFloor"; -NSString *const kBMFMapGetFocusedBaseIndoorMapInfoMethod = @"flutter_bmfmap/map/getFocusedBaseIndoorMapInfo"; - -// 个性化地图 -NSString *const kBMFMapSetCustomMapStyleEnableMethod = @"flutter_bmfmap/map/setCustomMapStyleEnable"; -NSString *const kBMFMapSetCustomMapStylePathMethod = @"flutter_bmfmap/map/setCustomMapStylePath"; -NSString *const kBMFMapSetCustomMapStyleWithOptionMethod = @"flutter_bmfmap/map/setCustomMapStyleWithOption"; - - -#endif diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/MethodConst/BMFOfflineMapMethodConst.h b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/MethodConst/BMFOfflineMapMethodConst.h deleted file mode 100644 index d42889d..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/MethodConst/BMFOfflineMapMethodConst.h +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef __BMFOfflineMapMethodConst__H__ -#define __BMFOfflineMapMethodConst__H__ - -#import - -/// offlineMapChannel -FOUNDATION_EXPORT NSString *const kBMFOfflineMapChannelName; - -/// 状态回调 -FOUNDATION_EXPORT NSString *const kBMFOfflineMapCallBackMethod; - -/// 初始化 -FOUNDATION_EXPORT NSString *const kBMFInitOfflineMapMethod; -/// 启动下载指定城市ID的离线地图,或在暂停更新某城市后继续更新下载某城市离线地图 -FOUNDATION_EXPORT NSString *const kBMFStartOfflineMapMethod; -/// 启动更新指定城市ID的离线地图 -FOUNDATION_EXPORT NSString *const kBMFUpdateOfflineMapMethod; -/// 暂停下载或更新指定城市ID的离线地图 -FOUNDATION_EXPORT NSString *const kBMFPauseOfflineMapMethod; -/// 删除指定城市ID的离线地图 -FOUNDATION_EXPORT NSString *const kBMFRemoveOfflineMapMethod; -/// 销毁离线地图管理模块,不用时调用 -FOUNDATION_EXPORT NSString *const kBMFDestroyOfflinMapMethod; -/// 返回热门城市列表 -FOUNDATION_EXPORT NSString *const kBMFGetHotCityListMapMethod; -/// 返回支持离线地图城市列表 -FOUNDATION_EXPORT NSString *const kBMFGetOfflineCityListMapMethod; -/// 根据城市名搜索该城市离线地图记录 -FOUNDATION_EXPORT NSString *const kBMFSearchCityMapMethod; -/// 返回各城市离线地图更新信息 -FOUNDATION_EXPORT NSString *const kBMFGetAllUpdateInfoMapMethod; -/// 返回指定城市ID离线地图更新信息 -FOUNDATION_EXPORT NSString *const kBMFGetUpdateInfoMapMethod; - -#endif diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/MethodConst/BMFOfflineMapMethodConst.m b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/MethodConst/BMFOfflineMapMethodConst.m deleted file mode 100644 index 514c64d..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/MethodConst/BMFOfflineMapMethodConst.m +++ /dev/null @@ -1,26 +0,0 @@ - -#ifndef __BMFOfflineMapMethodConst__M__ -#define __BMFOfflineMapMethodConst__M__ - -#import - -/// offlineMapChannel -NSString *const kBMFOfflineMapChannelName = @"flutter_bmfmap/offlineMap"; - -/// 状态回调 -NSString *const kBMFOfflineMapCallBackMethod = @"flutter_bmfmap/offlineMap/offlineCallBack"; - -/// 初始化 -NSString *const kBMFInitOfflineMapMethod = @"flutter_bmfmap/offlineMap/initOfflineMap"; -NSString *const kBMFStartOfflineMapMethod = @"flutter_bmfmap/offlineMap/startOfflineMap"; -NSString *const kBMFUpdateOfflineMapMethod = @"flutter_bmfmap/offlineMap/updateOfflineMap"; -NSString *const kBMFPauseOfflineMapMethod = @"flutter_bmfmap/offlineMap/pauseOfflineMap"; -NSString *const kBMFRemoveOfflineMapMethod = @"flutter_bmfmap/offlineMap/removeOfflineMap"; -NSString *const kBMFDestroyOfflinMapMethod = @"flutter_bmfmap/offlineMap/destroyOfflineMap"; -NSString *const kBMFGetHotCityListMapMethod = @"flutter_bmfmap/offlineMap/getHotCityList"; -NSString *const kBMFGetOfflineCityListMapMethod = @"flutter_bmfmap/offlineMap/getOfflineCityList"; -NSString *const kBMFSearchCityMapMethod = @"flutter_bmfmap/offlineMap/searchCityList"; -NSString *const kBMFGetAllUpdateInfoMapMethod = @"flutter_bmfmap/offlineMap/getAllUpdateInfo"; -NSString *const kBMFGetUpdateInfoMapMethod = @"flutter_bmfmap/offlineMap/getUpdateInfo"; - -#endif diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/MethodConst/BMFOverlayMethodConst.h b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/MethodConst/BMFOverlayMethodConst.h deleted file mode 100644 index 32bf752..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/MethodConst/BMFOverlayMethodConst.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef __BMFOverlayMethodConst__H__ -#define __BMFOverlayMethodConst__H__ - -#import - -/// map添加polyline -FOUNDATION_EXPORT NSString *const kBMFMapAddPolylineMethod; -/// map添加arcline -FOUNDATION_EXPORT NSString *const kBMFMapAddArcineMethod; -/// map添加polygon -FOUNDATION_EXPORT NSString *const kBMFMapAddPolygonMethod; -/// map添加circle -FOUNDATION_EXPORT NSString *const kBMFMapAddCircleMethod; -/// map添加tile -FOUNDATION_EXPORT NSString *const kBMFMapAddTileMethod; -/// map添加ground -FOUNDATION_EXPORT NSString *const kBMFMapAddGroundMethod; -/// map删除指定id的overlay -FOUNDATION_EXPORT NSString *const kBMFMapRemoveOverlayMethod; -/// map删除指定id的瓦片图(适配android) -FOUNDATION_EXPORT NSString *const kBMFMapRemoveTileMethod; - -/// 更新polyline属性 -FOUNDATION_EXPORT NSString *const kBMFMapUpdatePolylineMemberMethod; -#endif diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/MethodConst/BMFOverlayMethodConst.m b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/MethodConst/BMFOverlayMethodConst.m deleted file mode 100644 index df8781a..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/MethodConst/BMFOverlayMethodConst.m +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef __BMFOverlayMethodConst__M__ -#define __BMFOverlayMethodConst__M__ - -#import - -NSString *const kBMFMapAddPolylineMethod = @"flutter_bmfmap/overlay/addPolyline"; -NSString *const kBMFMapAddArcineMethod = @"flutter_bmfmap/overlay/addArcline"; -NSString *const kBMFMapAddPolygonMethod = @"flutter_bmfmap/overlay/addPolygon"; -NSString *const kBMFMapAddCircleMethod = @"flutter_bmfmap/overlay/addCircle"; -NSString *const kBMFMapAddTileMethod = @"flutter_bmfmap/overlay/addTile"; -NSString *const kBMFMapAddGroundMethod = @"flutter_bmfmap/overlay/addGround"; -NSString *const kBMFMapRemoveOverlayMethod = @"flutter_bmfmap/overlay/removeOverlay"; -NSString *const kBMFMapRemoveTileMethod = @"flutter_bmfmap/overlay/removeTile"; -NSString *const kBMFMapUpdatePolylineMemberMethod = @"flutter_bmfmap/overlay/updatePolylineMember"; -#endif diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/MethodConst/BMFProjectionConst.h b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/MethodConst/BMFProjectionConst.h deleted file mode 100644 index f0e9f41..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/MethodConst/BMFProjectionConst.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef __BMFProjectionConst__H__ -#define __BMFProjectionConst__H__ - - -#import -// 数据转换 -/// 屏幕坐标转经纬度 -FOUNDATION_EXPORT NSString *const kBMFCoordinateFromScreenPointMethod; -/// 经纬度转换屏幕坐标 -FOUNDATION_EXPORT NSString *const kBMFScreenPointFromCoordinateMethod; - -#endif diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/MethodConst/BMFProjectionConst.m b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/MethodConst/BMFProjectionConst.m deleted file mode 100644 index 62b0149..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/MethodConst/BMFProjectionConst.m +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef __BMFProjectionConst__M__ -#define __BMFProjectionConst__M__ - - -#import - -NSString *const kBMFCoordinateFromScreenPointMethod = @"flutter_bmfmap/projection/coordinateFromScreenPoint"; -NSString *const kBMFScreenPointFromCoordinateMethod = @"flutter_bmfmap/projection/screenPointfromCoordinate"; - -#endif - diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/MethodConst/BMFUserLocationConst.h b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/MethodConst/BMFUserLocationConst.h deleted file mode 100644 index 2a48832..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/MethodConst/BMFUserLocationConst.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef __BMFUserLocationConst__H__ -#define __BMFUserLocationConst__H__ - -#import - -// 定位图层 -/// 设定是否显示定位图层 -FOUNDATION_EXPORT NSString *const kBMFMapShowUserLocationMethod; -/// 设定定位模式,取值为:BMFUserTrackingMode -FOUNDATION_EXPORT NSString *const kBMFMapUserTrackingModeMethod; -/// 返回定位坐标点是否在当前地图可视区域内 -FOUNDATION_EXPORT NSString *const kBMFMapIsUserLocationVisibleMethod; -/// 动态定制我的位置样式 -FOUNDATION_EXPORT NSString *const kBMFMapUpdateLocationDisplayParamMethod; -/// 动态更新我的位置数据 -FOUNDATION_EXPORT NSString *const kBMFMapUpdateLocationDataMethod; - -#endif diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/MethodConst/BMFUserLocationConst.m b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/MethodConst/BMFUserLocationConst.m deleted file mode 100644 index 062e035..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/MethodConst/BMFUserLocationConst.m +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef __BMFUserLocationConst__M__ -#define __BMFUserLocationConst__M__ - -#import - -// 定位图层 -NSString *const kBMFMapShowUserLocationMethod = @"flutter_bmfmap/userLocation/showUserLocation"; -NSString *const kBMFMapUserTrackingModeMethod = @"flutter_bmfmap/userLocation/userTrackingMode"; -NSString *const kBMFMapIsUserLocationVisibleMethod = @"flutter_bmfmap/userLocation/isUserLocationVisible"; -NSString *const kBMFMapUpdateLocationDisplayParamMethod = @"flutter_bmfmap/userLocation/updateLocationDisplayParam"; -NSString *const kBMFMapUpdateLocationDataMethod = @"flutter_bmfmap/userLocation/updateLocationData"; - -#endif - diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFAnnotationModel.h b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFAnnotationModel.h deleted file mode 100644 index 83f3b1b..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFAnnotationModel.h +++ /dev/null @@ -1,69 +0,0 @@ -// -// BMFAnnotationModel.h -// flutter_bmfmap -// -// Created by zbj on 2020/2/11. -// - -#import "BMFModel.h" -@class BMFCoordinate; -@class BMFMapPoint; -@class BMFAnnotationViewOptions; -NS_ASSUME_NONNULL_BEGIN - -@interface BMFAnnotationModel : BMFModel - -/// flutter层mark的唯一id(用于区别哪个marker) -@property (nonatomic, copy) NSString *Id; - -/// 标题 -@property (nonatomic, copy) NSString *title; - -/// 子标题 -@property (nonatomic, copy) NSString *subtitle; - -/// annotation中心坐标. -@property (nonatomic, strong) BMFCoordinate *position; - -/// 标注固定在指定屏幕位置, 必须与screenPointToLock一起使用。 注意:拖动Annotation isLockedToScreen会被设置为false。 -/// 若isLockedToScreen为true,拖动地图时annotaion不会跟随移动; -/// 若isLockedToScreen为false,拖动地图时annotation会跟随移动。 -@property (nonatomic, assign) BOOL isLockedToScreen; - -/// 标注锁定在屏幕上的位置,注意:地图初始化后才能设置screenPointToLock。 -/// 可以在地图加载完成的回调方法:mapViewDidFinishLoading中使用此属性。 -@property (nonatomic, strong)BMFMapPoint *screenPointToLock; - -/// annotationView的参数集合 -@property (nonatomic, strong) BMFAnnotationViewOptions *annotationViewOptions; - -@end - - -@interface BMFAnnotationViewOptions : BMFModel - -/// annotationView复用标识符 -@property (nonatomic, copy) NSString *identifier; - -/// 图片路径 -@property (nonatomic, copy) NSString *icon; - -/// 默认情况下, annotation -/// view的中心位于annotation的坐标位置,可以设置centerOffset改变view的位置, -/// 正的偏移使view朝右下方移动,负的朝左上方,单位是像素 -@property (nonatomic, strong) BMFMapPoint *centerOffset; - -/// 默认情况下,标注没有3D效果,可以设置enabled3D改变使用3D效果,使得标注在地图旋转和俯视时跟随旋转、俯视 -@property (nonatomic, assign) BOOL enabled3D; - -/// 默认为YES,当为NO时view忽略触摸事件 -@property (nonatomic, assign) BOOL enabled; - -/// 当设为YES并实现了setCoordinate:方法时,支持将view在地图上拖动, iOS 3.2以后支持 -@property (nonatomic, assign) BOOL draggable; - -/// 默认为NO,当为YES时为会弹出气泡 -@property (nonatomic, assign) BOOL selected; - -@end -NS_ASSUME_NONNULL_END diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFAnnotationModel.m b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFAnnotationModel.m deleted file mode 100644 index dcef88b..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFAnnotationModel.m +++ /dev/null @@ -1,24 +0,0 @@ -// -// BMFAnnotationModel.m -// flutter_bmfmap -// -// Created by zbj on 2020/2/11. -// - -#import "BMFAnnotationModel.h" -#import "BMFMapModels.h" - -@implementation BMFAnnotationModel - -+ (NSDictionary *)bmf_setupReplacedKeyFromPropertyName{ - return @{@"Id" : @"id", - @"annotationViewOptions" : @"markerOptions" - }; -} - -@end - - -@implementation BMFAnnotationViewOptions - -@end diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFArclineModel.h b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFArclineModel.h deleted file mode 100644 index daedb17..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFArclineModel.h +++ /dev/null @@ -1,42 +0,0 @@ -// -// BMFArclineModel.h -// flutter_bmfmap -// -// Created by zbj on 2020/2/15. -// - -#import "BMFModel.h" - -@class BMFCoordinate; -@class BMFArclineViewOptions; -NS_ASSUME_NONNULL_BEGIN - -@interface BMFArclineModel : BMFModel - -/// flutter层arcline的唯一id(用于区别哪个arcline) -@property (nonatomic, copy) NSString *Id; - -/// 指定的经纬度坐标点数组(需传入3个点) -@property (nonatomic, strong) NSArray *coordinates; - -/// arclineView属性model -@property (nonatomic, strong) BMFArclineViewOptions *arclineOptions; - -@end - -@interface BMFArclineViewOptions : BMFModel - - -/// 颜色16进制 -@property (nonatomic, copy) NSString *color; - -/// 线宽 -@property (nonatomic, assign) int width; - -/// 虚线类型 -@property (nonatomic, assign) int lineDashType; - - - -@end -NS_ASSUME_NONNULL_END diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFArclineModel.m b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFArclineModel.m deleted file mode 100644 index c7f7319..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFArclineModel.m +++ /dev/null @@ -1,25 +0,0 @@ -// -// BMFArclineModel.m -// flutter_bmfmap -// -// Created by zbj on 2020/2/15. -// - -#import "BMFArclineModel.h" -#import "BMFMapModels.h" -@implementation BMFArclineModel - -+ (NSDictionary *)bmf_setupObjectClassInArray{ - return @{@"coordinates" : @"BMFCoordinate"}; -} - -+ (NSDictionary *)bmf_setupReplacedKeyFromPropertyName{ - return @{@"Id" : @"id"}; -} - -@end - -@implementation BMFArclineViewOptions - - -@end diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFCircleModel.h b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFCircleModel.h deleted file mode 100644 index 312a3e9..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFCircleModel.h +++ /dev/null @@ -1,47 +0,0 @@ -// -// BMFCircleModel.h -// flutter_bmfmap -// -// Created by zbj on 2020/2/15. -// - -#import "BMFModel.h" - -@class BMFCoordinate; -@class BMFCircleViewOptions; -NS_ASSUME_NONNULL_BEGIN - -@interface BMFCircleModel : BMFModel - -/// flutter层circle的唯一id(用于区别哪个circle) -@property (nonatomic, copy) NSString *Id; - -/// 半径,单位:米 -@property (nonatomic, assign) double radius; - -/// 中心点坐标 -@property (nonatomic, strong) BMFCoordinate *center; - -/// circleView属性model -@property (nonatomic,strong) BMFCircleViewOptions *circleOptions; - -@end - - -@interface BMFCircleViewOptions : BMFModel - -/// 线宽 -@property (nonatomic, assign) int width; - -/// 颜色16进制strokeColor -@property (nonatomic, copy) NSString *strokeColor; - -/// 颜色16进制fillColor -@property (nonatomic, copy) NSString *fillColor; - -/// 虚线类型 -@property (nonatomic, assign) int lineDashType; - -@end - -NS_ASSUME_NONNULL_END diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFCircleModel.m b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFCircleModel.m deleted file mode 100644 index 5f8f4fd..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFCircleModel.m +++ /dev/null @@ -1,21 +0,0 @@ -// -// BMFCircleModel.m -// flutter_bmfmap -// -// Created by zbj on 2020/2/15. -// - -#import "BMFCircleModel.h" -#import "BMFMapModels.h" - -@implementation BMFCircleModel - -+ (NSDictionary *)bmf_setupReplacedKeyFromPropertyName{ - return @{@"Id" : @"id"}; -} - -@end - -@implementation BMFCircleViewOptions - -@end diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFEdgeInsets.h b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFEdgeInsets.h deleted file mode 100644 index ff76adc..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFEdgeInsets.h +++ /dev/null @@ -1,30 +0,0 @@ -// -// BMFEdgeInsets.h -// flutter_bmfmap -// -// Created by zhangbaojin on 2020/3/3. -// - -#import "BMFModel.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface BMFEdgeInsets : BMFModel - -/// top -@property (nonatomic, assign) CGFloat top; - -/// left -@property (nonatomic, assign) CGFloat left; - -/// bottom -@property (nonatomic, assign) CGFloat bottom; - -/// right -@property (nonatomic, assign) CGFloat right; - -- (UIEdgeInsets)toUIEdgeInsets; - -@end - -NS_ASSUME_NONNULL_END diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFEdgeInsets.m b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFEdgeInsets.m deleted file mode 100644 index 8d0edd7..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFEdgeInsets.m +++ /dev/null @@ -1,16 +0,0 @@ -// -// BMFEdgeInsets.m -// flutter_bmfmap -// -// Created by zhangbaojin on 2020/3/3. -// - -#import "BMFEdgeInsets.h" - -@implementation BMFEdgeInsets - -- (UIEdgeInsets)toUIEdgeInsets{ - return UIEdgeInsetsMake(self.top, self.left, self.bottom, self.right); -} - -@end diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFGroundModel.h b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFGroundModel.h deleted file mode 100644 index e524ff9..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFGroundModel.h +++ /dev/null @@ -1,57 +0,0 @@ -// -// BMFGroundModel.h -// flutter_bmfmap -// -// Created by zhangbaojin on 2020/3/22. -// - -#import "BMFModel.h" - -@class BMFGroundModelOptions; -@class BMFCoordinate; -@class BMFCoordinateBounds; - -NS_ASSUME_NONNULL_BEGIN - -@interface BMFGroundModel : BMFModel - -/// groundOverlay 唯一id -@property (nonatomic, copy) NSString *Id; - -/// 参数集合 -@property (nonatomic, strong) BMFGroundModelOptions *groundOptions; - -@end - -@interface BMFGroundModelOptions : BMFModel - -/// 图片 -@property (nonatomic, copy) NSString *image; - -/// 宽 -@property (nonatomic, assign) double width; - -/// 高 -@property (nonatomic, assign) double height; - -/// 锚点x -@property (nonatomic, assign) double anchorX; - -/// 锚点y -@property (nonatomic, assign) double anchorY; - -/// 缩放级别 -@property (nonatomic, assign) int zoomLevel; - -/// 两种绘制GroundOverlay的方式之一:绘制的位置地理坐标,与anchor配对使用 -@property (nonatomic, strong) BMFCoordinate *position; - -/// 两种绘制GroundOverlay的方式之二:绘制的地理区域范围,图片在此区域内合理缩放 -@property (nonatomic, strong) BMFCoordinateBounds *bounds; - -/// 图片纹理透明度,最终透明度 = 纹理透明度 * alpha,取值范围为[0.0f, 1.0f],默认为1.0f -@property (nonatomic, assign) double transparency; - -@end - -NS_ASSUME_NONNULL_END diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFGroundModel.m b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFGroundModel.m deleted file mode 100644 index 9880a7a..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFGroundModel.m +++ /dev/null @@ -1,23 +0,0 @@ -// -// BMFGroundModel.m -// flutter_bmfmap -// -// Created by zhangbaojin on 2020/3/22. -// - -#import "BMFGroundModel.h" -#import "BMFMapModels.h" - -@implementation BMFGroundModel - -+ (NSDictionary *)bmf_setupReplacedKeyFromPropertyName{ - return @{@"Id" : @"id"}; -} - -@end - - -@implementation BMFGroundModelOptions - - -@end diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFHeatMapModel.h b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFHeatMapModel.h deleted file mode 100644 index 80d1afb..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFHeatMapModel.h +++ /dev/null @@ -1,59 +0,0 @@ -// -// BMFHeatMapModel.h -// flutter_bmfmap -// -// Created by zhangbaojin on 2020/3/26. -// - -#import "BMFModel.h" - -@class BMFGradient; -@class BMFHeatMapModelNode; -@class BMFCoordinate; -@class BMKHeatMap; -@class BMKGradient; -@class BMKHeatMapNode; -NS_ASSUME_NONNULL_BEGIN - -@interface BMFHeatMapModel : BMFModel - -///设置热力图点半径,默认为12ps -@property (nonatomic, assign) int radius; - -///设置热力图渐变,有默认值 DEFAULT_GRADIENT -@property (nonatomic, strong) BMFGradient *gradient; - -///设置热力图层透明度,默认 0.6 -@property (nonatomic, assign) double opacity; - -///用户传入的热力图数据,数组,成员类型为BMFHeatMapModelNode -@property (nonatomic, strong) NSMutableArray *data; - -- (BMKHeatMap *)toBMKHeatMap; - -@end - -@interface BMFGradient : BMFModel - -///渐变色用到的所有颜色数组,数组成员类型为UIColor -@property (nonatomic, strong) NSArray *colors; - -///每一个颜色的起始点数组,,数组成员类型为 [0,1]的double值, given as a percentage of the maximum intensity,个数和mColors的个数必须相同,数组内元素必须时递增的 -@property (nonatomic, strong) NSArray *startPoints; - -- (BMKGradient *)toBMKGradient; - -@end - -@interface BMFHeatMapModelNode : BMFModel - -/// 点的强度权值 -@property (nonatomic, assign) double intensity; - -/// 点的位置坐标 -@property (nonatomic, strong) BMFCoordinate *pt; - -- (BMKHeatMapNode *)toBMKHeatMapNode; - -@end -NS_ASSUME_NONNULL_END diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFHeatMapModel.m b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFHeatMapModel.m deleted file mode 100644 index 9080597..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFHeatMapModel.m +++ /dev/null @@ -1,64 +0,0 @@ -// -// BMFHeatMapModel.m -// flutter_bmfmap -// -// Created by zhangbaojin on 2020/3/26. -// - -#import "BMFHeatMapModel.h" -#import -#import "BMFMapModels.h" -#import "UIColor+BMFString.h" -@implementation BMFHeatMapModel - -+ (NSDictionary *)bmf_setupObjectClassInArray{ - return @{@"data" : @"BMFHeatMapModelNode"}; -} - -- (BMKHeatMap *)toBMKHeatMap{ - BMKHeatMap *heatMap = [BMKHeatMap new]; - heatMap.mRadius = self.radius; - heatMap.mGradient = [self.gradient toBMKGradient]; - heatMap.mOpacity = self.opacity; - NSMutableArray *mut = [NSMutableArray array]; - for (BMFHeatMapModelNode *node in self.data) { - [mut addObject:[node toBMKHeatMapNode]]; - } - heatMap.mData = mut; - return heatMap; -} - -@end - -@implementation BMFGradient - -+ (NSDictionary *)bmf_setupObjectClassInArray{ - return @{@"colors" : @"NSString", - @"startPoints" : @"NSNumber" - }; -} - -- (BMKGradient *)toBMKGradient{ - BMKGradient *gradient = [BMKGradient new]; - NSMutableArray *colors = [NSMutableArray array]; - for (NSString *color in self.colors) { - [colors addObject:[UIColor fromColorString:color]]; - } - gradient.mColors = colors; - gradient.mStartPoints = self.startPoints; - return gradient; -} - -@end - - -@implementation BMFHeatMapModelNode - -- (BMKHeatMapNode *)toBMKHeatMapNode{ - BMKHeatMapNode *node = [BMKHeatMapNode new]; - node.intensity = self.intensity; - node.pt = [self.pt toCLLocationCoordinate2D]; - return node; -} - -@end diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFIndoorMapInfoModel.h b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFIndoorMapInfoModel.h deleted file mode 100644 index a443b5c..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFIndoorMapInfoModel.h +++ /dev/null @@ -1,23 +0,0 @@ -// -// BMFIndoorMapInfoModel.h -// flutter_bmfmap -// -// Created by zhangbaojin on 2020/2/28. -// - -#import "BMFModel.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface BMFIndoorMapInfoModel : BMFModel - -/// 室内ID -@property (nonatomic, strong) NSString* strID; -/// 当前楼层 -@property (nonatomic, strong) NSString* strFloor; -/// 所有楼层信息 -@property (nonatomic, strong) NSMutableArray* listStrFloors; - -@end - -NS_ASSUME_NONNULL_END diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFIndoorMapInfoModel.m b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFIndoorMapInfoModel.m deleted file mode 100644 index 37edbe3..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFIndoorMapInfoModel.m +++ /dev/null @@ -1,14 +0,0 @@ -// -// BMFIndoorMapInfoModel.m -// flutter_bmfmap -// -// Created by zhangbaojin on 2020/2/28. -// - -#import "BMFIndoorMapInfoModel.h" - -@implementation BMFIndoorMapInfoModel -+ (NSDictionary *)bmf_setupObjectClassInArray{ - return @{@"listStrFloors" : @"NSString"}; -} -@end diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFMapPoiModel.h b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFMapPoiModel.h deleted file mode 100644 index f515280..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFMapPoiModel.h +++ /dev/null @@ -1,29 +0,0 @@ -// -// BMFMapPoiModel.h -// flutter_bmfmap -// -// Created by zhangbaojin on 2020/3/6. -// - -#import "BMFModel.h" - -@class BMFCoordinate; -@class BMKMapPoi; - -NS_ASSUME_NONNULL_BEGIN - -@interface BMFMapPoiModel : BMFModel - -/// 点标注的名称 -@property (nonatomic, strong) NSString *text; - -/// 点标注的经纬度坐标 -@property (nonatomic, strong) BMFCoordinate *pt; - -/// 点标注的uid,可能为空 -@property (nonatomic, strong) NSString *uid; - -+ (BMFMapPoiModel *)fromBMKMapPoi:(BMKMapPoi *)poi; -@end - -NS_ASSUME_NONNULL_END diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFMapPoiModel.m b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFMapPoiModel.m deleted file mode 100644 index bc0a665..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFMapPoiModel.m +++ /dev/null @@ -1,20 +0,0 @@ -// -// BMFMapPoiModel.m -// flutter_bmfmap -// -// Created by zhangbaojin on 2020/3/6. -// - -#import "BMFMapPoiModel.h" -#import "BMFMapModels.h" -#import - -@implementation BMFMapPoiModel -+ (BMFMapPoiModel *)fromBMKMapPoi:(BMKMapPoi *)poi{ - BMFMapPoiModel *model = [BMFMapPoiModel new]; - model.text = poi.text; - model.pt = [BMFCoordinate fromCLLocationCoordinate2D:poi.pt]; - model.uid = poi.uid; - return model; -} -@end diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFMapStatusModel.h b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFMapStatusModel.h deleted file mode 100644 index f1c6a48..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFMapStatusModel.h +++ /dev/null @@ -1,43 +0,0 @@ -// -// BMFMapStatusModel.h -// flutter_bmfmap -// -// Created by zbj on 2020/2/20. -// - -#import "BMFModel.h" - -@class BMFCoordinate; -@class BMFMapPoint; -@class BMFCoordinateBounds; -@class BMKMapStatus; -NS_ASSUME_NONNULL_BEGIN - -@interface BMFMapStatusModel : BMFModel - -/// 缩放级别:[3~19] -@property (nonatomic, assign) float fLevel; - -/// 旋转角度 -@property (nonatomic, assign) float fRotation; - -/// 俯视角度:[-45~0] -@property (nonatomic, assign) float fOverlooking; - -/// 屏幕中心点坐标:在屏幕内,超过无效 -@property (nonatomic, strong) BMFMapPoint *targetScreenPt; - -/// 地理中心点坐标:经纬度 -@property (nonatomic, strong) BMFCoordinate *targetGeoPt; - -/// 当前地图范围,采用经纬度坐标系东北,西南两坐标表示范围 -@property (nonatomic, strong) BMFCoordinateBounds *visibleMapBounds; - - -+ (BMFMapStatusModel *)fromMapStatus:(BMKMapStatus *)mapStatus; - -- (BMKMapStatus *)toMapStatus; - -@end - -NS_ASSUME_NONNULL_END diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFMapStatusModel.m b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFMapStatusModel.m deleted file mode 100644 index 3c6323c..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFMapStatusModel.m +++ /dev/null @@ -1,39 +0,0 @@ -// -// BMFMapStatusModel.m -// flutter_bmfmap -// -// Created by zbj on 2020/2/20. -// - -#import "BMFMapStatusModel.h" -#import "BMFMapModels.h" -#import - -typedef struct CG_BOXABLE BMFlutterMapRect BMFlutterMapRect; - -@implementation BMFMapStatusModel -+ (BMFMapStatusModel *)fromMapStatus:(BMKMapStatus *)mapStatus{ - BMFMapStatusModel *model = [BMFMapStatusModel new]; - model.fLevel = mapStatus.fLevel; - model.fRotation = mapStatus.fRotation; - model.fOverlooking = mapStatus.fOverlooking; - model.targetScreenPt = [BMFMapPoint fromCGPoint:mapStatus.targetScreenPt]; - model.targetGeoPt = [BMFCoordinate fromCLLocationCoordinate2D:mapStatus.targetGeoPt]; - BMFMapRect *rect = [BMFMapRect fromBMKMapRect:mapStatus.visibleMapRect]; - model.visibleMapBounds = [rect toBMFCoordinateBounds]; - return model; -} -- (BMKMapStatus *)toMapStatus { - BMKMapStatus *status = [BMKMapStatus new]; - status.fLevel = self.fLevel; - status.fRotation = self.fRotation; - status.fOverlooking = self.fOverlooking; - status.targetGeoPt = [self.targetGeoPt toCLLocationCoordinate2D]; - status.targetScreenPt = [self.targetScreenPt toCGPoint]; - // 这里需要KVC赋值 - BMKMapRect mapRect = [self.visibleMapBounds toBMKMapRect]; - NSValue *value = [NSValue valueWithBytes:&mapRect objCType:@encode(BMKMapRect)]; - [status setValue:value forKey:@"_visibleMapRect"]; - return status; -} -@end diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFOLSearchRecordModel.h b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFOLSearchRecordModel.h deleted file mode 100644 index 4b13754..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFOLSearchRecordModel.h +++ /dev/null @@ -1,71 +0,0 @@ -// -// BMFOLSearchRecordModel.h -// flutter_bmfmap -// -// Created by zhangbaojin on 2020/3/25. -// - -#import "BMFModel.h" - -@class BMFCoordinate; -@class BMKOLSearchRecord; -@class BMKOLUpdateElement; - -NS_ASSUME_NONNULL_BEGIN - -@interface BMFOLSearchRecordModel : BMFModel - -/// 城市名称 -@property (nonatomic, copy) NSString *cityName; - -/// 数据包总大小 -@property (nonatomic, assign) int dataSize; - -/// 城市ID -@property (nonatomic, assign) int cityID; - -/// 城市类型 0:全国;1:省份;2:城市;如果是省份,可以通过childCities得到子城市列表 -@property (nonatomic, assign) int cityType; - -/// 子城市列表 -@property (nonatomic, strong) NSArray *childCities; - -+ (BMFOLSearchRecordModel *)fromBMKOLSearchRecord:(BMKOLSearchRecord *)olSearchRecord; - -+ (NSArray *)fromDataArray:(NSArray *)dataArray; -@end - - -@interface BMFOLUpdateElementModel : BMFModel - -/// 城市名称 -@property (nonatomic, copy) NSString *cityName; - -/// 城市ID -@property (nonatomic, assign) int cityID; - -/// 已下载数据大小,单位:字节 -@property (nonatomic, assign) int size; - -/// 服务端数据大小,当update为YES时有效,单位:字节 -@property (nonatomic, assign) int serversize; - -/// 下载比率,100为下载完成,下载完成后会自动导入,status为4时离线包导入完成 -@property (nonatomic, assign) int ratio; - -/// 下载状态, -1:未定义 1:正在下载 2:等待下载 3:已暂停 4:完成 5:校验失败 6:网络异常 7:读写异常 8:Wifi网络异常 9:离线包数据格式异常,需重新下载离线包 10:离线包导入中 -@property (nonatomic, assign) int status; - -/// 更新状态,离线包是否有更新(有更新需重新下载) -@property (nonatomic, assign) BOOL update; - -/// 城市中心点 -@property (nonatomic, strong) BMFCoordinate *geoPt; - -+ (BMFOLUpdateElementModel *)fromBMKOLUpdateElement:(BMKOLUpdateElement *)olUpdateElement; - -+ (NSArray *)fromDataArray:(NSArray *)dataArray; - -@end - -NS_ASSUME_NONNULL_END diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFOLSearchRecordModel.m b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFOLSearchRecordModel.m deleted file mode 100644 index aeca764..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFOLSearchRecordModel.m +++ /dev/null @@ -1,62 +0,0 @@ -// -// BMFOLSearchRecordModel.m -// flutter_bmfmap -// -// Created by zhangbaojin on 2020/3/25. -// - -#import "BMFOLSearchRecordModel.h" -#import "BMFMapModels.h" -#import - -@implementation BMFOLSearchRecordModel - -+ (NSDictionary *)bmf_setupObjectClassInArray{ - return @{@"childCities" : @"BMFOLSearchRecordModel" - }; -} -+ (BMFOLSearchRecordModel *)fromBMKOLSearchRecord:(BMKOLSearchRecord *)olSearchRecord{ - BMFOLSearchRecordModel *model = [BMFOLSearchRecordModel new]; - model.cityID = olSearchRecord.cityID; - model.cityName = olSearchRecord.cityName; - model.dataSize = (int)olSearchRecord.size; - model.cityType = olSearchRecord.cityType; - if (olSearchRecord.childCities && olSearchRecord.childCities.count > 0) { - model.childCities = [BMFOLSearchRecordModel fromDataArray:olSearchRecord.childCities]; - } - - return model; -} - -+ (NSArray *)fromDataArray:(NSArray *)dataArray{ - NSMutableArray * models = [NSMutableArray array]; - for (BMKOLSearchRecord *record in dataArray) { - [models addObject:[BMFOLSearchRecordModel fromBMKOLSearchRecord:record]]; - } - return models; -} -@end - - -@implementation BMFOLUpdateElementModel - -+ (BMFOLUpdateElementModel *)fromBMKOLUpdateElement:(BMKOLUpdateElement *)olUpdateElement{ - BMFOLUpdateElementModel *model = [BMFOLUpdateElementModel new]; - model.cityID = olUpdateElement.cityID; - model.cityName = olUpdateElement.cityName; - model.size = (int)olUpdateElement.size; - model.serversize = (int)olUpdateElement.serversize; - model.ratio = olUpdateElement.ratio; - model.status = olUpdateElement.status; - model.update = olUpdateElement.update; - model.geoPt = [BMFCoordinate fromCLLocationCoordinate2D:olUpdateElement.pt]; - return model; -} -+ (NSArray *)fromDataArray:(NSArray *)dataArray{ - NSMutableArray *models = [NSMutableArray array]; - for (BMKOLUpdateElement *element in dataArray) { - [models addObject:[BMFOLUpdateElementModel fromBMKOLUpdateElement:element]]; - } - return models; -} -@end diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFPolygonModel.h b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFPolygonModel.h deleted file mode 100644 index 20e0bcc..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFPolygonModel.h +++ /dev/null @@ -1,46 +0,0 @@ -// -// BMFPolygonModel.h -// flutter_bmfmap -// -// Created by zhangbaojin on 2020/2/27. -// - -#import "BMFModel.h" - -@class BMFCoordinate; -@class BMFPolygonViewOptions; -NS_ASSUME_NONNULL_BEGIN - -@interface BMFPolygonModel : BMFModel - -/// flutter层polygon的唯一id(用于区别哪个polygon) -@property (nonatomic, copy) NSString *Id; - -/// 经纬度数组 -@property (nonatomic, strong) NSArray *coordinates; - -/// polygonView属性model -@property (nonatomic,strong) BMFPolygonViewOptions *polygonOptions; - -@end - - -@interface BMFPolygonViewOptions : BMFModel - -/// 线宽 -@property (nonatomic, assign) int width; - -/// 颜色16进制strokeColor -@property (nonatomic, copy) NSString *strokeColor; - -/// 颜色16进制fillColor -@property (nonatomic, copy) NSString *fillColor; - -/// 虚线类型 -@property (nonatomic, assign) int lineDashType; - -@end - - - -NS_ASSUME_NONNULL_END diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFPolygonModel.m b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFPolygonModel.m deleted file mode 100644 index f9b8fd3..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFPolygonModel.m +++ /dev/null @@ -1,25 +0,0 @@ -// -// BMFPolygonModel.m -// flutter_bmfmap -// -// Created by zhangbaojin on 2020/2/27. -// - -#import "BMFPolygonModel.h" -#import "BMFMapModels.h" -@implementation BMFPolygonModel - -+ (NSDictionary *)bmf_setupReplacedKeyFromPropertyName{ - return @{@"Id" : @"id"}; -} - -+ (NSDictionary *)bmf_setupObjectClassInArray{ - return @{@"coordinates" : @"BMFCoordinate"}; -} - -@end - - -@implementation BMFPolygonViewOptions - -@end diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFPolylineModel.h b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFPolylineModel.h deleted file mode 100644 index fb911a0..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFPolylineModel.h +++ /dev/null @@ -1,57 +0,0 @@ -// -// BMFPolylineModel.h -// flutter_bmfmap -// -// Created by zbj on 2020/2/11. -// - -#import "BMFModel.h" - -@class BMFCoordinate; -@class BMFPolylineViewOptions; - -NS_ASSUME_NONNULL_BEGIN - -@interface BMFPolylineModel : BMFModel - -/// flutter层polylinr的唯一id(用于区别哪个polyline) -@property (nonatomic, copy) NSString *Id; - -/// 经纬度数组 -@property (nonatomic, strong) NSArray *coordinates; - -/// indexs -@property (nonatomic, strong) NSArray *indexs; - -/// 是否抽希 -@property (nonatomic, assign) BOOL isThined; - - -/// polylineView属性model -@property (nonatomic, strong) BMFPolylineViewOptions *polylineOptions; - -@end - -@interface BMFPolylineViewOptions : BMFModel - -/// 颜色数组16进制 -@property (nonatomic, strong) NSArray *colors; - -/// 图片路径数组 -@property (nonatomic, strong) NSArray *textures; - -/// 线宽 -@property (nonatomic, assign) int width; - -/// 虚线类型 -@property (nonatomic, assign) int lineDashType; - -/// line头尾处理方式(不支持虚线) -@property (nonatomic, assign) int lineCapType; - -/// line拐角处理方式(不支持虚线) -@property (nonatomic, assign) int lineJoinType; - -@end - -NS_ASSUME_NONNULL_END diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFPolylineModel.m b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFPolylineModel.m deleted file mode 100644 index 61b620e..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFPolylineModel.m +++ /dev/null @@ -1,33 +0,0 @@ -// -// BMFPolylineModel.m -// flutter_bmfmap -// -// Created by zbj on 2020/2/11. -// - -#import "BMFPolylineModel.h" -#import "BMFMapModels.h" - -@implementation BMFPolylineModel - -+ (NSDictionary *)bmf_setupObjectClassInArray{ - return @{@"coordinates" : @"BMFCoordinate", - @"indexs" : @"NSNumber" - }; -} -+ (NSDictionary *)bmf_setupReplacedKeyFromPropertyName{ - return @{@"Id" : @"id"}; -} - -@end - - -@implementation BMFPolylineViewOptions - -+ (NSDictionary *)bmf_setupObjectClassInArray{ - return @{@"colors" : @"NSString", - @"textures" : @"NSString" - }; -} - -@end diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFTileModel.h b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFTileModel.h deleted file mode 100644 index 3d6869b..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFTileModel.h +++ /dev/null @@ -1,54 +0,0 @@ -// -// BMFTileModel.h -// flutter_bmfmap -// -// Created by zhangbaojin on 2020/3/20. -// - -#import "BMFModel.h" - -@class BMFTileModelOptions; -@class BMFTileProvider; -@class BMFCoordinateBounds; - -typedef NS_ENUM(NSUInteger, BMFTileLoadType){ - kBMFTileLoadUrl = 0, ///< 网络加载 - kBMFTileLoadLocalAsync, ///< 本地异步加载 - kBMFTileLoadLocalSync, ///<本地同步加载 -}; - -NS_ASSUME_NONNULL_BEGIN - -@interface BMFTileModel : BMFModel - -/// 唯一id -@property (nonatomic, copy) NSString *Id; - -/// tileLayer的可见最小Zoom值,默认3 -@property (nonatomic, assign) NSInteger minZoom; - -/// tileLayer的可见最大Zoom值,默认21,且不能小于minZoom -@property (nonatomic, assign) NSInteger maxZoom; - -/// tileOverlay的可渲染区域,默认世界范围 -@property (nonatomic, strong) BMFCoordinateBounds *visibleMapBounds; - -/// 瓦片图缓存大小,android端需要,ios端暂时不需要 -@property (nonatomic, assign) int maxTileTmp; - -/// 参数集合 -@property (nonatomic, strong) BMFTileModelOptions *tileOptions; - -@end - -@interface BMFTileModelOptions : BMFModel - -/// 瓦片图加载方式 -@property (nonatomic, assign) BMFTileLoadType tileLoadType; - -/// url -@property (nonatomic, copy) NSString *url; - -@end - -NS_ASSUME_NONNULL_END diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFTileModel.m b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFTileModel.m deleted file mode 100644 index 54e7e95..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFTileModel.m +++ /dev/null @@ -1,22 +0,0 @@ -// -// BMFTileModel.m -// flutter_bmfmap -// -// Created by zhangbaojin on 2020/3/20. -// - -#import "BMFTileModel.h" -#import "BMFMapModels.h" - -@implementation BMFTileModel - -+ (NSDictionary *)bmf_setupReplacedKeyFromPropertyName{ - return @{@"Id" : @"id"}; -} - -@end - -@implementation BMFTileModelOptions - -@end - diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFUserLocationModel.h b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFUserLocationModel.h deleted file mode 100644 index bc6f642..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFUserLocationModel.h +++ /dev/null @@ -1,137 +0,0 @@ -// -// BMFUserLocationModel.h -// flutter_bmfmap -// -// Created by zhangbaojin on 2020/3/01. -// - -#import "BMFModel.h" - -@class BMFCoordinate; -@class BMFLocationModel; -@class BMFHeadingModel; -@class BMKUserLocation; -@class CLHeading; -@class CLLocation; -@class BMKLocationViewDisplayParam; - -NS_ASSUME_NONNULL_BEGIN - -@interface BMFUserLocationModel : BMFModel - -/// 位置更新状态,如果正在更新位置信息,则该值为YES -@property (nonatomic, assign) BOOL updating; - -/// 位置信息,尚未定位成功,则该值为nil -@property (nonatomic, strong) BMFLocationModel *location; - -/// heading信息,尚未定位成功,则该值为nil -@property (nonatomic, strong) BMFHeadingModel *heading; - -/// 定位标注点要显示的标题信息 -@property (nonatomic, copy) NSString *title; - -/// 定位标注点要显示的子标题信息 -@property (nonatomic, copy) NSString *subtitle; - -- (BMKUserLocation *)toBMKUserLocation; - -@end - -@interface BMFLocationModel : BMFModel - -/// 经纬度 -@property(nonatomic, strong) BMFCoordinate *coordinate; - -/// 海拔 -@property(nonatomic, assign) double altitude; - -/// 水平精确度 -@property(nonatomic, assign) double horizontalAccuracy; - -/// 垂直精确度 -@property(nonatomic, assign) double verticalAccuracy; - -/// 航向 -@property(nonatomic, assign) double course; - -/// 速度 -@property(nonatomic, assign) double speed; - -/// 时间 -@property (nonatomic, copy) NSString *timestamp; - -- (CLLocation *)toCLLocation; - -@end - -@interface BMFHeadingModel : BMFModel - -/// 磁头 -/// 表示度方向,其中0度为磁北。无论设备的方向以及用户界面的方向如何,方向都是从设备的顶部引用的。 -/// 范围: 0.0 - 359.9度,0度为地磁北极 -@property (nonatomic, assign) double magneticHeading; - -/// 表示角度方向,其中0度为真北。参考方向 -/// 不考虑设备的方向以及设备的方向 -/// 范围: 0.0 - 359.9度,0为正北 -@property (nonatomic, assign) double trueHeading; - -/// 航向精度 -/// 表示磁头可能与实际地磁头偏差的最大度数。负值表示无效的标题。 -@property (nonatomic, assign) double headingAccuracy; - -/// x轴测量的地磁的原始值 -@property (nonatomic, assign) double x; - -/// y轴测量的地磁的原始值 -@property (nonatomic, assign) double y; - -/// z轴测量的地磁的原始值 -@property (nonatomic, assign) double z; - -/// 时间戳 -@property (nonatomic, copy) NSString *timestamp; - -- (CLHeading *)toCLHeading; - -@end - - -@interface BMFLocationViewDisplayParam : BMFModel - -/// 定位图标X轴偏移量(屏幕坐标) -@property (nonatomic, assign) CGFloat locationViewOffsetX; - -/// 定位图标Y轴偏移量(屏幕坐标) -@property (nonatomic, assign) CGFloat locationViewOffsetY; - -/// 精度圈是否显示,默认YES -@property (nonatomic, assign) BOOL isAccuracyCircleShow; - -/// 精度圈 填充颜色 -@property (nonatomic, copy) NSString *accuracyCircleFillColor; - -/// 精度圈 边框颜色 -@property (nonatomic, copy) NSString *accuracyCircleStrokeColor; - -/// 跟随态旋转角度是否生效,默认YES -@property (nonatomic, assign) BOOL isRotateAngleValid; - -///// 定位图标名称,需要将该图片放到 mapapi.bundle/images 目录下 -//@property (nonatomic, strong) NSString *locationViewImgName; - -/// 用户自定义定位图标,V4.2.1以后支持 -@property (nonatomic, copy) NSString *locationViewImage; - -/// 是否显示气泡,默认YES -@property (nonatomic, assign) BOOL canShowCallOut; - -/// locationView在mapview上的层级 默认值为LOCATION_VIEW_HIERARCHY_BOTTOM -@property (nonatomic, assign) int locationViewHierarchy; - -- (BMKLocationViewDisplayParam *)toBMKLocationViewDisplayParam; - -@end - -NS_ASSUME_NONNULL_END diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFUserLocationModel.m b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFUserLocationModel.m deleted file mode 100644 index d2fedb3..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/Models/BMFUserLocationModel.m +++ /dev/null @@ -1,105 +0,0 @@ -// -// BMFUserLocationModel.m -// flutter_bmfmap -// -// Created by zhangbaojin on 2020/3/01. -// - -#import "BMFUserLocationModel.h" -#import "BMFMapModels.h" -#import "UIColor+BMFString.h" -#import "BMFFileManager.h" -#import - -struct BMFHeadingInfo{ - double x; - double y; - double z; - double magneticHeading; - double trueHeading; - double accuracy; - double timestamp; -}; -typedef struct CG_BOXABLE BMFHeadingInfo BMFHeadingInfo; - -@implementation BMFUserLocationModel -- (BMKUserLocation *)toBMKUserLocation{ - BMKUserLocation *userLocation = [BMKUserLocation new]; - userLocation.location = [self.location toCLLocation]; - userLocation.heading = [self.heading toCLHeading]; - userLocation.title = self.title; - userLocation.subtitle = self.subtitle; - return userLocation; -} -@end - -@implementation BMFLocationModel - -- (CLLocation *)toCLLocation{ - NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; - [dateFormatter setDateFormat:@"YYYY-MM-dd HH:mm:ss"]; - CLLocation *location = [[CLLocation alloc] initWithCoordinate:[self.coordinate toCLLocationCoordinate2D] - altitude:self.altitude - horizontalAccuracy:self.horizontalAccuracy - verticalAccuracy:self.verticalAccuracy - course:self.course speed:self.speed - timestamp:self.timestamp ? [dateFormatter dateFromString:self.timestamp] : [NSDate date]]; - return location; -} - -@end - - -@implementation BMFHeadingModel - -- (CLHeading *)toCLHeading{ - NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; - [dateFormatter setDateFormat:@"YYYY-MM-dd HH:mm:ss"]; - NSDate *date = self.timestamp ? [dateFormatter dateFromString:self.timestamp] : [NSDate date]; - - CLHeading *heading = [CLHeading new]; - BMFHeadingInfo info = {}; - // 磁北 则对应于随时间变化的地球磁场北极 - info.magneticHeading = self.magneticHeading; - // 真北 始终指向地理北极点 - info.trueHeading = self.trueHeading; - // 方向值的误差范围 - info.accuracy = self.headingAccuracy; - // 获取该设备在 X 方向上监听得到的原始磁力值,该磁力值的强度单位是微特斯拉。 - info.x = self.x; - // 获取该设备在 Y 方向上监听得到的原始磁力值,该磁力值的强度单位是微特斯拉。 - info.y = self.y; - // 获取该设备在 Z 方向上监听得到的原始磁力值,该磁力值的强度单位是微特斯拉。 - info.z = self.z; - info.timestamp = [date timeIntervalSince1970] - NSTimeIntervalSince1970; - - // KVC赋值 - NSValue *value = [NSValue valueWithBytes:&info objCType:@encode(BMFHeadingInfo)]; - // CLHeadingInternal - id _internal = [[NSClassFromString(@"CLHeadingInternal") alloc] init]; - // NSConcreteValue - [_internal setValue:value forKey:@"fHeading"]; - [heading setValue:_internal forKey:@"_internal"]; - - return heading; -} - -@end - -@implementation BMFLocationViewDisplayParam - -- (BMKLocationViewDisplayParam *)toBMKLocationViewDisplayParam{ - BMKLocationViewDisplayParam *param = [BMKLocationViewDisplayParam new]; - param.locationViewOffsetX = self.locationViewOffsetX; - param.locationViewOffsetY = self.locationViewOffsetY; - param.isAccuracyCircleShow = self.isAccuracyCircleShow; - param.accuracyCircleStrokeColor = [UIColor fromColorString:self.accuracyCircleStrokeColor]; - param.accuracyCircleFillColor = [UIColor fromColorString:self.accuracyCircleFillColor]; - param.isRotateAngleValid = self.isRotateAngleValid; - param.locationViewImage = [UIImage imageWithContentsOfFile:[[BMFFileManager defaultCenter] pathForFlutterImageName:self.locationViewImage]]; - param.canShowCallOut = self.canShowCallOut; - param.locationViewHierarchy = self.locationViewHierarchy; - return param; -} - -@end diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/OfflineMap/BMFOfflineMap.h b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/OfflineMap/BMFOfflineMap.h deleted file mode 100644 index 4f3e85c..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/OfflineMap/BMFOfflineMap.h +++ /dev/null @@ -1,22 +0,0 @@ -// -// BMFOfflineMap.h -// flutter_bmfmap -// -// Created by zhangbaojin on 2020/3/25. -// - - -#ifndef __BMFOfflineMap__H__ -#define __BMFOfflineMap__H__ -#ifdef __OBJC__ -#import -#endif -#endif - -NS_ASSUME_NONNULL_BEGIN - -@interface BMFOfflineMap : BMKOfflineMap - -@end - -NS_ASSUME_NONNULL_END diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/OfflineMap/BMFOfflineMap.m b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/OfflineMap/BMFOfflineMap.m deleted file mode 100644 index 3cb0fbf..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/OfflineMap/BMFOfflineMap.m +++ /dev/null @@ -1,15 +0,0 @@ -// -// BMFOfflineMap.m -// flutter_bmfmap -// -// Created by zhangbaojin on 2020/3/25. -// - -#import "BMFOfflineMap.h" - -@implementation BMFOfflineMap - -- (void)dealloc{ -// NSLog(@"-offlineMap-dealloc"); -} -@end diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/OfflineMap/BMFOfflineMapHandle.h b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/OfflineMap/BMFOfflineMapHandle.h deleted file mode 100644 index ef95afe..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/OfflineMap/BMFOfflineMapHandle.h +++ /dev/null @@ -1,30 +0,0 @@ -// -// BMFOfflineMapHandle.h -// flutter_bmfmap -// -// Created by zhangbaojin on 2020/3/25. -// - -#import - -@class BMFOfflineMap; - -NS_ASSUME_NONNULL_BEGIN - -@protocol BMFOfflineMapHandle - -@required - -/// offlineMap(弱引用) -@property(nonatomic, weak) BMFOfflineMap *_offlineMap; - -/// 创建协议实例 -- (NSObject *)initWith:(BMFOfflineMap *)offlineMap; - -/// flutter --> ios -- (void)handleMethodCall:(FlutterMethodCall *)call result:(FlutterResult)result; - -@end - - -NS_ASSUME_NONNULL_END diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/OfflineMap/BMFOfflineMapHandles.h b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/OfflineMap/BMFOfflineMapHandles.h deleted file mode 100644 index cc4d1a3..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/OfflineMap/BMFOfflineMapHandles.h +++ /dev/null @@ -1,69 +0,0 @@ -// -// BMFOfflineMapHandles.h -// flutter_bmfmap -// -// Created by zhangbaojin on 2020/3/25. -// - -#import "BMFOfflineMapHandle.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface BMFOfflineMapHandles : NSObject -/// BMFOfflineMapHandler管理中心 -+ (instancetype)defalutCenter; - -- (NSDictionary *)offlineMapHandles; -@end - -#pragma mark - offlineMapHandler -/// 启动下载指定城市ID的离线地图,或在暂停更新某城市后继续更新下载某城市离线地图 -@interface BMFStartOfflineMap : NSObject - -@end - -/// 启动更新指定城市ID的离线地图 -@interface BMFUpdateOfflineMap : NSObject - -@end - -/// 暂停下载或更新指定城市ID的离线地图 -@interface BMFPauseOfflineMap : NSObject - -@end - -/// 删除指定城市ID的离线地图 -@interface BMFRemoveOfflineMap : NSObject - -@end - -/// 销毁离线地图管理模块,不用时调用 -@interface BMFDestroyOfflinMap : NSObject - -@end - -/// 热门城市列表 -@interface BMFGetHotCityListMap : NSObject - -@end - -/// 支持离线地图城市列表 -@interface BMFGetOfflineCityListMap : NSObject - -@end - -/// 根据城市名搜索该城市离线地图记录 -@interface BMFSearchCityMap : NSObject - -@end - -/// 各城市离线地图更新信息 -@interface BMFGetAllUpdateInfoMap : NSObject - -@end - -/// 指定城市ID离线地图更新信息 -@interface BMFGetUpdateInfoMap : NSObject - -@end -NS_ASSUME_NONNULL_END diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/OfflineMap/BMFOfflineMapHandles.m b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/OfflineMap/BMFOfflineMapHandles.m deleted file mode 100644 index de661c7..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/OfflineMap/BMFOfflineMapHandles.m +++ /dev/null @@ -1,274 +0,0 @@ -// -// BMFOfflineMapHandles.m -// flutter_bmfmap -// -// Created by zhangbaojin on 2020/3/25. -// - -#import "BMFOfflineMapHandles.h" -#import "BMFOfflineMapMethodConst.h" -#import "BMFOfflineMap.h" -#import "BMFOLSearchRecordModel.h" -#import "BMFMapModels.h" - -@interface BMFOfflineMapHandles () -{ - NSDictionary *_handles; -} -@end - -static BMFOfflineMapHandles *_instance = nil; -@implementation BMFOfflineMapHandles -/// BMFOfflineMapHandler管理中心 -+ (instancetype)defalutCenter{ - if (!_instance) { - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - _instance = [[BMFOfflineMapHandles alloc] init]; - }); - } - return _instance; -} - -- (NSDictionary *)offlineMapHandles{ - if (!_handles) { - _handles = @{ - kBMFStartOfflineMapMethod: NSStringFromClass([BMFStartOfflineMap class]), - kBMFUpdateOfflineMapMethod: NSStringFromClass([BMFUpdateOfflineMap class]), - kBMFPauseOfflineMapMethod: NSStringFromClass([BMFPauseOfflineMap class]), - kBMFRemoveOfflineMapMethod: NSStringFromClass([BMFRemoveOfflineMap class]), - kBMFDestroyOfflinMapMethod: NSStringFromClass([BMFDestroyOfflinMap class]), - kBMFGetHotCityListMapMethod: NSStringFromClass([BMFGetHotCityListMap class]), - kBMFGetOfflineCityListMapMethod: NSStringFromClass([BMFGetOfflineCityListMap class]), - kBMFSearchCityMapMethod: NSStringFromClass([BMFSearchCityMap class]), - kBMFGetAllUpdateInfoMapMethod: NSStringFromClass([BMFGetAllUpdateInfoMap class]), - kBMFGetUpdateInfoMapMethod: NSStringFromClass([BMFGetUpdateInfoMap class]), - }; - } - return _handles; -} -@end - - -#pragma mark - offlineMapHandler -@implementation BMFStartOfflineMap - -@synthesize _offlineMap; - -- (nonnull NSObject *)initWith:(nonnull BMFOfflineMap *)offlineMap { - _offlineMap = offlineMap; - return self; -} - -- (void)handleMethodCall:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult)result { - if (!call.arguments || !call.arguments[@"cityID"]) { - result(@NO); - } - BOOL success = [_offlineMap start:[[call.arguments safeValueForKey:@"cityID"] intValue]]; - result(@(success)); -} - -@end - -@implementation BMFUpdateOfflineMap - -@synthesize _offlineMap; - -- (nonnull NSObject *)initWith:(nonnull BMFOfflineMap *)offlineMap { - _offlineMap = offlineMap; - return self; -} - -- (void)handleMethodCall:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult)result { - if (!call.arguments || !call.arguments[@"cityID"]) { - result(@NO); - } - BOOL success = [_offlineMap update:[[call.arguments safeValueForKey:@"cityID"] intValue]]; - result(@(success)); -} - -@end - -@implementation BMFPauseOfflineMap - -@synthesize _offlineMap; - -- (nonnull NSObject *)initWith:(nonnull BMFOfflineMap *)offlineMap { - _offlineMap = offlineMap; - return self; -} - -- (void)handleMethodCall:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult)result { - if (!call.arguments || !call.arguments[@"cityID"]) { - result(@NO); - } - BOOL success = [_offlineMap pause:[[call.arguments safeValueForKey:@"cityID"] intValue]]; - result(@(success)); -} - -@end - -@implementation BMFRemoveOfflineMap - -@synthesize _offlineMap; - -- (nonnull NSObject *)initWith:(nonnull BMFOfflineMap *)offlineMap { - _offlineMap = offlineMap; - return self; -} - -- (void)handleMethodCall:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult)result { - if (!call.arguments || !call.arguments[@"cityID"]) { - result(@NO); - } - BOOL success = [_offlineMap remove:[[call.arguments safeValueForKey:@"cityID"] intValue]]; - result(@(success)); -} - -@end - -@implementation BMFDestroyOfflinMap - -@synthesize _offlineMap; - -- (nonnull NSObject *)initWith:(nonnull BMFOfflineMap *)offlineMap { - _offlineMap = offlineMap; - return self; -} - -- (void)handleMethodCall:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult)result { - // TODO:ios没有销毁接口 - result(@(YES)); -} - -@end - -@implementation BMFGetHotCityListMap - -@synthesize _offlineMap; - -- (nonnull NSObject *)initWith:(nonnull BMFOfflineMap *)offlineMap { - _offlineMap = offlineMap; - return self; -} - -- (void)handleMethodCall:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult)result { - NSArray *hotCity = [BMFOLSearchRecordModel fromDataArray:[_offlineMap getHotCityList]]; - NSMutableArray *dicModels = [NSMutableArray array]; - for (BMFOLSearchRecordModel *model in hotCity) { - - [dicModels addObject: [model bmf_toDictionary]]; - } - - if (dicModels.count > 0) { - result(@{@"searchCityRecord" : dicModels}); - } else { - result([NSNull null]); - } - -} - -@end - -@implementation BMFGetOfflineCityListMap - -@synthesize _offlineMap; - -- (nonnull NSObject *)initWith:(nonnull BMFOfflineMap *)offlineMap { - _offlineMap = offlineMap; - return self; -} - -- (void)handleMethodCall:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult)result { - NSArray *offlineCitys = [BMFOLSearchRecordModel fromDataArray:[_offlineMap getOfflineCityList]]; - NSMutableArray *dicModels = [NSMutableArray array]; - for (BMFOLSearchRecordModel *model in offlineCitys) { - - [dicModels addObject: [model bmf_toDictionary]]; - } - - if (dicModels.count > 0) { - result(@{@"searchCityRecord" : dicModels}); - } else { - result([NSNull null]); - } -} - -@end - -@implementation BMFSearchCityMap - -@synthesize _offlineMap; - -- (nonnull NSObject *)initWith:(nonnull BMFOfflineMap *)offlineMap { - _offlineMap = offlineMap; - return self; -} - -- (void)handleMethodCall:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult)result { - if (!call.arguments || !call.arguments[@"cityName"]) { - result([NSNull null]); - } - NSArray *citys = [BMFOLSearchRecordModel fromDataArray:[_offlineMap searchCity:[call.arguments safeValueForKey:@"cityName"]]]; - NSMutableArray *dicModels = [NSMutableArray array]; - for (BMFOLSearchRecordModel *model in citys) { - [dicModels addObject: [model bmf_toDictionary]]; - } - - if (dicModels.count > 0) { - result(@{@"searchCityRecord" : dicModels}); - } else { - result([NSNull null]); - } -} - -@end - -@implementation BMFGetAllUpdateInfoMap - -@synthesize _offlineMap; - -- (nonnull NSObject *)initWith:(nonnull BMFOfflineMap *)offlineMap { - _offlineMap = offlineMap; - return self; -} - -- (void)handleMethodCall:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult)result { - NSArray *models = [BMFOLUpdateElementModel fromDataArray:[_offlineMap getAllUpdateInfo]]; - NSMutableArray *dicModels = [NSMutableArray array]; - for (BMFOLUpdateElementModel *model in models) { - [dicModels addObject:[model bmf_toDictionary]]; - } - - if (dicModels.count > 0) { - result(@{@"updateElements" : dicModels}); - } else { - result([NSNull null]); - } -} - -@end - -@implementation BMFGetUpdateInfoMap - -@synthesize _offlineMap; - -- (nonnull NSObject *)initWith:(nonnull BMFOfflineMap *)offlineMap { - _offlineMap = offlineMap; - return self; -} - -- (void)handleMethodCall:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult)result { - if (!call.arguments || !call.arguments[@"cityID"]) { - result([NSNull null]); - } - BMKOLUpdateElement *element = [_offlineMap getUpdateInfo:[[call.arguments safeValueForKey:@"cityID"] intValue]]; - if (element) { - BMFOLUpdateElementModel *model = [BMFOLUpdateElementModel fromBMKOLUpdateElement:element]; - result([model bmf_toDictionary]); - } else { - result([NSNull null]); - } -} - -@end diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/OfflineMap/BMFOfflineMapManager.h b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/OfflineMap/BMFOfflineMapManager.h deleted file mode 100644 index 9895b0b..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/OfflineMap/BMFOfflineMapManager.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// BMFOfflineMapManager.h -// flutter_bmfmap -// -// Created by zhangbaojin on 2020/3/25. -// - -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface BMFOfflineMapManager : NSObject - -@property (nonatomic, strong) FlutterMethodChannel *channel; - -@end - -NS_ASSUME_NONNULL_END diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/OfflineMap/BMFOfflineMapManager.m b/lib/my_flutter_bmfmap-1.0.2/ios/Classes/OfflineMap/BMFOfflineMapManager.m deleted file mode 100644 index 66e5d93..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/Classes/OfflineMap/BMFOfflineMapManager.m +++ /dev/null @@ -1,65 +0,0 @@ -// -// BMFOfflineMapManager.m -// flutter_bmfmap -// -// Created by zhangbaojin on 2020/3/25. -// - -#import "BMFOfflineMapManager.h" -#import "BMFOfflineMapMethodConst.h" -#import "BMFOfflineMap.h" -#import "BMFOfflineMapHandles.h" - -@interface BMFOfflineMapManager () - -/// 离线地图类的实例 -@property (nonatomic, strong) BMFOfflineMap *offlineMap; - -@end -@implementation BMFOfflineMapManager - -+ (void)registerWithRegistrar:(nonnull NSObject *)registrar { - FlutterMethodChannel *offlineChannel = [FlutterMethodChannel methodChannelWithName:kBMFOfflineMapChannelName binaryMessenger:[registrar messenger]]; - BMFOfflineMapManager *manager = [[BMFOfflineMapManager alloc] init]; - manager.channel = offlineChannel; - [registrar addMethodCallDelegate:manager channel:offlineChannel]; -} - -// 通信回调 -- (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result{ -// NSLog(@"ios-离线地图-method = %@ \n arguments = %@", call.method, call.arguments); - if ([call.method isEqualToString:kBMFInitOfflineMapMethod]) { - [self offlineMap]; - return; - } - BMFOfflineMapHandles *handleCenter = [BMFOfflineMapHandles defalutCenter]; - NSArray *methods = [[handleCenter offlineMapHandles] allKeys]; - - if ([methods containsObject:call.method]) { - __weak __typeof__(_offlineMap) weakOfflineMap = _offlineMap; - NSObject *handler = [[NSClassFromString(handleCenter.offlineMapHandles[call.method]) new] initWith:weakOfflineMap]; - [handler handleMethodCall:call result:result]; - - } else { - result(FlutterMethodNotImplemented); - } -} -- (BMFOfflineMap *)offlineMap{ - if (!_offlineMap) { - _offlineMap = [[BMFOfflineMap alloc] init]; - _offlineMap.delegate = self; - } - return _offlineMap; -} -#pragma mark - BMKOfflineMapDelegate - -- (void)onGetOfflineMapState:(int)type withState:(int)state { -// NSLog(@"-ios-离线地图下载回调type = %d state = %d", type, state); - if (!_channel) { - return; - } - [_channel invokeMethod:kBMFOfflineMapCallBackMethod arguments:@{@"type": @(type), - @"state": @(state)}]; -} - -@end diff --git a/lib/my_flutter_bmfmap-1.0.2/ios/flutter_bmfmap.podspec b/lib/my_flutter_bmfmap-1.0.2/ios/flutter_bmfmap.podspec deleted file mode 100644 index 28b9968..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/ios/flutter_bmfmap.podspec +++ /dev/null @@ -1,29 +0,0 @@ -# -# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html. -# Run `pod lib lint flutter_bmfmap.podspec' to validate before publishing. -# -Pod::Spec.new do |s| - s.name = 'flutter_bmfmap' - s.version = '1.0.0' - s.summary = 'The basic map of Flutter plugin for BaiDuMap.' - s.description = <<-DESC - The basic map of Flutter plugin for BaiDuMap. - DESC - s.homepage = 'https://lbsyun.baidu.com/' - s.license = { :file => '../LICENSE' } - s.author = { 'Baidu.Inc' => 'email@example.com' } - s.source = { :path => '.' } - s.source_files = 'Classes/**/*' - s.public_header_files = 'Classes/**/*.h' - s.dependency 'Flutter' - s.dependency 'BaiduMapKit','5.4.0' - # s.dependency 'bmfcommon_ios', '1.0.5' - s.platform = :ios, '8.0' - - - - - - # Flutter.framework does not contain a i386 slice. Only x86_64 simulators are supported. - s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'VALID_ARCHS[sdk=iphonesimulator*]' => 'x86_64' } -end diff --git a/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/bmfmap_map.dart b/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/bmfmap_map.dart deleted file mode 100644 index 061f83d..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/bmfmap_map.dart +++ /dev/null @@ -1,29 +0,0 @@ -/// flutter百度地图插件map库 -library bmfmap_map; - -export 'map/bmf_map_controller.dart'; -export 'map/bmf_map_linedraw_types.dart'; -export 'map/bmf_map_texture_map_view.dart'; -export 'map/bmf_map_view.dart'; -export 'map/bmf_offline_controller.dart'; - -export 'models/bmf_baseindoormap_info.dart'; -export 'models/bmf_custommap_option.dart'; -export 'models/bmf_heatmap.dart'; -export 'models/bmf_infowindow.dart'; -export 'models/bmf_map_options.dart'; -export 'models/bmf_mappoi.dart'; -export 'models/bmf_mapstatus.dart'; -export 'models/bmf_offline_models.dart'; -export 'models/bmf_userlocation.dart'; - -export 'models/overlays/bmf_arcline.dart'; -export 'models/overlays/bmf_circle.dart'; -export 'models/overlays/bmf_dot.dart'; -export 'models/overlays/bmf_ground.dart'; -export 'models/overlays/bmf_marker.dart'; -export 'models/overlays/bmf_overlay.dart'; -export 'models/overlays/bmf_polygon.dart'; -export 'models/overlays/bmf_polyline.dart'; -export 'models/overlays/bmf_text.dart'; -export 'models/overlays/bmf_tile.dart'; diff --git a/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/map/bmf_map_controller.dart b/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/map/bmf_map_controller.dart deleted file mode 100644 index c7bbb32..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/map/bmf_map_controller.dart +++ /dev/null @@ -1,1124 +0,0 @@ -library bmfmap_map.map.bmf_map_controller; - -import 'dart:typed_data'; -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; -import 'package:flutter_bmfbase/BaiduMap/bmfmap_base.dart'; -import 'package:flutter_bmfmap/BaiduMap/map/bmf_projection.dart'; -import 'package:flutter_bmfmap/BaiduMap/models/bmf_baseindoormap_info.dart'; -import 'package:flutter_bmfmap/BaiduMap/models/bmf_custommap_option.dart'; -import 'package:flutter_bmfmap/BaiduMap/models/bmf_heatmap.dart'; -import 'package:flutter_bmfmap/BaiduMap/models/bmf_infowindow.dart'; -import 'package:flutter_bmfmap/BaiduMap/models/bmf_map_options.dart'; -import 'package:flutter_bmfmap/BaiduMap/models/bmf_mapstatus.dart'; -import 'package:flutter_bmfmap/BaiduMap/models/bmf_userlocation.dart'; -import 'package:flutter_bmfmap/BaiduMap/models/overlays/bmf_arcline.dart'; -import 'package:flutter_bmfmap/BaiduMap/models/overlays/bmf_circle.dart'; -import 'package:flutter_bmfmap/BaiduMap/models/overlays/bmf_dot.dart'; -import 'package:flutter_bmfmap/BaiduMap/models/overlays/bmf_ground.dart'; -import 'package:flutter_bmfmap/BaiduMap/models/overlays/bmf_marker.dart'; -import 'package:flutter_bmfmap/BaiduMap/models/overlays/bmf_polygon.dart'; -import 'package:flutter_bmfmap/BaiduMap/models/overlays/bmf_polyline.dart'; -import 'package:flutter_bmfmap/BaiduMap/models/overlays/bmf_text.dart'; -import 'package:flutter_bmfmap/BaiduMap/models/overlays/bmf_tile.dart'; -import 'package:flutter_bmfmap/BaiduMap/private/bmf_method_channel_handler.dart'; -import 'package:flutter_bmfmap/BaiduMap/private/mapdispatcher/bmf_map_dispatcher_factory.dart'; - -/// 地图通信中心 -class BMFMapController { - // static const _tag = "BMFMapController"; - - /// 通信 - MethodChannel _mapChannel; - - BMFMethodChannelHandler _methodChannelHandler; - - BMFMapController.withId(int id) { - _init(id); - } - - void _init(int id) { - _initMethodChannel(id); - BMFProjection.instance.init(_mapChannel); - } - - void _initMethodChannel(int id) { - _mapChannel = - MethodChannel('flutter_bmfmap/map_' + String.fromCharCode(id + 97)); - _methodChannelHandler = new BMFMethodChannelHandler(); - _mapChannel.setMethodCallHandler(_handlerMethod); - } - - /// flutter -> native - /// - /// 更新地图属性 - /// - /// [BMFMapOptions] change 地图参数集合 - /// - /// bool 更新成功返回true 失败false - Future updateMapOptions(BMFMapOptions change) async { - return await BMFMapDispatcherFactory.instance - .getMapStateDispatcher() - .updateMapOptionsDispatch(_mapChannel, change); - } - - /// 获取地图状态 - /// - /// [BMFMapStatus] mapStatus 地图状态 - Future getMapStatus() async { - return await BMFMapDispatcherFactory.instance - .getMapStateDispatcher() - .getMapStatusDispatch(_mapChannel); - } - - /// 获取map的展示类型 - /// - /// [BMFMapType] mapType 地图的展示类型 - Future getMapType() async { - return await BMFMapDispatcherFactory.instance - .getMapGetStateDispatcher() - .getMapTypeDispatch(_mapChannel); - } - - /// 获取map的比例尺级别 - /// - /// zoomLevel 比例尺级别 - Future getZoomLevel() async { - return await BMFMapDispatcherFactory.instance - .getMapGetStateDispatcher() - .getZoomLevelDispatch(_mapChannel); - } - - /// 获取map的自定义最小比例尺级别 - /// - /// minZoomLevel 自定义最小比例尺级别 - Future getMinZoomLevel() async { - return await BMFMapDispatcherFactory.instance - .getMapGetStateDispatcher() - .getMinZoomLevelDispatch(_mapChannel); - } - - /// 获取map的自定义最大比例尺级别 - /// - /// maxZoomLevel 自定义最大比例尺级别 - Future getMaxZoomLevel() async { - return await BMFMapDispatcherFactory.instance - .getMapGetStateDispatcher() - .getMaxZoomLevelDispatch(_mapChannel); - } - - /// 获取map的旋转角度 - /// - /// rotation 旋转角度 - Future getRotation() async { - return await BMFMapDispatcherFactory.instance - .getMapGetStateDispatcher() - .getRotationDispatch(_mapChannel); - } - - /// 获取map的地图俯视角度 - /// - /// overlooking 地图俯视角度 - Future getOverlooking() async { - return await BMFMapDispatcherFactory.instance - .getMapGetStateDispatcher() - .getOverlookingDispatch(_mapChannel); - } - - /// 获取map的俯视角度最小值 - /// - /// minOverlooking 俯视角度最小值 - /// - /// ios 独有 - Future getMinOverlooking() async { - return await BMFMapDispatcherFactory.instance - .getMapGetStateDispatcher() - .getMinOverlookingDispatch(_mapChannel); - } - - /// 获取map是否现显示3D楼块效果 - /// - /// buildingsEnabled 是否现显示3D楼块效果 - Future getBuildingsEnabled() async { - return await BMFMapDispatcherFactory.instance - .getMapGetStateDispatcher() - .getBuildingsEnabledDispatch(_mapChannel); - } - - /// 获取map是否显示底图poi标注 - /// - /// showMapPoi 是否显示底图poi标注 - /// - /// ios 独有 - Future getShowMapPoi() async { - return await BMFMapDispatcherFactory.instance - .getMapGetStateDispatcher() - .getShowMapPoiDispatch(_mapChannel); - } - - /// 获取map是否打开路况图层(在某些Android机型上,路况图无法正常展示) - /// - /// trafficEnabled 是否打开路况图层 - Future getTrafficEnabled() async { - return await BMFMapDispatcherFactory.instance - .getMapGetStateDispatcher() - .getTrafficEnabledDispatch(_mapChannel); - } - - /// 获取map是否打开百度城市热力图图层 - /// - /// baiduHeatMapEnabled 是否打开百度城市热力图图层 - Future getBaiduHeatMapEnabled() async { - return await BMFMapDispatcherFactory.instance - .getMapGetStateDispatcher() - .getBaiduHeatMapEnabledDispatch(_mapChannel); - } - - /// 获取map是否支持所有手势操作 - /// - /// gesturesEnabled 是否支持所有手势操作 - Future getGesturesEnabled() async { - return await BMFMapDispatcherFactory.instance - .getMapGetStateDispatcher() - .getGesturesEnabledDispatch(_mapChannel); - } - - /// 获取map是否支持用户多点缩放(双指) - /// - /// zoomEnabled 是否支持用户多点缩放(双指) - /// - /// android 中效果是否允许缩放手势包括(双击,双指单击,双指缩放) - Future getZoomEnabled() async { - return await BMFMapDispatcherFactory.instance - .getMapGetStateDispatcher() - .getZoomEnabledDispatch(_mapChannel); - } - - /// 获取map是否支持用户缩放(双击或双指单击) - /// - /// zoomEnabledWithTap 是否支持用户缩放(双击或双指单击) - /// - /// ios 独有 - Future getZoomEnabledWithTap() async { - return await BMFMapDispatcherFactory.instance - .getMapGetStateDispatcher() - .getZoomEnabledWithTapDispatch(_mapChannel); - } - - /// 获取map是否支持用户移动地图 - /// - /// scrollEnabled 是否支持用户移动地图 - Future getScrollEnabled() async { - return await BMFMapDispatcherFactory.instance - .getMapGetStateDispatcher() - .getScrollEnabledDispatch(_mapChannel); - } - - /// 获取map是否支持俯仰角 - /// - /// overlookEnabled 是否支持俯仰角 - Future getOverlookEnabled() async { - return await BMFMapDispatcherFactory.instance - .getMapGetStateDispatcher() - .getOverlookEnabledDispatch(_mapChannel); - } - - /// 获取map是否支持旋转 - /// - /// rotateEnabled 是否支持旋转 - Future getRotateEnabled() async { - return await BMFMapDispatcherFactory.instance - .getMapGetStateDispatcher() - .getRotateEnabledDispatch(_mapChannel); - } - - /// 获取map是否支持3Dtouch - /// - /// forceTouchEnabled 是否支持3Dtouch - /// - /// ios 独有 - Future getForceTouchEnabled() async { - return await BMFMapDispatcherFactory.instance - .getMapGetStateDispatcher() - .getForceTouchEnabledDispatch(_mapChannel); - } - - /// 获取map是否显式比例尺 - /// - /// showMapScaleBar 是否显式比例尺 - /// - /// ios 独有 - Future getShowMapScaleBar() async { - return await BMFMapDispatcherFactory.instance - .getMapGetStateDispatcher() - .getShowMapScaleBarDispatch(_mapChannel); - } - - /// 获取map的比例尺的位置 - /// - /// mapScaleBarPosition 比例尺的位置 - Future getMapScaleBarPosition() async { - return await BMFMapDispatcherFactory.instance - .getMapGetStateDispatcher() - .getMapScaleBarPositionDispatch(_mapChannel); - } - - /// 获取map的logo位置 - /// - /// logoPosition 地图logo的位置 - Future getLogoPosition() async { - return await BMFMapDispatcherFactory.instance - .getMapGetStateDispatcher() - .getLogoPositionDispatch(_mapChannel); - } - - /// 获取map的可视范围 - /// - /// visibleMapBounds 地图的可视范围 - Future getVisibleMapBounds() async { - return await BMFMapDispatcherFactory.instance - .getMapGetStateDispatcher() - .getVisibleMapBoundsDispatch(_mapChannel); - } - - /// 获取map是否显示室内图 - /// - /// baseIndoorMapEnabled 是否显示室内图 - Future getBaseIndoorMapEnabled() async { - return await BMFMapDispatcherFactory.instance - .getMapGetStateDispatcher() - .getBaseIndoorMapEnabledDispatch(_mapChannel); - } - - /// 获取map的室内图标注是否显示 - /// - /// showIndoorMapPoi 室内图标注是否显示 - /// - /// ios 独有 - Future getShowIndoorMapPoi() async { - return await BMFMapDispatcherFactory.instance - .getMapGetStateDispatcher() - .getShowIndoorMapPoiDispatch(_mapChannel); - } - - /// map放大一级比例尺 - /// - /// bool 成功返回true 失败false - Future zoomIn() async { - return await BMFMapDispatcherFactory.instance - .getMapStateDispatcher() - .zoomInDispatch(_mapChannel); - } - - /// map缩小一级比例尺 - /// - /// bool 成功返回true 失败false - Future zoomOut() async { - return await BMFMapDispatcherFactory.instance - .getMapStateDispatcher() - .zoomOutDispatch(_mapChannel); - } - - /// 自定义路况颜色。 - /// - /// 注意:如果需要自定义路况颜色,必须4种路况全都设置。4个参数全部合法时,自定义颜色才有效;否则全部使用默认的。 - /// - /// smooth 路况畅通对应的颜色 - /// - /// slow 路况缓行对应的颜色 - /// - /// congestion 路况拥堵对应的颜色 - /// - /// severeCongestion 路况严重拥堵对应的颜色 - /// - /// bool 成功返回true 失败false - Future setCustomTrafficColor( - {@required Color smooth, - @required Color slow, - @required Color congestion, - @required Color severeCongestion}) async { - return await BMFMapDispatcherFactory() - .getMapStateDispatcher() - .setCustomTrafficColorDispatch( - _mapChannel, smooth, slow, congestion, severeCongestion); - } - - /// 更新地图新状态 - /// - /// [BMFMapStatus] mapStatus 地图新状态 - /// - /// animateDurationMs 动画更新时间 - /// - /// bool 成功返回true 失败false - Future setNewMapStatus( - {@required BMFMapStatus mapStatus, int animateDurationMs}) async { - return await BMFMapDispatcherFactory.instance - .getMapStateDispatcher() - .setNewMapStatusDispatch(_mapChannel, - mapStatus: mapStatus, animateDurationMs: animateDurationMs); - } - - /// 按像素移动地图中心点(Android独有) - /// - /// xPixel 水平方向移动像素数 - /// - /// yPixel 垂直方向移动像素数 - /// - /// animateDurationMs 动画更新时间 - /// - /// bool 成功返回true 失败false - Future setScrollBy(int xPixel, int yPixel, - {int animateDurationMs}) async { - return await BMFMapDispatcherFactory.instance - .getMapStateDispatcher() - .setScrollByDispatch(_mapChannel, xPixel, yPixel, - animateDurationMs: animateDurationMs); - } - - /// 根据给定增量缩放地图级别(Android独有) - /// - /// amount 地图缩放级别增量 - /// - /// animateDurationMs 动画更新时间 - /// - /// bool 成功返回true 失败false - Future setZoomBy(double amount, {int animateDurationMs}) async { - return await BMFMapDispatcherFactory.instance - .getMapStateDispatcher() - .setZoomByDispatch(_mapChannel, amount, - animateDurationMs: animateDurationMs); - } - - /// 根据给定增量以及给定的屏幕坐标缩放地图级别(Android独有) - /// - /// amount 地图缩放级别增量 - /// - /// [BMFPoint] focus 地图缩放中心点屏幕坐标, 若为 null 则返回 null - /// - /// animateDurationMs 动画更新时间 - /// - /// bool 成功返回true 失败false - Future setZoomPointBy(double amount, BMFPoint focus, - {int animateDurationMs}) async { - return await BMFMapDispatcherFactory.instance - .getMapStateDispatcher() - .setZoomPointByDispatch(_mapChannel, amount, focus, - animateDurationMs: animateDurationMs); - } - - /// 设置地图缩放级别(Android独有) - /// - /// zoom 设置地图缩放级别 - /// - /// animateDurationMs 动画更新时间 - /// - /// bool 成功返回true 失败false - Future setZoomTo(double zoom, {int animateDurationMs}) async { - return await BMFMapDispatcherFactory.instance - .getMapStateDispatcher() - .setZoomToDispatch(_mapChannel, zoom, - animateDurationMs: animateDurationMs); - } - - /// 设定地图中心点坐标 - /// - /// [BMFCoordinate] coordinate 要设定的地图中心点坐标,用经纬度表示 - /// - /// animated 是否采用动画效果(ios 独有) - /// - /// animateDurationMs 动画更新时间(android 独有) - /// - /// bool 成功返回true 失败false - Future setCenterCoordinate(BMFCoordinate coordinate, bool animated, - {int animateDurationMs}) async { - return await BMFMapDispatcherFactory.instance - .getMapStateDispatcher() - .setCenterCoordinateDispatch(_mapChannel, coordinate, animated, - animateDurationMs: animateDurationMs); - } - - /// 设置地图中心点以及缩放级别(IOS不支持该接口) - /// - /// [BMFCoordinate]coordinate 要设定的地图中心点坐标,用经纬度表示 - /// zoom 缩放级别 - /// - /// animateDurationMs 动画时间 - /// - /// bool 成功返回true 失败false - Future setNewLatLngZoom( - {@required BMFCoordinate coordinate, - @required double zoom, - int animateDurationMs}) async { - return await BMFMapDispatcherFactory.instance - .getMapStateDispatcher() - .setNewLatLngZoomDispatcher(_mapChannel, - coordinate: coordinate, - zoom: zoom, - animateDurationMs: animateDurationMs); - } - - /// 获得地图当前可视区域截图 - /// - /// 范围内的截取的Images - Future takeSnapshot() async { - return await BMFMapDispatcherFactory.instance - .getMapStateDispatcher() - .takeSnapshotDispatch(_mapChannel); - } - - /// 获得地图指定区域截图 (ios) 处理方式 - /// - /// 指定区域的截取的Image - Future takeSnapshotWithRect(BMFMapRect rect) async { - return await BMFMapDispatcherFactory.instance - .getMapStateDispatcher() - .takeSnapshotWithRectDispatch(_mapChannel, rect); - } - - /// 设置罗盘的图片 - /// - /// imagePath 设置的图片 - /// - /// bool 成功返回true 失败false - Future setCompassImage(String imagePath) async { - return await BMFMapDispatcherFactory.instance - .getMapStateDispatcher() - .setCompassImageDispatch(_mapChannel, imagePath); - } - - /// 设置显示在屏幕中的地图地理范围 - /// - /// [BMFCoordinateBounds]visibleMapBounds 要设定的地图范围(东北,西南)角坐标 - /// - /// animated 是否采用动画效果 (ios 独有) - /// - /// bool 成功返回true 失败false - Future setVisibleMapBounds( - BMFCoordinateBounds visibleMapBounds, bool animated) async { - return await BMFMapDispatcherFactory.instance - .getMapStateDispatcher() - .setVisibleMapBoundsDispatch(_mapChannel, visibleMapBounds, animated); - } - - /// 设置显示在指定相对于MapView的padding中的地图地理范围 - /// - /// [BMFCoordinateBounds]visibleMapBounds 要设定的地图范围(东北,西南)角坐标 - /// - /// [EdgeInsets]insets 指定的四周边界大小 - /// - /// animated 是否采用动画效果(ios 独有) - /// - /// bool 成功返回true 失败false - Future setVisibleMapRectWithPaddingHandler( - {@required BMFCoordinateBounds visibleMapBounds, - @required EdgeInsets insets, - @required bool animated}) async { - return await BMFMapDispatcherFactory.instance - .getMapStateDispatcher() - .setVisibleMapRectWithPaddingDispatch( - _mapChannel, visibleMapBounds, insets, animated); - } - - /// 地图设定是否显示定位图层 - /// - /// show 展示ture 隐藏false - /// - /// bool 成功返回true 失败false - Future showUserLocation(bool show) async { - return await BMFMapDispatcherFactory.instance - .getMapUserLocationDispatcher() - .setShowUserLocationDispatch(_mapChannel, show); - } - - /// 设定定位模式 - /// - /// [BMFUserTrackingMode]userTrackingMode 定位模式 - /// - /// enableDirection 是否允许显示方向信息 (Android 独有) - /// - /// customMarker 设置用户自定义定位图标,可以为 null (Android 独有) - /// - /// bool 成功返回true 失败false - Future setUserTrackingMode(BMFUserTrackingMode userTrackingMode, - {bool enableDirection = true, String customMarker}) async { - return await BMFMapDispatcherFactory.instance - .getMapUserLocationDispatcher() - .setUserTrackingModeDispatch( - _mapChannel, userTrackingMode, enableDirection, - customMarker: customMarker); - } - - /// 定位坐标点是否在当前地图可视区域内 - /// - /// bool true在当前地图可视区域内 false 不在在当前地图可视区域内 - /// - /// Android 不支持该方法 - Future isUserLocationVisible() async { - return await BMFMapDispatcherFactory.instance - .getMapUserLocationDispatcher() - .setIsUserLocationVisibleDispatch(_mapChannel); - } - - /// 动态更新我的位置数据 - /// - /// [BMFUserLocation]userLocation 定位数据 - /// - /// bool 成功返回true 失败false - Future updateLocationData(BMFUserLocation userLocation) async { - return await BMFMapDispatcherFactory.instance - .getMapUserLocationDispatcher() - .setUpdateLocationDataDispatch(_mapChannel, userLocation); - } - - /// 动态定制我的位置样式 - /// - /// [BMFUserlocationDisplayParam]userlocationDisplayParam 样式参数 - /// - /// bool 成功返回true 失败false - Future updateLocationViewWithParam( - BMFUserlocationDisplayParam userlocationDisplayParam) async { - return await BMFMapDispatcherFactory.instance - .getMapUserLocationDispatcher() - .setUpdateLocationViewWithParamDispatch( - _mapChannel, userlocationDisplayParam); - } - - /// 地图添加Marker - /// - /// [BMFMarker] marker 大头针 - /// - /// bool 成功返回true 失败false - Future addMarker(BMFMarker marker) async { - return await BMFMapDispatcherFactory.instance - .getMarkerDispatcher() - .addMarkerDispatch(_mapChannel, marker); - } - - /// 地图添加Markers - /// - /// [BMFMarker]集合 markers 大头针list, - /// - /// bool 成功返回true 失败false - Future addMarkers(List markers) async { - return await BMFMapDispatcherFactory.instance - .getMarkerDispatcher() - .addMarkersDispatch(_mapChannel, markers); - } - - /// 地图添加[BMFInfoWindow] infoWindow - Future addInfoWindow(BMFInfoWindow infoWindow) async { - return await BMFMapDispatcherFactory.instance - .getMarkerDispatcher() - .addInfoWindowDispatch(_mapChannel, infoWindow); - } - - /// 地图批量添加[BMFInfoWindow] infoWindow - Future addInfoWindows(List infoWindows) async { - return await BMFMapDispatcherFactory.instance - .getMarkerDispatcher() - .addInfoWindowsDispatch(_mapChannel, infoWindows); - } - - /// 地图移除[BMFInfoWindow] infoWindow - Future removeInfoWindow(BMFInfoWindow infoWindow) async { - return await BMFMapDispatcherFactory.instance - .getMarkerDispatcher() - .removeInfoWindowDispatch(_mapChannel, infoWindow); - } - - /// 地图指定删除Marker - /// - /// [BMFMarker] marker 要移除的大头针 - /// - /// bool 成功返回true 失败false - Future removeMarker(BMFMarker marker) async { - return await BMFMapDispatcherFactory.instance - .getMarkerDispatcher() - .removeMarkerDispatch(_mapChannel, marker); - } - - /// 地图批量删除Markers - /// - /// [BMFMarker]集合 markers 要移除的大头针list - /// - /// bool 成功返回true 失败false - Future removeMarkers(List markers) async { - return await BMFMapDispatcherFactory.instance - .getMarkerDispatcher() - .removeMarkersDispatch(_mapChannel, markers); - } - - /// 地图清除所有Markers - /// - /// bool 成功返回true 失败false - Future cleanAllMarkers() async { - return await BMFMapDispatcherFactory.instance - .getMarkerDispatcher() - .cleanAllMarkersDispatch(_mapChannel); - } - - /// 地图添加Polyine - /// - /// [BMFPolyline] polyline 折线 - /// - /// bool 成功返回true 失败false - Future addPolyline(BMFPolyline polyline) async { - return await BMFMapDispatcherFactory.instance - .getOverlayDispatcher() - .addPolylineDispatch(_mapChannel, polyline); - } - - /// 地图添加Arcline - /// - /// [BMFArcline] arcline 弧线 - /// - /// bool 成功返回true 失败false - Future addArcline(BMFArcline arcline) async { - return await BMFMapDispatcherFactory.instance - .getOverlayDispatcher() - .addArclineDispatch(_mapChannel, arcline); - } - - /// 地图添加Polygon - /// - /// [BMFPolygon] polygon 多边形 - /// - /// bool 成功返回true 失败false - Future addPolygon(BMFPolygon polygon) async { - return await BMFMapDispatcherFactory.instance - .getOverlayDispatcher() - .addPolygonDispatch(_mapChannel, polygon); - } - - /// 地图添加Circle - /// - /// [BMFCircle] circle 圆 - /// - /// bool 成功返回true 失败false - Future addCircle(BMFCircle circle) async { - return await BMFMapDispatcherFactory.instance - .getOverlayDispatcher() - .addCircleDispatch(_mapChannel, circle); - } - - /// 地图添加Dot - /// - /// [BMFDot] dot 点 - /// - /// bool 成功返回true 失败false - Future addDot(BMFDot dot) async { - return await BMFMapDispatcherFactory.instance - .getOverlayDispatcher() - .addDotDispatch(_mapChannel, dot); - } - - /// 地图添加[BMFText] Text - Future addText(BMFText text) async { - return await BMFMapDispatcherFactory.instance - .getOverlayDispatcher() - .addTextDispatch(_mapChannel, text); - } - - /// 地图添加Ground - /// - /// [BMFGround] ground 图片图层 - /// - /// bool 成功返回true 失败false - Future addGround(BMFGround ground) async { - return await BMFMapDispatcherFactory.instance - .getOverlayDispatcher() - .addGroundDispatch(_mapChannel, ground); - } - - /// 地图指定删除overlay - /// - /// overlayId 要删除overlay的id - /// - /// bool 成功返回true 失败false - Future removeOverlay(String overlayId) async { - return await BMFMapDispatcherFactory.instance - .getOverlayDispatcher() - .removeOverlayDispatch(_mapChannel, overlayId); - } - - /// 添加热力图 - /// - /// [BMFHeatMap] heatMap 热力图 - /// - /// bool 成功返回true 失败false - Future addHeatMap(BMFHeatMap heatMap) async { - return await BMFMapDispatcherFactory.instance - .getMapStateDispatcher() - .addHeatMapDispatch(_mapChannel, heatMap); - } - - /// 删除热力图 - /// - /// bool 成功返回true 失败false - Future removeHeatMap() async { - return await BMFMapDispatcherFactory.instance - .getMapStateDispatcher() - .removeHeatMapDispatch(_mapChannel); - } - - /// 显示热力图(在某些Android机型上,该方法执行无效) - /// - /// show ture展示 false关闭 - /// - /// bool 成功返回true 失败false - Future showHeatMap(bool show) async { - return await BMFMapDispatcherFactory.instance - .getMapStateDispatcher() - .showHeatMapDispatch(_mapChannel, show); - } - - /// 添加瓦片图(在线瓦片图在某些Android机型上暂时不生效,等后续升级解决) - /// - /// [BMFTile] tile 瓦片图 - /// - /// bool 成功返回true 失败false - Future addTile(BMFTile tile) async { - return await BMFMapDispatcherFactory.instance - .getOverlayDispatcher() - .addTileDispatch(_mapChannel, tile); - } - - /// 移除瓦片图 - /// - /// [BMFTile] tile 瓦片图 - /// bool 成功返回true 失败false - Future removeTile(BMFTile tile) async { - return await BMFMapDispatcherFactory.instance - .getOverlayDispatcher() - .removeTileDispatch(_mapChannel, tile); - } - - /// 是否展示室内地图 - /// - /// show 展示true 隐藏false - /// - /// bool 成功返回true 失败false - Future showBaseIndoorMap(bool show) async { - return await BMFMapDispatcherFactory.instance - .getMapStateDispatcher() - .showBaseIndoorMapDispatch(_mapChannel, show); - } - - /// 室内图标注是否显示 - /// - /// showPoi 展示true 隐藏false - /// - /// bool 成功返回true 失败false - Future showBaseIndoorMapPoi(bool showPoi) async { - return await BMFMapDispatcherFactory.instance - .getMapStateDispatcher() - .showBaseIndoorMapPoiDispatch(_mapChannel, showPoi); - } - - /// 设置室内图楼层 - /// - /// floorId 楼层id - /// - /// indoorId 室内图ID - /// - /// [BMFSwitchIndoorFloorError] 枚举:室内图切换楼层结果 - Future switchBaseIndoorMapFloor( - String floorId, String indoorId) async { - return await BMFMapDispatcherFactory.instance - .getMapStateDispatcher() - .switchBaseIndoorMapFloorDispatch(_mapChannel, floorId, indoorId); - } - - /// 获取当前聚焦的室内图信息 - /// - /// [BMFBaseIndoorMapInfo] 当前聚焦的室内图信息。没有聚焦的室内图,返回nil - Future getFocusedBaseIndoorMapInfo() async { - return await BMFMapDispatcherFactory.instance - .getMapStateDispatcher() - .getFocusedBaseIndoorMapInfoDispatch(_mapChannel); - } - - /// 个性化地图样式开关,仅影响前mapView对象,需在地图创建后调用 - /// - /// enable 当前自定义地图样式是否生效 - /// - /// bool 成功返回true 失败false - Future setCustomMapStyleEnable(bool enable) async { - return await BMFMapDispatcherFactory.instance - .getMapStateDispatcher() - .setCustomMapStyleEnableDispatch(_mapChannel, enable); - } - - /// 设置个性化地图样式路径,仅影响当前mapView对象,需在对象创建后调用 - /// - /// path 本地个性化样式文件所在路径,包含文件名 - /// - /// mode 加载模式,0:加载本地文件 1:加载在线文件或在线缓存文件 - /// - /// bool 成功返回true 失败false - Future setCustomMapStyle(String path, int mode) async { - return await BMFMapDispatcherFactory.instance - .getMapStateDispatcher() - .setCustomMapStylePathDispatch(_mapChannel, path, mode); - } - - /// 设置个性化地图样式路径,仅影响当前mapView对象,需在对象创建后调用 - /// - /// 在线个性化样式加载状态回调接口。 - /// - /// 在线个性化样式创建地址:http://lbsyun.baidu.com/apiconsole/custommap - /// - /// 调用该接口加载个性化样式的默认策略为: - /// - /// 1、优先通过[BMFCustomMapStyleOption]配置的个性化样式ID,加载在线个性化样式; - /// - /// 2、如果配置的个性化样式ID无效或在线个性化样式请求失败,则加载本地缓存的最新一次请求成功的在线个性化样式; - /// - /// 3、如果本地缓存中没有最新一次请求成功的在线个性化样式,则通过BMFCustomMapStyleOption中配置的本地离线样式路径加载本地样式; - /// - /// 4、如果以上样式加载都失败,则显示普通地图样式。 - /// - /// [BMFCustomMapStyleOption] customMapStyleOption 在线个性化样式配置选项 - /// - /// preLoad 当预加载成功时会执行的block对象,path:本地缓存的最新一次请求成功的在线个性化样式路径 - /// - /// success 当加载成功时会执行的block对象,path:请求成功的在线个性化样式路径 - /// - /// error 当加载未成功时会执行的block对象,error:失败错误信息,path:失败后根据策略加载的个性化样式路径(路径可能会为nil) - /// - /// bool 成功返回true 失败false - Future setCustomMapStyleWithOptionPath( - {@required BMFCustomMapStyleOption customMapStyleOption, - @required void Function(String path) preload, - @required void Function(String path) success, - @required void Function(int errorCode, String path) error}) async { - return await BMFMapDispatcherFactory.instance - .getMapStateDispatcher() - .setCustomMapStyleWithOptionDispatch( - _mapChannel, customMapStyleOption, preload, success, error); - } - - /// 地图代理回调 - /// - /// native -> flutter - Future _handlerMethod(MethodCall call) async { - // BMFLog.d("_handlerMethod", tag: _tag); - if (_methodChannelHandler != null) { - return await _methodChannelHandler.handlerMethod(call); - } - } - - /// 设置地图加载完成回调 - /// - /// [BMFMapCallback] callback 回调接口 - void setMapDidLoadCallback({@required BMFMapCallback callback}) { - if (_methodChannelHandler != null || callback != null) { - _methodChannelHandler.setMapDidLoadCallback(callback); - } - } - - /// 设置地图渲染回调 - /// - /// [BMFMapSuccessCallback] callback 回调接口 - void setMapDidFinishedRenderCallback( - {@required BMFMapSuccessCallback callback}) { - if (_methodChannelHandler != null || callback != null) { - _methodChannelHandler.setMapDidFinishedRenderCallback(callback); - } - } - - /// 设置地图渲染每一帧画面过程中,以及每次需要重绘地图时(例如添加覆盖物)回调接口 - /// - /// [BMFMapOnDrawMapFrameCallback] callback 回调接口 - void setMapOnDrawMapFrameCallback( - {@required BMFMapOnDrawMapFrameCallback callback}) { - if (_methodChannelHandler != null || callback != null) { - _methodChannelHandler.setMapOnDrawMapFrameCallback(callback); - } - } - - /// 设置地图区域即将改变时会调用接口 - /// - /// [BMFMapRegionChangeCallback] callback 回调接口 - void setMapRegionWillChangeCallback( - {@required BMFMapRegionChangeCallback callback}) { - if (_methodChannelHandler != null || callback != null) { - _methodChannelHandler.setMapRegionWillChangeCallback(callback); - } - } - - /// 设置地图区域改变完成后会调用接口 - /// - /// [BMFMapRegionChangeCallback] callback 回调接口 - void setMapRegionDidChangeCallback( - {@required BMFMapRegionChangeCallback callback}) { - if (_methodChannelHandler != null || callback != null) { - _methodChannelHandler.setMapRegionDidChangeCallback(callback); - } - } - - /// 设置地图区域即将改变时会调用接口 - /// - /// [BMFMapRegionChangeReasonCallback] callback 回调接口 - void setMapRegionWillChangeWithReasonCallback( - {@required BMFMapRegionChangeReasonCallback callback}) { - if (_methodChannelHandler != null || callback != null) { - _methodChannelHandler.setMapRegionWillChangeWithReasonCallback(callback); - } - } - - /// 设置地图区域改变完成后会调用接口 - /// - /// [BMFMapRegionChangeReasonCallback] callback - void setMapRegionDidChangeWithReasonCallback( - {@required BMFMapRegionChangeReasonCallback callback}) { - if (_methodChannelHandler != null || callback != null) { - _methodChannelHandler.setMapRegionDidChangeWithReasonCallback(callback); - } - } - - /// 设置地图点击覆盖物回调,目前只支持[BMFPolyline]polyline - /// - /// [BMFMapOnClickedOverlayCallback] callback - /// - /// polyline只返回了id 与 polylineOptions - void setMapOnClickedOverlayCallback( - {@required BMFMapOnClickedOverlayCallback callback}) { - if (_methodChannelHandler != null || callback != null) { - _methodChannelHandler.setMapOnClickedOverlayCallback(callback); - } - } - - /// 设置点中底图标注后会回调接口 - /// - /// [BMFMapOnClickedMapPoiCallback] callback 回调接口 - void setMapOnClickedMapPoiCallback( - {@required BMFMapOnClickedMapPoiCallback callback}) { - if (_methodChannelHandler != null || callback != null) { - _methodChannelHandler.setMapOnClickedMapPoiCallback(callback); - } - } - - /// 设置点中底图空白处会回调接口 - /// - /// [BMFMapCoordinateCallback] callback 回调接口 - void setMapOnClickedMapBlankCallback( - {@required BMFMapCoordinateCallback callback}) { - if (_methodChannelHandler != null || callback != null) { - _methodChannelHandler.setMapOnClickedMapBlankCallback(callback); - } - } - - /// 设置双击地图时会回调接口 - /// - /// [BMFMapCoordinateCallback] callback 回调接口 - void setMapOnDoubleClickCallback( - {@required BMFMapCoordinateCallback callback}) { - if (_methodChannelHandler != null || callback != null) { - _methodChannelHandler.setMapOnDoubleClickCallback(callback); - } - } - - /// 设置长按地图时会回调接口 - /// - /// [BMFMapCoordinateCallback] callback 回调接口 - void setMapOnLongClickCallback( - {@required BMFMapCoordinateCallback callback}) { - if (_methodChannelHandler != null || callback != null) { - _methodChannelHandler.setMapOnLongClickCallback(callback); - } - } - - /// 设置3DTouch回调接口 - /// - /// [BMFMapOnForceTouchCallback] callback 回调接口 - void setMapOnForceTouchCallback( - {@required BMFMapOnForceTouchCallback callback}) { - if (_methodChannelHandler != null || callback != null) { - _methodChannelHandler.setMapOnForceTouchCallback(callback); - } - } - - /// 设置地图状态改变完成后回调接口 - /// - /// [BMFMapCallback] callback 回调接口 - void setMapStatusDidChangedCallback({@required BMFMapCallback callback}) { - if (_methodChannelHandler != null || callback != null) { - _methodChannelHandler.setMapStatusDidChangedCallback(callback); - } - } - - /// 设置地图View进入/移出室内地图回调接口 - /// - /// [BMFMapInOrOutBaseIndoorMapCallback] callback 回调接口 - void setMapInOrOutBaseIndoorMapCallback( - {@required BMFMapInOrOutBaseIndoorMapCallback callback}) { - if (_methodChannelHandler != null || callback != null) { - _methodChannelHandler.setMapInOrOutBaseIndoorMapCallback(callback); - } - } - - /// 设置marker点击回调 - /// - /// [BMFMapMarkerCallback] callback 回调接口 - void setMapClickedMarkerCallback({@required BMFMapMarkerCallback callback}) { - if (_methodChannelHandler != null || callback != null) { - _methodChannelHandler.setMapClickedMarkerCallback(callback); - } - } - - /// 设置marker选中回调 - /// - /// [BMFMapMarkerCallback] callback 回调接口 - /// - /// Android不支持该接口 - void setMaptDidSelectMarkerCallback( - {@required BMFMapMarkerCallback callback}) { - if (_methodChannelHandler != null || callback != null) { - _methodChannelHandler.setMaptDidSelectMarkerCallback(callback); - } - } - - /// 设置marker取消回调 - /// - /// [BMFMapMarkerCallback] callback 回调接口 - /// - /// Android不支持该接口 - void setMapDidDeselectMarkerCallback( - {@required BMFMapMarkerCallback callback}) { - if (_methodChannelHandler != null || callback != null) { - _methodChannelHandler.setMapDidDeselectMarkerCallback(callback); - } - } - - /// 设置marker拖拽回调 - /// - /// [BMFMapMarkerCallback] callback 回调接口 - void setMapDragMarkerCallback({@required BMFMapMarkerCallback callback}) { - if (_methodChannelHandler != null || callback != null) { - _methodChannelHandler.setMapDragMarkerCallback(callback); - } - } - - /// 设置marker的infoWindow(iOS paopaoView)点击回调 - /// - /// [BMFMapMarkerCallback] callback 回调接口 - void setMapDidClickedInfoWindowCallback( - {@required BMFMapMarkerCallback callback}) { - if (_methodChannelHandler != null || callback != null) { - _methodChannelHandler.setMapDidClickedInfoWindowCallback(callback); - } - } - - /// 设置地图绘制出有效数据的监听回调接口 - /// - /// [BMFMapRenderValidDataCallback] callback 回调接口 - /// - /// ios不支持该接口 - void setMapRenderValidDataCallback( - {@required BMFMapRenderValidDataCallback callback}) { - if (_methodChannelHandler != null || callback != null) { - _methodChannelHandler.setMapRenderValidDataCallback(callback); - } - } -} diff --git a/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/map/bmf_map_linedraw_types.dart b/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/map/bmf_map_linedraw_types.dart deleted file mode 100644 index 431e969..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/map/bmf_map_linedraw_types.dart +++ /dev/null @@ -1,36 +0,0 @@ -library bmfmap_map.map.bmf_map_linedraw_types; - -/// line拐角处理方式(不支持虚线) -/// -/// iOS独有 -enum BMFLineJoinType { - /// 平角衔接 - LineJoinBevel, - - /// 尖角衔接(尖角过长(大于线宽)按平角处理) - LineJoinMiter, - - /// 圆⻆角衔接 - LineJoinRound -} - -/// line头尾处理方式(不支持虚线) -enum BMFLineCapType { - /// 普通头 - LineCapButt, - - /// 圆形头 - LineCapRound -} - -/// 虚线绘制样式 -enum BMFLineDashType { - /// 实折线 - LineDashTypeNone, - - /// 方块样式 - LineDashTypeSquare, - - /// 圆点样式 - LineDashTypeDot, -} diff --git a/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/map/bmf_map_texture_map_view.dart b/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/map/bmf_map_texture_map_view.dart deleted file mode 100644 index 21e7081..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/map/bmf_map_texture_map_view.dart +++ /dev/null @@ -1,82 +0,0 @@ -library bmfmap_map.map.bmf_map_texture_map_view; - -import 'package:flutter/foundation.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter/rendering.dart'; -import 'package:flutter/services.dart'; -import 'package:flutter_bmfmap/BaiduMap/map/bmf_map_controller.dart'; -import 'package:flutter_bmfbase/BaiduMap/bmfmap_base.dart' - show BMFNativeViewType; -import 'package:flutter_bmfmap/BaiduMap/map/bmf_map_view.dart'; -import 'package:flutter_bmfmap/BaiduMap/models/bmf_map_options.dart'; - -/// textureMapView,android设备独有 -class BMFTextureMapWidget extends StatefulWidget { - const BMFTextureMapWidget( - {Key key, - @required this.onBMFMapCreated, - this.hitTestBehavior = PlatformViewHitTestBehavior.opaque, - this.layoutDirection, - this.mapOptions}) - : super(key: key); - - /// 创建mapView回调 - final BMFMapCreatedCallback onBMFMapCreated; - - /// 渗透点击事件,接收范围 opaque > translucent > transparent; - final PlatformViewHitTestBehavior hitTestBehavior; - - /// 嵌入视图文本方向 - final TextDirection layoutDirection; - - /// map属性配置 - final BMFMapOptions mapOptions; - @override - _BMFTextureMapWidgetState createState() => _BMFTextureMapWidgetState(); -} - -class _BMFTextureMapWidgetState extends State { - @override - Widget build(BuildContext context) { - if (defaultTargetPlatform == TargetPlatform.iOS) { - // ios没有textureView - return Text('BMFTextureMapWidget不支持$defaultTargetPlatform'); - } else if (defaultTargetPlatform == TargetPlatform.android) { - return AndroidView( - viewType: BMFNativeViewType.sTextureMapView, - onPlatformViewCreated: _onPlatformCreated, - hitTestBehavior: widget.hitTestBehavior, //渗透点击事件 - layoutDirection: widget.layoutDirection, //嵌入视图文本方向 - creationParams: widget.mapOptions.toMap() as dynamic, //向视图传递参数 - creationParamsCodec: new StandardMessageCodec(), //编解码器类型 - ); - } else { - return Text('flutter_bmfmap插件尚不支持$defaultTargetPlatform'); - } - } - - @override - void didChangeDependencies() { - print('didChangeDependencies'); - super.didChangeDependencies(); - } - - @override - void dispose() { - print('implement dispose'); - super.dispose(); - } - - @override - void didUpdateWidget(BMFTextureMapWidget oldWidget) { - print('didUpdateWidget'); - super.didUpdateWidget(oldWidget); - } - - void _onPlatformCreated(int id) { - if (widget.onBMFMapCreated == null) { - return; - } - widget.onBMFMapCreated(new BMFMapController.withId(id)); - } -} diff --git a/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/map/bmf_map_view.dart b/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/map/bmf_map_view.dart deleted file mode 100644 index 08accc7..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/map/bmf_map_view.dart +++ /dev/null @@ -1,119 +0,0 @@ -library bmfmap_map.map.bmf_map_view; - -import 'package:flutter/foundation.dart'; -import 'package:flutter/gestures.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter/rendering.dart'; -import 'package:flutter/services.dart'; -import 'package:flutter_bmfbase/BaiduMap/bmfmap_base.dart' - show BMFNativeViewType; -import 'package:flutter_bmfmap/BaiduMap/map/bmf_map_controller.dart'; -import 'package:flutter_bmfmap/BaiduMap/models/bmf_map_options.dart'; -import 'package:flutter_bmfmap/BaiduMap/private/mapdispatcher/bmf_map_dispatcher_factory.dart'; - -/// 地图创建回调 -typedef BMFMapCreatedCallback = void Function(BMFMapController controller); - -/// 百度地图Widget -class BMFMapWidget extends StatefulWidget { - /// BMFMapWidget构造方法 - const BMFMapWidget( - {Key key, - @required this.onBMFMapCreated, - this.hitTestBehavior = PlatformViewHitTestBehavior.opaque, - this.layoutDirection, - this.mapOptions}) - : super(key: key); - - /// 创建mapView回调 - final BMFMapCreatedCallback onBMFMapCreated; - - /// 渗透点击事件,接收范围 opaque > translucent > transparent; - final PlatformViewHitTestBehavior hitTestBehavior; - - /// 嵌入视图文本方向 - final TextDirection layoutDirection; - - /// map属性配置 - final BMFMapOptions mapOptions; - @override - _BMFMapWidgetState createState() => _BMFMapWidgetState(); -} - -class _BMFMapWidgetState extends State { - final _gestureRecognizers = >[ - Factory(() => EagerGestureRecognizer()), - ].toSet(); - - int _widgetID; - - @override - Widget build(BuildContext context) { - if (defaultTargetPlatform == TargetPlatform.iOS) { - // ios - return UiKitView( - viewType: BMFNativeViewType.sMapView, //原生交互时唯一标识符 - onPlatformViewCreated: _onPlatformCreated, //创建视图后的回调 - gestureRecognizers: _gestureRecognizers, //透传手势,貌似不加也行 - hitTestBehavior: widget.hitTestBehavior, //渗透点击事件 - layoutDirection: widget.layoutDirection, //嵌入视图文本方向 - creationParams: widget.mapOptions.toMap() as dynamic, //向视图传递参数 - creationParamsCodec: new StandardMessageCodec(), //编解码器类型 - ); - } else if (defaultTargetPlatform == TargetPlatform.android) { - return AndroidView( - viewType: BMFNativeViewType.sMapView, - onPlatformViewCreated: _onPlatformCreated, - hitTestBehavior: widget.hitTestBehavior, //渗透点击事件 - layoutDirection: widget.layoutDirection, //嵌入视图文本方向 - creationParams: widget.mapOptions.toMap() as dynamic, //向视图传递参数 - creationParamsCodec: new StandardMessageCodec(), //编解码器类型 - ); - } else { - return Text('flutter_bmfmap插件尚不支持$defaultTargetPlatform'); - } - } - - void _onPlatformCreated(int id) { - if (widget.onBMFMapCreated == null) { - return; - } - - _widgetID = id; - BMFMapDispatcherFactory.instance - .getMapWidgetStateDispatcher() - .initChannel(id); - widget.onBMFMapCreated(new BMFMapController.withId(id)); - } - - @override - void didChangeDependencies() { - print('didChangeDependencies'); - super.didChangeDependencies(); - } - - @override - void dispose() { - print('implement dispose'); - BMFMapDispatcherFactory.instance.getMapWidgetStateDispatcher().unInit(); - super.dispose(); - } - - @override - void didUpdateWidget(BMFMapWidget oldWidget) { - print('didUpdateWidget'); - super.didUpdateWidget(oldWidget); - BMFMapDispatcherFactory.instance - .getMapWidgetStateDispatcher() - .sendMapWidgetDidUpdateMsg(_widgetID); - } - - @override - void reassemble() { - print('reassemble'); - super.reassemble(); - BMFMapDispatcherFactory.instance - .getMapWidgetStateDispatcher() - .sendMapWidgetReassembleMsg(_widgetID); - } -} diff --git a/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/map/bmf_offline_controller.dart b/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/map/bmf_offline_controller.dart deleted file mode 100644 index f2bde24..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/map/bmf_offline_controller.dart +++ /dev/null @@ -1,141 +0,0 @@ -library bmfmap_map.bmf_offline_controller; - -import 'package:flutter/services.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter_bmfmap/BaiduMap/models/bmf_offline_models.dart'; -import 'package:flutter_bmfmap/BaiduMap/private/mapdispatcher/bmf_map_method_id.dart'; -import 'package:flutter_bmfmap/BaiduMap/private/mapdispatcher/bmf_offline_map_dispatcher.dart'; - -/// 通知事件回调方法 -/// -/// type: 事件类型, -/// 取值为MKOfflineMap.TYPE_NEW_OFFLINE, MKOfflineMap.TYPE_DOWNLOAD_UPDATE, -/// MKOfflineMap.TYPE_VER_UPDATE. -/// -/// state:事件状态; -/// 当type为TYPE_NEW_OFFLINE时,表示新安装的离线地图数目; -/// 当type为TYPE_DOWNLOAD_UPDATE时,表示更新的城市ID。 -typedef BMFGetOfflineMapStateback = void Function(int type, int state); - -class OfflineController { - /// 新安装离线地图事件类型 - static const int TYPE_NEW_OFFLINE = 6; - - /// 离线地图下载更新事件类型 - static const int TYPE_DOWNLOAD_UPDATE = 0; - - /// 离线地图网络问题 - static const int TYPE_NETWORK_ERROR = 2; - - /// 离线地图数据版本更新事件类型 - static const int TYPE_VER_UPDATE = 4; - - MethodChannel _channel; - BMFOfflineMapDispatcher _bmfOfflineMapDispatcher; - BMFGetOfflineMapStateback _bmfGetOfflineMapStateback; - - OfflineController() { - _channel = MethodChannel('flutter_bmfmap/offlineMap'); - _bmfOfflineMapDispatcher = BMFOfflineMapDispatcher(); - _channel.setMethodCallHandler(_handlerMethod); - } - - /// 初始化 - /// - /// 调用离线接口之前必须先初始化 - /// - /// 在某些Android机型上下载有问题 - Future init() async { - return await _bmfOfflineMapDispatcher.initOfflineMapDispatch(_channel); - } - - /// 启动下载指定城市ID的离线地图,或在暂停更新某城市后继续更新下载某城市离线地图 - /// - /// cityID 指定的城市ID - /// 成功返回true,否则返回false - Future startOfflineMap(int cityID) async { - return await _bmfOfflineMapDispatcher.startOfflineMapDispatch( - _channel, cityID); - } - - /// 启动更新指定城市ID的离线地图 - /// - /// cityID 指定的城市ID - /// 成功返回true,否则返回false - Future updateOfflineMap(int cityID) async { - return await _bmfOfflineMapDispatcher.updateOfflineMapDispatch( - _channel, cityID); - } - - /// 暂停下载或更新指定城市ID的离线地图 - /// - /// cityID 指定的城市ID - /// 成功返回true,否则返回false - Future pauseOfflineMap(int cityID) async { - return await _bmfOfflineMapDispatcher.pauseOfflineMapDispatch( - _channel, cityID); - } - - /// 删除指定城市ID的离线地图 - /// - /// cityID 指定的城市ID - /// 成功返回true,否则返回false - Future removeOfflineMap(int cityID) async { - return await _bmfOfflineMapDispatcher.removeOfflineMapDispatch( - _channel, cityID); - } - - /// 销毁离线地图管理模块,不用时调用 - Future destroyOfflineMap() async { - return await _bmfOfflineMapDispatcher.destroyOfflineMapDispatch(_channel); - } - - /// 返回热门城市列表 - Future> getHotCityList() async { - return await _bmfOfflineMapDispatcher.getHotCityListDispatch(_channel); - } - - /// 返回支持离线地图城市列表 - Future> getOfflineCityList() async { - return await _bmfOfflineMapDispatcher.getOfflineCityListDispatch(_channel); - } - - /// 根据城市名搜索该城市离线地图记录 - Future> searchCity(String cityName) async { - return await _bmfOfflineMapDispatcher.searchCityDispatch( - _channel, cityName); - } - - /// 返回各城市离线地图更新信息 - Future> getAllUpdateInfo() async { - return await _bmfOfflineMapDispatcher.getAllUpdateInfoDispatch(_channel); - } - - /// 返回指定城市ID离线地图更新信息 - /// - /// id 城市id - Future getUpdateInfo(int id) async { - return await _bmfOfflineMapDispatcher.getUpdateInfoDispatch(_channel, id); - } - - /// 返回通知事件 - void onGetOfflineMapStateBack( - {@required BMFGetOfflineMapStateback callback}) { - if (_bmfGetOfflineMapStateback != null || callback == null) { - return; - } - this._bmfGetOfflineMapStateback = callback; - } - - Future _handlerMethod(MethodCall call) async { - String method = call.method; - if (null == method) { - return; - } - if (method == BMFOfflineMethodId.kMapOfflineCallBackMethod) { - int type = await call.arguments['type']; - int state = await call.arguments['state']; - this._bmfGetOfflineMapStateback(type, state); - } - } -} diff --git a/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/map/bmf_projection.dart b/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/map/bmf_projection.dart deleted file mode 100644 index 808db96..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/map/bmf_projection.dart +++ /dev/null @@ -1,85 +0,0 @@ -import 'package:flutter/services.dart'; -import 'package:flutter_bmfbase/BaiduMap/bmfmap_base.dart' - show BMFCoordinate, BMFPoint, BMFLog; -import 'package:flutter_bmfmap/BaiduMap/private/mapdispatcher/bmf_map_method_id.dart' - show BMFProjectionMethodId; - -/// Projection接口用于屏幕像素点坐标系统和地球表面经纬度点坐标系统之间的变换。 -class BMFProjection { - factory BMFProjection() => _getInstance(); - - static BMFProjection get instance => _getInstance(); - - static BMFProjection _instance; - - /// 通信 - MethodChannel _mapChannel; - - BMFProjection._internal(); - - static BMFProjection _getInstance() { - if (null == _instance) { - _instance = new BMFProjection._internal(); - } - - return _instance; - } - - void init(MethodChannel methodChannel) { - _mapChannel = methodChannel; - } - - /// 将屏幕坐标转换成地理坐标 - /// - /// [BMFPoint] point 屏幕坐标 如果传入null 则返回null - /// - /// [BMFCoordinate] 地理坐标 - Future convertScreenPointToCoordinate(BMFPoint point) async { - if (null == _mapChannel) { - return null; - } - - if (null == point) { - return null; - } - BMFCoordinate result; - try { - Map map = (await _mapChannel.invokeMethod( - BMFProjectionMethodId.kCoordinateFromScreenPointMethod, - {'point': point?.toMap()} as dynamic)) as Map; - result = BMFCoordinate.coordinate().fromMap(map['coordinate']) - as BMFCoordinate; - } on PlatformException catch (e) { - BMFLog.e(e.toString()); - } - - return result; - } - - /// 将地理坐标转换成屏幕坐标 - /// - /// [BMFCoordinate] location 地理坐标 如果传入 null 则返回null - /// - /// [BMFPoint] 屏幕坐标 - Future convertCoordinateToScreenPoint( - BMFCoordinate location) async { - if (null == _mapChannel) { - return null; - } - - if (null == location) { - return null; - } - - BMFPoint point; - try { - Map map = ((await _mapChannel.invokeMethod( - BMFProjectionMethodId.kScreenPointFromCoordinateMethod, - {'coordinate': location?.toMap()} as dynamic))) as Map; - point = BMFPoint.point().fromMap(map['point']) as BMFPoint; - } on PlatformException catch (e) { - BMFLog.e(e.toString()); - } - return point; - } -} diff --git a/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/models/bmf_baseindoormap_info.dart b/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/models/bmf_baseindoormap_info.dart deleted file mode 100644 index b94ecea..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/models/bmf_baseindoormap_info.dart +++ /dev/null @@ -1,37 +0,0 @@ -library bmfmap_map.models.bmf_baseindoormap_info; - -import 'package:flutter_bmfbase/BaiduMap/bmfmap_base.dart' show BMFModel; - -/// 此类表示室内图基础信息 -class BMFBaseIndoorMapInfo implements BMFModel { - static BMFBaseIndoorMapInfo baseIndoorMapInfo() => BMFBaseIndoorMapInfo(); - - /// 室内ID - String strID; - - /// 当前楼层 - String strFloor; - - /// 所有楼层信息 - List listStrFloors; - - /// BMFBaseIndoorMapInfo构造方法 - BMFBaseIndoorMapInfo({this.strID, this.strFloor, this.listStrFloors}); - @override - fromMap(Map map) { - List list = map['listStrFloors'] as List; - return new BMFBaseIndoorMapInfo( - strID: map['strID'], - strFloor: map['strFloor'], - listStrFloors: list?.map((s) => s as String)?.toList()); - } - - @override - Map toMap() { - return { - 'strID': this.strID, - 'strFloor': this.strFloor, - 'listStrFloors': this.listStrFloors?.map((s) => s?.toString())?.toList() - }; - } -} diff --git a/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/models/bmf_custommap_option.dart b/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/models/bmf_custommap_option.dart deleted file mode 100644 index 23c613e..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/models/bmf_custommap_option.dart +++ /dev/null @@ -1,37 +0,0 @@ -library bmfmap_map.models.bmf_custommap_option; - -import 'package:flutter/material.dart'; -import 'package:flutter_bmfbase/BaiduMap/bmfmap_base.dart' show BMFModel; - -/// 在线个性化样式配置选项 -class BMFCustomMapStyleOption implements BMFModel { - BMFCustomMapStyleOption customMapStyleOption() => BMFCustomMapStyleOption( - customMapStyleID: null, customMapStyleFilePath: null); - - /// 个性化地图样式ID,可从百度地图开放平台控制台http://lbsyun.baidu.com/apiconsole/custommap获取个性化样式ID - /// - /// 样式ID是和AK绑定的,因此若要两端用同一个id,必须是同一个账号申请的Android和iOS的AK - String customMapStyleID; - - /// 个性化地图文件路径,通过id加载失败时,将会从本地加载此路径下的个性化样式 - String customMapStyleFilePath; - - /// BMFCustomMapStyleOption构造方法 - BMFCustomMapStyleOption( - {@required this.customMapStyleID, this.customMapStyleFilePath}); - - @override - fromMap(Map map) { - return new BMFCustomMapStyleOption( - customMapStyleID: map['customMapStyleID'], - customMapStyleFilePath: map['customMapStyleFilePath']); - } - - @override - Map toMap() { - return { - 'customMapStyleID': this.customMapStyleID, - 'customMapStyleFilePath': this.customMapStyleFilePath - }; - } -} diff --git a/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/models/bmf_heatmap.dart b/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/models/bmf_heatmap.dart deleted file mode 100644 index dd8b150..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/models/bmf_heatmap.dart +++ /dev/null @@ -1,118 +0,0 @@ -library bmfmap_map.models.bmf_heatmap; - -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_bmfbase/BaiduMap/bmfmap_base.dart' - show BMFModel, BMFCoordinate, ColorUtil; - -/// 热力图瓦片提供者 -class BMFHeatMap implements BMFModel { - /// 用户传入的热力图数据,数组,成员类型为BMFHeatMapNode - List data; - - /// 设置热力图点半径 - int radius; - - /// 设置热力图层透明度,默认 0.6 - double opacity; - - /// 设置热力图渐变 - BMFGradient gradient; - - /// BMFHeatMap构造方法 - BMFHeatMap( - {@required this.data, this.radius, this.opacity: 0.6, this.gradient}); - - @override - Map toMap() { - return { - 'data': this - .data - ?.map((weightedCoordinate) => weightedCoordinate?.toMap()) - ?.toList(), - 'radius': this.radius, - 'opacity': this.opacity, - 'gradient': this.gradient?.toMap() - }; - } - - /// map -> dynamic - @override - dynamic fromMap(Map map) { - if (null == map) { - return null; - } - List data = map['data'] as List; - return new BMFHeatMap( - data: data - ?.map((node) => BMFHeatMapNode.heatMapNode().fromMap(node)) - ?.toList(), - radius: map['radius'], - opacity: map['opacity'], - gradient: BMFGradient.gradient().fromMap(map['gradient'])); - } -} - -/// 热力图节点信息 -class BMFHeatMapNode implements BMFModel { - static BMFHeatMapNode heatMapNode() => - BMFHeatMapNode(intensity: null, pt: null); - - /// 点的强度权值 - double intensity; - - /// 点的位置坐标 - BMFCoordinate pt; - - BMFHeatMapNode({@required this.intensity, @required this.pt}) { - this.intensity = this.intensity > 1 ? this.intensity : 1.0; - } - @override - fromMap(Map map) { - return new BMFHeatMapNode( - intensity: map['intensity'], - pt: BMFCoordinate.coordinate().fromMap(map['pt'])); - } - - @override - Map toMap() { - return {'intensity': this.intensity, 'pt': this.pt?.toMap()}; - } -} - -/// 热力图渐变色定义类 -class BMFGradient implements BMFModel { - static BMFGradient gradient() => BMFGradient(colors: null, startPoints: null); - - /// 渐变色用到的所有颜色数组 colors与startPoints必须对应 - List colors; - - /// 每一个颜色的起始点数组,数组成员类型为 【0,1】的double值, - /// 个数和mColors的个数必须相同, - /// 数组内元素必须时递增的 例 【0.1, 0.5, 1】; - List startPoints; - - BMFGradient({@required this.colors, @required this.startPoints}); - - @override - dynamic fromMap(Map map) { - if (null == map) { - return null; - } - - List colors = map['colors'] as List; - List startPoints = map['startPoints'] as List; - return new BMFGradient( - colors: colors?.map((color) => ColorUtil.hexToColor(color))?.toList(), - startPoints: startPoints?.map((p) => p as double)?.toList()); - } - - @override - Map toMap() { - return { - 'colors': - this.colors?.map((color) => color.value.toRadixString(16))?.toList(), - 'startPoints': this.startPoints?.map((p) => p)?.toList() - }; - } -} diff --git a/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/models/bmf_infowindow.dart b/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/models/bmf_infowindow.dart deleted file mode 100644 index 0e666d5..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/models/bmf_infowindow.dart +++ /dev/null @@ -1,68 +0,0 @@ -library bmfmap_map.models.bmf_infowindow; - -import 'package:flutter/cupertino.dart'; -import 'package:flutter_bmfbase/BaiduMap/bmfmap_base.dart' - show BMFModel, BMFCoordinate; - -/// infoWindow -class BMFInfoWindow extends BMFModel { - /// infoWindow唯一id - String _id; - - /// infowWindow图片名 - String image; - - /// infoWindow显示位置 - BMFCoordinate coordinate; - - /// infoWindow y轴方向偏移 - double yOffset; - - /// 是否以bitmap形式添加 - bool isAddWithBitmap; - - /// BMFInfoWindow构造方法 - BMFInfoWindow( - {@required this.image, - @required this.coordinate, - this.yOffset, - this.isAddWithBitmap}) { - this._id = this.hashCode.toString(); - } - - BMFInfoWindow.withMap(Map map) { - if (null == map) { - return; - } - - this._id = map['id']; - this.image = map['image']; - this.coordinate = BMFCoordinate.coordinate().fromMap(map['coordinate']); - this.yOffset = map['yOffset']; - this.isAddWithBitmap = map['isAddWithBitmapDescriptor']; - } - - String getId() { - return _id; - } - - @override - fromMap(Map map) { - if (null == map) { - return null; - } - - return BMFInfoWindow.withMap(map); - } - - @override - Map toMap() { - return { - "id": this.getId(), - 'image': this.image, - 'coordinate': this.coordinate.toMap(), - 'yOffset': this.yOffset, - 'isAddWithBitmapDescriptor': this.isAddWithBitmap - }; - } -} diff --git a/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/models/bmf_map_options.dart b/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/models/bmf_map_options.dart deleted file mode 100644 index da9f79f..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/models/bmf_map_options.dart +++ /dev/null @@ -1,212 +0,0 @@ -library bmfmap_map.models.bmf_map_options; - -import 'package:flutter_bmfbase/BaiduMap/bmfmap_base.dart'; - -/// mapView属性集合 -class BMFMapOptions { - static BMFMapOptions mapOptions() => BMFMapOptions(); - - /// 当前地图类型,默认标准地图 - /// - /// MapTypeNone = MapTypeNone - /// - /// 标准地图 = MapTypeStandard - /// - /// 卫星地图 = MapTypeSatellite - BMFMapType mapType; - - /// 限制地图的显示范围(地图状态改变时,该范围不会在地图显示范围外。设置成功后,会调整地图显示该范围) - BMFCoordinateBounds limitMapBounds; - - /// 指南针的位置,设定坐标以BMKMapView左上角为原点,向右向下增长 - BMFPoint compassPosition; - - /// 当前地图的中心点,改变该值时,地图的比例尺级别不会发生变化 - BMFCoordinate center; - - /// 地图比例尺级别,在手机上当前可使用的级别为4-21级 - int zoomLevel; - - /// 地图的自定义最小比例尺级别 - int minZoomLevel; - - /// 地图的自定义最大比例尺级别 - int maxZoomLevel; - - /// 地图旋转角度,在手机上当前可使用的范围为-180~180度 (ios取int值) - double rotation; - - /// 地图俯视角度,在手机上当前可使用的范围为-45~0度 (ios取int值) - double overlooking; - - /// 地图俯视角度最小值(即角度最大值),在手机上当前可设置的范围为-79~0度 - /// - /// iOS独有 - int minOverlooking; - - /// 设定地图是否现显示3D楼块效果 - bool buildingsEnabled; - - /// 设定地图是否显示底图poi标注(不包含室内图标注),默认true - bool showMapPoi; - - /// 设定地图是否打开路况图层 - bool trafficEnabled; - - /// 设定地图是否打开百度城市热力图图层(百度自有数据), - /// - /// 注:地图层级大于11时,可显示热力图 - bool baiduHeatMapEnabled; - - /// 设定地图View能否支持所有手势操作 - bool gesturesEnabled; - - /// 设定地图View能否支持用户多点缩放(双指) - bool zoomEnabled; - - /// 设定地图View能否支持用户缩放(双击或双指单击) - /// - /// iOS独有 - bool zoomEnabledWithTap; - - /// 设定地图View能否支持用户移动地图 - bool scrollEnabled; - - /// 设定地图View能否支持俯仰角 - bool overlookEnabled; - - /// 设定地图View能否支持旋转 - bool rotateEnabled; - - /// 设定地图是否回调force touch事件,默认为false,仅适用于支持3D Touch的情况, - /// - /// 开启后会回调 - mapview:onForceTouch:force:maximumPossibleForce: - /// - /// iOS独有 - bool forceTouchEnabled; - - /// 设定是否显示比例尺 - bool showMapScaleBar; - - /// 比例尺的位置,设定坐标以BMKMapView左上角为原点,向右向下增长 - BMFPoint mapScaleBarPosition; - - /// logo位置 默认BMFLogoPositionLeftBottom - BMFLogoPosition logoPosition; - - /// 当前地图可显示范围(东北,西南)角坐标 - BMFCoordinateBounds visibleMapBounds; - - /// 地图预留边界,默认:(top:0, left:0, bottom:0, right:0)。 - /// - /// 注:设置后,会根据mapPadding调整logo、比例尺、指南针的位置。 - /// - /// 当updateTargetScreenPtWhenMapPaddingChanged==true时,地图中心(屏幕坐标:BMKMapStatus.targetScreenPt)跟着改变 - BMFEdgeInsets mapPadding; - - /// 设置mapPadding时,地图中心(屏幕坐标:BMKMapStatus.targetScreenPt)是否跟着改变,默认true - /// - /// iOS独有 - bool updateTargetScreenPtWhenMapPaddingChanged; - - /// 设定双指手势操作时,BMKMapView的旋转和缩放效果的中心点。 - /// - /// 设置为true时,以手势的中心点(二个指头的中心点)为中心进行旋转和缩放,地图中心点会改变; - /// - /// 设置为false时,以当前地图的中心点为中心进行旋转和缩放,地图中心点不变; - /// - /// 默认值为false。 - /// - /// (iOS独有) - bool changeWithTouchPointCenterEnabled; - - /// 设定双击手势放大地图时,BMKMapView的放大效果的中心点。 - /// - /// 设置为true时,以双击的位置为中心点进行放大,地图中心点会改变; - /// - /// 设置为false时,以当前地图的中心点为中心进行放大,地图中心点不变; - /// - /// 默认值为true。 - bool changeCenterWithDoubleTouchPointEnabled; - - /// 设定地图是否显示室内图(包含室内图标注),默认不显示 - bool baseIndoorMapEnabled; - - /// 设定室内图标注是否显示,默认true,仅当显示室内图(baseIndoorMapEnabled为true)时生效 - bool showIndoorMapPoi; - - /// BMFMapOptions构造方法 - BMFMapOptions({ - this.mapType: BMFMapType.Standard, - this.limitMapBounds, - this.compassPosition, - this.center, - this.zoomLevel, - this.minZoomLevel, - this.maxZoomLevel, - this.rotation, - this.overlooking, - this.minOverlooking, - this.buildingsEnabled, - this.showMapPoi, - this.trafficEnabled, - this.baiduHeatMapEnabled: false, - this.gesturesEnabled, - this.zoomEnabled, - this.zoomEnabledWithTap, - this.scrollEnabled, - this.overlookEnabled, - this.rotateEnabled, - this.forceTouchEnabled: false, - this.showMapScaleBar, - this.mapScaleBarPosition, - this.logoPosition: BMFLogoPosition.LeftBottom, - this.visibleMapBounds, - this.mapPadding, - this.updateTargetScreenPtWhenMapPaddingChanged: true, - this.changeWithTouchPointCenterEnabled: false, - this.changeCenterWithDoubleTouchPointEnabled: true, - this.baseIndoorMapEnabled, - this.showIndoorMapPoi: true, - }); - - /// BMFMapOptions -> map - Map toMap() { - return { - 'mapType': this.mapType?.index, - 'limitMapBounds': this.limitMapBounds?.toMap(), - 'compassPosition': this.compassPosition?.toMap(), - 'center': this.center?.toMap(), - 'zoomLevel': this.zoomLevel, - 'minZoomLevel': this.minZoomLevel, - 'maxZoomLevel': this.maxZoomLevel, - 'rotation': this.rotation, - 'overlooking': this.overlooking, - 'minOverlooking': this.minOverlooking, - 'buildingsEnabled': this.buildingsEnabled, - 'showMapPoi': this.showMapPoi, - 'trafficEnabled': this.trafficEnabled, - 'baiduHeatMapEnabled': this.baiduHeatMapEnabled, - 'gesturesEnabled': this.gesturesEnabled, - 'zoomEnabled': this.zoomEnabled, - 'zoomEnabledWithTap': this.zoomEnabledWithTap, - 'scrollEnabled': this.scrollEnabled, - 'overlookEnabled': this.overlookEnabled, - 'rotateEnabled': this.rotateEnabled, - 'forceTouchEnabled': this.forceTouchEnabled, - 'showMapScaleBar': this.showMapScaleBar, - 'mapScaleBarPosition': this.mapScaleBarPosition?.toMap(), - 'logoPosition': this.logoPosition?.index, - 'visibleMapBounds': this.visibleMapBounds?.toMap(), - 'mapPadding': this.mapPadding?.toMap(), - 'updateTargetScreenPtWhenMapPaddingChanged': - this.updateTargetScreenPtWhenMapPaddingChanged, - 'changeWithTouchPointCenterEnabled': - this.changeWithTouchPointCenterEnabled, - 'changeCenterWithDoubleTouchPointEnabled': - this.changeCenterWithDoubleTouchPointEnabled, - 'baseIndoorMapEnabled': this.baseIndoorMapEnabled, - 'showIndoorMapPoi': this.showIndoorMapPoi - }; - } -} diff --git a/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/models/bmf_mappoi.dart b/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/models/bmf_mappoi.dart deleted file mode 100644 index fc8bfbb..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/models/bmf_mappoi.dart +++ /dev/null @@ -1,33 +0,0 @@ -library bmfmap_map.models.bmf_mappoi; - -import 'package:flutter_bmfbase/BaiduMap/bmfmap_base.dart' - show BMFModel, BMFCoordinate; - -/// 点击地图标注返回数据结构 -class BMFMapPoi implements BMFModel { - static BMFMapPoi mapPoi() => BMFMapPoi(); - - /// 点标注的名称 - String text; - - /// 点标注的经纬度坐标 - BMFCoordinate pt; - - /// 点标注的uid,可能为空 - String uid; - - /// BMFMapPoi构造方法 - BMFMapPoi({this.text, this.pt, this.uid}); - @override - fromMap(Map map) { - return new BMFMapPoi( - text: map['text'], - pt: BMFCoordinate.coordinate().fromMap(map['pt']), - uid: map['uid']); - } - - @override - Map toMap() { - return {'text': this.text, 'pt': this.pt?.toMap(), 'uid': this.uid}; - } -} diff --git a/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/models/bmf_mapstatus.dart b/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/models/bmf_mapstatus.dart deleted file mode 100644 index b2591e4..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/models/bmf_mapstatus.dart +++ /dev/null @@ -1,58 +0,0 @@ -library bmfmap_map.models.bmf_mapstatus; - -import 'package:flutter_bmfbase/BaiduMap/bmfmap_base.dart'; - -/// 此类表示地图状态信息 -class BMFMapStatus implements BMFModel { - static BMFMapStatus mapStatus() => BMFMapStatus(); - - /// 缩放级别:(4-21) - double fLevel; - - /// 旋转角度 - double fRotation; - - /// 俯视角度:(-45~0) - double fOverlooking; - - /// 屏幕中心点坐标:在屏幕内,超过无效 - BMFPoint targetScreenPt; - - /// 地理中心点坐标:经纬度 - BMFCoordinate targetGeoPt; - - /// 当前屏幕显示范围内的地理范围 - BMFCoordinateBounds coordinateBounds; - - /// BMFMapStatus构造方法 - BMFMapStatus( - {this.fLevel, - this.fRotation, - this.fOverlooking, - this.targetScreenPt, - this.targetGeoPt, - this.coordinateBounds}); - @override - fromMap(Map map) { - return new BMFMapStatus( - fLevel: map['fLevel'], - fRotation: map['fRotation'], - fOverlooking: map['fOverlooking'], - targetScreenPt: BMFPoint.point().fromMap(map['targetScreenPt']), - targetGeoPt: BMFCoordinate.coordinate().fromMap(map['targetGeoPt']), - coordinateBounds: BMFCoordinateBounds.coordinateBounds() - .fromMap(map['visibleMapBounds'])); - } - - @override - Map toMap() { - return { - 'fLevel': this.fLevel, - 'fRotation': this.fRotation, - 'fOverlooking': this.fOverlooking, - 'targetScreenPt': this.targetScreenPt?.toMap(), - 'targetGeoPt': this.targetGeoPt?.toMap(), - 'visibleMapBounds': this.coordinateBounds?.toMap() - }; - } -} diff --git a/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/models/bmf_offline_models.dart b/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/models/bmf_offline_models.dart deleted file mode 100644 index e4cb62b..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/models/bmf_offline_models.dart +++ /dev/null @@ -1,160 +0,0 @@ -library bmfmap_map.models.bmf_offline_models; - -import 'package:flutter_bmfbase/BaiduMap/bmfmap_base.dart' - show BMFModel, BMFCoordinate; - -/// 离线地图搜索城市记录结构 -class BMFOfflineCityRecord implements BMFModel { - static BMFOfflineCityRecord offlineCityRecord() => BMFOfflineCityRecord(); - - /// 城市ID - int cityID; - - /// 数据包总大小 - int dataSize; - - /// 城市名称 - String cityName; - - /// 城市类型0:全国;1:省份;2:城市,如果是省份,可以通过childCities得到子城市列表 - int cityType; - - /// 子城市列表 - List childCities; - - /// BMFOfflineCityRecord构造方法 - BMFOfflineCityRecord( - {this.cityID, - this.dataSize, - this.cityName, - this.cityType, - this.childCities}); - - @override - Map toMap() { - return { - 'cityID': this.cityID, - 'dataSize': this.dataSize, - 'cityName': this.cityName, - 'cityType': this.cityType, - 'childCities': this.childCities?.map((city) => city?.toMap())?.toList() - }; - } - - @override - fromMap(Map map) { - List childCities = map['childCities'] as List; - return BMFOfflineCityRecord( - cityID: map['cityID'], - dataSize: map['dataSize'], - cityName: map['cityName'], - cityType: map['cityType'], - childCities: childCities - ?.map((city) => BMFOfflineCityRecord.offlineCityRecord() - .fromMap(city) as BMFOfflineCityRecord) - ?.toList()); - } -} - -/// 离线地图更新信息 -class BMFUpdateElement extends BMFModel { - static BMFUpdateElement bmfUpdateElement() => BMFUpdateElement(); - - /// 未定义 - static const int UNDEFINED = 0; - - /// 正在下载 - static const int DOWNLOADING = 1; - - /// 等待下载 - static const int WAITING = 2; - - /// 已暂停 - static const int SUSPENDED = 3; - - /// 完成 - static const int FINISHED = 4; - - /// 校验失败 - static const int eOLDSMd5Error = 5; - - /// 网络异常 - static const int eOLDSNetError = 6; - - /// 读写异常 - static const int eOLDSIOError = 7; - - /// wifi网络异常 - static const int eOLDSWifiError = 8; - - /// 数据错误,需重新下载 - static const int eOLDSFormatError = 9; - - /// 城市ID - int cityID; - - /// 城市名称 - String cityName; - - /// 下载比率,100为下载完成 - int ratio; - - /// 下载状态 - int status; - - /// 城市中心点坐标 - BMFCoordinate geoPt; - - /// 已下载数据大小 - int size; - - /// 服务端数据大小 - int serversize; - - /// 离线包地图层级(ios没有) - int level; - - /// 是否为更新 - bool update; - - /// BMFUpdateElement构造方法 - BMFUpdateElement( - {this.cityID, - this.cityName, - this.ratio, - this.status, - this.geoPt, - this.size, - this.serversize, - this.level, - this.update}); - - @override - fromMap(Map map) { - return BMFUpdateElement( - cityID: map["cityID"], - cityName: map["cityName"], - ratio: map["ratio"], - status: map["status"], - geoPt: BMFCoordinate.coordinate().fromMap(map['geoPt']), - size: map["size"], - serversize: map["serversize"], - level: map["level"], - update: map["update"]); - } - - @override - Map toMap() { - return { - "cityID": this.cityID, - "cityName": this.cityName, - "ratio": this.ratio, - "status": this.status, - "geoPt": this.geoPt?.toMap(), - "size": this.size, - "serversize": this.serversize, - "level": this.level, - "update": this.update - }; - } -} diff --git a/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/models/bmf_userlocation.dart b/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/models/bmf_userlocation.dart deleted file mode 100644 index bb5bd7a..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/models/bmf_userlocation.dart +++ /dev/null @@ -1,349 +0,0 @@ -library bmfmap_map.models.bmf_userlocation; - -import 'package:flutter/material.dart'; -import 'package:flutter_bmfbase/BaiduMap/bmfmap_base.dart'; - -/// 当前位置对象 -class BMFUserLocation implements BMFModel { - /// 位置更新状态,如果正在更新位置信息,则该值为YES - /// - /// Anroid没有该属性 - bool updating; - - /// 位置信息,尚未定位成功,则该值为null - BMFLocation location; - - /// heading信息,尚未定位成功,则该值为null - /// - /// Anroid没有该属性 - BMFHeading heading; - - /// 定位标注点要显示的标题信息 - /// - /// Anroid没有该属性 - String title; - - /// 定位标注点要显示的子标题信息 - /// - /// Anroid没有该属性 - String subtitle; - - /// BMFUserLocation构造方法 - BMFUserLocation( - {this.updating, - @required this.location, - this.heading, - this.title, - this.subtitle}); - - @override - fromMap(Map map) { - return new BMFUserLocation( - updating: map['updating'], - location: BMFLocation.location().fromMap(map['location']), - heading: BMFHeading.heading().fromMap(map['heading']), - title: map['title'], - subtitle: map['subtitle']); - } - - @override - Map toMap() { - return { - 'updating': this.updating, - 'location': this.location?.toMap(), - 'heading': this.heading?.toMap(), - 'title': this.title, - 'subtitle': this.subtitle - }; - } -} - -/// 定位信息 -class BMFLocation implements BMFModel { - static BMFLocation location() => BMFLocation(coordinate: null); - - /// 经纬度 - BMFCoordinate coordinate; - - /// 海拔 - /// - /// Android 没有该属性 - double altitude; - - /// 水平精确度 - /// - /// Android没有该属性 - double horizontalAccuracy; - - /// 垂直精确度 - /// - /// Android没有该属性 - double verticalAccuracy; - - /// 航向 - double course; - - /// 速度 - double speed; - - /// 定位精度 - /// - /// IOS没有该属性 - double accuracy; - - /// GPS定位时卫星数目 - /// - /// IOS没有该属性 - int satellitesNum; - - /// 时间 YYYY-MM-dd HH:mm:ss - /// - /// Android没有该属性 - String timestamp; - - BMFLocation( - {@required this.coordinate, - this.altitude, - this.horizontalAccuracy, - this.verticalAccuracy, - this.course, - this.speed, - this.accuracy, - this.satellitesNum, - this.timestamp}); - @override - fromMap(Map map) { - return new BMFLocation( - coordinate: BMFCoordinate.coordinate().fromMap(map['coordinate']), - altitude: map['altitude'], - horizontalAccuracy: map['horizontalAccuracy'], - verticalAccuracy: map['verticalAccuracy'], - course: map['course'], - speed: map['speed'], - accuracy: map['accuracy'], - satellitesNum: map['satellitesNum'], - timestamp: map['timestamp']); - } - - @override - Map toMap() { - return { - 'coordinate': this.coordinate?.toMap(), - 'altitude': this.altitude, - 'horizontalAccuracy': this.horizontalAccuracy, - 'verticalAccuracy': this.verticalAccuracy, - 'course': this.course, - 'speed': this.speed, - 'accuracy': this.accuracy, - 'satellitesNum': this.satellitesNum, - 'timestamp': this.timestamp - }; - } -} - -/// heading信息 -class BMFHeading implements BMFModel { - static BMFHeading heading() => BMFHeading(); - - /// 磁头 - /// - /// 表示度方向,其中0度为磁北。无论设备的方向以及用户界面的方向如何,方向都是从设备的顶部引用的。 - /// - /// 范围: 0.0 - 359.9度,0度为地磁北极 - double magneticHeading; - - /// 表示角度方向,其中0度为真北。参考方向 - /// - /// 不考虑设备的方向以及设备的方向 - /// - /// 范围: 0.0 - 359.9度,0为正北 - double trueHeading; - - /// 航向精度 - /// - /// 表示磁头可能与实际地磁头偏差的最大度数。负值表示无效的标题。 - double headingAccuracy; - - /// x轴测量的地磁的原始值 - double x; - - /// y轴测量的地磁的原始值 - double y; - - /// z轴测量的地磁的原始值 - double z; - - /// 时间戳 - String timestamp; - - BMFHeading( - {this.magneticHeading, - this.trueHeading, - this.headingAccuracy, - this.x, - this.y, - this.z, - this.timestamp}); - - @override - fromMap(Map map) { - return new BMFHeading( - magneticHeading: map['magneticHeading'], - trueHeading: map['trueHeading'], - headingAccuracy: map['headingAccuracy'], - x: map['x'], - y: map['y'], - z: map['z'], - timestamp: map['timestamp']); - } - - @override - Map toMap() { - return { - 'magneticHeading': this.magneticHeading, - 'trueHeading': this.trueHeading, - 'headingAccuracy': this.headingAccuracy, - 'x': this.x, - 'y': this.y, - 'z': this.z, - 'timestamp': this.timestamp - }; - } -} - -/// userlocationView在mapview上显示的层级 -enum BMFLocationViewHierarchy { - /// - BMFUserlocationDisplayParam( - locationViewOffsetX: 0, - locationViewOffsetY: 0, - userTrackingMode: BMFUserTrackingMode.None, - enableDirection: false, - accuracyCircleFillColor: Colors.blue, - accuracyCircleStrokeColor: Colors.blue, - locationViewImage: null, - locationViewHierarchy: - BMFLocationViewHierarchy.LOCATION_VIEW_HIERARCHY_TOP); - - /// 定位图标X轴偏移量(屏幕坐标) - /// - /// Android没有该属性 - double locationViewOffsetX; - - /// 定位图标Y轴偏移量(屏幕坐标) - /// - /// Android没有该属性 - double locationViewOffsetY; - - /// 定位模式 - /// - /// IOS没有该属性 - BMFUserTrackingMode userTrackingMode; - - /// 是否允许显示方向信息 - /// - /// IOS没有该属性 - bool enableDirection; - - /// 精度圈是否显示,默认YES - /// - /// Android没有该属性 - bool isAccuracyCircleShow; - - /// 精度圈 填充颜色 - Color accuracyCircleFillColor; - - /// 精度圈 边框颜色 - Color accuracyCircleStrokeColor; - - /// 跟随态旋转角度是否生效,默认YES - /// - /// Android没有该属性 - bool isRotateAngleValid; - - /// 用户自定义定位图标 - String locationViewImage; - - /// 是否显示气泡,默认YES - /// - /// Android没有该属性 - bool canShowCallOut; - - /// locationView在mapview上的层级 默认值为LOCATION_VIEW_HIERARCHY_BOTTOM - BMFLocationViewHierarchy locationViewHierarchy; - - BMFUserlocationDisplayParam( - {this.locationViewOffsetX, - this.locationViewOffsetY, - this.userTrackingMode: BMFUserTrackingMode.None, - this.enableDirection: true, - this.isAccuracyCircleShow: true, - this.accuracyCircleFillColor, - this.accuracyCircleStrokeColor, - this.isRotateAngleValid: true, - this.locationViewImage, - this.canShowCallOut: true, - this.locationViewHierarchy}); - - @override - fromMap(Map map) { - int userTrackingModeIndex = map['userTrackingMode'] as int; - BMFUserTrackingMode tmpUserTrackingMode; - if (null != userTrackingModeIndex && - userTrackingModeIndex >= 0 && - userTrackingModeIndex < BMFUserTrackingMode.values.length) { - tmpUserTrackingMode = BMFUserTrackingMode.values[userTrackingModeIndex]; - } - - int locationViewHierarchyIndex = map['locationViewHierarchy'] as int; - BMFLocationViewHierarchy tmpLocationViewHierarchy; - if (null != locationViewHierarchyIndex && - locationViewHierarchyIndex >= 0 && - locationViewHierarchyIndex < BMFLocationViewHierarchy.values.length) { - tmpLocationViewHierarchy = - BMFLocationViewHierarchy.values[locationViewHierarchyIndex]; - } - - return new BMFUserlocationDisplayParam( - locationViewOffsetX: map['locationViewOffsetX'], - locationViewOffsetY: map['locationViewOffsetY'], - userTrackingMode: tmpUserTrackingMode, - enableDirection: map['enableDirection'] as bool, - isAccuracyCircleShow: map['isAccuracyCircleShow'] as bool, - accuracyCircleFillColor: - ColorUtil.hexToColor(map['accuracyCircleFillColor']), - accuracyCircleStrokeColor: - ColorUtil.hexToColor(map['accuracyCircleStrokeColor']), - isRotateAngleValid: map['isRotateAngleValid'] as bool, - locationViewImage: map['locationViewImage'], - canShowCallOut: map['canShowCallOut'] as bool, - locationViewHierarchy: tmpLocationViewHierarchy); - } - - @override - Map toMap() { - return { - 'locationViewOffsetX': this.locationViewOffsetX, - 'locationViewOffsetY': this.locationViewOffsetY, - 'userTrackingMode': this.userTrackingMode.index, - 'enableDirection': this.enableDirection, - 'isAccuracyCircleShow': this.isAccuracyCircleShow, - 'accuracyCircleFillColor': - this.accuracyCircleFillColor?.value?.toRadixString(16), - 'accuracyCircleStrokeColor': - this.accuracyCircleStrokeColor?.value?.toRadixString(16), - 'isRotateAngleValid': this.isRotateAngleValid, - 'locationViewImage': this.locationViewImage, - 'canShowCallOut': this.canShowCallOut, - 'locationViewHierarchy': this.locationViewHierarchy.index - }; - } -} diff --git a/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/models/overlays/bmf_arcline.dart b/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/models/overlays/bmf_arcline.dart deleted file mode 100644 index 455ee0c..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/models/overlays/bmf_arcline.dart +++ /dev/null @@ -1,76 +0,0 @@ -library bmfmap_map.models.overlays.bmf_arcline; - -import 'package:flutter/foundation.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_bmfmap/BaiduMap/map/bmf_map_linedraw_types.dart'; -import 'package:flutter_bmfbase/BaiduMap/bmfmap_base.dart' - show BMFCoordinate, ColorUtil; - -import 'bmf_overlay.dart'; - -/// 弧线 -class BMFArcline extends BMFOverlay { - /// 经纬度数组三个点确定一条弧线 - List coordinates; - - /// 设置arclineView的线宽度 - int width; - - /// 设置arclineView的画笔颜色 - Color color; - - /// 虚线类型 - /// - /// iOS独有 - BMFLineDashType lineDashType; - - /// BMFArcline构造方法 - BMFArcline( - {@required this.coordinates, - this.width: 5, - this.color: Colors.blue, - this.lineDashType: BMFLineDashType.LineDashTypeNone, - int zIndex: 0, - bool visible: true}) - : super(zIndex: zIndex, visible: visible); - - BMFArcline.withMap(Map map) { - if (null == map) { - return; - } - - List list = map['coordinates'] as List; - - super.fromMap(map); - this.coordinates = list - ?.map((c) => BMFCoordinate.coordinate().fromMap(c) as BMFCoordinate) - ?.toList(); - this.width = map['width']; - this.color = ColorUtil.hexToColor(map['color']); - - int lineType = map['lineDashType'] as int; - if (null != lineType && - lineType >= 0 && - lineType < BMFLineDashType.values.length) { - this.lineDashType = BMFLineDashType.values[lineType]; - } - } - - @override - fromMap(Map map) { - return BMFArcline.withMap(map); - } - - @override - Map toMap() { - return { - 'id': this.getId(), - 'coordinates': this.coordinates?.map((coord) => coord?.toMap())?.toList(), - 'width': this.width, - 'color': this.color?.value?.toRadixString(16), - 'lineDashType': this.lineDashType?.index, - 'zIndex': this.zIndex, - 'visible': this.visible - }; - } -} diff --git a/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/models/overlays/bmf_circle.dart b/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/models/overlays/bmf_circle.dart deleted file mode 100644 index 02a0b0e..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/models/overlays/bmf_circle.dart +++ /dev/null @@ -1,86 +0,0 @@ -library bmfmap_map.models.overlays.bmf_circle; - -import 'package:flutter/material.dart'; -import 'package:flutter_bmfmap/BaiduMap/map/bmf_map_linedraw_types.dart'; -import 'package:flutter_bmfbase/BaiduMap/bmfmap_base.dart' - show BMFCoordinate, ColorUtil; - -import 'bmf_overlay.dart'; - -/// 圆 -class BMFCircle extends BMFOverlay { - /// 圆心点经纬度 - BMFCoordinate center; - - /// 圆的半径(单位米) - double radius; - - /// 设置circleView的线宽度 - int width; - - /// 设置circleView的边框颜色 - Color strokeColor; - - /// 设置circleView的填充色 - Color fillColor; - - /// 设置circleView为虚线样式 - BMFLineDashType lineDashType; - - /// BMFCircle构造方法 - BMFCircle( - {@required this.center, - @required this.radius, - this.width: 5, - this.strokeColor: Colors.blue, - this.fillColor: Colors.red, - this.lineDashType: BMFLineDashType.LineDashTypeNone, - int zIndex: 0, - bool visible: true}) - : super(zIndex: zIndex, visible: visible); - - BMFCircle.withMap(Map map) { - if (null == map) { - return; - } - - super.fromMap(map); - - this.center = BMFCoordinate.coordinate().fromMap(map['center']); - this.radius = map['radius']; - this.width = map['width']; - this.strokeColor = ColorUtil.hexToColor(map['strokeColor']); - this.fillColor = ColorUtil.hexToColor(map['fillColor']); - - int lineType = map['lineDashType'] as int; - if (null != lineType && - lineType >= 0 && - lineType < BMFLineDashType.values.length) { - this.lineDashType = BMFLineDashType.values[lineType]; - } - } - - @override - fromMap(Map map) { - if (null == map) { - return; - } - - return BMFCircle.withMap(map); - } - - @override - Map toMap() { - return { - 'id': this.getId(), - 'center': this.center?.toMap(), - 'radius': this.radius, - 'width': this.width, - 'strokeColor': this.strokeColor?.value?.toRadixString(16), - 'fillColor': this.fillColor?.value?.toRadixString(16), - 'lineDashType': this.lineDashType?.index, - 'zIndex': this.zIndex, - 'visible': this.visible - }; - } -} diff --git a/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/models/overlays/bmf_dot.dart b/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/models/overlays/bmf_dot.dart deleted file mode 100644 index 43d487e..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/models/overlays/bmf_dot.dart +++ /dev/null @@ -1,62 +0,0 @@ -library bmfmap_map.models.overlays.bmf_dot; - -import 'package:flutter/cupertino.dart'; -import 'package:flutter_bmfbase/BaiduMap/bmfmap_base.dart' - show BMFCoordinate, ColorUtil; - -import 'bmf_overlay.dart'; - -/// 点 -/// -/// Android独有 -class BMFDot extends BMFOverlay { - /// 圆心点经纬度 - BMFCoordinate center; - - /// 圆的半径(单位米) - double radius; - - ///园的颜色 - Color color; - - /// BMFDot构造方法 - BMFDot( - {@required this.center, - @required this.radius, - @required this.color, - int zIndex: 0, - bool visible: true}) - : super(zIndex: zIndex, visible: visible); - - BMFDot.withMap(Map map) { - if (null == map) { - return; - } - - super.fromMap(map); - this.center = BMFCoordinate.coordinate().fromMap(map['center']); - this.radius = map['radius']; - this.color = ColorUtil.hexToColor(map['color']); - } - - @override - fromMap(Map map) { - if (null == map) { - return null; - } - - return BMFDot.withMap(map); - } - - @override - Map toMap() { - return { - 'id': this.getId(), - 'center': this.center?.toMap(), - 'radius': this.radius, - 'color': this.color?.value?.toRadixString(16), - 'zIndex': this.zIndex, - 'visible': this.visible - }; - } -} diff --git a/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/models/overlays/bmf_ground.dart b/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/models/overlays/bmf_ground.dart deleted file mode 100644 index 297a91b..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/models/overlays/bmf_ground.dart +++ /dev/null @@ -1,101 +0,0 @@ -library bmfmap_map.models.overlays.bmf_ground; - -import 'package:flutter/material.dart'; -import 'package:flutter_bmfbase/BaiduMap/bmfmap_base.dart' - show BMFCoordinate, BMFCoordinateBounds; - -import 'bmf_overlay.dart'; - -/// 该类用于定义一个图片图层 -class BMFGround extends BMFOverlay { - /// 两种绘制GroundOverlay的方式之一:绘制的位置地理坐标,与anchor配对使用 - BMFCoordinate position; - - /// 用位置绘制时图片的锚点x,图片左上角为(0.0f,0.0f),向右向下为正 - /// - /// 使用groundOverlayWithPosition初始化时生效 - double anchorX; - - /// 用位置绘制时图片的锚点y,图片左上角为(0.0f,0.0f),向右向下为正 - /// - /// 使用groundOverlayWithPosition初始化时生效 - double anchorY; - - /// 宽 - double width; - - /// 高 - double height; - - /// 缩放级别(仅ios支持) - int zoomLevel; - - /// 两种绘制GroundOverlay的方式之二:绘制的地理区域范围,图片在此区域内合理缩放 - BMFCoordinateBounds bounds; - - /// 绘制图片 - String image; - - /// 图片纹理透明度,最终透明度 = 纹理透明度 * alpha,取值范围为【0.0f, 1.0f】,默认为1.0f - double transparency; - - /// BMFGround构造方法 - BMFGround( - {@required this.image, - this.width, - this.height, - this.anchorX, - this.anchorY, - this.zoomLevel, - this.bounds, - this.position, - this.transparency: 1.0, - int zIndex: 0, - bool visible: true}) - : super(zIndex: zIndex, visible: visible); - - BMFGround.withGround(Map map) { - if (null == map) { - return; - } - - super.fromMap(map); - - this.image = map['image']; - this.width = map['width']; - this.height = map['height']; - this.anchorX = map['anchorX']; - this.anchorY = map['anchorY']; - this.zoomLevel = map['zoomLevel']; - this.position = BMFCoordinate.coordinate().fromMap(map['position']); - this.bounds = BMFCoordinateBounds.coordinateBounds().fromMap(map['bounds']); - this.transparency = map['transparency']; - } - - @override - Map toMap() { - return { - 'id': this.getId(), - 'image': this.image, - 'width': this.width, - 'height': this.height, - 'anchorX': this.anchorX, - 'anchorY': this.anchorY, - 'zoomLevel': this.zoomLevel, - 'position': this.position?.toMap(), - 'bounds': this.bounds?.toMap(), - 'transparency': this.transparency, - 'zIndex': this.zIndex, - 'visible': this.visible - }; - } - - @override - fromMap(Map map) { - if (null == map) { - return; - } - - return BMFGround.withGround(map); - } -} diff --git a/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/models/overlays/bmf_marker.dart b/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/models/overlays/bmf_marker.dart deleted file mode 100644 index 8674990..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/models/overlays/bmf_marker.dart +++ /dev/null @@ -1,384 +0,0 @@ -library bmfmap_map.models.overlays.bmf_marker; - -import 'package:flutter/foundation.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_bmfbase/BaiduMap/bmfmap_base.dart' - show BMFCoordinate, BMFPoint; -import 'package:flutter_bmfmap/BaiduMap/models/overlays/bmf_overlay.dart'; -import 'package:flutter_bmfmap/BaiduMap/private/mapdispatcher/bmf_map_dispatcher_factory.dart'; - -/// 大头针 -class BMFMarker extends BMFOverlay { - static BMFMarker marker() => - BMFMarker(position: BMFCoordinate.coordinate(), icon: null); - - /// 标题 - String title; - - /// 子标题 - /// - /// Android没有该属性 - String subtitle; - - /// marker位置经纬度 - BMFCoordinate position; - - /// 标注固定在指定屏幕位置, 必须与screenPointToLock一起使用。 - /// - /// 注意:拖动Annotation isLockedToScreen会被设置为false。 - /// 若isLockedToScreen为true,拖动地图时annotaion不会跟随移动; - /// 若isLockedToScreen为false,拖动地图时annotation会跟随移动。 - bool isLockedToScreen; - - /// 标注锁定在屏幕上的位置, - /// - /// 注意:地图初始化后才能设置screenPointToLock。可以在地图加载完成的回调方法:mapViewDidFinishLoading中使用此属性。 - BMFPoint screenPointToLock; - - /// markerView的复用标识符 - String identifier; - - /// markView显示的图片 - String icon; - - /// 默认情况下, annotation view的中心位于annotation的坐标位置, - /// - /// 可以设置centerOffset改变view的位置,正的偏移使view朝右下方移动,负的朝左上方,单位是像素 - /// - /// 目前Android只支持Y轴设置偏移量对应SDK的 yOffset(int yOffset) 方法 - BMFPoint centerOffset; - - /// 默认情况下,标注没有3D效果,可以设置enabled3D改变使用3D效果, - /// - /// 使得标注在地图旋转和俯视时跟随旋转、俯视 - /// - /// iOS独有 - bool enabled3D; - - /// 默认为true,当为false时view忽略触摸事件 - bool enabled; - - /// 当设为true支持将view在地图上拖动 - bool draggable; - - /// x方向缩放倍数 - /// - /// Android独有 - double scaleX; - - /// y方向缩放倍数 - /// - /// Android独有 - double scaleY; - - /// 透明度 - /// - /// Android独有 - double alpha; - - /// 在有俯仰角的情况下,是否近大远小 - /// - /// Android独有 - bool isPerspective; - - BMFMarker.withMap(Map map) { - if (null == map) { - return; - } - - super.fromMap(map); - - this.position = BMFCoordinate.coordinate().fromMap(map['position']); - this.title = map['title']; - this.subtitle = map["subtitle"]; - this.isLockedToScreen = map['isLockedToScreen']; - this.screenPointToLock = BMFPoint.point().fromMap(map['screenPointToLock']); - this.identifier = map['identifier']; - this.icon = map['icon']; - this.centerOffset = map['centerOffset']; - this.enabled3D = map['enabled3D']; - this.enabled = map['enabled']; - this.draggable = map['draggable']; - this.scaleX = map['scaleX']; - this.scaleY = map['scaleY']; - this.alpha = map['alpha']; - this.isPerspective = map['isPerspective']; - } - - /// BMFMarker构造方法 - BMFMarker({ - @required this.position, - @required this.icon, - this.title, - this.subtitle, - this.isLockedToScreen: false, - this.screenPointToLock, - this.identifier, - this.centerOffset, - this.enabled3D, - this.enabled: true, - this.draggable: false, - this.scaleX: 1.0, - this.scaleY: 1.0, - this.alpha: 1.0, - this.isPerspective, - int zIndex: 0, - bool visible: true, - }) : super(zIndex: zIndex, visible: visible); - - @override - fromMap(Map map) { - if (null == map) { - return null; - } - - return BMFMarker.withMap(map); - } - - @override - Map toMap() { - return { - 'id': this.getId(), - 'position': this.position?.toMap(), - 'title': this.title, - 'subtitle': this.subtitle, - 'isLockedToScreen': this.isLockedToScreen, - 'screenPointToLock': this.screenPointToLock?.toMap(), - 'identifier': this.identifier, - 'icon': this.icon, - 'centerOffset': this.centerOffset?.toMap(), - 'enabled3D': this.enabled3D, - 'enabled': this.enabled, - 'draggable': this.draggable, - 'scaleX': this.scaleX, - 'scaleY': this.scaleY, - 'alpha': this.alpha, - 'isPerspective': this.isPerspective, - 'zIndex': this.zIndex, - 'visible': this.visible, - }; - } - - /// 更新title - Future updateTitle(String title) async { - if (null == title) { - return false; - } - - this.title = title; - - return await BMFMapDispatcherFactory.instance - .getMarkerDispatcher() - .updateMarkerMember(this.getMethodChannel(), { - 'id': this.getId(), - 'member': 'title', - 'value': title, - }); - } - - /// 更新subTitle - Future updateSubTitle(String subtitle) async { - if (null == subtitle) { - return false; - } - - this.subtitle = subtitle; - - return await BMFMapDispatcherFactory.instance - .getMarkerDispatcher() - .updateMarkerMember(this.getMethodChannel(), { - 'id': this.getId(), - 'member': 'subtitle', - 'value': subtitle, - }); - } - - /// 更新位置经纬度 - Future updatePosition(BMFCoordinate position) async { - if (null == position) { - return false; - } - - this.position = position; - - return await BMFMapDispatcherFactory.instance - .getMarkerDispatcher() - .updateMarkerMember(this.getMethodChannel(), { - 'id': this.getId(), - 'member': 'position', - 'value': position?.toMap(), - }); - } - - /// 更新是否锁定在屏幕上的位置 - /// - /// 如果isLockedToScreen为false,screenPointToLock需要传null - Future updateIsLockedToScreen( - bool isLockedToScreen, BMFPoint screenPointToLock) async { - this.isLockedToScreen = isLockedToScreen; - this.screenPointToLock = screenPointToLock; - - return await BMFMapDispatcherFactory.instance - .getMarkerDispatcher() - .updateMarkerMember(this.getMethodChannel(), { - 'id': this.getId(), - 'member': 'isLockedToScreen', - 'value': isLockedToScreen, - 'screenPointToLock': screenPointToLock?.toMap() - }); - } - - /// 更新显示的图片 - Future updateIcon(String icon) async { - if (null == icon || icon.isEmpty) { - return false; - } - - this.icon = icon; - - return await BMFMapDispatcherFactory.instance - .getMarkerDispatcher() - .updateMarkerMember(this.getMethodChannel(), { - 'id': this.getId(), - 'member': 'icon', - 'value': icon, - }); - } - - /// 更新marker centerOffset信息 - Future updateCenterOffset(BMFPoint centerOffset) async { - if (null == centerOffset) { - return false; - } - - this.centerOffset = centerOffset; - - return await BMFMapDispatcherFactory.instance - .getMarkerDispatcher() - .updateMarkerMember(this.getMethodChannel(), { - 'id': this.getId(), - 'member': 'centerOffset', - 'value': centerOffset?.toMap(), - }); - } - - /// 更新marker是否显示3D效果 - Future updateEnabled3D(bool enabled3D) async { - this.enabled3D = enabled3D; - return await BMFMapDispatcherFactory.instance - .getMarkerDispatcher() - .updateMarkerMember(this.getMethodChannel(), { - 'id': this.getId(), - 'member': 'enabled3D', - 'value': enabled3D, - }); - } - - /// 更新marker是否响应触摸事件, true则响应,false则不响应 - Future updateEnabled(bool enabled) async { - this.enabled = enabled; - return await BMFMapDispatcherFactory.instance - .getMarkerDispatcher() - .updateMarkerMember(this.getMethodChannel(), { - 'id': this.getId(), - 'member': 'enabled', - 'value': enabled, - }); - } - - /// 更新是否可拖拽 - Future updateDraggable(bool draggable) async { - this.draggable = draggable; - return await BMFMapDispatcherFactory.instance - .getMarkerDispatcher() - .updateMarkerMember(this.getMethodChannel(), { - 'id': this.getId(), - 'member': 'draggable', - 'value': draggable, - }); - } - - /// 更新x方向缩放倍数 - /// - /// Android独有 - Future updateScaleX(double scaleX) async { - this.scaleX = scaleX; - return await BMFMapDispatcherFactory.instance - .getMarkerDispatcher() - .updateMarkerMember(this.getMethodChannel(), { - 'id': this.getId(), - 'member': 'scaleX', - 'value': scaleX, - }); - } - - /// 更新y方向缩放倍数 - /// - /// Android独有 - Future updateScaleY(double scaleY) async { - this.scaleY = scaleY; - return await BMFMapDispatcherFactory.instance - .getMarkerDispatcher() - .updateMarkerMember(this.getMethodChannel(), { - 'id': this.getId(), - 'member': 'scaleY', - 'value': scaleY, - }); - } - - /// 更新透明度 - /// - /// Android独有 - Future updateAlpha(double alpha) async { - this.alpha = alpha; - return await BMFMapDispatcherFactory.instance - .getMarkerDispatcher() - .updateMarkerMember(this.getMethodChannel(), { - 'id': this.getId(), - 'member': 'alpha', - 'value': alpha, - }); - } - - /// 更新近大远小的开关 - /// - /// Android独有 - Future updateIsPerspective(bool isPerspective) async { - this.isPerspective = isPerspective; - return await BMFMapDispatcherFactory.instance - .getMarkerDispatcher() - .updateMarkerMember(this.getMethodChannel(), { - 'id': this.getId(), - 'member': 'isPerspective', - 'value': isPerspective, - }); - } - - /// 更新marker是否显示 - /// - /// Android独有 - Future updateVisible(bool visible) async { - this.visible = visible; - return await BMFMapDispatcherFactory.instance - .getMarkerDispatcher() - .updateMarkerMember(this.getMethodChannel(), { - 'id': this.getId(), - 'member': 'visible', - 'value': visible, - }); - } - - /// 更新z轴方向上的堆叠顺序 - /// - /// Android独有 - Future updateZIndex(int zIndex) async { - this.zIndex = zIndex; - return await BMFMapDispatcherFactory.instance - .getMarkerDispatcher() - .updateMarkerMember(this.getMethodChannel(), { - 'id': this.getId(), - 'member': 'zIndex', - 'value': zIndex, - }); - } -} diff --git a/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/models/overlays/bmf_overlay.dart b/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/models/overlays/bmf_overlay.dart deleted file mode 100644 index dca5c41..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/models/overlays/bmf_overlay.dart +++ /dev/null @@ -1,62 +0,0 @@ -library bmfmap_map.models.overlays.bmf_overlay; - -import 'package:flutter/services.dart'; -import 'package:flutter_bmfbase/BaiduMap/bmfmap_base.dart' show BMFModel; - -/// 地图覆盖物基类 -class BMFOverlay extends BMFModel { - /// overlay id - String _id; - - /// overlay是否可见 - /// - /// Android独有 - bool visible; - - /// 元素的堆叠顺序 - /// - /// Android独有 - int zIndex; - - MethodChannel _methodChannel; - - BMFOverlay({this.visible, this.zIndex}) { - this._id = this.hashCode.toString(); - } - - BMFOverlay.withMap(Map map) { - if (null == map) { - return; - } - - this._id = map['id']; - this.visible = map['visible']; - this.zIndex = map['zIndex']; - } - - String getId() { - return _id; - } - - void setMethodChannel(MethodChannel methodChannel) { - this._methodChannel = methodChannel; - } - - MethodChannel getMethodChannel() { - return this._methodChannel; - } - - @override - fromMap(Map map) { - if (null == map) { - return null; - } - - return BMFOverlay.withMap(map); - } - - @override - Map toMap() { - return {'id': this.getId(), 'visible': visible, 'zIndex': zIndex}; - } -} diff --git a/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/models/overlays/bmf_polygon.dart b/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/models/overlays/bmf_polygon.dart deleted file mode 100644 index 0c5678d..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/models/overlays/bmf_polygon.dart +++ /dev/null @@ -1,86 +0,0 @@ -library bmfmap_map.models.overlays.bmf_polygon; - -import 'package:flutter/material.dart'; -import 'package:flutter_bmfmap/BaiduMap/map/bmf_map_linedraw_types.dart'; -import 'package:flutter_bmfbase/BaiduMap/bmfmap_base.dart' - show BMFCoordinate, ColorUtil; - -import 'bmf_overlay.dart'; - -/// 多边形 -class BMFPolygon extends BMFOverlay { - /// 经纬度数组 - List coordinates; - - /// 设置polygonView的线宽度 - int width; - - /// 设置polygonView的边框颜色 - Color strokeColor; - - /// 设置polygonView的填充色 - Color fillColor; - - /// 设置polygonView为虚线样式 - /// - /// iOS独有 - BMFLineDashType lineDashType; - - BMFPolygon.withMap(Map map) { - if (null == map) { - return; - } - - super.fromMap(map); - - List list = map['coordinates'] as List; - this.coordinates = list - ?.map((c) => BMFCoordinate.coordinate().fromMap(c) as BMFCoordinate) - ?.toList(); - - this.width = map['width']; - this.strokeColor = ColorUtil.hexToColor(map['strokeColor']); - this.fillColor = ColorUtil.hexToColor(map['fillColor']); - - int lineType = map['lineDashType'] as int; - if (null != lineType && - lineType >= 0 && - lineType < BMFLineDashType.values.length) { - this.lineDashType = BMFLineDashType.values[lineType]; - } - } - - /// BMFPolygon构造方法 - BMFPolygon( - {@required this.coordinates, - this.width: 5, - this.strokeColor: Colors.blue, - this.fillColor: Colors.red, - this.lineDashType: BMFLineDashType.LineDashTypeNone, - int zIndex: 0, - bool visible: true}) - : super(zIndex: zIndex, visible: visible); - - @override - fromMap(Map map) { - if (null == map) { - return; - } - - return BMFPolygon.withMap(map); - } - - @override - Map toMap() { - return { - 'id': this.getId(), - 'coordinates': this.coordinates?.map((coord) => coord?.toMap())?.toList(), - 'width': this.width, - 'strokeColor': this.strokeColor?.value?.toRadixString(16), - 'fillColor': this.fillColor?.value?.toRadixString(16), - 'lineDashType': this.lineDashType?.index, - 'zIndex': this.zIndex, - 'visible': this.visible - }; - } -} diff --git a/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/models/overlays/bmf_polyline.dart b/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/models/overlays/bmf_polyline.dart deleted file mode 100644 index 8a9fe28..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/models/overlays/bmf_polyline.dart +++ /dev/null @@ -1,433 +0,0 @@ -library bmfmap_map.models.overlays.bmf_polyline; - -import 'package:flutter/material.dart'; -import 'package:flutter_bmfmap/BaiduMap/map/bmf_map_linedraw_types.dart'; -import 'package:flutter_bmfbase/BaiduMap/bmfmap_base.dart'; -import 'package:flutter_bmfmap/BaiduMap/private/mapdispatcher/bmf_map_dispatcher_factory.dart'; -import 'bmf_overlay.dart'; - -/// 折线 -/// -class BMFPolyline extends BMFOverlay { - static BMFPolyline polyline() => BMFPolyline(coordinates: null, indexs: null); - - /// 经纬度数组 - List coordinates; - - /// 分段索引(多纹理,多颜色折线请赋值) - List indexs; - - /// 线宽 - int width; - - /// 颜色折线的colors 用于颜色绘制 - /// - /// 与textures二者必须选择其一进行传参 - List colors; - - /// 纹理折线的纹理图片路径 用于纹理绘制 - /// - /// 注意:纹理图片宽高必须是2的n次幂 - /// 与colors二者必须选择其一进行传参 - List textures; - - /// 设置折线是否虚线(Android独有) - /// - /// 当以纹理形式渲染polyline时,该属性为true,则显示纹理上的元素,为false不显示 - /// 当以颜色形式渲染polyline时,与BMFLineDashType配合使用;为true,则polyline可以渲染成虚线,为fasle则不能, - bool dottedLine; - - /// 虚线绘制样式 默认实折线 BMFLineDashTypeNone - /// - /// 实折线 LineDashTypeNone, - /// 方块虚线 LineDashTypeSquare, - /// 圆点虚线 LineDashTypeDot, - /// - /// Android平台要想渲染成虚线,必须设置dottedLine为true - BMFLineDashType lineDashType; - - /// line头尾处理方式(不支持虚线) 默认普通头 LineCapButt, - /// - /// 普通头 LineCapButt, - /// 圆形头 LineCapRound - /// - /// iOS独有 - BMFLineCapType lineCapType; - - /// line拐角处理方式(不支持虚线)默认平角衔接 LineJoinBevel, - /// - /// 平角衔接 BMFLineJoinBevel, - /// 尖角衔接(尖角过长(大于线宽)按平角处理) LineJoinMiter, - /// 圆⻆角衔接 LineJoinRound - /// - /// iOS独有 - BMFLineJoinType lineJoinType; - - /// 是否抽稀 默认ture - bool isThined; - - /// 是否可点击 - /// - /// Android独有属性,iOS polyline默认可点击,目前不支持通过该属性设置可点击状态 - bool clickable; - - /// 纹理宽、高是否保持原比例渲染,默认为false - /// - /// Android独有 - bool isKeepScale; - - /// 是否可以被选中,获得焦点,默认true - /// - /// Android独有 - bool isFocus; - - /// BMFPolyline构造方法 - BMFPolyline( - {@required this.coordinates, - @required this.indexs, - this.width: 5, - this.colors: const [], - this.textures: const [], - this.dottedLine: true, - this.lineDashType: BMFLineDashType.LineDashTypeNone, - this.lineCapType: BMFLineCapType.LineCapButt, - this.lineJoinType: BMFLineJoinType.LineJoinBevel, - this.isThined: true, - this.clickable: true, - this.isKeepScale: false, - this.isFocus: true, - int zIndex: 0, - bool visible: true}) - : super(zIndex: zIndex, visible: visible); - - BMFPolyline.withMap(Map map) { - if (null == map) { - return; - } - - super.fromMap(map); - - List list = map['coordinates'] as List; - List indexs = map['indexs'] as List; - this.coordinates = list - ?.map((c) => BMFCoordinate.coordinate().fromMap(c) as BMFCoordinate) - ?.toList(); - - this.indexs = indexs?.map((i) => i as int)?.toList(); - this.width = map['width']; - list = map['colors'] as List; - this.colors = list?.map((s) => ColorUtil.hexToColor(s as String))?.toList(); - this.textures = textures?.map((s) => s)?.toList(); - - this.dottedLine = map['dottedLine'] as bool; - - int lineType = map['lineDashType'] as int; - if (null != lineType && - lineType >= 0 && - lineType < BMFLineDashType.values.length) { - this.lineDashType = BMFLineDashType.values[lineType]; - } - - lineType = map['lineCapType'] as int; - if (null != lineType && - lineType >= 0 && - lineType < BMFLineDashType.values.length) { - this.lineCapType = BMFLineCapType.values[lineType]; - } - - lineType = map['lineJoinType'] as int; - if (null != lineType && - lineType >= 0 && - lineType < BMFLineDashType.values.length) { - this.lineJoinType = BMFLineJoinType.values[lineType]; - } - - this.isThined = map['isThined'] as bool; - this.clickable = map['clickable'] as bool; - this.isKeepScale = map['isKeepScale'] as bool; - this.isFocus = map['isFocus']; - } - - @override - fromMap(Map map) { - if (null == map) { - return; - } - - return BMFPolyline.withMap(map); - } - - @override - Map toMap() { - return { - 'id': this.getId(), - 'coordinates': this.coordinates?.map((coord) => coord?.toMap())?.toList(), - 'indexs': this.indexs?.map((index) => index)?.toList(), - 'width': this.width, - 'colors': - this.colors?.map((color) => color.value.toRadixString(16))?.toList(), - 'textures': this.textures, - 'dottedLine': this.dottedLine, - 'lineDashType': this.lineDashType?.index, - 'lineCapType': this.lineCapType?.index, - 'lineJoinType': this.lineJoinType?.index, - 'isThined': this.isThined, - 'clickable': this.clickable, - 'isKeepScale': this.isKeepScale, - 'isFocus': this.isFocus, - 'zIndex': this.zIndex, - 'visible': this.visible - }; - } - - /// 更新经纬度数组 - /// - /// List<[BMFCoordinate]> coordinates polyline经纬度数组 - /// - /// indexs 分段索引(多纹理,多颜色折线请赋值),iOS在多颜色或者多纹理渲染的情况下,更新经纬度数组的同时,必须更新indexs - Future updateCoordinates(List coordinates, - {List indexs}) async { - if (null == coordinates) { - return false; - } - - this.coordinates = coordinates; - - return await BMFMapDispatcherFactory.instance - .getOverlayDispatcher() - .updateOverlayMemberDispatch(this.getMethodChannel(), { - 'id': this.getId(), - 'member': 'coordinates', - 'value': coordinates?.map((coordinate) => coordinate?.toMap())?.toList(), - 'indexs': indexs?.map((index) => index)?.toList() - }); - } - - /// 更新线宽 - Future updateWidth(int width) async { - if (width < 0) { - return false; - } - - this.width = width; - - return await BMFMapDispatcherFactory.instance - .getOverlayDispatcher() - .updateOverlayMemberDispatch(this.getMethodChannel(), { - 'id': this.getId(), - 'member': 'width', - 'value': width, - }); - } - - /// 更新索引 - /// - /// Android在以colors渲染的情况下,更新纹理是无效的,应该使用updateColors接口 - Future updateIndexs(List indexs) async { - if (null == indexs) { - return false; - } - - this.indexs = indexs; - - return await BMFMapDispatcherFactory.instance - .getOverlayDispatcher() - .updateOverlayMemberDispatch(this.getMethodChannel(), { - 'id': this.getId(), - 'member': 'indexs', - 'value': indexs?.map((index) => index)?.toList(), - }); - } - - /// 更新colors - /// - /// android更新colors的时候,必须带上indexs - Future updateColors(List colors, {List indexs}) async { - if (null == colors) { - return false; - } - - this.colors = colors; - - if (null != indexs) { - this.indexs = indexs; - } - - return await BMFMapDispatcherFactory.instance - .getOverlayDispatcher() - .updateOverlayMemberDispatch(this.getMethodChannel(), { - 'id': this.getId(), - 'member': 'colors', - 'value': colors?.map((color) => color.value.toRadixString(16))?.toList(), - 'indexs': indexs?.map((index) => index)?.toList(), - }); - } - - /// 更新纹理textures (ios暂不支持) - Future updateTextures(List textures) async { - if (null == textures) { - return false; - } - - this.textures = textures; - - return await BMFMapDispatcherFactory.instance - .getOverlayDispatcher() - .updateOverlayMemberDispatch(this.getMethodChannel(), { - 'id': this.getId(), - 'member': 'textures', - 'value': textures?.map((e) => e)?.toList(), - }); - } - - /// 更新是否设置虚线 - /// - /// Android独有 - Future updateDottedLine(bool dottedLine) async { - this.dottedLine = dottedLine; - - return await BMFMapDispatcherFactory.instance - .getOverlayDispatcher() - .updateOverlayMemberDispatch(this.getMethodChannel(), { - 'id': this.getId(), - 'member': 'dottedLine', - 'value': dottedLine, - }); - } - - /// 更新折线绘制样式 - /// - /// [BMFLineDashType] lineDashType 折线类型 - Future updateLineDashType(BMFLineDashType lineDashType) async { - this.lineDashType = lineDashType; - - return await BMFMapDispatcherFactory.instance - .getOverlayDispatcher() - .updateOverlayMemberDispatch(this.getMethodChannel(), { - 'id': this.getId(), - 'member': 'lineDashType', - 'value': lineDashType?.index, - }); - } - - /// 更新折线头尾处理方式 - /// - /// [BMFLineCapType] lineCapType 折线头尾类型 - /// - /// iOS独有 - Future updateLineCapType(BMFLineCapType lineCapType) async { - this.lineCapType = lineCapType; - - return await BMFMapDispatcherFactory.instance - .getOverlayDispatcher() - .updateOverlayMemberDispatch(this.getMethodChannel(), { - 'id': this.getId(), - 'member': 'lineCapType', - 'value': lineCapType?.index, - }); - } - - /// 更新折线拐角处理方式 - /// - /// [BMFLineJoinType] lineJoinType 折线拐角处理方式 - /// - /// iOS独有 - Future updateLineJoinType(BMFLineJoinType lineJoinType) async { - this.lineJoinType = lineJoinType; - - return await BMFMapDispatcherFactory.instance - .getOverlayDispatcher() - .updateOverlayMemberDispatch(this.getMethodChannel(), { - 'id': this.getId(), - 'member': 'lineJoinType', - 'value': lineJoinType?.index, - }); - } - - /// 更新polyLine是否可点击 - /// - /// Android独有 - Future updateClickable(bool clickable) async { - this.clickable = clickable; - - return await BMFMapDispatcherFactory.instance - .getOverlayDispatcher() - .updateOverlayMemberDispatch(this.getMethodChannel(), { - 'id': this.getId(), - 'member': 'clickable', - 'value': clickable, - }); - } - - /// 更新纹理宽、高是否保持原比例渲染 - /// - /// Android独有 - Future updateIsKeepScale(bool isKeepScale) async { - this.isKeepScale = isKeepScale; - return await BMFMapDispatcherFactory.instance - .getOverlayDispatcher() - .updateOverlayMemberDispatch(this.getMethodChannel(), { - 'id': this.getId(), - 'member': 'isKeepScale', - 'value': isKeepScale, - }); - } - - /// 更新是否可以被选中,获得焦点 - /// - /// Android独有 - Future updateIsFocus(bool isFocus) async { - this.isFocus = isFocus; - - return await BMFMapDispatcherFactory.instance - .getOverlayDispatcher() - .updateOverlayMemberDispatch(this.getMethodChannel(), { - 'id': this.getId(), - 'member': 'isFocus', - 'value': isFocus, - }); - } - - /// 更新polyline是否显示 - /// - /// Android独有 - Future updateVisible(bool visible) async { - this.visible = visible; - - return await BMFMapDispatcherFactory.instance - .getOverlayDispatcher() - .updateOverlayMemberDispatch(this.getMethodChannel(), { - 'id': this.getId(), - 'member': 'visible', - 'value': visible, - }); - } - - /// 更新z轴方向上的堆叠顺序 - /// - /// Android独有 - Future updateZIndex(int zIndex) async { - this.zIndex = zIndex; - - return await BMFMapDispatcherFactory.instance - .getOverlayDispatcher() - .updateOverlayMemberDispatch(this.getMethodChannel(), { - 'id': this.getId(), - 'member': 'zIndex', - 'value': zIndex, - }); - } - - /// 更新polyline是否抽稀 - Future updateThined(bool isThined) async { - this.isThined = isThined; - - return await BMFMapDispatcherFactory.instance - .getOverlayDispatcher() - .updateOverlayMemberDispatch(this.getMethodChannel(), { - 'id': this.getId(), - 'member': 'isThined', - 'value': isThined, - }); - } -} diff --git a/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/models/overlays/bmf_text.dart b/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/models/overlays/bmf_text.dart deleted file mode 100644 index 5b37937..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/models/overlays/bmf_text.dart +++ /dev/null @@ -1,163 +0,0 @@ -library bmfmap_map.models.overlays.bmf_text; - -import 'package:flutter/material.dart'; -import 'package:flutter_bmfbase/BaiduMap/bmfmap_base.dart' - show BMFModel, BMFCoordinate, ColorUtil; - -import 'bmf_overlay.dart'; - -/// 文本 -/// -/// Android独有 -class BMFText extends BMFOverlay { - /// 文本 - String text; - - /// text经纬度 - BMFCoordinate position; - - /// 背景色 - Color bgColor; - - /// 字体颜色 - Color fontColor; - - /// 字体大小 - int fontSize; - - /// typeface - BMFTypeFace typeFace; - - /// 文字覆盖物水平对齐方式 ALIGN_LEFT | ALIGN_RIGHT | ALIGN_CENTER_HORIZONTAL - int alignX; - - /// 文字覆盖物垂直对齐方式 ALIGN_TOP | ALIGN_BOTTOM | ALIGN_CENTER_VERTICAL - int alignY; - - /// 旋转角度 - double rotate; - - BMFText.withMap(Map map) { - if (null == map) { - return; - } - - super.fromMap(map); - - this.text = map['text']; - this.position = BMFCoordinate.coordinate().fromMap(map['position']); - this.bgColor = ColorUtil.hexToColor(map['bgColor']); - this.fontColor = ColorUtil.hexToColor(map['fontColor']); - this.fontSize = map['fontSize']; - this.typeFace = BMFTypeFace.bmfTypeFace().fromMap(map['typeFace']); - this.alignX = map['alignX']; - this.alignY = map['alignY']; - this.rotate = map['rotate']; - } - - /// BMFText构造方法 - BMFText( - {@required this.text, - @required this.position, - this.bgColor, - this.fontColor: Colors.blue, - this.fontSize: 12, - this.typeFace, - this.alignY: BMFHorizontalAlign.ALIGN_CENTER_HORIZONTAL, - this.alignX: BMFVerticalAlign.ALIGN_CENTER_VERTICAL, - this.rotate: 0, - int zIndex: 0, - bool visible: true}) - : super(zIndex: zIndex, visible: visible); - - @override - fromMap(Map map) { - if (null == map) { - return null; - } - - return BMFText.withMap(map); - } - - @override - Map toMap() { - return { - 'id': this.getId(), - 'text': this.text, - 'position': this.position?.toMap(), - "bgColor": this.bgColor?.value?.toRadixString(16), - "fontColor": this.fontColor?.value?.toRadixString(16), - "fontSize": this.fontSize, - "typeFace": this.typeFace?.toMap(), - "alignX": this.alignX, - "alignY": this.alignY, - "rotate": this.rotate, - "zIndex": this.zIndex, - 'visible': this.visible, - }; - } -} - -/// Text水平方向上围绕position的对齐方式 -class BMFHorizontalAlign { - /// 文字覆盖物水平对齐方式:左对齐 - static const int ALIGN_LEFT = 1; - - /// 文字覆盖物水平对齐方式:右对齐 - static const int ALIGN_RIGHT = 2; - - /// 文字覆盖物水平对齐方式:水平居中对齐 - static const int ALIGN_CENTER_HORIZONTAL = 4; -} - -/// Text垂直方向上围绕position的对齐方式 -class BMFVerticalAlign { - /// 文字覆盖物垂直对齐方式:上对齐 - static const int ALIGN_TOP = 8; - - /// 文字覆盖物垂直对齐方式:下对齐 - static const int ALIGN_BOTTOM = 16; - - /// 文字覆盖物垂直对齐方式:居中对齐 - static const int ALIGN_CENTER_VERTICAL = 32; -} - -enum BMFTextStyle { - NORMAL, - BOLD, - ITALIC, - BOLD_ITALIC, -} - -class BMFFamilyName { - static const String sDefault = ""; - static const String sSansSerif = "sans-serif"; - static const String sSerif = "serif"; - static const String sMonospace = "monospace"; -} - -/// typeFace -class BMFTypeFace implements BMFModel { - static BMFTypeFace bmfTypeFace() => - BMFTypeFace(familyName: null, textStype: BMFTextStyle.NORMAL); - - String familyName; - BMFTextStyle textStype; - - BMFTypeFace({@required this.familyName, @required this.textStype}); - - @override - fromMap(Map map) { - if (null == map) { - return null; - } - return new BMFTypeFace( - familyName: map['familyName'], - textStype: BMFTextStyle.values[map['textStype'] as int]); - } - - @override - Map toMap() { - return {"familyName": this.familyName, "textStype": this.textStype.index}; - } -} diff --git a/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/models/overlays/bmf_tile.dart b/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/models/overlays/bmf_tile.dart deleted file mode 100644 index 555fa94..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/models/overlays/bmf_tile.dart +++ /dev/null @@ -1,100 +0,0 @@ -library bmfmap_map.models.overlays.bmf_tile; - -import 'package:flutter/cupertino.dart'; -import 'package:flutter_bmfbase/BaiduMap/bmfmap_base.dart' - show BMFCoordinateBounds; - -import 'bmf_overlay.dart'; - -/// 枚举:瓦片图加载方式 -enum BMFTileLoadType { - /// 网络加载,取该值时BMFTile必须传url - LoadUrlTile, - - /// 本地异步加载 - LoadLocalAsyncTile, - - /// 本地同步加载 - /// - /// Android没有该选项 - LoadLocalSyncTile, -} - -/// 瓦片图 -class BMFTile extends BMFOverlay { - static BMFTile tile() => BMFTile( - visibleMapBounds: null, tileLoadType: BMFTileLoadType.LoadLocalAsyncTile); - - /// 瓦片图最大放大级别,android平台默认为20,其它平台默认为21 - int maxZoom; - - /// 瓦片图最小缩放级别,默认3 - int minZoom; - - /// tileOverlay的可渲染区域,默认世界范围 - BMFCoordinateBounds visibleMapBounds; - - /// 瓦片图缓存大小,android端需要,ios端暂时不需要 - int maxTileTmp; - - /// 瓦片图加载类型 - BMFTileLoadType tileLoadType; - - /// 可选的参数,只有tileLoadType为LoadUrlTile时才有效 - String url; - - /// BMFTile构造方法 - BMFTile( - {@required this.visibleMapBounds, - @required this.tileLoadType, - this.maxZoom, - this.minZoom, - this.maxTileTmp, - this.url}); - - BMFTile.withMap(Map map) { - if (null == map) { - return; - } - - super.fromMap(map); - - this.maxZoom = map['maxZoom']; - this.minZoom = map['minZoom']; - this.visibleMapBounds = - BMFCoordinateBounds.coordinateBounds().fromMap(map['visibleMapBounds']); - this.maxTileTmp = map['maxTileTmp']; - - int tileLoadType = map['tileLoadType'] as int; - - if (null != tileLoadType && - tileLoadType >= 0 && - tileLoadType < BMFTileLoadType.values.length) { - this.tileLoadType = BMFTileLoadType.values[tileLoadType]; - } - - this.url = map['url']; - } - - @override - fromMap(Map map) { - if (null == map) { - return null; - } - - return BMFTile.withMap(map); - } - - @override - Map toMap() { - return { - 'id': this.getId(), - 'maxZoom': this.maxZoom, - 'minZoom': this.minZoom, - 'visibleMapBounds': this.visibleMapBounds?.toMap(), - 'maxTileTmp': this.maxTileTmp, - 'tileLoadType': this.tileLoadType?.index, - 'url': this.url - }; - } -} diff --git a/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/private/bmf_method_channel_handler.dart b/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/private/bmf_method_channel_handler.dart deleted file mode 100644 index 7906bc4..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/private/bmf_method_channel_handler.dart +++ /dev/null @@ -1,518 +0,0 @@ -import 'package:flutter/services.dart'; -import 'package:flutter_bmfbase/BaiduMap/bmfmap_base.dart'; -import 'package:flutter_bmfmap/BaiduMap/models/bmf_baseindoormap_info.dart'; -import 'package:flutter_bmfmap/BaiduMap/models/bmf_mappoi.dart'; -import 'package:flutter_bmfmap/BaiduMap/models/bmf_mapstatus.dart'; -import 'package:flutter_bmfmap/BaiduMap/models/overlays/bmf_polyline.dart'; -import 'package:flutter_bmfmap/BaiduMap/private/mapdispatcher/bmf_map_method_id.dart'; - -/// 地图无参数回调 -typedef BMFMapCallback = void Function(); - -/// 地图成功回调 -typedef BMFMapSuccessCallback = void Function(bool success); - -/// 地图区域改变回调 -typedef BMFMapRegionChangeCallback = void Function(BMFMapStatus mapStatus); - -/// 地图区域改变原因回调 -typedef BMFMapRegionChangeReasonCallback = void Function( - BMFMapStatus mapStatus, BMFRegionChangeReason regionChangeReason); - -/// 点中底图标注后会回调此接口 -typedef BMFMapOnClickedMapPoiCallback = void Function(BMFMapPoi mapPoi); - -/// 地图marker事件回调 -typedef BMFMapMarkerCallback = void Function(String markerId, dynamic extra); - -/// 地图点击覆盖物回调,目前只支持polyline -typedef BMFMapOnClickedOverlayCallback = void Function(BMFPolyline polyline); - -/// 地图经纬度回调 -typedef BMFMapCoordinateCallback = void Function(BMFCoordinate coordinate); - -/// 地图3DTouch回调 -/// -/// coordinate 触摸点的经纬度 -/// -/// force 触摸该点的力度(参考UITouch的force属性) -/// -/// maximumPossibleForce 当前输入机制下的最大可能力度(参考UITouch的maximumPossibleForce属性) -typedef BMFMapOnForceTouchCallback = void Function( - BMFCoordinate coordinate, double force, double maximumPossibleForce); - -/// 地图渲染每一帧画面过程中,以及每次需要重绘地图时(例如添加覆盖物)都会调用此接口 -typedef BMFMapOnDrawMapFrameCallback = void Function(BMFMapStatus mapStatus); - -/// 地图View进入/移出室内图会调用此方法 -/// -/// flag true:进入室内图,false:移出室内图 -/// -/// baseIndoorMapInfo 室内图信息 -typedef BMFMapInOrOutBaseIndoorMapCallback = void Function( - bool flag, BMFBaseIndoorMapInfo baseIndoorMapInfo); - -/// 地图绘制出有效数据的监听 -typedef BMFMapRenderValidDataCallback = void Function( - bool isValid, int errorCode, String errorMessage); - -///处理native发送过来的消息 -class BMFMethodChannelHandler { - static const sTag = 'BMFMethodChannelHandler'; - - /// 加载完成回调 - BMFMapCallback _mapDidLoadCallback; - - /// 渲染完成回调 - BMFMapSuccessCallback _mapDidFinishRenderCallback; - - /// 地图渲染每一帧画面过程中,以及每次需要重绘地图时(例如添加覆盖物)都会调用此接口 - BMFMapOnDrawMapFrameCallback _mapOnDrawMapFrameCallback; - - /// 两端类型不一致,Android返回的是MapStatus状态,ios没有返回参数 - /// - /// 地图区域即将改变时会调用此接口 - BMFMapRegionChangeCallback _mapRegionWillChangeCallback; - - /// 两端类型不一致,Android返回的是MapStatus状态,ios没有返回参数 - /// - /// 地图区域改变完成后会调用此接口 - BMFMapRegionChangeCallback _mapRegionDidChangeCallback; - - /// 两端类型不一致,Android返回的是MapStatus状态,ios没有返回参数 - /// - /// 地图区域即将改变时会调用此接口reason - BMFMapRegionChangeReasonCallback _mapRegionWillChangeWithReasonCallback; - - /// 两端类型不一致,Android返回的是MapStatus状态,ios没有返回参数 - /// - /// 地图区域改变完成后会调用此接口reason - BMFMapRegionChangeReasonCallback _mapRegionDidChangeWithReasonCallback; - - /// 点中覆盖物后会回调此接口,目前只支持点中Polyline时回调 - BMFMapOnClickedOverlayCallback _mapOnClickedOverlayCallback; - - /// 点中底图标注后会回调此接口 - BMFMapOnClickedMapPoiCallback _mapOnClickedMapPoiCallback; - - /// 点中底图空白处会回调此接口 - BMFMapCoordinateCallback _mapOnClickedMapBlankCallback; - - /// 双击地图时会回调此接口 - BMFMapCoordinateCallback _mapOnDoubleClickCallback; - - /// 长按地图时会回调此接口 - BMFMapCoordinateCallback _mapOnLongClickCallback; - - /// (ios) 独有 - /// - /// 3DTouch 按地图时会回调此接口 - /// - ///(仅在支持3D Touch,且fouchTouchEnabled属性为true时,会回调此接口) - BMFMapOnForceTouchCallback _mapOnForceTouchCallback; - - /// 地图状态改变完成后会调用此接口 - BMFMapCallback _mapStatusDidChangedCallback; - - /// 地图View进入/移出室内图会调用此方法 - BMFMapInOrOutBaseIndoorMapCallback _mapInOrOutBaseIndoorMapCallback; - - //marker - /// marker点击回调 - BMFMapMarkerCallback _mapClickedMarkerCallback; - - /// marker选中回调 - BMFMapMarkerCallback _mapDidSelectMarkerCallback; - - /// marker取消选中回调 - BMFMapMarkerCallback _mapDidDeselectMarkerCallback; - - /// marker取消选中回调 - BMFMapMarkerCallback _mapDragMarkerCallback; - - /// marker的infoWindow(ios paopaoView)点击回调 - BMFMapMarkerCallback _mapDidClickedInfoWindowCallback; - - /// 地图绘制出有效数据的监听 - BMFMapRenderValidDataCallback _mapRenderValidDataCallback; - - /// native -> flutter - dynamic handlerMethod(MethodCall call) async { -// BMFLog.d('_handlerMethod--\n method = ${call.method}'); -// BMFLog.d('_handlerMethod--\n arguments = ${call.arguments}'); - switch (call.method) { - case BMFMapCallbackMethodId.kMapDidLoadCallback: - { - if (this._mapDidLoadCallback != null) { - this._mapDidLoadCallback(); - } - break; - } - - case BMFMapCallbackMethodId.kMapDidFinishRenderCallback: - { - // BMFLog.d("kMapDidFinishRenderCallback"); - if (this._mapDidFinishRenderCallback != null) { - this._mapDidFinishRenderCallback(call.arguments['success'] as bool); - } - break; - } - case BMFMapCallbackMethodId.kMapOnDrawMapFrameCallback: - { - if (this._mapOnDrawMapFrameCallback != null) { - BMFMapStatus mapStatus = - BMFMapStatus.mapStatus().fromMap(call.arguments['mapStatus']); - this._mapOnDrawMapFrameCallback(mapStatus); - } - break; - } - case BMFMapCallbackMethodId.kMapRegionWillChangeCallback: - { - if (this._mapRegionWillChangeCallback != null) { - BMFMapStatus mapStatus = - BMFMapStatus.mapStatus().fromMap(call.arguments['mapStatus']); - this._mapRegionWillChangeCallback(mapStatus); - } - break; - } - case BMFMapCallbackMethodId.kMapRegionDidChangeCallback: - { - if (this._mapRegionDidChangeCallback != null) { - BMFMapStatus mapStatus = - BMFMapStatus.mapStatus().fromMap(call.arguments['mapStatus']); - this._mapRegionDidChangeCallback(mapStatus); - } - break; - } - case BMFMapCallbackMethodId.kMapRegionWillChangeWithReasonCallback: - { - if (this._mapRegionWillChangeWithReasonCallback != null) { - BMFMapStatus mapStatus = - BMFMapStatus.mapStatus().fromMap(call.arguments['mapStatus']); - BMFRegionChangeReason reason = - BMFRegionChangeReason.values[call.arguments['reason'] as int]; - this._mapRegionWillChangeWithReasonCallback(mapStatus, reason); - } - break; - } - case BMFMapCallbackMethodId.kMapRegionDidChangeWithReasonCallback: - { - if (this._mapRegionDidChangeWithReasonCallback != null) { - BMFMapStatus mapStatus = - BMFMapStatus.mapStatus().fromMap(call.arguments['mapStatus']); - BMFRegionChangeReason reason = - BMFRegionChangeReason.values[call.arguments['reason'] as int]; - this._mapRegionDidChangeWithReasonCallback(mapStatus, reason); - } - break; - } - case BMFOverlayCallbackMethodId.kMapOnClickedOverlayCallback: - { - if (this._mapOnClickedOverlayCallback != null) { - BMFPolyline polyline = - BMFPolyline.polyline().fromMap(call.arguments['polyline']); - this._mapOnClickedOverlayCallback(polyline); - } - break; - } - case BMFMapCallbackMethodId.kMapOnClickedMapPoiCallback: - { - if (this._mapOnClickedMapPoiCallback != null) { - BMFMapPoi poi = BMFMapPoi.mapPoi().fromMap(call.arguments['poi']); - this._mapOnClickedMapPoiCallback(poi); - } - break; - } - case BMFMapCallbackMethodId.kMapOnClickedMapBlankCallback: - { - if (this._mapOnClickedMapBlankCallback != null) { - BMFCoordinate coordinate = - BMFCoordinate.coordinate().fromMap(call.arguments['coord']); - this._mapOnClickedMapBlankCallback(coordinate); - } - break; - } - case BMFMapCallbackMethodId.kMapOnDoubleClickCallback: - { - if (this._mapOnDoubleClickCallback != null) { - BMFCoordinate coordinate = - BMFCoordinate.coordinate().fromMap(call.arguments['coord']); - this._mapOnDoubleClickCallback(coordinate); - } - break; - } - case BMFMapCallbackMethodId.kMapOnLongClickCallback: - { - if (this._mapOnLongClickCallback != null) { - BMFCoordinate coordinate = - BMFCoordinate.coordinate().fromMap(call.arguments['coord']); - this._mapOnLongClickCallback(coordinate); - } - break; - } - case BMFMapCallbackMethodId.kMapOnForceTouchCallback: - { - if (this._mapOnForceTouchCallback != null) { - BMFCoordinate coordinate = - BMFCoordinate.coordinate().fromMap(call.arguments['coord']); - double force = call.arguments['force'] as double; - double maximumPossibleForce = - call.arguments['maximumPossibleForce'] as double; - this._mapOnForceTouchCallback( - coordinate, force, maximumPossibleForce); - } - break; - } - case BMFMapCallbackMethodId.kMapStatusDidChangedCallback: - { - if (this._mapStatusDidChangedCallback != null) { - this._mapStatusDidChangedCallback(); - } - break; - } - case BMFMapCallbackMethodId.kMapInOrOutBaseIndoorMapCallback: - { - if (this._mapInOrOutBaseIndoorMapCallback != null) { - bool flag = call.arguments['flag']; - BMFBaseIndoorMapInfo info = BMFBaseIndoorMapInfo.baseIndoorMapInfo() - .fromMap(call.arguments['info']); - this._mapInOrOutBaseIndoorMapCallback(flag, info); - } - break; - } - case BMFMarkerCallbackMethodId.kMapClickedmarkedCallback: - { - if (this._mapClickedMarkerCallback != null) { - BMFLog.d(BMFMarkerCallbackMethodId.kMapClickedmarkedCallback); - String id = call.arguments['id']; - Map extra = call.arguments['extra']; - this._mapClickedMarkerCallback(id, extra); - } - break; - } - case BMFMarkerCallbackMethodId.kMapDidSelectMarkerCallback: - { - if (this._mapDidSelectMarkerCallback != null) { - String id = call.arguments['id']; - Map extra = call.arguments['extra']; - this._mapDidSelectMarkerCallback(id, extra); - } - break; - } - case BMFMarkerCallbackMethodId.kMapDidDeselectMarkerCallback: - { - if (this._mapDidDeselectMarkerCallback != null) { - String id = call.arguments['id']; - Map extra = call.arguments['extra']; - this._mapDidDeselectMarkerCallback(id, extra); - } - break; - } - case BMFMarkerCallbackMethodId.kMapDragMarkerCallback: - { - if (this._mapDragMarkerCallback != null) { - BMFLog.d("drag marker", tag: sTag); - String id = call.arguments['id']; - this._mapDragMarkerCallback(id, call.arguments['extra']); - } - break; - } - case BMFInfoWindowMethodId.kMapDidClickedInfoWindowMethod: - { - if (this._mapDidClickedInfoWindowCallback != null) { - BMFLog.d("infoWindow click", tag: 'BMFMethodChannelHandler'); - String id = call.arguments['id']; - BMFLog.d(id, tag: 'BMFMethodChannelHandler'); - this._mapDidClickedInfoWindowCallback(id, null); - } - break; - } - - case BMFMapCallbackMethodId.kMapRenderValidDataCallback: - { - if (this._mapRenderValidDataCallback != null) { - bool isValid = call.arguments['isValid'] as bool; - int errorCode = call.arguments['errorCode'] as int; - String errorMessage = call.arguments['errorMessage'] as String; - this._mapRenderValidDataCallback(isValid, errorCode, errorMessage); - } - break; - } - default: - break; - } - } - - /// 地图加载完成回调 - void setMapDidLoadCallback(BMFMapCallback block) { - if (block == null) { - return; - } - this._mapDidLoadCallback = block; - } - - /// 地图渲染回调 - void setMapDidFinishedRenderCallback(BMFMapSuccessCallback block) { - if (block == null) { - return; - } - this._mapDidFinishRenderCallback = block; - } - - /// 地图渲染每一帧画面过程中,以及每次需要重绘地图时(例如添加覆盖物)都会调用此接口 - void setMapOnDrawMapFrameCallback(BMFMapOnDrawMapFrameCallback block) { - if (block == null) { - return; - } - this._mapOnDrawMapFrameCallback = block; - } - - /// 地图区域即将改变时会调用此接口 - void setMapRegionWillChangeCallback(BMFMapRegionChangeCallback block) { - if (block == null) { - return; - } - this._mapRegionWillChangeCallback = block; - } - - /// 地图区域改变完成后会调用此接口 - void setMapRegionDidChangeCallback(BMFMapRegionChangeCallback block) { - if (block == null) { - return; - } - this._mapRegionDidChangeCallback = block; - } - - /// 地图区域即将改变时会调用此接口reason - void setMapRegionWillChangeWithReasonCallback( - BMFMapRegionChangeReasonCallback block) { - if (block == null) { - return; - } - this._mapRegionWillChangeWithReasonCallback = block; - } - - /// 地图区域改变完成后会调用此接口reason - void setMapRegionDidChangeWithReasonCallback( - BMFMapRegionChangeReasonCallback block) { - if (block == null) { - return; - } - this._mapRegionDidChangeWithReasonCallback = block; - } - - /// 地图点击覆盖物回调,目前只支持polyline - void setMapOnClickedOverlayCallback(BMFMapOnClickedOverlayCallback block) { - if (block == null) { - return; - } - this._mapOnClickedOverlayCallback = block; - } - - /// 点中底图标注后会回调此接口 - void setMapOnClickedMapPoiCallback(BMFMapOnClickedMapPoiCallback block) { - if (block == null) { - return; - } - this._mapOnClickedMapPoiCallback = block; - } - - /// 点中底图空白处会回调此接口 - void setMapOnClickedMapBlankCallback(BMFMapCoordinateCallback block) { - if (block == null) { - return; - } - this._mapOnClickedMapBlankCallback = block; - } - - /// 双击地图时会回调此接口 - void setMapOnDoubleClickCallback(BMFMapCoordinateCallback block) { - if (block == null) { - return; - } - this._mapOnDoubleClickCallback = block; - } - - /// 长按地图时会回调此接口 - void setMapOnLongClickCallback(BMFMapCoordinateCallback block) { - if (block == null) { - return; - } - this._mapOnLongClickCallback = block; - } - - /// 3DTouch 按地图时会回调此接口 - /// - ///(仅在支持3D Touch,且fouchTouchEnabled属性为true时,会回调此接口) - void setMapOnForceTouchCallback(BMFMapOnForceTouchCallback block) { - if (block == null) { - return; - } - this._mapOnForceTouchCallback = block; - } - - /// 地图状态改变完成后会调用此接口 - void setMapStatusDidChangedCallback(BMFMapCallback block) { - if (block == null) { - return; - } - this._mapStatusDidChangedCallback = block; - } - - /// 设置地图View进入/移出室内图回调 - void setMapInOrOutBaseIndoorMapCallback( - BMFMapInOrOutBaseIndoorMapCallback block) { - if (block == null) { - return; - } - this._mapInOrOutBaseIndoorMapCallback = block; - } - - /// 设置marker点击回调 - void setMapClickedMarkerCallback(BMFMapMarkerCallback block) { - if (block == null) { - return; - } - this._mapClickedMarkerCallback = block; - } - - /// 设置marker选中回调 - void setMaptDidSelectMarkerCallback(BMFMapMarkerCallback block) { - if (block == null) { - return; - } - this._mapDidSelectMarkerCallback = block; - } - - /// 设置marker取消回调 - void setMapDidDeselectMarkerCallback(BMFMapMarkerCallback block) { - if (block == null) { - return; - } - this._mapDidDeselectMarkerCallback = block; - } - - /// 设置marker拖拽回调 - void setMapDragMarkerCallback(BMFMapMarkerCallback block) { - if (block == null) { - return; - } - this._mapDragMarkerCallback = block; - } - - /// 设置marker的infoWindow(iOS paopaoView)点击回调 - void setMapDidClickedInfoWindowCallback(BMFMapMarkerCallback block) { - if (block == null) { - return; - } - this._mapDidClickedInfoWindowCallback = block; - } - - /// 设置地图绘制出有效数据的监听 - void setMapRenderValidDataCallback(BMFMapRenderValidDataCallback block) { - if (block == null) { - return; - } - this._mapRenderValidDataCallback = block; - } -} diff --git a/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/private/mapdispatcher/bmf_map_dispatcher_factory.dart b/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/private/mapdispatcher/bmf_map_dispatcher_factory.dart deleted file mode 100644 index dcb00b2..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/private/mapdispatcher/bmf_map_dispatcher_factory.dart +++ /dev/null @@ -1,61 +0,0 @@ -import 'package:flutter_bmfmap/BaiduMap/private/mapdispatcher/bmf_map_get_state_dispacther.dart'; -import 'package:flutter_bmfmap/BaiduMap/private/mapdispatcher/bmf_map_state_dispacther.dart'; -import 'package:flutter_bmfmap/BaiduMap/private/mapdispatcher/bmf_map_widget_state_dispather.dart'; -import 'package:flutter_bmfmap/BaiduMap/private/mapdispatcher/bmf_marker_dispatcher.dart'; -import 'package:flutter_bmfmap/BaiduMap/private/mapdispatcher/bmf_offline_map_dispatcher.dart'; -import 'package:flutter_bmfmap/BaiduMap/private/mapdispatcher/bmf_overlay_dispatcher.dart'; -import 'package:flutter_bmfmap/BaiduMap/private/mapdispatcher/bmf_userlocation_dispatcher.dart'; - -class BMFMapDispatcherFactory { - // 工厂模式 - factory BMFMapDispatcherFactory() => _getInstance(); - static BMFMapDispatcherFactory get instance => _getInstance(); - static BMFMapDispatcherFactory _instance; - - BMFMapStateDispatcher _mapStateDispatcher; - BMFMapGetStateDispatcher _mapGetStateDispatcher; - BMFMapUserLocationDispatcher _mapUserLocationDispatcher; - BMFMarkerDispatcher _markerDispatcher; - BMFOverlayDispatcher _overlayDispatcher; - BMFOfflineMapDispatcher _offlineMapDispatcher; - BMFMapWidgetStateDispatcher _mapWidgetStateDispatcher; - - BMFMapDispatcherFactory._internal() { - _mapStateDispatcher = new BMFMapStateDispatcher(); - _mapGetStateDispatcher = new BMFMapGetStateDispatcher(); - _mapUserLocationDispatcher = new BMFMapUserLocationDispatcher(); - _markerDispatcher = new BMFMarkerDispatcher(); - _overlayDispatcher = new BMFOverlayDispatcher(); - _offlineMapDispatcher = new BMFOfflineMapDispatcher(); - _mapWidgetStateDispatcher = new BMFMapWidgetStateDispatcher(); - } - static BMFMapDispatcherFactory _getInstance() { - if (_instance == null) { - _instance = new BMFMapDispatcherFactory._internal(); - } - return _instance; - } - - /// mapStateDispatcher - BMFMapStateDispatcher getMapStateDispatcher() => _mapStateDispatcher; - - // mapGetStateDispatcher - BMFMapGetStateDispatcher getMapGetStateDispatcher() => _mapGetStateDispatcher; - - /// mapUserLocationDispatcher - BMFMapUserLocationDispatcher getMapUserLocationDispatcher() => - _mapUserLocationDispatcher; - - /// markerDispatcher - BMFMarkerDispatcher getMarkerDispatcher() => _markerDispatcher; - - /// overlayDispatcher - BMFOverlayDispatcher getOverlayDispatcher() => _overlayDispatcher; - - /// offlineMapDispatcher - BMFOfflineMapDispatcher getOfflineMapDispatcher() => _offlineMapDispatcher; - - /// widgetStateDispatcher - BMFMapWidgetStateDispatcher getMapWidgetStateDispatcher() => - _mapWidgetStateDispatcher; -} diff --git a/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/private/mapdispatcher/bmf_map_get_state_dispacther.dart b/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/private/mapdispatcher/bmf_map_get_state_dispacther.dart deleted file mode 100644 index 5fa1af4..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/private/mapdispatcher/bmf_map_get_state_dispacther.dart +++ /dev/null @@ -1,416 +0,0 @@ -import 'package:flutter/services.dart'; -import 'package:flutter_bmfbase/BaiduMap/bmfmap_base.dart'; -import 'bmf_map_method_id.dart' show BMFMapGetPropertyMethodId; - -/// 获取地图状态 -class BMFMapGetStateDispatcher { - /// 获取map的展示类型 - Future getMapTypeDispatch(MethodChannel _mapChannel) async { - if (_mapChannel == null) { - return null; - } - BMFMapType mapType; - try { - Map result = await _mapChannel - .invokeMethod(BMFMapGetPropertyMethodId.kMapGetMapTypeMethod); - mapType = BMFMapType.values[result['mapType'] as int]; - } on PlatformException catch (e) { - print(e.toString()); - } - return mapType; - } - - /// 获取map的比例尺级别 - Future getZoomLevelDispatch(MethodChannel _mapChannel) async { - if (_mapChannel == null) { - return null; - } - int zoomLevel; - try { - Map result = await _mapChannel - .invokeMethod(BMFMapGetPropertyMethodId.kMapGetZoomLevelMethod); - zoomLevel = result['zoomLevel'] as int; - } on PlatformException catch (e) { - print(e.toString()); - } - return zoomLevel; - } - - /// 获取map的自定义最小比例尺级别 - Future getMinZoomLevelDispatch(MethodChannel _mapChannel) async { - if (_mapChannel == null) { - return null; - } - int minZoomLevel; - try { - Map result = await _mapChannel - .invokeMethod(BMFMapGetPropertyMethodId.kMapGetMinZoomLevelMethod); - minZoomLevel = result['minZoomLevel'] as int; - } on PlatformException catch (e) { - print(e.toString()); - } - return minZoomLevel; - } - - /// 获取map的自定义最大比例尺级别 - Future getMaxZoomLevelDispatch(MethodChannel _mapChannel) async { - if (_mapChannel == null) { - return null; - } - int maxZoomLevel; - try { - Map result = await _mapChannel - .invokeMethod(BMFMapGetPropertyMethodId.kMapGetMaxZoomLevelMethod); - maxZoomLevel = result['maxZoomLevel'] as int; - } on PlatformException catch (e) { - print(e.toString()); - } - return maxZoomLevel; - } - - /// 获取map的旋转角度 - Future getRotationDispatch(MethodChannel _mapChannel) async { - if (_mapChannel == null) { - return null; - } - double rotation; - try { - Map result = await _mapChannel - .invokeMethod(BMFMapGetPropertyMethodId.kMapGetRotationMethod); - rotation = result['rotation'] as double; - } on PlatformException catch (e) { - print(e.toString()); - } - return rotation; - } - - /// 获取map的地图俯视角度 - Future getOverlookingDispatch(MethodChannel _mapChannel) async { - if (_mapChannel == null) { - return null; - } - double overlooking; - try { - Map result = await _mapChannel - .invokeMethod(BMFMapGetPropertyMethodId.kMapGetOverlookingMethod); - overlooking = result['overlooking'] as double; - } on PlatformException catch (e) { - print(e.toString()); - } - return overlooking; - } - - /// 获取map的俯视角度最小值 - /// - /// ios 独有 - Future getMinOverlookingDispatch(MethodChannel _mapChannel) async { - if (_mapChannel == null) { - return null; - } - int minOverlooking; - try { - Map result = await _mapChannel - .invokeMethod(BMFMapGetPropertyMethodId.kMapGetMinOverlookingMethod); - minOverlooking = result['minOverlooking'] as int; - } on PlatformException catch (e) { - print(e.toString()); - } - return minOverlooking; - } - - /// 获取map的是否现显示3D楼块效果 - Future getBuildingsEnabledDispatch(MethodChannel _mapChannel) async { - if (_mapChannel == null) { - return null; - } - bool buildingsEnabled; - try { - Map result = await _mapChannel.invokeMethod( - BMFMapGetPropertyMethodId.kMapGetBuildingsEnabledMethod); - buildingsEnabled = result['buildingsEnabled'] as bool; - } on PlatformException catch (e) { - print(e.toString()); - } - return buildingsEnabled; - } - - /// 获取map的是否显示底图poi标注 - /// - /// ios 独有 - Future getShowMapPoiDispatch(MethodChannel _mapChannel) async { - if (_mapChannel == null) { - return null; - } - bool showMapPoi; - try { - Map result = await _mapChannel - .invokeMethod(BMFMapGetPropertyMethodId.kMapGetShowMapPoiMethod); - showMapPoi = result['showMapPoi'] as bool; - } on PlatformException catch (e) { - print(e.toString()); - } - return showMapPoi; - } - - /// 获取map的是否打开路况图层 - Future getTrafficEnabledDispatch(MethodChannel _mapChannel) async { - if (_mapChannel == null) { - return null; - } - bool trafficEnabled; - try { - Map result = await _mapChannel - .invokeMethod(BMFMapGetPropertyMethodId.kMapGetTrafficEnabledMethod); - trafficEnabled = result['trafficEnabled'] as bool; - } on PlatformException catch (e) { - print(e.toString()); - } - return trafficEnabled; - } - - /// 获取map的是否打开百度城市热力图图层 - Future getBaiduHeatMapEnabledDispatch(MethodChannel _mapChannel) async { - if (_mapChannel == null) { - return null; - } - bool baiduHeatMapEnabled; - try { - Map result = await _mapChannel.invokeMethod( - BMFMapGetPropertyMethodId.kMapGetBaiduHeatMapEnabledMethod); - baiduHeatMapEnabled = result['baiduHeatMapEnabled'] as bool; - } on PlatformException catch (e) { - print(e.toString()); - } - return baiduHeatMapEnabled; - } - - /// 获取map的是否支持所有手势操作 - Future getGesturesEnabledDispatch(MethodChannel _mapChannel) async { - if (_mapChannel == null) { - return null; - } - bool gesturesEnabled; - try { - Map result = await _mapChannel - .invokeMethod(BMFMapGetPropertyMethodId.kMapGetGesturesEnabledMethod); - gesturesEnabled = result['gesturesEnabled'] as bool; - } on PlatformException catch (e) { - print(e.toString()); - } - return gesturesEnabled; - } - - /// 获取map的是否支持用户多点缩放(双指) - /// - /// android 中效果是否允许缩放手势包括(双击,双指单击,双指缩放) - Future getZoomEnabledDispatch(MethodChannel _mapChannel) async { - if (_mapChannel == null) { - return null; - } - bool zoomEnabled; - try { - Map result = await _mapChannel - .invokeMethod(BMFMapGetPropertyMethodId.kMapGetZoomEnabledMethod); - zoomEnabled = result['zoomEnabled'] as bool; - } on PlatformException catch (e) { - print(e.toString()); - } - return zoomEnabled; - } - - /// 获取map的是否支持用户缩放(双击或双指单击) - /// - /// ios 独有 - Future getZoomEnabledWithTapDispatch(MethodChannel _mapChannel) async { - if (_mapChannel == null) { - return null; - } - bool zoomEnabledWithTap; - try { - Map result = await _mapChannel.invokeMethod( - BMFMapGetPropertyMethodId.kMapGetZoomEnabledWithTapMethod); - zoomEnabledWithTap = result['zoomEnabledWithTap'] as bool; - } on PlatformException catch (e) { - print(e.toString()); - } - return zoomEnabledWithTap; - } - - /// 获取map的是否支持用户移动地图 - Future getScrollEnabledDispatch(MethodChannel _mapChannel) async { - if (_mapChannel == null) { - return null; - } - bool scrollEnabled; - try { - Map result = await _mapChannel - .invokeMethod(BMFMapGetPropertyMethodId.kMapGetScrollEnabledMethod); - scrollEnabled = result['scrollEnabled'] as bool; - } on PlatformException catch (e) { - print(e.toString()); - } - return scrollEnabled; - } - - /// 获取map的是否支持俯仰角 - Future getOverlookEnabledDispatch(MethodChannel _mapChannel) async { - if (_mapChannel == null) { - return null; - } - bool overlookEnabled; - try { - Map result = await _mapChannel - .invokeMethod(BMFMapGetPropertyMethodId.kMapGetOverlookEnabledMethod); - overlookEnabled = result['overlookEnabled'] as bool; - } on PlatformException catch (e) { - print(e.toString()); - } - return overlookEnabled; - } - - /// 获取map的是否支持旋转 - Future getRotateEnabledDispatch(MethodChannel _mapChannel) async { - if (_mapChannel == null) { - return null; - } - bool rotateEnabled; - try { - Map result = await _mapChannel - .invokeMethod(BMFMapGetPropertyMethodId.kMapGetRotateEnabledMethod); - rotateEnabled = result['rotateEnabled'] as bool; - } on PlatformException catch (e) { - print(e.toString()); - } - return rotateEnabled; - } - - /// 获取map的是否支持3Dtouch - /// - /// ios 独有 - Future getForceTouchEnabledDispatch(MethodChannel _mapChannel) async { - if (_mapChannel == null) { - return null; - } - bool forceTouchEnabled; - try { - Map result = await _mapChannel.invokeMethod( - BMFMapGetPropertyMethodId.kMapGetForceTouchEnabledMethod); - forceTouchEnabled = result['forceTouchEnabled'] as bool; - } on PlatformException catch (e) { - print(e.toString()); - } - return forceTouchEnabled; - } - - /// 获取map的是否显式比例尺 - /// - /// ios 独有 - Future getShowMapScaleBarDispatch(MethodChannel _mapChannel) async { - if (_mapChannel == null) { - return null; - } - bool showMapScaleBar; - try { - Map result = await _mapChannel - .invokeMethod(BMFMapGetPropertyMethodId.kMapGetShowMapScaleBarMethod); - showMapScaleBar = result['showMapScaleBar'] as bool; - } on PlatformException catch (e) { - print(e.toString()); - } - return showMapScaleBar; - } - - /// 获取map的比例尺的位置 - Future getMapScaleBarPositionDispatch( - MethodChannel _mapChannel) async { - if (_mapChannel == null) { - return null; - } - BMFPoint mapScaleBarPosition; - try { - Map result = await _mapChannel.invokeMethod( - BMFMapGetPropertyMethodId.kMapGetMapScaleBarPositionMethod); - if (null == result) { - return null; - } - mapScaleBarPosition = - BMFPoint.point().fromMap(result['mapScaleBarPosition']) as BMFPoint; - } on PlatformException catch (e) { - print(e.toString()); - } - return mapScaleBarPosition; - } - - /// 获取map的logo位置 - Future getLogoPositionDispatch( - MethodChannel _mapChannel) async { - if (_mapChannel == null) { - return null; - } - BMFLogoPosition logoPosition; - try { - Map result = await _mapChannel - .invokeMethod(BMFMapGetPropertyMethodId.kMapGetLogoPositionMethod); - if (null == result) { - return null; - } - logoPosition = BMFLogoPosition.values[result['logoPosition'] as int]; - } on PlatformException catch (e) { - print(e.toString()); - } - return logoPosition; - } - - /// 获取map的可视范围 - Future getVisibleMapBoundsDispatch( - MethodChannel _mapChannel) async { - if (_mapChannel == null) { - return null; - } - BMFCoordinateBounds visibleMapBounds; - try { - Map result = await _mapChannel.invokeMethod( - BMFMapGetPropertyMethodId.kMapGetVisibleMapBoundsMethod); - visibleMapBounds = BMFCoordinateBounds.coordinateBounds() - .fromMap(result['visibleMapBounds']) as BMFCoordinateBounds; - } on PlatformException catch (e) { - print(e.toString()); - } - return visibleMapBounds; - } - - /// 获取map的显示室内图 - Future getBaseIndoorMapEnabledDispatch( - MethodChannel _mapChannel) async { - if (_mapChannel == null) { - return null; - } - bool baseIndoorMapEnabled; - try { - Map result = await _mapChannel.invokeMethod( - BMFMapGetPropertyMethodId.kMapGetBaseIndoorMapEnabledMethod); - baseIndoorMapEnabled = result['baseIndoorMapEnabled'] as bool; - } on PlatformException catch (e) { - print(e.toString()); - } - return baseIndoorMapEnabled; - } - - /// 获取map的室内图标注是否显示 - /// - /// ios 独有 - Future getShowIndoorMapPoiDispatch(MethodChannel _mapChannel) async { - if (_mapChannel == null) { - return null; - } - bool showIndoorMapPoi; - try { - Map result = await _mapChannel.invokeMethod( - BMFMapGetPropertyMethodId.kMapGetShowIndoorMapPoiMethod); - showIndoorMapPoi = result['showIndoorMapPoi'] as bool; - } on PlatformException catch (e) { - print(e.toString()); - } - return showIndoorMapPoi; - } -} diff --git a/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/private/mapdispatcher/bmf_map_method_id.dart b/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/private/mapdispatcher/bmf_map_method_id.dart deleted file mode 100644 index 36d13af..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/private/mapdispatcher/bmf_map_method_id.dart +++ /dev/null @@ -1,469 +0,0 @@ -/// 用于methodChannel合native的方法id约定 - -/// 地图状态方法ID集合 -class BMFMapStateMethodId { - /// 更新地图参数 - static const kMapUpdateMethod = 'flutter_bmfmap/map/updateMapOptions'; - - /// map放大一级比例尺 - static const kMapZoomInMethod = 'flutter_bmfmap/map/zoomIn'; - - /// map缩小一级比例尺 - static const kMapZoomOutMethod = 'flutter_bmfmap/map/zoomOut'; - - /// 设置路况颜色 - static const kMapSetCustomTrafficColorMethod = - 'flutter_bmfmap/map/setCustomTrafficColor'; - - /// 更新地图状态 - static const kMapSetMapStatusMethod = 'flutter_bmfmap/map/setMapStatus'; - - /// 获取地图状态 - static const kMapGetMapStatusMethod = 'flutter_bmfmap/map/getMapStatus'; - - /// 按像素移动地图中心点 - static const kMapSetScrollByMethod = 'flutter_bmfmap/map/setScrollBy'; - - /// 根据给定增量缩放地图级别 - static const kMapSetZoomByMethod = 'flutter_bmfmap/map/setZoomBy'; - - /// 设置地图缩放级别 - static const kMapSetZoomToMethod = 'flutter_bmfmap/map/setZoomTo'; - - /// 根据给定增量以及给定的屏幕坐标缩放地图级别 - static const kMapSetZoomPointByMethod = 'flutter_bmfmap/map/setZoomPointBy'; - - /// 设定地图中心点坐标 - static const kMapSetCenterCoordinateMethod = - 'flutter_bmfmap/map/setCenterCoordinate'; - - /// 设置地图中心点以及缩放级别 - static const kMapSetCenterZoomMethod = 'flutter_bmfmap/map/setMapCenterZoom'; - - /// 获得地图当前可视区域截图 - static const kMapTakeSnapshotMethod = 'flutter_bmfmap/map/takeSnapshot'; - - /// 获得地图指定区域截图 - static const kMapTakeSnapshotWithRectMethod = - 'flutter_bmfmap/map/takeSnapshotWithRect'; - - /// 设置罗盘的图片 - static const kMapSetCompassImageMethod = 'flutter_bmfmap/map/setCompassImage'; - - /// 设置显示在屏幕中的地图地理范围 - static const kMapSetVisibleMapBoundsMethod = - 'flutter_bmfmap/map/setVisibleMapBounds'; - - /// 设定地图的显示范围,并使mapRect四周保留insets指定的边界区域 - static const kMapSetVisibleMapBoundsWithPaddingMethod = - 'flutter_bmfmap/map/setVisibleMapBoundsWithPadding'; -} - -/// 地图获取属性方法id集合 -class BMFMapGetPropertyMethodId { - /// 获取map的展示类型 - static const kMapGetMapTypeMethod = 'flutter_bmfmap/map/getMapType'; - - /// 获取map的比例尺级别 - static const kMapGetZoomLevelMethod = 'flutter_bmfmap/map/getZoomLevel'; - - /// 获取map的自定义最小比例尺级别 - static const kMapGetMinZoomLevelMethod = 'flutter_bmfmap/map/getMinZoomLevel'; - - /// 获取map的自定义最大比例尺级别 - static const kMapGetMaxZoomLevelMethod = 'flutter_bmfmap/map/getMaxZoomLevel'; - - /// 获取map的旋转角度 - static const kMapGetRotationMethod = 'flutter_bmfmap/map/getRotation'; - - /// 获取map的地图俯视角度 - static const kMapGetOverlookingMethod = 'flutter_bmfmap/map/getOverlooking'; - - /// 获取map的俯视角度最小值 - static const kMapGetMinOverlookingMethod = - 'flutter_bmfmap/map/getMinOverlooking'; - - /// 获取map的是否现显示3D楼块效果 - static const kMapGetBuildingsEnabledMethod = - 'flutter_bmfmap/map/getBuildingsEnabled'; - - /// 获取map的是否显示底图poi标注 - static const kMapGetShowMapPoiMethod = 'flutter_bmfmap/map/getShowMapPoi'; - - /// 获取map的是否打开路况图层 - static const kMapGetTrafficEnabledMethod = - 'flutter_bmfmap/map/getTrafficEnabled'; - - /// 获取map的是否打开百度城市热力图图层 - static const kMapGetBaiduHeatMapEnabledMethod = - 'flutter_bmfmap/map/getBaiduHeatMapEnabled'; - - /// 获取map的是否支持所有手势操作 - static const kMapGetGesturesEnabledMethod = - 'flutter_bmfmap/map/getGesturesEnabled'; - - /// 获取map的是否支持用户多点缩放(双指) - static const kMapGetZoomEnabledMethod = 'flutter_bmfmap/map/getZoomEnabled'; - - /// 获取map的是否支持用户缩放(双击或双指单击) - static const kMapGetZoomEnabledWithTapMethod = - 'flutter_bmfmap/map/getZoomEnabledWithTap'; - - /// 获取map的是否支持用户移动地图 - static const kMapGetScrollEnabledMethod = - 'flutter_bmfmap/map/getScrollEnabled'; - - /// 获取map的是否支持俯仰角 - static const kMapGetOverlookEnabledMethod = - 'flutter_bmfmap/map/getOverlookEnabled'; - - /// 获取map的是否支持旋转 - static const kMapGetRotateEnabledMethod = - 'flutter_bmfmap/map/getRotateEnabled'; - - /// 获取map的是否支持3Dtouch - static const kMapGetForceTouchEnabledMethod = - 'flutter_bmfmap/map/getForceTouchEnabled'; - - /// 获取map的是否显式比例尺 - static const kMapGetShowMapScaleBarMethod = - 'flutter_bmfmap/map/getShowMapScaleBar'; - - /// 获取map的比例尺的位置 - static const kMapGetMapScaleBarPositionMethod = - 'flutter_bmfmap/map/getMapScaleBarPosition'; - - /// 获取map的logo位置 - static const kMapGetLogoPositionMethod = 'flutter_bmfmap/map/getLogoPosition'; - - /// 获取map的可视范围 - static const kMapGetVisibleMapBoundsMethod = - 'flutter_bmfmap/map/getVisibleMapBounds'; - - /// 获取map的显示室内图 - static const kMapGetBaseIndoorMapEnabledMethod = - 'flutter_bmfmap/map/getBaseIndoorMapEnabled'; - - /// 获取map的室内图标注是否显示 - static const kMapGetShowIndoorMapPoiMethod = - 'flutter_bmfmap/map/getShowIndoorMapPoi'; -} - -/// 地图代理回调方法ID集合 -class BMFMapCallbackMethodId { - /// map加载完成 - static const kMapDidLoadCallback = 'flutter_bmfmap/map/mapViewDidFinishLoad'; - - /// map渲染完成 - static const kMapDidFinishRenderCallback = - 'flutter_bmfmap/map/mapViewDidFinishRender'; - - /// 地图渲染每一帧画面过程中,以及每次需要重绘地图时(例如添加覆盖物)都会调用此接口 - static const kMapOnDrawMapFrameCallback = - 'flutter_bmfmap/map/mapViewOnDrawMapFrame'; - - /// 地图区域即将改变时会调用此接口 - static const kMapRegionWillChangeCallback = - 'flutter_bmfmap/map/mapViewRegionWillChange'; - - /// 地图区域即将改变时会调用此接口reason - static const kMapRegionWillChangeWithReasonCallback = - 'flutter_bmfmap/map/mapViewRegionWillChangeWithReason'; - - /// 地图区域改变完成后会调用此接口 - static const kMapRegionDidChangeCallback = - 'flutter_bmfmap/map/mapViewRegionDidChange'; - - /// 地图区域改变完成后会调用此接口reason - static const kMapRegionDidChangeWithReasonCallback = - 'flutter_bmfmap/map/mapViewRegionDidChangeWithReason'; - - /// 点中底图标注后会回调此接口 - static const kMapOnClickedMapPoiCallback = - 'flutter_bmfmap/map/mapViewonClickedMapPoi'; - - /// 点中底图空白处会回调此接口 - static const kMapOnClickedMapBlankCallback = - 'flutter_bmfmap/map/mapViewOnClickedMapBlank'; - - /// 双击地图时会回调此接口 - static const kMapOnDoubleClickCallback = - 'flutter_bmfmap/map/mapViewOnDoubleClick'; - - /// 长按地图时会回调此接口 - static const kMapOnLongClickCallback = - 'flutter_bmfmap/map/mapViewOnLongClick'; - - /// 3DTouch 按地图时会回调此接口 - ///(仅在支持3D Touch,且fouchTouchEnabled属性为true时,会回调此接口) - static const kMapOnForceTouchCallback = - 'flutter_bmfmap/map/mapViewOnForceTouch'; - - /// 地图状态改变完成后会调用此接口 - static const kMapStatusDidChangedCallback = - 'flutter_bmfmap/map/mapViewStatusDidChanged'; - - /// 地图View进入/移出室内图 - static const kMapInOrOutBaseIndoorMapCallback = - 'flutter_bmfmap/map/mapViewInOrOutBaseIndoorMap'; - - /// 地图绘制出有效数据的监听 - static const kMapRenderValidDataCallback = - 'flutter_bmfmap/map/mapRenderValidDataCallback'; -} - -/// 个性化地图方法ID集合 -class BMFCustomMapStyleMethodId { - /// 开启个性化地图 - static const kSetCustomMapStyleEnableMethod = - 'flutter_bmfmap/map/setCustomMapStyleEnable'; - - /// 设置个性化地图样式路径 - static const kSetCustomMapStylePathMethod = - 'flutter_bmfmap/map/setCustomMapStylePath'; - - /// 在线个性化样式加载状态回调接口 - static const kSetCustomMapStyleWithOptionMethod = - 'flutter_bmfmap/map/setCustomMapStyleWithOption'; -} - -/// 室内地图方法ID集合 -class BMFBaseIndoorMapMethodId { - /// 展示室内地图 - static const kShowBaseIndoorMapMethod = - 'flutter_bmfmap/map/showBaseIndoorMap'; - - /// 室内图标注是否显示 - static const kShowBaseIndoorMapPoiMethod = - 'flutter_bmfmap/map/showBaseIndoorMapPoi'; - - /// 设置室内图楼层 - static const kSwitchBaseIndoorMapFloorMethod = - 'flutter_bmfmap/map/switchBaseIndoorMapFloor'; - - /// 获取当前聚焦的室内图信息 - static const kGetFocusedBaseIndoorMapInfo = - 'flutter_bmfmap/map/getFocusedBaseIndoorMapInfo'; -} - -/// marker方法ID集合 -class BMFMarkerMethodId { - /// 添加marker - static const kMapAddMarkerMethod = 'flutter_bmfmap/marker/addMarker'; - - /// 添加markers - static const kMapAddMarkersMethod = 'flutter_bmfmap/marker/addMarkers'; - - /// 删除marker - static const kMapRemoveMarkerMethod = 'flutter_bmfmap/marker/removeMarker'; - - /// 删除markers - static const kMapRemoveMarkersMethod = 'flutter_bmfmap/marker/removeMarkers'; - - /// 清除所有的markers - static const kMapCleanAllMarkersMethod = - 'flutter_bmfmap/marker/cleanAllMarkers'; - - /// 更新marker属性 - static const kMapUpdateMarkerMember = - 'flutter_bmfmap/marker/updateMarkerMember'; -} - -/// marker事件回调方法ID集合 -class BMFMarkerCallbackMethodId { - /// marker点击回调 - static const kMapClickedmarkedCallback = - 'flutter_bmfmap/marker/clickedMarker'; - - /// marker选中回调 - static const kMapDidSelectMarkerCallback = - 'flutter_bmfmap/marker/didSelectedMarker'; - - /// marker点击回调 - static const kMapDidDeselectMarkerCallback = - 'flutter_bmfmap/marker/didDeselectMarker'; - - /// marker拖拽回调 - static const kMapDragMarkerCallback = 'flutter_bmfmap/marker/dragMarker'; -} - -/// infoWindow方法ID集合 -class BMFInfoWindowMethodId { - /// marker的infoWindow(iOS paopaoView)点击回调 - static const kMapDidClickedInfoWindowMethod = - 'flutter_bmfmap/map/didClickedInfoWindow'; - - /// 添加infoWindow - static const kMapAddInfoWindowMethod = 'flutter_bmfmap/map/addInfoWindow'; - - /// 批量添加infoWindow - static const kMapAddInfoWindowsMethod = 'flutter_bmfmap/map/addInfoWindows'; - - /// 删除infoWindow - static const kMapRemoveInfoWindowMethod = - 'flutter_bmfmap/map/removeInfoWindow'; - - /// 清除所有的infowWindow - static const kMapCleanAllInfoWindowsMethod = - 'flutter_bmfmap/map/cleanAllInfoWindows'; -} - -/// overlay方法id集合 -class BMFOverlayMethodId { - /// 添加polyline - static const kMapAddPolylineMethod = 'flutter_bmfmap/overlay/addPolyline'; - - /// 添加arcline - static const kMapAddArclinelineMethod = 'flutter_bmfmap/overlay/addArcline'; - - /// 添加polygon - static const kMapAddPolygonMethod = 'flutter_bmfmap/overlay/addPolygon'; - - /// 添加circle - static const kMapAddCircleMethod = 'flutter_bmfmap/overlay/addCircle'; - - /// 添加dot - static const kMapAddDotMethod = 'flutter_bmfmap/overlay/addDot'; - - /// 添加dot - static const kMapAddTextMethod = 'flutter_bmfmap/overlay/addText'; - - /// 添加ground - static const kMapAddGroundMethod = 'flutter_bmfmap/overlay/addGround'; - - /// 添加tile - static const kMapAddTileMethod = 'flutter_bmfmap/overlay/addTile'; - - /// 删除tile - static const kMapRemoveTileMethod = 'flutter_bmfmap/overlay/removeTile'; - - /// 删除overlay - static const kMapRemoveOverlayMethod = 'flutter_bmfmap/overlay/removeOverlay'; - - /// 更新overlay属性 - // static const kMapUpdateOverlayMemberMethod = 'flutter_bmfmap/overlay/updateOverlayMember'; - /// 更新polyline属性 - static const kMapUpdatePolylineMemberMethod = - 'flutter_bmfmap/overlay/updatePolylineMember'; -} - -/// overlay回调方法id集合 -class BMFOverlayCallbackMethodId { - /// 当mapView新添加overlay 时,调用此接口 - static const kMapDidAddOverlayCallback = - 'flutter_bmfmap/overlay/didAddOverlay'; - - /// 点中覆盖物后会回调此接口,目前只支持点中Polyline时回调 - static const kMapOnClickedOverlayCallback = - 'flutter_bmfmap/overlay/onClickedOverlay'; -} - -/// 定位图层集合 -class BMFUserlocationMethodId { - /// 设定是否显示定位图层 - static const kMapShowUserLocationMethod = - 'flutter_bmfmap/userLocation/showUserLocation'; - - /// 设定定位模式,取值为:BMFUserTrackingMode - static const kMapUserTrackingModeMethod = - 'flutter_bmfmap/userLocation/userTrackingMode'; - - /// 返回定位坐标点是否在当前地图可视区域内 - static const kMapIsUserLocationVisibleMethod = - 'flutter_bmfmap/userLocation/isUserLocationVisible'; - - /// 动态定制我的位置样式 - static const kMapUpdateLocationDisplayParamMethod = - 'flutter_bmfmap/userLocation/updateLocationDisplayParam'; - - /// 动态更新我的位置数据 - static const kMapUpdateLocationDataMethod = - 'flutter_bmfmap/userLocation/updateLocationData'; -} - -/// 离线地图方法id集合 -class BMFOfflineMethodId { - /// 初使化 - static const kMapInitOfflineMethod = - 'flutter_bmfmap/offlineMap/initOfflineMap'; - - /// 状态回调 - static const kMapOfflineCallBackMethod = - 'flutter_bmfmap/offlineMap/offlineCallBack'; - - /// 启动下载指定城市ID的离线地图,或在暂停更新某城市后继续更新下载某城市离线地图 - static const kMapStartOfflineMethod = - 'flutter_bmfmap/offlineMap/startOfflineMap'; - - /// 启动更新指定城市ID的离线地图 - static const kMapUpdateOfflineMethod = - 'flutter_bmfmap/offlineMap/updateOfflineMap'; - - /// 暂停下载或更新指定城市ID的离线地图 - static const kMapPauseOfflineMethod = - 'flutter_bmfmap/offlineMap/pauseOfflineMap'; - - /// 删除指定城市ID的离线地图 - static const kMapRemoveOfflineMethod = - 'flutter_bmfmap/offlineMap/removeOfflineMap'; - - /// 销毁离线地图管理模块,不用时调用 - static const kMapDestroyOfflineMethod = - 'flutter_bmfmap/offlineMap/destroyOfflineMap'; - - /// 返回热门城市列表 - static const kMapGetHotCityListMethod = - 'flutter_bmfmap/offlineMap/getHotCityList'; - - /// 返回支持离线地图城市列表 - static const kMapGetOfflineCityListMethod = - 'flutter_bmfmap/offlineMap/getOfflineCityList'; - - /// 根据城市名搜索该城市离线地图记录 - static const kMapSearchCityMethod = - 'flutter_bmfmap/offlineMap/searchCityList'; - - /// 返回各城市离线地图更新信息 - static const kMapGetAllUpdateInfoMethod = - 'flutter_bmfmap/offlineMap/getAllUpdateInfo'; - - /// 返回指定城市ID离线地图更新信息 - static const kMapGetUpdateInfoMethod = - 'flutter_bmfmap/offlineMap/getUpdateInfo'; -} - -/// 热力图地图方法ID集合 -class BMFHeapMapMethodId { - /// 添加热力图 - static const kAddMapMethod = 'flutter_bmfmap/heatMap/addHeatMap'; - - /// 删除热力图 - static const kRemoveHeatMapMethod = 'flutter_bmfmap/heatMap/removeHeatMap'; - - /// 是否展示热力图 - static const kShowHeatMapMethod = 'flutter_bmfmap/heatMap/showHeatMap'; -} - -/// 数据转换方法Id集合 -class BMFProjectionMethodId { - /// 屏幕坐标转地理坐标 - static const kCoordinateFromScreenPointMethod = - 'flutter_bmfmap/projection/screenPointfromCoordinate'; - - /// 将地理坐标转换成屏幕坐标 - static const kScreenPointFromCoordinateMethod = - 'flutter_bmfmap/projection/coordinateFromScreenPoint'; - - /// 米为计量单位的距离(沿赤道)在当前缩放水平下转换到一个以像素(水平)为计量单位的距离 - static const kMetersToEquatorPixels = - 'flutter_bmfmap/projection/metersToEquatorPixels'; -} - -/// MapWidget 状态更新方法Id集合 -class BMFMapWidgetMethodId { - /// widget 状态更新 - static const kMapDidUpdateWidget = 'flutter_bmfmap/map/didUpdateWidget'; - - /// widget 热重载 - static const kMapReassemble = 'flutter_bmfmap/map/reassemble'; -} diff --git a/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/private/mapdispatcher/bmf_map_state_dispacther.dart b/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/private/mapdispatcher/bmf_map_state_dispacther.dart deleted file mode 100644 index a4a4153..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/private/mapdispatcher/bmf_map_state_dispacther.dart +++ /dev/null @@ -1,591 +0,0 @@ -import 'dart:typed_data'; -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; -import 'package:flutter_bmfbase/BaiduMap/bmfmap_base.dart'; -import 'package:flutter_bmfmap/BaiduMap/models/bmf_baseindoormap_info.dart'; -import 'package:flutter_bmfmap/BaiduMap/models/bmf_custommap_option.dart'; -import 'package:flutter_bmfmap/BaiduMap/models/bmf_heatmap.dart'; -import 'package:flutter_bmfmap/BaiduMap/models/bmf_map_options.dart'; -import 'package:flutter_bmfmap/BaiduMap/models/bmf_mapstatus.dart'; - -import 'bmf_map_method_id.dart'; - -class BMFMapStateDispatcher { - static const _tag = 'BMFMapStateDispatcher'; - - /// 更新地图属性 - Future updateMapOptionsDispatch( - MethodChannel _mapChannel, BMFMapOptions change) async { - if (change == null || _mapChannel == null) { - return false; - } - bool result = false; - try { - result = (await _mapChannel.invokeMethod( - BMFMapStateMethodId.kMapUpdateMethod, change.toMap() as dynamic)) - as bool; - } on PlatformException catch (e) { - print(e.toString()); - } - return result; - } - - /// map放大一级比例尺 - Future zoomInDispatch(MethodChannel _mapChannel) async { - if (_mapChannel == null) { - return false; - } - bool result = false; - try { - result = (await _mapChannel - .invokeMethod(BMFMapStateMethodId.kMapZoomInMethod)) as bool; - } on PlatformException catch (e) { - print(e.toString()); - } - return result; - } - - /// map缩小一级比例尺 - Future zoomOutDispatch(MethodChannel _mapChannel) async { - if (_mapChannel == null) { - return false; - } - bool result = false; - try { - result = (await _mapChannel - .invokeMethod(BMFMapStateMethodId.kMapZoomOutMethod)) as bool; - } on PlatformException catch (e) { - print(e.toString()); - } - return result; - } - - /// 自定义路况颜色。 - /// - /// 注意:如果需要自定义路况颜色,必须4种路况全都设置。4个参数全部合法时,自定义颜色才有效;否则全部使用默认的。 - /// smooth 路况畅通对应的颜色 - /// slow 路况缓行对应的颜色 - /// congestion 路况拥堵对应的颜色 - /// severeCongestion 路况严重拥堵对应的颜色 - Future setCustomTrafficColorDispatch( - MethodChannel _mapChannel, - Color smooth, - Color slow, - Color congestion, - Color severeCongestion) async { - if (_mapChannel == null || - smooth == null || - slow == null || - congestion == null || - severeCongestion == null) { - return false; - } - bool result = false; - try { - Map colorMap = { - 'smooth': smooth.value?.toRadixString(16), - 'slow': slow.value?.toRadixString(16), - 'congestion': congestion.value?.toRadixString(16), - 'severeCongestion': severeCongestion.value?.toRadixString(16) - }; - result = (await _mapChannel.invokeMethod( - BMFMapStateMethodId.kMapSetCustomTrafficColorMethod, - colorMap as dynamic)) as bool; - } on PlatformException catch (e) { - print(e.toString()); - } - return result; - } - - /// 更新地图新状态 - /// - /// mapStatus 地图新状态 - /// animateDurationMs 动画更新时间 - /// - /// (注意:animateDurationMs该字段仅对android生效,若animateDurationMs !=0 ,iOS则启动默认动画设置mapStatus,反之不开启动画设置mapStatus) - Future setNewMapStatusDispatch(MethodChannel _mapChannel, - {@required BMFMapStatus mapStatus, int animateDurationMs}) async { - if (_mapChannel == null || mapStatus == null) { - return false; - } - bool result = false; - try { - result = (await _mapChannel.invokeMethod( - BMFMapStateMethodId.kMapSetMapStatusMethod, - { - 'mapStatus': mapStatus.toMap(), - 'animateDurationMs': animateDurationMs - } as dynamic)) as bool; - } on PlatformException catch (e) { - print(e.toString()); - } - return result; - } - - /// 获取地图新状态 - Future getMapStatusDispatch(MethodChannel _mapChannel) async { - if (_mapChannel == null) { - return null; - } - dynamic result; - try { - result = await _mapChannel - .invokeMethod(BMFMapStateMethodId.kMapGetMapStatusMethod); - } on PlatformException catch (e) { - print(e.toString()); - } - - BMFMapStatus mapStatus; - if (null != result) { - mapStatus = BMFMapStatus.mapStatus().fromMap(result['mapStatus']); - } - return mapStatus; - } - - /// 按像素移动地图中心点 - /// - /// xPixel 水平方向移动像素数 - /// yPixel 垂直方向移动像素数 - /// animateDurationMs 动画更新时间 - Future setScrollByDispatch( - MethodChannel _mapChannel, int xPixel, int yPixel, - {int animateDurationMs}) async { - if (_mapChannel == null || xPixel == null || yPixel == null) { - return false; - } - bool result = false; - try { - result = (await _mapChannel.invokeMethod( - BMFMapStateMethodId.kMapSetScrollByMethod, - { - 'xPixel': xPixel, - 'yPixel': yPixel, - 'animateDurationMs': animateDurationMs - } as dynamic)) as bool; - } on PlatformException catch (e) { - print(e.toString()); - } - return result; - } - - /// 根据定增量缩放给地图级别 - /// - /// amount 地图缩放级别增量 - /// animateDurationMs 动画更新时间 - Future setZoomByDispatch(MethodChannel _mapChannel, double amount, - {int animateDurationMs}) async { - if (_mapChannel == null || amount == null) { - return false; - } - bool result = false; - try { - result = (await _mapChannel.invokeMethod( - BMFMapStateMethodId.kMapSetZoomByMethod, - {'amount': amount, 'animateDurationMs': animateDurationMs} - as dynamic)) as bool; - } on PlatformException catch (e) { - print(e.toString()); - } - return result; - } - - /// 设置地图缩放级别 - /// - /// zoom 设置地图缩放级别 - /// animateDurationMs 动画更新时间 - Future setZoomToDispatch(MethodChannel _mapChannel, double zoom, - {int animateDurationMs}) async { - if (_mapChannel == null || zoom == null) { - return false; - } - bool result = false; - try { - result = (await _mapChannel.invokeMethod( - BMFMapStateMethodId.kMapSetZoomToMethod, - {'zoom': zoom, 'animateDurationMs': animateDurationMs} - as dynamic)) as bool; - } on PlatformException catch (e) { - print(e.toString()); - } - return result; - } - - /// 根据给定增量以及给定的屏幕坐标缩放地图级别 - /// - /// amount 地图缩放级别增量 - /// focus 地图缩放中心点屏幕坐标, 若为 null 则返回 null - /// animateDurationMs 动画更新时间 - Future setZoomPointByDispatch( - MethodChannel _mapChannel, double amount, BMFPoint focus, - {int animateDurationMs}) async { - if (_mapChannel == null || amount == null || focus == null) { - return false; - } - bool result = false; - try { - result = (await _mapChannel.invokeMethod( - BMFMapStateMethodId.kMapSetZoomByMethod, - { - 'amount': amount, - 'focus': focus.toMap(), - 'animateDurationMs': animateDurationMs - } as dynamic)) as bool; - } on PlatformException catch (e) { - print(e.toString()); - } - return result; - } - - /// 设定地图中心点坐标 - /// - /// coordinate 要设定的地图中心点坐标,用经纬度表示 - /// animated 是否采用动画效果 - /// animateDurationMs 动画更新时间[android]支持 - Future setCenterCoordinateDispatch( - MethodChannel _mapChannel, BMFCoordinate coordinate, bool animated, - {int animateDurationMs}) async { - if (_mapChannel == null || coordinate == null || animated == null) { - return false; - } - bool result = false; - try { - result = (await _mapChannel.invokeMethod( - BMFMapStateMethodId.kMapSetCenterCoordinateMethod, - { - 'coordinate': coordinate.toMap(), - 'animated': animated, - 'animateDurationMs': animateDurationMs - } as dynamic)) as bool; - } on PlatformException catch (e) { - print(e.toString()); - } - return result; - } - - /// [Android]设置地图中心点以及缩放级别 - /// - /// coordinate 要设定的地图中心点坐标,用经纬度表示 - /// zoom 缩放级别 - /// animateDurationMs 动画时间 - Future setNewLatLngZoomDispatcher(MethodChannel _mapChannel, - {@required BMFCoordinate coordinate, - @required double zoom, - int animateDurationMs}) async { - if (_mapChannel == null || coordinate == null || zoom == null) { - return false; - } - bool result = false; - try { - result = (await _mapChannel.invokeMethod( - BMFMapStateMethodId.kMapSetCenterZoomMethod, - { - 'coordinate': coordinate.toMap(), - 'zoom': zoom, - 'animateDurationMs': animateDurationMs - } as dynamic)) as bool; - } on PlatformException catch (e) { - print(e.toString()); - } - return result; - } - - /// 获得地图当前可视区域截图 - /// - /// 范围内的截取的Images - Future takeSnapshotDispatch(MethodChannel _mapChannel) async { - if (_mapChannel == null) { - return null; - } - List result; - try { - result = (await _mapChannel.invokeMethod( - BMFMapStateMethodId.kMapTakeSnapshotMethod)) as List; - } on PlatformException catch (e) { - print(e.toString()); - } - return Uint8List.fromList(result?.map((i) => i as int)?.toList()); - } - - /// 获得地图指定区域截图 - /// - /// 指定区域的截取的Image - Future takeSnapshotWithRectDispatch( - MethodChannel _mapChannel, BMFMapRect rect) async { - if (_mapChannel == null || rect == null) { - return null; - } - List result; - try { - result = (await _mapChannel.invokeMethod( - BMFMapStateMethodId.kMapTakeSnapshotWithRectMethod, - {'rect': rect.toMap()})) as List; - } on PlatformException catch (e) { - print(e.toString()); - } - return Uint8List.fromList(result?.map((i) => i as int)?.toList()); - } - - /// 设置罗盘的图片 - Future setCompassImageDispatch( - MethodChannel _mapChannel, String imagePath) async { - if (_mapChannel == null || imagePath == null) { - return false; - } - bool result = false; - try { - result = (await _mapChannel.invokeMethod( - BMFMapStateMethodId.kMapSetCompassImageMethod, - {'imagePath': imagePath} as dynamic)) as bool; - } on PlatformException catch (e) { - print(e.toString()); - } - return result; - } - - /// 设置显示在屏幕中的地图地理范围 - /// - /// coordinateBounds 要设定的地图范围(东北,西南)角坐标 - /// animated 是否采用动画效果 - Future setVisibleMapBoundsDispatch(MethodChannel _mapChannel, - BMFCoordinateBounds visibleMapBounds, bool animated) async { - if (_mapChannel == null || visibleMapBounds == null || animated == null) { - return false; - } - bool result = false; - try { - result = (await _mapChannel.invokeMethod( - BMFMapStateMethodId.kMapSetVisibleMapBoundsMethod, - {'visibleMapBounds': visibleMapBounds.toMap(), 'animated': animated} - as dynamic)) as bool; - } on PlatformException catch (e) { - print(e.toString()); - } - return result; - } - - /// 设置显示在指定相对于MapView的padding中的地图地理范围 - /// - /// visibleMapBounds 要设定的地图范围(东北,西南)角坐标 - /// insets 指定的四周边界大小 - /// animated 是否采用动画效果 - Future setVisibleMapRectWithPaddingDispatch( - MethodChannel _mapChannel, - BMFCoordinateBounds visibleMapBounds, - EdgeInsets insets, - bool animated) async { - if (_mapChannel == null || - visibleMapBounds == null || - insets == null || - animated == null) { - return false; - } - - bool result = false; - try { - result = (await _mapChannel.invokeMethod( - BMFMapStateMethodId.kMapSetVisibleMapBoundsWithPaddingMethod, - { - 'visibleMapBounds': visibleMapBounds.toMap(), - 'insets': - BMFEdgeInsets.edgeInsets().fromEdgeInsets(insets)?.toMap(), - 'animated': animated - } as dynamic)) as bool; - } on PlatformException catch (e) { - print(e.toString()); - } - return result; - } - - /// 添加热力图 - Future addHeatMapDispatch( - MethodChannel _mapChannel, BMFHeatMap heapMap) async { - if (heapMap == null || _mapChannel == null) { - return false; - } - bool result = false; - try { - result = (await _mapChannel.invokeMethod(BMFHeapMapMethodId.kAddMapMethod, - {'heatMap': heapMap?.toMap()} as dynamic)) as bool; - } on PlatformException catch (e) { - BMFLog.e(e.toString(), tag: _tag); - } - return result; - } - - /// 删除热力图 - Future removeHeatMapDispatch(MethodChannel _mapChannel) async { - if (_mapChannel == null) { - return false; - } - bool result = false; - try { - result = (await _mapChannel - .invokeMethod(BMFHeapMapMethodId.kRemoveHeatMapMethod) as bool); - } on PlatformException catch (e) { - BMFLog.e(e.toString(), tag: _tag); - } - return result; - } - - /// 是否展示热力图 - Future showHeatMapDispatch(MethodChannel _mapChannel, bool show) async { - if (show == null || _mapChannel == null) { - return false; - } - bool result = false; - try { - result = (await _mapChannel.invokeMethod( - BMFHeapMapMethodId.kShowHeatMapMethod, {'show': show} as dynamic)) - as bool; - } on PlatformException catch (e) { - BMFLog.e(e.toString(), tag: _tag); - } - return result; - } - - /// 是否展示室内地图 - Future showBaseIndoorMapDispatch( - MethodChannel _mapChannel, bool show) async { - if (show == null || _mapChannel == null) { - return false; - } - bool result = false; - try { - result = (await _mapChannel.invokeMethod( - BMFBaseIndoorMapMethodId.kShowBaseIndoorMapMethod, - {'show': show} as dynamic)) as bool; - } on PlatformException catch (e) { - print(e.toString()); - } - return result; - } - - /// 室内图标注是否显示 - Future showBaseIndoorMapPoiDispatch( - MethodChannel _mapChannel, bool showPoi) async { - if (showPoi == null || _mapChannel == null) { - return false; - } - bool result = false; - try { - result = (await _mapChannel.invokeMethod( - BMFBaseIndoorMapMethodId.kShowBaseIndoorMapPoiMethod, - {'showIndoorPoi': showPoi} as dynamic)) as bool; - } on PlatformException catch (e) { - print(e.toString()); - } - return result; - } - - /// 设置室内图楼层 - /// - /// floorId 楼层id - /// indoorId 室内图ID - Future switchBaseIndoorMapFloorDispatch( - MethodChannel _mapChannel, String floorId, String indoorId) async { - if (floorId == null || indoorId == null || _mapChannel == null) { - return BMFSwitchIndoorFloorError.Failed; - } - BMFSwitchIndoorFloorError result; - try { - Map map = (await _mapChannel.invokeMethod( - BMFBaseIndoorMapMethodId.kSwitchBaseIndoorMapFloorMethod, - {'floorId': floorId, 'indoorId': indoorId} as dynamic)) as Map; - result = BMFSwitchIndoorFloorError.values[map['result'] as int]; - } on PlatformException catch (e) { - print(e.toString()); - } - return result; - } - - /// 获取当前聚焦的室内图信息 - /// - /// 当前聚焦的室内图信息。没有聚焦的室内图,返回nil - Future getFocusedBaseIndoorMapInfoDispatch( - MethodChannel _mapChannel) async { - if (_mapChannel == null) { - return null; - } - BMFBaseIndoorMapInfo result; - try { - Map map = (await _mapChannel.invokeMethod( - BMFBaseIndoorMapMethodId.kGetFocusedBaseIndoorMapInfo)) as Map; - result = BMFBaseIndoorMapInfo.baseIndoorMapInfo().fromMap(map); - } on PlatformException catch (e) { - print(e.toString()); - } - - return result; - } - - /// 个性化地图样式开关,仅影响当前mapView对象,需���对象创建后调用 - /// - /// enable 当前自定义地图样式是否生效 - Future setCustomMapStyleEnableDispatch( - MethodChannel _mapChannel, bool enable) async { - if (_mapChannel == null) { - return false; - } - bool result = false; - try { - result = (await _mapChannel.invokeMethod( - BMFCustomMapStyleMethodId.kSetCustomMapStyleEnableMethod, - {'enable': enable} as dynamic)) as bool; - } on PlatformException catch (e) { - print(e.toString()); - } - return result; - } - - /// 设置个性化地图样式路径,仅影响当前mapView对象,需在���象创建后调用 - /// customMapStyleJsonFilePath 本地个性化样式文件所在路径,包含文件名 - /// mode 加载模式,0:加载本地文件 1:加载在线文件或在线缓存文件 - Future setCustomMapStylePathDispatch( - MethodChannel _mapChannel, String path, int mode) async { - if (_mapChannel == null) { - return false; - } - bool result = false; - try { - result = (await _mapChannel.invokeMethod( - BMFCustomMapStyleMethodId.kSetCustomMapStylePathMethod, - {'path': path, 'mode': mode} as dynamic)) as bool; - } on PlatformException catch (e) { - print(e.toString()); - } - return result; - } - - /// 在线个性化样式加载接口。 - /// option 在线个性化样式配置选项 - Future setCustomMapStyleWithOptionDispatch( - MethodChannel _mapChannel, - BMFCustomMapStyleOption customMapStyleOption, - void Function(String path) preload, - void Function(String path) success, - void Function(int errorCode, String path) error) async { - if (_mapChannel == null || customMapStyleOption == null) { - return false; - } - bool result; - try { - Map map = (await _mapChannel.invokeMethod( - BMFCustomMapStyleMethodId.kSetCustomMapStyleWithOptionMethod, - {'customMapStyleOption': customMapStyleOption.toMap()} - as dynamic)) as Map; - result = map != null; - if (preload != null && map['preloadPath'] != null) { - preload(map['preloadPath']); - } - if (success != null && map['successPath'] != null) { - success(map['successPath']); - } - if (error != null) { - error(map['errorCode'] as int, map['errorPath']); - } - } on PlatformException catch (e) { - print(e.toString()); - } - return result; - } -} diff --git a/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/private/mapdispatcher/bmf_map_widget_state_dispather.dart b/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/private/mapdispatcher/bmf_map_widget_state_dispather.dart deleted file mode 100644 index 90d0717..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/private/mapdispatcher/bmf_map_widget_state_dispather.dart +++ /dev/null @@ -1,41 +0,0 @@ -import 'package:flutter/services.dart'; -import 'package:flutter_bmfmap/BaiduMap/private/mapdispatcher/bmf_map_method_id.dart'; - -/// flutter端widget 状态更新通知native -class BMFMapWidgetStateDispatcher { - Map _methodChannelMap; - - BMFMapWidgetStateDispatcher() { - _methodChannelMap = new Map(); - } - - void initChannel(int widgetID) { - if (!_methodChannelMap.containsKey(widgetID)) { - MethodChannel methodChannel = new MethodChannel( - 'flutter_bmfmap/map_' + String.fromCharCode(widgetID + 97)); - _methodChannelMap[widgetID] = methodChannel; - } - } - - void unInit() { - _methodChannelMap.clear(); - } - - /// flutter 端Widget update通知native - void sendMapWidgetDidUpdateMsg(int widgetID) { - MethodChannel methodChannel = _methodChannelMap[widgetID]; - if (null == methodChannel) { - return; - } - methodChannel.invokeMethod(BMFMapWidgetMethodId.kMapDidUpdateWidget, null); - } - - /// flutter 端Widget热重载通知native - void sendMapWidgetReassembleMsg(int widgetID) { - MethodChannel methodChannel = _methodChannelMap[widgetID]; - if (null == methodChannel) { - return; - } - methodChannel.invokeMethod(BMFMapWidgetMethodId.kMapReassemble, null); - } -} diff --git a/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/private/mapdispatcher/bmf_marker_dispatcher.dart b/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/private/mapdispatcher/bmf_marker_dispatcher.dart deleted file mode 100644 index c34af79..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/private/mapdispatcher/bmf_marker_dispatcher.dart +++ /dev/null @@ -1,175 +0,0 @@ -import 'package:flutter/services.dart'; -import 'package:flutter_bmfmap/BaiduMap/bmfmap_map.dart'; -import 'package:flutter_bmfmap/BaiduMap/models/bmf_infowindow.dart'; -import 'package:flutter_bmfmap/BaiduMap/models/overlays/bmf_marker.dart'; -import 'bmf_map_method_id.dart' show BMFMarkerMethodId, BMFInfoWindowMethodId; - -/// marker处理类 -class BMFMarkerDispatcher { - /// 地图添加Marker - Future addMarkerDispatch( - MethodChannel _mapChannel, BMFMarker marker) async { - if (null == _mapChannel || null == marker) { - return false; - } - - marker.setMethodChannel(_mapChannel); - - bool result = false; - try { - result = (await _mapChannel.invokeMethod( - BMFMarkerMethodId.kMapAddMarkerMethod, marker.toMap() as dynamic)) - as bool; - } on PlatformException catch (e) { - print(e.toString()); - } - return result; - } - - /// 批量添加markers - Future addMarkersDispatch( - MethodChannel _mapChannel, List markers) async { - if (null == _mapChannel || null == markers) { - return false; - } - - markers.forEach((marker) { - marker.setMethodChannel(_mapChannel); - }); - - bool result = false; - try { - result = (await _mapChannel.invokeMethod( - BMFMarkerMethodId.kMapAddMarkersMethod, - markers?.map((marker) => marker.toMap())?.toList() as dynamic)) - as bool; - } on PlatformException catch (e) { - print(e.toString()); - } - return result; - } - - /// 添加infowindow - Future addInfoWindowDispatch( - MethodChannel _mapChannel, BMFInfoWindow infoWindow) async { - if (null == _mapChannel || null == infoWindow) { - return false; - } - bool result = false; - try { - result = (await _mapChannel.invokeMethod( - BMFInfoWindowMethodId.kMapAddInfoWindowMethod, - infoWindow.toMap() as dynamic)) as bool; - } on PlatformException catch (e) { - print(e.toString()); - } - return result; - } - - /// 批量添加infowindow - Future addInfoWindowsDispatch( - MethodChannel _mapChannel, List infoWindows) async { - if (null == _mapChannel || null == infoWindows) { - return false; - } - bool result = false; - try { - result = (await _mapChannel.invokeMethod( - BMFInfoWindowMethodId.kMapAddInfoWindowsMethod, - infoWindows?.map((infoWindow) => infoWindow.toMap())?.toList())) - as bool; - } on PlatformException catch (e) { - print(e.toString()); - } - return result; - } - - /// 批量添加markers - Future removeInfoWindowDispatch( - MethodChannel _mapChannel, BMFInfoWindow infoWindow) async { - if (null == _mapChannel || null == infoWindow) { - return false; - } - bool result = false; - try { - result = (await _mapChannel.invokeMethod( - BMFInfoWindowMethodId.kMapRemoveInfoWindowMethod, - infoWindow.toMap() as dynamic)) as bool; - } on PlatformException catch (e) { - print(e.toString()); - } - return result; - } - - /// map 指定删除marker - Future removeMarkerDispatch( - MethodChannel _mapChannel, BMFMarker marker) async { - if (null == _mapChannel || null == marker) { - return false; - } - bool result = false; - - marker.setMethodChannel(null); - - try { - result = (await _mapChannel.invokeMethod( - BMFMarkerMethodId.kMapRemoveMarkerMethod, marker.toMap())) as bool; - } on PlatformException catch (e) { - print(e.toString()); - } - return result; - } - - /// 批量删除markers - Future removeMarkersDispatch( - MethodChannel _mapChannel, List markers) async { - if (null == _mapChannel || null == markers) { - return false; - } - - markers.forEach((marker) { - marker.setMethodChannel(null); - }); - - bool result = false; - try { - result = (await _mapChannel.invokeMethod( - BMFMarkerMethodId.kMapRemoveMarkersMethod, - markers?.map((marker) => marker.toMap())?.toList() as dynamic)) - as bool; - } on PlatformException catch (e) { - print(e.toString()); - } - return result; - } - - /// map 清除所有的markers - Future cleanAllMarkersDispatch(MethodChannel _mapChannel) async { - if (null == _mapChannel) { - return false; - } - bool result = false; - try { - result = (await _mapChannel - .invokeMethod(BMFMarkerMethodId.kMapCleanAllMarkersMethod)) as bool; - } on PlatformException catch (e) { - print(e.toString()); - } - return result; - } - - /// 更新marker属性 - Future updateMarkerMember(MethodChannel _mapChannel, Map map) async { - if (null == _mapChannel || null == map) { - return false; - } - bool result = false; - try { - result = (await _mapChannel.invokeMethod( - BMFMarkerMethodId.kMapUpdateMarkerMember, map)) as bool; - } on PlatformException catch (e) { - print(e.toString()); - } - return result; - } -} diff --git a/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/private/mapdispatcher/bmf_offline_map_dispatcher.dart b/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/private/mapdispatcher/bmf_offline_map_dispatcher.dart deleted file mode 100644 index 1f30599..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/private/mapdispatcher/bmf_offline_map_dispatcher.dart +++ /dev/null @@ -1,239 +0,0 @@ -import 'package:flutter/services.dart'; -import 'package:flutter_bmfmap/BaiduMap/models/bmf_offline_models.dart'; -import 'bmf_map_method_id.dart' show BMFOfflineMethodId; - -/// 离线地图处理类 -class BMFOfflineMapDispatcher { - /// 初始化 - /// - /// 调用离线接口之前必须先初始化 - Future initOfflineMapDispatch(MethodChannel _mapChannel) async { - if (null == _mapChannel) { - return false; - } - bool result = false; - try { - result = (await _mapChannel - .invokeMethod(BMFOfflineMethodId.kMapInitOfflineMethod)) as bool; - } on PlatformException catch (e) { - print(e.toString()); - } - return result; - } - - /// 启动下载指定城市ID的离线地图,或在暂停更新某城市后继续更新下载某城市离线地图 - /// - /// cityID 指定的城市ID - /// 成功返回true,否则返回false - Future startOfflineMapDispatch( - MethodChannel _mapChannel, int cityID) async { - if (null == _mapChannel || null == cityID) { - return false; - } - bool result = false; - try { - result = (await _mapChannel.invokeMethod( - BMFOfflineMethodId.kMapStartOfflineMethod, {"cityID": cityID})) - as bool; - } on PlatformException catch (e) { - print(e.toString()); - } - return result; - } - - /// 启动更新指定城市ID的离线地图 - /// - /// cityID 指定的城市ID - /// 成功返回true,否则返回false - Future updateOfflineMapDispatch( - MethodChannel _mapChannel, int cityID) async { - if (null == _mapChannel || null == cityID) { - return false; - } - bool result = false; - try { - result = (await _mapChannel.invokeMethod( - BMFOfflineMethodId.kMapUpdateOfflineMethod, {"cityID": cityID})) - as bool; - } on PlatformException catch (e) { - print(e.toString()); - } - return result; - } - - /// 暂停下载或更新指定城市ID的离线地图 - /// - /// cityID 指定的城市ID - /// 成功返回true,否则返回false - Future pauseOfflineMapDispatch( - MethodChannel _mapChannel, int cityID) async { - if (null == _mapChannel || null == cityID) { - return false; - } - bool result = false; - try { - result = (await _mapChannel.invokeMethod( - BMFOfflineMethodId.kMapPauseOfflineMethod, {"cityID": cityID})) - as bool; - } on PlatformException catch (e) { - print(e.toString()); - } - return result; - } - - /// 删除指定城市ID的离线地图 - /// - /// cityID 指定的城市ID - /// 成功返回true,否则返回false - Future removeOfflineMapDispatch( - MethodChannel _mapChannel, int cityID) async { - if (null == _mapChannel || null == cityID) { - return false; - } - bool result = false; - try { - result = (await _mapChannel.invokeMethod( - BMFOfflineMethodId.kMapRemoveOfflineMethod, {"cityID": cityID})) - as bool; - } on PlatformException catch (e) { - print(e.toString()); - } - return result; - } - - /// 返回热门城市列表 - Future> getHotCityListDispatch( - MethodChannel _mapChannel) async { - if (null == _mapChannel) { - return null; - } - List result; - try { - Map map = (await _mapChannel - .invokeMethod(BMFOfflineMethodId.kMapGetHotCityListMethod) as Map); - if (null == map) { - return null; - } - List list = map["searchCityRecord"] as List; - result = list - ?.map((city) => BMFOfflineCityRecord.offlineCityRecord().fromMap(city) - as BMFOfflineCityRecord) - ?.toList(); - } on PlatformException catch (e) { - print(e.toString()); - } - return result; - } - - /// 返回支持离线地图城市列表 - Future> getOfflineCityListDispatch( - MethodChannel _mapChannel) async { - if (null == _mapChannel) { - return null; - } - List result; - try { - Map map = (await _mapChannel.invokeMethod( - BMFOfflineMethodId.kMapGetOfflineCityListMethod) as Map); - if (null == map) { - return null; - } - List list = map["searchCityRecord"] as List; - result = list - ?.map((city) => BMFOfflineCityRecord.offlineCityRecord().fromMap(city) - as BMFOfflineCityRecord) - ?.toList(); - } on PlatformException catch (e) { - print(e.toString()); - } - return result; - } - - /// 根据城市名搜索该城市离线地图记录 - /// - /// cityName 城市名 - Future> searchCityDispatch( - MethodChannel _mapChannel, String cityName) async { - if (null == _mapChannel || null == cityName) { - return null; - } - List result; - try { - Map map = (await _mapChannel.invokeMethod( - BMFOfflineMethodId.kMapSearchCityMethod, {'cityName': cityName}) - as Map); - if (null == map) { - return null; - } - List list = map["searchCityRecord"] as List; - result = list - ?.map((city) => BMFOfflineCityRecord.offlineCityRecord().fromMap(city) - as BMFOfflineCityRecord) - ?.toList(); - } on PlatformException catch (e) { - print(e.toString()); - } - return result; - } - - /// 返回各城市离线地图更新信息 - Future> getAllUpdateInfoDispatch( - MethodChannel _mapChannel) async { - if (null == _mapChannel) { - return null; - } - List result; - try { - Map map = (await _mapChannel - .invokeMethod(BMFOfflineMethodId.kMapGetAllUpdateInfoMethod) as Map); - if (null == map) { - return null; - } - List list = map["updateElements"] as List; - result = list - ?.map((element) => BMFUpdateElement.bmfUpdateElement() - .fromMap(element) as BMFUpdateElement) - ?.toList(); - } on PlatformException catch (e) { - print(e.toString()); - } - return result; - } - - /// 返回指定城市ID离线地图更新信息 - /// - /// id 城市id - Future getUpdateInfoDispatch( - MethodChannel _mapChannel, int id) async { - if (null == _mapChannel) { - return null; - } - BMFUpdateElement result; - try { - Map map = (await _mapChannel.invokeMethod( - BMFOfflineMethodId.kMapGetUpdateInfoMethod, {"cityID": id}) as Map); - if (null == map) { - return null; - } - result = BMFUpdateElement.bmfUpdateElement().fromMap(map); - } on PlatformException catch (e) { - print(e.toString()); - } - return result; - } - - /// 销毁离线地图管理模块,不用时调用 - Future destroyOfflineMapDispatch(MethodChannel _mapChannel) async { - if (null == _mapChannel) { - return false; - } - bool result = false; - try { - result = (await _mapChannel - .invokeMethod(BMFOfflineMethodId.kMapDestroyOfflineMethod)) as bool; - } on PlatformException catch (e) { - print(e.toString()); - } - return result; - } -} diff --git a/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/private/mapdispatcher/bmf_overlay_dispatcher.dart b/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/private/mapdispatcher/bmf_overlay_dispatcher.dart deleted file mode 100644 index 2f65d81..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/private/mapdispatcher/bmf_overlay_dispatcher.dart +++ /dev/null @@ -1,205 +0,0 @@ -import 'package:flutter/services.dart'; -import 'package:flutter_bmfbase/BaiduMap/bmfmap_base.dart'; -import 'package:flutter_bmfmap/BaiduMap/models/overlays/bmf_arcline.dart'; -import 'package:flutter_bmfmap/BaiduMap/models/overlays/bmf_circle.dart'; -import 'package:flutter_bmfmap/BaiduMap/models/overlays/bmf_dot.dart'; -import 'package:flutter_bmfmap/BaiduMap/models/overlays/bmf_ground.dart'; -import 'package:flutter_bmfmap/BaiduMap/models/overlays/bmf_polygon.dart'; -import 'package:flutter_bmfmap/BaiduMap/models/overlays/bmf_polyline.dart'; -import 'package:flutter_bmfmap/BaiduMap/models/overlays/bmf_text.dart'; -import 'package:flutter_bmfmap/BaiduMap/models/overlays/bmf_tile.dart'; -import 'package:flutter_bmfmap/BaiduMap/private/mapdispatcher/bmf_map_method_id.dart' - show BMFOverlayMethodId; - -/// polyline, arcline, polygon, circle -/// Dot Text (Android) -class BMFOverlayDispatcher { - static const _tag = 'BMFOverlayDispatcher'; - - /// 地图添加Polyline - Future addPolylineDispatch( - MethodChannel _mapChannel, BMFPolyline polyline) async { - if (null == _mapChannel || null == polyline) { - return false; - } - - polyline.setMethodChannel(_mapChannel); - - bool result = false; - try { - result = (await _mapChannel.invokeMethod( - BMFOverlayMethodId.kMapAddPolylineMethod, - polyline.toMap() as dynamic)) as bool; - } on PlatformException catch (e) { - print(e.toString()); - } - return result; - } - - /// 地图添加arcline - Future addArclineDispatch( - MethodChannel _mapChannel, BMFArcline arcline) async { - if (null == _mapChannel || null == arcline) { - return false; - } - - bool result = false; - try { - result = (await _mapChannel.invokeMethod( - BMFOverlayMethodId.kMapAddArclinelineMethod, - arcline.toMap() as dynamic)) as bool; - } on PlatformException catch (e) { - print(e.toString()); - } - return result; - } - - /// 地图添加polygon - Future addPolygonDispatch( - MethodChannel _mapChannel, BMFPolygon polygon) async { - if (null == _mapChannel || null == polygon) { - return false; - } - bool result = false; - try { - result = (await _mapChannel.invokeMethod( - BMFOverlayMethodId.kMapAddPolygonMethod, - polygon.toMap() as dynamic)) as bool; - } on PlatformException catch (e) { - print(e.toString()); - } - return result; - } - - /// 地图添加circle - Future addCircleDispatch( - MethodChannel _mapChannel, BMFCircle circle) async { - if (null == _mapChannel || null == circle) { - return false; - } - bool result = false; - try { - result = (await _mapChannel.invokeMethod( - BMFOverlayMethodId.kMapAddCircleMethod, - circle.toMap() as dynamic)) as bool; - } on PlatformException catch (e) { - print(e.toString()); - } - return result; - } - - /// 地图添加Dot - Future addDotDispatch(MethodChannel _mapChannel, BMFDot dot) async { - if (null == _mapChannel || null == dot) { - return false; - } - bool result = false; - try { - result = (await _mapChannel.invokeMethod( - BMFOverlayMethodId.kMapAddDotMethod, dot?.toMap() as dynamic)) - as bool; - } on PlatformException catch (e) { - print(e.toString()); - } - return result; - } - - /// 地图添加Text - Future addTextDispatch(MethodChannel _mapChannel, BMFText text) async { - if (null == _mapChannel || null == text) { - return false; - } - bool result = false; - try { - result = (await _mapChannel.invokeMethod( - BMFOverlayMethodId.kMapAddTextMethod, text.toMap() as dynamic)) - as bool; - } on PlatformException catch (e) { - print(e.toString()); - } - return result; - } - - /// 地图添加Ground - Future addGroundDispatch( - MethodChannel _mapChannel, BMFGround ground) async { - if (null == _mapChannel || null == ground) { - return false; - } - bool result = false; - try { - result = (await _mapChannel.invokeMethod( - BMFOverlayMethodId.kMapAddGroundMethod, - ground.toMap() as dynamic)) as bool; - } on PlatformException catch (e) { - print(e.toString()); - } - return result; - } - - /// 添加瓦片图 - Future addTileDispatch(MethodChannel _mapChannel, BMFTile tile) async { - if (tile == null || _mapChannel == null) { - return false; - } - bool result = false; - try { - result = (await _mapChannel.invokeMethod( - BMFOverlayMethodId.kMapAddTileMethod, tile?.toMap() as dynamic)) - as bool; - } on PlatformException catch (e) { - BMFLog.e(e.toString(), tag: _tag); - } - return result; - } - - /// 移除瓦片图 - Future removeTileDispatch( - MethodChannel _mapChannel, BMFTile tile) async { - if (tile == null || _mapChannel == null) { - return false; - } - bool result = false; - try { - result = (await _mapChannel.invokeMethod( - BMFOverlayMethodId.kMapRemoveTileMethod, - tile?.toMap() as dynamic)) as bool; - } on PlatformException catch (e) { - BMFLog.e(e.toString(), tag: _tag); - } - return result; - } - - /// 指定id删除overlay - Future removeOverlayDispatch( - MethodChannel _mapChannel, String overlayId) async { - if (null == _mapChannel || null == overlayId) { - return false; - } - bool result = false; - try { - result = (await _mapChannel.invokeMethod( - BMFOverlayMethodId.kMapRemoveOverlayMethod, - {'id': overlayId} as dynamic)) as bool; - } on PlatformException catch (e) { - print(e.toString()); - } - return result; - } - - /// 更新overlay属性 - Future updateOverlayMemberDispatch( - MethodChannel _mapChannel, Map map) async { - if (null == _mapChannel || null == map) { - return false; - } - bool result = false; - try { - result = (await _mapChannel.invokeMethod( - BMFOverlayMethodId.kMapUpdatePolylineMemberMethod, map)) as bool; - } on PlatformException catch (e) { - print(e.toString()); - } - return result; - } -} diff --git a/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/private/mapdispatcher/bmf_userlocation_dispatcher.dart b/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/private/mapdispatcher/bmf_userlocation_dispatcher.dart deleted file mode 100644 index 934fdb7..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/lib/BaiduMap/private/mapdispatcher/bmf_userlocation_dispatcher.dart +++ /dev/null @@ -1,106 +0,0 @@ -import 'package:flutter/services.dart'; -import 'package:flutter_bmfbase/BaiduMap/bmfmap_base.dart'; -import 'package:flutter_bmfmap/BaiduMap/models/bmf_userlocation.dart'; -import 'package:flutter_bmfmap/BaiduMap/private/mapdispatcher/bmf_map_method_id.dart' - show BMFUserlocationMethodId; - -/// 地图定位图层 -class BMFMapUserLocationDispatcher { - /// 设定是否显示定位图层 - Future setShowUserLocationDispatch( - MethodChannel _mapChannel, bool show) async { - if (_mapChannel == null || show == null) { - return false; - } - bool result = false; - try { - result = (await _mapChannel.invokeMethod( - BMFUserlocationMethodId.kMapShowUserLocationMethod, - {'show': show} as dynamic)) as bool; - } on PlatformException catch (e) { - print(e.toString()); - } - return result; - } - - /// 设定定位模式,取值为:BMFUserTrackingMode - /// - /// enableDirection 是否允许显示方向信息 (Android) 生效 - /// customMarker 设置用户自定义定位图标,可以为 null (Android)生效 - Future setUserTrackingModeDispatch(MethodChannel _mapChannel, - BMFUserTrackingMode userTrackingMode, bool enableDirection, - {String customMarker}) async { - if (_mapChannel == null || userTrackingMode == null) { - return false; - } - bool result = false; - try { - result = (await _mapChannel.invokeMethod( - BMFUserlocationMethodId.kMapUserTrackingModeMethod, - { - 'userTrackingMode': userTrackingMode.index, - 'enableDirection': enableDirection, - 'customMarker': customMarker - } as dynamic)) as bool; - } on PlatformException catch (e) { - print(e.toString()); - } - return result; - } - - /// 定位坐标点是否在当前地图可视区域内 - Future setIsUserLocationVisibleDispatch( - MethodChannel _mapChannel) async { - if (_mapChannel == null) { - return false; - } - bool result = false; - try { - Map map = (await _mapChannel.invokeMethod( - BMFUserlocationMethodId.kMapShowUserLocationMethod)) as Map; - result = map['userLocationVisible'] as bool; - } on PlatformException catch (e) { - print(e.toString()); - } - return result; - } - - /// 动态更新我的位置数据 - /// - /// userLocation 定位数据 - Future setUpdateLocationDataDispatch( - MethodChannel _mapChannel, BMFUserLocation userLocation) async { - if (_mapChannel == null || userLocation == null) { - return false; - } - bool result = false; - try { - result = (await _mapChannel.invokeMethod( - BMFUserlocationMethodId.kMapUpdateLocationDataMethod, - {'userLocation': userLocation.toMap()} as dynamic)) as bool; - } on PlatformException catch (e) { - print(e.toString()); - } - return result; - } - - /// 动态定制我的位置样式 - /// - /// userlocationDisplayParam 样式参数 - Future setUpdateLocationViewWithParamDispatch(MethodChannel _mapChannel, - BMFUserlocationDisplayParam userlocationDisplayParam) async { - if (_mapChannel == null || userlocationDisplayParam == null) { - return false; - } - bool result = false; - try { - result = (await _mapChannel.invokeMethod( - BMFUserlocationMethodId.kMapUpdateLocationDisplayParamMethod, - {'userlocationDisplayParam': userlocationDisplayParam.toMap()} - as dynamic)) as bool; - } on PlatformException catch (e) { - print(e.toString()); - } - return result; - } -} diff --git a/lib/my_flutter_bmfmap-1.0.2/map_doc.zip b/lib/my_flutter_bmfmap-1.0.2/map_doc.zip deleted file mode 100644 index 0b3ab6e..0000000 Binary files a/lib/my_flutter_bmfmap-1.0.2/map_doc.zip and /dev/null differ diff --git a/lib/my_flutter_bmfmap-1.0.2/pubspec.yaml b/lib/my_flutter_bmfmap-1.0.2/pubspec.yaml deleted file mode 100644 index bde0703..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/pubspec.yaml +++ /dev/null @@ -1,61 +0,0 @@ -name: flutter_bmfmap -description: The flutter_bmfmap is a flutter plugin of basic map for baidu map, You can use it to develop map page for Flutter application. -version: 1.0.2 -author: Baidu Map SDK team -homepage: https://lbsyun.baidu.com/index.php?title=flutter/loc - -environment: - sdk: ">=2.1.0 <3.0.0" - -dependencies: - flutter: - sdk: flutter - flutter_bmfbase: ^1.0.0 - -dev_dependencies: - flutter_test: - sdk: flutter - -# For information on the generic Dart part of this file, see the -# following page: https://dart.dev/tools/pub/pubspec - -# The following section is specific to Flutter. -flutter: - # This section identifies this Flutter project as a plugin project. - # The androidPackage and pluginClass identifiers should not ordinarily - # be modified. They are used by the tooling to maintain consistency when - # adding or updating assets for this project. - plugin: - androidPackage: com.baidu.flutter_bmfmap - pluginClass: FlutterBmfmapPlugin - - # To add assets to your plugin package, add an assets section, like this: - # assets: - # - images/a_dot_burr.jpeg - # - images/a_dot_ham.jpeg - # - # For details regarding assets in packages, see - # https://flutter.dev/assets-and-images/#from-packages - # - # An image asset can refer to one or more resolution-specific "variants", see - # https://flutter.dev/assets-and-images/#resolution-aware. - - # To add custom fonts to your plugin package, add a fonts section here, - # in this "flutter" section. Each entry in this list should have a - # "family" key with the font family name, and a "fonts" key with a - # list giving the asset and other descriptors for the font. For - # example: - # fonts: - # - family: Schyler - # fonts: - # - asset: fonts/Schyler-Regular.ttf - # - asset: fonts/Schyler-Italic.ttf - # style: italic - # - family: Trajan Pro - # fonts: - # - asset: fonts/TrajanPro.ttf - # - asset: fonts/TrajanPro_Bold.ttf - # weight: 700 - # - # For details regarding fonts in packages, see - # https://flutter.dev/custom-fonts/#from-packages diff --git a/lib/my_flutter_bmfmap-1.0.2/test/flutter_bmfmap_test.dart b/lib/my_flutter_bmfmap-1.0.2/test/flutter_bmfmap_test.dart deleted file mode 100644 index aa708a3..0000000 --- a/lib/my_flutter_bmfmap-1.0.2/test/flutter_bmfmap_test.dart +++ /dev/null @@ -1,22 +0,0 @@ -import 'package:flutter/services.dart'; -import 'package:flutter_test/flutter_test.dart'; - -void main() { - const MethodChannel channel = MethodChannel('flutter_bmfmap'); - - TestWidgetsFlutterBinding.ensureInitialized(); - - setUp(() { - channel.setMockMethodCallHandler((MethodCall methodCall) async { - return '42'; - }); - }); - - tearDown(() { - channel.setMockMethodCallHandler(null); - }); - - // test('getPlatformVersion', () async { - // expect(await FlutterBmfmap.platformVersion, '42'); - // }); -} diff --git a/pubspec.lock b/pubspec.lock index ba951f0..f096cc7 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -275,7 +275,7 @@ packages: flutter_bmfmap: dependency: "direct main" description: - path: "lib/my_flutter_bmfmap-1.0.2" + path: "lib/Modules/hyzp_yibin_bmfmap/lib/my_flutter_bmfmap-1.0.2" relative: true source: path version: "1.0.2" diff --git a/pubspec.yaml b/pubspec.yaml index 9883259..d562954 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -135,7 +135,7 @@ dependencies: # 准备使用自定义 flutter_bmfmap: ^1.0.2,以适应IOS版加载文本标识 # 为 BMFMarker 类增加参数 BitmapDescriptor bitmapDescriptor flutter_bmfmap: - path: ./lib/my_flutter_bmfmap-1.0.2/ + path: ./lib/Modules/hyzp_yibin_bmfmap/lib/my_flutter_bmfmap-1.0.2 flutter_bmfutils: ^1.0.2 http: ^0.12.2