Commit 260aa9e4 by niuxiaolin

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

parent 357ea03e
...@@ -46,7 +46,7 @@ export class MainComponent implements OnInit { ...@@ -46,7 +46,7 @@ export class MainComponent implements OnInit {
theme: any; theme: any;
markers: any; markers: any;
map: 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) { 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 = { this.polylineOptions = {
...@@ -74,7 +74,7 @@ export class MainComponent implements OnInit { ...@@ -74,7 +74,7 @@ export class MainComponent implements OnInit {
course: Course = { delFlag: 0 }; course: Course = { delFlag: 0 };
section: Scetion = { delFlag: 0 }; section: Scetion = { delFlag: 0 };
type = 1; type = 1;
_this = this;
currentCouseId: any; currentCouseId: any;
staticHighWay: any = {}; staticHighWay: any = {};
staticNormal: any = {}; staticNormal: any = {};
...@@ -114,44 +114,31 @@ export class MainComponent implements OnInit { ...@@ -114,44 +114,31 @@ export class MainComponent implements OnInit {
} }
ngOnInit(): void { ngOnInit(): void {
//localStorage.clear(); (window as any).main_this = this;
this.m.clearMapLocal();
this.map = new window.BMap.Map(("baidu-map"), { this.map = new window.BMap.Map(("baidu-map"), {
enableMapClick: true enableMapClick: true
}); });
this.map.setMaxZoom(this.debug==true ? 18:13);
(window as any).map=this.map;
// this.map.setMapStyleV2({ styleJson: theme });
var hiddenHighIcon={ setTimeout(() => {
"featureType": "highwaysign", this.others();
"elementType": "labels.icon", }, 1);
"stylers": {
"visibility": "off"
} }
} others() {
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.dynamicScriptLoader.load('drawing').then(data => { 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 // Script Loaded Successfully
drawingManager.addEventListener('overlaycomplete', e => { drawingManager.addEventListener('overlaycomplete', e => {
var overlay = e.overlay; var overlay = e.overlay;
...@@ -203,14 +190,41 @@ export class MainComponent implements OnInit { ...@@ -203,14 +190,41 @@ export class MainComponent implements OnInit {
}); });
}).catch(error => console.log(error)); }).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 => { var hiddenHighIcon={
this.debug = Boolean(queryParams.get("debug")) "featureType": "highwaysign",
if(this.debug){ "elementType": "labels.icon",
var node = document.getElementsByClassName('BMapLib_Drawing')[0]; "stylers": {
(node as any).style.display = 'block'; "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.http.get<any>(this.s.basePath + `/project/list/${markType.HIGHWAY}`).subscribe(res => {
this.projects1 = res.data; this.projects1 = res.data;
...@@ -252,7 +266,6 @@ export class MainComponent implements OnInit { ...@@ -252,7 +266,6 @@ export class MainComponent implements OnInit {
this.http.get<any>(this.s.basePath + "/scetion/list").subscribe(res => { this.http.get<any>(this.s.basePath + "/scetion/list").subscribe(res => {
this.allsecs = res.data; this.allsecs = res.data;
}); });
} }
proj2Change($event, type) { proj2Change($event, type) {
this.map.clearOverlays(); this.map.clearOverlays();
...@@ -360,8 +373,9 @@ export class MainComponent implements OnInit { ...@@ -360,8 +373,9 @@ export class MainComponent implements OnInit {
this.wheelEvent.target=document.getElementById("baidu-map"); this.wheelEvent.target=document.getElementById("baidu-map");
setTimeout(() => { setTimeout(() => {
(window as any).xiaolinMouseWheel(this.wheelEvent); (window as any).xiaolinMouseWheel(this.wheelEvent);
(window as any).xiaolinMouseWheel(this.wheelEvent); (window as any).xiaolinMouseWheel(this.wheelEvent);
(window as any).xiaolinMouseWheel(this.wheelEvent);
}, 500); }, 500);
obj.hadZoom=true; obj.hadZoom=true;
// setTimeout(() => { // setTimeout(() => {
......
...@@ -196,7 +196,13 @@ export class SelfMapService { ...@@ -196,7 +196,13 @@ export class SelfMapService {
} }
return curvePoints; return curvePoints;
} }
clearMapLocal(){
for(var l in localStorage){
if(l.indexOf("BMap")>-1){
localStorage.removeItem(l);
}
}
}
/** /**
* 根据两点获取曲线坐标点数组 * 根据两点获取曲线坐标点数组
* @param Point 起点 * @param Point 起点
......
...@@ -471,7 +471,7 @@ hh.fO = function(a, b) { ...@@ -471,7 +471,7 @@ hh.fO = function(a, b) {
console.log('test') console.log('test')
e.Lk = new ub({ e.Lk = new ub({
Hc: 60, Hc: 60,
duration: f.U.to ? 1200 : 1, duration: f.U.to ? 900 : 1,
$b: vb.Vr, $b: vb.Vr,
za: function(a) { za: function(a) {
if (b > 0) { if (b > 0) {
......
...@@ -522,12 +522,15 @@ ...@@ -522,12 +522,15 @@
return { stepy: Math.sin(angleOf(p1, p2)) * step, stepx: Math.cos(angleOf(p1, p2)) * step }; return { stepy: Math.sin(angleOf(p1, p2)) * step, stepx: Math.cos(angleOf(p1, p2)) * step };
} }
function drawLine( moveStart,current) { function drawLine( moveStart,current) {
context.restore();
context.lineCap = "round"; context.lineCap = "round";
context.strokeStyle = '#fff';
context.shadowColor="#015293";
context.shadowBlur="0";
context.beginPath(); context.beginPath();
context.moveTo(moveStart.x,moveStart.y); context.moveTo(moveStart.x,moveStart.y);
context.strokeStyle = '#fff'; //context.fillStyle = '#146a10';
context.fillStyle = '#fff'; context.lineWidth =4;
context.lineWidth =3;
context.lineTo(current.x,current.y); context.lineTo(current.x,current.y);
//context.fillStyle = 'rgba(7,120,249,1)'; //context.fillStyle = 'rgba(7,120,249,1)';
// context.fill(); // context.fill();
...@@ -543,7 +546,7 @@ ...@@ -543,7 +546,7 @@
ctx.beginPath(); ctx.beginPath();
ctx.arc(options.x, options.y, options.r, 0, Math.PI * 2, true); ctx.arc(options.x, options.y, options.r, 0, Math.PI * 2, true);
ctx.closePath(); ctx.closePath();
ctx.fillStyle = 'rgba(7,120,249,1)'; ctx.fillStyle = '#146a10';
ctx.fill(); ctx.fill();
ctx.drawImage(backDom, 0, 0, backDom.width, backDom.height); 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