From 39c221338d56e953b745bfdd761f8c594d8f92da Mon Sep 17 00:00:00 2001 From: Dominic Alie Date: Fri, 16 Oct 2015 11:33:55 -0400 Subject: [PATCH] JSTS type definitions --- jsts/jsts-tests.ts | 145 ++++ jsts/jsts.d.ts | 1666 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 1811 insertions(+) create mode 100644 jsts/jsts-tests.ts create mode 100644 jsts/jsts.d.ts diff --git a/jsts/jsts-tests.ts b/jsts/jsts-tests.ts new file mode 100644 index 000000000..3b37d0f18 --- /dev/null +++ b/jsts/jsts-tests.ts @@ -0,0 +1,145 @@ +/// +var str: string; +var n: number; +var bool: boolean; +var obj: any; + +var c: jsts.geom.Coordinate = new jsts.geom.Coordinate(n, n); +var e: jsts.geom.Envelope = new jsts.geom.Envelope(n, n, n, n); +var g: jsts.geom.Geometry = new jsts.geom.Geometry(); +var lr: jsts.geom.LinearRing = new jsts.geom.LinearRing([c]); +var ls: jsts.geom.LineString = new jsts.geom.LineString([c]); +var p: jsts.geom.Point = new jsts.geom.Point(c); +var poly: jsts.geom.Polygon = new jsts.geom.Polygon(lr); + +str = jsts.version; + +c = new jsts.geom.Coordinate(c); +c = c.clone(); +n = c.compareTo(c); +n = c.distance(c); +bool = c.equals(c); +bool = c.equals2D(c); +c.setCoordinate(c); +n = c.x; +n = c.y; +n = c.z; + +e = new jsts.geom.Envelope(c); +e = new jsts.geom.Envelope(e); +e = new jsts.geom.Envelope(c, c); +c = e.centre(); +e = e.clone(); +bool = e.contains(e); +bool = e.contains(c); +bool = e.contains(n, n); +bool = e.covers(c); +bool = e.covers(e); +bool = e.covers(n, n); +n = e.distance(e); +bool = e.equals(e); +e.expandBy(n); +e.expandToInclude(c); +e.expandToInclude(e); +e.expandToInclude(n, n); +n = e.getArea(); +n = e.getHeight(); +n = e.getMaxX(); +n = e.getMaxY(); +n = e.getMinX(); +n = e.getMinY(); +n = e.getWidth(); +e = e.intersection(e); +bool = e.intersects(e); +bool = e.intersects(c); +bool = e.intersects(n, n); +bool = e.isNull(); +n = e.maxx; +n = e.maxy; +n = e.minx; +n = e.miny; +e.setToNull(); +str = e.toString(); +e.translate(n, n); + +g.apply({}); +g = g.buffer(n, n, n); +g.checkNotGeometryCollection(g); +g = g.clone(); +n = g.compare([{}], [{}]); +n = g.compareTo(g); +n = g.compareToSameClass(g); +e = g.computeEnvelopeInternal(); +bool = g.contains(g); +g = g.convexHull(); +bool = g.coveredBy(g); +bool = g.covers(g); +bool = g.crosses(g); +g = g.difference(g); +bool = g.disjoint(g); +n = g.distance(g); +e = g.envelope; +bool = g.equal(c, c, n); +bool = g.equals(g); +bool = g.equalsExact(g, n); +bool = g.equalsNorm(g); +bool = g.equalsTopo(g); +n = g.getArea(); +g = g.getBoundary(); +n = g.getBoundaryDimension(); +p = g.getCentroid(); +c = g.getCoordinate(); +var coords: jsts.geom.Coordinate[] = g.getCoordinates(); +n = g.getDimension(); +g = g.getEnvelope(); +e = g.getEnvelopeInternal(); +obj = g.getFactory(); +g = g.getGeometryN(n); +str = g.getGeometryType(); +p = g.getInteriorPoint(); +n = g.getLength(); +n = g.getNumGeometries(); +n = g.getNumPoints(); +obj = g.getPrecisionModel(); +g = g.intersection(g); +bool = g.intersects(g); +bool = g.isEmpty(); +bool = g.isEquivalentClass(g); +bool = g.isGeometryCollection(); +bool = g.isGeometryCollectionBase(); +bool = g.isRectangle(); +bool = g.isSimple(); +bool = g.isValid(); +bool = g.isWithinDistance(g, n); +g = g.norm(); +g.normalize(); +bool = g.overlaps(g); +bool = g.relate(g, str); +obj = g.relate2(g); +g = g.symDifference(g); +str = g.toString(); +bool = g.touches(g); +g = g.union(g); +bool = g.within(g); + +c = ls.getCoordinateN(n); +p = ls.getEndPoint(); +p = ls.getPointN(n); +p = ls.getStartPoint(); +bool = ls.isClosed(); +bool = ls.isRing(); + +n = p.getX(); +n = p.getY(); +p = p.reverse(); + +lr = poly.getExteriorRing(); +lr = poly.getInteriorRingN(n); +n = poly.getNumInteriorRing(); + +var gjw: jsts.io.GeoJSONWriter = new jsts.io.GeoJSONWriter(); +obj = gjw.write(g); + +var wr: jsts.io.WKTReader = new jsts.io.WKTReader(); +g = wr.read(str); +wr.reducePrecision(g); \ No newline at end of file diff --git a/jsts/jsts.d.ts b/jsts/jsts.d.ts new file mode 100644 index 000000000..2eac4d5a4 --- /dev/null +++ b/jsts/jsts.d.ts @@ -0,0 +1,1666 @@ +// Type definitions for jsts 0.16.0 +// Project: https://github.com/bjornharrtell/jsts +// Definitions by: Stephane Alie +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module jsts { + export var version: string; + + module geom { + /** + * 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 Coordinate only contains + * coordinate values and accessor methods. + */ + export class Coordinate { + /** + * @constructor + */ + constructor(x: number, y: number); + + /** + * @constructor + */ + constructor(c: Coordinate); + + /** + * 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 Coordinates (x,y,z) values to that of + * other. + * + * @param {Coordinate} + * other the Coordinate 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 Coordinates + * are equal. + * + * @param {Coordinate} + * other a Coordinate with which to do the 2D + * comparison. + * @return {boolean} true if the x- and y-coordinates are + * equal; the z-coordinates do not have to be equal. + */ + equals2D(other: Coordinate): boolean; + + /** + * Returns true if other 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 Coordinate with which to do the comparison. + * @return {boolean} true if other is a + * Coordinate 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: + *
    + *
  • -1 : this.x < other.x || ((this.x == other.x) && (this.y < other.y)) + *
  • 0 : this.x == other.x && this.y = other.y + *
  • 1 : this.x > other.x || ((this.x == other.x) && (this.y > other.y)) + * + *
+ * Note: This method assumes that ordinate values are valid numbers. NaN + * values are not handled correctly. + * + * @param {Coordinate} + * other the Coordinate with which this + * Coordinate is being compared. + * @return {number} -1, zero, or 1 as explained above. + */ + compareTo(other: Coordinate): number; + } + + /** + * 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. + *

+ * Note that Envelopes support infinite or half-infinite regions, by using the + * values of Double.POSITIVE_INFINITY and + * Double.NEGATIVE_INFINITY. + *

+ * 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} true 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} true if Q intersects P. + */ + static intersectsEnvelope(p1: Coordinate, p2: Coordinate, q1: Coordinate, q2: Coordinate): boolean; + + /** + * Creates an Envelope 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 Envelope 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 Envelope to a region defined by a single + * Coordinate. + * + * @param {jsts.geom.Coordinate} p the Coordinate. + */ + constructor(p: Coordinate); + + /** + * Initialize an Envelope 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 Envelope a "null" envelope, that is, the envelope + * of the empty geometry. + */ + setToNull(): void; + + /** + * Returns true if this Envelope is a "null" + * envelope. + * + * @return {boolean} true if this Envelope 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 Envelope. + */ + 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 Envelope. + */ + getWidth(): number; + + /** + * Returns the Envelopes minimum x-value. min x > max x + * indicates that this is a null Envelope. + * + * @return {number} the minimum x-coordinate. + */ + getMinX(): number; + + /** + * Returns the Envelopes maximum x-value. min x > max x + * indicates that this is a null Envelope. + * + * @return {number} the maximum x-coordinate. + */ + getMaxX(): number; + + /** + * Returns the Envelopes minimum y-value. min y > max y + * indicates that this is a null Envelope. + * + * @return {number} the minimum y-coordinate. + */ + getMinY(): number; + + /** + * Returns the Envelopes maximum y-value. min y > max y + * indicates that this is a null Envelope. + * + * @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 Envelope 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 Envelope 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 Envelope so that it contains the + * other Envelope. Has no effect if other is + * wholly on or within the envelope. + * + * @param {jsts.geom.Envelope} other the Envelope 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 null + * 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 other overlaps (intersects) the + * region of this Envelope. + * + * @param {jsts.geom.Envelope} + * other the Envelope which this Envelope + * is being checked for overlapping. + * @return {boolean} true if the Envelopes + * overlap. + */ + intersects(other: Envelope): boolean; + + /** + * Check if the point p overlaps (lies inside) the region of this + * Envelope. + * + * @param {jsts.geom.Coordinate} + * p the Coordinate to be tested. + * @return {boolean} true if the point overlaps this + * Envelope. + */ + intersects(p: Coordinate): boolean; + + /** + * Check if the point (x, y) overlaps (lies inside) the region of + * this Envelope. + * + * @param {number} + * x the x-ordinate of the point. + * @param {number} + * y the y-ordinate of the point. + * @return {boolean} true if the point overlaps this + * Envelope. + */ + intersects(x: number, y: number): boolean; + + /** + * Tests if the Envelope other lies wholely inside this + * Envelope (inclusive of the boundary). + *

+ * Note that this is not the same definition as the SFS + * contains, which would exclude the envelope boundary. + * + * @param {jsts.geom.Envelope} + * other the Envelope to check. + * @return {boolean} true if other is contained in this + * Envelope. + * + * @see covers(Envelope) + */ + contains(other: Envelope): boolean; + + /** + * Tests if the given point lies in or on the envelope. + *

+ * Note that this is not the same definition as the SFS + * contains, which would exclude the envelope boundary. + * + * @param {jsts.geom.Coordinate} + * p the point which this Envelope is being checked for + * containing. + * @return {boolean} true if the point lies in the interior or on + * the boundary of this Envelope. + * + * @see covers(Coordinate) + */ + contains(p: Coordinate): boolean; + + /** + * Tests if the given point lies in or on the envelope. + *

+ * Note that this is not the same definition as the SFS + * contains, which would exclude the envelope boundary. + * + * @param {number} + * x the x-coordinate of the point which this Envelope + * is being checked for containing. + * @param {number} + * y the y-coordinate of the point which this Envelope + * is being checked for containing. + * @return {boolean} true if (x, y) lies in the + * interior or on the boundary of this Envelope. + * + * @see covers(double, double) + */ + contains(x: number, y: number): boolean; + + /** + * Tests if the given point lies in or on the envelope. + * + * @param {number} + * x the x-coordinate of the point which this Envelope + * is being checked for containing. + * @param {number} + * y the y-coordinate of the point which this Envelope + * is being checked for containing. + * @return {boolean} true if (x, y) lies in the + * interior or on the boundary of this Envelope. + */ + covers(x: number, y: number): boolean; + + /** + * Tests if the given point lies in or on the envelope. + * + * @param {jsts.geom.Coordinate} + * p the point which this Envelope is being checked for + * containing. + * @return {boolean} true if the point lies in the interior or on + * the boundary of this Envelope. + */ + covers(p: Coordinate): boolean; + + /** + * Tests if the Envelope other lies wholely inside this + * Envelope (inclusive of the boundary). + * + * @param {jsts.geom.Envelope} + * other the Envelope to check. + * @return {boolean} true if this Envelope covers the + * other. + */ + covers(other: Envelope): boolean; + + /** + * Computes the distance between this and another Envelope. + * + * @param {jsts.geom.Envelope} + * env The Envelope to test this Envelope + * against. + * @return {number} The distance between overlapping Envelopes is 0. Otherwise, + * the distance is the Euclidean distance between the closest points. + */ + distance(env: Envelope): number; + + /** + * @param {jsts.geom.Envelope} + * other the Envelope to check against. + * @return {boolean} true if envelopes are equal. + */ + equals(other: Envelope): boolean; + + /** + * @return {string} String representation of this Envelope. + */ + toString(): string; + + /** + * @return {jsts.geom.Envelope} A new instance copied from this. + */ + clone(): Envelope; + } + + /** + * The base class for all geometric objects. + */ + export class Geometry { + /** + * Creates a new Geometry via the specified GeometryFactory. + */ + constructor(factory?: any); + + /** + * The bounding box of this Geometry. + */ + envelope: Envelope; + + /** + * Gets the factory which contains the context in which this geometry was created. + * + * @return {jsts.geom.GeometryFactory} the factory for this geometry. + */ + getFactory(): any; + + /** + * Returns the name of this object's com.vivid.jts.geom interface. + * + * @return {string} The name of this Geometrys most specific jsts.geom interface. + */ + getGeometryType(): string; + + /** + *Returns the number of {@link Geometry}s in a {@link GeometryCollection} + * (or 1, if the geometry is not a collection). + * + * @return {number} the number of geometries contained in this geometry. + */ + getNumGeometries(): number; + + /** + * Returns an element {@link Geometry} from a {@link GeometryCollection} (or + * this, if the geometry is not a collection). + * + * @param {number} n The index of the geometry element. + * + * @return {Geometry} the n'th geometry contained in this geometry. + */ + getGeometryN(n: number): Geometry; + + /** + * Returns the PrecisionModel used by the Geometry. + * + * @return {PrecisionModel} the specification of the grid of allowable points, for this + * Geometry and all other Geometrys. + */ + getPrecisionModel(): any; + + /** + * Returns a vertex of this Geometry (usually, but not + * necessarily, the first one). The returned coordinate should not be assumed to + * be an actual Coordinate object used in the internal representation. + * + * @return {Coordinate} a {@link Coordinate} which is a vertex of this + * Geometry. null if this Geometry is empty. + */ + getCoordinate(): Coordinate; + + /** + * Returns an array containing the values of all the vertices for this geometry. + * If the geometry is a composite, the array will contain all the vertices for + * the components, in the order in which the components occur in the geometry. + *

+ * In general, the array cannot be assumed to be the actual internal storage for + * the vertices. Thus modifying the array may not modify the geometry itself. + * Use the {@link CoordinateSequence#setOrdinate} method (possibly on the + * components) to modify the underlying data. If the coordinates are modified, + * {@link #geometryChanged} must be called afterwards. + * + * @return {Coordinate[]} the vertices of this Geometry. + * @see geometryChanged + * @see CoordinateSequence#setOrdinate + */ + getCoordinates(): Coordinate[]; + + /** + * Returns the count of this Geometrys vertices. The + * Geometry s contained by composite Geometrys + * must be Geometry's; that is, they must implement getNumPoints + * + * @return {number} the number of vertices in this Geometry. + */ + getNumPoints(): number; + + /** + * Tests whether this {@link Geometry} is simple. In general, the SFS + * specification of simplicity follows the rule: + *

    + *
  • A Geometry is simple iff the only self-intersections are at boundary + * points. + *
+ * Simplicity is defined for each {@link Geometry} subclass as follows: + *
    + *
  • Valid polygonal geometries are simple by definition, so + * isSimple trivially returns true. + *
  • Linear geometries are simple iff they do not self-intersect at points + * other than boundary points. + *
  • Zero-dimensional geometries (points) are simple iff they have no + * repeated points. + *
  • Empty Geometrys are always simple + *
      + * + * @return {boolean} true if this Geometry has any + * points of self-tangency, self-intersection or other anomalous points. + * @see #isValid + */ + isSimple(): boolean; + + /** + * Tests the validity of this Geometry. Subclasses provide their + * own definition of "valid". + * + * @return {boolean} true if this Geometry is + * valid. + * + * @see IsValidOp + */ + isValid(): boolean; + + /** + * Returns whether or not the set of points in this Geometry is + * empty. + * + * @return {boolean} true if this Geometry equals + * the empty geometry. + */ + isEmpty(): boolean; + + /** + * Returns the minimum distance between this Geometry and the + * Geometry g + * + * @param {Geometry} + * g the Geometry from which to compute the distance. + * @return {number} the distance between the geometries. 0 if either input + * geometry is empty. + * @throws IllegalArgumentException + * if g is null + */ + distance(g: Geometry): number; + + /** + * Tests whether the distance from this Geometry to another is + * less than or equal to a specified value. + * + * @param {Geometry} + * geom the Geometry to check the distance to. + * @param {number} + * distance the distance value to compare. + * @return {boolean} true if the geometries are less than + * distance apart. + */ + isWithinDistance(geom: Geometry, distance: number): boolean; + + isRectangle(): boolean; + + /** + * Returns the area of this Geometry. Areal Geometries have a + * non-zero area. They override this function to compute the area. Others return + * 0.0 + * + * @return the area of the Geometry. + */ + getArea(): number; + + /** + * Returns the length of this Geometry. Linear geometries return + * their length. Areal geometries return their perimeter. They override this + * function to compute the area. Others return 0.0 + * + * @return the length of the Geometry. + */ + getLength(): number; + + /** + * Computes the centroid of this Geometry. The centroid is equal + * to the centroid of the set of component Geometries of highest dimension + * (since the lower-dimension geometries contribute zero "weight" to the + * centroid) + * + * @return a {@link Point} which is the centroid of this Geometry. + */ + getCentroid(): Point; + + /** + * Computes an interior point of this Geometry. An interior + * point is guaranteed to lie in the interior of the Geometry, if it possible to + * calculate such a point exactly. Otherwise, the point may lie on the boundary + * of the geometry. + * + * @return {Point} a {@link Point} which is in the interior of this Geometry. + */ + getInteriorPoint(): Point; + + /** + * Returns the dimension of this geometry. The dimension of a geometry is is the + * topological dimension of its embedding in the 2-D Euclidean plane. In the JTS + * spatial model, dimension values are in the set {0,1,2}. + *

      + * Note that this is a different concept to the dimension of the vertex + * {@link Coordinate}s. The geometry dimension can never be greater than the + * coordinate dimension. For example, a 0-dimensional geometry (e.g. a Point) + * may have a coordinate dimension of 3 (X,Y,Z). + * + * @return {number} the topological dimension of this geometry. + */ + getDimension(): number; + + /** + * Returns the boundary, or an empty geometry of appropriate dimension if this + * Geometry is empty. (In the case of zero-dimensional + * geometries, ' an empty GeometryCollection is returned.) For a discussion of + * this function, see the OpenGIS Simple Features Specification. As stated in + * SFS Section 2.1.13.1, "the boundary of a Geometry is a set of Geometries of + * the next lower dimension." + * + * @return {Geometry} the closure of the combinatorial boundary of this + * Geometry. + */ + getBoundary(): Geometry; + + /** + * Returns the dimension of this Geometrys inherent boundary. + * + * @return {number} the dimension of the boundary of the class implementing this + * interface, whether or not this object is the empty geometry. Returns + * Dimension.FALSE if the boundary is the empty geometry. + */ + getBoundaryDimension(): number; + + /** + * Returns this Geometrys bounding box. If this + * Geometry is the empty geometry, returns an empty + * Point. If the Geometry is a point, returns a + * non-empty Point. Otherwise, returns a Polygon + * whose points are (minx, miny), (maxx, miny), (maxx, maxy), (minx, maxy), + * (minx, miny). + * + * @return {Geometry} an empty Point (for empty + * Geometrys), a Point (for + * Points) or a Polygon (in all other + * cases). + */ + getEnvelope(): Geometry; + + /** + * Returns the minimum and maximum x and y values in this Geometry, + * or a null Envelope if this Geometry is empty. + * + * @return {Envelope} this Geometrys bounding box; if the + * Geometry is empty, Envelope#isNull will + * return true. + */ + getEnvelopeInternal(): Envelope; + + /** + * Tests whether this geometry is disjoint from the specified geometry. + *

      + * The disjoint predicate has the following equivalent + * definitions: + *

        + *
      • The two geometries have no point in common + *
      • The DE-9IM Intersection Matrix for the two geometries matches + * [FF*FF****] + *
      • ! g.intersects(this) (disjoint is the + * inverse of intersects) + *
      + * + * @param {Geometry} + * g the Geometry with which to compare this + * Geometry. + * @return {boolean} true if the two Geometrys + * are disjoint. + * + * @see Geometry#intersects + */ + disjoint(g: Geometry): boolean; + + /** + * Tests whether this geometry touches the specified geometry. + *

      + * The touches predicate has the following equivalent + * definitions: + *

        + *
      • The geometries have at least one point in common, but their interiors do + * not intersect. + *
      • The DE-9IM Intersection Matrix for the two geometries matches + * [FT*******] or [F**T*****] or + * [F***T****] + *
      + * If both geometries have dimension 0, this predicate returns + * false + * + * @param {Geometry} + * g the Geometry with which to compare this + * Geometry. + * @return {boolean} true if the two Geometrys + * touch; Returns false if both Geometrys + * are points. + */ + touches(g: Geometry): boolean; + + /** + * Tests whether this geometry intersects the specified geometry. + *

      + * The intersects predicate has the following equivalent + * definitions: + *

        + *
      • The two geometries have at least one point in common + *
      • The DE-9IM Intersection Matrix for the two geometries matches + * [T********] or [*T*******] or + * [***T*****] or [****T****] + *
      • ! g.disjoint(this) (intersects is the + * inverse of disjoint) + *
      + * + * @param {Geometry} + * g the Geometry with which to compare this + * Geometry. + * @return {boolean} true if the two Geometrys + * intersect. + * + * @see Geometry#disjoint + */ + intersects(g: Geometry): boolean; + + /** + * Tests whether this geometry crosses the specified geometry. + *

      + * The crosses predicate has the following equivalent + * definitions: + *

        + *
      • The geometries have some but not all interior points in common. + *
      • The DE-9IM Intersection Matrix for the two geometries matches + *
          + *
        • [T*T******] (for P/L, P/A, and L/A situations) + *
        • [T*****T**] (for L/P, A/P, and A/L situations) + *
        • [0********] (for L/L situations) + *
        + *
      + * For any other combination of dimensions this predicate returns + * false. + *

      + * The SFS defined this predicate only for P/L, P/A, L/L, and L/A situations. + * JTS extends the definition to apply to L/P, A/P and A/L situations as well, + * in order to make the relation symmetric. + * + * @param {Geometry} + * g the Geometry with which to compare this + * Geometry. + * @return {boolean} true if the two Geometrys + * cross. + */ + crosses(g: Geometry): boolean; + + /** + * Tests whether this geometry is within the specified geometry. + *

      + * The within predicate has the following equivalent definitions: + *

        + *
      • Every point of this geometry is a point of the other geometry, and the + * interiors of the two geometries have at least one point in common. + *
      • The DE-9IM Intersection Matrix for the two geometries matches + * [T*F**F***] + *
      • g.contains(this) (within is the converse + * of contains) + *
      + * An implication of the definition is that "The boundary of a Geometry is not + * within the Geometry". In other words, if a geometry A is a subset of the + * points in the boundary of a geomtry B, A.within(B) = false + * + * @param {Geometry} + * g the Geometry with which to compare this + * Geometry. + * @return {boolean} true if this Geometry is + * within other. + * + * @see Geometry#contains + */ + within(g: Geometry): boolean; + + /** + * Tests whether this geometry contains the specified geometry. + *

      + * The contains predicate has the following equivalent + * definitions: + *

        + *
      • Every point of the other geometry is a point of this geometry, and the + * interiors of the two geometries have at least one point in common. + *
      • The DE-9IM Intersection Matrix for the two geometries matches + * [T*****FF*] + *
      • g.within(this) (contains is the converse + * of within) + *
      + * An implication of the definition is that "Geometries do not contain their + * boundary". In other words, if a geometry A is a subset of the points in the + * boundary of a geometry B, B.contains(A) = false + * + * @param {Geometry} + * g the Geometry with which to compare this + * Geometry. + * @return {boolean} true if this Geometry + * contains g. + * + * @see Geometry#within + */ + contains(g: Geometry): boolean; + + /** + * Tests whether this geometry overlaps the specified geometry. + *

      + * The overlaps predicate has the following equivalent + * definitions: + *

        + *
      • The geometries have at least one point each not shared by the other (or + * equivalently neither covers the other), they have the same dimension, and the + * intersection of the interiors of the two geometries has the same dimension as + * the geometries themselves. + *
      • The DE-9IM Intersection Matrix for the two geometries matches + * [T*T***T**] (for two points or two surfaces) or + * [1*T***T**] (for two curves) + *
      + * If the geometries are of different dimension this predicate returns + * false. + * + * @param {Geometry} + * g the Geometry with which to compare this + * Geometry. + * @return {boolean} true if the two Geometrys + * overlap. + */ + overlaps(g: Geometry): boolean; + + /** + * Tests whether this geometry covers the specified geometry. + *

      + * The covers predicate has the following equivalent definitions: + *

        + *
      • Every point of the other geometry is a point of this geometry. + *
      • The DE-9IM Intersection Matrix for the two geometries matches + * [T*****FF*] or [*T****FF*] or + * [***T**FF*] or [****T*FF*] + *
      • g.coveredBy(this) (covers is the converse + * of coveredBy) + *
      + * If either geometry is empty, the value of this predicate is false. + *

      + * This predicate is similar to {@link #contains}, but is more inclusive (i.e. + * returns true for more cases). In particular, unlike + * contains it does not distinguish between points in the + * boundary and in the interior of geometries. For most situations, + * covers should be used in preference to contains. + * As an added benefit, covers is more amenable to optimization, + * and hence should be more performant. + * + * @param {Geometry} + * g the Geometry with which to compare this + * Geometry. + * @return {boolean} true if this Geometry covers + * g. + * + * @see Geometry#contains + * @see Geometry#coveredBy + */ + covers(g: Geometry): boolean; + + /** + * Tests whether this geometry is covered by the specified geometry. + *

      + * The coveredBy predicate has the following equivalent + * definitions: + *

        + *
      • Every point of this geometry is a point of the other geometry. + *
      • The DE-9IM Intersection Matrix for the two geometries matches + * [T*F**F***] or [*TF**F***] or + * [**FT*F***] or [**F*TF***] + *
      • g.covers(this) (coveredBy is the converse + * of covers) + *
      + * If either geometry is empty, the value of this predicate is false. + *

      + * This predicate is similar to {@link #within}, but is more inclusive (i.e. + * returns true for more cases). + * + * @param {Geometry} + * g the Geometry with which to compare this + * Geometry. + * @return {boolean} true if this Geometry is + * covered by g. + * + * @see Geometry#within + * @see Geometry#covers + */ + coveredBy(g: Geometry): boolean; + + /** + * Tests whether the elements in the DE-9IM {@link IntersectionMatrix} for the + * two Geometrys match the elements in + * intersectionPattern. The pattern is a 9-character string, + * with symbols drawn from the following set: + *

        + *
      • 0 (dimension 0) + *
      • 1 (dimension 1) + *
      • 2 (dimension 2) + *
      • T ( matches 0, 1 or 2) + *
      • F ( matches FALSE) + *
      • * ( matches any value) + *
      + * For more information on the DE-9IM, see the OpenGIS Simple Features + * Specification. + * + * @param {Geometry} + * other the Geometry with which to compare this + * Geometry. + * @param {string} + * intersectionPattern the pattern against which to check the + * intersection matrix for the two Geometrys. + * @return {boolean} true if the DE-9IM intersection matrix for + * the two Geometrys match + * intersectionPattern. + * @see IntersectionMatrix + */ + relate(g: Geometry, intersectionPattern: string): boolean; + + /** + * Returns the DE-9IM {@link IntersectionMatrix} for the two + * Geometrys. + * + * @param {Geometry} + * g the Geometry with which to compare this + * Geometry. + * @return {IntersectionMatrix} an {@link IntersectionMatrix} describing the + * intersections of the interiors, boundaries and exteriors of the two + * Geometrys. + */ + relate2(g: Geometry): any; + + /** + * Tests whether this geometry is topologically equal to the argument geometry + * as defined by the SFS equals predicate. + *

      + * The SFS equals predicate has the following equivalent + * definitions: + *

        + *
      • The two geometries have at least one point in common, and no point of + * either geometry lies in the exterior of the other geometry. + *
      • The DE-9IM Intersection Matrix for the two geometries matches the + * pattern T*F**FFF* + *
        +             * T*F
        +             * **F
        +             * FF*
        +             * 
        + * + *
      + * Note that this method computes topologically equality. For + * structural equality, see {@link #equalsExact(Geometry)}. + * + * @param {Geometry} + * g the Geometry with which to compare this + * Geometry. + * @return {boolean} true if the two Geometrys + * are topologically equal. + * + * @see #equalsExact(Geometry) + */ + equalsTopo(g: Geometry): boolean; + + /** + * Tests whether this geometry is structurally and numerically equal to a given + * Object. If the argument Object is not a + * Geometry, the result is false. Otherwise, the result + * is computed using {@link #equalsExact(Geometry)}. + *

      + * This method is provided to fulfill the Java contract for value-based object + * equality. In conjunction with {@link #hashCode()} it provides semantics which + * are most useful for using Geometrys as keys and values in Java + * collections. + *

      + * Note that to produce the expected result the input geometries should be in + * normal form. It is the caller's responsibility to perform this where required + * (using {@link Geometry#norm() or {@link #normalize()} as appropriate). + * + * @param {Object} + * o the Object to compare. + * @return {boolean} true if this geometry is exactly equal to the argument. + * + * @see #equalsExact(Geometry) + * @see #hashCode() + * @see #norm() + * @see #normalize() + */ + equals(o: Object): boolean; + + /** + * Computes a buffer area around this geometry having the given width and with a + * specified accuracy of approximation for circular arcs, and using a specified + * end cap style. + *

      + * Mathematically-exact buffer area boundaries can contain circular arcs. To + * represent these arcs using linear geometry they must be approximated with + * line segments. The quadrantSegments argument allows + * controlling the accuracy of the approximation by specifying the number of + * line segments used to represent a quadrant of a circle + *

      + * The end cap style specifies the buffer geometry that will be created at the + * ends of linestrings. The styles provided are: + *

        + *
      • BufferOp.CAP_ROUND - (default) a semi-circle + *
      • BufferOp.CAP_BUTT - a straight line perpendicular to the end + * segment + *
      • BufferOp.CAP_SQUARE - a half-square + *
      + *

      + * The buffer operation always returns a polygonal result. The negative or + * zero-distance buffer of lines and points is always an empty {@link Polygon}. + * This is also the result for the buffers of degenerate (zero-area) polygons. + * + * @param {number} + * distance the width of the buffer (may be positive, negative or 0). + * @param {number} + * quadrantSegments the number of line segments used to represent a + * quadrant of a circle. + * @param {number} + * endCapStyle the end cap style to use. + * @return {Geometry} a polygonal geometry representing the buffer region (which + * may be empty). + * + * @throws TopologyException + * if a robustness error occurs + * + * @see #buffer(double) + * @see #buffer(double, int) + * @see BufferOp + */ + buffer(distance: number, quadrantSegments: number, endCapStyle: number): Geometry; + + /** + * Computes the smallest convex Polygon that contains all the + * points in the Geometry. This obviously applies only to + * Geometry s which contain 3 or more points; the results for + * degenerate cases are specified as follows: + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
      Number of Points in argument Geometry + * Geometry class of result
      0 empty GeometryCollection
      1 Point
      2 LineString
      3 or more Polygon
      + * + * @return {Geometry} the minimum-area convex polygon containing this + * Geometry' s points. + */ + convexHull(): Geometry; + + /** + * Computes a Geometry representing the points shared by this + * Geometry and other. {@link GeometryCollection}s + * support intersection with homogeneous collection types, with the semantics + * that the result is a {@link GeometryCollection} of the intersection of each + * element of the target with the argument. + * + * @param {Geometry} + * other the Geometry with which to compute the + * intersection. + * @return {Geometry} the points common to the two Geometrys. + * @throws TopologyException + * if a robustness error occurs + * @throws IllegalArgumentException + * if the argument is a non-empty GeometryCollection + */ + intersection(other: Geometry): Geometry; + + /** + * Computes a Geometry representing all the points in this + * Geometry and other. + * + * Or without arguments: + * + * Computes the union of all the elements of this geometry. Heterogeneous + * {@link GeometryCollection}s are fully supported. + * + * The result obeys the following contract: + *

        + *
      • Unioning a set of {@link LineString}s has the effect of fully noding + * and dissolving the linework. + *
      • Unioning a set of {@link Polygon}s will always return a + * {@link Polygonal} geometry (unlike {link #union(Geometry)}, which may return + * geometrys of lower dimension if a topology collapse occurred. + *
      + * + * @param {Geometry} + * other the Geometry with which to compute the union. + * @return {Geometry} a set combining the points of this Geometry + * and the points of other. + * @throws TopologyException + * if a robustness error occurs + * @throws IllegalArgumentException + * if either input is a non-empty GeometryCollection + */ + union(other: Geometry): Geometry; + + /** + * Computes a Geometry representing the points making up this + * Geometry that do not make up other. This + * method returns the closure of the resultant Geometry. + * + * @param {Geometry} + * other the Geometry with which to compute the + * difference. + * @return {Geometry} the point set difference of this Geometry + * with other. + * @throws TopologyException + * if a robustness error occurs + * @throws IllegalArgumentException + * if either input is a non-empty GeometryCollection + */ + difference(other: Geometry): Geometry; + + /** + * Returns a set combining the points in this Geometry not in + * other, and the points in other not in this + * Geometry. This method returns the closure of the resultant + * Geometry. + * + * @param {Geometry} + * other the Geometry with which to compute the + * symmetric difference. + * @return {Geometry} the point set symmetric difference of this + * Geometry with other. + * @throws TopologyException + * if a robustness error occurs + * @throws IllegalArgumentException + * if either input is a non-empty GeometryCollection + */ + symDifference(other: Geometry): Geometry; + + /** + * Returns true if the two Geometrys are exactly equal, up to a + * specified distance tolerance. Two Geometries are exactly equal within a + * distance tolerance if and only if: + *
        + *
      • they have the same class + *
      • they have the same values for their vertices, within the given tolerance + * distance, in exactly the same order. + *
      + * If this and the other Geometrys are composites and any + * children are not Geometrys, returns false. + * + * @param {Geometry} + * other the Geometry with which to compare this + * Geometry. + * @param {number} + * tolerance distance at or below which two Coordinates + * are considered equal. + * @return {boolean} + */ + equalsExact(other: Geometry, tolerance: number): boolean; + + /** + * Tests whether two geometries are exactly equal in their normalized forms. + * This is a convenience method which creates normalized versions of both + * geometries before computing {@link #equalsExact(Geometry)}. This method is + * relatively expensive to compute. For maximum performance, the client should + * instead perform normalization itself at an appropriate point during + * execution. + * + * @param {Geometry} + * g a Geometry. + * @return {boolean} true if the input geometries are exactly equal in their + * normalized form. + */ + equalsNorm(g: Geometry): boolean; + + /** + * Performs an operation with or on this Geometry and its + * subelement Geometrys (if any). Only GeometryCollections and + * subclasses have subelement Geometry's. + * + * @param filter + * the filter to apply to this Geometry (and its + * children, if it is a GeometryCollection). + */ + apply(filter: any): void; + + /** + * Creates and returns a full copy of this {@link Geometry} object (including + * all coordinates contained by it). Subclasses are responsible for overriding + * this method and copying their internal data. Overrides should call this + * method first. + * + * @return a clone of this instance. + */ + clone(): Geometry; + + /** + * Converts this Geometry to normal form (or + * canonical form ). Normal form is a unique representation for + * Geometry s. It can be used to test whether two + * Geometrys are equal in a way that is independent of the + * ordering of the coordinates within them. Normal form equality is a stronger + * condition than topological equality, but weaker than pointwise equality. The + * definitions for normal form use the standard lexicographical ordering for + * coordinates. "Sorted in order of coordinates" means the obvious extension of + * this ordering to sequences of coordinates. + */ + normalize(): void; + + /** + * Creates a new Geometry which is a normalized copy of this Geometry. + * + * @return a normalized copy of this geometry. + * @see #normalize() + */ + norm(): Geometry; + + /** + * Returns whether this Geometry is greater than, equal to, or + * less than another Geometry. + *

      + * + * If their classes are different, they are compared using the following + * ordering: + *

        + *
      • Point (lowest) + *
      • MultiPoint + *
      • LineString + *
      • LinearRing + *
      • MultiLineString + *
      • Polygon + *
      • MultiPolygon + *
      • GeometryCollection (highest) + *
      + * If the two Geometrys have the same class, their first + * elements are compared. If those are the same, the second elements are + * compared, etc. + * + * @param {Geometry} + * other a Geometry with which to compare this + * Geometry. + * @return {number} a positive number, 0, or a negative number, depending on + * whether this object is greater than, equal to, or less than + * o, as defined in "Normal Form For Geometry" in the + * JTS Technical Specifications. + */ + compareTo(o: Geometry): number; + + /** + * Returns whether the two Geometrys are equal, from the point + * of view of the equalsExact method. Called by + * equalsExact . In general, two Geometry classes + * are considered to be "equivalent" only if they are the same class. An + * exception is LineString , which is considered to be equivalent + * to its subclasses. + * + * @param {Geometry} + * other the Geometry with which to compare this + * Geometry for equality. + * @return {boolean} true if the classes of the two + * Geometry s are considered to be equal by the + * equalsExact method. + */ + isEquivalentClass(other: Geometry): boolean; + + /** + * Throws an exception if g's class is + * GeometryCollection . (Its subclasses do not trigger an + * exception). + * + * @param {Geometry} + * g the Geometry to check. + * @throws Error + * if g is a GeometryCollection but not + * one of its subclasses + */ + checkNotGeometryCollection(g: Geometry): void; + + /** + * + * @return {boolean} true if this is a GeometryCollection. + */ + isGeometryCollection(): boolean; + + /** + * + * @return {boolean} true if this is a GeometryCollection but not subclass. + */ + isGeometryCollectionBase(): boolean; + + /** + * Returns the minimum and maximum x and y values in this Geometry, + * or a null Envelope if this Geometry is empty. + * Unlike getEnvelopeInternal, this method calculates the + * Envelope each time it is called; + * getEnvelopeInternal caches the result of this method. + * + * @return {Envelope} this Geometrys bounding box; if the + * Geometry is empty, Envelope#isNull will + * return true. + */ + computeEnvelopeInternal(): Envelope; + + /** + * Returns whether this Geometry is greater than, equal to, or + * less than another Geometry having the same class. + * + * @param o + * a Geometry having the same class as this + * Geometry. + * @return a positive number, 0, or a negative number, depending on whether this + * object is greater than, equal to, or less than o, as + * defined in "Normal Form For Geometry" in the JTS Technical + * Specifications. + */ + compareToSameClass(o: Geometry): number; + + /** + * Returns the first non-zero result of compareTo encountered as + * the two Collections are iterated over. If, by the time one of + * the iterations is complete, no non-zero result has been encountered, returns + * 0 if the other iteration is also complete. If b completes + * before a, a positive number is returned; if a before b, a + * negative number. + * + * @param {Array} + * a a Collection of Comparables. + * @param {Array} + * b a Collection of Comparables. + * @return {number} the first non-zero compareTo result, if any; + * otherwise, zero. + */ + compare(a: Array, b: Array): number; + + /** + * @param {jsts.geom.Coordinate} + * a first Coordinate to compare. + * @param {jsts.geom.Coordinate} + * b second Coordinate to compare. + * @param {number} + * tolerance tolerance when comparing. + * @return {boolean} true if equal. + */ + equal(a: Coordinate, b: Coordinate, tolerance: number): boolean; + + /** + * Returns a WKT representation of this geometry. + */ + toString(): string; + } + + /** + * Models an OGC SFS LinearRing. A LinearRing is a LineString + * which is both closed and simple. In other words, the first and last + * coordinate in the ring must be equal, and the interior of the ring must not + * self-intersect. Either orientation of the ring is allowed. + *

      + * A ring must have either 0 or 4 or more points. The first and last points + * must be equal (in 2D). If these conditions are not met, the constructors + * throw an {@link IllegalArgumentException} + */ + export class LinearRing extends LineString { + } + + export class LineString extends Geometry { + /** + * @constructor + */ + constructor(points: Array, factory?: any); + + /** + * @return {jsts.geom.Coordinate} The n'th coordinate of this + * jsts.geom.LineString. + * @param {int} + * n index. + */ + getCoordinateN(n: number): Coordinate; + + /** + * @return {jsts.geom.Point} The n'th point of this + * jsts.geom.LineString. + * @param {int} + * n index. + */ + getPointN(n: number): Point; + + /** + * @return {jsts.geom.Point} The first point of this + * jsts.geom.LineString. + */ + getStartPoint(): Point; + + /** + * @return {jsts.geom.Point} The last point of this + * jsts.geom.LineString. + */ + getEndPoint(): Point; + + /** + * @return {Boolean} true if LineString is Closed. + */ + isClosed(): boolean; + + /** + * @return {Boolean} true if LineString is a Ring. + */ + isRing(): boolean; + } + + export class Point extends Geometry { + /** + * @constructor + */ + constructor(coordinate: Coordinate, factory?: any); + + /** + * @return {number} x-axis value of this Point. + */ + getX(): number; + + /** + * @return {number} y-axis value of this Point. + */ + getY(): number; + + /** + * @return {Point} Reversed point is a cloned point. + */ + reverse(): Point; + } + + /** + * Represents a linear polygon, which may include holes. The shell and holes + * of the polygon are represented by {@link LinearRing}s. In a valid polygon, + * holes may touch the shell or other holes at a single point. However, no + * sequence of touching holes may split the polygon into two pieces. The + * orientation of the rings in the polygon does not matter. + * + * The shell and holes must conform to the assertions specified in the OpenGIS Simple Features + * Specification for SQL. + */ + export class Polygon extends Geometry { + /** + * @constructor + */ + constructor(shell: LinearRing, holes?: Array, factory?: any); + + /** + * Gets the exterior ring. + * + * @return {LinearRing} The exterior ring. + */ + getExteriorRing(): LinearRing; + + /** + * Gets the interior ring at the specified index. + * + * @param {number} n The interior ring index. + * + * @returns {LinearRing} The interior ring at the specified index. + */ + getInteriorRingN(n: number): LinearRing; + + /** + * Gets the number of interior rings. + * + * @return {number} The number of interior rings. + */ + getNumInteriorRing(): number; + } + } + + module io { + export class GeoJSONWriter { + /** + * Writes the GeoJSON representation of a {@link Geometry}. The + * The GeoJSON format is defined here. + *

      + * The GeoJSONWriter outputs coordinates rounded to the precision + * model. Only the maximum number of decimal places necessary to represent the + * ordinates to the required precision will be output. + *

      + * + * @see WKTReader + * @constructor + */ + constructor(); + + /** + * Converts a Geometry to its GeoJSON representation. + * + * @param {jsts.geom.Geometry} + * geometry a Geometry to process. + * @return {Object} The GeoJSON representation of the Geometry. + */ + write(geometry: geom.Geometry): Object; + } + + /** + * Converts a geometry in Well-Known Text format to a {@link Geometry}. + *

      + * WKTReader supports extracting Geometry objects + * from either {@link Reader}s or {@link String}s. This allows it to function + * as a parser to read Geometry objects from text blocks embedded + * in other data formats (e.g. XML). + *

      + *

      + * A WKTReader is parameterized by a GeometryFactory, + * to allow it to create Geometry objects of the appropriate + * implementation. In particular, the GeometryFactory determines + * the PrecisionModel and SRID that is used. + *

      + */ + export class WKTReader { + /** + * @constructor + */ + constructor(geometryFactory?: any); + + /** + * Reads a Well-Known Text representation of a {@link Geometry} + * + * @param {string} + * wkt a string (see the OpenGIS Simple Features + * Specification). + * @return {jsts.geom.Geometry} a Geometry read from + * string. + */ + read(wkt: string): geom.Geometry; + + reducePrecision(geometry: geom.Geometry): void; + } + } +} \ No newline at end of file