import { InstanceAPI, LayerInstance } from '../../api/internal'; import { DefPromise, DrawState, Extent, Graphic, InitiationState, LayerState, TreeNode, Attributes, AttributeSet, GetGraphicParams, RampLayerConfig, RampLayerMapImageSublayerConfig, TabularAttributeSet } from '../api'; import { EsriArcadeExecutor } from '../esri'; declare const enum TimerType { DRAW = "draw", LOAD = "load" } /** * A common layer class which is inherited by all layer classes. */ export declare class CommonLayer extends LayerInstance { /** * Tracks load and draw elapsed time */ timers: { draw: number | undefined; load: number | undefined; }; protected origRampConfig: RampLayerConfig; /** * A deferred promise that resolves when layer is fully ready and safe to use. for convenience of caller */ protected loadDefProm: DefPromise; /** * A boolean to track whether the promise is pending (false) or fulfilled/rejected (true) */ protected loadPromDone: boolean; protected layerTree: TreeNode; /** * Internally tracks any arcade formula for the name value. */ protected nameArcadeFormula: string; /** * The name arcade executor if a name formula is defined */ protected nameArcadeExecutor: EsriArcadeExecutor | undefined; /** * Internally tracks any arcade formula for the maptip value. */ protected maptipArcadeFormula: string; /** * The maptip arcade executor if a maptip formula is defined */ protected maptipArcadeExecutor: EsriArcadeExecutor | undefined; protected constructor(rampConfig: RampLayerConfig, $iApi: InstanceAPI); updateInitiationState(newState: InitiationState): void; updateLayerState(newState: LayerState, userCancel?: boolean): void; updateDrawState(newState: DrawState): void; initiate(): Promise; protected onInitiate(): Promise; terminate(): Promise; onLoad(): void; onError(genuineError?: boolean): void; /** * Performs setup on the layer that needs to occur after initialization and * the esri layer (if a map layer) loads, but before we mark the layer as loaded. * Any async tasks must include their promise in the return array. * * @private * @returns {Array>} List of things to wait on. */ protected onLoadActions(): Array>; cancelLoad(): void; loadPromise(): Promise; get isLoaded(): boolean; /** * Indicates if layer should participate in an identify request. */ canIdentify(): boolean; /** * Provides a tree structure describing the layer and any sublayers, * including uid values. Should only be called after loadPromise resolves. * * @method getLayerTree * @returns {TreeNode} the root of the layer tree */ getLayerTree(): TreeNode; protected stubError(): void; /** * Invokes the process to get the full set of attribute values for the layer. * Repeat calls will re-use the downloaded values unless the values have been explicitly cleared. * * @returns {Promise} resolves with set of attribute values */ getAttributes(): Promise; abortAttributeLoad(): void; clearFeatureCache(): void; getTabularAttributes(): Promise; /** * Gets information on a graphic in the most efficient way possible. Options object properties: * - getGeom ; a boolean to indicate if the result should include graphic geometry * - getAttribs ; a boolean to indicate if the result should include graphic attributes * - getStyle ; a boolean to indicate if the result should include symbol styling information * * @param {Integer} objectId the object id of the graphic to find * @param {Object} options options object for the request, see above * @returns {Promise} resolves with a Graphic containing the requested information */ getGraphic(objectId: number, options: GetGraphicParams): Promise; getIcon(objectId: number): Promise; getSqlFilter(filterKey: string): string; setSqlFilter(filterKey: string, whereClause: string): void; getFilterOIDs(exclusions?: Array, extent?: Extent | undefined): Promise | undefined>; getGraphicExtent(objectId: number): Promise; applySqlFilter(exclusions?: Array): void; /** * Add a WMS layer parameter, maybe even refresh the layer * * @function setCustomParameter * @param {String} key name of the key to be created or updated * @param {String} value value of the key * @param {Boolean} forceRefresh show the new fancy version of the layer or not */ setCustomParameter(key: string, value: string, forceRefresh?: boolean): void; /** * Start the draw/load timer for the layer, after which is a slow to load/draw notification is shown. * @param type the type of timer to start (load or draw) */ protected startTimer(type: TimerType): void; /** * Stop the draw/load timer for the layer, if it was started. * @param type the type of timer to stop (load or draw) */ protected stopTimer(type: TimerType): void; /** * Will create an arcade formula executor valid for this layer * * @param formula an arcade formula * @returns resolves with an arcade executor object */ private arcadeGenerator; get nameArcade(): string; setNameArcade(formula: string): Promise; /** * Handles initialization logic for feature names. * Only valid for layers that support attributes. * Typically called by internal processes. * * @param config a ramp layer configuration object. Can pass empty object if n/a. * @param serviceDefault name field as defined by the layer service. Not required */ nameInitializer(config: RampLayerConfig | RampLayerMapImageSublayerConfig, serviceDefault?: string): Promise; nameValue(attributes: Attributes): string; get maptipArcade(): string; setMaptipArcade(formula: string): Promise; /** * DEPRECIATED #2595 * Use maptipInitializer */ tooltipInitializer(config: RampLayerConfig | RampLayerMapImageSublayerConfig): Promise; /** * Handles initialization logic for feature maptips. * Only valid for layers that support attributes. * Needs to be called after nameInitializer to ensure correct fallback defaults. * Typically called by internal processes. * * @param config a ramp layer configuration object. Can pass empty object if n/a. */ maptipInitializer(config: RampLayerConfig | RampLayerMapImageSublayerConfig): Promise; maptipValue(attributes: Attributes): string; } export {};