diff --git a/types/jsts/index.d.ts b/types/jsts/index.d.ts
index f3ff051c50..5328bf05d6 100644
--- a/types/jsts/index.d.ts
+++ b/types/jsts/index.d.ts
@@ -8,6 +8,26 @@
declare namespace jsts {
export var version: string;
+ namespace algorithm {
+ import Point = jsts.geom.Point;
+ import Coordinate = jsts.geom.Coordinate;
+
+ 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 {}
+ }
+
namespace geom {
@@ -208,6 +228,12 @@ declare namespace jsts {
compareTo(other: Coordinate): number;
}
+ export class CoordinateSequence {
+ static X: number;
+ static Y: number;
+ static Z: number;
+ static M: 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
@@ -1574,6 +1600,94 @@ declare namespace jsts {
toString(): string;
}
+ export class IntersectionMatrix {
+ static matches(
+ actualDimensionValue: number,
+ requiredDimensionSymbol: string
+ ): boolean;
+
+ static matches(
+ actualDimensionSymbols: string,
+ requiredDimensionSymbols: string
+ ): boolean;
+
+ static isTrue(actualDimensionValue: number): boolean;
+
+ isIntersects(): boolean;
+
+ isCovers(): boolean;
+
+ isCoveredBy(): boolean;
+
+ set(dimensionSymbols: [string, string, string]): void;
+
+ set(row: number, col: number, dimensionValue: number): void;
+
+ isContains(): boolean;
+
+ setAtLeast(dimensionSymbols: [string, string, string]): void;
+
+ setAtLeast(row: number, col: number, dimensionValue: number): void;
+
+ setAtLeastIfValid(
+ row: number,
+ col: number,
+ minimumDimensionValue: number
+ ): void;
+
+ isWithin(): boolean;
+
+ isTouches(
+ dimensionOfGeometryA: number,
+ dimensionOfGeometryB: number
+ ): boolean;
+
+ isOverlaps(
+ dimensionOfGeometryA: number,
+ dimensionOfGeometryB: number
+ ): boolean;
+
+ isEquals(
+ dimensionOfGeometryA: number,
+ dimensionOfGeometryB: number
+ ): boolean;
+
+ toString(): string;
+
+ setAll(dimensionValue: number): void;
+
+ get(row: number, column: number): number;
+
+ transpose(): IntersectionMatrix;
+
+ matches(
+ requiredDimensionSymbols: [
+ string,
+ string,
+ string,
+ string,
+ string,
+ string,
+ string,
+ string,
+ string
+ ]
+ ): boolean;
+
+ add(im: IntersectionMatrix): void;
+
+ isDisjoint(): boolean;
+
+ isCrosses(
+ dimensionOfGeometryA: number,
+ dimensionOfGeometryB: number
+ ): boolean;
+
+ constructor(elements?: string[]);
+
+ constructor(other?: IntersectionMatrix);
+ }
+
/**
* Models an OGC SFS LinearRing. A LinearRing is a LineString
* which is both closed and simple. In other words, the first and last
@@ -1694,6 +1808,179 @@ declare namespace jsts {
*/
getNumInteriorRing(): number;
}
+
+ namespace util {
+ export class AffineTransformation {
+ static translationInstance(x: number, y: number): AffineTransformation;
+
+ static shearInstance(
+ xShear: number,
+ yShear: number
+ ): AffineTransformation;
+
+ static reflectionInstance(
+ x0: number,
+ y0: number,
+ x1?: number,
+ y1?: number
+ ): AffineTransformation;
+
+ static rotationInstance(theta: number): AffineTransformation;
+
+ static rotationInstance(
+ sinTheta: number,
+ cosTheta: number
+ ): AffineTransformation;
+
+ static rotationInstance(
+ theta: number,
+ x: number,
+ y: number
+ ): AffineTransformation;
+
+ static rotationInstance(
+ sinTheta: number,
+ cosTheta: number,
+ x: number,
+ y: number
+ ): AffineTransformation;
+
+ static scaleInstance(
+ xScale: number,
+ yScale: number,
+ x?: number,
+ y?: number
+ ): AffineTransformation;
+
+ setToReflectionBasic(
+ x0: number,
+ y0: number,
+ x1: number,
+ y1: number
+ ): AffineTransformation;
+
+ getInverse(): AffineTransformation;
+
+ compose(trans: AffineTransformation): AffineTransformation;
+
+ equals(obj: AffineTransformation): boolean;
+
+ setToScale(xScale: number, yScale: number): AffineTransformation;
+
+ isIdentity(): boolean;
+
+ scale(xScale: number, yScale: number): AffineTransformation;
+
+ setToIdentity(): AffineTransformation;
+
+ isGeometryChanged(): boolean;
+
+ setTransformation(trans: AffineTransformation): AffineTransformation;
+
+ setTransformation(
+ m00: number,
+ m01: number,
+ m02: number,
+ m10: number,
+ m11: number,
+ m12: number
+ ): AffineTransformation;
+
+ setToRotation(theta: number): AffineTransformation;
+
+ setToRotation(sinTheta: number, cosTheta: number): AffineTransformation;
+
+ setToRotation(
+ theta: number,
+ x: number,
+ y: number
+ ): AffineTransformation;
+
+ setToRotation(
+ sinTheta: number,
+ cosTheta: number,
+ x: number,
+ y: number
+ ): AffineTransformation;
+
+ getMatrixEntries(): [number, number, number, number, number, number];
+
+ filter(seq: CoordinateSequence, i: number): void;
+
+ rotate(theta: number): AffineTransformation;
+
+ rotate(sinTheta: number, cosTheta: number): AffineTransformation;
+
+ rotate(theta: number, x: number, y: number): AffineTransformation;
+
+ rotate(
+ sinTheta: number,
+ cosTheta: number,
+ x: number,
+ y: number
+ ): AffineTransformation;
+
+ getDeterminant(): number;
+
+ composeBefore(trans: AffineTransformation): AffineTransformation;
+
+ setToShear(xShear: number, yShear: number): AffineTransformation;
+
+ isDone(): boolean;
+
+ clone(): AffineTransformation;
+
+ translate(x: number, y: number): AffineTransformation;
+
+ setToReflection(x: number, y: number): AffineTransformation;
+
+ setToReflection(
+ x0: number,
+ y0: number,
+ x1: number,
+ y1: number
+ ): AffineTransformation;
+
+ toString(): string;
+
+ setToTranslation(dx: number, dy: number): AffineTransformation;
+
+ shear(xShear: number, yShear: number): AffineTransformation;
+
+ transform(g: T): T;
+
+ transform(src: Coordinate, dest: Coordinate): Coordinate;
+
+ transform(seq: CoordinateSequence, i: number): void;
+
+ reflect(
+ x0: number,
+ y0: number,
+ x1?: number,
+ y1?: number
+ ): AffineTransformation;
+
+ constructor(trans?: AffineTransformation);
+
+ constructor(
+ m00: number,
+ m01: number,
+ m02: number,
+ m10: number,
+ m11: number,
+ m12: number
+ );
+
+ constructor(
+ src0: Coordinate,
+ src1: Coordinate,
+ src2: Coordinate,
+ dest0: Coordinate,
+ dest1: Coordinate,
+ dest2: Coordinate
+ );
+ }
+ }
}
namespace io {
@@ -1791,6 +2078,61 @@ declare namespace jsts {
}
}
+
+ namespace operation {
+ import Geometry = jsts.geom.Geometry;
+ import PrecisionModel = jsts.geom.PrecisionModel;
+ import BoundaryNodeRule = jsts.algorithm.BoundaryNodeRule;
+
+ export class GeometryGraphOperation {
+ getArgGeometry(i: number): Geometry;
+
+ setComputationPrecision(pm: PrecisionModel): void;
+
+ constructor(g0: Geometry, g1?: Geometry);
+
+ constructor(
+ g0: Geometry,
+ g1: Geometry,
+ boundaryNodeRule: BoundaryNodeRule
+ );
+ }
+
+ namespace relate {
+ import Geometry = jsts.geom.Geometry;
+ import IntersectionMatrix = jsts.geom.IntersectionMatrix;
+
+ export class RelateOp extends GeometryGraphOperation {
+ static covers(g1: Geometry, g2: Geometry): boolean;
+
+ static intersects(g1: Geometry, g2: Geometry): boolean;
+
+ static touches(g1: Geometry, g2: Geometry): boolean;
+
+ static equalsTopo(g1: Geometry, g2: Geometry): boolean;
+
+ static relate(
+ g1: Geometry,
+ g2: Geometry,
+ boundaryNodeRule?: BoundaryNodeRule
+ ): IntersectionMatrix;
+
+ static overlaps(g1: Geometry, g2: Geometry): boolean;
+
+ static crosses(g1: Geometry, g2: Geometry): boolean;
+
+ static contains(g1: Geometry, g2: Geometry): boolean;
+
+ getIntersectionMatrix(): IntersectionMatrix;
+
+ constructor(
+ g1: Geometry,
+ g2: Geometry,
+ boundaryNodeRule?: BoundaryNodeRule
+ );
+ }
+ }
+ }
}
declare module "jsts" {
diff --git a/types/jsts/jsts-tests.ts b/types/jsts/jsts-tests.ts
index 4d4c1353b4..57924d7c05 100644
--- a/types/jsts/jsts-tests.ts
+++ b/types/jsts/jsts-tests.ts
@@ -17,6 +17,24 @@ var poly: jsts.geom.Polygon = new jsts.geom.Polygon(lr);
var precisionModel = new jsts.geom.PrecisionModel();
var factory = new jsts.geom.GeometryFactory(precisionModel);
var wktWriter = new jsts.io.WKTWriter(factory);
+const o: jsts.algorithm.Orientation = new jsts.algorithm.Orientation();
+const bnr: jsts.algorithm.BoundaryNodeRule = new jsts.algorithm.BoundaryNodeRule();
+
+let im0: jsts.geom.IntersectionMatrix = new jsts.geom.IntersectionMatrix();
+const im1: jsts.geom.IntersectionMatrix = new jsts.geom.IntersectionMatrix(['1', '2']);
+const im2: jsts.geom.IntersectionMatrix = new jsts.geom.IntersectionMatrix(im0);
+
+let at0: jsts.geom.util.AffineTransformation = new jsts.geom.util.AffineTransformation(n, n, n, n, n, n);
+const at1: jsts.geom.util.AffineTransformation = new jsts.geom.util.AffineTransformation(c, c, c, c, c, c);
+const at2: jsts.geom.util.AffineTransformation = new jsts.geom.util.AffineTransformation(at0);
+let seq: jsts.geom.CoordinateSequence = new jsts.geom.CoordinateSequence();
+
+const ggo0: jsts.operation.GeometryGraphOperation = new jsts.operation.GeometryGraphOperation(g);
+const ggo1: jsts.operation.GeometryGraphOperation = new jsts.operation.GeometryGraphOperation(g, g);
+const ggo2: jsts.operation.GeometryGraphOperation = new jsts.operation.GeometryGraphOperation(g, g, bnr);
+
+const ro0: jsts.operation.relate.RelateOp = new jsts.operation.relate.RelateOp(g, g);
+const ro1: jsts.operation.relate.RelateOp = new jsts.operation.relate.RelateOp(g, g, bnr);
str = jsts.version;
@@ -148,4 +166,91 @@ 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
+wr.reducePrecision(g);
+
+n = jsts.algorithm.Orientation.index(p, p, p);
+bool = jsts.algorithm.Orientation.isCCW([c]);
+
+bool = jsts.geom.IntersectionMatrix.matches(n, str);
+bool = jsts.geom.IntersectionMatrix.matches(str, str);
+bool = jsts.geom.IntersectionMatrix.isTrue(n);
+bool = im0.isIntersects();
+bool = im0.isCovers();
+bool = im0.isCoveredBy();
+im0.set([str, str, str]);
+im0.set(n, n, n);
+bool = im0.isContains();
+im0.setAtLeast([str, str, str]);
+im0.setAtLeast(n, n, n);
+im0.setAtLeastIfValid(n, n, n);
+bool = im0.isWithin();
+bool = im0.isTouches(n, n);
+bool = im0.isOverlaps(n, n);
+bool = im0.isEquals(n, n);
+str = im0.toString();
+im0.setAll(n);
+n = im0.get(n, n);
+im0 = im0.transpose();
+bool = im0.matches([str, str, str, str, str, str ,str, str, str]);
+im0.add(im1);
+bool = im0.isDisjoint();
+bool = im0.isCrosses(n, n);
+
+at0 = jsts.geom.util.AffineTransformation.translationInstance(n, n);
+at0 = jsts.geom.util.AffineTransformation.shearInstance(n, n);
+at0 = jsts.geom.util.AffineTransformation.reflectionInstance(n, n, n, n);
+at0 = jsts.geom.util.AffineTransformation.rotationInstance(n);
+at0 = jsts.geom.util.AffineTransformation.reflectionInstance(n, n);
+at0 = jsts.geom.util.AffineTransformation.reflectionInstance(n, n, n);
+at0 = jsts.geom.util.AffineTransformation.reflectionInstance(n, n, n, n);
+at0 = jsts.geom.util.AffineTransformation.scaleInstance(n, n, n, n);
+at0 = at0.setToReflectionBasic(n, n, n, n);
+at0 = at0.getInverse();
+at0 = at0.compose(at1);
+bool = at0.equals(at1);
+at0 = at0.setToScale(n, n);
+bool = at0.isIdentity();
+at0 = at1.setToIdentity();
+bool = at0.isGeometryChanged();
+at0 = at0.setTransformation(at1);
+at0 = at0.setTransformation(n, n, n, n, n, n);
+at0 = at0.setToRotation(n);
+at0 = at0.setToRotation(n, n);
+at0 = at0.setToRotation(n, n, n);
+at0 = at0.setToRotation(n, n, n, n);
+const nArray: [number, number, number, number, number, number] = at0.getMatrixEntries();
+at0.filter(seq, n);
+at0 = at0.rotate(n);
+at0 = at0.rotate(n, n);
+at0 = at0.rotate(n, n, n);
+at0 = at0.rotate(n, n, n, n);
+n = at0.getDeterminant();
+at0 = at0.composeBefore(at1);
+at0 = at0.setToShear(n, n);
+bool = at0.isDone();
+at0 = at0.clone();
+at0 = at0.translate(n, n);
+at0 = at0.setToReflection(n, n);
+at0 = at0.setToReflection(n, n, n, n);
+str = at0.toString();
+at0 = at0.setToTranslation(n, n);
+at0 = at0.shear(n, n);
+p = at0.transform(p);
+c = at0.transform(c, c);
+at0.transform(seq, n);
+at0 = at0.reflect(n, n);
+at0 = at0.reflect(n, n, n, n);
+
+g = ggo0.getArgGeometry(n);
+ggo0.setComputationPrecision(precisionModel);
+
+bool = jsts.operation.relate.RelateOp.covers(g, g);
+bool = jsts.operation.relate.RelateOp.intersects(g, g);
+bool = jsts.operation.relate.RelateOp.touches(g, g);
+bool = jsts.operation.relate.RelateOp.equalsTopo(g, g);
+im0 = jsts.operation.relate.RelateOp.relate(g, g);
+im0 = jsts.operation.relate.RelateOp.relate(g, g, bnr);
+bool = jsts.operation.relate.RelateOp.overlaps(g, g);
+bool = jsts.operation.relate.RelateOp.crosses(g, g);
+bool = jsts.operation.relate.RelateOp.contains(g, g);
+im0 = ro0.getIntersectionMatrix();