| | |
| | | import { NzModalSubject } from 'ng-zorro-antd'; |
| | | import { ReactiveFormsModule } from '@angular/forms'; |
| | | import { ViewEncapsulation,Component, ViewChild, ElementRef, NgZone } from '@angular/core'; |
| | | import { MapOptions,Point,MarkerOptions,ControlAnchor,NavigationControlOptions,NavigationControlType,BMapInstance } from 'angular2-baidu-map'; |
| | | import { ViewEncapsulation, Component, ViewChild, ElementRef, NgZone } from '@angular/core'; |
| | | import { MapOptions, Point, MarkerOptions, ControlAnchor, NavigationControlOptions, NavigationControlType, BMapInstance } from 'angular2-baidu-map'; |
| | | import { CoorPicker } from '@business/entity/data'; |
| | | import { CoorPickerService } from 'app/routes/map/coordinates-picker/coordinates-picker.service'; |
| | | |
| | |
| | | templateUrl: './coordinates-picker.component.html', |
| | | styleUrls: [ './coordinates-picker.component.css' ], |
| | | }) |
| | | export class CoordinatesPickerComponent{ |
| | | export class CoordinatesPickerComponent { |
| | | Default_LNG = 121; |
| | | Default_LAT = 31.4; |
| | | isSaving = false; |
| | | markerOption:{ |
| | | point:Point, |
| | | options:MarkerOptions |
| | | }= { |
| | | point:null, |
| | | options:null |
| | | markerOption: { |
| | | point: Point, |
| | | options: MarkerOptions |
| | | } = { |
| | | point: null, |
| | | options: null |
| | | }; |
| | | data:CoorPicker; |
| | | navigationOpts:NavigationControlOptions; |
| | | data: CoorPicker; |
| | | navigationOpts: NavigationControlOptions; |
| | | options: MapOptions; |
| | | _BMap:any = null; |
| | | _BMap: any = null; |
| | | |
| | | constructor(private subject:NzModalSubject,private coorPickerService:CoorPickerService) { |
| | | constructor(private subject: NzModalSubject, private coorPickerService: CoorPickerService) { |
| | | this.data = this.coorPickerService.data; |
| | | let lng = this.data.longitude; |
| | | lng = lng ==0 || lng == null ? this.Default_LNG:lng; |
| | | lng = lng === 0 || lng == null ? this.Default_LNG : lng; |
| | | this.data.longitude = lng; |
| | | let lat = this.data.latitude; |
| | | lat = lat == 0||lat == null ? this.Default_LAT:lat; |
| | | lat = lat === 0 || lat == null ? this.Default_LAT : lat; |
| | | this.data.latitude = lat; |
| | | this.options = { |
| | | minZoom:3, |
| | | maxZoom:19, |
| | | cursor:'default', |
| | | minZoom: 3, |
| | | maxZoom: 19, |
| | | cursor: 'default', |
| | | centerAndZoom: { |
| | | lng:lng, |
| | | lat:lat, |
| | | lng: lng, |
| | | lat: lat, |
| | | zoom: 19 |
| | | }, |
| | | enableKeyboard: true |
| | |
| | | this.navigationOpts = { |
| | | anchor: ControlAnchor.BMAP_ANCHOR_BOTTOM_RIGHT, |
| | | type: NavigationControlType.BMAP_NAVIGATION_CONTROL_LARGE |
| | | } |
| | | }; |
| | | this.markerOption.point = { |
| | | lng:lng, |
| | | lat:lat |
| | | lng: lng, |
| | | lat: lat |
| | | }; |
| | | this.markerOption.options = { |
| | | icon: { |
| | |
| | | width: 30 |
| | | } |
| | | }, |
| | | offset:{ |
| | | height:-30, |
| | | width:-15 |
| | | offset: { |
| | | height: -30, |
| | | width: -15 |
| | | } |
| | | }; |
| | | } |
| | | private _marker:any = null; |
| | | loadMarker(marker){ |
| | | if(this._marker==null){ |
| | | private _marker: any = null; |
| | | loadMarker(marker) { |
| | | if (this._marker == null) { |
| | | this._marker = marker; |
| | | } |
| | | } |
| | |
| | | this._map.addOverlay(this._marker); |
| | | } |
| | | ); |
| | | this._localSearch= new this._BMap.LocalSearch(map, { |
| | | renderOptions:{map: map} |
| | | this._localSearch = new this._BMap.LocalSearch(map, { |
| | | renderOptions: {map: map} |
| | | }); |
| | | if(this.data.latitude==this.Default_LAT&&this.data.longitude==this.Default_LNG |
| | | &&this.data.address!=null){ |
| | | if (this.data.latitude === this.Default_LAT && this.data.longitude === this.Default_LNG |
| | | && this.data.address != null) { |
| | | this._localSearch.search(this.data.address); |
| | | } |
| | | |
| | | } |
| | | queryTest:string; |
| | | mapSearch(param:any){ |
| | | queryTest: string; |
| | | mapSearch(param: any) { |
| | | let text = this.queryTest; |
| | | text = text == null || text.trim() ==''?'昆山市':text; |
| | | text = text == null || text.trim() === '' ? '昆山市' : text; |
| | | this._localSearch.search(text); |
| | | } |
| | | clickMap(e: any) { |