Update to latest mapsjs definition file

This commit is contained in:
Matthew James Davis
2014-02-12 21:08:59 +09:00
parent 939223787d
commit dc8b0911bd
+92 -31
View File
@@ -423,7 +423,7 @@ declare module 'mapsjs' {
* @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;
getActualDistance(idx?: number): number;
/**
* Determines whether this polyline intersects a given geometry.
@@ -504,7 +504,7 @@ declare module 'mapsjs' {
* @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;
getActualArea(idx?: number): number;
/**
* Calculates perimeter of a ring in a polygon by index according
@@ -513,7 +513,7 @@ declare module 'mapsjs' {
* @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;
getActualPerimeter(idx?: number): number;
/**
* Determines whether this polygon intersects a given geometry.
@@ -543,7 +543,7 @@ declare module 'mapsjs' {
* @class geometryStyle
*/
export class geometryStyle {
constructor();
constructor(options?: styleObj);
/**
* Gets path outline thickness in pixels.
@@ -894,8 +894,14 @@ declare module 'mapsjs' {
* @class styledGeometry
*/
export class styledGeometry {
constructor(geom: geometry, gStyle: geometryStyle);
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.
@@ -907,6 +913,12 @@ declare module 'mapsjs' {
* @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.
@@ -928,7 +940,7 @@ declare module 'mapsjs' {
/**
* Gets path outline opacity in decimal format.
* @returns {number} Outline opacity.
* @param {number} Outline opacity.
*/
setOutlineColor(c: string): void;
@@ -1317,6 +1329,11 @@ declare module 'mapsjs' {
ulX: number;
ulY: number;
};
/**
* Unbind all associations with this tile layer to facilitate garbage collection
*/
dispose(): void;
}
/**
@@ -2216,8 +2233,53 @@ declare module 'mapsjs' {
* @returns {number} maxY coord as integer
*/
maxY: number;
}
}
interface extentChangeStatsObj {
centerX: number;
centerY: number;
centerLat: number;
centerLon: number;
zoomLevel: number;
mapScale: number;
mapScaleProjected: number;
mapUnitsPerPixel: number;
extents: envelope;
}
interface repositionStatsObj {
centerX: number;
centerY: number;
zoomLevel: number;
mapUnitsPerPixel: number;
}
interface beginDigitizeOptions {
key?: string;
shapeType: string;
geometryStyle?: geometryStyle;
styledGeometry?: styledGeometry;
nodeTapAndHoldAction?: (setIdx: number, idx: number) => boolean;
nodeMoveAction?: (x: number, y: number, actionType: string) => any;
shapeChangeAction?: () => void;
envelopeEndAction?: (env: envelope) => void;
circleEndAction?: (circle: geometry.polygon) => void;
suppressNodeAdd?: boolean;
leavePath?: boolean;
}
interface styleObj {
fillColor?: string;
fillOpacity?: number;
outlineColor?: string;
outlineOpacity?: number;
outlineThicknessPix?: number
dashArray?: string;
}
interface mapsjsWidget {
/**
@@ -2507,12 +2569,18 @@ declare module 'mapsjs' {
* content area DOM. If an attempt to add a geometry is made with the same
* key, the geometry is swapped out. You must remove using removePathGeometry
* for resource cleanup.
* @param {styleGeometry} styledGeom THe styledGeometry to render.
* @param {string} key String used to tie a geometry to its SVG
* @param {styleGeometry} styledGeom The styledGeometry to render.
* @param {string} key String used to tie a geometry to its SVG
* @param {function} addAction optional function that is called when mapsjs adds an svg element to the DOM representing this styledGeometry.
* @param {function} removeAction optional function that is called when mapsjs adds an svg element to the DOM representing this styledGeometry.
* rendering in the DOM.
* @returns {element} The SVG element which was added to the DOM.
*/
addPathGeometry(styledGeom: styledGeometry, key: string): void;
addPathGeometry(
styledGeom: styledGeometry,
key: string,
addAction?: (svg: SVGElement) => void,
removeAction?: (svg: SVGElement) => void): SVGElement;
/**
* Updates an existing path geometry to reflect a style change.
@@ -2524,41 +2592,34 @@ declare module 'mapsjs' {
/**
* Removes a styledGeometry from display.
* @param {string} key The key of the geometry to remove.
* @returns {element} The SVG element which was removed from the DOM.
*/
removePathGeometry(key: string): void;
removePathGeometry(key?: string): SVGElement;
/**
* Initiates digitization on the map control. This creates a new
* geometry and adds verticies to the geometry accord to mouse
* click locations.
* @param {object} options JavaScript object of the form { key,
* shapeType, geometryStyle, nodeTapAndHoldAction, nodeMoveAction,
* shapeChangeAction, envelopeEndAction, supressNodeAdd, leavePath }
* shapeType, geometryStyle, styledGeometry, nodeTapAndHoldAction, nodeMoveAction,
* shapeChangeAction, envelopeEndAction, circleEndAction, supressNodeAdd, leavePath }
* where key is a a string associated with this geometry, shapeType
* is the type of shape this geometry is, one of 'point', 'path', or
* 'polygon', geometryStyle is a geometryStyle which should be applied
* to the digitized geometry, nodeTapAndHoldAction is a callback invoked
* is the type of shape this geometry is, one of 'polygon', 'polyline', 'multipoint', 'envelope' or 'circle',
* geometryStyle is a geometryStyle which should be applied
* to the digitized geometry, styledGeometry is an optional styledGeometry for existing paths to edit, set this to enter edit mode,
* nodeTapAndHoldAction is a callback invoked
* when any point in the geometry is clicked and held and has the
* signature nodeTapAndHoldAction(setIdx, idx), nodeMoveAction is a
* callback invoked after any node is dragged to a new location and
* has signature nodeMoveAction(x, y, actionType), shapeChangeAction
* is a callback that is invoked after the geometry shape changes and,
* has signature shapeChangeAction(), envelopeEndAction is a callback
* has signature shapeChangeAction(shape), envelopeEndAction is a callback
* invoked after an envelope is created and has signature envelopeEndAction(envelope),
* circleEndAction is similar to envelopeEndAction but takes a geometry.polygon representing the circle,
* and leavePath is a flag that indicates whether the digitized shape
* should be left on the map after digitization is complete.
*/
beginDigitize(options: {
key?: string;
shapeType: string;
geometryStyle?: geometryStyle;
nodeTapAndHoldAction?: (setIdx: number, idx: number) => boolean;
nodeMoveAction?: (x: number, y: number, actionType: string) => any;
shapeChangeAction?: () => void;
envelopeEndAction?: (env: envelope) => void;
suppressNodeAdd?: boolean;
leavePath?: boolean;
}): void;
beginDigitize(options: beginDigitizeOptions): void;
endDigitize(): void;
/**
@@ -2601,7 +2662,7 @@ declare module 'mapsjs' {
* the form { centerX, centerY, centerLat, centerLon, zoomLevel, mapScale,
* mapScaleProjected, mapUnitsPerPixel, extents }.
*/
setExtentChangeCompleteAction(action: (vals: {}) => void): void;
setExtentChangeCompleteAction(action: (vals: extentChangeStatsObj) => void): void;
/**
* Set the function called when map content (map tiles and fixed elements) are
@@ -2611,7 +2672,7 @@ declare module 'mapsjs' {
* completes repositioning with signature action(object) where object
* is of the form { centerX, centerY, zoomLevel, mapUnitsPerPixel }.
*/
setContentRepositionAction(action: (vals: {}) => void): void;
setContentRepositionAction(action: (vals: repositionStatsObj) => void): void;
/**
* Sets function called when map is clicked or tapped.