Commit ab2f809c by niuxiaolin

latest

parent 5ecc78f4
...@@ -33,7 +33,9 @@ ...@@ -33,7 +33,9 @@
], ],
"scripts":[ "scripts":[
"src/getscript.js",
"src/assets/GeoUtils.js",
"src/assets/mapv.js"
], ],
"es5BrowserSupport": true "es5BrowserSupport": true
}, },
......
...@@ -21,11 +21,11 @@ ...@@ -21,11 +21,11 @@
<option *ngFor="let c of projects2" [value]="c.id" >{{c.name}}</option> <option *ngFor="let c of projects2" [value]="c.id" >{{c.name}}</option>
</select> </select>
</div> </div>
<baidu-map #map [options]="opts"> <!-- <baidu-map #map [options]="opts">
<polyline [points]="points" [options]="polylineOptions" (loaded)="polylineLoaded($event)" <polyline [points]="points" [options]="polylineOptions" (loaded)="polylineLoaded($event)"
(clicked)="polylineClicked($event)"></polyline> (clicked)="polylineClicked($event)"></polyline>
</baidu-map> </baidu-map> -->
<div id="baidu-map"></div>
<div class="main"> <div class="main">
<div class="left"> <div class="left">
<fieldset> <fieldset>
......
...@@ -72,7 +72,7 @@ ...@@ -72,7 +72,7 @@
.focus{ .focus{
background: #ea262d96!important; background: #ea262d96!important;
} }
baidu-map{ #baidu-map{
width: 100%; width: 100%;
height: 900px; height: 900px;
display: block; display: block;
......
...@@ -14,7 +14,7 @@ import { ActivatedRoute, Router } from '@angular/router'; ...@@ -14,7 +14,7 @@ import { ActivatedRoute, Router } from '@angular/router';
import { IdService } from '../services/id.service'; import { IdService } from '../services/id.service';
import { SelfMapService } from '../services/map.service'; import { SelfMapService } from '../services/map.service';
declare var map: any;
declare var BMap: any; declare var BMap: any;
declare var BMapLib: any; declare var BMapLib: any;
declare var drawingManager: any; declare var drawingManager: any;
...@@ -45,7 +45,7 @@ export class MainComponent implements OnInit { ...@@ -45,7 +45,7 @@ export class MainComponent implements OnInit {
curiveLength:number = 10; curiveLength:number = 10;
theme: any; theme: any;
markers: any; markers: any;
map: any;
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.opts = { this.opts = {
...@@ -115,7 +115,7 @@ export class MainComponent implements OnInit { ...@@ -115,7 +115,7 @@ export class MainComponent implements OnInit {
var toPoints = this.m.toPoints(points,this.curiveLength,this.curive); var toPoints = this.m.toPoints(points,this.curiveLength,this.curive);
var newPolyLine = new window.BMap.Polyline(toPoints, { strokeColor: proj.lineStyle, strokeWeight: proj.lineWidth }); var newPolyLine = new window.BMap.Polyline(toPoints, { strokeColor: proj.lineStyle, strokeWeight: proj.lineWidth });
(newPolyLine as any).id = (proj.course ? "p" : "s") + proj.id; (newPolyLine as any).id = (proj.course ? "p" : "s") + proj.id;
map.addOverlay(newPolyLine); this.map.addOverlay(newPolyLine);
// var newPoints = this.corToPoint(proj.coordinate); // var newPoints = this.corToPoint(proj.coordinate);
// this.m.animationLine(newPoints); // this.m.animationLine(newPoints);
...@@ -124,6 +124,16 @@ export class MainComponent implements OnInit { ...@@ -124,6 +124,16 @@ export class MainComponent implements OnInit {
this.router.navigate(['/video']); this.router.navigate(['/video']);
} }
ngOnInit(): void { ngOnInit(): void {
this.map = new window.BMap.Map(document.getElementById("baidu-map"), {
centerAndZoom: {
lat: 37.78663390039693,
lng: 112.43176242674386,
zoom: 10,
}});
this.map.setMapStyleV2({ styleJson: theme });
this.map.enableScrollWheelZoom(true);
this.map.centerAndZoom("山西省",11);
this.route.queryParamMap.subscribe(queryParams => { this.route.queryParamMap.subscribe(queryParams => {
this.debug = Boolean(queryParams.get("debug")) this.debug = Boolean(queryParams.get("debug"))
}) })
...@@ -167,7 +177,7 @@ export class MainComponent implements OnInit { ...@@ -167,7 +177,7 @@ export class MainComponent implements OnInit {
} }
proj2Change($event, type) { proj2Change($event, type) {
map.clearOverlays(); this.map.clearOverlays();
var proj: any = {}; var proj: any = {};
if (type == 1) { if (type == 1) {
} else { } else {
...@@ -176,7 +186,7 @@ export class MainComponent implements OnInit { ...@@ -176,7 +186,7 @@ export class MainComponent implements OnInit {
proj = this.projects1.find(f => f.id == $event); proj = this.projects1.find(f => f.id == $event);
this.addPoly(proj); this.addPoly(proj);
var points = this.corToPoint(proj.coordinate); var points = this.corToPoint(proj.coordinate);
map.setViewport(points); this.map.setViewport(points);
} }
loadLabels(data){ loadLabels(data){
...@@ -197,7 +207,7 @@ export class MainComponent implements OnInit { ...@@ -197,7 +207,7 @@ export class MainComponent implements OnInit {
var points = this.loadPolys(res,true); var points = this.loadPolys(res,true);
}); });
}else{ }else{
map.centerAndZoom("山西省",8); this.map.centerAndZoom("山西省",8);
} }
} }
...@@ -217,7 +227,7 @@ export class MainComponent implements OnInit { ...@@ -217,7 +227,7 @@ export class MainComponent implements OnInit {
} }
toNormal() { toNormal() {
map.clearOverlays(); this.map.clearOverlays();
this.normalShow = !this.normalShow; this.normalShow = !this.normalShow;
...@@ -237,7 +247,7 @@ export class MainComponent implements OnInit { ...@@ -237,7 +247,7 @@ export class MainComponent implements OnInit {
} }
highLight(i: number, obj, type) { highLight(i: number, obj, type) {
this.currProj = Object.assign({}, obj); this.currProj = Object.assign({}, obj);
var overlays = map.getOverlays(); var overlays = this.map.getOverlays();
var cur = overlays.find(o => o.id == type + obj.id); var cur = overlays.find(o => o.id == type + obj.id);
timer(0, 200) timer(0, 200)
.pipe(timeInterval(), pluck('interval'), take(6)).subscribe(index => { .pipe(timeInterval(), pluck('interval'), take(6)).subscribe(index => {
...@@ -252,7 +262,7 @@ export class MainComponent implements OnInit { ...@@ -252,7 +262,7 @@ export class MainComponent implements OnInit {
//标段不定位 //标段不定位
if(type!='s'){ if(type!='s'){
map.setViewport(points); this.map.setViewport(points);
} }
...@@ -320,9 +330,9 @@ export class MainComponent implements OnInit { ...@@ -320,9 +330,9 @@ export class MainComponent implements OnInit {
this.setBound(); this.setBound();
(window as any).map.setMapStyleV2({ styleJson: theme }); // (window as any).map.setMapStyleV2({ styleJson: theme });
map.enableScrollWheelZoom(true); // this.map.enableScrollWheelZoom(true);
map.centerAndZoom("山西省",11); // this.map.centerAndZoom("山西省",11);
this.dynamicScriptLoader.load('geouti',"mapv").then(); this.dynamicScriptLoader.load('geouti',"mapv").then();
if (this.debug) { if (this.debug) {
...@@ -396,7 +406,7 @@ export class MainComponent implements OnInit { ...@@ -396,7 +406,7 @@ export class MainComponent implements OnInit {
setBound() { setBound() {
var project = map.getMapType().getProjection(); var project = this.map.getMapType().getProjection();
var getPathStr = function (overlay) { var getPathStr = function (overlay) {
var pathStr = ""; var pathStr = "";
var path = overlay.getPath(); var path = overlay.getPath();
...@@ -430,11 +440,11 @@ export class MainComponent implements OnInit { ...@@ -430,11 +440,11 @@ export class MainComponent implements OnInit {
var SE_JW = "170.672126, -68.045308 ;"; //东南角 var SE_JW = "170.672126, -68.045308 ;"; //东南角
//3.添加环形遮罩层 //3.添加环形遮罩层
var ply1 = new BMap.Polygon(ENWS + E_JW + SE_JW + S_JW + WS_JW + W_JW + NW_JW + N_JW + EN_JW + E_JW, {strokeColor:"none",strokeOpacity:0,fillColor:"#0002069c",fillOpacity:"0.5"}); //建立多边形覆盖物 var ply1 = new BMap.Polygon(ENWS + E_JW + SE_JW + S_JW + WS_JW + W_JW + NW_JW + N_JW + EN_JW + E_JW, {strokeColor:"none",strokeOpacity:0,fillColor:"#0002069c",fillOpacity:"0.5"}); //建立多边形覆盖物
map.addOverlay(ply1);//遮罩物是半透明的,如果需要纯色可以多添加几层 this.map.addOverlay(ply1);//遮罩物是半透明的,如果需要纯色可以多添加几层
//4. 给目标行政区划添加边框,其实就是给目标行政区划添加一个没有填充物的遮罩层 //4. 给目标行政区划添加边框,其实就是给目标行政区划添加一个没有填充物的遮罩层
var ply = new BMap.Polygon(rs.boundaries[0], {strokeWeight:0,strokeColor:"#16e8d6",fillColor:"",fillOpacity:"0"}); var ply = new BMap.Polygon(rs.boundaries[0], {strokeWeight:0,strokeColor:"#16e8d6",fillColor:"",fillOpacity:"0"});
map.addOverlay(ply); this.map.addOverlay(ply);
map.setViewport(ply.getPath());//调整视野 this.map.setViewport(ply.getPath());//调整视野
//获取行政区域 //获取行政区域
// map.clearOverlays(); //清除地图覆盖物 // map.clearOverlays(); //清除地图覆盖物
...@@ -481,7 +491,7 @@ export class MainComponent implements OnInit { ...@@ -481,7 +491,7 @@ export class MainComponent implements OnInit {
* @param type "s" = section ,"p"=project * @param type "s" = section ,"p"=project
*/ */
getOverlayById(id: number, type: string = "p") { getOverlayById(id: number, type: string = "p") {
var overlays = map.getOverlays(); var overlays = this.map.getOverlays();
return overlays.find(o => o.id == type + id); return overlays.find(o => o.id == type + id);
} }
addLabel(points:Array<Point>,proj){ addLabel(points:Array<Point>,proj){
...@@ -500,7 +510,7 @@ export class MainComponent implements OnInit { ...@@ -500,7 +510,7 @@ export class MainComponent implements OnInit {
</div>`, { </div>`, {
position: center position: center
}); });
map.addOverlay(label); this.map.addOverlay(label);
} }
...@@ -515,7 +525,7 @@ ${label.name} ...@@ -515,7 +525,7 @@ ${label.name}
position: JSON.parse(label.coordinate), position: JSON.parse(label.coordinate),
// offset:{width:5,height:-10} // offset:{width:5,height:-10}
}); });
map.addOverlay(label); this.map.addOverlay(label);
} }
} }
......
...@@ -483,6 +483,9 @@ ...@@ -483,6 +483,9 @@
render: function (points, context) { render: function (points, context) {
if(window.timeoutIDForLine){
clearTimeout(window.timeoutIDForLine)
}
console.log(points) console.log(points)
var index = 1; var index = 1;
var step = 2; var step = 2;
...@@ -490,6 +493,7 @@ ...@@ -490,6 +493,7 @@
var movStart = Object.assign({},points[0]); var movStart = Object.assign({},points[0]);
var next = points[index]; var next = points[index];
var canvas = context.canvas; var canvas = context.canvas;
var backDom = document.createElement('canvas'), var backDom = document.createElement('canvas'),
backCtx = backDom.getContext('2d'); backCtx = backDom.getContext('2d');
backDom.width = canvas.width; backDom.width = canvas.width;
...@@ -557,7 +561,7 @@ ...@@ -557,7 +561,7 @@
movStart =Object.assign({},points[index - 1]) ; movStart =Object.assign({},points[index - 1]) ;
current =Object.assign({},movStart) ; current =Object.assign({},movStart) ;
} }
setTimeout(renderBody, 1); window.timeoutIDForLine=setTimeout(renderBody, 1);
} }
renderBody(); renderBody();
......
...@@ -2,51 +2,51 @@ window.TILE_VERSION = { ...@@ -2,51 +2,51 @@ window.TILE_VERSION = {
"ditu": { "ditu": {
"normal": { "normal": {
"version": "088", "version": "088",
"updateDate": "20190726" "updateDate": "20190802"
}, },
"satellite": { "satellite": {
"version": "009", "version": "009",
"updateDate": "20190726" "updateDate": "20190802"
}, },
"normalTraffic": { "normalTraffic": {
"version": "081", "version": "081",
"updateDate": "20190726" "updateDate": "20190802"
}, },
"satelliteTraffic": { "satelliteTraffic": {
"version": "083", "version": "083",
"updateDate": "20190726" "updateDate": "20190802"
}, },
"mapJS": { "mapJS": {
"version": "104", "version": "104",
"updateDate": "20190726" "updateDate": "20190802"
}, },
"satelliteStreet": { "satelliteStreet": {
"version": "083", "version": "083",
"updateDate": "20190726" "updateDate": "20190802"
}, },
"earthVector": { "earthVector": {
"version": "001", "version": "001",
"updateDate": "20190726" "updateDate": "20190802"
} }
}, },
"webapp": { "webapp": {
"high_normal": { "high_normal": {
"version": "001", "version": "001",
"updateDate": "20190726" "updateDate": "20190802"
}, },
"lower_normal": { "lower_normal": {
"version": "002", "version": "002",
"updateDate": "20190726" "updateDate": "20190802"
} }
}, },
"api_for_mobile": { "api_for_mobile": {
"vector": { "vector": {
"version": "002", "version": "002",
"updateDate": "20190726" "updateDate": "20190802"
}, },
"vectorIcon": { "vectorIcon": {
"version": "002", "version": "002",
"updateDate": "20190726" "updateDate": "20190802"
} }
} }
}; };
......
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