Commit 260aa9e4 by niuxiaolin

latest ui 08/12/2019 10:38:35

parent 357ea03e
......@@ -46,7 +46,7 @@ export class MainComponent implements OnInit {
theme: any;
markers: any;
map: any;
wheelEvent:any = {clientX:944,clientY:588,currentTarget:document.getElementById("baidu-map"),deltaX:0,deltaY:-600,type:"mousewheel",wheelDelta:450,wheelDeltaX:0,wheelDeltaY:450,which:0,x:944,y:488};
wheelEvent:any = {clientX:944,clientY:554,currentTarget:document.getElementById("baidu-map"),deltaX:0,deltaY:-600,type:"mousewheel",wheelDelta:450,wheelDeltaX:0,wheelDeltaY:450,which:0,x:944,y:188};
constructor(private m:SelfMapService, private router:Router, private idService: IdService, private route: ActivatedRoute, private cd: ChangeDetectorRef, private http: HttpClient, private dynamicScriptLoader: DynamicScriptLoaderService, private modalService: ModalService, private s: DefaultService) {
this.polylineOptions = {
......@@ -74,7 +74,7 @@ export class MainComponent implements OnInit {
course: Course = { delFlag: 0 };
section: Scetion = { delFlag: 0 };
type = 1;
_this = this;
currentCouseId: any;
staticHighWay: any = {};
staticNormal: any = {};
......@@ -114,44 +114,31 @@ export class MainComponent implements OnInit {
}
ngOnInit(): void {
//localStorage.clear();
(window as any).main_this = this;
this.m.clearMapLocal();
this.map = new window.BMap.Map(("baidu-map"), {
enableMapClick: true
});
this.map.setMaxZoom(this.debug==true ? 18:13);
(window as any).map=this.map;
// this.map.setMapStyleV2({ styleJson: theme });
var hiddenHighIcon={
"featureType": "highwaysign",
"elementType": "labels.icon",
"stylers": {
"visibility": "off"
}
}
this.map.setMapStyleV2({styleJson:hiddenHighIcon});
this.map.enableScrollWheelZoom();
//this.map.enableScrollWheelZoom()
this.map.enableContinuousZoom()
//this.map.centerAndZoom("山西省",11);
var _map =this.map;
var maping = {8:11,9:15,10:20,11:22,12:25,13:26,14:28,15:29}
this.map.addEventListener("zoomend", function() {
var curZoom =_map.getZoom();
var collections = document.getElementsByClassName("label-panel2");
var marks = document.getElementsByClassName("mark");
for (const key in collections) {
if (collections.hasOwnProperty(key)) {
const element = collections[key];
const mark = marks[key];
(element as any).style.fontSize=maping[curZoom]+"px";
(mark as any).style.fontSize=maping[curZoom]+"px";
}
setTimeout(() => {
this.others();
}, 1);
}
});
this.setBound();
others() {
this.dynamicScriptLoader.load('drawing').then(data => {
//显示编辑按钮
(window as any).main_this.route.queryParamMap.subscribe(queryParams => {
(window as any).main_this.debug = Boolean(queryParams.get("debug"))
if( (window as any).main_this.debug){
var node = document.getElementsByClassName('BMapLib_Drawing')[0];
(node as any).style.display = 'block';
}
})
// Script Loaded Successfully
drawingManager.addEventListener('overlaycomplete', e => {
var overlay = e.overlay;
......@@ -203,14 +190,41 @@ export class MainComponent implements OnInit {
});
}).catch(error => console.log(error));
this.map.setMaxZoom(this.debug==true ? 18:13);
(window as any).map=this.map;
// this.map.setMapStyleV2({ styleJson: theme });
this.route.queryParamMap.subscribe(queryParams => {
this.debug = Boolean(queryParams.get("debug"))
if(this.debug){
var node = document.getElementsByClassName('BMapLib_Drawing')[0];
(node as any).style.display = 'block';
var hiddenHighIcon={
"featureType": "highwaysign",
"elementType": "labels.icon",
"stylers": {
"visibility": "off"
}
})
}
this.map.setMapStyleV2({styleJson:hiddenHighIcon});
this.map.enableScrollWheelZoom();
//this.map.enableScrollWheelZoom()
this.map.enableContinuousZoom()
//this.map.centerAndZoom("山西省",11);
var _map =this.map;
var maping = {8:11,9:15,10:20,11:22,12:25,13:26,14:28,15:29}
this.map.addEventListener("zoomend", function() {
var curZoom =_map.getZoom();
var collections = document.getElementsByClassName("label-panel2");
var marks = document.getElementsByClassName("mark");
for (const key in collections) {
if (collections.hasOwnProperty(key)) {
const element = collections[key];
const mark = marks[key];
(element as any).style.fontSize=maping[curZoom]+"px";
(mark as any).style.fontSize=maping[curZoom]+"px";
}
}
});
this.setBound();
this.http.get<any>(this.s.basePath + `/project/list/${markType.HIGHWAY}`).subscribe(res => {
this.projects1 = res.data;
......@@ -252,7 +266,6 @@ export class MainComponent implements OnInit {
this.http.get<any>(this.s.basePath + "/scetion/list").subscribe(res => {
this.allsecs = res.data;
});
}
proj2Change($event, type) {
this.map.clearOverlays();
......@@ -362,6 +375,7 @@ export class MainComponent implements OnInit {
(window as any).xiaolinMouseWheel(this.wheelEvent);
(window as any).xiaolinMouseWheel(this.wheelEvent);
(window as any).xiaolinMouseWheel(this.wheelEvent);
}, 500);
obj.hadZoom=true;
// setTimeout(() => {
......
......@@ -196,7 +196,13 @@ export class SelfMapService {
}
return curvePoints;
}
clearMapLocal(){
for(var l in localStorage){
if(l.indexOf("BMap")>-1){
localStorage.removeItem(l);
}
}
}
/**
* 根据两点获取曲线坐标点数组
* @param Point 起点
......
......@@ -471,7 +471,7 @@ hh.fO = function(a, b) {
console.log('test')
e.Lk = new ub({
Hc: 60,
duration: f.U.to ? 1200 : 1,
duration: f.U.to ? 900 : 1,
$b: vb.Vr,
za: function(a) {
if (b > 0) {
......
......@@ -522,12 +522,15 @@
return { stepy: Math.sin(angleOf(p1, p2)) * step, stepx: Math.cos(angleOf(p1, p2)) * step };
}
function drawLine( moveStart,current) {
context.restore();
context.lineCap = "round";
context.strokeStyle = '#fff';
context.shadowColor="#015293";
context.shadowBlur="0";
context.beginPath();
context.moveTo(moveStart.x,moveStart.y);
context.strokeStyle = '#fff';
context.fillStyle = '#fff';
context.lineWidth =3;
//context.fillStyle = '#146a10';
context.lineWidth =4;
context.lineTo(current.x,current.y);
//context.fillStyle = 'rgba(7,120,249,1)';
// context.fill();
......@@ -543,7 +546,7 @@
ctx.beginPath();
ctx.arc(options.x, options.y, options.r, 0, Math.PI * 2, true);
ctx.closePath();
ctx.fillStyle = 'rgba(7,120,249,1)';
ctx.fillStyle = '#146a10';
ctx.fill();
ctx.drawImage(backDom, 0, 0, backDom.width, backDom.height);
......
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