From 8327000a0cce5e47226372e0e25c1e6faec497e7 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期三, 12 一月 2022 16:56:43 +0800 Subject: [PATCH] 推送功能完善 --- lib/model/map/map_model.dart | 86 +++++++++++++++++++++++++++++++++++++++++- 1 files changed, 83 insertions(+), 3 deletions(-) diff --git a/lib/model/map/map_model.dart b/lib/model/map/map_model.dart index 5fb8d22..cd12135 100644 --- a/lib/model/map/map_model.dart +++ b/lib/model/map/map_model.dart @@ -1,9 +1,89 @@ -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); +} -- Gitblit v1.8.0