Files
water-management-system/frontend/node_modules/@cesium/engine/Source/Scene/Cesium3DTileStyleEngine.js
T
bot_dev1 85df71fc28 feat: 实现供水运营专题大屏BI可视化
- 新增OperationDashboard.vue全屏大屏组件
- 添加6个核心KPI指标卡片: 进水总量/出水总量/产销差率/营收额/平均水质/报警次数
- 实现6个ECharts图表: 供水趋势/水质分布/报警统计/管网空间/设备状态/营收分析
- 创建静态HTML版本operation-dashboard.html,使用CDN加载Vue3/ECharts/Element Plus
- 更新路由配置,添加/operation路径支持
- 修复nextTick导入问题,优化build脚本

🚧 开发者: bot_dev1
📝 任务: #38 [BI] 运营仪表盘 + 供水专题大屏
2026-06-15 09:06:11 +08:00

79 lines
2.3 KiB
JavaScript

import defined from "../Core/defined.js";
/**
* @private
*/
function Cesium3DTileStyleEngine() {
this._style = undefined; // The style provided by the user
this._styleDirty = false; // true when the style is reassigned
this._lastStyleTime = 0; // The "time" when the last style was assigned
}
Object.defineProperties(Cesium3DTileStyleEngine.prototype, {
style: {
get: function () {
return this._style;
},
set: function (value) {
if (value === this._style) {
return;
}
this._style = value;
this._styleDirty = true;
},
},
});
Cesium3DTileStyleEngine.prototype.makeDirty = function () {
this._styleDirty = true;
};
Cesium3DTileStyleEngine.prototype.resetDirty = function () {
this._styleDirty = false;
};
Cesium3DTileStyleEngine.prototype.applyStyle = function (tileset) {
if (!defined(tileset.root)) {
return;
}
if (defined(this._style) && !this._style._ready) {
return;
}
const styleDirty = this._styleDirty;
if (styleDirty) {
// Increase "time", so the style is applied to all visible tiles
++this._lastStyleTime;
}
const lastStyleTime = this._lastStyleTime;
const statistics = tileset._statistics;
// If a new style was assigned, loop through all the visible tiles; otherwise, loop through
// only the tiles that are newly visible, i.e., they are visible this frame, but were not
// visible last frame. In many cases, the newly selected tiles list will be short or empty.
const tiles = styleDirty
? tileset._selectedTiles
: tileset._selectedTilesToStyle;
// PERFORMANCE_IDEA: does mouse-over picking basically trash this? We need to style on
// pick, for example, because a feature's show may be false.
const length = tiles.length;
for (let i = 0; i < length; ++i) {
const tile = tiles[i];
if (tile.lastStyleTime !== lastStyleTime) {
// Apply the style to this tile if it wasn't already applied because:
// 1) the user assigned a new style to the tileset
// 2) this tile is now visible, but it wasn't visible when the style was first assigned
const content = tile.content;
tile.lastStyleTime = lastStyleTime;
content.applyStyle(this._style);
statistics.numberOfFeaturesStyled += content.featuresLength;
++statistics.numberOfTilesStyled;
}
}
};
export default Cesium3DTileStyleEngine;