import XYZ from 'ol/source/XYZ'

class Gaode extends XYZ {
    constructor(options = {}) {
        let projection = options.projection || 'EPSG:3857'
        let crossOrigin = options.crossOrigin || 'anonymous'
        const url = options.url || 'http://wprd0{1-4}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&style=6&x={x}&y={y}&z={z}'
        const tileUrlFunction = options.tileUrlFunction || undefined
        super({
            projection,
            cacheSize: options.cacheSize,
            crossOrigin: crossOrigin,
            opaque: options.opaque !== undefined ? options.opaque : true,
            maxZoom: options.maxZoom !== undefined ? options.maxZoom : 19,
            reprojectionErrorThreshold: options.reprojectionErrorThreshold,
            tileLoadFunction: options.tileLoadFunction,
            tileUrlFunction: tileUrlFunction,
            url: url,
            wrapX: options.wrapX
        })
    }
}
export default Gaode