Commit f81ad2ab by niuxiaolin

latest ui 08/09/2019 15:25:06

parent 52930465
......@@ -136,12 +136,66 @@ export class MainComponent implements OnInit {
}
});
this.setBound();
this.route.queryParamMap.subscribe(queryParams => {
this.debug = Boolean(queryParams.get("debug"))
})
this.route.queryParamMap.subscribe(queryParams => {
this.debug = Boolean(queryParams.get("debug"))
if (this.debug) {
this.dynamicScriptLoader.load('drawing').then(data => {
// Script Loaded Successfully
drawingManager.addEventListener('overlaycomplete', e => {
var overlay = e.overlay;
var coordinates = [];
if(overlay.getPath){
var path = overlay.getPath();
for (var i = 0; i < path.length; i++) {
coordinates.push([path[i].lng, path[i].lat]);
}
}else{
coordinates.push(overlay.getPosition())
}
if (overlay.toString() == '[object Polyline]') {
if (this.type == CordType.PROJ) {
this.proj.course = this.currentCouseId;
this.proj.coordinate = JSON.stringify(coordinates);
this.modalService.open('custom-modal-1');
}
else if (this.type == CordType.COURSE) {
this.course.coordinate = JSON.stringify(coordinates);
this.modalService.open('custom-modal-2');
}
else if (this.type == CordType.SECTION) {
this.section.project = this.currentProjId;
this.section.coordinate = JSON.stringify(coordinates);
this.modalService.open('custom-modal-3');
}
}
else if (overlay.toString() == '[object Polygon]') {
// geojsonStr = {
// "type": "Polygon",
// "coordinates": [coordinates]
// };
}else if(overlay.toString() == "[object Marker]"){
this.marker.coordinate = JSON.stringify(coordinates[0]);
this.modalService.open('marker');
}
// document.getElementById('result').innerHTML = "<div><span>左下角,右上角(经纬度):</span><button class='btn'>复制</button><p class='copyText'>" + sw.lng + "," + sw.lat + "," + ne.lng + "," + ne.lat + "</p></div>"
// + "<div><span>左下角,右上角(墨卡托坐标):</span><button class='btn'>复制</button><p class='copyText'>" + swMc.x + "," + swMc.y + "," + neMc.x + "," + neMc.y + "</p></div>"
// + "<div><span>坐标集(经纬度):</span><button class='btn'>复制</button><p class='copyText'>" + pathStr + "</p></div>"
// + "<div><span>坐标集(墨卡托坐标):</span><button class='btn'>复制</button><p class='copyText'>" + pathmcStr + "</p></div>"
// + "<div><span>geojson:</span><button class='btn'>复制</button><p class='copyText' style='white-space:nowrap;'>" + JSON.stringify(geojsonStr) + "</p></div>";
});
}).catch(error => console.log(error));
}
})
this.http.get<any>(this.s.basePath + `/project/list/${markType.HIGHWAY}`).subscribe(res => {
......@@ -357,74 +411,19 @@ export class MainComponent implements OnInit {
setTheme(theme){
(window as any).map.setMapStyleV2({ styleJson: theme });
}
// public polylineLoaded(polyline: BPolyline): void {
// this.map = polyline.getMap();
// this.setBound();
// this.map.setMapStyleV2({ styleJson: theme });
// this.map.enableScrollWheelZoom(true);
// this.map.centerAndZoom("山西省",11);
// this.dynamicScriptLoader.load('geouti',"mapv").then();
// if (this.debug) {
// this.dynamicScriptLoader.load('drawing').then(data => {
// // Script Loaded Successfully
// drawingManager.addEventListener('overlaycomplete', e => {
// var overlay = e.overlay;
public polylineLoaded(polyline: BPolyline): void {
this.map = polyline.getMap();
// var coordinates = [];
// if(overlay.getPath){
// var path = overlay.getPath();
// for (var i = 0; i < path.length; i++) {
// coordinates.push([path[i].lng, path[i].lat]);
// }
// }else{
// coordinates.push(overlay.getPosition())
// }
// if (overlay.toString() == '[object Polyline]') {
// if (this.type == CordType.PROJ) {
// this.proj.course = this.currentCouseId;
// this.proj.coordinate = JSON.stringify(coordinates);
// this.modalService.open('custom-modal-1');
// }
// else if (this.type == CordType.COURSE) {
// this.course.coordinate = JSON.stringify(coordinates);
// this.modalService.open('custom-modal-2');
// }
// else if (this.type == CordType.SECTION) {
// this.section.project = this.currentProjId;
// this.section.coordinate = JSON.stringify(coordinates);
// this.modalService.open('custom-modal-3');
// }
// }
// else if (overlay.toString() == '[object Polygon]') {
// // geojsonStr = {
// // "type": "Polygon",
// // "coordinates": [coordinates]
// // };
// }else if(overlay.toString() == "[object Marker]"){
// this.marker.coordinate = JSON.stringify(coordinates[0]);
// this.modalService.open('marker');
// }
this.setBound();
this.map.setMapStyleV2({ styleJson: theme });
this.map.enableScrollWheelZoom(true);
this.map.centerAndZoom("山西省",11);
// // document.getElementById('result').innerHTML = "<div><span>左下角,右上角(经纬度):</span><button class='btn'>复制</button><p class='copyText'>" + sw.lng + "," + sw.lat + "," + ne.lng + "," + ne.lat + "</p></div>"
// // + "<div><span>左下角,右上角(墨卡托坐标):</span><button class='btn'>复制</button><p class='copyText'>" + swMc.x + "," + swMc.y + "," + neMc.x + "," + neMc.y + "</p></div>"
// // + "<div><span>坐标集(经纬度):</span><button class='btn'>复制</button><p class='copyText'>" + pathStr + "</p></div>"
// // + "<div><span>坐标集(墨卡托坐标):</span><button class='btn'>复制</button><p class='copyText'>" + pathmcStr + "</p></div>"
// // + "<div><span>geojson:</span><button class='btn'>复制</button><p class='copyText' style='white-space:nowrap;'>" + JSON.stringify(geojsonStr) + "</p></div>";
// });
this.dynamicScriptLoader.load('geouti',"mapv").then();
// }).catch(error => console.log(error));
// }
// console.log('polyline loaded', polyline)
// }
console.log('polyline loaded', polyline)
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment