/** * * */ export type RuleOperatorType = string; export namespace RuleOperatorType { let BETWEEN: string; let EQUAL_TO: string; let GREATER_THAN: string; let GREATER_THAN_OR_EQUAL_TO: string; let LESSER_THAN: string; let LESSER_THAN_OR_EQUAL_TO: string; let LIKE: string; let NOT_EQUAL_TO: string; } /** * * */ export type RuleSpatialOperatorType = string; export namespace RuleSpatialOperatorType { let CONTAINS: string; let INTERSECTS: string; let WITHIN: string; } /** * * */ export type RuleTemporalOperatorType = string; export namespace RuleTemporalOperatorType { let BEGINS: string; let DURING: string; let ENDS: string; let EQUALS: string; } /** * @hidden */ export default class Rule { /** * The abstract class for all filter rules. * * Rules are used to define filters that can be applied on data sources. * A rule is usually a combination of 3 things: * * - a property name, for example 'city_name' * - an operator, for example 'is equal to' * - and an literal, for example 'Chicoutimi'. * * A rule is useful to hold those properties and change them on the fly. * For example, changing an operator from 'is equal to' to 'like'. * * Also, a rule is especially useful for its `value` getter, which returns * the combination of properties described above or `null` if there are some * missing. The `value` getter can be watched and used when the value is * not null. * * When the operator is `between`, the `lowerBoundary` and `upperBoundary` * properties are used instead of `literal`. * * @param {RuleOptions} options Options. */ constructor(options: RuleOptions); /** * Whether the rule is active or not. Used by the `ngeo-rule` component. * Defaults to `false`. * * @type {boolean} */ active: boolean; /** * The literal of the rule. The literal and boundaries are mutually * exclusives. * * @type {?number|string|string[]} * @protected */ protected literal_: (number | string | string[]) | null; /** * The lower boundary of the rule. The literal and boundaries are * mutually exclusives. * * @type {?number} */ lowerBoundary: number | null; /** * The rule operator. * * @type {?string} */ operator: string | null; /** * The upper boundary of the rule. The literal and boundaries are * mutually exclusives. * * @type {?number} */ upperBoundary: number | null; /** * Whether the rule is a custom one or not. * * @type {boolean} * @private */ private isCustom_; /** * The human-readable name of the rule. * * @type {string} * @private */ private name_; /** * A list of rule operators. * * @type {?string[]} * @private */ private operators_; /** * The property name (a.k.a. the attribute name). * * @type {string} * @private */ private propertyName_; /** * The type of rule. * * @type {string} * @private */ private type_; /** * @type {import('ol/events').EventsKey[]} * @protected */ protected listenerKeys: import("ol/events").EventsKey[]; /** * @param {?number|string|string[]} literal Literal */ set literal(literal: (number | string | string[]) | null); /** * @returns {?number|string|string[]} Literal */ get literal(): (number | string | string[]) | null; /** * @returns {boolean} Is custom. */ get isCustom(): boolean; /** * @returns {string} name */ get name(): string; /** * @returns {?string[]} Operators */ get operators(): string[] | null; /** * @returns {string} Property name */ get propertyName(): string; /** * @returns {string} Type */ get type(): string; /** * @returns {?RuleSimpleValue|RuleRangeValue} Value. */ get value(): (RuleSimpleValue | RuleRangeValue) | null; /** * Reset the following properties to `null`: literal, lowerBoundary, * upperBoundary. */ reset(): void; /** */ destroy(): void; } export type RuleOptions = { /** * Whether the rule is active or not. Used by the `ngeo-rule` component. */ active?: boolean; /** * Deprecated. Use literal instead. Kept for compatibility with saved filters. */ expression?: number | string; /** * The literal of the rule. The literal and boundaries are * mutually exclusives. */ literal?: number | string | string[]; /** * Whether the rule is a custom one or not. Defaults to `true`. */ isCustom?: boolean; /** * The lower boundary of the rule. The literal and boundaries are * mutually exclusives. */ lowerBoundary?: number; /** * The human-readable name of the rule. */ name: string; /** * The rule operator. */ operator?: string; /** * The rule operators. */ operators?: string[]; /** * The property name (a.k.a. the attribute name). */ propertyName: string; /** * The type of rule. */ type?: string; /** * The upper boundary of the rule. The literal and boundaries are * mutually exclusives. */ upperBoundary?: number; }; export type RuleBaseValue = { /** * The operator of the rule value. */ operator: string; /** * The property name of the rule value */ propertyName: string; }; export type RuleSimpleValue = { /** * The literal of the rule value. * extends RuleBaseValue */ literal: number | string | string[]; /** * The operator of the rule value. */ operator: string; /** * The property name of the rule value */ propertyName: string; }; export type RuleRangeValue = { /** * The lower boundary of the rule value. */ lowerBoundary: number; /** * The upper boundary of the rule value. * extends RuleBaseValue */ upperBoundary: number; /** * The operator of the rule value. */ operator: string; /** * The property name of the rule value */ propertyName: string; };