| | |
| | | |
| | | import 'package:flutter/cupertino.dart'; |
| | | import 'package:flutter/material.dart'; |
| | | import 'package:locations/utils/map_util.dart'; |
| | | import 'package:locations/utils/ui_constant.dart'; |
| | | import 'package:flutter_baidu_mapapi_map/flutter_baidu_mapapi_map.dart'; |
| | | import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart'; |
| | | import 'dart:math' as math; |
| | | |
| | | //三角形 |
| | |
| | | } |
| | | } |
| | | |
| | | class MapMarkerUtil { |
| | | ///添加轨迹开始点 |
| | | static Future<List<BMFMarker>> addTravelStartMarker( |
| | | BMFMapController? _mapController, BMFCoordinate position) async { |
| | | BMFMarker marker = await MapUtil.addMarker( |
| | | _mapController, position, "assets/images/map/icon_travel_start.png", |
| | | zIndex: 1); |
| | | BMFMarker marker1 = await MapUtil.addMarker( |
| | | _mapController, position, "assets/images/map/icon_travel_start_1.png", |
| | | offset: BMFPoint(0, 38)); |
| | | return [marker, marker1]; |
| | | } |
| | | |
| | | //添加轨迹结束点 |
| | | static Future<List<BMFMarker>> addTravelEndMarker( |
| | | BMFMapController? _mapController, BMFCoordinate position) async { |
| | | BMFMarker marker = await MapUtil.addMarker( |
| | | _mapController, position, "assets/images/map/icon_travel_end.png", |
| | | zIndex: 1); |
| | | BMFMarker marker1 = await MapUtil.addMarker( |
| | | _mapController, position, "assets/images/map/icon_travel_end_1.png", |
| | | offset: BMFPoint(0, 38)); |
| | | return [marker, marker1]; |
| | | } |
| | | |
| | | ///添加文字图层 |
| | | static Future addText( |
| | | BMFMapController? _mapController, BMFCoordinate position,String text, |
| | | {Color bgColor = const Color(0xAA0E95FE), |
| | | Color fontColor = Colors.white}) async { |
| | | BMFText bmfText = BMFText( |
| | | text: " "+text+" ", |
| | | position: position, |
| | | bgColor: bgColor, |
| | | fontColor: fontColor, |
| | | fontSize: 30, |
| | | typeFace: BMFTypeFace( |
| | | familyName: BMFFamilyName.sMonospace, |
| | | textStype: BMFTextStyle.BOLD_ITALIC), |
| | | alignY: BMFVerticalAlign.ALIGN_CENTER_VERTICAL, |
| | | alignX: BMFHorizontalAlign.ALIGN_LEFT); |
| | | |
| | | /// 添加text |
| | | await _mapController!.addText(bmfText); |
| | | } |
| | | } |