gisthreemap
Version:
基于webGL的三维api
53 lines (46 loc) • 1.67 kB
JavaScript
/*
* @Description: 飞线效果(参考开源代码)
* @Version: 1.0
*/
class LineFlowMaterialProperty {
constructor(options) {
this._definitionChanged = new Cesium.Event();
this._color = undefined;
this._speed = undefined;
this._percent = undefined;
this._gradient = undefined;
this.color = options.color;
this.speed = options.speed;
this.percent = options.percent;
this.gradient = options.gradient;
};
get isConstant() {
return false;
}
get definitionChanged() {
return this._definitionChanged;
}
getType(time) {
return Cesium.Material.LineFlowMaterialType;
}
getValue(time, result) {
if (!Cesium.defined(result)) {
result = {};
}
result.color = Cesium.Property.getValueOrDefault(this._color, time, Cesium.Color.RED, result.color);
result.speed = Cesium.Property.getValueOrDefault(this._speed, time, 5.0, result.speed);
result.percent = Cesium.Property.getValueOrDefault(this._percent, time, 0.1, result.percent);
result.gradient = Cesium.Property.getValueOrDefault(this._gradient, time, 0.01, result.gradient);
return result
}
equals(other) {
return (this === other ||
(other instanceof LineFlowMaterialProperty &&
Cesium.Property.equals(this._color, other._color) &&
Cesium.Property.equals(this._speed, other._speed) &&
Cesium.Property.equals(this._percent, other._percent) &&
Cesium.Property.equals(this._gradient, other._gradient))
)
}
}
export default LineFlowMaterialProperty