shuishen
2022-04-27 510ae9f8768cd16c39fde70e1ae40b164500d5d5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
import defaultValue from './defaultValue.js'
 
class CustomloadingImg {
    constructor(options) {
        this._errorEvent = new global.DC.Namespace.Cesium.Event()
        this._tileWidth = 256
        this._tileHeight = 256
        // this._maximumLevel = 18
        // this._minimumLevel = 1
 
        var rectangle = defaultValue(options.rectangle, global.DC.Namespace.Cesium.Rectangle.MAX_VALUE)
        this._tilingScheme = new global.DC.Namespace.Cesium.GeographicTilingScheme({
            rectangle: rectangle,
            numberOfLevelZeroTilesX: 13,
            numberOfLevelZeroTilesY: 13
        })
 
        this._rectangle = this._tilingScheme.rectangle
 
        var resource = global.DC.Namespace.Cesium.Resource.createIfNeeded(options.url)
 
        this._resource = resource
 
        this._tileDiscardPolicy = undefined
 
        this._credit = undefined
 
        this._readyPromise = undefined
    }
 
    get url () {
        return this._resource.url
    }
 
    get proxy () {
        return this._resource.proxy
    }
 
    get tileWidth () {
        if (!this.ready) {
            throw new global.DC.Namespace.Cesium.DeveloperError('tileWidth must not be called before the imagery provider is ready.')
        }
        return this._tileWidth
    }
 
    get tileHeight () {
        if (!this.ready) {
            throw new global.DC.Namespace.Cesium.DeveloperError('tileHeight must not be called before the imagery provider is ready.')
        }
        return this._tileHeight
    }
 
    get maximumLevel () {
        if (!this.ready) {
            throw new global.DC.Namespace.Cesium.DeveloperError('maximumLevel must not be called before the imagery provider is ready.')
        }
        return this._maximumLevel
    }
 
    get minimumLevel () {
        if (!this.ready) {
            throw new global.DC.Namespace.Cesium.DeveloperError('minimumLevel must not be called before the imagery provider is ready.')
        }
        return this._minimumLevel
    }
 
    get tilingScheme () {
        if (!this.ready) {
            throw new global.DC.Namespace.Cesium.DeveloperError('tilingScheme must not be called before the imagery provider is ready.')
        }
        return this._tilingScheme
    }
 
    get tileDiscardPolicy () {
        if (!this.ready) {
            throw new global.DC.Namespace.Cesium.DeveloperError('tileDiscardPolicy must not be called before the imagery provider is ready.')
        }
        return this._tileDiscardPolicy
    }
 
    get rectangle () {
        if (!this.ready) {
            throw new global.DC.Namespace.Cesium.DeveloperError('rectangle must not be called before the imagery provider is ready.')
        }
        return this._rectangle
    }
 
    get errorEvent () {
        return this._errorEvent
    }
 
    get ready () {
        return this._resource
    }
 
    get readyPromise () {
        return this._readyPromise
    }
 
    get credit () {
        if (!this.ready) {
            throw new global.DC.Namespace.Cesium.DeveloperError('credit must not be called before the imagery provider is ready.')
        }
        return this._credit
    }
 
    requestImage (x, y, level, request) {
        var r = this._tilingScheme.getNumberOfXTilesAtLevel(level)
        var c = this._tilingScheme.getNumberOfYTilesAtLevel(level)
 
        var s = this.url.replace('{x}', x).replace('{y}', y)
 
        console.log('x:', x, 'y:', y, 'level:', level, 'url:', s)
 
        return global.DC.Namespace.Cesium.ImageryProvider.loadImage(this, s)
    }
}
 
export default CustomloadingImg