September Update
This commit is contained in:
Родитель
c764a7483a
Коммит
3dc7ef578a
15
Example.ts
15
Example.ts
|
@ -24,8 +24,8 @@ layer.add(pin);
|
|||
|
||||
map.layers.insert(layer);
|
||||
|
||||
Microsoft.Maps.loadModule('Microsoft.Maps.GeoJSON', () => {
|
||||
Microsoft.Maps.GeoJSON.readFromUrl('URL to file', (data) => {
|
||||
Microsoft.Maps.loadModule('Microsoft.Maps.GeoJson', () => {
|
||||
Microsoft.Maps.GeoJson.readFromUrl('URL to file', (data) => {
|
||||
if (data instanceof Array) {
|
||||
//Data is an array of shapes.
|
||||
} else {
|
||||
|
@ -82,6 +82,17 @@ Microsoft.Maps.loadModule('Microsoft.Maps.Directions', () => {
|
|||
directionsManager.calculateDirections();
|
||||
});
|
||||
|
||||
Microsoft.Maps.loadModule('Microsoft.Maps.DataBinning', () => {
|
||||
var dataBinLayer = new Microsoft.Maps.DataBinningLayer();
|
||||
dataBinLayer.setPushpins(<Microsoft.Maps.Pushpin[]>Microsoft.Maps.TestDataGenerator.getPushpins(100));
|
||||
dataBinLayer.setOptions({
|
||||
scaleCallback: (info, min, max) => {
|
||||
return info.metrics.count / max.count;
|
||||
}
|
||||
});
|
||||
map.layers.insert(dataBinLayer);
|
||||
});
|
||||
|
||||
|
||||
/***********************
|
||||
* Custom Overlay Example
|
||||
|
|
|
@ -53,7 +53,7 @@ or you can add a reference to the individual module definitions.
|
|||
| [Clustering](https://msdn.microsoft.com/en-us/library/mt712807.aspx) | scripts/MicrosoftMaps/Modules/Clustering.d.ts |
|
||||
| [Directions](https://msdn.microsoft.com/en-US/library/mt748655.aspx) | scripts/MicrosoftMaps/Modules/Directions.d.ts |
|
||||
| [Drawing Tools](https://msdn.microsoft.com/en-us/library/mt750543.aspx) | scripts/MicrosoftMaps/Modules/DrawingTools.d.ts |
|
||||
| [GeoJSON](https://msdn.microsoft.com/en-us/library/mt712806.aspx) | scripts/MicrosoftMaps/Modules/GeoJSON.d.ts |
|
||||
| [GeoJson](https://msdn.microsoft.com/en-us/library/mt712806.aspx) | scripts/MicrosoftMaps/Modules/GeoJson.d.ts |
|
||||
| [Heat Map Layer](https://msdn.microsoft.com/en-us/library/mt712868.aspx) | scripts/MicrosoftMaps/Modules/HeatMapLayer.d.ts |
|
||||
| [Search](https://msdn.microsoft.com/en-us/library/mt712846.aspx) | scripts/MicrosoftMaps/Modules/Search.d.ts |
|
||||
| [Spatial Data Services](https://msdn.microsoft.com/en-us/library/mt712849.aspx) | scripts/MicrosoftMaps/Modules/SpatialDataServices.d.ts |
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
|
||||
<metadata>
|
||||
<id>Microsoft.BingMaps.V8.TypeScript</id>
|
||||
<version>1.0.11</version>
|
||||
<version>1.0.12</version>
|
||||
<title>Bing Maps V8 TypeScript Definitions</title>
|
||||
<authors>Microsoft</authors>
|
||||
<owners>microsoft bingmaps</owners>
|
||||
|
@ -20,9 +20,11 @@
|
|||
<files>
|
||||
<file src="..\scripts\MicrosoftMaps\Modules\Autosuggest.d.ts" target="content\scripts\MicrosoftMaps\Modules\Autosuggest.d.ts" />
|
||||
<file src="..\scripts\MicrosoftMaps\Modules\Clustering.d.ts" target="content\scripts\MicrosoftMaps\Modules\Clustering.d.ts" />
|
||||
<file src="..\scripts\MicrosoftMaps\Modules\Contour.d.ts" target="content\scripts\MicrosoftMaps\Modules\Contour.d.ts" />
|
||||
<file src="..\scripts\MicrosoftMaps\Modules\DataBinning.d.ts" target="content\scripts\MicrosoftMaps\Modules\DataBinning.d.ts" />
|
||||
<file src="..\scripts\MicrosoftMaps\Modules\Directions.d.ts" target="content\scripts\MicrosoftMaps\Modules\Directions.d.ts" />
|
||||
<file src="..\scripts\MicrosoftMaps\Modules\DrawingTools.d.ts" target="content\scripts\MicrosoftMaps\Modules\DrawingTools.d.ts" />
|
||||
<file src="..\scripts\MicrosoftMaps\Modules\GeoJSON.d.ts" target="content\scripts\MicrosoftMaps\Modules\GeoJSON.d.ts" />
|
||||
<file src="..\scripts\MicrosoftMaps\Modules\GeoJson.d.ts" target="content\scripts\MicrosoftMaps\Modules\GeoJson.d.ts" />
|
||||
<file src="..\scripts\MicrosoftMaps\Modules\HeatMapLayer.d.ts" target="content\scripts\MicrosoftMaps\Modules\HeatMapLayer.d.ts" />
|
||||
<file src="..\scripts\MicrosoftMaps\Modules\Search.d.ts" target="content\scripts\MicrosoftMaps\Modules\Search.d.ts" />
|
||||
<file src="..\scripts\MicrosoftMaps\Modules\SpatialDataService.d.ts" target="content\scripts\MicrosoftMaps\Modules\SpatialDataService.d.ts" />
|
||||
|
|
21
package.json
21
package.json
|
@ -1,17 +1,32 @@
|
|||
{
|
||||
"name": "bingmaps",
|
||||
"version": "1.0.11",
|
||||
"version": "1.0.12",
|
||||
"description": "These are the official TypeScript definitions for the Bing Maps V8 SDK. These can be used to provide intellisense and rich error detection to your IDE.",
|
||||
"typings": "index.d.ts",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/Microsoft/Bing-Maps-V8-TypeScript-Definitions.git"
|
||||
},
|
||||
"keywords": ["Microsoft", "Bing Maps", "Maps", "GIS", "TypeScript", "V8", "Web", "Map", "Geospatial", "JavaScript"],
|
||||
"keywords": [
|
||||
"Microsoft",
|
||||
"Bing Maps",
|
||||
"Maps",
|
||||
"GIS",
|
||||
"TypeScript",
|
||||
"V8",
|
||||
"Web",
|
||||
"Map",
|
||||
"Geospatial",
|
||||
"JavaScript"
|
||||
],
|
||||
"author": "Bing Maps <bingmapsoss@microsoft.com> (https://www.microsoft.com/maps/v8control.aspx)",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/Microsoft/Bing-Maps-V8-TypeScript-Definitions/issues"
|
||||
},
|
||||
"homepage": "https://github.com/Microsoft/Bing-Maps-V8-TypeScript-Definitions#readme"
|
||||
"homepage": "https://github.com/Microsoft/Bing-Maps-V8-TypeScript-Definitions#readme",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,9 +26,11 @@
|
|||
|
||||
/// <reference path="Modules/Autosuggest.d.ts"/>
|
||||
/// <reference path="Modules/Clustering.d.ts"/>
|
||||
/// <reference path="Modules/Contour.d.ts"/>
|
||||
/// <reference path="Modules/DataBinning.d.ts"/>
|
||||
/// <reference path="Modules/Directions.d.ts"/>
|
||||
/// <reference path="Modules/DrawingTools.d.ts"/>
|
||||
/// <reference path="Modules/GeoJSON.d.ts"/>
|
||||
/// <reference path="Modules/GeoJson.d.ts"/>
|
||||
/// <reference path="Modules/HeatMapLayer.d.ts"/>
|
||||
/// <reference path="Modules/Search.d.ts"/>
|
||||
/// <reference path="Modules/SpatialDataService.d.ts"/>
|
||||
|
|
|
@ -741,7 +741,7 @@ declare module Microsoft.Maps {
|
|||
* Besides using formatted tile URLs, you can also specify a callback function as the uriConstructor. This is useful if you need to be able to
|
||||
* build custom tile URL’s that may require some additional calculations for a tile.
|
||||
*/
|
||||
uriConstructor: string | ((tile: PyramidTileId) => void);
|
||||
uriConstructor: string | ((tile: PyramidTileId) => string);
|
||||
}
|
||||
|
||||
/** Represents options that can be used to set the view of the map. */
|
||||
|
|
|
@ -0,0 +1,113 @@
|
|||
/*
|
||||
* Copyright(c) 2016 Microsoft Corporation. All rights reserved.
|
||||
*
|
||||
* This code is licensed under the MIT License (MIT).
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
* of the Software, and to permit persons to whom the Software is furnished to do
|
||||
* so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/// <reference path="../Microsoft.Maps.d.ts"/>
|
||||
|
||||
declare module Microsoft.Maps {
|
||||
|
||||
/**
|
||||
* The contour layer options
|
||||
*/
|
||||
interface IContourLayerOptions {
|
||||
/** The z-index of this layer */
|
||||
zIndex?: number;
|
||||
|
||||
/** Whether the layer is visible */
|
||||
visible?: boolean;
|
||||
|
||||
/** A callback function which defines the color of the contour line fill. */
|
||||
colorCallback?: (contourValue: number | string) => string | Color;
|
||||
|
||||
/** The polygon options that apply to all contour lines of this layer */
|
||||
polygonOptions?: IPolygonOptions;
|
||||
}
|
||||
|
||||
/**
|
||||
* The contour line of a contour layer
|
||||
*/
|
||||
export class ContourLine extends Polygon {
|
||||
/** The contour lines that are directly nested inside this contour line */
|
||||
public innerContourLines: ContourLine[];
|
||||
|
||||
/** The outer/parent contour line of this contour */
|
||||
public outerContourLine: ContourLine;
|
||||
|
||||
/** The data value associated with this contour line */
|
||||
public contourValue: number | string;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @param boundary The boundary of this contour line
|
||||
* @param contourValue The value associated with this contour line
|
||||
*/
|
||||
constructor(boundary: Location[], contourValue?: number | string);
|
||||
}
|
||||
|
||||
/**
|
||||
* The contour layer class.
|
||||
*/
|
||||
export class ContourLayer extends Layer {
|
||||
/**
|
||||
* @constructor
|
||||
* @param contourLines The contour lines that compose this layer.
|
||||
* @param options The contour layer options.
|
||||
*/
|
||||
constructor(contourLines: ContourLine[], options?: IContourLayerOptions);
|
||||
|
||||
/**
|
||||
* Clears all data on the contour layer.
|
||||
*/
|
||||
public clear(): void;
|
||||
|
||||
/**
|
||||
* Gets the contour lines of this layer.
|
||||
* @returns The contour lines of this layer.
|
||||
*/
|
||||
public getContourLines(): ContourLine[];
|
||||
|
||||
/**
|
||||
* Gets the polygons that were generated from the contour lines in this layer.
|
||||
* @returns The polygons that were generated from the contour lines in this layer.
|
||||
*/
|
||||
public getContourPolygons(): Polygon[];
|
||||
|
||||
/**
|
||||
* Retrieves the options of this contour layer.
|
||||
* @returns The options of this contour layer.
|
||||
*/
|
||||
public getOptions(): IContourLayerOptions;
|
||||
|
||||
/**
|
||||
* Sets the contour lines used to calculate the polygon areas of this layer.
|
||||
* @param contourLines The contour lines used to calculate the polygon areas of this layer.
|
||||
*/
|
||||
public setContourLines(contourLines: ContourLine[]): void;
|
||||
|
||||
/**
|
||||
* Sets the options of the contour layer.
|
||||
* @param options The new options to update the layer.
|
||||
*/
|
||||
public setOptions(options: IContourLayerOptions): void;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,173 @@
|
|||
/*
|
||||
* Copyright(c) 2016 Microsoft Corporation. All rights reserved.
|
||||
*
|
||||
* This code is licensed under the MIT License (MIT).
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
* of the Software, and to permit persons to whom the Software is furnished to do
|
||||
* so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/// <reference path="../Microsoft.Maps.d.ts"/>
|
||||
/// <reference path="SpatialMath.d.ts"/>
|
||||
|
||||
declare module Microsoft.Maps {
|
||||
|
||||
/**
|
||||
* Specifies the shape of data bin rendered in the layer.
|
||||
*/
|
||||
export enum DataBinType {
|
||||
/* Renders data bins as circles in a square grid. */
|
||||
circle,
|
||||
|
||||
/* Renders data bins as hexagons with a flat top edge. */
|
||||
hexagon,
|
||||
|
||||
/* Renders data bins as circles in a hexagonal grid. */
|
||||
hexCircle,
|
||||
|
||||
/* Renders data bins as hexagons with a pointy top corner. */
|
||||
pointyHexagon,
|
||||
|
||||
/* Renders data bins as a square grid. */
|
||||
square
|
||||
}
|
||||
|
||||
/**
|
||||
* A set options the define how a data binning layer is rendered.
|
||||
*/
|
||||
export interface IDataBinningOptions {
|
||||
/* The name of a property in the Pushpin.metadata object on which to perform calculations (average, count, sum) against the pushpins in each data bin. */
|
||||
aggregationProperty?: string;
|
||||
|
||||
/*
|
||||
* A callback function which defines the color a data bin polygon should be. This callback recieves data bin information
|
||||
* along with the min and max calculated metrics for the data set. If set, this callback function must return a color value.
|
||||
*/
|
||||
colorCallback?: (binInfo: IDataBinInfo, min: IDataBinMetrics, max: IDataBinMetrics) => string | Color;
|
||||
|
||||
/* The shape of the data bin to generate. Default: hexagon */
|
||||
dataBinType?: DataBinType;
|
||||
|
||||
/* The distance units of the radius option. Default: meters */
|
||||
distanceUnits?: SpatialMath.DistanceUnits;
|
||||
|
||||
/* The default options used for rendering the data bin polygons. */
|
||||
polygonOptions?: IPolygonOptions;
|
||||
|
||||
/*
|
||||
* A spatial distance which will be converted into a pixel distance at the equater and used to generate symetrically sized data bins
|
||||
* that have the apprimate spatial distance radius. Default: 1000
|
||||
*/
|
||||
radius?: number;
|
||||
|
||||
/*
|
||||
* A callback function which defines how much to scale a data bins size. This callback recieves data bin information
|
||||
* along with the min and max calculated metrics for the data set. If set, this callback function must return a number between 0 and 1.
|
||||
*/
|
||||
scaleCallback?: (binInfo: IDataBinInfo, min: IDataBinMetrics, max: IDataBinMetrics) => number;
|
||||
}
|
||||
|
||||
/**
|
||||
* A set of values calculated from the pushpins in a data bin.
|
||||
*/
|
||||
export interface IDataBinMetrics {
|
||||
|
||||
/* The average value of the aggregation property of the pushpins in a data bin. */
|
||||
average?: number;
|
||||
|
||||
/* The number of pushpins in a data bin. */
|
||||
count?: number;
|
||||
|
||||
/* The number of pushpins in the data bin who's aggregation property has a value. */
|
||||
countNotBlank?: number;
|
||||
|
||||
/* The number of pushpins in the data bin who's aggregation property is a valid number. */
|
||||
countNumbers?: number;
|
||||
|
||||
/* The sum of the aggregation property of the pushpins in a data bin. */
|
||||
sum?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* The result of a calculated data bin.
|
||||
*/
|
||||
export interface IDataBinInfo {
|
||||
/* An array of all the pushpins that are in the data bin. */
|
||||
containedPushpins: Microsoft.Maps.Pushpin[];
|
||||
|
||||
/* A set of calculated metric values determined using the aggregationProperty value of all the pushpins contained in the data bin. */
|
||||
metrics: IDataBinMetrics;
|
||||
}
|
||||
|
||||
/**
|
||||
* A polygon which represents a data bin on the map and contains the data bin information.
|
||||
*/
|
||||
|
||||
export class DataBinPolygon extends Polygon {
|
||||
/* Information about the data bin; the contained pushpins and calculated metrics. */
|
||||
public dataBinInfo: IDataBinInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* This class provides a data binning visualization for the map. It takes in an array of pushpins, groups them into
|
||||
* symmetrical shapes that fit together in a grid such as hexagons. Aggregation of data values are done and can be
|
||||
* used to customize how the data bins are rendered on the map (i.e. scale / color) .
|
||||
*/
|
||||
export class DataBinningLayer extends Layer {
|
||||
/**
|
||||
* Initializes the data binning layer.
|
||||
* @param pushpins The array of pushpins that are used to generate the data bins.
|
||||
* @param options The options used for calculating and rendering the data bins.
|
||||
*/
|
||||
constructor(pushpins?: Pushpin[], options?: IDataBinningOptions);
|
||||
|
||||
/**
|
||||
* Gets the options used for calculating and rendering the data bins.
|
||||
* @returns The options used for calculating and rendering the data bins.
|
||||
*/
|
||||
public getOptions(): IDataBinningOptions;
|
||||
|
||||
/**
|
||||
* Gets all pushpins that are in the layers.
|
||||
* @returns All pushpins that are in the layers.
|
||||
*/
|
||||
public getPushpins(): Pushpin[];
|
||||
|
||||
/**
|
||||
* Sets the array of pushpins that are used to generate the data bins.
|
||||
* @param pushpins The array of pushpins that are used to generate the data bins.
|
||||
*/
|
||||
public setPushpins(pushpins: Pushpin[]): void;
|
||||
|
||||
/**
|
||||
* Clears all the data in the data binning layer.
|
||||
*/
|
||||
public clear(): void;
|
||||
|
||||
/**
|
||||
* Cleans up any resources this object is consuming.
|
||||
*/
|
||||
public dispose(): void;
|
||||
|
||||
/**
|
||||
* Sets the options used for calculating and rendering the data bins.
|
||||
* @param options The options used for calculating and rendering the data bins.
|
||||
*/
|
||||
public setOptions(options: IDataBinningOptions): void;
|
||||
}
|
||||
}
|
|
@ -64,12 +64,12 @@ declare module Microsoft.Maps {
|
|||
|
||||
/**
|
||||
* Class responsible for reading/writing geo data in GeoJson format
|
||||
* @requires The Microsoft.Maps.GeoJSON module.
|
||||
* @requires The Microsoft.Maps.GeoJson module.
|
||||
*/
|
||||
export module GeoJSON {
|
||||
export module GeoJson {
|
||||
/**
|
||||
* Reads the data from a given url and returns the shapes.
|
||||
* @param url GeojJSON download url.
|
||||
* @param url GeoJson download url.
|
||||
* @param callback Callback function that needs to be called once the data is downloaded and parsed.
|
||||
* @param jsonpQueryParam The name of the url query param to make a jsonp request.
|
||||
* @param styles Styles that needs to be applied.
|
||||
|
@ -78,7 +78,7 @@ declare module Microsoft.Maps {
|
|||
|
||||
/**
|
||||
* Reads the data in geoJson format and returns the shapes.
|
||||
* @param geoJson GeoJSON data object that needs to be parsed into shapes.
|
||||
* @param geoJson GeoJson data object that needs to be parsed into shapes.
|
||||
* @param styles Styles that needs to be applied.
|
||||
* @returns An array of shapes.
|
||||
*/
|
||||
|
|
|
@ -369,6 +369,15 @@ declare module Microsoft.Maps.SpatialMath.Geometry {
|
|||
*/
|
||||
export function concaveHull(shapes: Location | IPrimitive | (Location | IPrimitive)[], allowMultiPolygons?: boolean, allowHoles?: boolean, options?: IPolygonOptions): IPrimitive | IPrimitive[];
|
||||
|
||||
/**
|
||||
* Given two shapes, determines if the first one contains the second one
|
||||
* (or, the second shape is a subset of the first shape) or not.
|
||||
* @param shapeA The first shape to test against the second.
|
||||
* @param shapeB The second shape to test against the first.
|
||||
* @returns A boolean indicating if the first shape contains the second shape.
|
||||
*/
|
||||
export function contains(shapeA: Location | IPrimitive | (Location | IPrimitive)[], shapeB: Location | IPrimitive | (Location | IPrimitive)[]): boolean;
|
||||
|
||||
/**
|
||||
* Calculates a convex hull. A convex hull is a shape that represents that minimum convex geometry that encloses all shapes in the specified data set.
|
||||
* @param shapes Shape(s) whose Location(s) or Location(s) are to be used to generate a convex hull.
|
||||
|
|
Загрузка…
Ссылка в новой задаче