mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-11-30 02:01:46 +00:00
added definitions for PrecisionModel, GeometryFactory (partial), GeometryFactory, OL3Parser, WKTWriter
This commit is contained in:
Vendored
+101
-4
@@ -1,12 +1,88 @@
|
||||
// Type definitions for jsts 0.16.0
|
||||
// Type definitions for jsts 0.17.0
|
||||
// Project: https://github.com/bjornharrtell/jsts
|
||||
// Definitions by: Stephane Alie <https://github.com/StephaneAlie>
|
||||
// Definitions by: Stephane Alie <https://github.com/StephaneAlie>, Jorge Rocha Gualtieri <https://github.com/jrocha>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace jsts {
|
||||
export var version: string;
|
||||
|
||||
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);
|
||||
|
||||
|
||||
/**
|
||||
* 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: Array<Coordinate>): LineString;
|
||||
/**
|
||||
* 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;
|
||||
|
||||
}
|
||||
|
||||
export class GeometryCollection extends jsts.geom.Geometry {
|
||||
|
||||
constructor(geometries?: Array<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
|
||||
@@ -560,7 +636,7 @@ declare namespace jsts {
|
||||
* @return {PrecisionModel} the specification of the grid of allowable points, for this
|
||||
* <code>Geometry</code> and all other <code>Geometry</code>s.
|
||||
*/
|
||||
getPrecisionModel(): any;
|
||||
getPrecisionModel(): PrecisionModel;
|
||||
|
||||
/**
|
||||
* Returns a vertex of this <code>Geometry</code> (usually, but not
|
||||
@@ -1602,6 +1678,17 @@ declare namespace jsts {
|
||||
}
|
||||
|
||||
namespace io {
|
||||
|
||||
|
||||
/**
|
||||
* OpenLayers 3 Geometry parser and writer
|
||||
*/
|
||||
export class OL3Parser {
|
||||
constructor(geometryFactory?: jsts.geom.GeometryFactory);
|
||||
read(geometry: ol.geom.Geometry): jsts.geom.Geometry;
|
||||
write(geometry: jsts.geom.Geometry): ol.geom.Geometry;
|
||||
}
|
||||
|
||||
export class GeoJSONReader {
|
||||
constructor();
|
||||
|
||||
@@ -1659,7 +1746,7 @@ declare namespace jsts {
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
constructor(geometryFactory?: any);
|
||||
constructor(geometryFactory?: jsts.geom.GeometryFactory);
|
||||
|
||||
/**
|
||||
* Reads a Well-Known Text representation of a {@link Geometry}
|
||||
@@ -1674,6 +1761,16 @@ declare namespace jsts {
|
||||
|
||||
reducePrecision(geometry: geom.Geometry): void;
|
||||
}
|
||||
|
||||
|
||||
|
||||
export class WKTWriter {
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
constructor(geometryFactory?: jsts.geom.GeometryFactory);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,9 @@ 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);
|
||||
var precisionModel = new jsts.geom.PrecisionModel();
|
||||
var factory = new jsts.geom.GeometryFactory(this.precisionModel);
|
||||
var wktWriter = new jsts.io.WKTWriter(this.factory);
|
||||
|
||||
str = jsts.version;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user