| | |
| | | import { Component, OnInit } from '@angular/core'; |
| | | import { _HttpClient } from '@delon/theme'; |
| | | import { MapOptions, HeatmapData, HeatmapOptions, NavigationControlOptions, ControlAnchor, NavigationControlType } from 'angular2-baidu-map'; |
| | | import { ViewEncapsulation } from '@angular/compiler/src/core'; |
| | | import { BMapLib } from 'angular2-baidu-map/types/BMapLib'; |
| | | |
| | | @Component({ |
| | | selector: 'app-grid-trace', |
| | | templateUrl: './grid-trace.component.html', |
| | | }) |
| | | export class GridTraceComponent implements OnInit { |
| | | |
| | | options: MapOptions; |
| | | private _map: any; |
| | | constructor( |
| | | private http: _HttpClient |
| | | ) { } |
| | | |
| | | ngOnInit() { |
| | | ) { |
| | | this.options = { |
| | | minZoom: 3, |
| | | maxZoom: 13, |
| | | cursor: 'default', |
| | | centerAndZoom: { |
| | | lng: 121, |
| | | lat: 31.4, |
| | | zoom: 17 |
| | | }, |
| | | enableKeyboard: true |
| | | }; |
| | | } |
| | | |
| | | loadMap(map: any) { |
| | | this._map = map; |
| | | } |
| | | navigationOpts: NavigationControlOptions; |
| | | //热力图 |
| | | heatData: HeatmapData = { |
| | | data: [ |
| | | {"lng":121,"lat":31.4,"count":99}, |
| | | {"lng":121.02,"lat":31.38,"count":95}, |
| | | {"lng":120.96,"lat":31.39,"count":95}, |
| | | ], |
| | | max: 100 |
| | | }; |
| | | heatOption: HeatmapOptions = { |
| | | radius: 100 |
| | | }; |
| | | heatmapOverlay :any; |
| | | /** |
| | | * loadHeatmap |
| | | */ |
| | | public loadHeatmap(heatmapOverlay) { |
| | | this.heatmapOverlay = heatmapOverlay; |
| | | } |
| | | ngOnInit() { |
| | | this.navigationOpts = { |
| | | anchor: ControlAnchor.BMAP_ANCHOR_BOTTOM_RIGHT, |
| | | type: NavigationControlType.BMAP_NAVIGATION_CONTROL_LARGE |
| | | }; |
| | | } |
| | | } |