import type OlFeature from 'ol/Feature.js'; /** * Represents a grid data organized by unique ids. */ export type GridDataById = Record; /** * Represents the data structure for a grid, based on multiple features * for a same ID (and with a same structure, geom type and properties). * - Columns are every (not ol) features properties name; * - Data are every (not ol) features properties values; * - Features are every Ol features (backref); * - notOlProperties are every property but without ol specific one. */ export interface GridData { columns: string[]; data: unknown[][]; features: OlFeature[]; notOlProperties: Record[]; } /** * Options for converting feature data to grid data. */ export interface FeatureToGridDataOptions { /** Determines whether to keep the geometry property as a property value. */ keepGeomProperty?: boolean; /** Determines whether to keep (always) empty columns or not in columns and data. */ removeEmptyColumns?: boolean; } /** * A feature-to-grid data converter, to show feature's properties in grid-like system. */ export default class FeatureToGridDataById { options: FeatureToGridDataOptions; constructor(options: FeatureToGridDataOptions); /** * Takes an array of OpenLayers features and converts them into a grid data object, where each feature * is mapped by its ID as the key. * @returns The grid data objects, by id. */ toGridDataById(features: OlFeature[]): GridDataById; /** * @returns a gridDataByID for a single converted OL feature. * @private */ private addFeatureToGridDataById; /** * @returns {GridData} A new empty grid data object with columns from given properties. * @static */ private static createGridDataWithColumns; /** * Removes empty columns (columns and data) from a given gridData object. * It's expected that all features in the gridData have the same properties. * @static */ private static removeEmptyColumns; /** * This method finds the indexes of empty columns in a given 2D array. * @param data - The 2D array to search for empty columns. * @returns An array of indexes representing the empty columns. * @static */ private static findEmptyColumnIndexOf; static getUserFeatureType(feature: OlFeature): string; }