1234567891011121314151617181920212223242526272829303132333435363738394041 |
- /** * POI点
- *
- */
- import PubSub from "pubsub-js";
- import MapUtil from "../utils/MapUtil";
- import App from "../App";
- export default class POI{
- /** * POI点
- * @param {Number} id - POI id
- * @param {Number} x - POI x坐标
- * @param {Number} y - POI y坐标
- * @param {String} name - POI 名称
- * @param {Array<String>} info - jsx详细信息
- * @param {String} src - 标记图标路径
- */
- constructor(id, x, y, name, info, src){
- let latlng = MapUtil.distancePointToLatLng(App.origin, x, y);
- this.lat = latlng.lat;
- this.lng = latlng.lng;
- this.src = src ? src : "img/move.png";
- this.info = info;
- this.name = name;
- this.id = id;
- }
- add(){
- PubSub.publish('map.poi.add', this);
- }
- // move(x, y){
- // let latlng = MapUtil.distancePointToLatLng(App.origin, x, y);
- // this.lat = latlng.lat;
- // this.lng = latlng.lng;
- // PubSub.publish('map.poi.move', this);
- // }
- remove(){
- PubSub.publish('map.poi.remove', this);
- }
- }
|