|
|
|
@ -532,13 +532,273 @@ export class UnitDetailsComponent implements OnInit {
|
|
|
|
|
this.getBuildingTypes(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Tmap: any; //天地图实例
|
|
|
|
|
Tzoom = 12; |
|
|
|
|
map: any; //天地图实例
|
|
|
|
|
zoom = 12; |
|
|
|
|
localsearch; //创建搜索对象 -- 提示列表
|
|
|
|
|
geocoder; |
|
|
|
|
labelGisBgT() { |
|
|
|
|
this.Tmap = new T.Map('container', { |
|
|
|
|
projection: 'EPSG:4326', |
|
|
|
|
this.map = new T.Map('container', { |
|
|
|
|
// projection: 'EPSG:4326',
|
|
|
|
|
}); |
|
|
|
|
this.map.centerAndZoom(new T.LngLat(116.40769, 39.89945), this.zoom); |
|
|
|
|
this.localsearch = new T.LocalSearch(this.map, { |
|
|
|
|
pageCapacity: 10, |
|
|
|
|
onSearchComplete: (res) => { |
|
|
|
|
this.localSearchResult(res); |
|
|
|
|
}, |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
this.geocoder = new T.Geocoder(); |
|
|
|
|
|
|
|
|
|
this.createDrivingRoute(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//驾车规划
|
|
|
|
|
drivingRoute; |
|
|
|
|
|
|
|
|
|
createDrivingRoute() { |
|
|
|
|
var startIcon = '../../../../assets/images/tdt/start.png'; //起点图标
|
|
|
|
|
var endIcon = '../../../../assets/images/tdt/end.png'; //终点图标
|
|
|
|
|
let that = this; |
|
|
|
|
this.drivingRoute = new T.DrivingRoute(this.map, { |
|
|
|
|
policy: 0, //驾车策略
|
|
|
|
|
onSearchComplete: (res) => { |
|
|
|
|
searchResult(res); |
|
|
|
|
}, |
|
|
|
|
}); |
|
|
|
|
searchDrivingRoute(); |
|
|
|
|
function searchDrivingRoute() { |
|
|
|
|
that.map.clearOverLays(); |
|
|
|
|
let startLngLat = new T.LngLat(116.26762, 39.8001); |
|
|
|
|
let endLngLat = new T.LngLat(116.60889, 40.02656); |
|
|
|
|
//驾车路线搜索
|
|
|
|
|
that.drivingRoute.search(startLngLat, endLngLat); |
|
|
|
|
} |
|
|
|
|
function searchResult(result) { |
|
|
|
|
console.log('驾车规划结果', result); |
|
|
|
|
//添加起始点
|
|
|
|
|
createStartMarker(result); |
|
|
|
|
|
|
|
|
|
// obj = result;
|
|
|
|
|
// var resultList = document.createElement('div');
|
|
|
|
|
// //获取方案个数
|
|
|
|
|
|
|
|
|
|
//获得单条驾车方案结果对象
|
|
|
|
|
let plan = result.getPlan(0); |
|
|
|
|
console.log('单条驾车方案结果对象', plan); |
|
|
|
|
|
|
|
|
|
//显示方案内容
|
|
|
|
|
var describeStr = |
|
|
|
|
'<strong>总时间:' + |
|
|
|
|
plan.getDuration() + |
|
|
|
|
'秒,总距离:' + |
|
|
|
|
Math.round(plan.getDistance()) + |
|
|
|
|
'公里</strong>'; |
|
|
|
|
describeStr += |
|
|
|
|
"<div><img src='" + |
|
|
|
|
startIcon + |
|
|
|
|
"'/>" + |
|
|
|
|
'116.267620,39.800100' + |
|
|
|
|
'</div>'; |
|
|
|
|
console.log('describeStr', describeStr); |
|
|
|
|
|
|
|
|
|
//显示该方案每段的描述信息
|
|
|
|
|
var numRoutes = plan.getNumRoutes(); |
|
|
|
|
console.log('numRoutes', numRoutes); |
|
|
|
|
// for (var m = 0; m < numRoutes; m++) {
|
|
|
|
|
// var route = plan.getRoute(m);
|
|
|
|
|
// describeStr +=
|
|
|
|
|
// m + 1 + '.<span>' + route.getDescription() + '</span><br/>';
|
|
|
|
|
|
|
|
|
|
// //显示该方案每段的详细描述信息
|
|
|
|
|
// var numStepsStr = '';
|
|
|
|
|
// var numSteps = route.getNumSteps();
|
|
|
|
|
// for (var n = 0; n < numSteps; n++) {
|
|
|
|
|
// var step = route.getStep(n);
|
|
|
|
|
// numStepsStr +=
|
|
|
|
|
// '<p>' +
|
|
|
|
|
// (n + 1) +
|
|
|
|
|
// ")<a href='javascript://' onclick='showPosition(\"" +
|
|
|
|
|
// step.getPosition().getLng() +
|
|
|
|
|
// '","' +
|
|
|
|
|
// step.getPosition().getLat() +
|
|
|
|
|
// '","' +
|
|
|
|
|
// step.getDescription() +
|
|
|
|
|
// '");\'>' +
|
|
|
|
|
// step.getDescription() +
|
|
|
|
|
// '</a></p>';
|
|
|
|
|
// }
|
|
|
|
|
// describeStr += numStepsStr;
|
|
|
|
|
// }
|
|
|
|
|
// describeStr +=
|
|
|
|
|
// "<div><img src='" +
|
|
|
|
|
// endIcon +
|
|
|
|
|
// "'/>" +
|
|
|
|
|
// '116.608890,40.026560' +
|
|
|
|
|
// '</div>';
|
|
|
|
|
// div.innerHTML = describeStr;
|
|
|
|
|
// resultList.appendChild(div);
|
|
|
|
|
|
|
|
|
|
// //显示驾车线路
|
|
|
|
|
createRoute(plan.getPath(),'red'); |
|
|
|
|
// //显示最佳级别
|
|
|
|
|
that.map.setViewport(plan.getPath()); |
|
|
|
|
|
|
|
|
|
//显示公交搜索结果
|
|
|
|
|
// document.getElementById('driving_way').appendChild(resultList);
|
|
|
|
|
} |
|
|
|
|
function createRoute(lnglats, lineColor?) { |
|
|
|
|
//创建线对象
|
|
|
|
|
var line = new T.Polyline(lnglats, { |
|
|
|
|
color: '#2C64A7', |
|
|
|
|
weight: 5, |
|
|
|
|
opacity: 0.9, |
|
|
|
|
}); |
|
|
|
|
//向地图上添加线
|
|
|
|
|
that.map.addOverLay(line); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function createStartMarker(result) { |
|
|
|
|
var startMarker = new T.Marker(result.getStart(), { |
|
|
|
|
icon: new T.Icon({ |
|
|
|
|
iconUrl: startIcon, |
|
|
|
|
iconSize: new T.Point(44, 34), |
|
|
|
|
iconAnchor: new T.Point(12, 31), |
|
|
|
|
}), |
|
|
|
|
}); |
|
|
|
|
that.map.addOverLay(startMarker); |
|
|
|
|
var endMarker = new T.Marker(result.getEnd(), { |
|
|
|
|
icon: new T.Icon({ |
|
|
|
|
iconUrl: endIcon, |
|
|
|
|
iconSize: new T.Point(44, 34), |
|
|
|
|
iconAnchor: new T.Point(12, 31), |
|
|
|
|
}), |
|
|
|
|
}); |
|
|
|
|
that.map.addOverLay(endMarker); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//输入提示
|
|
|
|
|
inputValue?: string; |
|
|
|
|
options: any[] = []; |
|
|
|
|
|
|
|
|
|
onInput(event: Event): void { |
|
|
|
|
const value = (event.target as HTMLInputElement).value; |
|
|
|
|
|
|
|
|
|
this.localsearch.search(value, 4); |
|
|
|
|
//
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
localSearchResult(result) { |
|
|
|
|
this.clearAll(); |
|
|
|
|
// this.localsearch.clearResults()
|
|
|
|
|
console.log('结果列表', result); |
|
|
|
|
console.log('结果类型', result.getResultType()); |
|
|
|
|
// console.log('666', result.suggests[0].getPois());
|
|
|
|
|
this.options = result.suggests || []; |
|
|
|
|
//清空地图及搜索列表
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//解析点数据结果
|
|
|
|
|
// pois(obj) {
|
|
|
|
|
// if (obj) {
|
|
|
|
|
// //显示搜索列表
|
|
|
|
|
// var divMarker = document.createElement('div');
|
|
|
|
|
// //坐标数组,设置最佳比例尺时会用到
|
|
|
|
|
// var zoomArr = [];
|
|
|
|
|
// for (var i = 0; i < obj.length; i++) {
|
|
|
|
|
// //闭包
|
|
|
|
|
// (function (i) {
|
|
|
|
|
// //名称
|
|
|
|
|
// var name = obj[i].name;
|
|
|
|
|
// //地址
|
|
|
|
|
// var address = obj[i].address;
|
|
|
|
|
// //坐标
|
|
|
|
|
// var lnglatArr = obj[i].lonlat.split(',');
|
|
|
|
|
// var lnglat = new T.LngLat(lnglatArr[0], lnglatArr[1]);
|
|
|
|
|
|
|
|
|
|
// var winHtml = '名称:' + name + '<br/>地址:' + address;
|
|
|
|
|
|
|
|
|
|
// //创建标注对象
|
|
|
|
|
// var marker = new T.Marker(lnglat);
|
|
|
|
|
// //地图上添加标注点
|
|
|
|
|
// map.addOverLay(marker);
|
|
|
|
|
// //注册标注点的点击事件
|
|
|
|
|
// var markerInfoWin = new T.InfoWindow(winHtml, { autoPan: true });
|
|
|
|
|
// marker.addEventListener('click', function () {
|
|
|
|
|
// marker.openInfoWindow(markerInfoWin);
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
// zoomArr.push(lnglat);
|
|
|
|
|
|
|
|
|
|
// //在页面上显示搜索的列表
|
|
|
|
|
// var a = document.createElement('a');
|
|
|
|
|
// a.href = 'javascript://';
|
|
|
|
|
// a.innerHTML = name;
|
|
|
|
|
// a.onclick = function () {
|
|
|
|
|
// showPosition(marker, winHtml);
|
|
|
|
|
// };
|
|
|
|
|
// divMarker.appendChild(document.createTextNode(i + 1 + '.'));
|
|
|
|
|
// divMarker.appendChild(a);
|
|
|
|
|
// divMarker.appendChild(document.createElement('br'));
|
|
|
|
|
// })(i);
|
|
|
|
|
// }
|
|
|
|
|
// //显示地图的最佳级别
|
|
|
|
|
// map.setViewport(zoomArr);
|
|
|
|
|
// //显示搜索结果
|
|
|
|
|
// divMarker.appendChild(
|
|
|
|
|
// document.createTextNode(
|
|
|
|
|
// '共' +
|
|
|
|
|
// localsearch.getCountNumber() +
|
|
|
|
|
// '条记录,分' +
|
|
|
|
|
// localsearch.getCountPage() +
|
|
|
|
|
// '页,当前第' +
|
|
|
|
|
// localsearch.getPageIndex() +
|
|
|
|
|
// '页'
|
|
|
|
|
// )
|
|
|
|
|
// );
|
|
|
|
|
// document.getElementById('searchDiv').appendChild(divMarker);
|
|
|
|
|
// document.getElementById('resultDiv').style.display = 'block';
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
//清空地图及搜索列表
|
|
|
|
|
clearAll() { |
|
|
|
|
this.map.clearOverLays(); |
|
|
|
|
} |
|
|
|
|
//点击位置按钮
|
|
|
|
|
setPosition() { |
|
|
|
|
console.log('点击位置'); |
|
|
|
|
|
|
|
|
|
if (this.disableds) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
this.isGisTopBox = false; |
|
|
|
|
this.isGisTopBoxTwo = true; |
|
|
|
|
} |
|
|
|
|
search() { |
|
|
|
|
console.log(this.inputValue); |
|
|
|
|
if (!this.inputValue) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// this.localsearch.search(this.inputValue, 1);
|
|
|
|
|
// console.log(this.localsearch.getResultType())
|
|
|
|
|
// this.http
|
|
|
|
|
// .get(
|
|
|
|
|
// `/geocoder?ds={"keyWord":"北京市延庆区延庆镇莲花池村前街50夕阳红养老院"}&tk=3027d4c8ed89bd8a185a9b73dbf3dcad`
|
|
|
|
|
// )
|
|
|
|
|
// .subscribe((data) => {
|
|
|
|
|
// console.log(data);
|
|
|
|
|
// });
|
|
|
|
|
this.geocoder.getPoint(this.inputValue, (res) => { |
|
|
|
|
console.log(888, res); |
|
|
|
|
this.map.centerAndZoom( |
|
|
|
|
new T.LngLat(res.location.lon, res.location.lat), |
|
|
|
|
16 |
|
|
|
|
); |
|
|
|
|
}); |
|
|
|
|
this.Tmap.centerAndZoom(new T.LngLat(116.40769, 39.89945), this.Tzoom); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
imageUrl = ''; //单位照片
|
|
|
|
@ -612,7 +872,6 @@ export class UnitDetailsComponent implements OnInit {
|
|
|
|
|
isMapLabel: boolean; |
|
|
|
|
//地图标注位置
|
|
|
|
|
markerPosition: any = { x: 0, y: 0 }; //单位坐标
|
|
|
|
|
map: any; //地图实例
|
|
|
|
|
isGisTopBox: boolean = false; //点击位置按钮
|
|
|
|
|
isGisTopBoxTwo: boolean = false; //点击位置按钮
|
|
|
|
|
oldPositionMarker: any; //旧位置marker实例
|
|
|
|
@ -636,227 +895,6 @@ export class UnitDetailsComponent implements OnInit {
|
|
|
|
|
//初始化地图
|
|
|
|
|
searchTitle: any; //搜索内容
|
|
|
|
|
placeSearch: any; //地址搜索类
|
|
|
|
|
search() { |
|
|
|
|
this.placeSearch.search(this.searchTitle, (status, result) => { |
|
|
|
|
// 搜索成功时,result即是对应的匹配数据
|
|
|
|
|
if (result.info == 'OK') { |
|
|
|
|
this.newPositionMarker.setPosition([ |
|
|
|
|
result.poiList.pois[0].location.lng, |
|
|
|
|
result.poiList.pois[0].location.lat, |
|
|
|
|
]); |
|
|
|
|
this.markerPosition2 = { |
|
|
|
|
x: result.poiList.pois[0].location.lng, |
|
|
|
|
y: result.poiList.pois[0].location.lat, |
|
|
|
|
}; |
|
|
|
|
this.map.setCenter([ |
|
|
|
|
result.poiList.pois[0].location.lng, |
|
|
|
|
result.poiList.pois[0].location.lat, |
|
|
|
|
]); //设置地图中心点
|
|
|
|
|
} else { |
|
|
|
|
alert('查询不到输入地址信息'); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
//初始化地图
|
|
|
|
|
markerPosition2; |
|
|
|
|
labelGis() { |
|
|
|
|
this.map = new AMap.Map('container', { |
|
|
|
|
zoom: 12, |
|
|
|
|
}); |
|
|
|
|
this.map.on('complete', () => { |
|
|
|
|
this.isGisTopBox = true; |
|
|
|
|
}); |
|
|
|
|
//输入提示
|
|
|
|
|
var autoOptions = { |
|
|
|
|
input: 'tipinput', |
|
|
|
|
}; |
|
|
|
|
AMap.plugin(['AMap.PlaceSearch', 'AMap.AutoComplete'], () => { |
|
|
|
|
var auto = new AMap.AutoComplete(autoOptions); |
|
|
|
|
this.placeSearch = new AMap.PlaceSearch(); //构造地点查询类
|
|
|
|
|
auto.on('select', (e) => { |
|
|
|
|
this.newPositionMarker.setPosition([ |
|
|
|
|
e.poi.location.lng, |
|
|
|
|
e.poi.location.lat, |
|
|
|
|
]); |
|
|
|
|
this.markerPosition2 = { x: e.poi.location.lng, y: e.poi.location.lat }; |
|
|
|
|
this.map.setCenter([e.poi.location.lng, e.poi.location.lat]); //设置地图中心点
|
|
|
|
|
}); //注册监听,当选中某条记录时会触发
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
if (this.isMapLabel) { |
|
|
|
|
//如果已经标注单位坐标
|
|
|
|
|
console.log('已标注单位位置'); |
|
|
|
|
this.map.setCenter([this.olddata.location.x, this.olddata.location.y]); |
|
|
|
|
this.oldPositionMarker = new AMap.Marker({ |
|
|
|
|
position: [this.olddata.location.x, this.olddata.location.y], |
|
|
|
|
content: this.newPositionMarkerContent, |
|
|
|
|
offset: new AMap.Pixel(-34, -36), |
|
|
|
|
}); |
|
|
|
|
// 将 markers 添加到地图
|
|
|
|
|
this.map.add(this.oldPositionMarker); |
|
|
|
|
} else { |
|
|
|
|
// console.log('未标注单位位置')
|
|
|
|
|
this.map.setCity('济南'); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//点击位置按钮
|
|
|
|
|
setPosition() { |
|
|
|
|
if (this.disableds) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
this.isGisTopBox = false; |
|
|
|
|
this.isGisTopBoxTwo = true; |
|
|
|
|
if (this.isMapLabel) { |
|
|
|
|
//如果已经标注单位坐标
|
|
|
|
|
// console.log('已标注单位位置')
|
|
|
|
|
if (this.oldPositionMarker) { |
|
|
|
|
this.oldPositionMarker.setContent(this.oldPositionMarkerContent); |
|
|
|
|
} |
|
|
|
|
if (this.newPositionMarker) { |
|
|
|
|
this.newPositionMarker.setContent(this.oldPositionMarkerContent); |
|
|
|
|
} |
|
|
|
|
this.newPositionMarker = new AMap.Marker({ |
|
|
|
|
draggable: true, |
|
|
|
|
position: [this.markerPosition.x, this.markerPosition.y], |
|
|
|
|
content: this.newPositionMarkerContentBtn, |
|
|
|
|
offset: new AMap.Pixel(-34, -36), |
|
|
|
|
}); |
|
|
|
|
this.map.add(this.newPositionMarker); |
|
|
|
|
if (this.markerPosition.x && this.markerPosition.x != 0) { |
|
|
|
|
this.markerPosition2 = { |
|
|
|
|
x: this.markerPosition.x, |
|
|
|
|
y: this.markerPosition.y, |
|
|
|
|
}; |
|
|
|
|
} else { |
|
|
|
|
this.markerPosition2 = { |
|
|
|
|
x: this.map.getCenter().lng, |
|
|
|
|
y: this.map.getCenter().lat, |
|
|
|
|
}; //获取当前地图中心位置
|
|
|
|
|
} |
|
|
|
|
this.newPositionMarker.on('dragend', (e) => { |
|
|
|
|
let lnglat = this.map.containerToLngLat(e.pixel); |
|
|
|
|
this.markerPosition2 = { x: lnglat.KL, y: lnglat.kT }; |
|
|
|
|
}); |
|
|
|
|
this.newPositionMarker.on('dragging', (e) => { |
|
|
|
|
let lnglat = this.map.containerToLngLat(e.pixel); |
|
|
|
|
this.newPositionMarker.setPosition(lnglat); |
|
|
|
|
}); |
|
|
|
|
//点击确定
|
|
|
|
|
this.renderer2.listen( |
|
|
|
|
this.elementRef.nativeElement.querySelector('#setPositionOk'), |
|
|
|
|
'click', |
|
|
|
|
(event) => { |
|
|
|
|
this.map.clearMap(); |
|
|
|
|
this.isGisTopBox = true; |
|
|
|
|
this.isGisTopBoxTwo = false; |
|
|
|
|
this.newPositionMarker = new AMap.Marker({ |
|
|
|
|
position: [this.markerPosition2.x, this.markerPosition2.y], |
|
|
|
|
content: this.newPositionMarkerContent, |
|
|
|
|
offset: new AMap.Pixel(-34, -36), |
|
|
|
|
}); |
|
|
|
|
this.markerPosition = this.markerPosition2; |
|
|
|
|
this.map.add(this.newPositionMarker); |
|
|
|
|
} |
|
|
|
|
); |
|
|
|
|
//点击取消
|
|
|
|
|
this.renderer2.listen( |
|
|
|
|
this.elementRef.nativeElement.querySelector('#setPositionClose'), |
|
|
|
|
'click', |
|
|
|
|
(event) => { |
|
|
|
|
this.isGisTopBox = true; |
|
|
|
|
this.isGisTopBoxTwo = false; |
|
|
|
|
this.map.clearMap(); |
|
|
|
|
this.newPositionMarker = new AMap.Marker({ |
|
|
|
|
position: [this.markerPosition.x, this.markerPosition.y], |
|
|
|
|
content: this.newPositionMarkerContent, |
|
|
|
|
offset: new AMap.Pixel(-34, -36), |
|
|
|
|
}); |
|
|
|
|
this.map.setCenter([this.markerPosition.x, this.markerPosition.y]); //设置地图中心点
|
|
|
|
|
this.map.add(this.newPositionMarker); |
|
|
|
|
} |
|
|
|
|
); |
|
|
|
|
} else { |
|
|
|
|
// console.log('未标注单位位置')
|
|
|
|
|
if (this.newPositionMarker) { |
|
|
|
|
this.newPositionMarker.setContent(this.oldPositionMarkerContent); |
|
|
|
|
} |
|
|
|
|
let center; |
|
|
|
|
//this.markerPosition---单位坐标
|
|
|
|
|
if (this.markerPosition.x && this.markerPosition.x != 0) { |
|
|
|
|
center = [this.markerPosition.x, this.markerPosition.y]; |
|
|
|
|
} else { |
|
|
|
|
center = this.map.getCenter(); //获取当前地图中心位置
|
|
|
|
|
// console.log('获取当前地图中心位置', center)
|
|
|
|
|
this.map.setCenter(center); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
this.newPositionMarker = new AMap.Marker({ |
|
|
|
|
draggable: true, |
|
|
|
|
position: center, |
|
|
|
|
content: this.newPositionMarkerContentBtn, |
|
|
|
|
offset: new AMap.Pixel(-34, -36), |
|
|
|
|
}); |
|
|
|
|
this.map.add(this.newPositionMarker); |
|
|
|
|
|
|
|
|
|
if (this.markerPosition.x && this.markerPosition.x != 0) { |
|
|
|
|
this.markerPosition2 = { |
|
|
|
|
x: this.markerPosition.x, |
|
|
|
|
y: this.markerPosition.y, |
|
|
|
|
}; |
|
|
|
|
} else { |
|
|
|
|
this.markerPosition2 = { |
|
|
|
|
x: this.map.getCenter().lng, |
|
|
|
|
y: this.map.getCenter().lat, |
|
|
|
|
}; //获取当前地图中心位置
|
|
|
|
|
} |
|
|
|
|
this.newPositionMarker.on('dragend', (e) => { |
|
|
|
|
let lnglat = this.map.containerToLngLat(e.pixel); |
|
|
|
|
this.markerPosition2 = { x: lnglat.KL, y: lnglat.kT }; |
|
|
|
|
}); |
|
|
|
|
this.newPositionMarker.on('dragging', (e) => { |
|
|
|
|
let lnglat = this.map.containerToLngLat(e.pixel); |
|
|
|
|
this.newPositionMarker.setPosition(lnglat); |
|
|
|
|
}); |
|
|
|
|
//点击确定
|
|
|
|
|
this.renderer2.listen( |
|
|
|
|
this.elementRef.nativeElement.querySelector('#setPositionOk'), |
|
|
|
|
'click', |
|
|
|
|
(event) => { |
|
|
|
|
this.isGisTopBox = true; |
|
|
|
|
this.isGisTopBoxTwo = false; |
|
|
|
|
this.markerPosition = this.markerPosition2; |
|
|
|
|
this.map.clearMap(); |
|
|
|
|
this.newPositionMarker = new AMap.Marker({ |
|
|
|
|
position: [this.markerPosition.x, this.markerPosition.y], |
|
|
|
|
content: this.newPositionMarkerContent, |
|
|
|
|
offset: new AMap.Pixel(-34, -36), |
|
|
|
|
}); |
|
|
|
|
this.newPositionMarker.setMap(this.map); |
|
|
|
|
} |
|
|
|
|
); |
|
|
|
|
this.renderer2.listen( |
|
|
|
|
this.elementRef.nativeElement.querySelector('#setPositionClose'), |
|
|
|
|
'click', |
|
|
|
|
(event) => { |
|
|
|
|
this.map.clearMap(); |
|
|
|
|
this.isGisTopBox = true; |
|
|
|
|
this.isGisTopBoxTwo = false; |
|
|
|
|
if (this.markerPosition.x && this.markerPosition.x != 0) { |
|
|
|
|
//说明之前标过点
|
|
|
|
|
this.newPositionMarker = new AMap.Marker({ |
|
|
|
|
position: [this.markerPosition.x, this.markerPosition.y], |
|
|
|
|
content: this.newPositionMarkerContent, |
|
|
|
|
offset: new AMap.Pixel(-34, -36), |
|
|
|
|
}); |
|
|
|
|
this.map.setCenter([this.markerPosition.x, this.markerPosition.y]); //设置地图中心点
|
|
|
|
|
this.map.add(this.newPositionMarker); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
); //取消
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
listOfData: any[] = []; |
|
|
|
|
listOfData2: any[] = []; |
|
|
|
|