5 changed files with 68 additions and 26 deletions
@ -0,0 +1,2 @@ |
|||||
|
export * from './tencent-map'; |
||||
|
export * from './openstreet-map'; |
||||
@ -0,0 +1,15 @@ |
|||||
|
|
||||
|
import L from 'leaflet'; |
||||
|
import LeafletMap from '../leaflet-map'; |
||||
|
import { MapOptions } from '../map-models'; |
||||
|
|
||||
|
export class OpenStreetMap extends LeafletMap { |
||||
|
constructor($container, options: MapOptions) { |
||||
|
super($container, options); |
||||
|
const map = L.map($container).setView(options?.defaultCenterPosition, options?.defaultZoomLevel); |
||||
|
var tileLayer = (L.tileLayer as any).provider("OpenStreetMap.Mapnik"); |
||||
|
tileLayer.addTo(map); |
||||
|
super.setMap(map); |
||||
|
super.initSettings(options); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,16 @@ |
|||||
|
|
||||
|
import L from 'leaflet'; |
||||
|
import LeafletMap from '../leaflet-map'; |
||||
|
import { MapOptions } from '../map-models'; |
||||
|
|
||||
|
export class TencentMap extends LeafletMap { |
||||
|
constructor($container, options: MapOptions) { |
||||
|
super($container, options); |
||||
|
const txUrl = 'http://rt{s}.map.gtimg.com/realtimerender?z={z}&x={x}&y={y}&type=vector&style=0'; |
||||
|
const map = L.map($container).setView(options?.defaultCenterPosition, options?.defaultZoomLevel); |
||||
|
const txLayer = L.tileLayer(txUrl, { subdomains: '0123', tms: true }).addTo(map); |
||||
|
txLayer.addTo(map); |
||||
|
super.setMap(map); |
||||
|
super.initSettings(options); |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue