typescript-closure-tools
Version:
Command-line tools to convert closure-style JSDoc annotations to typescript, and to convert typescript sources to closure externs files
1,471 lines (1,266 loc) • 96 kB
TypeScript
// Type definitions for Mapsjs 9.6.0
// Project: https://github.com/mapsjs
// Definitions by: Matthew James Davis <https://github.com/davismj/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/**
* Mapsjs 9.6.0 Copyright (c) 2013 ISC. All Rights Reserved.
*/
declare module 'mapsjs' {
/**
* Clusters a set of points.
* @param {object} options An options object which specifies the clustering algorithm.
* @returns {object} An array of clustered points.
*/
export function clusterPoints(options: {
data: {}[];
pointKey: string;
valueFunction?: (row: any) => number;
radiusFunction: (row: any) => number;
aggregateFunction?: (srcRow: any, cmpRow: any, aggRow: any) => void;
mapUnitsPerPixel: number;
marginPixels?: number;
}): {}[];
/**
* An immutable envelope
* @class envelope
*/
export class envelope {
constructor(minX: number, minY: number, maxX: number, maxY: number);
/**
* Gets the minimum x coordinate of the envelope.
* @returns {number} The minimum x coordinate.
*/
getMinX(): number;
/**
* Gets the minimum y coordinate of the envelope
* @returns {number} The minimum y coordinate.
*/
getMinY(): number;
/**
* Gets the maximum x coordinate of the envelope
* @returns {number} The maximum x coordinate.
*/
getMaxX(): number;
/**
* Gets the maximum y coordinate of the envelope
* @returns {number} The maximum y coordinate.
*/
getMaxY(): number;
/**
* Creates a new envelope from this as deep copy.
* @returns {envelope} The new cloned envelope.
*/
clone(): envelope;
/**
* Creates a new envelope from this one plus x and y margins.
* @param {number} marginX The x margin.
* @param {number} marginY The y margin.
* @returns {envelope} A new envelope.
*/
createFromMargins(marginX: number, marginY: number): envelope;
/**
* Create a new envelope from this one plus a bleed ratio.
* @param {number} bleed The bleed ratio.
* @returns {envelope} A new envelope.
*/
createFromBleed(bleed: number): envelope;
/**
* Gets the center point of the envelope.
* @returns {point} Center as a point.
*/
getCenter(): point;
/**
* Gets the width of the envelope.
* @returns {number} Width of the envelope.
*/
getWidth(): number;
/**
* Gets height of the envelope.
* @returns {number} Height of the envelope.
*/
getHeight(): number;
/**
* Gets area of the envelope.
* @return {number} Area of the envelope.
*/
getArea(): number;
/**
* Returns the minimum and maximum coordinates of this envelope as an envObject.
* @returns {envObject} Representaton of this envelope as an envObject.
*/
toObject(): envObject;
/**
* Gets upper left coordinate of this envelope.
* @returns {point} A new point.
*/
getUL(): point;
/**
* Gets upper right of this envelope.
* @returns {point} A new point.
*/
getUR(): point;
/**
* Gets lower left of this envelope.
* @returns {point} A new point.
*/
getLL(): point;
/**
* Gets lower right of this envelope.
* @returns {point} A new point.
*/
getLR(): point;
/**
* Gets the aspect of the envelope.
* @returns {number} Width-to-height ratio.
*/
getAspect(): number;
/**
* Equality comparer between this and another envelope.
* @param {envelope} env Envelope to compare.
* @return {boolean} Result of equality comparison.
*/
equals(env: envelope): boolean;
/**
* Method for casting this envelope as a string.
* @returns {string} String of the form 'minX,minY,maxX,maxY'.
*/
toString(): string;
/**
* Create a closed geometry from this envelope.
* @returns {geometry} A new closed path geometry.
*/
toGeometry(): geometry;
/**
* Tests whether the given point is contained within this envelope.
* @param {point} pt Point to test.
* @returns {boolean} Result of containment test.
*/
contains(pt: point): boolean;
}
/**
* Exposes static functions that act on or return envelopes.
* @module envelope
*/
export module envelope {
/**
* Creates a new envelope from MapDotNet XML.
* @param {string} xml A MapDotNet XML string of the envelope.
* @returns {envelope} A new envelope
*/
export function createFromMdnXml(xml: string): envelope;
/**
* Creates new envelope from two corner points.
* @param {point} pt1 Corner point
* @param {point} pt2 Opposite corner point
* @returns {envelope} A new envelope
*/
export function createFromPoints(pt1: point, pt2: point): envelope;
/**
* Creates a new envelope from the x and y coordinates of the center
* point and x and y margins from the center point.
* @param {number} centerPtX The center x coordinate.
* @param {number} centerPtY The center y coordinate.
* @param {number} marginX The margin from center x coordinate.
* @param {number} marginY The margin from center y coordinate.
* @returns {envelope} A new envelope
*/
export function createFromCenterAndMargins(centerPtX: number, centerPtY: number, marginX: number, marginY: number): envelope;
/**
* Tests whether two given envelopes intersect.
* @param {envelope} env1 First envelope to test.
* @param {envelope} env2 Second envelope to test.
* @returns {boolean} Result of the intersection test.
*/
export function intersects(env1: envelope, env2: envelope): boolean;
/**
* Creates a new envelope from the union of two given envelopes.
* @param {envelope} env1 The first enevelope to unite.
* @param {envelope} env2 The second envelope to unite.
* @returns {envelope} A new envelope.
*/
export function union(env1: envelope, env2: envelope): envelope;
}
/**
* A general geometry which can represent a point, line, polygon,
* mulitpoint, multilinestring
* @class geometry
*/
export class geometry {
constructor(isPath?: boolean, isClosed?: boolean);
/**
* Creates a new polygon or polyline form the geometry according to
* whether the geometry is closed.
* @returns {any} A new polyline or polygon geometry.
*/
factoryPoly(): any;
/**
* Creates a deep copy of this geometry.
* @returns {geometry} The new cloned geometry.
*/
clone(): geometry;
/**
* Iterates every vertex in the geometry and passes to the supplied
* callback. Return true from in the callback will break the iteration.
* @param {function} action Callback with the signature action(setIdx, idx, x, y, set).
*/
foreachVertex(action: (setIdx: number, idx: number, x: number, y: number, s: number[]) => void): void;
/**
* Returns the geometry's bounding box as an envelope.
* @returns {envelope} The bounding box of the geometry as an envelope.
*/
getBounds(): envelope;
/**
* Checks whether or not this geometry is closed.
* @returns {boolean} Result of the path check.
*/
getIsPath(): boolean;
/**
* Checks whether or not this geometry is closed.
* @returns {boolean} Result of the closed check.
*/
getIsClosed(): boolean;
/**
* Gets the number of sets in this geometry.
* @returns {number} Number of sets.
*/
getSetCount(): number;
/**
* Gets a set from this geometry's set collection by index, or, if no
* index is provided, gets the last set. Note: for polygons, first set
* is primary ring and subsequent ones are holes.
* @param {number} [idx] Index of the set to return.
* @returns {number[]} A set as an array of points in the form [xn,yn].
*/
getSet(idx: number): number[];
/**
* Adds a new set to this geometry's collection of sets.
* @param {number[]} s Set to add as an array of points in the form [xn,yn].
*/
pushSet(s: number[]): void;
/**
* Gets the last set in the geometry's set collection and removes it
* from the collection.
* @returns {number} Set removed as an array of points in the form [xn,yn].
*/
popSet(): number[];
/**
* Creates SVG path data from this geometry if it is a path.
* @returns {string} String of the SVG path or null the geometry is not a path.
*/
toSvgPathData(): string;
/**
* Adds point to the last set in geometry's set collection. If the
* geometry is empty, a new set is added to the geometry first.
* @param {point} pt The point to add.
* @returns {object} Object of the form {setIdx, idx} where setIdx is
* the 0-based index of the set the point was added to and idx is the
* 0-based index of the point in its set.
*/
addPointToLastSet(pt: point): { setIdx: number; idx: number; };
/**
* Tests the validity of this geometry. An open path geometry is valid
* if it has at least one set with at least two points. A closed
* geometry is valid if it has at least one set with at least three
* points. A point (non-path) geometry is always valid.
* @returns {geometry} valid geometry is true, otherwise false.
*/
isValid(): boolean;
/**
* Creates a wkt string from this geometry.
* @returns {string} A string of well known text.
*/
toString(): string;
toWkt(): string;
/**
* Finds the point in this geometry nearest to the given point.
* @param {point} pt Reference point.
* @returns {object} An object of the form {setIdx, ptIdx, pt, distance}
* where setIdx is the index of the set the point is in, ptIdx is the
* index of the point in the set, pt is the point object, and distance
* is the distance of the point to the reference point in map units.
*/
findNearestVertex(pt: point): { setIdx: number; ptIdx: number; pt: point; distance: number; };
/**
* Finds point along boundary of geometry nearest to the given point
* @param {point} pt Reference point.
* @param {boolean} [close] Flag to indicate whether this geometry
* should be treated as a closed geometry.
* @returns {object} An object of the form {setIdx, ptIdx, pt, distance}
* where setIdx is the index of the set the point is in, ptIdx is the
* index of the point in the set, pt is the point object, and distance
* is the distance of the point to the reference point in map units.
*/
findNearestSegment(pt: point, close?: boolean): { setIdx: number; ptIdx: number; pt: point; distance: number; };
/**
* Finds coordinates in map units of the midpoint of this geometry. If
* this geometry is an open path, the midpoint is the midpoint of the
* path. If this geometry is a closed path, the midpoint is the centroid
* of the polygon. If a set index is not provided, finds the labeling
* point for the last set in this geometry's set collection.
* @param {number} [idx] Index of set for which to find the labeling point.
* @returns {point} Midpoint of this geometry.
*/
getLabelingPoint(idx?: number): point;
/**
* Tests whether this geometry contains a given point/
* @param {point} pt The reference point.
* @returns {boolean} Result of the containment test.
*/
contains(pt: point): boolean;
}
/**
* Exposes static functions that act on or return geometries, including
* constructors for specific geometries such as polygon and polyline.
* @module geometry
*/
export module geometry {
/**
* A polyline object which is an open path geometry with one or more paths.
* @class polyline
*/
class polyline extends geometry {
constructor(geom: geometry);
/**
* Gets the underlying geometry of the polyline.
* @returns {geometry} The polyline's underlying geometry object.
*/
getGeometry(): geometry;
/**
* Creates a new polyline object from a deep copy of the underlying geometry.
* @returns {polyline} Thew new cloned polyline.
*/
clone(): polyline;
/**
* Gets number of lines in this polyline.
* @returns {number} Number of lines.
*/
getLineCount(): number;
/**
* Gets a line from this polyline's liune collection by index, or,
* if no index is provided, gets the last line.
* @param {number} [idx] Index of the line to return.
* @returns {number[]} A line as an array of points in the form [xn,yn].
*/
getLine(idx: number): number[];
/**
* Adds a new line to this polyline's line collection.
* @param {number[]} s Line to add as an array of points in the form [xn,yn].
*/
pushLine(s: number[]): void;
/**
* Gets the last line in the polyline's set collection and removes it
* from the collection.
* @returns {number} Line removed as an array of points in the form [xn,yn].
*/
popLine(): number[];
/**
* Calculates distance of a line in a polyline by index according
* to projected map cooordinates. If no index is provided, uses
* the last line in the polyline's set collection.
* @param {number} [idx] Index of the line for which to compute the distance.
* @returns {number} Length in projected units of the distance of the line.
*/
getProjectedDistance(idx: number): number;
/**
* Calculates distance of a line in a polyline by index according
* to actual distance. If no index is provided, uses the last line
* in the polyline's set collection.
* @param {number} [idx] Index of the line for which to compute the distance.
* @returns {number} Distance in meters of the line.
*/
getActualDistance(idx?: number): number;
/**
* Determines whether this polyline intersects a given geometry.
* @param {geometry} geom Geometry to test against.
* @returns {boolean} Result of the intersection test.
*/
intersects(geom: geometry): boolean;
}
/**
* A polyline object which is a closed path geometry with one or more paths.
* @class polygon
*/
class polygon extends geometry {
constructor(geom: geometry);
/**
* Gets the underlying geometry of the polygon.
* @returns {geometry} The polygon's underlying geometry object.
*/
getGeometry(): geometry;
/**
* Creates a new polygon object from a deep copy of the underlying geometry.
* @returns {polygon} Thew new cloned polygon.
*/
clone(): polygon;
/**
* Gets number of rings in this polygon.
* @returns {number} Number of rings.
*/
getRingCount(): number;
/**
* Gets a ring from this polygon's set collection by index, or,
* if no index is provided, gets the last ring.
* @param {number} [idx] Index of the ring to return.
* @returns {number[]} A ring as an array of points in the form [xn,yn].
*/
getRing(idx: number): number[];
/**
* Adds a new ring to this polygon's ring collection.
* @param {number[]} s Ring to add as an array of points in the form [xn,yn].
*/
pushRing(s: number[]): void;
/**
* Gets the last ring in the polygon's ring collection and removes it
* from the collection.
* @returns {number} Ring removed as an array of points in the form [xn,yn].
*/
popRing(): number[];
/**
* Calculates area of a ring in a polygon by index according
* to projected map cooordinates. If no index is provided, uses
* the last ring in the polygon's ring collection.
* @param {number} [idx] Index of the ring for which to compute the area.
* @returns {number} Area in square projected units of the ring.
*/
getProjectedArea(idx: number): number;
/**
* Calculates perimeter of a ring in a polygon by index according
* to projected map cooordinates. If no index is provided, uses
* the last ring in the polygon's ring collection.
* @param {number} [idx] Index of the ring for which to compute the perimeter.
* @returns {number} Length in projected units of the distance of the ring.
*/
getProjectedPerimeter(idx: number): number;
/**
* Calculates area of a ring in a polygon by index according
* to the actual area. If no index is provided, uses the last ring
* in the polygon's ring collection.
* @param {number} [idx] Index of the ring for which to compute the area.
* @returns {number} Area in square meters of the ring.
*/
getActualArea(idx?: number): number;
/**
* Calculates perimeter of a ring in a polygon by index according
* to actual distance. If no index is provided, uses the last ring
* in the polygon's ring collection.
* @param {number} [idx] Index of the ring for which to compute the perimeter.
* @returns {number} Length in meters of the perimeter of the ring.
*/
getActualPerimeter(idx?: number): number;
/**
* Determines whether this polygon intersects a given geometry.
* @param {geometry} geom Geometry to test against.
* @returns {boolean} Result of the intersection test.
*/
intersects(geom: geometry): boolean;
/**
* Determines whether this polyline overlaps a given geometry.
* @param {geometry} geom Geometry to test against.
* @returns {boolean} Result of the intersection test.
*/
overlaps(poly: polygon): boolean;
/**
* Convert this polygon into an array of OGC compliant polygons where
* the first set is a ring and all subsequent contained sets are holes.
* @returns {polygon[]} An array of OGC polygons.
*/
toMultiPolygon(): polygon[];
}
}
/**
* A style specification for geometry objects.
* @class geometryStyle
*/
export class geometryStyle {
constructor(options?: styleObj);
/**
* Gets path outline thickness in pixels.
* @returns {number} Thickness of path outline.
*/
getOutlineThicknessPix(): number;
/**
* Sets path outline thickness in pixels.
* @param {number} t Desired thickness.
*/
setOutlineThicknessPix(t: number): void;
/**
* Gets path outline color as a CSS style string.
* @returns {string} Outline color as a CSS style string.
*/
getOutlineColor(): string;
/**
* Sets path outline color from a CSS style string.
* @param {string} c Outline color as a CSS style string.
*/
setOutlineColor(c: string): void;
/**
* Gets path outline opacity in decimal format.
* @returns {number} Outline opacity.
*/
getOutlineOpacity(): number;
/**
* Set path outline opacity to a decimal between 0 and 1.
* @param {number} o Outline opacity.
*/
setOutlineOpacity(o: number): void;
/**
* Gets fill color as a CSS style string.
* @returns {string} Fill color as a CSS style string.
*/
getFillColor(): string;
/**
* Sets fill color as a CSS style string.
* @param {string} c Fill color as a CSS style string.
*/
setFillColor(c: string): void;
/**
* Gets fill opacity in decimal format.
* @returns {number} Fill opacity.
*/
getFillOpacity(): number;
/**
* Sets fill opacity to a decimal between 0 and 1.
* @param {number} o Fill opacity.
*/
setFillOpacity(o: number): void;
/**
* Gets the dash array as a string.
* @returns {string} Dash array as astring.
*/
getDashArray(): string;
/**
* Sets dash array string from a CSS style string. Defaults to solid
* stroke if no dash array string is provided.
* @param {string} [da] Dash array as a CSS style string.
*/
setDashArray(da: string): void;
}
/**
* Gets the mapsjs license.
* @returns {string} The license.
*/
export var license: string;
/**
* A simple point class with x and y coordinates.
* @class point
*/
export class point {
constructor(x: number, y: number);
/**
* Returns the x coordinate.
* @returns {number} The x coordinate.
*/
getX(): number;
/**
* Returns the y coordinate.
* @returns {number} The y coordinate.
*/
getY(): number;
/**
* Returns the x and y coordinates of this point as a pointObject.
* @returns {pointObject} Representaton of this point as an pointObject.
*/
toProps(): pointObject;
/**
* Equality comparer between this point and a given reference point.
* @param {point} pt Reference point.
* @returns {boolean} Result of the equality test.
*/
equals(pt: point): boolean;
/**
* Creates a point from this point offset by a given x and y distance.
* @param {number} dx The x offset.
* @param {number} dy The y offset.
* @returns {point} The offset point.
*/
createOffsetBy(dx: number, dy: number): point;
/**
* Creates new n-sided polygon around this point.
* @param {number} sides Number of polygon sides.
* @param {number} radius Distance to polygon points.
* @returns {polygon} The generated polygon.
*/
convertToPoly(side: number, radius: number): geometry.polygon;
/**
* Gets the wkt representation of this point.
* @returns {string} The well known text for this point.
*/
toString(): string;
/**
* Creates a deep copy of this point.
* @returns {point} The new cloned point.
*/
clone(): point;
/**
* Returns this point's bounding box.
* @returns {envelope} The bounding box of the point as an envelope.
*/
getBounds(): envelope;
/**
* Computes distance between this point and a given point in projected
* map units.
* @param {point} pt Point to which to compute distance.
* @returns {number} Distance from this point to the given point in
* projected map units.
*/
distanceTo(pt: point): number;
}
/**
* Exposes static functions that act on points.
* @module point
*/
export module point {
/**
* Computes the distance between two points in coordinate units.
* @param {number} x1 The x coordinate for the first point.
* @param {number} y1 The y coordinate for the first point.
* @param {number} x2 The x coordinate for the second point.
* @param {number} y2 The y coordinate for the second point.
* @returns {number} Distance in coordinate units.
*/
export function distance(x1: number, y1: number, x2: number, y2: number): number;
/**
* Computes the midpoint of two points.
* @param {number} x1 The x coordinate for the first point.
* @param {number} y1 The y coordinate for the first point.
* @param {number} x2 The x coordinate for the second point.
* @param {number} y2 The y coordinate for the second point.
* @return {point} Midpoint point.
*/
export function midpoint(x1: number, y1: number, x2: number, y2: number): point;
}
/**
* Exposes static functions related to the Spherical Mercator projection.
* @module sphericalMercator
*/
export module sphericalMercator {
/**
* Gets the EPSG number for Spherical Mercator.
* @return {number} ESPG number.
*/
export function getEpsg(): number;
/**
* Gets the minimum zoom level for this projection.
* @returns {number} Minimum zoom level.
*/
export function getMinZoomLevel(): number;
/**
* Sets the minimum zoom level for this projection. Normally this is
* set to 1.0 and should not be altered.
* @param {number} minZ Desired minimum zoom level.
*/
export function setMinZoomLevel(minZ: number): void;
/**
* Gets the maxmimum zoom level for this projection.
* @returns {number} Maximum zoom level.
*/
export function getMaxZoomLevel(): number;
/**
* Sets the maximum zoom level for this projection. Normally this is
* set to 20.0 and should not be altered.
* @param {number} maxZ1 Desired maximum zoom level.
*/
export function setMaxZoomLevel(maxZ: number): void;
/**
* Gets the tile height and width in pixels.
* @returns {number} The height and width of the tiles in pixels.
*/
export function getTileSizePix(): number;
/**
* Gets the display DPI, which defaults to 96. Note: The dpi is
* recomputed on page load complete.
* @returns {number} Dots per inch on display.
*/
export function getDpi(): number;
/**
* Set the display DPI, which defaults to 96. Note: The DPI is
* recomputed on page load complete.
* @param {number} dpi Dots per inch on display.
*/
export function setDpi(dpi: number): void;
/**
* Return the equitorial radius in meters for this projection.
* @returns {number} Equitorial radius in meters.
*/
export function getRadius(): number;
/**
* Returns equitorial circumference in meters for this projection
* @returns {number} Equitorial circumference in meters.
*/
export function getCircumference(): number;
/**
* Returns half the equitorial circumference in meters for this projection
* @returns {number} Half of the equitorial circumference in meters.
*/
export function getHalfCircumference(): number;
/**
* Get the envelope in map units for a given quadtree node, i.e. tile,
* based on the given x, y, and z quadtree coordinates.
* @param {number} x The x coordinate.
* @param {number} y The y coordinate.
* @param {number} z The z coordinate.
* @returns {envelope} Envelope of the tile in map units.
*/
export function getQuadTreeNodeToMapEnvelope(x: number, y: number, z: number): envelope;
/**
* Gets the envelope in map units of tiles in the quadtree from an
* evelope in map units and a zoom level.
* @param {envelope} env Envelope for which to find intersecting tiles.
* @param {number} z Zoom level with which to test for intersection.
* @returns {envelope} The envelope in map units of the tiles.
*/
export function getQuadTreeNodeRangeFromEnvelope(env: envelope, z: number): envelope;
/**
* Gets projected map units per pixel for a given zoom level.
* @param {number} zoomLevel Reference zoom level.
* @returns {number} Projection units per pixel.
*/
export function getProjectionUnitsPerPixel(zoomLevel: number): number;
/**
* Gets the required scale transform to apply to shapes so distance
* and area computations yield actual Earth-geodesic units instead of
* projected map units.
* @param {number} mapPtY Reference latitude for the computation.
* @returns {number} Scale transform multiplier.
*/
export function getActualShapeScaleTransform(mapPtY: number): number;
/**
* Gets actual, on-the-ground meters per pixel for a given zoom level
* and map point in map units.
* @param {point} mapPt Reference location for the computation.
* @param {number} z Reference zoom level.
* @returns {number} Meters per pixel multiplier.
*/
export function getActualUnitsPerPixel(mapPt: point, zoomLevel: number): number;
/**
* Gets the optimal zoom level for a given envelope in map units
* based on the envelope of visible device area in pixels.
* @param {envelope} envelopeMap Envelope in map units to display.
* @param {envelope} envelopeDevice Envelope in pixels of visible area.
* @returns {number} Optimal zoom level for viewing envelopeMap.
*/
export function getBestFitZoomLevelByExtents(envelopeMap: envelope, envelopeDevice: envelope): number;
/**
* Gets a quad-key from x, y, and z coordinates.
* @param {number} x The x coordinate.
* @param {number} y The y coordinate.
* @param {number} z The z coordinate.
* @returns {string} Quad-key string.
*/
export function getQuadKeyFromXYZ(x: number, y: number, z: number): string;
/**
* Gets x, y, and z coordinates as an object from a given quad-key.
* @param {string} key Reference quad-key.
* @return {object} JavaScript object of the form {x,y,z}.
*/
export function getXYZFromQuadKey(key: string): { x: number; y: number; z: number; };
/**
* Project a point from latitude/longitude to Spherical Mercator.
* @param {point} lonLat Point object in latitude/longitude.
* @returns {point} The same point in Spherical Mercator.
*/
export function projectFromLatLon(lonLat: point): point;
/**
* Project a point from Spherical Mercator to latitude/longitude.
* @param {point} mapPt Point object in Spherical Mercator.
* @returns {point} The same point in latitude/longitude.
*/
export function deprojectToLatLon(mapPt: point): point;
}
/**
* A geometry object decorated with a geometry style object
* @class styledGeometry
*/
export class styledGeometry {
constructor(geom: geometry, gStyle?: geometryStyle);
/**
* Set this styledGeometry's geometry.
* @param {geometry} g A new Geometry.
*/
setGeometry(g: geometry): void;
/**
* Set this styledGeometry's geometryStyle.
* @param {geometryStyle} gs A new styledGeometry.
*/
setGeometryStyle(gs: geometryStyle): void;
/**
* Gets the styledGeometry's underlying geometry object.
* @returns {geometry} The underlying geometry.
*/
getGeometry(): geometry;
/**
* Gets the styledGeometry's underlying geometryStyle object.
* @returns {geometryStyle} The underlying geometry style.
*/
getGeometryStyle(): geometryStyle;
/**
* Gets path outline thickness in pixels.
* @returns {number} Thickness in pixels.
*/
getOutlineThicknessPix(): number;
/**
* Sets path outline thickness in pixels.
* @param {number} t Thickness in pixels.
*/
setOutlineThicknessPix(t: number): void;
/**
* Gets path outline color as a CSS style string.
* @returns {string} Outline color as a CSS style string.
*/
getOutlineColor(): string;
/**
* Gets path outline opacity in decimal format.
* @param {number} Outline opacity.
*/
setOutlineColor(c: string): void;
/**
* Gets path outline opacity in decimal format.
* @returns {number} Outline opacity.
*/
getOutlineOpacity(): number;
/**
* Set path outline opacity to a decimal between 0 and 1.
* @param {number} o Outline opacity.
*/
setOutlineOpacity(o: number): void;
/**
* Gets fill color as a CSS style string.
* @returns {string} Fill color as a CSS style string.
*/
getFillColor(): string;
/**
* Sets fill color as a CSS style string.
* @param {string} c Fill color as a CSS style string.
*/
setFillColor(c: string): void;
/**
* Gets fill opacity in decimal format.
* @returns {number} Fill opacity.
*/
getFillOpacity(): number;
/**
* Sets fill opacity to a decimal between 0 and 1.
* @param {number} o Fill opacity.
*/
setFillOpacity(o: number): void;
/**
* Gets the dash array as a string.
* @returns {string} Dash array as astring.
*/
getDashArray(): string;
/**
* Sets dash array string from a CSS style string. Defaults to solid
* stroke if no dash array string is provided.
* @param {string} [da] Dash array as a CSS style string.
*/
setDashArray(da: string): void;
/**
* Gets optional animation function called when SVG node is created.
* @returns {function} Function with the signature animation(pathElement, loopback).
*/
getAnimation(): (pathElement: HTMLElement, loopback: () => void) => void;
/**
* You can use the loopback parameter on complete to call itself and
* create repeating animation.
* @param {function} Function with the signature animation(pathElement, loopback).
*/
setAnimation(action: (pathElement: HTMLElement, loopback: () => void) => void): void;
/**
* Renders this geometry as an SVG path. Note: We attach original
* geometry bounds to svg doc as an expando.
* @param {string} key Identifer to keep track of the SVG DOM element.
* @param {number} mupp Map units per pixel with which to create the SVG element.
* @returns {HTMLElement} A new SVG document root.
*/
createSvgPathElement(key: string, mapUnitsPerPix: number): HTMLElement;
/**
* Renders this to a canvas context.
* @param {CanvasRenderingContext2D} ctx Canvas context to which to render.
*/
renderPathToCanvasContext(ctx: CanvasRenderingContext2D): void;
}
/**
* The mapjs version.
*/
export var version: string;
/**
* Exposes static functions for working with well known text.
* @module wkt
*/
export module wkt {
/**
* Parses WKT as a point.
* @param {string} w A WKT string.
* @returns {point} The parsed point.
*/
export function parsePoint(wkt: string): point;
/**
* Parses WKT as a multipoint.
* @param [string} w A WKT string.
* @retuns {geometry} The parsed multipoint geometry.
*/
export function parseMultiPoint(wkt: string): geometry;
/**
* Parses WKT as an open path geometry with a single set.
* @param {string} w A WKT string.
* @returns {geometry} The parsed open path geometry.
*/
export function parseLineString(wkt: string): geometry;
/**
* Parses WKT as an open path geometry with multiple sets.
* @param {string} w A WKT string.
* @returns {geometry} The parsed open path geometry.
*/
export function parseMultiLineString(wkt: string): geometry;
/**
* Parses WKT as a closed path geometry with a single set.
* @param {string} w A WKT string.
* @returns {geometry} The parsed closed path geometry.
*/
export function parsePolygon(wkt: string): geometry;
/**
* Parses WKT as a closed path geometry with multiple sets.
* @param {string} w A WKT string.
* @returns {geometry} The parsed closed path geometry.
*/
export function parseMultiPolygon(wkt: string): geometry;
/**
* Parses WKT as a geometry and determines its type from the string.
* @param {string} w The WKT string.
* @returns {any} The parsed shape, a point, geometry, or an array of
* polygons depending on the WKT.
*/
export function parse(wkt: string): any;
/**
* Converts an array of polygons to an OGC compliant multipolygon WKT string.
* @param {polygon[]} polys Set of polygons to parse into WKT.
* @returns {geometry} The OGC compliant WKT for the polygons.
*/
export function toMultiPolygonString(polys: geometry.polygon[]): string;
}
/**
* Exposes various tile-related constructors, including layers, descriptors,
* and requestors.
* @module tile
*/
export module tile {
/**
* A tile layer is a view on the map containing an array of rectangular content.
* @class layer
*/
export class layer {
constructor(id: string, useBackdrop?: boolean, maxConcurrentRequests?: number);
/**
* @param {number} m - number for margin in pixels
*/
// setContentExtentsMarginInPixels(m: number): void;
/**
* Gets ID associated with this tile layer.
* @returns {string} ID of the layer.
*/
getId(): string;
/**
* Determines whether this tile layer uses a backdrop.
* @returns {boolean} Whether or not the layer uses a backdrop.
*/
getUseBackdrop(): boolean;
/**
* Returns the tile layer's descriptor, which describes how
* requested content is rendered or styled.
* @returns {object} The tile layer's descriptor.
*/
getDescriptor(): any;
/**
* Sets the tile layer's descriptor, which describes how requested
* content is rendered or styled.
* @param {function} d A descriptor for this tile layer.
*/
setDescriptor(d: any): void;
/**
* Notifies the tile layer to check for changes to its descriptor.
*/
notifyDescriptorChange(): void;
/**
* Returns this tile layer's requestor which defines what kind of
* content to get and where to get it.
* @returns {requestor} This tile layer's requestor.
*/
getRequestor(): tile.requestor;
/**
* Sets this tile layer's requestor, which defines what kind of
* content to get and where to get it.
* @param {tile.requestor} req A requestor object.
* @param {tile.requestor} [desc] Descriptor object so that both
* can be set in one call and incur only one content change event.
*/
setRequestor(req: tile.requestor, desc?: any): void;
/**
* Returns this tile layer's renderer if it exists, which defines
* how geometry data for a quadView is rendered.
* @returns {renderer} The renderer object.
*/
getRenderer(): tile.renderer;
/**
* Sets optional renderer which defines how geometry data for
* quadView is rendered.
* @param {renderer} r The renderer delegate function with
* signature renderer(quadview).
*/
setRenderer(r: any): void;
/**
* Notifies the tile layer to check for changes to its renderer.
*/
notifyRendererChange(): void;
/**
* Gets the visibility state of this tile layer.
* @returns {boolean} Whether or not this layer is visible.
*/
getIsVisible(): boolean;
/**
* Sets visibility state of this tile layer.
* @param {boolean} v Whether this layer should be visible or not.
*/
setIsVisible(v: boolean): void;
/**
* Gets the opacity of this tile layer.
* @returns {number} Opacity as a decimal.
*/
getOpacity(): number;
/**
* Sets opacity of this tile layer.
* @param {number} o Opacity as a decimal.
*/
setOpacity(o: number): void;
/**
* Gets minimum zoom level where this tile layer is visible.
* @returns {number} The minimum zoom level.
*/
getMinZoomLevel(): number;
/**
* Sets minimum zoom level where this tile layer is visible.
* @param {number} minZ The desired minimum zoom level.
*/
setMinZoomLevel(minZ: number): void;
/**
* Gets maximum zoom level where this tile layer is visible.
* @returns {number} The maximum zoom level.
*/
getMaxZoomLevel(): number;
/**
* Sets maximum zoom level where this tile layer is visible.
* @param {number} maxZ The desired maximum zoom level.
*/
setMaxZoomLevel(maxZ: number): void;
/**
* Sets pixel bleed on quadTiles, which defaults to 1. Setting this
* to zero for overlay layers with translucent polygon fills is
* recommended. Bleed overlap can create faint lines at tile
* boundries when fill is not opaque.
* @param {number} bleed The number of pixels to bleed.
*/
setTileBleedPix(bleed: number): void;
/**
* Sets whether or not to retain and display previous level tile
* content as you change tile levels to provide a nice zoom level
* change effect. Once the next level is loaded the old level
* content is always discarded. This should be set to false if there
* is translucent content to display. Defaults to true (prior to
* version 9.0.0001 this value had the same state as useBackdrop.)
* @param {boolean} ret Whether or not to retain interlevel content.
*/
setRetainInterlevelContent(retain: boolean): void;
/**
* Enables or disables the fade in on tile content, which defaults to enabled.
* @param {boolean} fadeIn Whether or not fade in on tile content
* should be enabled.
*/
setEnableTileFadeIn(fadeIn: boolean): void;
/**
* Sets the default action to take on error.
* @param {function} action Function to execute on error.
*/
setNotifyErrorAction(action: () => void): void;
/**
* Sets an optional function to be called when the tile loading
* queue for this layer has emptied.
* @param {function} action Callback function.
*/
setNotifyLoadingQueueHasEmptiedAction(action: () => void): void;
/**
* Sets the optional function to be called by this layer's tile
* loader during processing. The supplied progress function takes
* tiles loaded and tiles total parameters.
* @param {function} action Callback of the signature action(tileLoaded, tilesTotal).
*/
setNotifyLoadingQueueProgressAction(action: (tilesLoaded: number, tilesTotal: number) => void): void;
/**
* Sets optional request processor for this tile layer. This is
* an advanced feature allowing developers to tap into tile
* request pipeline for purposes of customizing requests or manage
* custom caching. This is also the mechanism used for offline
* apps with frameworks such as phonegap.
* @param {function} Processor function with signature
* processor(requestor, descriptor, quad, timeoutMs, complete, error)
*/
setRequestProcessor(processorFunc: (
requestor: tile.requestor,
descriptor: any,
quad: tile.quad,
timeoutMs: number,
completeAction: (img: HTMLElement) => void,
errorAction: (msg: string) => void) => void): void;
/**
* Instructs the tile loader to populate a specified tile pyramid.
* This is used to fetch content (e.g. bitmap tiles) and preload
* it into the browser cache.
* @param {envelope} extents Envelope for which to fetch content.
* @param {number} startZoomLevel Minimum zoom level for which to
* fetch content.
* @param {number} endZoomLevel Maximum zoom level for which to
* fetch content.
*/
preload(extents: envelope, startZoomLevel: number, endZoomLevel: number): void;
/**
* Composes an array of quadtiles with composition information and
* requestor endpoints. This can be used to create static images
* or print-ready versions of this tile layer at arbitrary extents
* (both source and target) For example: If you needed a 5x3 inch
* 300 dpi output you can specify extents in device units to be
* 1500x900. This function determines the correct zoom level so
* that the source extents fits in the target extents to the
* nearest integer zoom level.
* @param {envelope} extentsMapUnits Source extents in map units.
* @param {envelope} extentsDeviceUnits Target extents in pixels.
* @returns {object} Composed object in the form
* {quadCollection, endpointCollection, idxMinX, idxMinY, ulX, ulY }
* where quadCollection is an array of quad objects, endpointCollection
* is an array of REST endpoints from which to obtain the tiled content,
* idxMinX and idxMinY are the minimum x and y tile indicies of the
* collection respectively, and ulX and ulY are the offset in pixels
* of the upper left tile from the upper left target extents.
*/
compose(extentsMapUnits: envelope, extentsDeviceUnits: envelope): {
quadCollection: tile.quad[];
endpointCollection: string[];
idxMinX: number;
idxMinY: number;
ulX: number;
ulY: number;
};
/**
* Unbind all associations with this tile layer to facilitate garbage collection
*/
dispose(): void;
}
/**
* A layerOptions object is a method for constructing a tile layer for
* immediate use, for example by passing it to the jQuery widget or
* in the knockout binding.
* @class layerOptions
*/
export class layerOptions {
constructor(id: string, options: {
useBackdrop?: boolean;
maxConcurrentRequests?: number;
requestor?: tile.requestor;
descriptor?: any;
renderer?: tile.renderer;
requestProcessor?: any;
visible?: boolean;
opacity?: number;
minZoomLevel?: number;
maxZoomLevel?: number;
tileBleedPix?: number;
retainInterlevelContent?: boolean;
enableTileFadeIn?: boolean;
notifyErrorAction?: (msg?: string) => void;
notifyLoadingQueueHasEmptiedAction?: () => void;
});
/**
* Returns the underlying tile layer.
* @returns {layer} The underlying tile layer.
*/
getTileLayer(): tile.layer;
/**
* Gets ID associated with the underlying tile layer.
* @returns {string} ID of the layer.
*/
getId(): string;
/**
* Gets this layerOptions object as a JavaScript object.
*/
getOptions(): any;
}
/**
* The quad class represents a quad tile within three dimensional
* coordinate space.
* @class quad
*/
export class quad {
/**
* Gets the x coodinate of this quad tile.
* @returns {number} The x coordinate of this quad tile.
*/
getX(): number;
/**
* Gets the y coordinate of this quad tile.
* @returns {number} The y coordinate of this quad tile.
*/
getY(): number;
/**
* Gets the z coordinate of this quad tile, or depth.
* @returns {number} The z coordinate of this quad tile.
*/
getLevel(): number;
/**
* Gets the envelope in map units which encompasses this quad tile.
* @returns {envelope} The encompassing envelope of this quad tile.
*/
getEnvelope(): envelope;
/**
* Gets the string representation of this quad tile as a quad key.
* @returns {string} Quad key for this quad tile as a string.
*/
toString(): string;
/**
* Gets the quad key for this quad tile as a string.
* @returns {string} Quad key for this quad tile as a string.
*/
getKey(): string;
/**
* Compares this quad tile with another quad tile and determines
* whether or not they are equal.
* @param {quad} Quad tile with which to check for equality with this quad tile.
* @returns {boolean} Result of the equality test.
*/
equals(q: quad): boolean;
/**
* Generates the quad tile which is a given number of levels above
* this tile in the pyramid and in which this quad tile is contained.
* @param {number} ancestorsBack Number of levels above this tile the
* generated tile should be.
* @returns {quad} The generated parent tile.
*/
factoryParent(ancestorsBack: number): quad;
}
/**
* Exposes static functions for generating and handling quad tiles.
* @module quad
*/
export module quad {
/**
* Generates a new quad tile based on a given quad key.
* @param {string} key The quad key from which to generate the quad tile.
* @returns The generated quad tile.
*/
export function factoryQuadFromKey(key: string): quad;
}
/**
* A tile renderer handles converting JSON vector content loaded from the
* MapDotNet REST feature service into a canvas rendering on a tile.
* @class renderer
*/
export class renderer {
constructor(options? : {
renderPoint?: (pt: point, context: CanvasRenderingContext2D) => void;
renderGeometry?: (shape: geometry, context: CanvasRenderingContext2D) => void;