|
|
|
|
@ -10,6 +10,12 @@ int g_zoomLevel_default = 14; //地图默认缩放倍数
|
|
|
|
|
int g_zoomLevel = 14; //地图缩放倍数
|
|
|
|
|
int g_zoomMin = 10;
|
|
|
|
|
int g_zoomMax = 18;
|
|
|
|
|
|
|
|
|
|
String g_myIconPathPre = "";
|
|
|
|
|
// g_myIconPathPre = /data/user/0/com.example.hyzp_yibin_bmfmap/app_flutter/myIcons
|
|
|
|
|
String g_myIconDir = "myIcons";
|
|
|
|
|
String g_myIconPre = "myIcon";
|
|
|
|
|
|
|
|
|
|
///批量添加定位标记
|
|
|
|
|
List<BMFMarker> g_listBMFMarker = [];
|
|
|
|
|
Map g_map_BMFMarkerID_dwIndex = {};
|
|
|
|
|
@ -42,7 +48,11 @@ Future getListBMFMarker({List listDwinfo}) async {
|
|
|
|
|
subtitle: 'test',
|
|
|
|
|
// identifier: '${listDwinfo[i]["id"].toString()}、${listDwinfo[i]["dwmc"]}',
|
|
|
|
|
identifier: '${(i + 1).toString()}、${listDwinfo[i]["dwmc"]}',
|
|
|
|
|
icon: 'assets/images/location.png',
|
|
|
|
|
// icon: 'assets/images/location.png',
|
|
|
|
|
|
|
|
|
|
// 为IOS在百度地图中显示文本图标
|
|
|
|
|
icon: "$g_myIconPathPre/${g_myIconPre}${i + 1}.png",
|
|
|
|
|
// icon: '/data/user/0/com.example.hyzp_yibin_bmfmap/app_flutter/myIcons/myIcon01.png',
|
|
|
|
|
|
|
|
|
|
/// 默认情况下, annotation view的中心位于annotation的坐标位置,
|
|
|
|
|
/// 可以设置centerOffset改变view的位置,正的偏移使view朝右下方移动,负的朝左上方,单位是像素
|
|
|
|
|
@ -62,33 +72,34 @@ Future getListBMFMarker({List listDwinfo}) async {
|
|
|
|
|
g_map_BMFMarkerID_dwIndex[marker.getId()] = i;
|
|
|
|
|
g_listBMFMarker.add(marker);
|
|
|
|
|
|
|
|
|
|
g_listBMFText.add(BMFText(
|
|
|
|
|
// text: '${listDwinfo[i]["id"].toString()}、${listDwinfo[i]["dwmc"]}',
|
|
|
|
|
text: '${(i + 1).toString()}、${listDwinfo[i]["dwmc"]}',
|
|
|
|
|
//纬度偏移-上下 off_latitude, 经度偏移-左右 off_longitude
|
|
|
|
|
//已经在zoomLevel = 15时调整好定位标记与文本标记的相对位置
|
|
|
|
|
// ,当地图缩放时,会发生位置变化,必须使用 Provider 或者 EventBus 进行跟踪更新
|
|
|
|
|
|
|
|
|
|
//https://time.geekbang.org/column/article/131890
|
|
|
|
|
//老师,provider、eventBus的用途有啥区别吗,都可以做状态的通知
|
|
|
|
|
// 作者回复: Provider 主要是用来做数据读写共享;event_bus主要是用来做数据状态通知、实现组件间单向数据传递。
|
|
|
|
|
//如果我们的应用足够简单,数据流动的方向和顺序是清晰的,我们只需要将数据映射成视图就可以了。
|
|
|
|
|
// 作为声明式的框架,Flutter 可以自动处理数据到渲染的全过程,通常并不需要 Provider 状态管理。
|
|
|
|
|
// position: getBMFCoordinate(listDwinfo[i]["dwzb"],
|
|
|
|
|
// off_latitude: -0.0002 * g_zoomLevel * _scale,
|
|
|
|
|
// off_longitude: -0.00009 * g_zoomLevel * _scale),
|
|
|
|
|
position: getBMFCoordinate(listDwinfo[i]["dwzb"]),
|
|
|
|
|
//自己控制off_latitude、off_longitude效果不好
|
|
|
|
|
bgColor: Colors.yellow,
|
|
|
|
|
fontColor: Colors.black,
|
|
|
|
|
fontSize: 35,
|
|
|
|
|
// typeFace:
|
|
|
|
|
// BMFTypeFace(familyName: BMFFamilyName.sMonospace, textStype: BMFTextStyle.BOLD_ITALIC),
|
|
|
|
|
typeFace: BMFTypeFace(familyName: BMFFamilyName.sMonospace, textStype: BMFTextStyle.BOLD),
|
|
|
|
|
alignY: BMFVerticalAlign.ALIGN_TOP,
|
|
|
|
|
alignX: BMFHorizontalAlign.ALIGN_LEFT,
|
|
|
|
|
rotate: 0.0,
|
|
|
|
|
zIndex: 99));
|
|
|
|
|
// android专有
|
|
|
|
|
// g_listBMFText.add(BMFText(
|
|
|
|
|
// // text: '${listDwinfo[i]["id"].toString()}、${listDwinfo[i]["dwmc"]}',
|
|
|
|
|
// text: '${(i + 1).toString()}、${listDwinfo[i]["dwmc"]}',
|
|
|
|
|
// //纬度偏移-上下 off_latitude, 经度偏移-左右 off_longitude
|
|
|
|
|
// //已经在zoomLevel = 15时调整好定位标记与文本标记的相对位置
|
|
|
|
|
// // ,当地图缩放时,会发生位置变化,必须使用 Provider 或者 EventBus 进行跟踪更新
|
|
|
|
|
//
|
|
|
|
|
// //https://time.geekbang.org/column/article/131890
|
|
|
|
|
// //老师,provider、eventBus的用途有啥区别吗,都可以做状态的通知
|
|
|
|
|
// // 作者回复: Provider 主要是用来做数据读写共享;event_bus主要是用来做数据状态通知、实现组件间单向数据传递。
|
|
|
|
|
// //如果我们的应用足够简单,数据流动的方向和顺序是清晰的,我们只需要将数据映射成视图就可以了。
|
|
|
|
|
// // 作为声明式的框架,Flutter 可以自动处理数据到渲染的全过程,通常并不需要 Provider 状态管理。
|
|
|
|
|
// // position: getBMFCoordinate(listDwinfo[i]["dwzb"],
|
|
|
|
|
// // off_latitude: -0.0002 * g_zoomLevel * _scale,
|
|
|
|
|
// // off_longitude: -0.00009 * g_zoomLevel * _scale),
|
|
|
|
|
// position: getBMFCoordinate(listDwinfo[i]["dwzb"]),
|
|
|
|
|
// //自己控制off_latitude、off_longitude效果不好
|
|
|
|
|
// bgColor: Colors.yellow,
|
|
|
|
|
// fontColor: Colors.black,
|
|
|
|
|
// fontSize: 35,
|
|
|
|
|
// // typeFace:
|
|
|
|
|
// // BMFTypeFace(familyName: BMFFamilyName.sMonospace, textStype: BMFTextStyle.BOLD_ITALIC),
|
|
|
|
|
// typeFace: BMFTypeFace(familyName: BMFFamilyName.sMonospace, textStype: BMFTextStyle.BOLD),
|
|
|
|
|
// alignY: BMFVerticalAlign.ALIGN_TOP,
|
|
|
|
|
// alignX: BMFHorizontalAlign.ALIGN_LEFT,
|
|
|
|
|
// rotate: 0.0,
|
|
|
|
|
// zIndex: 99));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|