UNPKG

@types/jsts

Version:
1,132 lines (1,037 loc) 195 kB
/// <reference types="openlayers" /> declare namespace jsts { export var version: string; namespace algorithm { import Point = jsts.geom.Point; import Coordinate = jsts.geom.Coordinate; import Geometry = jsts.geom.Geometry; import GeometryFactory = jsts.geom.GeometryFactory; import PrecisionModel = jsts.geom.PrecisionModel; export class Orientation { static CLOCKWISE: number; static RIGHT: number; static COUNTERCLOCKWISE: number; static LEFT: number; static COLLINEAR: number; static STRAIGHT: number; static index(p1: Point, p2: Point, q: Point): number; static isCCW(ring: Coordinate[]): boolean; } export class BoundaryNodeRule {} /** * Computes the convex hull of a Geometry. * The convex hull is the smallest convex Geometry that contains * all the points in the input Geometry. * Uses the Graham Scan algorithm. */ export class ConvexHull { /** * Create a new convex hull construction for the input Coordinate array. */ constructor(pts: Coordinate[], geomFactory: GeometryFactory); /** * Create a new convex hull construction for the input Geometry. */ constructor(geometry: Geometry); /** * Returns a Geometry that represents the convex hull of the input geometry. * The returned geometry contains the minimal number of points needed * to represent the convex hull. In particular, * no more than two consecutive points will be collinear. * * @returns if the convex hull contains 3 or more points, a Polygon; * 2 points, a LineString; 1 point, a Point; 0 points, an empty GeometryCollection. */ getConvexHull(): Geometry; } /** * Computes a point in the interior of an areal geometry. * The point will lie in the geometry interior in all except certain pathological cases. * * KNOWN BUGS * If a fixed precision model is used, in some cases this method * may return a point which does not lie in the interior. * If the input polygon is extremely narrow the computed point * may not lie in the interior of the polygon. */ export class InteriorPointArea { /** * Creates a new interior point finder for an areal geometry. */ constructor(g: Geometry); /** * Computes an interior point for the polygonal components of a Geometry. * * @param geom the geometry to compute * @returns the computed interior point, or null if the geometry has no polygonal components */ static getInteriorPoint(geom: Geometry): Coordinate | null; /** * Gets the computed interior point. * * @returns the coordinate of an interior point or null if the input geometry is empty */ getInteriorPoint(): Coordinate | null; } /** * A LineIntersector is an algorithm that can both test whether * two line segments intersect and compute the intersection point(s) if they do. * * There are three possible outcomes when determining whether two line segments intersect: * NO_INTERSECTION - the segments do not intersect * POINT_INTERSECTION - the segments intersect in a single point * COLLINEAR_INTERSECTION - the segments are collinear and they intersect in a line segment * * For segments which intersect in a single point, the point may be either an endpoint * or in the interior of each segment. * If the point lies in the interior of both segments, * this is termed a proper intersection. The method isProper() test for this situation. * * The intersection point(s) may be computed in a precise or non-precise manner. * Computing an intersection point precisely involves rounding it via a supplied PrecisionModel. * * LineIntersectors do not perform an initial envelope intersection test to determine * if the segments are disjoint. This is because this class is likely to be used * in a context where envelope overlap is already known to occur (or be likely). */ export class LineIntersector { /** */ static COLLINEAR: number; /** * Indicates that line segments intersect in a line segment */ static COLLINEAR_INTERSECTION: number; /** */ static DO_INTERSECT: number; /** * These are deprecated, due to ambiguous naming */ static DONT_INTERSECT: number; /** * Indicates that line segments do not intersect */ static NO_INTERSECTION: number; /** * Indicates that line segments intersect in a single point */ static POINT_INTERSECTION: number; /** */ constructor(); /** * Computes the "edge distance" of an intersection point p along a segment. * The edge distance is a metric of the point along the edge. * The metric used is a robust and easy to compute metric function. * It is not equivalent to the usual Euclidean metric. * It relies on the fact that either the x or the y ordinates of the points * in the edge are unique, depending on whether the edge is longer * in the horizontal or vertical direction. * * NOTE: This function may produce incorrect distances for inputs * where p is not precisely on p1-p2 * (E.g. p = (139,9) p1 = (139,10), p2 = (280,1) produces distance 0.0, which is incorrect. * My hypothesis is that the function is safe to use for points which are * the result of rounding points which lie on the line, * but not safe to use for truncated points. */ static computeEdgeDistance(p: Coordinate, p0: Coordinate, p1: Coordinate): number; /** * This function is non-robust, since it may compute the square of large numbers. * Currently not sure how to improve this. */ static nonRobustComputeEdgeDistance(p: Coordinate, p1: Coordinate, p2: Coordinate): number; /** * Force computed intersection to be rounded to a given precision model. * No getter is provided, because the precision model is not required to be specified. */ setPrecisionModel(precisionModel: PrecisionModel): void; /** * Gets an endpoint of an input segment. * @param {int} segmentIndex the index of the input segment (0 or 1) * @param {int} ptIndex the index of the endpoint (0 or 1) * @returns the specified endpoint */ getEndpoint(segmentIndex: number, ptIndex: number): Coordinate; /** * Computes the intersection of the lines p1-p2 and p3-p4. * This function computes both the boolean value of the hasIntersection test * and the (approximate) value of the intersection point itself (if there is one). */ computeIntersection(p1: Coordinate, p2: Coordinate, p3: Coordinate, p4: Coordinate): void; toString(): string; /** * Tests whether the input geometries intersect. * * @returns true if the input geometries intersect */ hasIntersection(): boolean; /** * Returns the number of intersection points found. This will be either 0, 1 or 2. * @returns {int} the number of intersection points found (0, 1, or 2) */ getIntersectionNum(): number; /** * @param {int} intIndex is 0 or 1 * @returns the intIndex'th intersection point */ getIntersection(intIndex: number): Coordinate; /** * Test whether a point is a intersection point of two line segments. * Note that if the intersection is a line segment, this method only tests * for equality with the endpoints of the intersection segment. * It does not return true if the input point is internal to the intersection segment. * * @returns true if the input point is one of the intersection points. */ isIntersection(pt: Coordinate): boolean; /** * Tests whether either intersection point is an interior point of one of the input segments. * * @returns true if either intersection point is in the interior of one of the input segments */ isInteriorIntersection(): boolean; /** * Tests whether either intersection point is an interior point of the specified input segment. * @param {int} inputLineIndex * * @returns true if either intersection point is in the interior of the input segment */ isInteriorIntersection(inputLineIndex: number): boolean; /** * Tests whether an intersection is proper. * The intersection between two line segments is considered proper if they intersect * in a single point in the interior of both segments * (e.g. the intersection is a single point and is not equal to any of the endpoints). * The intersection between a point and a line segment is considered proper if * the point lies in the interior of the segment (e.g. is not equal to either of the endpoints). * * @returns true if the intersection is proper */ isProper(): boolean; /** * Computes the intIndex'th intersection point in the direction * of a specified input line segment * * @param {int} segmentIndex is 0 or 1 * @param {int} intIndex is 0 or 1 * * @returns the intIndex'th intersection point in the direction * of the specified input line segment */ getIntersectionAlongSegment(segmentIndex: number, intIndex: number): Coordinate; /** * Computes the index (order) of the intIndex'th intersection point * in the direction of a specified input line segment * * @param {int} segmentIndex is 0 or 1 * @param {int} intIndex is 0 or 1 * * @returns {int} the index of the intersection point along the input segment (0 or 1) */ getIndexAlongSegment(segmentIndex: number, intIndex: number): number; /** * Computes the "edge distance" of an intersection point * along the specified input line segment. * * @param {int} segmentIndex is 0 or 1 * @param {int} intIndex is 0 or 1 * * @returns {double} the edge distance of the intersection point */ getEdgeDistance(segmentIndex: number, intIndex: number): number; } /** * A robust version of {@link LineIntersector}. */ export class RobustLineIntersector extends LineIntersector { /** */ constructor(); /** * Compute the intersection of a point p and the line p1-p2. * This function computes the boolean value of the hasIntersection test. * The actual value of the intersection (if there is one) is equal to the value of p. */ computeIntersection(p: Coordinate, p1: Coordinate, p2: Coordinate): void; computeIntersection(p: Coordinate, p1: Coordinate, p2: Coordinate, p3: Coordinate): void; } namespace locate { import Polygon = jsts.geom.Polygon; /** * An interface for classes which determine the Location of points in a Geometry. */ interface PointOnGeometryLocator { /** * Determines the Location of a point in the Geometry. * * @param p the point to test * * @returns {int} the location of the point in the geometry */ locate(p: Coordinate): number; } /** * Computes the location of points relative to a Polygonal Geometry, * using a simple O(n) algorithm. * * The algorithm used reports if a point lies in the interior, exterior, * or exactly on the boundary of the Geometry. * * Instance methods are provided to implement the interface PointInAreaLocator. * However, they provide no performance advantage over the class methods. * * This algorithm is suitable for use in cases where only a few points will be tested. * If many points will be tested, IndexedPointInAreaLocator may provide better performance. */ export class SimplePointInAreaLocator implements PointOnGeometryLocator { /** * Create an instance of a point-in-area locator, using the provided areal geometry. */ constructor(geom: Geometry); /** * Determines the Location of a point in an areal Geometry. The return value is one of: * Location.INTERIOR if the point is in the geometry interior * Location.BOUNDARY if the point lies exactly on the boundary * Location.EXTERIOR if the point is outside the geometry * * @returns {int} the Location of the point in the geometry */ static locate(p: Coordinate, geom: Geometry): number; /** * Determines whether a point is contained in a Geometry, or lies on its boundary. * This is a convenience method for Location.EXTERIOR != locate(p, geom) */ static isContained(p: Coordinate, geom: Geometry): boolean; /** * Determines the Location of a point in a Polygon. The return value is one of: * - Location.INTERIOR if the point is in the geometry interior * - Location.BOUNDARY if the point lies exactly on the boundary * - Location.EXTERIOR if the point is outside the geometry * This method is provided for backwards compatibility only. Use locate(Coordinate, Geometry) instead. * * @param p {Coordinate} the point to test * @param poly {Polygon} the geometry to test * * @returns {int} the Location of the point in the polygon */ static locatePointInPolygon(p: Coordinate, poly: Polygon): number; /** * Determines whether a point lies in a Polygon. If the point lies on the polygon boundary it is considered to be inside. * * @param p {Coordinate} the point to test * @param poly {Polygon} the geometry to test * * @returns {boolean} true if the point lies in or on the polygon */ static containsPointInPolygon(p: Coordinate, poly: Polygon): boolean; /** * Determines the Location of a point in an areal Geometry. The return value is one of: * - Location.INTERIOR if the point is in the geometry interior * - Location.BOUNDARY if the point lies exactly on the boundary * - Location.EXTERIOR if the point is outside the geometry * * @param p {Coordinate} the point to test * * @returns {int} the Location of the point in the geometry */ locate(p: Coordinate): number; } } } namespace densify { import Geometry = jsts.geom.Geometry; /** * Densifies a Geometry by inserting extra vertices along the line segments * contained in the geometry. All segments in the created densified geometry * will be no longer than the given distance tolerance. * Densified polygonal geometries are guaranteed to be topologically correct. * The coordinates created during densification respect the input geometry's PrecisionModel. */ export class Densifier { /** * Creates a new densifier instance. */ constructor(inputGeom: Geometry); /** * Densifies a geometry using a given distance tolerance, * and respecting the input geometry's PrecisionModel. * * @param geom the geometry to densify * @param {double} distanceTolerance the distance tolerance to densify * * @returns the densified geometry */ static densify(geom: Geometry, distanceTolerance: number): Geometry; /** * Sets the distance tolerance for the densification. * All line segments in the densified geometry will be no longer than * the distance tolerance. simplified geometry will be within this distance * of the original geometry. The distance tolerance must be positive. * * @param {double} distanceTolerance the densification tolerance to use */ setDistanceTolerance(distanceTolerance: number): void; /** * Gets the densified geometry. */ getResultGeometry(): Geometry; } } namespace geom { /** * Specifies the precision model of the Coordinates in a Geometry. In other words, specifies the grid of allowable points for all Geometrys. * The makePrecise method allows rounding a coordinate to a "precise" value; that is, one whose precision is known exactly. * * Coordinates are assumed to be precise in geometries. That is, the coordinates are assumed to be rounded to the precision model given for the geometry. JTS input routines automatically round coordinates to the precision model before creating Geometries. All internal operations assume that coordinates are rounded to the precision model. Constructive methods (such as boolean operations) always round computed coordinates to the appropriate precision model. * * Currently one type of precision model are supported: * * FLOATING - represents full double precision floating point. * Coordinates are represented internally as Java double-precision values. Since Java uses the IEEE-754 floating point standard, this provides 53 bits of precision. * * JSTS methods currently do not handle inputs with different precision models. */ export class PrecisionModel { static FIXED: string; static FLOATING: string; static FLOATING_SINGLE: string; /** * @param modelType */ constructor(modelType?: number | string); } /** * Supplies a set of utility methods for building Geometry objects from lists * of Coordinates. * * Note that the factory constructor methods do <b>not</b> change the input * coordinates in any way. * * In particular, they are not rounded to the supplied <tt>PrecisionModel</tt>. * It is assumed that input Coordinates meet the given precision. */ export class GeometryFactory { /** * Constructs a GeometryFactory that generates Geometries having a floating PrecisionModel and a spatial-reference ID of 0. */ constructor(precisionModel?: PrecisionModel); createPointFromInternalCoord(coord: Coordinate, exemplar: Geometry): Point; /** * Creates a Geometry with the same extent as the given envelope. The Geometry returned is guaranteed to be valid. To provide this behaviour, the following cases occur: * * If the Envelope is: * - null : returns an empty Point * - a point : returns a non-empty Point * - a line : returns a two-point LineString * - a rectangle : returns a Polygon whose points are (minx, miny), (minx, maxy), (maxx, maxy), (maxx, miny), (minx, miny). * * @param {Envelope} envelope the Envelope to convert * * @returns {Geometry} an empty Point (for null Envelopes), a Point (when min x = max x and min y = max y) or a Polygon (in all other cases) */ toGeometry(envelope: Envelope): Geometry; /** * Returns the PrecisionModel that Geometries created by this factory will be associated with. * * @returns {PrecisionModel} the PrecisionModel for this factory */ getPrecisionModel(): PrecisionModel; /** * Constructs an empty LineString geometry. * * @returns an empty LineString */ createLineString(): LineString; /** * Creates a LineString using the given Coordinates; a null or empty array will * create an empty LineString. Consecutive points must not be equal. * * @param {Coordinate[]} * coordinates an array without null elements, or an empty array, or * null. * @return {LineString} A new LineString. */ createLineString(coordinates: Coordinate[]): LineString; /** * Creates a LineString using the given CoordinateSequence. * A null or empty CoordinateSequence creates an empty LineString. * * @param coordinates a CoordinateSequence (possibly empty), or null */ createLineString(coordinates: CoordinateSequence): LineString; /** * Constructs an empty Point geometry. * * @returns {Point} an empty Point */ createPoint(): Point; /** * Creates a Point using the given Coordinate; a null Coordinate will create an * empty Geometry. * * @param {Coordinate} * coordinate Coordinate to base this Point on. * @return {Point} A new Point. */ createPoint(coordinates: Coordinate): Point; /** * Creates a Point using the given CoordinateSequence; a null or empty CoordinateSequence will create an empty Point. * * @param {CoordinateSequence} coordinates a CoordinateSequence (possibly empty), or null * * @returns {Point} the created Point */ createPoint(coordinates: CoordinateSequence): Point; /** * Constructs an empty MultiPoint geometry. * * @returns an empty MultiPoint */ createMultiPoint(): MultiPoint; /** * Creates a MultiPoint using the given Points. A null or empty array will create an empty MultiPoint. * * @param point an array of Points (without null elements), or an empty array, or null * * @returns a MultiPoint object */ createMultiPoint(point: Point[]): MultiPoint; /** * @deprecated Deprecated. Use createMultiPointFromCoords(org.locationtech.jts.geom.Coordinate[]) instead * * Creates a MultiPoint using the given Coordinates. A null or empty array will create an empty MultiPoint. * * @param coordinates an array (without null elements), or an empty array, or null * * @returns a MultiPoint object */ createMultiPoint(coordinates: Coordinate[]): MultiPoint; /** * Creates a MultiPoint using the points in the given CoordinateSequence. * A null or empty CoordinateSequence creates an empty MultiPoint. * * @param coordinates a CoordinateSequence (possibly empty), or null * @returns a MultiPoint geometry */ createMultiPoint(coordinates: CoordinateSequence): MultiPoint; /** * Creates a MultiPoint using the given Coordinates. A null or empty array will create an empty MultiPoint. * * @param coordinates an array (without null elements), or an empty array, or null * * @returns a MultiPoint object */ createMultiPointFromCoords(coordinates: Coordinate[]): MultiPoint; /** * Constructs an empty LinearRing geometry. * * @returns an empty LinearRing */ createLinearRing(): LinearRing; /** * Creates a LinearRing using the given Coordinates; a null or empty array * will create an empty LinearRing. Consecutive points must not be equal. * * @param {Coordinate[]} * coordinates an array without null elements, or an empty array, * or null. * @return {LineString} A new LinearRing. */ createLinearRing(coordinates: Coordinate[]): LinearRing; /** * Creates a LinearRing using the given CoordinateSequence. * A null or empty array creates an empty LinearRing. * The points must form a closed and simple linestring. * * @param coordinates a CoordinateSequence (possibly empty), or null * * @returns the created LinearRing * * @throws {IllegalArgumentException} if the ring is not closed, or has too few points */ createLinearRing(coordinates: CoordinateSequence): LinearRing; /** * Creates a Polygon using the given LinearRing. * * @param {LinearRing} shell A LinearRing constructed by coordinates. * @return {Polygon} A new Polygon. */ createPolygon(shell: LinearRing, holes: LinearRing[]): Polygon; /** * Constructs a Polygon with the given exterior boundary. * * @param shell the outer boundary of the new Polygon, or null or an empty LinearRing if the empty geometry is to be created. * * @throws {IllegalArgumentException} if the boundary ring is invalid */ createPolygon(shell: CoordinateSequence): Polygon; /** * Constructs a Polygon with the given exterior boundary. * * @param shell the outer boundary of the new Polygon, or null or an empty LinearRing if the empty geometry is to be created. * * @throws {IllegalArgumentException} if the boundary ring is invalid */ createPolygon(shell: Coordinate[]): Polygon; /** * Constructs a Polygon with the given exterior boundary. * * @param shell the outer boundary of the new Polygon, or null or an empty LinearRing if the empty geometry is to be created. * * @throws {IllegalArgumentException} if the boundary ring is invalid */ createPolygon(shell: LinearRing): Polygon; /** * Constructs an empty Polygon geometry. * * @returns an empty polygon */ createPolygon(): Polygon; /** * Constructs an empty MultiPolygon geometry. * * @returns an empty MultiPolygon */ createMultiPolygon(): MultiPolygon; /** * Creates a MultiPolygon using the given Polygons; a null or empty array will create an empty Polygon. The polygons must conform to the assertions specified in the OpenGIS Simple Features Specification for SQL. * * @param polygons Polygons, each of which may be empty but not null * * @returns the created MultiPolygon */ createMultiPolygon(polygons: Polygon[]): MultiPolygon; /** * Constructs an empty MultiLineString geometry. * * @returns {MultiLineString} an empty MultiLineString */ createMultiLineString(): MultiLineString; /** * Creates a MultiLineString using the given LineStrings; a null or empty array will create an empty MultiLineString. * * @param lineStrings LineStrings, each of which may be empty but not null * * @returns the created MultiLineString */ createMultiLineString(lineStrings: LineString[]): MultiLineString; /** * Constructs an empty GeometryCollection geometry. * * @returns {GeometryCollection} an empty GeometryCollection */ createGeometryCollection(): GeometryCollection; /** * Creates a GeometryCollection using the given Geometries; a null or empty array will create an empty GeometryCollection. * * @param geometries an array of Geometries, each of which may be empty but not null, or null * * @returns the created GeometryCollection */ createGeometryCollection(geometries: Geometry[]): GeometryCollection; /** * Creates an empty atomic geometry of the given dimension. * If passed a dimension of -1 will create an empty GeometryCollection. * * @param {int} dimension the required dimension (-1, 0, 1 or 2) * * @returns an empty atomic geometry of given dimension */ createEmpty(dimension: number): Geometry; /** * Creates a deep copy of the input Geometry. * The CoordinateSequenceFactory defined for this factory is used * to copy the CoordinateSequences of the input geometry. * This is a convenient way to change the CoordinateSequence used to represent a geometry, * or to change the factory used for a geometry. * Geometry.copy() can also be used to make a deep copy, * but it does not allow changing the CoordinateSequence type. * * @returns a deep copy of the input geometry, using the CoordinateSequence type of this factory * * @see Geometry.copy() */ createGeometry(g: Geometry): Geometry; /** * Gets the SRID value defined for this factory. * * @returns {int} the factory SRID value */ getSRID(): number; getCoordinateSequenceFactory(): CoordinateSequenceFactory; } export class GeometryCollection extends jsts.geom.Geometry { constructor(geometries?: Geometry[], factory?: GeometryFactory); } /** * A lightweight class used to store coordinates on the 2-dimensional * Cartesian plane. It is distinct from {@link Point}, which is a subclass of * {@link Geometry}. Unlike objects of type {@link Point} (which contain * additional information such as an envelope, a precision model, and spatial * reference system information), a <code>Coordinate</code> only contains * coordinate values and accessor methods. */ export class Coordinate { /** */ constructor(x: number, y: number); /** */ constructor(c: Coordinate); /** */ constructor(); /** */ constructor(x: number, y: number, z: number); /** * Gets or sets the x value. */ x: number; /** * Gets or sets the y value. */ y: number; /** * Gets or sets the z value. */ z: number; /** * Sets this <code>Coordinate</code>s (x,y,z) values to that of * <code>other</code>. * * @param {Coordinate} * other the <code>Coordinate</code> to copy. */ setCoordinate(other: Coordinate): void; /** * Clones this instance. * * @return {Coordinate} A point instance cloned from this. */ clone(): Coordinate; /** * Computes the 2-dimensional Euclidean distance to another location. The * Z-ordinate is ignored. * * @param {Coordinate} * p a point. * @return {number} the 2-dimensional Euclidean distance between the * locations. */ distance(p: Coordinate): number; /** * Returns whether the planar projections of the two <code>Coordinate</code>s * are equal. * * @param {Coordinate} * other a <code>Coordinate</code> with which to do the 2D * comparison. * @return {boolean} <code>true</code> if the x- and y-coordinates are * equal; the z-coordinates do not have to be equal. */ equals2D(other: Coordinate): boolean; /** * Returns <code>true</code> if <code>other</code> has the same values for * the x and y ordinates. Since Coordinates are 2.5D, this routine ignores the * z value when making the comparison. * * @param {Coordinate} * other a <code>Coordinate</code> with which to do the comparison. * @return {boolean} <code>true</code> if <code>other</code> is a * <code>Coordinate</code> with the same values for the x and y * ordinates. */ equals(other: Coordinate): boolean; /** * Compares this {@link Coordinate} with the specified {@link Coordinate} for * order. This method ignores the z value when making the comparison. Returns: * <UL> * <LI> -1 : this.x < other.x || ((this.x == other.x) && (this.y < other.y)) * <LI> 0 : this.x == other.x && this.y = other.y * <LI> 1 : this.x > other.x || ((this.x == other.x) && (this.y > other.y)) * * </UL> * Note: This method assumes that ordinate values are valid numbers. NaN * values are not handled correctly. * * @param {Coordinate} * other the <code>Coordinate</code> with which this * <code>Coordinate</code> is being compared. * @return {number} -1, zero, or 1 as explained above. */ compareTo(other: Coordinate): number; } export class CoordinateSequence { static X: number; static Y: number; static Z: number; static M: number; } export interface CoordinateSequenceFactory { /** * Returns a CoordinateSequence based on the given array. * Whether the array is copied or simply referenced is implementation-dependent. * This method must handle null arguments by creating an empty sequence. * * @param coordinates the coordinates */ create(coordinates: Coordinate[]): CoordinateSequence; /** * Creates a CoordinateSequence which is a copy of the given CoordinateSequence. * This method must handle null arguments by creating an empty sequence. * * @param coordSeq the coordinate sequence to copy */ create(coordSeq: CoordinateSequence): CoordinateSequence; /** * Creates a CoordinateSequence of the specified size and dimension. * For this to be useful, the CoordinateSequence implementation must be mutable. * If the requested dimension is larger than the CoordinateSequence implementation can provide, * then a sequence of maximum possible dimension should be created. An error should not be thrown. * * @param {int} size the number of coordinates in the sequence * @param {int} dimension the dimension of the coordinates in the sequence (if user-specifiable, otherwise ignored) */ create(size: number, dimension: number): CoordinateSequence; /** * Creates a CoordinateSequence of the specified size and dimension with measure support. * For this to be useful, the CoordinateSequence implementation must be mutable. * If the requested dimension or measures are larger than the CoordinateSequence implementation can provide, * then a sequence of maximum possible dimension should be created. An error should not be thrown. * * @param {int} size the number of coordinates in the sequence * @param {int} dimension the dimension of the coordinates in the sequence (if user-specifiable, otherwise ignored) * @param {int} measures the number of measures of the coordinates in the sequence (if user-specifiable, otherwise ignored) */ create(size: number, dimension: number, measures: number): CoordinateSequence; } /** * Defines a rectangular region of the 2D coordinate plane. It is often used to * represent the bounding box of a {@link Geometry}, e.g. the minimum and * maximum x and y values of the {@link Coordinate}s. * <p> * Note that Envelopes support infinite or half-infinite regions, by using the * values of <code>Double.POSITIVE_INFINITY</code> and * <code>Double.NEGATIVE_INFINITY</code>. * <p> * When Envelope objects are created or initialized, the supplies extent values * are automatically sorted into the correct order. */ export class Envelope { /** * Test the point q to see whether it intersects the Envelope defined by p1-p2 * * NOTE: calls intersectsEnvelope if four arguments are given to simulate * overloaded function * * @param {jsts.geom.Coordinate} * p1 one extremal point of the envelope. * @param {jsts.geom.Coordinate} * p2 another extremal point of the envelope. * @param {jsts.geom.Coordinate} * q the point to test for intersection. * @return {boolean} <code>true</code> if q intersects the envelope p1-p2. */ static intersects(p1: Coordinate, p2: Coordinate, q: Coordinate): boolean; /** * Test the envelope defined by p1-p2 for intersection with the envelope defined * by q1-q2 * * @param {jsts.geom.Coordinate} * p1 one extremal point of the envelope P. * @param {jsts.geom.Coordinate} * p2 another extremal point of the envelope P. * @param {jsts.geom.Coordinate} * q1 one extremal point of the envelope Q. * @param {jsts.geom.Coordinate} * q2 another extremal point of the envelope Q. * @return {boolean} <code>true</code> if Q intersects P. */ static intersectsEnvelope(p1: Coordinate, p2: Coordinate, q1: Coordinate, q2: Coordinate): boolean; /** * Creates an <code>Envelope</code> for a region defined by maximum and * minimum values. * * @param {number} x1 the first x-value. * @param {number} x2 the second x-value. * @param {number} y1 the first y-value. * @param {number} y2 the second y-value. */ constructor(x1: number, x2: number, y1: number, y2: number); /** * Initialize an <code>Envelope</code> to a region defined by two Coordinates. * * @param {jsts.geom.Coordinate} p1 the first Coordinate. * @param {jsts.geom.Coordinate} p2 the second Coordinate. */ constructor(p1: Coordinate, p2: Coordinate); /** * Initialize an <code>Envelope</code> to a region defined by a single * Coordinate. * * @param {jsts.geom.Coordinate} p the Coordinate. */ constructor(p: Coordinate); /** * Initialize an <code>Envelope</code> from an existing Envelope. * * @param {jsts.geom.Envelope} env the Envelope to initialize from. */ constructor(env: Envelope); /** * the minimum x-coordinate. */ minx: number; /** * the maximum x-coordinate. */ maxx: number; /** * the minimum y-coordinate. */ miny: number; /** * the maximum y-coordinate. */ maxy: number; /** * Makes this <code>Envelope</code> a "null" envelope, that is, the envelope * of the empty geometry. */ setToNull(): void; /** * Returns <code>true</code> if this <code>Envelope</code> is a "null" * envelope. * * @return {boolean} <code>true</code> if this <code>Envelope</code> is * uninitialized or is the envelope of the empty geometry. */ isNull(): boolean; /** * Returns the difference between the maximum and minimum y values. * * @return {number} max y - min y, or 0 if this is a null <code>Envelope.</code> */ getHeight(): number; /** * Returns the difference between the maximum and minimum x values. * * @return {number} max x - min x, or 0 if this is a null <code>Envelope.</code> */ getWidth(): number; /** * Returns the <code>Envelope</code>s minimum x-value. min x > max x * indicates that this is a null <code>Envelope</code>. * * @return {number} the minimum x-coordinate. */ getMinX(): number; /** * Returns the <code>Envelope</code>s maximum x-value. min x > max x * indicates that this is a null <code>Envelope</code>. * * @return {number} the maximum x-coordinate. */ getMaxX(): number; /** * Returns the <code>Envelope</code>s minimum y-value. min y > max y * indicates that this is a null <code>Envelope</code>. * * @return {number} the minimum y-coordinate. */ getMinY(): number; /** * Returns the <code>Envelope</code>s maximum y-value. min y > max y * indicates that this is a null <code>Envelope</code>. * * @return {number} the maximum y-coordinate. */ getMaxY(): number; /** * Gets the area of this envelope. * * @return {number} the area of the envelope, 0.0 if the envelope is null. */ getArea(): number; /** * Enlarges this <code>Envelope</code> so that it contains the given * {@link Coordinate}. Has no effect if the point is already on or within the * envelope. * * @param {jsts.geom.Coordinate} p the Coordinate to expand to include. */ expandToInclude(p: Coordinate): void; /** * Enlarges this <code>Envelope</code> so that it contains the given point. * Has no effect if the point is already on or within the envelope. * * @param {number} x the value to lower the minimum x to or to raise the maximum x to. * @param {number} y the value to lower the minimum y to or to raise the maximum y to. */ expandToInclude(x: number, y: number): void; /** * Enlarges this <code>Envelope</code> so that it contains the * <code>other</code> Envelope. Has no effect if <code>other</code> is * wholly on or within the envelope. * * @param {jsts.geom.Envelope} other the <code>Envelope</code> to expand to include. */ expandToInclude(other: Envelope): void; /** * Expands this envelope by a given distance in all directions. Both positive * and negative distances are supported. * * @param {number} distance the distance to expand the envelope. */ expandBy(distance: number): void; /** * Expands this envelope by a given distance in all directions. Both positive * and negative distances are supported. * * @param {number} * deltaX the distance to expand the envelope along the the X axis. * @param {number} * deltaY the distance to expand the envelope along the the Y axis. */ expandBy(deltaX: number, deltaY: number): void; /** * Translates this envelope by given amounts in the X and Y direction. * * @param {number} * transX the amount to translate along the X axis. * @param {number} * transY the amount to translate along the Y axis. */ translate(transX: number, transY: number): void; /** * Computes the coordinate of the centre of this envelope (as long as it is * non-null * * @return {jsts.geom.Coordinate} the centre coordinate of this envelope <code>null</code> * if the envelope is null. */ centre(): Coordinate; /** * Computes the intersection of two {@link Envelopes} * * @param {jsts.geom.Envelope} * env the envelope to intersect with. * @return {jsts.geom.Envelope} a new Envelope representing the intersection of * the envelopes (this will be the null envelope if either argument is * null, or they do not intersect. */ intersection(env: Envelope): Envelope; /** * Check if the region defined by <code>other</code> overlaps (intersects) the * region of this <code>Envelope</code>. * * @param {jsts.geom.Envelope} * other the <code>Envelope</code> which this <code>Envelope</code> * is being checked for overlapping. * @return {boolean} <code>true</code> if the <code>Envelope</code>s * overlap. */ intersects(other: Envelope): boolean; /** * Check if the point <code>p</code> overlaps (lies inside) the region of this * <code>Envelope</code>. * * @param {jsts.geom.Coordinate} * p the <code>Coordinate</code> to be tested. * @return {boolean} <code>true</code> if the point overlaps this * <code>Envelope.</code>