新增自定义颜色方案
This commit is contained in:
@@ -11,9 +11,18 @@ export class DeckLayer extends Layer {
|
||||
private onVisibilityChange?: (layerId: string, visible: boolean) => void;
|
||||
private userVisibility: Map<string, boolean> = new Map(); // 存储用户设置的可见性
|
||||
|
||||
constructor(deckInstance: Deck) {
|
||||
super({});
|
||||
/**
|
||||
* @param deckInstance deck.gl 实例
|
||||
* @param layerProperties 可选:在构造时直接设置到 OpenLayers Layer 的 properties
|
||||
*/
|
||||
constructor(deckInstance: Deck, layerProperties?: Record<string, any>) {
|
||||
// 将 layerProperties 作为 Layer 的 properties 传入
|
||||
super({ properties: layerProperties || {} });
|
||||
this.deck = deckInstance;
|
||||
// 再次确保属性应用到实例(兼容场景)
|
||||
if (layerProperties) {
|
||||
this.setProperties(layerProperties);
|
||||
}
|
||||
}
|
||||
|
||||
// 设置可见性变化回调
|
||||
@@ -118,4 +127,9 @@ export class DeckLayer extends Layer {
|
||||
this.setDeckLayerVisible(layerId, !currentVisible);
|
||||
}
|
||||
}
|
||||
|
||||
// 可选的封装:在外部用更语义化的方式设置属性(内部可直接调用 setProperties)
|
||||
setLayerProperties(props: Record<string, any>): void {
|
||||
this.setProperties(props);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user