import Coordinate, { CoordinateLike } from './Coordinate'; import Point from './Point'; import Size from './Size'; import type PointExtent from './PointExtent'; import type { WithNull } from '../types/typings'; export type Projection = any; export type PositionType = Point | Coordinate; export type ArrayExtent = [number, number, number, number]; export type JsonExtent = { xmin: number; xmax: number; ymin: number; ymax: number; }; export type ExtentLike = Extent | JsonExtent | ArrayExtent; export interface Constructable { new (p1?: WithNull, p?: Projection): T; new (p1: PositionType, p2: PositionType, p?: Projection): T; new (p1: number, p2: number, p3: number, p4: number, p?: Projection): T; } /** * 表示地图上的边界框,即具有最小和最大坐标的矩形地理区域。
* 有多种方法可以创建范围: * * @english * * Represent a bounding box on the map, a rectangular geographical area with minimum and maximum coordinates.
* There are serveral ways to create a extent: * @category basic types * @example * * ```ts * //with 4 numbers: xmin, ymin, xmax and ymax * var extent = new Extent(100, 10, 120, 20); * * //with 2 coordinates * var extent = new Extent(new Coordinate(100, 10), new Coordinate(120, 20)); * * //with a json object containing xmin, ymin, xmax and ymax * var extent = new Extent({xmin : 100, ymin: 10, xmax: 120, ymax:20}); * * var extent1 = new Extent(100, 10, 120, 20); * //with another extent * var extent2 = new Extent(extent1); * ``` */ declare class Extent { _clazz: typeof Coordinate | typeof Point; _dirty: boolean; projection: any; xmin: WithNull; xmax: WithNull; ymin: WithNull; ymax: WithNull; pxmin: number; pxmax: number; pymin: number; pymax: number; left?: number; right?: number; top?: number; bottom?: number; antiMeridian?: boolean; zmin?: number; zmax?: number; constructor(p1?: WithNull, p?: Projection); constructor(p1: PositionType, p2: PositionType, p?: Projection); constructor(p1: number, p2: number, p3: number, p4: number, p?: Projection); _initialize(p1: WithNull): void; _initialize(p1: PositionType, p2: PositionType): void; _initialize(p1: number, p2: number, p3: number, p4: number): void; /** * 与坐标或点相加, 会改变原数据 * * @english * * Add the extent with a coordinate or a point. * @returns a new extent * @param p */ _add(p: Extent): this; _add(p: PointExtent): this; _add(p: PositionType): this; _add(p: number[]): this; /** * 与坐标或点相加, 返回一个新的 extent * * @english * * Add the extent with a coordinate or a point. * @returns a new extent * @param p */ add(p: Extent): this; add(p: PointExtent): this; add(p: PositionType): this; add(p: number[]): this; /** * 缩放当前 extent * * @english * * scale extent * * @param s */ _scale(s: number): this; /** * 当前范围减去 coordinate、point 或者 extent(改变原数据) * * @english * * Substract the extent with a coordinate or a point. * @param p */ _sub(p: [number, number]): this; _sub(p: PositionType): this; _sub(p: Extent | PointExtent): this; /** * _sub 的别名 * * @english * * Alias for _sub * @param p */ _substract(p: [number, number]): this; _substract(p: PositionType): this; _substract(p: Extent | PointExtent): this; /** * 当前范围减去 coordinate 或者 point * * @english * * Substract the extent with a coordinate or a point. * @returns a new extent * @param p */ sub(p: [number, number]): this; sub(p: PositionType): this; sub(p: Extent | PointExtent): this; /** * sub 的别名 * * @english * * Alias for sub * @returns a new extent * @param p */ substract(p: [number, number]): this; substract(p: PositionType): this; substract(p: Extent | PointExtent): this; /** * 对 Extent 边界值进行四舍五入,返回一个新的 Extent * * @english * * Round the extent * @returns rounded extent */ round(): PointExtent | Extent; /** * 对当前 Extent 边界值进行四舍五入 * * @english * * Round the extent * @returns rounded extent */ _round(): this; /** * 获取 Extent 的最小点 * * @english * Get the minimum point * @params [out=undefined] - optional point to receive result */ getMin(out?: Point): Point; getMin(out?: Coordinate): Coordinate; /** * 获取 Extent 的最大点 * * @english * Get the maximum point * @params [out=undefined] - optional point to receive result */ getMax(out?: Point): Point; getMax(out?: Coordinate): Coordinate; /** * 获取 Extent 的中心点 * * @english * Get center of the extent. * @params [out=undefined] - optional point to receive result */ getCenter(out?: PositionType): PositionType; /** * 检查 Extent 是否有效 * * @english * Whether the extent is valid * @protected */ isValid(): boolean; /** * 与另一个 extent 进行比较它们是否相等 * * @english * * Compare with another extent to see whether they are equal. * @param ext2 - extent to compare */ equals(ext2: Extent | PointExtent): boolean; /** * 是否与另一个范围相交 * @english * * Whether it intersects with another extent * @param ext2 - another extent */ intersects(ext2: Extent | PointExtent): boolean; /** * 判断当前 extent 是否在其他 extent 范围内 * @english * * Whether the extent is within another extent * @param extent - another extent */ within(extent: Extent | PointExtent): boolean; /** * 该范围是否包含输入点 * @english * Whether the extent contains the input point. * @param c - input point */ contains(c: CoordinateLike): boolean; /** * 获取Extent的宽度 * * @english * Get the width of the Extent */ getWidth(): number; /** * 获取Extent的高度 * * @english * Get the height of the Extent */ getHeight(): number; /** * 获取Extent的大小 - 高度和宽度构造的 Size 对象 * * @english * Get size of the Extent */ getSize(): Size; /** * 设置 extent 的边界值 * * @english * * set extent value * * @param xmin * @param ymin * @param xmax * @param ymax */ set(xmin: WithNull, ymin: WithNull, xmax: WithNull, ymax: WithNull): this; __combine(extent: PositionType | Extent | PointExtent): number[]; /** * 与其他 extent 合并 * @english * Combine it with another extent to a larger extent. * @param extent - extent/coordinate/point to combine into * @returns extent combined */ _combine(extent: PositionType | Extent | PointExtent): this; /** * 与其他 extent 合并到一个更大的 extent,返回一个新 extent * @english * Combine it with another extent to a larger extent. * @param extent - extent/coordinate/point to combine into * @returns extent combined */ combine(extent: PositionType | Extent | PointExtent): any; /** * 获取当前 extent 与另一个 extent 的交集范围 * * @english * * Gets the intersection extent of this and another extent. * @param extent - another extent * @returns intersection extent */ intersection(extent: Extent | PointExtent): any; /** * 扩大 extent,返回一个新 Extent * @english * * Expand the extent by distance * @param distance - distance to expand * @returns a new extent expanded from */ expand(distance: number | Size): PointExtent | Extent; /** * 扩大 extent * @english * Expand the extent by distance * @param distance - distance to expand */ _expand(distance: number | Size): this; /** * 获取 extent 的 JSON 对象。 * * @english * Get extent's JSON object. * @returns jsonObject * @example * * ```ts * // {xmin : 100, ymin: 10, xmax: 120, ymax:20} * var json = extent.toJSON(); * ``` */ toJSON(): JsonExtent; /** * 获取extent矩形区域的坐标数组,包含5个坐标,第一个坐标与最后一个坐标相等。 * @english * Get a coordinate array of extent's rectangle area, containing 5 coordinates in which the first equals with the last. * @returns coordinates array */ toArray(out?: PositionType[]): PositionType[]; toBBOX(): number[]; /** * 获取 extent 的 xmin、ymin、xmax、ymax 组成的字符串 * * @english * * Get the string consisting of xmin, ymin, xmax, and ymax of extent */ toString(): string; /** * 复制 extent * * @english * * Get a copy of the extent. * @returns copy */ copy(): PointExtent | Extent; /** * 转换到新的 extent * * @english * * Convert to a new extent * @param fn convert function on each point * @param out temp out */ convertTo(fn: (p: Point) => Point, out?: Extent | PointExtent): Extent | PointExtent; convertTo(fn: (p: Coordinate) => Coordinate, out?: Extent | PointExtent): Extent | PointExtent; /** * 计算给定 Extent 的投影范围 * * @english * * Calculate the projected range of the given Extent * @param ext extent */ _project(ext: Extent | PointExtent): void; } export default Extent; export declare function combineExtentAltitude(extent1: Extent, extent2: Extent): Extent; //# sourceMappingURL=Extent.d.ts.map