| 53 | let layerIdCounter = 0; |
| 54 | |
| 55 | export default class BaseLayer<ChildLayerStyleOptions = {}> |
| 56 | extends EventEmitter<LayerEventType> |
| 57 | implements ILayer |
| 58 | { |
| 59 | public id: string = `${layerIdCounter++}`; |
| 60 | public name: string = `${layerIdCounter}`; |
| 61 | public parent: ILayer; |
| 62 | public coordCenter: number[]; |
| 63 | public type: string; |
| 64 | public visible: boolean = true; |
| 65 | public zIndex: number = 0; |
| 66 | public minZoom: number; |
| 67 | public maxZoom: number; |
| 68 | public inited: boolean = false; |
| 69 | public layerModelNeedUpdate: boolean = false; |
| 70 | public pickedFeatureID: number | null = null; |
| 71 | public selectedFeatureID: number | null = null; |
| 72 | public styleNeedUpdate: boolean = false; |
| 73 | public rendering: boolean; |
| 74 | public forceRender: boolean = false; |
| 75 | public clusterZoom: number = 0; // 聚合等级标记 |
| 76 | public layerType?: string | undefined; |
| 77 | public triangulation?: Triangulation | undefined; |
| 78 | public layerPickService: ILayerPickService; |
| 79 | public textureService: ITextureService; |
| 80 | |
| 81 | public defaultSourceConfig: { |
| 82 | data: any[]; |
| 83 | options: ISourceCFG | undefined; |
| 84 | } = { |
| 85 | data: [], |
| 86 | options: { |
| 87 | parser: { |
| 88 | type: 'json', |
| 89 | }, |
| 90 | }, |
| 91 | }; |
| 92 | |
| 93 | public dataState: IDataState = { |
| 94 | dataSourceNeedUpdate: false, |
| 95 | dataMappingNeedUpdate: false, |
| 96 | filterNeedUpdate: false, |
| 97 | featureScaleNeedUpdate: false, |
| 98 | StyleAttrNeedUpdate: false, |
| 99 | }; |
| 100 | // 生命周期钩子 |
| 101 | public hooks = { |
| 102 | init: new AsyncSeriesBailHook(), |
| 103 | afterInit: new SyncBailHook(), |
| 104 | beforeRender: new SyncBailHook(), |
| 105 | beforeRenderData: new AsyncWaterfallHook(), |
| 106 | afterRender: new SyncHook(), |
| 107 | beforePickingEncode: new SyncHook(), |
| 108 | afterPickingEncode: new SyncHook(), |
| 109 | beforeHighlight: new SyncHook(['pickedColor']), |
| 110 | afterHighlight: new SyncHook(), |
| 111 | beforeSelect: new SyncHook(['pickedColor']), |
| 112 | afterSelect: new SyncHook(), |
nothing calls this directly
no test coverage detected