|
|
|
|
|
|
|
|
* |
|
|
* |
|
|
* @private |
|
|
* @private |
|
|
*/ |
|
|
*/ |
|
|
_initVisibleEvent() { |
|
|
|
|
|
if (!this._tileVisibleCallback) { |
|
|
|
|
|
this._tileVisibleCallback = this._delegate.tileVisible.addEventListener( |
|
|
|
|
|
this._updateTile, |
|
|
|
|
|
this |
|
|
|
|
|
) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
_bindVisibleEvent() { |
|
|
|
|
|
this._tileVisibleCallback && this._tileVisibleCallback() |
|
|
|
|
|
this._tileVisibleCallback = this._delegate.tileVisible.addEventListener( |
|
|
|
|
|
this._updateTile, |
|
|
|
|
|
this |
|
|
|
|
|
) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* Sets height |
|
|
* Sets height |
|
|
* @param height |
|
|
* @param height |
|
|
|
|
|
* @param isAbsolute |
|
|
* @returns {Tileset} |
|
|
* @returns {Tileset} |
|
|
*/ |
|
|
*/ |
|
|
setHeight(height) { |
|
|
|
|
|
|
|
|
setHeight(height, isAbsolute = false) { |
|
|
this.readyPromise.then(tileset => { |
|
|
this.readyPromise.then(tileset => { |
|
|
let center = Cesium.Cartographic.fromCartesian( |
|
|
let center = Cesium.Cartographic.fromCartesian( |
|
|
tileset.boundingSphere.center |
|
|
tileset.boundingSphere.center |
|
|
|
|
|
|
|
|
let offset = Cesium.Cartesian3.fromRadians( |
|
|
let offset = Cesium.Cartesian3.fromRadians( |
|
|
center.longitude, |
|
|
center.longitude, |
|
|
center.latitude, |
|
|
center.latitude, |
|
|
center.height + height |
|
|
|
|
|
|
|
|
isAbsolute ? height : center.height + height |
|
|
) |
|
|
) |
|
|
let translation = Cesium.Cartesian3.subtract( |
|
|
let translation = Cesium.Cartesian3.subtract( |
|
|
offset, |
|
|
offset, |
|
|
|
|
|
|
|
|
*/ |
|
|
*/ |
|
|
setProperties(properties) { |
|
|
setProperties(properties) { |
|
|
this._properties = properties |
|
|
this._properties = properties |
|
|
this._initVisibleEvent() |
|
|
|
|
|
|
|
|
this._bindVisibleEvent() |
|
|
return this |
|
|
return this |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
*/ |
|
|
*/ |
|
|
setCustomShader(customShader) { |
|
|
setCustomShader(customShader) { |
|
|
this._customShader = customShader |
|
|
this._customShader = customShader |
|
|
this._initVisibleEvent() |
|
|
|
|
|
|
|
|
this._bindVisibleEvent() |
|
|
return this |
|
|
return this |
|
|
} |
|
|
} |
|
|
|
|
|
|