/// import { EventEmitter } from "events"; import { IFeature, Feature } from "ginkgoch-geom"; import Shp from "../shp/Shp"; import Dbf from "../dbf/Dbf"; import DbfField from '../dbf/DbfField'; import OpenerSync from "../base/OpenerSync"; import Optional from "../base/Optional"; import IQueryFilter from "../shared/IQueryFilter"; import ShapefileIterator from "./ShapefileIterator"; import { ShapefileType } from "../shared"; import ShpHeader from '../shp/ShpHeader'; /** * The Shapefile class. */ export default class Shapefile extends OpenerSync { filePath: string; _flag: string; _shp: Optional; _dbf: Optional; _eventEmitter: EventEmitter | undefined; /** * Creates a Shapefile instance. * @constructor * @param {*} filePath The shapefile file path. */ constructor(filePath: string, flag?: string); get eventEmitter(): EventEmitter | undefined; set eventEmitter(v: EventEmitter | undefined); /** * Opens the related resources and get ready for reading records. * @override */ _open(): void; /** * Closes the related resources and release the file handlers. * @override */ _close(): void; /** * Gets the header detail of the shapefile. * @returns The header of shapefile. */ header(): ShpHeader | undefined; /** * Gets the envelope of the shapefile. * @returns The envelope of shapefile. */ envelope(): import("ginkgoch-geom").Envelope; /** * Gets the fields detail of the shapefile. * @param {boolean} detail Indicates whether to show field details (name, type, length, decimal) or not. Default to false. * @returns The fields of shapefile. */ fields(detail?: boolean): string[] | DbfField[]; /** * Gets the iterator of the shapefile. Used to loop all the records in flow mode. * @param {*} filter Indicates the filter for iterating the records. Allows to filter with fields and envelopes. * @returns The iterator for looping records of shapefile. */ iterator(filter?: IQueryFilter): ShapefileIterator; /** * Gets the record count of shapefile. * @returns The count of shapefile. */ count(): number; shapeType(): ShapefileType; /** * Gets shapefile record by a specified id, and returns with the given fields. If fields is not indicated, all fields will be fetched. * @param {number} id The record id. Starts from 1. * @param {undefined|Array|'all'|'none'} fields The fields that will be fetch from DBF file. * @returns The record that contains the required id. */ get(id: number, fields?: string[] | 'all' | 'none'): Feature | null; records(filter?: IQueryFilter): Array; push(feature: IFeature): void; update(feature: IFeature, target?: 'all' | 'geom' | 'properties'): void; /** * Remove shapefile record by id. * @param id The id to remove. Starts from 1. */ remove(id: number): void; pushField(field: DbfField): void; removeField(fieldName: string): void; updateField(fieldName: string, newField: DbfField): void; flushFields(): void; /** * Creates an empty shapefile as well as its shape index file and d-base file. * @param {string} filePath The shapefile path. File path extension must be '.shp'. * @param {ShapefileType} fileType The geometry type that this new shapefile maintains. * @param {DbfField[]} fields The fields info of the d-base file. * @static */ static createEmpty(filePath: string, fileType: ShapefileType, fields: DbfField[]): Shapefile; /** * Copy the shp, shx and dbf files as another filename. */ static copyFiles(sourceFilename: string, targetFilename: string, overwrite?: boolean): void; /** * @private * @param {*} fields The fields filter could be 'all', 'none', Array. - field names. Default value is 'all' which means returns all fields. */ _normalizeFields(fields?: 'all' | 'none' | string[]): string[]; } //# sourceMappingURL=Shapefile.d.ts.map