| | |
| | | import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart'; |
| | | import 'package:flutter_baidu_mapapi_map/flutter_baidu_mapapi_map.dart'; |
| | | import 'location_model.dart'; |
| | | |
| | | class MapShowInfo { |
| | | final BMFCoordinate center; |
| | | final SimpleLocation center; |
| | | final int zoomLevel; |
| | | |
| | | MapShowInfo(this.center, this.zoomLevel); |
| | | } |
| | | |
| | | class Marker { |
| | | String? _id; |
| | | SimpleLocation position; |
| | | String icon; |
| | | int? zIndex; |
| | | double? width; |
| | | double? height; |
| | | Offset? centerOffset; |
| | | |
| | | Marker( |
| | | {required this.position, |
| | | required this.icon, |
| | | String? id, |
| | | this.zIndex, |
| | | this.width, |
| | | this.height, |
| | | this.centerOffset}) { |
| | | if (id == null) { |
| | | var timeStamp = DateTime.now().millisecondsSinceEpoch; |
| | | _id = '$timeStamp' '_' '$hashCode'; |
| | | } else { |
| | | _id = id; |
| | | } |
| | | } |
| | | |
| | | /// 获取id |
| | | String get Id => _id!; |
| | | |
| | | Map<String, Object?> toMap() { |
| | | Map<String, Object?> map = { |
| | | 'id': Id, |
| | | 'position': position.toJson(), |
| | | 'zIndex': zIndex, |
| | | 'icon': icon, |
| | | }; |
| | | if (width != null) { |
| | | map["width"] = width; |
| | | } |
| | | |
| | | if (height != null) { |
| | | map["height"] = height; |
| | | } |
| | | |
| | | if (centerOffset != null) { |
| | | map["centerOffset"] = centerOffset!.toMap(); |
| | | } |
| | | |
| | | return map; |
| | | } |
| | | } |
| | | |
| | | class Offset { |
| | | double x; |
| | | double y; |
| | | |
| | | Offset(this.x, this.y); |
| | | |
| | | Map<String, Object?> toMap() { |
| | | Map<String, Object?> map = {'x': x, 'y': y}; |
| | | return map; |
| | | } |
| | | } |
| | | |
| | | class MapClickEventBus { |
| | | SimpleLocation? location; |
| | | |
| | | MapClickEventBus(this.location); |
| | | } |
| | | |
| | | class CaptureEventBus { |
| | | String path; |
| | | CaptureEventBus(this.path); |
| | | } |
| | | |
| | | class Coordinate { |
| | | final double latitude; |
| | | final double longitude; |
| | | |
| | | Coordinate(this.latitude, this.longitude); |
| | | } |