add immoweb ui
This commit is contained in:
parent
7e8c79d3d1
commit
151da16c27
266 changed files with 264879 additions and 0 deletions
17
immoweb/Dockerfile
Normal file
17
immoweb/Dockerfile
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
# Use the official lightweight Nginx image
|
||||
FROM nginx:alpine
|
||||
|
||||
# Set working directory to Nginx asset directory
|
||||
WORKDIR /usr/share/nginx/html
|
||||
|
||||
# Remove default Nginx static files
|
||||
RUN rm -rf ./*
|
||||
|
||||
# Copy static files from host to container
|
||||
COPY ./ .
|
||||
|
||||
# Expose port 80 (HTTP)
|
||||
EXPOSE 80
|
||||
|
||||
# Start Nginx in foreground (Alpine uses `sh` syntax)
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
1
immoweb/data/all_geojs.js
Normal file
1
immoweb/data/all_geojs.js
Normal file
File diff suppressed because one or more lines are too long
221369
immoweb/data/london_geojs.js
Normal file
221369
immoweb/data/london_geojs.js
Normal file
File diff suppressed because it is too large
Load diff
1
immoweb/data/not_all_geojs.js
Normal file
1
immoweb/data/not_all_geojs.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
var data = { "type": "FeatureCollection", "features": [{ "type": "Feature", "properties": { "city": "K\u00f6ln", "country": "Deutschland", "qm": 74.49, "qmprice": 23.96294804671768, "rooms": 3.0, "total_price": 1785.0 }, "geometry": { "coordinates": [7.00037101481143, 50.9329353483442], "type": "Point" } }] }
|
||||
50
immoweb/density.html
Normal file
50
immoweb/density.html
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Visualization</title>
|
||||
|
||||
<script src='https://api.mapbox.com/mapbox-gl-js/v0.39.1/mapbox-gl.js'></script>
|
||||
<link href='https://api.mapbox.com/mapbox-gl-js/v0.39.1/mapbox-gl.css' rel='stylesheet' />
|
||||
<script src="node_modules/hexgrid-heatmap/dist/HexgridHeatmap.js"></script>
|
||||
<script src="data/berlin_geojs.js"></script>
|
||||
|
||||
|
||||
<style>
|
||||
#map {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id='map'></div>
|
||||
<script>
|
||||
mapboxgl.accessToken = 'pk.eyJ1IjoiZGktdG8iLCJhIjoiY2o0bnBoYXcxMW1mNzJ3bDhmc2xiNWttaiJ9.ZccatVk_4shzoAsEUXXecA';
|
||||
var map = new mapboxgl.Map({
|
||||
container: 'map',
|
||||
style: 'mapbox://styles/mapbox/light-v9',
|
||||
center: [13.38032, 52.51239],
|
||||
zoom: 11
|
||||
});
|
||||
|
||||
|
||||
map.on("load", function(){
|
||||
var heatmap = new HexgridHeatmap(map, "hexgrid-heatmap", "waterway-label");
|
||||
heatmap.setIntensity(6); // dunno yet
|
||||
heatmap.setSpread(0.15); // dunno yet
|
||||
heatmap.setCellDensity(0.5); // small value == bigger hexagons
|
||||
heatmap.setData(data);
|
||||
heatmap.update();
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
92
immoweb/index.html
Normal file
92
immoweb/index.html
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>WrongMove</title>
|
||||
|
||||
<!--Style stuff-->
|
||||
<link href='//fonts.googleapis.com/css?family=Raleway:400,300,600' rel='stylesheet' type='text/css'>
|
||||
<link rel="stylesheet" href="https://unpkg.com/skeleton-css@2.0.4/css/normalize.css">
|
||||
<link rel="stylesheet" href="https://unpkg.com/skeleton-css@2.0.4/css/skeleton.css">
|
||||
|
||||
<link rel="stylesheet" href="style.css?v=1">
|
||||
<script src="own_libs/HexgridHeatmap.js?v=1"></script>
|
||||
|
||||
<!--libs-->
|
||||
<script src='https://api.mapbox.com/mapbox-gl-js/v0.39.1/mapbox-gl.js'></script>
|
||||
<link href='https://api.mapbox.com/mapbox-gl-js/v0.39.1/mapbox-gl.css' rel='stylesheet' />
|
||||
<script src="https://d3js.org/d3.v4.min.js"></script>
|
||||
<script src="https://unpkg.com/crossfilter@1.3.12/crossfilter.js"></script>
|
||||
<script src="https://unpkg.com/rivets@0.9.6/dist/rivets.bundled.min.js"></script>
|
||||
|
||||
<!--data-->
|
||||
<!-- <script src="data/all_geojs.js"></script> -->
|
||||
<!-- <script src="data/not_all_geojs.js"></script> -->
|
||||
<script src="data/london_geojs.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div id='map'></div>
|
||||
|
||||
<div id="legend">
|
||||
<svg id="svg">
|
||||
</svg>
|
||||
</div>
|
||||
|
||||
<div id="overlay">
|
||||
<div class="modal modal-open" id="modal_overlay">
|
||||
<div class="modal-inner">
|
||||
<div class="modal-content">
|
||||
<div class="modal-close-icon">
|
||||
<a href="javascript:void(0)" class="close-modal"><i class="fa fa-times"
|
||||
aria-hidden="true"></i></a>
|
||||
</div>
|
||||
<div class="modal-content-inner">
|
||||
<h4>Visualization Parameters</h4>
|
||||
<p>Conflicting parameters will yield zero results.</p>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="five columns">
|
||||
<label for="city_input">City</label>
|
||||
<input type="search" class="u-full-width" id="city_input" placeholder="London"
|
||||
rv-value="filter.city"> <br>
|
||||
</div>
|
||||
<div class="one columns">
|
||||
<p></p>
|
||||
<p></p>
|
||||
<p>or</p>Squaremeter
|
||||
</div>
|
||||
<div class="five columns">
|
||||
<label for="country_input">Country</label>
|
||||
<select class="u-full-width" id="country_input" rv-value="filter.country">
|
||||
<option rv-each-country="filter.countries" rv-value="country">{country}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<hr class="modal-buttons-seperator">
|
||||
<label for="heatmap_type">What to visualize?</label>
|
||||
|
||||
<select class="u-full-width" id="heatmap_type" rv-value="filter.mode">
|
||||
<option selected="selected" value="qmprice">Price per squaremeter</option>
|
||||
<option value="rooms">Number of rooms</option>
|
||||
<option value="qm">Squaremeter</option>
|
||||
<option value="total_price">Price</option>
|
||||
</select>
|
||||
|
||||
<hr class="modal-buttons-seperator">
|
||||
<div class="modal-buttons">
|
||||
<button class="button-primary close-modal" onclick="update()">Load Data</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="script.js?v=1"></script>
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
20
immoweb/node_modules/@turf/bbox/LICENSE
generated
vendored
Normal file
20
immoweb/node_modules/@turf/bbox/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2017 TurfJS
|
||||
|
||||
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.
|
||||
55
immoweb/node_modules/@turf/bbox/README.md
generated
vendored
Normal file
55
immoweb/node_modules/@turf/bbox/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
# @turf/bbox
|
||||
|
||||
# bbox
|
||||
|
||||
Takes a set of features, calculates the bbox of all input features, and returns a bounding box.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `geojson` **([Feature](http://geojson.org/geojson-spec.html#feature-objects) \| [FeatureCollection](http://geojson.org/geojson-spec.html#feature-collection-objects))** input features
|
||||
|
||||
**Examples**
|
||||
|
||||
```javascript
|
||||
var pt1 = turf.point([114.175329, 22.2524])
|
||||
var pt2 = turf.point([114.170007, 22.267969])
|
||||
var pt3 = turf.point([114.200649, 22.274641])
|
||||
var pt4 = turf.point([114.200649, 22.274641])
|
||||
var pt5 = turf.point([114.186744, 22.265745])
|
||||
var features = turf.featureCollection([pt1, pt2, pt3, pt4, pt5])
|
||||
|
||||
var bbox = turf.bbox(features);
|
||||
|
||||
var bboxPolygon = turf.bboxPolygon(bbox);
|
||||
|
||||
//=bbox
|
||||
|
||||
//=bboxPolygon
|
||||
```
|
||||
|
||||
Returns **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)>** bbox extent in [minX, minY, maxX, maxY] order
|
||||
|
||||
<!-- This file is automatically generated. Please don't edit it directly:
|
||||
if you find an error, edit the source file (likely index.js), and re-run
|
||||
./scripts/generate-readmes in the turf project. -->
|
||||
|
||||
---
|
||||
|
||||
This module is part of the [Turfjs project](http://turfjs.org/), an open source
|
||||
module collection dedicated to geographic algorithms. It is maintained in the
|
||||
[Turfjs/turf](https://github.com/Turfjs/turf) repository, where you can create
|
||||
PRs and issues.
|
||||
|
||||
### Installation
|
||||
|
||||
Install this module individually:
|
||||
|
||||
```sh
|
||||
$ npm install @turf/bbox
|
||||
```
|
||||
|
||||
Or install the Turf module that includes it as a function:
|
||||
|
||||
```sh
|
||||
$ npm install @turf/turf
|
||||
```
|
||||
12
immoweb/node_modules/@turf/bbox/index.d.ts
generated
vendored
Normal file
12
immoweb/node_modules/@turf/bbox/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
/// <reference types="geojson" />
|
||||
|
||||
type Feature = GeoJSON.Feature<any>;
|
||||
type Features = GeoJSON.FeatureCollection<any>;
|
||||
type BBox = [number, number, number, number];
|
||||
|
||||
/**
|
||||
* http://turfjs.org/docs/#bbox
|
||||
*/
|
||||
declare function bbox(features: Feature | Features): BBox;
|
||||
declare namespace bbox { }
|
||||
export = bbox;
|
||||
35
immoweb/node_modules/@turf/bbox/index.js
generated
vendored
Normal file
35
immoweb/node_modules/@turf/bbox/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
var each = require('@turf/meta').coordEach;
|
||||
|
||||
/**
|
||||
* Takes a set of features, calculates the bbox of all input features, and returns a bounding box.
|
||||
*
|
||||
* @name bbox
|
||||
* @param {(Feature|FeatureCollection)} geojson input features
|
||||
* @returns {Array<number>} bbox extent in [minX, minY, maxX, maxY] order
|
||||
* @addToMap features, bboxPolygon
|
||||
* @example
|
||||
* var pt1 = turf.point([114.175329, 22.2524])
|
||||
* var pt2 = turf.point([114.170007, 22.267969])
|
||||
* var pt3 = turf.point([114.200649, 22.274641])
|
||||
* var pt4 = turf.point([114.200649, 22.274641])
|
||||
* var pt5 = turf.point([114.186744, 22.265745])
|
||||
* var features = turf.featureCollection([pt1, pt2, pt3, pt4, pt5])
|
||||
*
|
||||
* var bbox = turf.bbox(features);
|
||||
*
|
||||
* var bboxPolygon = turf.bboxPolygon(bbox);
|
||||
*
|
||||
* //=bbox
|
||||
*
|
||||
* //=bboxPolygon
|
||||
*/
|
||||
module.exports = function (geojson) {
|
||||
var bbox = [Infinity, Infinity, -Infinity, -Infinity];
|
||||
each(geojson, function (coord) {
|
||||
if (bbox[0] > coord[0]) bbox[0] = coord[0];
|
||||
if (bbox[1] > coord[1]) bbox[1] = coord[1];
|
||||
if (bbox[2] < coord[0]) bbox[2] = coord[0];
|
||||
if (bbox[3] < coord[1]) bbox[3] = coord[1];
|
||||
});
|
||||
return bbox;
|
||||
};
|
||||
68
immoweb/node_modules/@turf/bbox/package.json
generated
vendored
Normal file
68
immoweb/node_modules/@turf/bbox/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
{
|
||||
"_from": "@turf/bbox@^3.14.0",
|
||||
"_id": "@turf/bbox@3.14.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-zuXzlt3nisqc7eBeESLbGLxQRjU=",
|
||||
"_location": "/@turf/bbox",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "@turf/bbox@^3.14.0",
|
||||
"name": "@turf/bbox",
|
||||
"escapedName": "@turf%2fbbox",
|
||||
"scope": "@turf",
|
||||
"rawSpec": "^3.14.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^3.14.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@turf/center"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@turf/bbox/-/bbox-3.14.0.tgz",
|
||||
"_shasum": "cee5f396dde78aca9cede05e1122db18bc504635",
|
||||
"_spec": "@turf/bbox@^3.14.0",
|
||||
"_where": "/home/kadir/workspace/webimmo/node_modules/@turf/center",
|
||||
"author": {
|
||||
"name": "Turf Authors"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/Turfjs/turf/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"@turf/meta": "^3.14.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "turf bbox module",
|
||||
"devDependencies": {
|
||||
"benchmark": "^1.0.0",
|
||||
"tape": "^3.5.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"homepage": "https://github.com/Turfjs/turf",
|
||||
"keywords": [
|
||||
"turf",
|
||||
"extent",
|
||||
"bbox",
|
||||
"polygon",
|
||||
"featurecollection",
|
||||
"geojson"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "@turf/bbox",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/Turfjs/turf.git"
|
||||
},
|
||||
"scripts": {
|
||||
"bench": "node bench.js",
|
||||
"test": "node test.js"
|
||||
},
|
||||
"types": "index.d.ts",
|
||||
"version": "3.14.0"
|
||||
}
|
||||
20
immoweb/node_modules/@turf/center/LICENSE
generated
vendored
Normal file
20
immoweb/node_modules/@turf/center/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2017 TurfJS
|
||||
|
||||
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.
|
||||
143
immoweb/node_modules/@turf/center/README.md
generated
vendored
Normal file
143
immoweb/node_modules/@turf/center/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,143 @@
|
|||
# @turf/center
|
||||
|
||||
# center
|
||||
|
||||
Takes a [Feature](http://geojson.org/geojson-spec.html#feature-objects) or [FeatureCollection](http://geojson.org/geojson-spec.html#feature-collection-objects) and returns the absolute center point of all features.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `layer` **([Feature](http://geojson.org/geojson-spec.html#feature-objects) \| [FeatureCollection](http://geojson.org/geojson-spec.html#feature-collection-objects))** input features
|
||||
|
||||
**Examples**
|
||||
|
||||
```javascript
|
||||
var features = {
|
||||
"type": "FeatureCollection",
|
||||
"features": [
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [-97.522259, 35.4691]
|
||||
}
|
||||
}, {
|
||||
"type": "Feature",
|
||||
"properties": {},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [-97.502754, 35.463455]
|
||||
}
|
||||
}, {
|
||||
"type": "Feature",
|
||||
"properties": {},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [-97.508269, 35.463245]
|
||||
}
|
||||
}, {
|
||||
"type": "Feature",
|
||||
"properties": {},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [-97.516809, 35.465779]
|
||||
}
|
||||
}, {
|
||||
"type": "Feature",
|
||||
"properties": {},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [-97.515372, 35.467072]
|
||||
}
|
||||
}, {
|
||||
"type": "Feature",
|
||||
"properties": {},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [-97.509363, 35.463053]
|
||||
}
|
||||
}, {
|
||||
"type": "Feature",
|
||||
"properties": {},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [-97.511123, 35.466601]
|
||||
}
|
||||
}, {
|
||||
"type": "Feature",
|
||||
"properties": {},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [-97.518547, 35.469327]
|
||||
}
|
||||
}, {
|
||||
"type": "Feature",
|
||||
"properties": {},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [-97.519706, 35.469659]
|
||||
}
|
||||
}, {
|
||||
"type": "Feature",
|
||||
"properties": {},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [-97.517839, 35.466998]
|
||||
}
|
||||
}, {
|
||||
"type": "Feature",
|
||||
"properties": {},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [-97.508678, 35.464942]
|
||||
}
|
||||
}, {
|
||||
"type": "Feature",
|
||||
"properties": {},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [-97.514914, 35.463453]
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
var centerPt = turf.center(features);
|
||||
centerPt.properties['marker-size'] = 'large';
|
||||
centerPt.properties['marker-color'] = '#000';
|
||||
|
||||
var resultFeatures = features.features.concat(centerPt);
|
||||
var result = {
|
||||
"type": "FeatureCollection",
|
||||
"features": resultFeatures
|
||||
};
|
||||
|
||||
//=result
|
||||
```
|
||||
|
||||
Returns **[Feature](http://geojson.org/geojson-spec.html#feature-objects)<[Point](http://geojson.org/geojson-spec.html#point)>** a Point feature at the absolute center point of all input features
|
||||
|
||||
<!-- This file is automatically generated. Please don't edit it directly:
|
||||
if you find an error, edit the source file (likely index.js), and re-run
|
||||
./scripts/generate-readmes in the turf project. -->
|
||||
|
||||
---
|
||||
|
||||
This module is part of the [Turfjs project](http://turfjs.org/), an open source
|
||||
module collection dedicated to geographic algorithms. It is maintained in the
|
||||
[Turfjs/turf](https://github.com/Turfjs/turf) repository, where you can create
|
||||
PRs and issues.
|
||||
|
||||
### Installation
|
||||
|
||||
Install this module individually:
|
||||
|
||||
```sh
|
||||
$ npm install @turf/center
|
||||
```
|
||||
|
||||
Or install the Turf module that includes it as a function:
|
||||
|
||||
```sh
|
||||
$ npm install @turf/turf
|
||||
```
|
||||
12
immoweb/node_modules/@turf/center/index.d.ts
generated
vendored
Normal file
12
immoweb/node_modules/@turf/center/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
/// <reference types="geojson" />
|
||||
|
||||
type Feature = GeoJSON.Feature<any>;
|
||||
type Features = GeoJSON.FeatureCollection<any>;
|
||||
type Point = GeoJSON.Feature<GeoJSON.Point>;
|
||||
|
||||
/**
|
||||
* http://turfjs.org/docs/#center
|
||||
*/
|
||||
declare function center(features: Feature | Features): Point;
|
||||
declare namespace center { }
|
||||
export = center;
|
||||
121
immoweb/node_modules/@turf/center/index.js
generated
vendored
Normal file
121
immoweb/node_modules/@turf/center/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,121 @@
|
|||
var bbox = require('@turf/bbox'),
|
||||
point = require('@turf/helpers').point;
|
||||
|
||||
/**
|
||||
* Takes a {@link Feature} or {@link FeatureCollection} and returns the absolute center point of all features.
|
||||
*
|
||||
* @name center
|
||||
* @param {(Feature|FeatureCollection)} layer input features
|
||||
* @return {Feature<Point>} a Point feature at the absolute center point of all input features
|
||||
* @addToMap features, centerPt
|
||||
* @example
|
||||
* var features = {
|
||||
* "type": "FeatureCollection",
|
||||
* "features": [
|
||||
* {
|
||||
* "type": "Feature",
|
||||
* "properties": {},
|
||||
* "geometry": {
|
||||
* "type": "Point",
|
||||
* "coordinates": [-97.522259, 35.4691]
|
||||
* }
|
||||
* }, {
|
||||
* "type": "Feature",
|
||||
* "properties": {},
|
||||
* "geometry": {
|
||||
* "type": "Point",
|
||||
* "coordinates": [-97.502754, 35.463455]
|
||||
* }
|
||||
* }, {
|
||||
* "type": "Feature",
|
||||
* "properties": {},
|
||||
* "geometry": {
|
||||
* "type": "Point",
|
||||
* "coordinates": [-97.508269, 35.463245]
|
||||
* }
|
||||
* }, {
|
||||
* "type": "Feature",
|
||||
* "properties": {},
|
||||
* "geometry": {
|
||||
* "type": "Point",
|
||||
* "coordinates": [-97.516809, 35.465779]
|
||||
* }
|
||||
* }, {
|
||||
* "type": "Feature",
|
||||
* "properties": {},
|
||||
* "geometry": {
|
||||
* "type": "Point",
|
||||
* "coordinates": [-97.515372, 35.467072]
|
||||
* }
|
||||
* }, {
|
||||
* "type": "Feature",
|
||||
* "properties": {},
|
||||
* "geometry": {
|
||||
* "type": "Point",
|
||||
* "coordinates": [-97.509363, 35.463053]
|
||||
* }
|
||||
* }, {
|
||||
* "type": "Feature",
|
||||
* "properties": {},
|
||||
* "geometry": {
|
||||
* "type": "Point",
|
||||
* "coordinates": [-97.511123, 35.466601]
|
||||
* }
|
||||
* }, {
|
||||
* "type": "Feature",
|
||||
* "properties": {},
|
||||
* "geometry": {
|
||||
* "type": "Point",
|
||||
* "coordinates": [-97.518547, 35.469327]
|
||||
* }
|
||||
* }, {
|
||||
* "type": "Feature",
|
||||
* "properties": {},
|
||||
* "geometry": {
|
||||
* "type": "Point",
|
||||
* "coordinates": [-97.519706, 35.469659]
|
||||
* }
|
||||
* }, {
|
||||
* "type": "Feature",
|
||||
* "properties": {},
|
||||
* "geometry": {
|
||||
* "type": "Point",
|
||||
* "coordinates": [-97.517839, 35.466998]
|
||||
* }
|
||||
* }, {
|
||||
* "type": "Feature",
|
||||
* "properties": {},
|
||||
* "geometry": {
|
||||
* "type": "Point",
|
||||
* "coordinates": [-97.508678, 35.464942]
|
||||
* }
|
||||
* }, {
|
||||
* "type": "Feature",
|
||||
* "properties": {},
|
||||
* "geometry": {
|
||||
* "type": "Point",
|
||||
* "coordinates": [-97.514914, 35.463453]
|
||||
* }
|
||||
* }
|
||||
* ]
|
||||
* };
|
||||
*
|
||||
* var centerPt = turf.center(features);
|
||||
* centerPt.properties['marker-size'] = 'large';
|
||||
* centerPt.properties['marker-color'] = '#000';
|
||||
*
|
||||
* var resultFeatures = features.features.concat(centerPt);
|
||||
* var result = {
|
||||
* "type": "FeatureCollection",
|
||||
* "features": resultFeatures
|
||||
* };
|
||||
*
|
||||
* //=result
|
||||
*/
|
||||
|
||||
module.exports = function (layer) {
|
||||
var ext = bbox(layer);
|
||||
var x = (ext[0] + ext[2]) / 2;
|
||||
var y = (ext[1] + ext[3]) / 2;
|
||||
return point([x, y]);
|
||||
};
|
||||
69
immoweb/node_modules/@turf/center/package.json
generated
vendored
Normal file
69
immoweb/node_modules/@turf/center/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
{
|
||||
"_from": "@turf/center@^3.10.3",
|
||||
"_id": "@turf/center@3.14.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-EIOspPE308SYiVV0DH1EDEXMnsw=",
|
||||
"_location": "/@turf/center",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "@turf/center@^3.10.3",
|
||||
"name": "@turf/center",
|
||||
"escapedName": "@turf%2fcenter",
|
||||
"scope": "@turf",
|
||||
"rawSpec": "^3.10.3",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^3.10.3"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/hexgrid-heatmap"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@turf/center/-/center-3.14.0.tgz",
|
||||
"_shasum": "1083aca4f137d3c4988955740c7d440c45cc9ecc",
|
||||
"_spec": "@turf/center@^3.10.3",
|
||||
"_where": "/home/kadir/workspace/webimmo/node_modules/hexgrid-heatmap",
|
||||
"author": {
|
||||
"name": "Turf Authors"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/Turfjs/turf/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"@turf/bbox": "^3.14.0",
|
||||
"@turf/helpers": "^3.13.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "turf center module",
|
||||
"devDependencies": {
|
||||
"benchmark": "^1.0.0",
|
||||
"tape": "^3.5.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"homepage": "https://github.com/Turfjs/turf",
|
||||
"keywords": [
|
||||
"centroid",
|
||||
"geojson",
|
||||
"gis",
|
||||
"geospatial",
|
||||
"geo",
|
||||
"turf"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "@turf/center",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/Turfjs/turf.git"
|
||||
},
|
||||
"scripts": {
|
||||
"bench": "node bench.js",
|
||||
"test": "node test.js"
|
||||
},
|
||||
"types": "index.d.ts",
|
||||
"version": "3.14.0"
|
||||
}
|
||||
20
immoweb/node_modules/@turf/destination/LICENSE
generated
vendored
Normal file
20
immoweb/node_modules/@turf/destination/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2017 TurfJS
|
||||
|
||||
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.
|
||||
67
immoweb/node_modules/@turf/destination/README.md
generated
vendored
Normal file
67
immoweb/node_modules/@turf/destination/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
# @turf/destination
|
||||
|
||||
# destination
|
||||
|
||||
Takes a [Point](http://geojson.org/geojson-spec.html#point) and calculates the location of a destination point given a distance in degrees, radians, miles, or kilometers; and bearing in degrees. This uses the [Haversine formula](http://en.wikipedia.org/wiki/Haversine_formula) to account for global curvature.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `from` **[Feature](http://geojson.org/geojson-spec.html#feature-objects)<[Point](http://geojson.org/geojson-spec.html#point)>** starting point
|
||||
- `distance` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** distance from the starting point
|
||||
- `bearing` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** ranging from -180 to 180
|
||||
- `units` **\[[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)]** miles, kilometers, degrees, or radians (optional, default `kilometers`)
|
||||
|
||||
**Examples**
|
||||
|
||||
```javascript
|
||||
var point = {
|
||||
"type": "Feature",
|
||||
"properties": {
|
||||
"marker-color": "#0f0"
|
||||
},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [-75.343, 39.984]
|
||||
}
|
||||
};
|
||||
var distance = 50;
|
||||
var bearing = 90;
|
||||
var units = 'miles';
|
||||
|
||||
var destination = turf.destination(point, distance, bearing, units);
|
||||
destination.properties['marker-color'] = '#f00';
|
||||
|
||||
var result = {
|
||||
"type": "FeatureCollection",
|
||||
"features": [point, destination]
|
||||
};
|
||||
|
||||
//=result
|
||||
```
|
||||
|
||||
Returns **[Feature](http://geojson.org/geojson-spec.html#feature-objects)<[Point](http://geojson.org/geojson-spec.html#point)>** destination point
|
||||
|
||||
<!-- This file is automatically generated. Please don't edit it directly:
|
||||
if you find an error, edit the source file (likely index.js), and re-run
|
||||
./scripts/generate-readmes in the turf project. -->
|
||||
|
||||
---
|
||||
|
||||
This module is part of the [Turfjs project](http://turfjs.org/), an open source
|
||||
module collection dedicated to geographic algorithms. It is maintained in the
|
||||
[Turfjs/turf](https://github.com/Turfjs/turf) repository, where you can create
|
||||
PRs and issues.
|
||||
|
||||
### Installation
|
||||
|
||||
Install this module individually:
|
||||
|
||||
```sh
|
||||
$ npm install @turf/destination
|
||||
```
|
||||
|
||||
Or install the Turf module that includes it as a function:
|
||||
|
||||
```sh
|
||||
$ npm install @turf/turf
|
||||
```
|
||||
10
immoweb/node_modules/@turf/destination/index.d.ts
generated
vendored
Normal file
10
immoweb/node_modules/@turf/destination/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
/// <reference types="geojson" />
|
||||
|
||||
type Point = GeoJSON.Feature<GeoJSON.Point>;
|
||||
|
||||
/**
|
||||
* http://turfjs.org/docs/#destination
|
||||
*/
|
||||
declare function destination(from: Point, distance: number, bearing: number, units?: string): Point;
|
||||
declare namespace destination { }
|
||||
export = destination;
|
||||
59
immoweb/node_modules/@turf/destination/index.js
generated
vendored
Normal file
59
immoweb/node_modules/@turf/destination/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
//http://en.wikipedia.org/wiki/Haversine_formula
|
||||
//http://www.movable-type.co.uk/scripts/latlong.html
|
||||
var getCoord = require('@turf/invariant').getCoord;
|
||||
var helpers = require('@turf/helpers');
|
||||
var point = helpers.point;
|
||||
var distanceToRadians = helpers.distanceToRadians;
|
||||
|
||||
/**
|
||||
* Takes a {@link Point} and calculates the location of a destination point given a distance in degrees, radians, miles, or kilometers; and bearing in degrees. This uses the [Haversine formula](http://en.wikipedia.org/wiki/Haversine_formula) to account for global curvature.
|
||||
*
|
||||
* @name destination
|
||||
* @param {Feature<Point>} from starting point
|
||||
* @param {number} distance distance from the starting point
|
||||
* @param {number} bearing ranging from -180 to 180
|
||||
* @param {string} [units=kilometers] miles, kilometers, degrees, or radians
|
||||
* @returns {Feature<Point>} destination point
|
||||
* @example
|
||||
* var point = {
|
||||
* "type": "Feature",
|
||||
* "properties": {
|
||||
* "marker-color": "#0f0"
|
||||
* },
|
||||
* "geometry": {
|
||||
* "type": "Point",
|
||||
* "coordinates": [-75.343, 39.984]
|
||||
* }
|
||||
* };
|
||||
* var distance = 50;
|
||||
* var bearing = 90;
|
||||
* var units = 'miles';
|
||||
*
|
||||
* var destination = turf.destination(point, distance, bearing, units);
|
||||
* destination.properties['marker-color'] = '#f00';
|
||||
*
|
||||
* var result = {
|
||||
* "type": "FeatureCollection",
|
||||
* "features": [point, destination]
|
||||
* };
|
||||
*
|
||||
* //=result
|
||||
*/
|
||||
module.exports = function (from, distance, bearing, units) {
|
||||
var degrees2radians = Math.PI / 180;
|
||||
var radians2degrees = 180 / Math.PI;
|
||||
var coordinates1 = getCoord(from);
|
||||
var longitude1 = degrees2radians * coordinates1[0];
|
||||
var latitude1 = degrees2radians * coordinates1[1];
|
||||
var bearing_rad = degrees2radians * bearing;
|
||||
|
||||
var radians = distanceToRadians(distance, units);
|
||||
|
||||
var latitude2 = Math.asin(Math.sin(latitude1) * Math.cos(radians) +
|
||||
Math.cos(latitude1) * Math.sin(radians) * Math.cos(bearing_rad));
|
||||
var longitude2 = longitude1 + Math.atan2(Math.sin(bearing_rad) *
|
||||
Math.sin(radians) * Math.cos(latitude1),
|
||||
Math.cos(radians) - Math.sin(latitude1) * Math.sin(latitude2));
|
||||
|
||||
return point([radians2degrees * longitude2, radians2degrees * latitude2]);
|
||||
};
|
||||
70
immoweb/node_modules/@turf/destination/package.json
generated
vendored
Normal file
70
immoweb/node_modules/@turf/destination/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
{
|
||||
"_from": "@turf/destination@^3.10.3",
|
||||
"_id": "@turf/destination@3.14.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-7J5lxBnZlzO8rrA/ObSPQtVKw2w=",
|
||||
"_location": "/@turf/destination",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "@turf/destination@^3.10.3",
|
||||
"name": "@turf/destination",
|
||||
"escapedName": "@turf%2fdestination",
|
||||
"scope": "@turf",
|
||||
"rawSpec": "^3.10.3",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^3.10.3"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/hexgrid-heatmap"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@turf/destination/-/destination-3.14.0.tgz",
|
||||
"_shasum": "ec9e65c419d99733bcaeb03f39b48f42d54ac36c",
|
||||
"_spec": "@turf/destination@^3.10.3",
|
||||
"_where": "/home/kadir/workspace/webimmo/node_modules/hexgrid-heatmap",
|
||||
"author": {
|
||||
"name": "Turf Authors"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/Turfjs/turf/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"@turf/helpers": "^3.13.0",
|
||||
"@turf/invariant": "^3.13.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "turf destination module",
|
||||
"devDependencies": {
|
||||
"@turf/distance": "^3.14.0",
|
||||
"benchmark": "^1.0.0",
|
||||
"tape": "^3.5.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"homepage": "https://github.com/Turfjs/turf",
|
||||
"keywords": [
|
||||
"turf",
|
||||
"distance",
|
||||
"destination",
|
||||
"bearing",
|
||||
"miles",
|
||||
"km"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "@turf/destination",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/Turfjs/turf.git"
|
||||
},
|
||||
"scripts": {
|
||||
"bench": "node bench.js",
|
||||
"test": "node test.js"
|
||||
},
|
||||
"types": "index.d.ts",
|
||||
"version": "3.14.0"
|
||||
}
|
||||
20
immoweb/node_modules/@turf/distance/LICENSE
generated
vendored
Normal file
20
immoweb/node_modules/@turf/distance/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2017 TurfJS
|
||||
|
||||
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.
|
||||
74
immoweb/node_modules/@turf/distance/README.md
generated
vendored
Normal file
74
immoweb/node_modules/@turf/distance/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
# @turf/distance
|
||||
|
||||
# distance
|
||||
|
||||
Calculates the distance between two [points](http://geojson.org/geojson-spec.html#point) in degrees, radians,
|
||||
miles, or kilometers. This uses the
|
||||
[Haversine formula](http://en.wikipedia.org/wiki/Haversine_formula)
|
||||
to account for global curvature.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `from` **[Feature](http://geojson.org/geojson-spec.html#feature-objects)<[Point](http://geojson.org/geojson-spec.html#point)>** origin point
|
||||
- `to` **[Feature](http://geojson.org/geojson-spec.html#feature-objects)<[Point](http://geojson.org/geojson-spec.html#point)>** destination point
|
||||
- `units` **\[[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)]** can be degrees, radians, miles, or kilometers (optional, default `kilometers`)
|
||||
|
||||
**Examples**
|
||||
|
||||
```javascript
|
||||
var from = {
|
||||
"type": "Feature",
|
||||
"properties": {},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [-75.343, 39.984]
|
||||
}
|
||||
};
|
||||
var to = {
|
||||
"type": "Feature",
|
||||
"properties": {},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [-75.534, 39.123]
|
||||
}
|
||||
};
|
||||
var units = "miles";
|
||||
|
||||
var points = {
|
||||
"type": "FeatureCollection",
|
||||
"features": [from, to]
|
||||
};
|
||||
|
||||
//=points
|
||||
|
||||
var distance = turf.distance(from, to, units);
|
||||
|
||||
//=distance
|
||||
```
|
||||
|
||||
Returns **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** distance between the two points
|
||||
|
||||
<!-- This file is automatically generated. Please don't edit it directly:
|
||||
if you find an error, edit the source file (likely index.js), and re-run
|
||||
./scripts/generate-readmes in the turf project. -->
|
||||
|
||||
---
|
||||
|
||||
This module is part of the [Turfjs project](http://turfjs.org/), an open source
|
||||
module collection dedicated to geographic algorithms. It is maintained in the
|
||||
[Turfjs/turf](https://github.com/Turfjs/turf) repository, where you can create
|
||||
PRs and issues.
|
||||
|
||||
### Installation
|
||||
|
||||
Install this module individually:
|
||||
|
||||
```sh
|
||||
$ npm install @turf/distance
|
||||
```
|
||||
|
||||
Or install the Turf module that includes it as a function:
|
||||
|
||||
```sh
|
||||
$ npm install @turf/turf
|
||||
```
|
||||
10
immoweb/node_modules/@turf/distance/index.d.ts
generated
vendored
Normal file
10
immoweb/node_modules/@turf/distance/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
/// <reference types="geojson" />
|
||||
|
||||
type Point = GeoJSON.Feature<GeoJSON.Point>;
|
||||
|
||||
/**
|
||||
* http://turfjs.org/docs/#distance
|
||||
*/
|
||||
declare function distance(from: Point, to: Point, units?: string): number;
|
||||
declare namespace distance { }
|
||||
export = distance;
|
||||
60
immoweb/node_modules/@turf/distance/index.js
generated
vendored
Normal file
60
immoweb/node_modules/@turf/distance/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
var getCoord = require('@turf/invariant').getCoord;
|
||||
var radiansToDistance = require('@turf/helpers').radiansToDistance;
|
||||
//http://en.wikipedia.org/wiki/Haversine_formula
|
||||
//http://www.movable-type.co.uk/scripts/latlong.html
|
||||
|
||||
/**
|
||||
* Calculates the distance between two {@link Point|points} in degrees, radians,
|
||||
* miles, or kilometers. This uses the
|
||||
* [Haversine formula](http://en.wikipedia.org/wiki/Haversine_formula)
|
||||
* to account for global curvature.
|
||||
*
|
||||
* @name distance
|
||||
* @param {Feature<Point>} from origin point
|
||||
* @param {Feature<Point>} to destination point
|
||||
* @param {string} [units=kilometers] can be degrees, radians, miles, or kilometers
|
||||
* @returns {number} distance between the two points
|
||||
* @example
|
||||
* var from = {
|
||||
* "type": "Feature",
|
||||
* "properties": {},
|
||||
* "geometry": {
|
||||
* "type": "Point",
|
||||
* "coordinates": [-75.343, 39.984]
|
||||
* }
|
||||
* };
|
||||
* var to = {
|
||||
* "type": "Feature",
|
||||
* "properties": {},
|
||||
* "geometry": {
|
||||
* "type": "Point",
|
||||
* "coordinates": [-75.534, 39.123]
|
||||
* }
|
||||
* };
|
||||
* var units = "miles";
|
||||
*
|
||||
* var points = {
|
||||
* "type": "FeatureCollection",
|
||||
* "features": [from, to]
|
||||
* };
|
||||
*
|
||||
* //=points
|
||||
*
|
||||
* var distance = turf.distance(from, to, units);
|
||||
*
|
||||
* //=distance
|
||||
*/
|
||||
module.exports = function (from, to, units) {
|
||||
var degrees2radians = Math.PI / 180;
|
||||
var coordinates1 = getCoord(from);
|
||||
var coordinates2 = getCoord(to);
|
||||
var dLat = degrees2radians * (coordinates2[1] - coordinates1[1]);
|
||||
var dLon = degrees2radians * (coordinates2[0] - coordinates1[0]);
|
||||
var lat1 = degrees2radians * coordinates1[1];
|
||||
var lat2 = degrees2radians * coordinates2[1];
|
||||
|
||||
var a = Math.pow(Math.sin(dLat / 2), 2) +
|
||||
Math.pow(Math.sin(dLon / 2), 2) * Math.cos(lat1) * Math.cos(lat2);
|
||||
|
||||
return radiansToDistance(2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)), units);
|
||||
};
|
||||
68
immoweb/node_modules/@turf/distance/package.json
generated
vendored
Normal file
68
immoweb/node_modules/@turf/distance/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
{
|
||||
"_from": "@turf/distance@^3.10.3",
|
||||
"_id": "@turf/distance@3.14.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-cbDG8mXSO7MAQZjm2jL4KWT0L4s=",
|
||||
"_location": "/@turf/distance",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "@turf/distance@^3.10.3",
|
||||
"name": "@turf/distance",
|
||||
"escapedName": "@turf%2fdistance",
|
||||
"scope": "@turf",
|
||||
"rawSpec": "^3.10.3",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^3.10.3"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@turf/hex-grid",
|
||||
"/hexgrid-heatmap"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@turf/distance/-/distance-3.14.0.tgz",
|
||||
"_shasum": "71b0c6f265d23bb3004198e6da32f82964f42f8b",
|
||||
"_spec": "@turf/distance@^3.10.3",
|
||||
"_where": "/home/kadir/workspace/webimmo/node_modules/hexgrid-heatmap",
|
||||
"author": {
|
||||
"name": "Turf Authors"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/Turfjs/turf/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"@turf/helpers": "^3.13.0",
|
||||
"@turf/invariant": "^3.13.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "turf distance module",
|
||||
"devDependencies": {
|
||||
"benchmark": "^1.0.0",
|
||||
"tape": "^3.5.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"homepage": "https://github.com/Turfjs/turf",
|
||||
"keywords": [
|
||||
"turf",
|
||||
"distance",
|
||||
"miles",
|
||||
"km"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "@turf/distance",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/Turfjs/turf.git"
|
||||
},
|
||||
"scripts": {
|
||||
"bench": "node bench.js",
|
||||
"test": "node test.js"
|
||||
},
|
||||
"types": "index.d.ts",
|
||||
"version": "3.14.0"
|
||||
}
|
||||
3
immoweb/node_modules/@turf/helpers/CHANGELOG.md
generated
vendored
Normal file
3
immoweb/node_modules/@turf/helpers/CHANGELOG.md
generated
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# 2.0.0
|
||||
|
||||
* Only accept `[x, y]` arrays, not as arguments
|
||||
20
immoweb/node_modules/@turf/helpers/LICENSE
generated
vendored
Normal file
20
immoweb/node_modules/@turf/helpers/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2017 TurfJS
|
||||
|
||||
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.
|
||||
255
immoweb/node_modules/@turf/helpers/README.md
generated
vendored
Normal file
255
immoweb/node_modules/@turf/helpers/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,255 @@
|
|||
# @turf/helpers
|
||||
|
||||
# feature
|
||||
|
||||
Wraps a GeoJSON [Geometry](http://geojson.org/geojson-spec.html#geometry) in a GeoJSON [Feature](http://geojson.org/geojson-spec.html#feature-objects).
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `geometry` **[Geometry](http://geojson.org/geojson-spec.html#geometry)** input geometry
|
||||
- `properties` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** properties
|
||||
|
||||
**Examples**
|
||||
|
||||
```javascript
|
||||
var geometry = {
|
||||
"type": "Point",
|
||||
"coordinates": [
|
||||
67.5,
|
||||
32.84267363195431
|
||||
]
|
||||
}
|
||||
|
||||
var feature = turf.feature(geometry);
|
||||
|
||||
//=feature
|
||||
```
|
||||
|
||||
Returns **[FeatureCollection](http://geojson.org/geojson-spec.html#feature-collection-objects)** a FeatureCollection of input features
|
||||
|
||||
# point
|
||||
|
||||
Takes coordinates and properties (optional) and returns a new [Point](http://geojson.org/geojson-spec.html#point) feature.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `coordinates` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)>** longitude, latitude position (each in decimal degrees)
|
||||
- `properties` **\[[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)]** an Object that is used as the [Feature](http://geojson.org/geojson-spec.html#feature-objects)'s
|
||||
properties
|
||||
|
||||
**Examples**
|
||||
|
||||
```javascript
|
||||
var pt1 = turf.point([-75.343, 39.984]);
|
||||
|
||||
//=pt1
|
||||
```
|
||||
|
||||
Returns **[Feature](http://geojson.org/geojson-spec.html#feature-objects)<[Point](http://geojson.org/geojson-spec.html#point)>** a Point feature
|
||||
|
||||
# polygon
|
||||
|
||||
Takes an array of LinearRings and optionally an [Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) with properties and returns a [Polygon](http://geojson.org/geojson-spec.html#polygon) feature.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `coordinates` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)>>>** an array of LinearRings
|
||||
- `properties` **\[[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)]** a properties object
|
||||
|
||||
**Examples**
|
||||
|
||||
```javascript
|
||||
var polygon = turf.polygon([[
|
||||
[-2.275543, 53.464547],
|
||||
[-2.275543, 53.489271],
|
||||
[-2.215118, 53.489271],
|
||||
[-2.215118, 53.464547],
|
||||
[-2.275543, 53.464547]
|
||||
]], { name: 'poly1', population: 400});
|
||||
|
||||
//=polygon
|
||||
```
|
||||
|
||||
- Throws **[Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error)** throw an error if a LinearRing of the polygon has too few positions
|
||||
or if a LinearRing of the Polygon does not have matching Positions at the
|
||||
beginning & end.
|
||||
|
||||
Returns **[Feature](http://geojson.org/geojson-spec.html#feature-objects)<[Polygon](http://geojson.org/geojson-spec.html#polygon)>** a Polygon feature
|
||||
|
||||
# lineString
|
||||
|
||||
Creates a [LineString](http://geojson.org/geojson-spec.html#linestring) based on a
|
||||
coordinate array. Properties can be added optionally.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `coordinates` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)>>** an array of Positions
|
||||
- `properties` **\[[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)]** an Object of key-value pairs to add as properties
|
||||
|
||||
**Examples**
|
||||
|
||||
```javascript
|
||||
var linestring1 = turf.lineString([
|
||||
[-21.964416, 64.148203],
|
||||
[-21.956176, 64.141316],
|
||||
[-21.93901, 64.135924],
|
||||
[-21.927337, 64.136673]
|
||||
]);
|
||||
var linestring2 = turf.lineString([
|
||||
[-21.929054, 64.127985],
|
||||
[-21.912918, 64.134726],
|
||||
[-21.916007, 64.141016],
|
||||
[-21.930084, 64.14446]
|
||||
], {name: 'line 1', distance: 145});
|
||||
|
||||
//=linestring1
|
||||
|
||||
//=linestring2
|
||||
```
|
||||
|
||||
- Throws **[Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error)** if no coordinates are passed
|
||||
|
||||
Returns **[Feature](http://geojson.org/geojson-spec.html#feature-objects)<[LineString](http://geojson.org/geojson-spec.html#linestring)>** a LineString feature
|
||||
|
||||
# featureCollection
|
||||
|
||||
Takes one or more [Features](http://geojson.org/geojson-spec.html#feature-objects) and creates a [FeatureCollection](http://geojson.org/geojson-spec.html#feature-collection-objects).
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `features` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<[Feature](http://geojson.org/geojson-spec.html#feature-objects)>** input features
|
||||
|
||||
**Examples**
|
||||
|
||||
```javascript
|
||||
var features = [
|
||||
turf.point([-75.343, 39.984], {name: 'Location A'}),
|
||||
turf.point([-75.833, 39.284], {name: 'Location B'}),
|
||||
turf.point([-75.534, 39.123], {name: 'Location C'})
|
||||
];
|
||||
|
||||
var fc = turf.featureCollection(features);
|
||||
|
||||
//=fc
|
||||
```
|
||||
|
||||
Returns **[FeatureCollection](http://geojson.org/geojson-spec.html#feature-collection-objects)** a FeatureCollection of input features
|
||||
|
||||
# multiLineString
|
||||
|
||||
Creates a [Feature<MultiLineString>](Feature<MultiLineString>) based on a
|
||||
coordinate array. Properties can be added optionally.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `coordinates` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)>>>** an array of LineStrings
|
||||
- `properties` **\[[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)]** an Object of key-value pairs to add as properties
|
||||
|
||||
**Examples**
|
||||
|
||||
```javascript
|
||||
var multiLine = turf.multiLineString([[[0,0],[10,10]]]);
|
||||
|
||||
//=multiLine
|
||||
```
|
||||
|
||||
- Throws **[Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error)** if no coordinates are passed
|
||||
|
||||
Returns **[Feature](http://geojson.org/geojson-spec.html#feature-objects)<[MultiLineString](http://geojson.org/geojson-spec.html#multilinestring)>** a MultiLineString feature
|
||||
|
||||
# multiPoint
|
||||
|
||||
Creates a [Feature<MultiPoint>](Feature<MultiPoint>) based on a
|
||||
coordinate array. Properties can be added optionally.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `coordinates` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)>>** an array of Positions
|
||||
- `properties` **\[[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)]** an Object of key-value pairs to add as properties
|
||||
|
||||
**Examples**
|
||||
|
||||
```javascript
|
||||
var multiPt = turf.multiPoint([[0,0],[10,10]]);
|
||||
|
||||
//=multiPt
|
||||
```
|
||||
|
||||
- Throws **[Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error)** if no coordinates are passed
|
||||
|
||||
Returns **[Feature](http://geojson.org/geojson-spec.html#feature-objects)<[MultiPoint](http://geojson.org/geojson-spec.html#multipoint)>** a MultiPoint feature
|
||||
|
||||
# multiPolygon
|
||||
|
||||
Creates a [Feature<MultiPolygon>](Feature<MultiPolygon>) based on a
|
||||
coordinate array. Properties can be added optionally.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `coordinates` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)>>>>** an array of Polygons
|
||||
- `properties` **\[[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)]** an Object of key-value pairs to add as properties
|
||||
|
||||
**Examples**
|
||||
|
||||
```javascript
|
||||
var multiPoly = turf.multiPolygon([[[[0,0],[0,10],[10,10],[10,0],[0,0]]]]);
|
||||
|
||||
//=multiPoly
|
||||
```
|
||||
|
||||
- Throws **[Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error)** if no coordinates are passed
|
||||
|
||||
Returns **[Feature](http://geojson.org/geojson-spec.html#feature-objects)<[MultiPolygon](http://geojson.org/geojson-spec.html#multipolygon)>** a multipolygon feature
|
||||
|
||||
# geometryCollection
|
||||
|
||||
Creates a [Feature<GeometryCollection>](Feature<GeometryCollection>) based on a
|
||||
coordinate array. Properties can be added optionally.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `geometries` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<{Geometry}>** an array of GeoJSON Geometries
|
||||
- `properties` **\[[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)]** an Object of key-value pairs to add as properties
|
||||
|
||||
**Examples**
|
||||
|
||||
```javascript
|
||||
var pt = {
|
||||
"type": "Point",
|
||||
"coordinates": [100, 0]
|
||||
};
|
||||
var line = {
|
||||
"type": "LineString",
|
||||
"coordinates": [ [101, 0], [102, 1] ]
|
||||
};
|
||||
var collection = turf.geometryCollection([pt, line]);
|
||||
|
||||
//=collection
|
||||
```
|
||||
|
||||
Returns **[Feature](http://geojson.org/geojson-spec.html#feature-objects)<[GeometryCollection](http://geojson.org/geojson-spec.html#geometrycollection)>** a GeoJSON GeometryCollection Feature
|
||||
|
||||
<!-- This file is automatically generated. Please don't edit it directly:
|
||||
if you find an error, edit the source file (likely index.js), and re-run
|
||||
./scripts/generate-readmes in the turf project. -->
|
||||
|
||||
---
|
||||
|
||||
This module is part of the [Turfjs project](http://turfjs.org/), an open source
|
||||
module collection dedicated to geographic algorithms. It is maintained in the
|
||||
[Turfjs/turf](https://github.com/Turfjs/turf) repository, where you can create
|
||||
PRs and issues.
|
||||
|
||||
### Installation
|
||||
|
||||
Install this module individually:
|
||||
|
||||
```sh
|
||||
$ npm install @turf/helpers
|
||||
```
|
||||
|
||||
Or install the Turf module that includes it as a function:
|
||||
|
||||
```sh
|
||||
$ npm install @turf/turf
|
||||
```
|
||||
89
immoweb/node_modules/@turf/helpers/index.d.ts
generated
vendored
Normal file
89
immoweb/node_modules/@turf/helpers/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
/// <reference types="geojson" />
|
||||
|
||||
export type Points = GeoJSON.FeatureCollection<GeoJSON.Point>;
|
||||
export type Point = GeoJSON.Feature<GeoJSON.Point>;
|
||||
export type MultiPoints = GeoJSON.FeatureCollection<GeoJSON.MultiPoint>;
|
||||
export type MultiPoint = GeoJSON.Feature<GeoJSON.MultiPoint>;
|
||||
export type LineStrings = GeoJSON.FeatureCollection<GeoJSON.LineString>;
|
||||
export type LineString = GeoJSON.Feature<GeoJSON.LineString>;
|
||||
export type MultiLineStrings = GeoJSON.FeatureCollection<GeoJSON.MultiLineString>;
|
||||
export type MultiLineString = GeoJSON.Feature<GeoJSON.MultiLineString>;
|
||||
export type Polygons = GeoJSON.FeatureCollection<GeoJSON.Polygon>;
|
||||
export type Polygon = GeoJSON.Feature<GeoJSON.Polygon>;
|
||||
export type MultiPolygons = GeoJSON.FeatureCollection<GeoJSON.MultiPolygon>;
|
||||
export type MultiPolygon = GeoJSON.Feature<GeoJSON.MultiPolygon>;
|
||||
export type Features = GeoJSON.FeatureCollection<any>;
|
||||
export type Feature = GeoJSON.Feature<any>;
|
||||
export type Position = GeoJSON.Position;
|
||||
export type LineStringFeatures = LineString | LineStrings | MultiLineString | MultiLineStrings | GeoJSON.LineString | GeoJSON.MultiLineString
|
||||
export type PolygonFeatures = Polygon | Polygons | MultiPolygon | MultiPolygons | GeoJSON.Polygon | GeoJSON.MultiPolygon
|
||||
export type Units = "miles" | "nauticalmiles" | "degrees" | "radians" | "inches" | "yards" | "meters" | "metres" | "kilometers" | "kilometres";
|
||||
export type BBox = [number, number, number, number];
|
||||
|
||||
/**
|
||||
* http://turfjs.org/docs/#feature
|
||||
*/
|
||||
export function feature(geometry: GeoJSON.GeometryObject, properties?: any): Feature;
|
||||
|
||||
/**
|
||||
* http://turfjs.org/docs/#point
|
||||
*/
|
||||
export function point(coordinates: Position, properties?: any): Point;
|
||||
|
||||
/**
|
||||
* http://turfjs.org/docs/#polygon
|
||||
*/
|
||||
export function polygon(coordinates: Position[][], properties?: any): Polygon;
|
||||
|
||||
/**
|
||||
* http://turfjs.org/docs/#linestring
|
||||
*/
|
||||
export function lineString(coordinates: Position[], properties?: any): LineString;
|
||||
|
||||
/**
|
||||
* http://turfjs.org/docs/#featurecollection
|
||||
*/
|
||||
export const featureCollection: {
|
||||
(features: Array<Point>): Points;
|
||||
(features: Array<LineString>): LineStrings;
|
||||
(features: Array<Polygon>): Polygons;
|
||||
(features: Array<MultiPoint>): MultiPoints;
|
||||
(features: Array<MultiLineString>): MultiLineStrings;
|
||||
(features: Array<MultiPolygon>): MultiPolygons;
|
||||
(features: Array<Feature>): Features;
|
||||
};
|
||||
|
||||
/**
|
||||
* http://turfjs.org/docs/#multilinestring
|
||||
*/
|
||||
export function multiLineString(coordinates: Position[][], properties?: any): MultiLineString;
|
||||
|
||||
/**
|
||||
* http://turfjs.org/docs/#multipoint
|
||||
*/
|
||||
export function multiPoint(coordinates: Position[], properties?: any): MultiPoint;
|
||||
|
||||
/**
|
||||
* http://turfjs.org/docs/#multipolygon
|
||||
*/
|
||||
export function multiPolygon(coordinates: Position[][][], properties?: any): MultiPolygon;
|
||||
|
||||
/**
|
||||
* http://turfjs.org/docs/#geometrycollection
|
||||
*/
|
||||
export function geometryCollection(geometries: Array<GeoJSON.GeometryObject>, properties?: any): GeoJSON.GeometryCollection;
|
||||
|
||||
/**
|
||||
* http://turfjs.org/docs/
|
||||
*/
|
||||
export function radiansToDistance(radians: number, units?: Units): number
|
||||
|
||||
/**
|
||||
* http://turfjs.org/docs/
|
||||
*/
|
||||
export function distanceToRadians(distance: number, units?: Units): number
|
||||
|
||||
/**
|
||||
* http://turfjs.org/docs/
|
||||
*/
|
||||
export function distanceToDegrees(distance: number, units?: Units): number
|
||||
324
immoweb/node_modules/@turf/helpers/index.js
generated
vendored
Normal file
324
immoweb/node_modules/@turf/helpers/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,324 @@
|
|||
/**
|
||||
* Wraps a GeoJSON {@link Geometry} in a GeoJSON {@link Feature}.
|
||||
*
|
||||
* @name feature
|
||||
* @param {Geometry} geometry input geometry
|
||||
* @param {Object} properties properties
|
||||
* @returns {FeatureCollection} a FeatureCollection of input features
|
||||
* @example
|
||||
* var geometry = {
|
||||
* "type": "Point",
|
||||
* "coordinates": [
|
||||
* 67.5,
|
||||
* 32.84267363195431
|
||||
* ]
|
||||
* }
|
||||
*
|
||||
* var feature = turf.feature(geometry);
|
||||
*
|
||||
* //=feature
|
||||
*/
|
||||
function feature(geometry, properties) {
|
||||
if (!geometry) throw new Error('No geometry passed');
|
||||
|
||||
return {
|
||||
type: 'Feature',
|
||||
properties: properties || {},
|
||||
geometry: geometry
|
||||
};
|
||||
}
|
||||
module.exports.feature = feature;
|
||||
|
||||
/**
|
||||
* Takes coordinates and properties (optional) and returns a new {@link Point} feature.
|
||||
*
|
||||
* @name point
|
||||
* @param {Array<number>} coordinates longitude, latitude position (each in decimal degrees)
|
||||
* @param {Object=} properties an Object that is used as the {@link Feature}'s
|
||||
* properties
|
||||
* @returns {Feature<Point>} a Point feature
|
||||
* @example
|
||||
* var pt1 = turf.point([-75.343, 39.984]);
|
||||
*
|
||||
* //=pt1
|
||||
*/
|
||||
module.exports.point = function (coordinates, properties) {
|
||||
if (!coordinates) throw new Error('No coordinates passed');
|
||||
if (coordinates.length === undefined) throw new Error('Coordinates must be an array');
|
||||
if (coordinates.length < 2) throw new Error('Coordinates must be at least 2 numbers long');
|
||||
if (typeof coordinates[0] !== 'number' || typeof coordinates[1] !== 'number') throw new Error('Coordinates must numbers');
|
||||
|
||||
return feature({
|
||||
type: 'Point',
|
||||
coordinates: coordinates
|
||||
}, properties);
|
||||
};
|
||||
|
||||
/**
|
||||
* Takes an array of LinearRings and optionally an {@link Object} with properties and returns a {@link Polygon} feature.
|
||||
*
|
||||
* @name polygon
|
||||
* @param {Array<Array<Array<number>>>} coordinates an array of LinearRings
|
||||
* @param {Object=} properties a properties object
|
||||
* @returns {Feature<Polygon>} a Polygon feature
|
||||
* @throws {Error} throw an error if a LinearRing of the polygon has too few positions
|
||||
* or if a LinearRing of the Polygon does not have matching Positions at the
|
||||
* beginning & end.
|
||||
* @example
|
||||
* var polygon = turf.polygon([[
|
||||
* [-2.275543, 53.464547],
|
||||
* [-2.275543, 53.489271],
|
||||
* [-2.215118, 53.489271],
|
||||
* [-2.215118, 53.464547],
|
||||
* [-2.275543, 53.464547]
|
||||
* ]], { name: 'poly1', population: 400});
|
||||
*
|
||||
* //=polygon
|
||||
*/
|
||||
module.exports.polygon = function (coordinates, properties) {
|
||||
if (!coordinates) throw new Error('No coordinates passed');
|
||||
|
||||
for (var i = 0; i < coordinates.length; i++) {
|
||||
var ring = coordinates[i];
|
||||
if (ring.length < 4) {
|
||||
throw new Error('Each LinearRing of a Polygon must have 4 or more Positions.');
|
||||
}
|
||||
for (var j = 0; j < ring[ring.length - 1].length; j++) {
|
||||
if (ring[ring.length - 1][j] !== ring[0][j]) {
|
||||
throw new Error('First and last Position are not equivalent.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return feature({
|
||||
type: 'Polygon',
|
||||
coordinates: coordinates
|
||||
}, properties);
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a {@link LineString} based on a
|
||||
* coordinate array. Properties can be added optionally.
|
||||
*
|
||||
* @name lineString
|
||||
* @param {Array<Array<number>>} coordinates an array of Positions
|
||||
* @param {Object=} properties an Object of key-value pairs to add as properties
|
||||
* @returns {Feature<LineString>} a LineString feature
|
||||
* @throws {Error} if no coordinates are passed
|
||||
* @example
|
||||
* var linestring1 = turf.lineString([
|
||||
* [-21.964416, 64.148203],
|
||||
* [-21.956176, 64.141316],
|
||||
* [-21.93901, 64.135924],
|
||||
* [-21.927337, 64.136673]
|
||||
* ]);
|
||||
* var linestring2 = turf.lineString([
|
||||
* [-21.929054, 64.127985],
|
||||
* [-21.912918, 64.134726],
|
||||
* [-21.916007, 64.141016],
|
||||
* [-21.930084, 64.14446]
|
||||
* ], {name: 'line 1', distance: 145});
|
||||
*
|
||||
* //=linestring1
|
||||
*
|
||||
* //=linestring2
|
||||
*/
|
||||
module.exports.lineString = function (coordinates, properties) {
|
||||
if (!coordinates) throw new Error('No coordinates passed');
|
||||
|
||||
return feature({
|
||||
type: 'LineString',
|
||||
coordinates: coordinates
|
||||
}, properties);
|
||||
};
|
||||
|
||||
/**
|
||||
* Takes one or more {@link Feature|Features} and creates a {@link FeatureCollection}.
|
||||
*
|
||||
* @name featureCollection
|
||||
* @param {Feature[]} features input features
|
||||
* @returns {FeatureCollection} a FeatureCollection of input features
|
||||
* @example
|
||||
* var features = [
|
||||
* turf.point([-75.343, 39.984], {name: 'Location A'}),
|
||||
* turf.point([-75.833, 39.284], {name: 'Location B'}),
|
||||
* turf.point([-75.534, 39.123], {name: 'Location C'})
|
||||
* ];
|
||||
*
|
||||
* var fc = turf.featureCollection(features);
|
||||
*
|
||||
* //=fc
|
||||
*/
|
||||
module.exports.featureCollection = function (features) {
|
||||
if (!features) throw new Error('No features passed');
|
||||
|
||||
return {
|
||||
type: 'FeatureCollection',
|
||||
features: features
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a {@link Feature<MultiLineString>} based on a
|
||||
* coordinate array. Properties can be added optionally.
|
||||
*
|
||||
* @name multiLineString
|
||||
* @param {Array<Array<Array<number>>>} coordinates an array of LineStrings
|
||||
* @param {Object=} properties an Object of key-value pairs to add as properties
|
||||
* @returns {Feature<MultiLineString>} a MultiLineString feature
|
||||
* @throws {Error} if no coordinates are passed
|
||||
* @example
|
||||
* var multiLine = turf.multiLineString([[[0,0],[10,10]]]);
|
||||
*
|
||||
* //=multiLine
|
||||
*
|
||||
*/
|
||||
module.exports.multiLineString = function (coordinates, properties) {
|
||||
if (!coordinates) throw new Error('No coordinates passed');
|
||||
|
||||
return feature({
|
||||
type: 'MultiLineString',
|
||||
coordinates: coordinates
|
||||
}, properties);
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a {@link Feature<MultiPoint>} based on a
|
||||
* coordinate array. Properties can be added optionally.
|
||||
*
|
||||
* @name multiPoint
|
||||
* @param {Array<Array<number>>} coordinates an array of Positions
|
||||
* @param {Object=} properties an Object of key-value pairs to add as properties
|
||||
* @returns {Feature<MultiPoint>} a MultiPoint feature
|
||||
* @throws {Error} if no coordinates are passed
|
||||
* @example
|
||||
* var multiPt = turf.multiPoint([[0,0],[10,10]]);
|
||||
*
|
||||
* //=multiPt
|
||||
*
|
||||
*/
|
||||
module.exports.multiPoint = function (coordinates, properties) {
|
||||
if (!coordinates) throw new Error('No coordinates passed');
|
||||
|
||||
return feature({
|
||||
type: 'MultiPoint',
|
||||
coordinates: coordinates
|
||||
}, properties);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Creates a {@link Feature<MultiPolygon>} based on a
|
||||
* coordinate array. Properties can be added optionally.
|
||||
*
|
||||
* @name multiPolygon
|
||||
* @param {Array<Array<Array<Array<number>>>>} coordinates an array of Polygons
|
||||
* @param {Object=} properties an Object of key-value pairs to add as properties
|
||||
* @returns {Feature<MultiPolygon>} a multipolygon feature
|
||||
* @throws {Error} if no coordinates are passed
|
||||
* @example
|
||||
* var multiPoly = turf.multiPolygon([[[[0,0],[0,10],[10,10],[10,0],[0,0]]]]);
|
||||
*
|
||||
* //=multiPoly
|
||||
*
|
||||
*/
|
||||
module.exports.multiPolygon = function (coordinates, properties) {
|
||||
if (!coordinates) throw new Error('No coordinates passed');
|
||||
|
||||
return feature({
|
||||
type: 'MultiPolygon',
|
||||
coordinates: coordinates
|
||||
}, properties);
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a {@link Feature<GeometryCollection>} based on a
|
||||
* coordinate array. Properties can be added optionally.
|
||||
*
|
||||
* @name geometryCollection
|
||||
* @param {Array<{Geometry}>} geometries an array of GeoJSON Geometries
|
||||
* @param {Object=} properties an Object of key-value pairs to add as properties
|
||||
* @returns {Feature<GeometryCollection>} a GeoJSON GeometryCollection Feature
|
||||
* @example
|
||||
* var pt = {
|
||||
* "type": "Point",
|
||||
* "coordinates": [100, 0]
|
||||
* };
|
||||
* var line = {
|
||||
* "type": "LineString",
|
||||
* "coordinates": [ [101, 0], [102, 1] ]
|
||||
* };
|
||||
* var collection = turf.geometryCollection([pt, line]);
|
||||
*
|
||||
* //=collection
|
||||
*/
|
||||
module.exports.geometryCollection = function (geometries, properties) {
|
||||
if (!geometries) throw new Error('No geometries passed');
|
||||
|
||||
return feature({
|
||||
type: 'GeometryCollection',
|
||||
geometries: geometries
|
||||
}, properties);
|
||||
};
|
||||
|
||||
var factors = {
|
||||
miles: 3960,
|
||||
nauticalmiles: 3441.145,
|
||||
degrees: 57.2957795,
|
||||
radians: 1,
|
||||
inches: 250905600,
|
||||
yards: 6969600,
|
||||
meters: 6373000,
|
||||
metres: 6373000,
|
||||
kilometers: 6373,
|
||||
kilometres: 6373,
|
||||
feet: 20908792.65
|
||||
};
|
||||
|
||||
/*
|
||||
* Convert a distance measurement from radians to a more friendly unit.
|
||||
*
|
||||
* @name radiansToDistance
|
||||
* @param {number} distance in radians across the sphere
|
||||
* @param {string} [units=kilometers] can be degrees, radians, miles, or kilometers
|
||||
* inches, yards, metres, meters, kilometres, kilometers.
|
||||
* @returns {number} distance
|
||||
*/
|
||||
module.exports.radiansToDistance = function (radians, units) {
|
||||
var factor = factors[units || 'kilometers'];
|
||||
if (factor === undefined) throw new Error('Invalid unit');
|
||||
|
||||
return radians * factor;
|
||||
};
|
||||
|
||||
/*
|
||||
* Convert a distance measurement from a real-world unit into radians
|
||||
*
|
||||
* @name distanceToRadians
|
||||
* @param {number} distance in real units
|
||||
* @param {string} [units=kilometers] can be degrees, radians, miles, or kilometers
|
||||
* inches, yards, metres, meters, kilometres, kilometers.
|
||||
* @returns {number} radians
|
||||
*/
|
||||
module.exports.distanceToRadians = function (distance, units) {
|
||||
var factor = factors[units || 'kilometers'];
|
||||
if (factor === undefined) throw new Error('Invalid unit');
|
||||
|
||||
return distance / factor;
|
||||
};
|
||||
|
||||
/*
|
||||
* Convert a distance measurement from a real-world unit into degrees
|
||||
*
|
||||
* @name distanceToRadians
|
||||
* @param {number} distance in real units
|
||||
* @param {string} [units=kilometers] can be degrees, radians, miles, or kilometers
|
||||
* inches, yards, metres, meters, kilometres, kilometers.
|
||||
* @returns {number} degrees
|
||||
*/
|
||||
module.exports.distanceToDegrees = function (distance, units) {
|
||||
var factor = factors[units || 'kilometers'];
|
||||
if (factor === undefined) throw new Error('Invalid unit');
|
||||
|
||||
return (distance / factor) * 57.2958;
|
||||
};
|
||||
67
immoweb/node_modules/@turf/helpers/package.json
generated
vendored
Normal file
67
immoweb/node_modules/@turf/helpers/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
{
|
||||
"_from": "@turf/helpers@^3.13.0",
|
||||
"_id": "@turf/helpers@3.13.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-0GB4oUZM9WzbfqYk6h4TpxuIuAY=",
|
||||
"_location": "/@turf/helpers",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "@turf/helpers@^3.13.0",
|
||||
"name": "@turf/helpers",
|
||||
"escapedName": "@turf%2fhelpers",
|
||||
"scope": "@turf",
|
||||
"rawSpec": "^3.13.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^3.13.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@turf/center",
|
||||
"/@turf/destination",
|
||||
"/@turf/distance",
|
||||
"/@turf/hex-grid"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@turf/helpers/-/helpers-3.13.0.tgz",
|
||||
"_shasum": "d06078a1464cf56cdb7ea624ea1e13a71b88b806",
|
||||
"_spec": "@turf/helpers@^3.13.0",
|
||||
"_where": "/home/kadir/workspace/webimmo/node_modules/@turf/center",
|
||||
"author": {
|
||||
"name": "Turf Authors"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/Turfjs/turf/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {},
|
||||
"deprecated": false,
|
||||
"description": "turf helpers module",
|
||||
"devDependencies": {
|
||||
"benchmark": "^2.1.3",
|
||||
"tape": "^3.5.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"homepage": "https://github.com/Turfjs/turf",
|
||||
"keywords": [
|
||||
"geo",
|
||||
"point",
|
||||
"turf",
|
||||
"geojson"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "@turf/helpers",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/Turfjs/turf.git"
|
||||
},
|
||||
"scripts": {
|
||||
"bench": "node bench.js",
|
||||
"test": "node test.js"
|
||||
},
|
||||
"types": "index.d.ts",
|
||||
"version": "3.13.0"
|
||||
}
|
||||
20
immoweb/node_modules/@turf/hex-grid/LICENSE
generated
vendored
Normal file
20
immoweb/node_modules/@turf/hex-grid/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2017 TurfJS
|
||||
|
||||
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.
|
||||
53
immoweb/node_modules/@turf/hex-grid/README.md
generated
vendored
Normal file
53
immoweb/node_modules/@turf/hex-grid/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
# @turf/hex-grid
|
||||
|
||||
# hexGrid
|
||||
|
||||
Takes a bounding box and a cell size in degrees and returns a [FeatureCollection](http://geojson.org/geojson-spec.html#feature-collection-objects) of flat-topped
|
||||
hexagons ([Polygon](http://geojson.org/geojson-spec.html#polygon) features) aligned in an "odd-q" vertical grid as
|
||||
described in [Hexagonal Grids](http://www.redblobgames.com/grids/hexagons/).
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `bbox` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)>** extent in [minX, minY, maxX, maxY] order
|
||||
- `cellSize` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** dimension of cell in specified units
|
||||
- `units` **\[[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)]** used in calculating cellSize, can be degrees, radians, miles, or kilometers (optional, default `kilometers`)
|
||||
- `triangles` **\[[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)]** whether to return as triangles instead of hexagons (optional, default `false`)
|
||||
|
||||
**Examples**
|
||||
|
||||
```javascript
|
||||
var bbox = [-96,31,-84,40];
|
||||
var cellSize = 50;
|
||||
var units = 'miles';
|
||||
|
||||
var hexgrid = turf.hexGrid(bbox, cellSize, units);
|
||||
|
||||
//=hexgrid
|
||||
```
|
||||
|
||||
Returns **[FeatureCollection](http://geojson.org/geojson-spec.html#feature-collection-objects)<[Polygon](http://geojson.org/geojson-spec.html#polygon)>** a hexagonal grid
|
||||
|
||||
<!-- This file is automatically generated. Please don't edit it directly:
|
||||
if you find an error, edit the source file (likely index.js), and re-run
|
||||
./scripts/generate-readmes in the turf project. -->
|
||||
|
||||
---
|
||||
|
||||
This module is part of the [Turfjs project](http://turfjs.org/), an open source
|
||||
module collection dedicated to geographic algorithms. It is maintained in the
|
||||
[Turfjs/turf](https://github.com/Turfjs/turf) repository, where you can create
|
||||
PRs and issues.
|
||||
|
||||
### Installation
|
||||
|
||||
Install this module individually:
|
||||
|
||||
```sh
|
||||
$ npm install @turf/hex-grid
|
||||
```
|
||||
|
||||
Or install the Turf module that includes it as a function:
|
||||
|
||||
```sh
|
||||
$ npm install @turf/turf
|
||||
```
|
||||
8
immoweb/node_modules/@turf/hex-grid/index.d.ts
generated
vendored
Normal file
8
immoweb/node_modules/@turf/hex-grid/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
import {Units, BBox, Polygons} from '@turf/helpers'
|
||||
|
||||
/**
|
||||
* http://turfjs.org/docs/#hexgrid
|
||||
*/
|
||||
declare function hexGrid(bbox: BBox, cellSize: number, units?: Units, triangles?: boolean): Polygons;
|
||||
declare namespace hexGrid { }
|
||||
export = hexGrid;
|
||||
130
immoweb/node_modules/@turf/hex-grid/index.js
generated
vendored
Normal file
130
immoweb/node_modules/@turf/hex-grid/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,130 @@
|
|||
var point = require('@turf/helpers').point;
|
||||
var polygon = require('@turf/helpers').polygon;
|
||||
var distance = require('@turf/distance');
|
||||
var featurecollection = require('@turf/helpers').featureCollection;
|
||||
|
||||
//Precompute cosines and sines of angles used in hexagon creation
|
||||
// for performance gain
|
||||
var cosines = [];
|
||||
var sines = [];
|
||||
for (var i = 0; i < 6; i++) {
|
||||
var angle = 2 * Math.PI / 6 * i;
|
||||
cosines.push(Math.cos(angle));
|
||||
sines.push(Math.sin(angle));
|
||||
}
|
||||
|
||||
/**
|
||||
* Takes a bounding box and a cell size in degrees and returns a {@link FeatureCollection} of flat-topped
|
||||
* hexagons ({@link Polygon} features) aligned in an "odd-q" vertical grid as
|
||||
* described in [Hexagonal Grids](http://www.redblobgames.com/grids/hexagons/).
|
||||
*
|
||||
* @name hexGrid
|
||||
* @param {Array<number>} bbox extent in [minX, minY, maxX, maxY] order
|
||||
* @param {number} cellSize dimension of cell in specified units
|
||||
* @param {string} [units=kilometers] used in calculating cellSize, can be degrees, radians, miles, or kilometers
|
||||
* @param {boolean} [triangles=false] whether to return as triangles instead of hexagons
|
||||
* @returns {FeatureCollection<Polygon>} a hexagonal grid
|
||||
* @example
|
||||
* var bbox = [-96,31,-84,40];
|
||||
* var cellSize = 50;
|
||||
* var units = 'miles';
|
||||
*
|
||||
* var hexgrid = turf.hexGrid(bbox, cellSize, units);
|
||||
*
|
||||
* //=hexgrid
|
||||
*/
|
||||
module.exports = function hexGrid(bbox, cellSize, units, triangles) {
|
||||
var xFraction = cellSize / (distance(point([bbox[0], bbox[1]]), point([bbox[2], bbox[1]]), units));
|
||||
var cellWidth = xFraction * (bbox[2] - bbox[0]);
|
||||
var yFraction = cellSize / (distance(point([bbox[0], bbox[1]]), point([bbox[0], bbox[3]]), units));
|
||||
var cellHeight = yFraction * (bbox[3] - bbox[1]);
|
||||
var radius = cellWidth / 2;
|
||||
|
||||
var hex_width = radius * 2;
|
||||
var hex_height = Math.sqrt(3) / 2 * cellHeight;
|
||||
|
||||
var box_width = bbox[2] - bbox[0];
|
||||
var box_height = bbox[3] - bbox[1];
|
||||
|
||||
var x_interval = 3 / 4 * hex_width;
|
||||
var y_interval = hex_height;
|
||||
|
||||
var x_span = box_width / (hex_width - radius / 2);
|
||||
var x_count = Math.ceil(x_span);
|
||||
if (Math.round(x_span) === x_count) {
|
||||
x_count++;
|
||||
}
|
||||
|
||||
var x_adjust = ((x_count * x_interval - radius / 2) - box_width) / 2 - radius / 2;
|
||||
|
||||
var y_count = Math.ceil(box_height / hex_height);
|
||||
|
||||
var y_adjust = (box_height - y_count * hex_height) / 2;
|
||||
|
||||
var hasOffsetY = y_count * hex_height - box_height > hex_height / 2;
|
||||
if (hasOffsetY) {
|
||||
y_adjust -= hex_height / 4;
|
||||
}
|
||||
|
||||
var fc = featurecollection([]);
|
||||
for (var x = 0; x < x_count; x++) {
|
||||
for (var y = 0; y <= y_count; y++) {
|
||||
|
||||
var isOdd = x % 2 === 1;
|
||||
if (y === 0 && isOdd) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (y === 0 && hasOffsetY) {
|
||||
continue;
|
||||
}
|
||||
|
||||
var center_x = x * x_interval + bbox[0] - x_adjust;
|
||||
var center_y = y * y_interval + bbox[1] + y_adjust;
|
||||
|
||||
if (isOdd) {
|
||||
center_y -= hex_height / 2;
|
||||
}
|
||||
if (triangles) {
|
||||
fc.features.push.apply(fc.features, hexTriangles([center_x, center_y], cellWidth / 2, cellHeight / 2));
|
||||
} else {
|
||||
fc.features.push(hexagon([center_x, center_y], cellWidth / 2, cellHeight / 2));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return fc;
|
||||
};
|
||||
|
||||
//Center should be [x, y]
|
||||
function hexagon(center, rx, ry) {
|
||||
var vertices = [];
|
||||
for (var i = 0; i < 6; i++) {
|
||||
var x = center[0] + rx * cosines[i];
|
||||
var y = center[1] + ry * sines[i];
|
||||
vertices.push([x, y]);
|
||||
}
|
||||
//first and last vertex must be the same
|
||||
vertices.push(vertices[0]);
|
||||
return polygon([vertices]);
|
||||
}
|
||||
|
||||
//Center should be [x, y]
|
||||
function hexTriangles(center, rx, ry) {
|
||||
var triangles = [];
|
||||
for (var i = 0; i < 6; i++) {
|
||||
var vertices = [];
|
||||
vertices.push(center);
|
||||
vertices.push([
|
||||
center[0] + rx * cosines[i],
|
||||
center[1] + ry * sines[i]
|
||||
]);
|
||||
vertices.push([
|
||||
center[0] + rx * cosines[(i + 1) % 6],
|
||||
center[1] + ry * sines[(i + 1) % 6]
|
||||
]);
|
||||
vertices.push(center);
|
||||
triangles.push(polygon([vertices]));
|
||||
}
|
||||
return triangles;
|
||||
}
|
||||
91
immoweb/node_modules/@turf/hex-grid/package.json
generated
vendored
Normal file
91
immoweb/node_modules/@turf/hex-grid/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
{
|
||||
"_from": "@turf/hex-grid@^3.10.3",
|
||||
"_id": "@turf/hex-grid@3.14.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-noA28SceUWS/ao8BfenA9JAtmp8=",
|
||||
"_location": "/@turf/hex-grid",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "@turf/hex-grid@^3.10.3",
|
||||
"name": "@turf/hex-grid",
|
||||
"escapedName": "@turf%2fhex-grid",
|
||||
"scope": "@turf",
|
||||
"rawSpec": "^3.10.3",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^3.10.3"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/hexgrid-heatmap"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@turf/hex-grid/-/hex-grid-3.14.0.tgz",
|
||||
"_shasum": "9e8036f1271e5164bf6a8f017de9c0f4902d9a9f",
|
||||
"_spec": "@turf/hex-grid@^3.10.3",
|
||||
"_where": "/home/kadir/workspace/webimmo/node_modules/hexgrid-heatmap",
|
||||
"author": {
|
||||
"name": "Turf Authors"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/Turfjs/turf/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"contributors": [
|
||||
{
|
||||
"name": "jseppi"
|
||||
},
|
||||
{
|
||||
"name": "jvail"
|
||||
},
|
||||
{
|
||||
"name": "lyzidiamond"
|
||||
},
|
||||
{
|
||||
"name": "tmcw"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"@turf/distance": "^3.14.0",
|
||||
"@turf/helpers": "^3.13.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "turf hex-grid module",
|
||||
"devDependencies": {
|
||||
"@turf/bbox-polygon": "^3.14.0",
|
||||
"@turf/explode": "^3.14.0",
|
||||
"@turf/inside": "^3.14.0",
|
||||
"@turf/truncate": "^3.13.0",
|
||||
"benchmark": "^1.0.0",
|
||||
"eslint": "^3.15.0",
|
||||
"eslint-config-mourner": "^2.0.1",
|
||||
"load-json-file": "^2.0.0",
|
||||
"tape": "^3.5.0",
|
||||
"write-json-file": "^2.0.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"homepage": "https://github.com/Turfjs/turf",
|
||||
"keywords": [
|
||||
"turf",
|
||||
"grid",
|
||||
"hexgrid",
|
||||
"hexbin",
|
||||
"points",
|
||||
"geojson"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "@turf/hex-grid",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/Turfjs/turf.git"
|
||||
},
|
||||
"scripts": {
|
||||
"bench": "node bench.js",
|
||||
"test": "node test.js"
|
||||
},
|
||||
"types": "index.d.ts",
|
||||
"version": "3.14.0"
|
||||
}
|
||||
20
immoweb/node_modules/@turf/invariant/LICENSE
generated
vendored
Normal file
20
immoweb/node_modules/@turf/invariant/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2017 TurfJS
|
||||
|
||||
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.
|
||||
87
immoweb/node_modules/@turf/invariant/README.md
generated
vendored
Normal file
87
immoweb/node_modules/@turf/invariant/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
# @turf/invariant
|
||||
|
||||
# getCoord
|
||||
|
||||
Unwrap a coordinate from a Point Feature, Geometry or a single coordinate.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `obj` **([Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<any> | [Geometry](http://geojson.org/geojson-spec.html#geometry) \| [Feature](http://geojson.org/geojson-spec.html#feature-objects)<[Point](http://geojson.org/geojson-spec.html#point)>)** any value
|
||||
|
||||
Returns **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)>** coordinates
|
||||
|
||||
# getCoords
|
||||
|
||||
Unwrap coordinates from a Feature, Geometry Object or an Array of numbers
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `obj` **([Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<any> | [Geometry](http://geojson.org/geojson-spec.html#geometry) \| [Feature](http://geojson.org/geojson-spec.html#feature-objects)<any>)** any value
|
||||
|
||||
Returns **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<any>** coordinates
|
||||
|
||||
# geojsonType
|
||||
|
||||
Enforce expectations about types of GeoJSON objects for Turf.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `value` **GeoJSON** any GeoJSON object
|
||||
- `type` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** expected GeoJSON type
|
||||
- `name` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** name of calling function
|
||||
|
||||
|
||||
- Throws **[Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error)** if value is not the expected type.
|
||||
|
||||
# featureOf
|
||||
|
||||
Enforce expectations about types of [Feature](http://geojson.org/geojson-spec.html#feature-objects) inputs for Turf.
|
||||
Internally this uses [geojsonType](#geojsontype) to judge geometry types.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `feature` **[Feature](http://geojson.org/geojson-spec.html#feature-objects)** a feature with an expected geometry type
|
||||
- `type` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** expected GeoJSON type
|
||||
- `name` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** name of calling function
|
||||
|
||||
|
||||
- Throws **[Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error)** error if value is not the expected type.
|
||||
|
||||
# collectionOf
|
||||
|
||||
Enforce expectations about types of [FeatureCollection](http://geojson.org/geojson-spec.html#feature-collection-objects) inputs for Turf.
|
||||
Internally this uses [geojsonType](#geojsontype) to judge geometry types.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `featureCollection` **[FeatureCollection](http://geojson.org/geojson-spec.html#feature-collection-objects)** a FeatureCollection for which features will be judged
|
||||
- `type` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** expected GeoJSON type
|
||||
- `name` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** name of calling function
|
||||
|
||||
|
||||
- Throws **[Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error)** if value is not the expected type.
|
||||
|
||||
<!-- This file is automatically generated. Please don't edit it directly:
|
||||
if you find an error, edit the source file (likely index.js), and re-run
|
||||
./scripts/generate-readmes in the turf project. -->
|
||||
|
||||
---
|
||||
|
||||
This module is part of the [Turfjs project](http://turfjs.org/), an open source
|
||||
module collection dedicated to geographic algorithms. It is maintained in the
|
||||
[Turfjs/turf](https://github.com/Turfjs/turf) repository, where you can create
|
||||
PRs and issues.
|
||||
|
||||
### Installation
|
||||
|
||||
Install this module individually:
|
||||
|
||||
```sh
|
||||
$ npm install @turf/invariant
|
||||
```
|
||||
|
||||
Or install the Turf module that includes it as a function:
|
||||
|
||||
```sh
|
||||
$ npm install @turf/turf
|
||||
```
|
||||
30
immoweb/node_modules/@turf/invariant/index.d.ts
generated
vendored
Normal file
30
immoweb/node_modules/@turf/invariant/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
/// <reference types="geojson" />
|
||||
|
||||
type Feature = GeoJSON.Feature<any>
|
||||
type Features = GeoJSON.FeatureCollection<any>
|
||||
type GetCoord = Feature | any[] | GeoJSON.GeometryObject
|
||||
|
||||
/**
|
||||
* http://turfjs.org/docs/
|
||||
*/
|
||||
export function getCoord(obj: GetCoord): Array<any>;
|
||||
|
||||
/**
|
||||
* http://turfjs.org/docs/
|
||||
*/
|
||||
export function getCoords(obj: GetCoord): Array<any>;
|
||||
|
||||
/**
|
||||
* http://turfjs.org/docs/
|
||||
*/
|
||||
export function geojsonType(value: Features, type: string, name: string): void;
|
||||
|
||||
/**
|
||||
* http://turfjs.org/docs/
|
||||
*/
|
||||
export function featureOf(feature: Feature, type: string, name: string): void
|
||||
|
||||
/**
|
||||
* http://turfjs.org/docs/
|
||||
*/
|
||||
export function collectionOf(featurecollection: Features, type: string, name: string): void
|
||||
140
immoweb/node_modules/@turf/invariant/index.js
generated
vendored
Normal file
140
immoweb/node_modules/@turf/invariant/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,140 @@
|
|||
/**
|
||||
* Unwrap a coordinate from a Point Feature, Geometry or a single coordinate.
|
||||
*
|
||||
* @param {Array<any>|Geometry|Feature<Point>} obj any value
|
||||
* @returns {Array<number>} coordinates
|
||||
*/
|
||||
function getCoord(obj) {
|
||||
if (!obj) throw new Error('No obj passed');
|
||||
|
||||
var coordinates = getCoords(obj);
|
||||
|
||||
// getCoord() must contain at least two numbers (Point)
|
||||
if (coordinates.length > 1 &&
|
||||
typeof coordinates[0] === 'number' &&
|
||||
typeof coordinates[1] === 'number') {
|
||||
return coordinates;
|
||||
} else {
|
||||
throw new Error('Coordinate is not a valid Point');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unwrap coordinates from a Feature, Geometry Object or an Array of numbers
|
||||
*
|
||||
* @param {Array<any>|Geometry|Feature<any>} obj any value
|
||||
* @returns {Array<any>} coordinates
|
||||
*/
|
||||
function getCoords(obj) {
|
||||
if (!obj) throw new Error('No obj passed');
|
||||
var coordinates;
|
||||
|
||||
// Array of numbers
|
||||
if (obj.length) {
|
||||
coordinates = obj;
|
||||
|
||||
// Geometry Object
|
||||
} else if (obj.coordinates) {
|
||||
coordinates = obj.coordinates;
|
||||
|
||||
// Feature
|
||||
} else if (obj.geometry && obj.geometry.coordinates) {
|
||||
coordinates = obj.geometry.coordinates;
|
||||
}
|
||||
// Checks if coordinates contains a number
|
||||
if (coordinates) {
|
||||
containsNumber(coordinates);
|
||||
return coordinates;
|
||||
}
|
||||
throw new Error('No valid coordinates');
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if coordinates contains a number
|
||||
*
|
||||
* @private
|
||||
* @param {Array<any>} coordinates GeoJSON Coordinates
|
||||
* @returns {boolean} true if Array contains a number
|
||||
*/
|
||||
function containsNumber(coordinates) {
|
||||
if (coordinates.length > 1 &&
|
||||
typeof coordinates[0] === 'number' &&
|
||||
typeof coordinates[1] === 'number') {
|
||||
return true;
|
||||
}
|
||||
if (coordinates[0].length) {
|
||||
return containsNumber(coordinates[0]);
|
||||
}
|
||||
throw new Error('coordinates must only contain numbers');
|
||||
}
|
||||
|
||||
/**
|
||||
* Enforce expectations about types of GeoJSON objects for Turf.
|
||||
*
|
||||
* @alias geojsonType
|
||||
* @param {GeoJSON} value any GeoJSON object
|
||||
* @param {string} type expected GeoJSON type
|
||||
* @param {string} name name of calling function
|
||||
* @throws {Error} if value is not the expected type.
|
||||
*/
|
||||
function geojsonType(value, type, name) {
|
||||
if (!type || !name) throw new Error('type and name required');
|
||||
|
||||
if (!value || value.type !== type) {
|
||||
throw new Error('Invalid input to ' + name + ': must be a ' + type + ', given ' + value.type);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Enforce expectations about types of {@link Feature} inputs for Turf.
|
||||
* Internally this uses {@link geojsonType} to judge geometry types.
|
||||
*
|
||||
* @alias featureOf
|
||||
* @param {Feature} feature a feature with an expected geometry type
|
||||
* @param {string} type expected GeoJSON type
|
||||
* @param {string} name name of calling function
|
||||
* @throws {Error} error if value is not the expected type.
|
||||
*/
|
||||
function featureOf(feature, type, name) {
|
||||
if (!feature) throw new Error('No feature passed');
|
||||
if (!name) throw new Error('.featureOf() requires a name');
|
||||
if (!feature || feature.type !== 'Feature' || !feature.geometry) {
|
||||
throw new Error('Invalid input to ' + name + ', Feature with geometry required');
|
||||
}
|
||||
if (!feature.geometry || feature.geometry.type !== type) {
|
||||
throw new Error('Invalid input to ' + name + ': must be a ' + type + ', given ' + feature.geometry.type);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Enforce expectations about types of {@link FeatureCollection} inputs for Turf.
|
||||
* Internally this uses {@link geojsonType} to judge geometry types.
|
||||
*
|
||||
* @alias collectionOf
|
||||
* @param {FeatureCollection} featureCollection a FeatureCollection for which features will be judged
|
||||
* @param {string} type expected GeoJSON type
|
||||
* @param {string} name name of calling function
|
||||
* @throws {Error} if value is not the expected type.
|
||||
*/
|
||||
function collectionOf(featureCollection, type, name) {
|
||||
if (!featureCollection) throw new Error('No featureCollection passed');
|
||||
if (!name) throw new Error('.collectionOf() requires a name');
|
||||
if (!featureCollection || featureCollection.type !== 'FeatureCollection') {
|
||||
throw new Error('Invalid input to ' + name + ', FeatureCollection required');
|
||||
}
|
||||
for (var i = 0; i < featureCollection.features.length; i++) {
|
||||
var feature = featureCollection.features[i];
|
||||
if (!feature || feature.type !== 'Feature' || !feature.geometry) {
|
||||
throw new Error('Invalid input to ' + name + ', Feature with geometry required');
|
||||
}
|
||||
if (!feature.geometry || feature.geometry.type !== type) {
|
||||
throw new Error('Invalid input to ' + name + ': must be a ' + type + ', given ' + feature.geometry.type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports.geojsonType = geojsonType;
|
||||
module.exports.collectionOf = collectionOf;
|
||||
module.exports.featureOf = featureOf;
|
||||
module.exports.getCoord = getCoord;
|
||||
module.exports.getCoords = getCoords;
|
||||
65
immoweb/node_modules/@turf/invariant/package.json
generated
vendored
Normal file
65
immoweb/node_modules/@turf/invariant/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
{
|
||||
"_from": "@turf/invariant@^3.13.0",
|
||||
"_id": "@turf/invariant@3.13.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-iSQzCM1WMgboHlxhYuDSL2GCL5A=",
|
||||
"_location": "/@turf/invariant",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "@turf/invariant@^3.13.0",
|
||||
"name": "@turf/invariant",
|
||||
"escapedName": "@turf%2finvariant",
|
||||
"scope": "@turf",
|
||||
"rawSpec": "^3.13.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^3.13.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@turf/destination",
|
||||
"/@turf/distance"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@turf/invariant/-/invariant-3.13.0.tgz",
|
||||
"_shasum": "89243308cd563206e81e5c6162e0d22f61822f90",
|
||||
"_spec": "@turf/invariant@^3.13.0",
|
||||
"_where": "/home/kadir/workspace/webimmo/node_modules/@turf/destination",
|
||||
"author": {
|
||||
"name": "Turf Authors"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/Turfjs/turf/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {},
|
||||
"deprecated": false,
|
||||
"description": "turf invariant module",
|
||||
"devDependencies": {
|
||||
"@turf/helpers": "^3.13.0",
|
||||
"benchmark": "^2.1.3",
|
||||
"tape": "^3.5.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"homepage": "https://github.com/Turfjs/turf",
|
||||
"keywords": [
|
||||
"turf",
|
||||
"invariant",
|
||||
"expectations"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "@turf/invariant",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/Turfjs/turf.git"
|
||||
},
|
||||
"scripts": {
|
||||
"bench": "node bench.js",
|
||||
"test": "node test.js"
|
||||
},
|
||||
"types": "index.d.ts",
|
||||
"version": "3.13.0"
|
||||
}
|
||||
20
immoweb/node_modules/@turf/meta/LICENSE
generated
vendored
Normal file
20
immoweb/node_modules/@turf/meta/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2017 TurfJS
|
||||
|
||||
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.
|
||||
403
immoweb/node_modules/@turf/meta/README.md
generated
vendored
Normal file
403
immoweb/node_modules/@turf/meta/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,403 @@
|
|||
# @turf/meta
|
||||
|
||||
# coordEach
|
||||
|
||||
Iterate over coordinates in any GeoJSON object, similar to Array.forEach()
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `layer` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** any GeoJSON object
|
||||
- `callback` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** a method that takes (currentCoords, currentIndex)
|
||||
- `excludeWrapCoord` **\[[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)]** whether or not to include
|
||||
the final coordinate of LinearRings that wraps the ring in its iteration. (optional, default `false`)
|
||||
|
||||
**Examples**
|
||||
|
||||
```javascript
|
||||
var features = {
|
||||
"type": "FeatureCollection",
|
||||
"features": [
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [26, 37]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [36, 53]
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
turf.coordEach(features, function (currentCoords, currentIndex) {
|
||||
//=currentCoords
|
||||
//=currentIndex
|
||||
});
|
||||
```
|
||||
|
||||
# coordReduce
|
||||
|
||||
Reduce coordinates in any GeoJSON object, similar to Array.reduce()
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `layer` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** any GeoJSON object
|
||||
- `callback` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** a method that takes (previousValue, currentCoords, currentIndex)
|
||||
- `initialValue` **\[Any]** Value to use as the first argument to the first call of the callback.
|
||||
- `excludeWrapCoord` **\[[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)]** whether or not to include
|
||||
the final coordinate of LinearRings that wraps the ring in its iteration. (optional, default `false`)
|
||||
|
||||
**Examples**
|
||||
|
||||
```javascript
|
||||
var features = {
|
||||
"type": "FeatureCollection",
|
||||
"features": [
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [26, 37]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [36, 53]
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
turf.coordReduce(features, function (previousValue, currentCoords, currentIndex) {
|
||||
//=previousValue
|
||||
//=currentCoords
|
||||
//=currentIndex
|
||||
return currentCoords;
|
||||
});
|
||||
```
|
||||
|
||||
Returns **Any** The value that results from the reduction.
|
||||
|
||||
# propEach
|
||||
|
||||
Iterate over properties in any GeoJSON object, similar to Array.forEach()
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `layer` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** any GeoJSON object
|
||||
- `callback` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** a method that takes (currentProperties, currentIndex)
|
||||
|
||||
**Examples**
|
||||
|
||||
```javascript
|
||||
var features = {
|
||||
"type": "FeatureCollection",
|
||||
"features": [
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {"foo": "bar"},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [26, 37]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {"hello": "world"},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [36, 53]
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
turf.propEach(features, function (currentProperties, currentIndex) {
|
||||
//=currentProperties
|
||||
//=currentIndex
|
||||
});
|
||||
```
|
||||
|
||||
# propReduce
|
||||
|
||||
Reduce properties in any GeoJSON object into a single value,
|
||||
similar to how Array.reduce works. However, in this case we lazily run
|
||||
the reduction, so an array of all properties is unnecessary.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `layer` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** any GeoJSON object
|
||||
- `callback` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** a method that takes (previousValue, currentProperties, currentIndex)
|
||||
- `initialValue` **\[Any]** Value to use as the first argument to the first call of the callback.
|
||||
|
||||
**Examples**
|
||||
|
||||
```javascript
|
||||
var features = {
|
||||
"type": "FeatureCollection",
|
||||
"features": [
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {"foo": "bar"},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [26, 37]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {"hello": "world"},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [36, 53]
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
turf.propReduce(features, function (previousValue, currentProperties, currentIndex) {
|
||||
//=previousValue
|
||||
//=currentProperties
|
||||
//=currentIndex
|
||||
return currentProperties
|
||||
});
|
||||
```
|
||||
|
||||
Returns **Any** The value that results from the reduction.
|
||||
|
||||
# featureEach
|
||||
|
||||
Iterate over features in any GeoJSON object, similar to
|
||||
Array.forEach.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `layer` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** any GeoJSON object
|
||||
- `callback` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** a method that takes (currentFeature, currentIndex)
|
||||
|
||||
**Examples**
|
||||
|
||||
```javascript
|
||||
var features = {
|
||||
"type": "FeatureCollection",
|
||||
"features": [
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [26, 37]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [36, 53]
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
turf.featureEach(features, function (currentFeature, currentIndex) {
|
||||
//=currentFeature
|
||||
//=currentIndex
|
||||
});
|
||||
```
|
||||
|
||||
# featureReduce
|
||||
|
||||
Reduce features in any GeoJSON object, similar to Array.reduce().
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `layer` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** any GeoJSON object
|
||||
- `callback` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** a method that takes (previousValue, currentFeature, currentIndex)
|
||||
- `initialValue` **\[Any]** Value to use as the first argument to the first call of the callback.
|
||||
|
||||
**Examples**
|
||||
|
||||
```javascript
|
||||
var features = {
|
||||
"type": "FeatureCollection",
|
||||
"features": [
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {"foo": "bar"},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [26, 37]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {"hello": "world"},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [36, 53]
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
turf.featureReduce(features, function (previousValue, currentFeature, currentIndex) {
|
||||
//=previousValue
|
||||
//=currentFeature
|
||||
//=currentIndex
|
||||
return currentFeature
|
||||
});
|
||||
```
|
||||
|
||||
Returns **Any** The value that results from the reduction.
|
||||
|
||||
# coordAll
|
||||
|
||||
Get all coordinates from any GeoJSON object.
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `layer` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** any GeoJSON object
|
||||
|
||||
**Examples**
|
||||
|
||||
```javascript
|
||||
var features = {
|
||||
"type": "FeatureCollection",
|
||||
"features": [
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [26, 37]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [36, 53]
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
var coords = turf.coordAll(features);
|
||||
//=coords
|
||||
```
|
||||
|
||||
Returns **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)>>** coordinate position array
|
||||
|
||||
# geomEach
|
||||
|
||||
Iterate over each geometry in any GeoJSON object, similar to Array.forEach()
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `layer` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** any GeoJSON object
|
||||
- `callback` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** a method that takes (currentGeometry, currentIndex)
|
||||
|
||||
**Examples**
|
||||
|
||||
```javascript
|
||||
var features = {
|
||||
"type": "FeatureCollection",
|
||||
"features": [
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [26, 37]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [36, 53]
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
turf.geomEach(features, function (currentGeometry, currentIndex) {
|
||||
//=currentGeometry
|
||||
//=currentIndex
|
||||
});
|
||||
```
|
||||
|
||||
# geomReduce
|
||||
|
||||
Reduce geometry in any GeoJSON object, similar to Array.reduce().
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `layer` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** any GeoJSON object
|
||||
- `callback` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** a method that takes (previousValue, currentGeometry, currentIndex)
|
||||
- `initialValue` **\[Any]** Value to use as the first argument to the first call of the callback.
|
||||
|
||||
**Examples**
|
||||
|
||||
```javascript
|
||||
var features = {
|
||||
"type": "FeatureCollection",
|
||||
"features": [
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {"foo": "bar"},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [26, 37]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {"hello": "world"},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [36, 53]
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
turf.geomReduce(features, function (previousValue, currentGeometry, currentIndex) {
|
||||
//=previousValue
|
||||
//=currentGeometry
|
||||
//=currentIndex
|
||||
return currentGeometry
|
||||
});
|
||||
```
|
||||
|
||||
Returns **Any** The value that results from the reduction.
|
||||
|
||||
<!-- This file is automatically generated. Please don't edit it directly:
|
||||
if you find an error, edit the source file (likely index.js), and re-run
|
||||
./scripts/generate-readmes in the turf project. -->
|
||||
|
||||
---
|
||||
|
||||
This module is part of the [Turfjs project](http://turfjs.org/), an open source
|
||||
module collection dedicated to geographic algorithms. It is maintained in the
|
||||
[Turfjs/turf](https://github.com/Turfjs/turf) repository, where you can create
|
||||
PRs and issues.
|
||||
|
||||
### Installation
|
||||
|
||||
Install this module individually:
|
||||
|
||||
```sh
|
||||
$ npm install @turf/meta
|
||||
```
|
||||
|
||||
Or install the Turf module that includes it as a function:
|
||||
|
||||
```sh
|
||||
$ npm install @turf/turf
|
||||
```
|
||||
101
immoweb/node_modules/@turf/meta/index.d.ts
generated
vendored
Normal file
101
immoweb/node_modules/@turf/meta/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
/// <reference types="geojson" />
|
||||
|
||||
type Points = GeoJSON.FeatureCollection<GeoJSON.Point>
|
||||
type Point = GeoJSON.Feature<GeoJSON.Point> | GeoJSON.Point
|
||||
type MultiPoints = GeoJSON.FeatureCollection<GeoJSON.MultiPoint>
|
||||
type MultiPoint = GeoJSON.Feature<GeoJSON.MultiPoint> | GeoJSON.MultiPoint
|
||||
type LineStrings = GeoJSON.FeatureCollection<GeoJSON.LineString>
|
||||
type LineString = GeoJSON.Feature<GeoJSON.LineString> | GeoJSON.LineString
|
||||
type MultiLineStrings = GeoJSON.FeatureCollection<GeoJSON.MultiLineString>
|
||||
type MultiLineString = GeoJSON.Feature<GeoJSON.MultiLineString> | GeoJSON.MultiLineString
|
||||
type Polygons = GeoJSON.FeatureCollection<GeoJSON.Polygon>
|
||||
type Polygon = GeoJSON.Feature<GeoJSON.Polygon> | GeoJSON.Polygon
|
||||
type MultiPolygons = GeoJSON.FeatureCollection<GeoJSON.MultiPolygon>
|
||||
type MultiPolygon = GeoJSON.Feature<GeoJSON.MultiPolygon> | GeoJSON.MultiPolygon
|
||||
type Feature = GeoJSON.Feature<any>
|
||||
type Features = GeoJSON.FeatureCollection<any>
|
||||
type GeometryCollection = GeoJSON.GeometryCollection
|
||||
type GeometryObject = GeoJSON.GeometryObject
|
||||
|
||||
interface MetaStatic {
|
||||
/**
|
||||
* http://turfjs.org/docs/#coordeach
|
||||
*/
|
||||
coordEach(layer: Points | Point | MultiPoint | MultiPoints, callback: (currentCoords: Array<number>, currentIndex: number) => void, excludeWrapCoord?: boolean): void;
|
||||
coordEach(layer: LineStrings | LineString | MultiLineString | MultiLineStrings, callback: (currentCoords: Array<Array<number>>, currentIndex: number) => void, excludeWrapCoord?: boolean): void;
|
||||
coordEach(layer: Polygons | Polygon | MultiPolygons | MultiPolygon, callback: (currentCoords: Array<Array<Array<number>>>, currentIndex: number) => void, excludeWrapCoord?: boolean): void;
|
||||
coordEach(layer: GeometryCollection | GeometryObject, callback: (currentCoords: Array<any>, currentIndex: number) => void, excludeWrapCoord?: boolean): void;
|
||||
|
||||
/**
|
||||
* http://turfjs.org/docs/#coordreduce
|
||||
*/
|
||||
coordReduce(layer: Points | Point | MultiPoint | MultiPoints, callback: (previousValue: any, currentCoords: Array<number>, currentIndex: number) => void, initialValue: any, excludeWrapCoord?: boolean): any;
|
||||
coordReduce(layer: LineStrings | LineString | MultiLineString | MultiLineStrings, callback: (previousValue: any, currentCoords: Array<Array<number>>, currentIndex: number) => void, initialValue: any, excludeWrapCoord?: boolean): any;
|
||||
coordReduce(layer: Polygons | Polygon | MultiPolygons | MultiPolygon, callback: (previousValue: any, currentCoords: Array<Array<Array<number>>>, currentIndex: number) => void, initialValue: any, excludeWrapCoord?: boolean): any;
|
||||
coordReduce(layer: GeometryCollection | GeometryObject, callback: (previousValue: any, currentCoords: Array<any>, currentIndex: number) => void, initialValue: any, excludeWrapCoord?: boolean): any;
|
||||
|
||||
/**
|
||||
* http://turfjs.org/docs/#propeach
|
||||
*/
|
||||
propEach(layer: Feature | Features, callback: (currentProperties: any, currentIndex: number) => void): void;
|
||||
|
||||
/**
|
||||
* http://turfjs.org/docs/#propreduce
|
||||
*/
|
||||
propReduce(layer: Feature | Features, callback: (previousValue: any, currentProperties: any, currentIndex: number) => void, initialValue: any): any;
|
||||
|
||||
/**
|
||||
* http://turfjs.org/docs/#featurereduce
|
||||
*/
|
||||
featureReduce(layer: Point | Points, callback: (previousValue: any, currentFeature: Point, currentIndex: number) => void, initialValue: any): any;
|
||||
featureReduce(layer: LineString | LineStrings, callback: (previousValue: any, currentFeature: LineString, currentIndex: number) => void, initialValue: any): any;
|
||||
featureReduce(layer: Polygon | Polygons, callback: (previousValue: any, currentFeature: Polygon, currentIndex: number) => void, initialValue: any): any;
|
||||
featureReduce(layer: MultiPoint | MultiPoints, callback: (previousValue: any, currentFeature: MultiPoint, currentIndex: number) => void, initialValue: any): any;
|
||||
featureReduce(layer: MultiLineString | MultiLineStrings, callback: (previousValue: any, currentFeature: MultiLineString, currentIndex: number) => void, initialValue: any): any;
|
||||
featureReduce(layer: MultiPolygon | MultiPolygons, callback: (previousValue: any, currentFeature: MultiPolygon, currentIndex: number) => void, initialValue: any): any;
|
||||
featureReduce(layer: Feature | Features, callback: (previousValue: any, currentFeature: Feature, currentIndex: number) => void, initialValue: any): any;
|
||||
|
||||
|
||||
/**
|
||||
* http://turfjs.org/docs/#featureeach
|
||||
*/
|
||||
featureEach(layer: Point | Points, callback: (currentFeature: Point, currentIndex: number) => void): void;
|
||||
featureEach(layer: LineString | LineStrings, callback: (currentFeature: LineString, currentIndex: number) => void): void;
|
||||
featureEach(layer: Polygon | Polygons, callback: (currentFeature: Polygon, currentIndex: number) => void): void;
|
||||
featureEach(layer: MultiPoint | MultiPoints, callback: (currentFeature: MultiPoint, currentIndex: number) => void): void;
|
||||
featureEach(layer: MultiLineString | MultiLineStrings, callback: (currentFeature: MultiLineString, currentIndex: number) => void): void;
|
||||
featureEach(layer: MultiPolygon | MultiPolygons, callback: (currentFeature: MultiPolygon, currentIndex: number) => void): void;
|
||||
featureEach(layer: Feature | Features, callback: (currentFeature: Feature, currentIndex: number) => void): void;
|
||||
|
||||
/**
|
||||
* http://turfjs.org/docs/#coordall
|
||||
*/
|
||||
coordAll(layer: Feature | Features | GeometryCollection | GeometryObject): Array<Array<number>>
|
||||
|
||||
/**
|
||||
* http://turfjs.org/docs/#geomreduce
|
||||
*/
|
||||
geomReduce(layer: Point | Points, callback: (previousValue: any, currentGeometry: GeoJSON.Point, currentIndex: number) => void, initialValue: any): any;
|
||||
geomReduce(layer: LineString | LineStrings, callback: (previousValue: any, currentGeometry: GeoJSON.LineString, currentIndex: number) => void, initialValue: any): any;
|
||||
geomReduce(layer: Polygon | Polygons, callback: (previousValue: any, currentGeometry: GeoJSON.Polygon, currentIndex: number) => void, initialValue: any): any;
|
||||
geomReduce(layer: MultiPoint | MultiPoints, callback: (previousValue: any, currentGeometry: GeoJSON.MultiPoint, currentIndex: number) => void, initialValue: any): any;
|
||||
geomReduce(layer: MultiLineString | MultiLineStrings, callback: (previousValue: any, currentGeometry: GeoJSON.MultiLineString, currentIndex: number) => void, initialValue: any): any;
|
||||
geomReduce(layer: MultiPolygon | MultiPolygons, callback: (previousValue: any, currentGeometry: GeoJSON.MultiPolygon, currentIndex: number) => void, initialValue: any): any;
|
||||
geomReduce(layer: Feature | Features, callback: (previousValue: any, currentGeometry: GeometryObject, currentIndex: number) => void, initialValue: any): any;
|
||||
geomReduce(layer: GeometryCollection | GeometryObject, callback: (previousValue: any, currentGeometry: GeometryObject, currentIndex: number) => void, initialValue: any): any;
|
||||
|
||||
/**
|
||||
* http://turfjs.org/docs/#geomeach
|
||||
*/
|
||||
geomEach(layer: Point | Points, callback: (currentGeometry: GeoJSON.Point, currentIndex: number) => void): void;
|
||||
geomEach(layer: LineString | LineStrings, callback: (currentGeometry: GeoJSON.LineString, currentIndex: number) => void): void;
|
||||
geomEach(layer: Polygon | Polygons, callback: (currentGeometry: GeoJSON.Polygon, currentIndex: number) => void): void;
|
||||
geomEach(layer: MultiPoint | MultiPoints, callback: (currentGeometry: GeoJSON.MultiPoint, currentIndex: number) => void): void;
|
||||
geomEach(layer: MultiLineString | MultiLineStrings, callback: (currentGeometry: GeoJSON.MultiLineString, currentIndex: number) => void): void;
|
||||
geomEach(layer: MultiPolygon | MultiPolygons, callback: (currentGeometry: GeoJSON.MultiPolygon, currentIndex: number) => void): void;
|
||||
geomEach(layer: Feature | Features, callback: (currentGeometry: GeometryObject, currentIndex: number) => void): void;
|
||||
geomEach(layer: GeometryCollection | GeometryObject, callback: (currentGeometry: GeometryObject, currentIndex: number) => void): void;
|
||||
}
|
||||
|
||||
declare const meta: MetaStatic
|
||||
export = meta
|
||||
650
immoweb/node_modules/@turf/meta/index.js
generated
vendored
Normal file
650
immoweb/node_modules/@turf/meta/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,650 @@
|
|||
/**
|
||||
* Callback for coordEach
|
||||
*
|
||||
* @private
|
||||
* @callback coordEachCallback
|
||||
* @param {[number, number]} currentCoords The current coordinates being processed.
|
||||
* @param {number} currentIndex The index of the current element being processed in the
|
||||
* array.Starts at index 0, if an initialValue is provided, and at index 1 otherwise.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Iterate over coordinates in any GeoJSON object, similar to Array.forEach()
|
||||
*
|
||||
* @name coordEach
|
||||
* @param {Object} layer any GeoJSON object
|
||||
* @param {Function} callback a method that takes (currentCoords, currentIndex)
|
||||
* @param {boolean} [excludeWrapCoord=false] whether or not to include
|
||||
* the final coordinate of LinearRings that wraps the ring in its iteration.
|
||||
* @example
|
||||
* var features = {
|
||||
* "type": "FeatureCollection",
|
||||
* "features": [
|
||||
* {
|
||||
* "type": "Feature",
|
||||
* "properties": {},
|
||||
* "geometry": {
|
||||
* "type": "Point",
|
||||
* "coordinates": [26, 37]
|
||||
* }
|
||||
* },
|
||||
* {
|
||||
* "type": "Feature",
|
||||
* "properties": {},
|
||||
* "geometry": {
|
||||
* "type": "Point",
|
||||
* "coordinates": [36, 53]
|
||||
* }
|
||||
* }
|
||||
* ]
|
||||
* };
|
||||
* turf.coordEach(features, function (currentCoords, currentIndex) {
|
||||
* //=currentCoords
|
||||
* //=currentIndex
|
||||
* });
|
||||
*/
|
||||
function coordEach(layer, callback, excludeWrapCoord) {
|
||||
var i, j, k, g, l, geometry, stopG, coords,
|
||||
geometryMaybeCollection,
|
||||
wrapShrink = 0,
|
||||
currentIndex = 0,
|
||||
isGeometryCollection,
|
||||
isFeatureCollection = layer.type === 'FeatureCollection',
|
||||
isFeature = layer.type === 'Feature',
|
||||
stop = isFeatureCollection ? layer.features.length : 1;
|
||||
|
||||
// This logic may look a little weird. The reason why it is that way
|
||||
// is because it's trying to be fast. GeoJSON supports multiple kinds
|
||||
// of objects at its root: FeatureCollection, Features, Geometries.
|
||||
// This function has the responsibility of handling all of them, and that
|
||||
// means that some of the `for` loops you see below actually just don't apply
|
||||
// to certain inputs. For instance, if you give this just a
|
||||
// Point geometry, then both loops are short-circuited and all we do
|
||||
// is gradually rename the input until it's called 'geometry'.
|
||||
//
|
||||
// This also aims to allocate as few resources as possible: just a
|
||||
// few numbers and booleans, rather than any temporary arrays as would
|
||||
// be required with the normalization approach.
|
||||
for (i = 0; i < stop; i++) {
|
||||
|
||||
geometryMaybeCollection = (isFeatureCollection ? layer.features[i].geometry :
|
||||
(isFeature ? layer.geometry : layer));
|
||||
isGeometryCollection = geometryMaybeCollection.type === 'GeometryCollection';
|
||||
stopG = isGeometryCollection ? geometryMaybeCollection.geometries.length : 1;
|
||||
|
||||
for (g = 0; g < stopG; g++) {
|
||||
geometry = isGeometryCollection ?
|
||||
geometryMaybeCollection.geometries[g] : geometryMaybeCollection;
|
||||
coords = geometry.coordinates;
|
||||
|
||||
wrapShrink = (excludeWrapCoord &&
|
||||
(geometry.type === 'Polygon' || geometry.type === 'MultiPolygon')) ?
|
||||
1 : 0;
|
||||
|
||||
if (geometry.type === 'Point') {
|
||||
callback(coords, currentIndex);
|
||||
currentIndex++;
|
||||
} else if (geometry.type === 'LineString' || geometry.type === 'MultiPoint') {
|
||||
for (j = 0; j < coords.length; j++) {
|
||||
callback(coords[j], currentIndex);
|
||||
currentIndex++;
|
||||
}
|
||||
} else if (geometry.type === 'Polygon' || geometry.type === 'MultiLineString') {
|
||||
for (j = 0; j < coords.length; j++)
|
||||
for (k = 0; k < coords[j].length - wrapShrink; k++) {
|
||||
callback(coords[j][k], currentIndex);
|
||||
currentIndex++;
|
||||
}
|
||||
} else if (geometry.type === 'MultiPolygon') {
|
||||
for (j = 0; j < coords.length; j++)
|
||||
for (k = 0; k < coords[j].length; k++)
|
||||
for (l = 0; l < coords[j][k].length - wrapShrink; l++) {
|
||||
callback(coords[j][k][l], currentIndex);
|
||||
currentIndex++;
|
||||
}
|
||||
} else if (geometry.type === 'GeometryCollection') {
|
||||
for (j = 0; j < geometry.geometries.length; j++)
|
||||
coordEach(geometry.geometries[j], callback, excludeWrapCoord);
|
||||
} else {
|
||||
throw new Error('Unknown Geometry Type');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
module.exports.coordEach = coordEach;
|
||||
|
||||
/**
|
||||
* Callback for coordReduce
|
||||
*
|
||||
* The first time the callback function is called, the values provided as arguments depend
|
||||
* on whether the reduce method has an initialValue argument.
|
||||
*
|
||||
* If an initialValue is provided to the reduce method:
|
||||
* - The previousValue argument is initialValue.
|
||||
* - The currentValue argument is the value of the first element present in the array.
|
||||
*
|
||||
* If an initialValue is not provided:
|
||||
* - The previousValue argument is the value of the first element present in the array.
|
||||
* - The currentValue argument is the value of the second element present in the array.
|
||||
*
|
||||
* @private
|
||||
* @callback coordReduceCallback
|
||||
* @param {*} previousValue The accumulated value previously returned in the last invocation
|
||||
* of the callback, or initialValue, if supplied.
|
||||
* @param {[number, number]} currentCoords The current coordinate being processed.
|
||||
* @param {number} currentIndex The index of the current element being processed in the
|
||||
* array.Starts at index 0, if an initialValue is provided, and at index 1 otherwise.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Reduce coordinates in any GeoJSON object, similar to Array.reduce()
|
||||
*
|
||||
* @name coordReduce
|
||||
* @param {Object} layer any GeoJSON object
|
||||
* @param {Function} callback a method that takes (previousValue, currentCoords, currentIndex)
|
||||
* @param {*} [initialValue] Value to use as the first argument to the first call of the callback.
|
||||
* @param {boolean} [excludeWrapCoord=false] whether or not to include
|
||||
* the final coordinate of LinearRings that wraps the ring in its iteration.
|
||||
* @returns {*} The value that results from the reduction.
|
||||
* @example
|
||||
* var features = {
|
||||
* "type": "FeatureCollection",
|
||||
* "features": [
|
||||
* {
|
||||
* "type": "Feature",
|
||||
* "properties": {},
|
||||
* "geometry": {
|
||||
* "type": "Point",
|
||||
* "coordinates": [26, 37]
|
||||
* }
|
||||
* },
|
||||
* {
|
||||
* "type": "Feature",
|
||||
* "properties": {},
|
||||
* "geometry": {
|
||||
* "type": "Point",
|
||||
* "coordinates": [36, 53]
|
||||
* }
|
||||
* }
|
||||
* ]
|
||||
* };
|
||||
* turf.coordReduce(features, function (previousValue, currentCoords, currentIndex) {
|
||||
* //=previousValue
|
||||
* //=currentCoords
|
||||
* //=currentIndex
|
||||
* return currentCoords;
|
||||
* });
|
||||
*/
|
||||
function coordReduce(layer, callback, initialValue, excludeWrapCoord) {
|
||||
var previousValue = initialValue;
|
||||
coordEach(layer, function (currentCoords, currentIndex) {
|
||||
if (currentIndex === 0 && initialValue === undefined) {
|
||||
previousValue = currentCoords;
|
||||
} else {
|
||||
previousValue = callback(previousValue, currentCoords, currentIndex);
|
||||
}
|
||||
}, excludeWrapCoord);
|
||||
return previousValue;
|
||||
}
|
||||
module.exports.coordReduce = coordReduce;
|
||||
|
||||
/**
|
||||
* Callback for propEach
|
||||
*
|
||||
* @private
|
||||
* @callback propEachCallback
|
||||
* @param {*} currentProperties The current properties being processed.
|
||||
* @param {number} currentIndex The index of the current element being processed in the
|
||||
* array.Starts at index 0, if an initialValue is provided, and at index 1 otherwise.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Iterate over properties in any GeoJSON object, similar to Array.forEach()
|
||||
*
|
||||
* @name propEach
|
||||
* @param {Object} layer any GeoJSON object
|
||||
* @param {Function} callback a method that takes (currentProperties, currentIndex)
|
||||
* @example
|
||||
* var features = {
|
||||
* "type": "FeatureCollection",
|
||||
* "features": [
|
||||
* {
|
||||
* "type": "Feature",
|
||||
* "properties": {"foo": "bar"},
|
||||
* "geometry": {
|
||||
* "type": "Point",
|
||||
* "coordinates": [26, 37]
|
||||
* }
|
||||
* },
|
||||
* {
|
||||
* "type": "Feature",
|
||||
* "properties": {"hello": "world"},
|
||||
* "geometry": {
|
||||
* "type": "Point",
|
||||
* "coordinates": [36, 53]
|
||||
* }
|
||||
* }
|
||||
* ]
|
||||
* };
|
||||
* turf.propEach(features, function (currentProperties, currentIndex) {
|
||||
* //=currentProperties
|
||||
* //=currentIndex
|
||||
* });
|
||||
*/
|
||||
function propEach(layer, callback) {
|
||||
var i;
|
||||
switch (layer.type) {
|
||||
case 'FeatureCollection':
|
||||
for (i = 0; i < layer.features.length; i++) {
|
||||
callback(layer.features[i].properties, i);
|
||||
}
|
||||
break;
|
||||
case 'Feature':
|
||||
callback(layer.properties, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
module.exports.propEach = propEach;
|
||||
|
||||
|
||||
/**
|
||||
* Callback for propReduce
|
||||
*
|
||||
* The first time the callback function is called, the values provided as arguments depend
|
||||
* on whether the reduce method has an initialValue argument.
|
||||
*
|
||||
* If an initialValue is provided to the reduce method:
|
||||
* - The previousValue argument is initialValue.
|
||||
* - The currentValue argument is the value of the first element present in the array.
|
||||
*
|
||||
* If an initialValue is not provided:
|
||||
* - The previousValue argument is the value of the first element present in the array.
|
||||
* - The currentValue argument is the value of the second element present in the array.
|
||||
*
|
||||
* @private
|
||||
* @callback propReduceCallback
|
||||
* @param {*} previousValue The accumulated value previously returned in the last invocation
|
||||
* of the callback, or initialValue, if supplied.
|
||||
* @param {*} currentProperties The current properties being processed.
|
||||
* @param {number} currentIndex The index of the current element being processed in the
|
||||
* array.Starts at index 0, if an initialValue is provided, and at index 1 otherwise.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Reduce properties in any GeoJSON object into a single value,
|
||||
* similar to how Array.reduce works. However, in this case we lazily run
|
||||
* the reduction, so an array of all properties is unnecessary.
|
||||
*
|
||||
* @name propReduce
|
||||
* @param {Object} layer any GeoJSON object
|
||||
* @param {Function} callback a method that takes (previousValue, currentProperties, currentIndex)
|
||||
* @param {*} [initialValue] Value to use as the first argument to the first call of the callback.
|
||||
* @returns {*} The value that results from the reduction.
|
||||
* @example
|
||||
* var features = {
|
||||
* "type": "FeatureCollection",
|
||||
* "features": [
|
||||
* {
|
||||
* "type": "Feature",
|
||||
* "properties": {"foo": "bar"},
|
||||
* "geometry": {
|
||||
* "type": "Point",
|
||||
* "coordinates": [26, 37]
|
||||
* }
|
||||
* },
|
||||
* {
|
||||
* "type": "Feature",
|
||||
* "properties": {"hello": "world"},
|
||||
* "geometry": {
|
||||
* "type": "Point",
|
||||
* "coordinates": [36, 53]
|
||||
* }
|
||||
* }
|
||||
* ]
|
||||
* };
|
||||
* turf.propReduce(features, function (previousValue, currentProperties, currentIndex) {
|
||||
* //=previousValue
|
||||
* //=currentProperties
|
||||
* //=currentIndex
|
||||
* return currentProperties
|
||||
* });
|
||||
*/
|
||||
function propReduce(layer, callback, initialValue) {
|
||||
var previousValue = initialValue;
|
||||
propEach(layer, function (currentProperties, currentIndex) {
|
||||
if (currentIndex === 0 && initialValue === undefined) {
|
||||
previousValue = currentProperties;
|
||||
} else {
|
||||
previousValue = callback(previousValue, currentProperties, currentIndex);
|
||||
}
|
||||
});
|
||||
return previousValue;
|
||||
}
|
||||
module.exports.propReduce = propReduce;
|
||||
|
||||
/**
|
||||
* Callback for featureEach
|
||||
*
|
||||
* @private
|
||||
* @callback featureEachCallback
|
||||
* @param {Feature<any>} currentFeature The current feature being processed.
|
||||
* @param {number} currentIndex The index of the current element being processed in the
|
||||
* array.Starts at index 0, if an initialValue is provided, and at index 1 otherwise.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Iterate over features in any GeoJSON object, similar to
|
||||
* Array.forEach.
|
||||
*
|
||||
* @name featureEach
|
||||
* @param {Object} layer any GeoJSON object
|
||||
* @param {Function} callback a method that takes (currentFeature, currentIndex)
|
||||
* @example
|
||||
* var features = {
|
||||
* "type": "FeatureCollection",
|
||||
* "features": [
|
||||
* {
|
||||
* "type": "Feature",
|
||||
* "properties": {},
|
||||
* "geometry": {
|
||||
* "type": "Point",
|
||||
* "coordinates": [26, 37]
|
||||
* }
|
||||
* },
|
||||
* {
|
||||
* "type": "Feature",
|
||||
* "properties": {},
|
||||
* "geometry": {
|
||||
* "type": "Point",
|
||||
* "coordinates": [36, 53]
|
||||
* }
|
||||
* }
|
||||
* ]
|
||||
* };
|
||||
* turf.featureEach(features, function (currentFeature, currentIndex) {
|
||||
* //=currentFeature
|
||||
* //=currentIndex
|
||||
* });
|
||||
*/
|
||||
function featureEach(layer, callback) {
|
||||
if (layer.type === 'Feature') {
|
||||
callback(layer, 0);
|
||||
} else if (layer.type === 'FeatureCollection') {
|
||||
for (var i = 0; i < layer.features.length; i++) {
|
||||
callback(layer.features[i], i);
|
||||
}
|
||||
}
|
||||
}
|
||||
module.exports.featureEach = featureEach;
|
||||
|
||||
/**
|
||||
* Callback for featureReduce
|
||||
*
|
||||
* The first time the callback function is called, the values provided as arguments depend
|
||||
* on whether the reduce method has an initialValue argument.
|
||||
*
|
||||
* If an initialValue is provided to the reduce method:
|
||||
* - The previousValue argument is initialValue.
|
||||
* - The currentValue argument is the value of the first element present in the array.
|
||||
*
|
||||
* If an initialValue is not provided:
|
||||
* - The previousValue argument is the value of the first element present in the array.
|
||||
* - The currentValue argument is the value of the second element present in the array.
|
||||
*
|
||||
* @private
|
||||
* @callback featureReduceCallback
|
||||
* @param {*} previousValue The accumulated value previously returned in the last invocation
|
||||
* of the callback, or initialValue, if supplied.
|
||||
* @param {Feature<any>} currentFeature The current Feature being processed.
|
||||
* @param {number} currentIndex The index of the current element being processed in the
|
||||
* array.Starts at index 0, if an initialValue is provided, and at index 1 otherwise.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Reduce features in any GeoJSON object, similar to Array.reduce().
|
||||
*
|
||||
* @name featureReduce
|
||||
* @param {Object} layer any GeoJSON object
|
||||
* @param {Function} callback a method that takes (previousValue, currentFeature, currentIndex)
|
||||
* @param {*} [initialValue] Value to use as the first argument to the first call of the callback.
|
||||
* @returns {*} The value that results from the reduction.
|
||||
* @example
|
||||
* var features = {
|
||||
* "type": "FeatureCollection",
|
||||
* "features": [
|
||||
* {
|
||||
* "type": "Feature",
|
||||
* "properties": {"foo": "bar"},
|
||||
* "geometry": {
|
||||
* "type": "Point",
|
||||
* "coordinates": [26, 37]
|
||||
* }
|
||||
* },
|
||||
* {
|
||||
* "type": "Feature",
|
||||
* "properties": {"hello": "world"},
|
||||
* "geometry": {
|
||||
* "type": "Point",
|
||||
* "coordinates": [36, 53]
|
||||
* }
|
||||
* }
|
||||
* ]
|
||||
* };
|
||||
* turf.featureReduce(features, function (previousValue, currentFeature, currentIndex) {
|
||||
* //=previousValue
|
||||
* //=currentFeature
|
||||
* //=currentIndex
|
||||
* return currentFeature
|
||||
* });
|
||||
*/
|
||||
function featureReduce(layer, callback, initialValue) {
|
||||
var previousValue = initialValue;
|
||||
featureEach(layer, function (currentFeature, currentIndex) {
|
||||
if (currentIndex === 0 && initialValue === undefined) {
|
||||
previousValue = currentFeature;
|
||||
} else {
|
||||
previousValue = callback(previousValue, currentFeature, currentIndex);
|
||||
}
|
||||
});
|
||||
return previousValue;
|
||||
}
|
||||
module.exports.featureReduce = featureReduce;
|
||||
|
||||
/**
|
||||
* Get all coordinates from any GeoJSON object.
|
||||
*
|
||||
* @name coordAll
|
||||
* @param {Object} layer any GeoJSON object
|
||||
* @returns {Array<Array<number>>} coordinate position array
|
||||
* @example
|
||||
* var features = {
|
||||
* "type": "FeatureCollection",
|
||||
* "features": [
|
||||
* {
|
||||
* "type": "Feature",
|
||||
* "properties": {},
|
||||
* "geometry": {
|
||||
* "type": "Point",
|
||||
* "coordinates": [26, 37]
|
||||
* }
|
||||
* },
|
||||
* {
|
||||
* "type": "Feature",
|
||||
* "properties": {},
|
||||
* "geometry": {
|
||||
* "type": "Point",
|
||||
* "coordinates": [36, 53]
|
||||
* }
|
||||
* }
|
||||
* ]
|
||||
* };
|
||||
* var coords = turf.coordAll(features);
|
||||
* //=coords
|
||||
*/
|
||||
function coordAll(layer) {
|
||||
var coords = [];
|
||||
coordEach(layer, function (coord) {
|
||||
coords.push(coord);
|
||||
});
|
||||
return coords;
|
||||
}
|
||||
module.exports.coordAll = coordAll;
|
||||
|
||||
/**
|
||||
* Iterate over each geometry in any GeoJSON object, similar to Array.forEach()
|
||||
*
|
||||
* @name geomEach
|
||||
* @param {Object} layer any GeoJSON object
|
||||
* @param {Function} callback a method that takes (currentGeometry, currentIndex)
|
||||
* @example
|
||||
* var features = {
|
||||
* "type": "FeatureCollection",
|
||||
* "features": [
|
||||
* {
|
||||
* "type": "Feature",
|
||||
* "properties": {},
|
||||
* "geometry": {
|
||||
* "type": "Point",
|
||||
* "coordinates": [26, 37]
|
||||
* }
|
||||
* },
|
||||
* {
|
||||
* "type": "Feature",
|
||||
* "properties": {},
|
||||
* "geometry": {
|
||||
* "type": "Point",
|
||||
* "coordinates": [36, 53]
|
||||
* }
|
||||
* }
|
||||
* ]
|
||||
* };
|
||||
* turf.geomEach(features, function (currentGeometry, currentIndex) {
|
||||
* //=currentGeometry
|
||||
* //=currentIndex
|
||||
* });
|
||||
*/
|
||||
function geomEach(layer, callback) {
|
||||
var i, j, g, geometry, stopG,
|
||||
geometryMaybeCollection,
|
||||
isGeometryCollection,
|
||||
currentIndex = 0,
|
||||
isFeatureCollection = layer.type === 'FeatureCollection',
|
||||
isFeature = layer.type === 'Feature',
|
||||
stop = isFeatureCollection ? layer.features.length : 1;
|
||||
|
||||
// This logic may look a little weird. The reason why it is that way
|
||||
// is because it's trying to be fast. GeoJSON supports multiple kinds
|
||||
// of objects at its root: FeatureCollection, Features, Geometries.
|
||||
// This function has the responsibility of handling all of them, and that
|
||||
// means that some of the `for` loops you see below actually just don't apply
|
||||
// to certain inputs. For instance, if you give this just a
|
||||
// Point geometry, then both loops are short-circuited and all we do
|
||||
// is gradually rename the input until it's called 'geometry'.
|
||||
//
|
||||
// This also aims to allocate as few resources as possible: just a
|
||||
// few numbers and booleans, rather than any temporary arrays as would
|
||||
// be required with the normalization approach.
|
||||
for (i = 0; i < stop; i++) {
|
||||
|
||||
geometryMaybeCollection = (isFeatureCollection ? layer.features[i].geometry :
|
||||
(isFeature ? layer.geometry : layer));
|
||||
isGeometryCollection = geometryMaybeCollection.type === 'GeometryCollection';
|
||||
stopG = isGeometryCollection ? geometryMaybeCollection.geometries.length : 1;
|
||||
|
||||
for (g = 0; g < stopG; g++) {
|
||||
geometry = isGeometryCollection ?
|
||||
geometryMaybeCollection.geometries[g] : geometryMaybeCollection;
|
||||
|
||||
if (geometry.type === 'Point' ||
|
||||
geometry.type === 'LineString' ||
|
||||
geometry.type === 'MultiPoint' ||
|
||||
geometry.type === 'Polygon' ||
|
||||
geometry.type === 'MultiLineString' ||
|
||||
geometry.type === 'MultiPolygon') {
|
||||
callback(geometry, currentIndex);
|
||||
currentIndex++;
|
||||
} else if (geometry.type === 'GeometryCollection') {
|
||||
for (j = 0; j < geometry.geometries.length; j++) {
|
||||
callback(geometry.geometries[j], currentIndex);
|
||||
currentIndex++;
|
||||
}
|
||||
} else {
|
||||
throw new Error('Unknown Geometry Type');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
module.exports.geomEach = geomEach;
|
||||
|
||||
/**
|
||||
* Callback for geomReduce
|
||||
*
|
||||
* The first time the callback function is called, the values provided as arguments depend
|
||||
* on whether the reduce method has an initialValue argument.
|
||||
*
|
||||
* If an initialValue is provided to the reduce method:
|
||||
* - The previousValue argument is initialValue.
|
||||
* - The currentValue argument is the value of the first element present in the array.
|
||||
*
|
||||
* If an initialValue is not provided:
|
||||
* - The previousValue argument is the value of the first element present in the array.
|
||||
* - The currentValue argument is the value of the second element present in the array.
|
||||
*
|
||||
* @private
|
||||
* @callback geomReduceCallback
|
||||
* @param {*} previousValue The accumulated value previously returned in the last invocation
|
||||
* of the callback, or initialValue, if supplied.
|
||||
* @param {*} currentGeometry The current Feature being processed.
|
||||
* @param {number} currentIndex The index of the current element being processed in the
|
||||
* array.Starts at index 0, if an initialValue is provided, and at index 1 otherwise.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Reduce geometry in any GeoJSON object, similar to Array.reduce().
|
||||
*
|
||||
* @name geomReduce
|
||||
* @param {Object} layer any GeoJSON object
|
||||
* @param {Function} callback a method that takes (previousValue, currentGeometry, currentIndex)
|
||||
* @param {*} [initialValue] Value to use as the first argument to the first call of the callback.
|
||||
* @returns {*} The value that results from the reduction.
|
||||
* @example
|
||||
* var features = {
|
||||
* "type": "FeatureCollection",
|
||||
* "features": [
|
||||
* {
|
||||
* "type": "Feature",
|
||||
* "properties": {"foo": "bar"},
|
||||
* "geometry": {
|
||||
* "type": "Point",
|
||||
* "coordinates": [26, 37]
|
||||
* }
|
||||
* },
|
||||
* {
|
||||
* "type": "Feature",
|
||||
* "properties": {"hello": "world"},
|
||||
* "geometry": {
|
||||
* "type": "Point",
|
||||
* "coordinates": [36, 53]
|
||||
* }
|
||||
* }
|
||||
* ]
|
||||
* };
|
||||
* turf.geomReduce(features, function (previousValue, currentGeometry, currentIndex) {
|
||||
* //=previousValue
|
||||
* //=currentGeometry
|
||||
* //=currentIndex
|
||||
* return currentGeometry
|
||||
* });
|
||||
*/
|
||||
function geomReduce(layer, callback, initialValue) {
|
||||
var previousValue = initialValue;
|
||||
geomEach(layer, function (currentGeometry, currentIndex) {
|
||||
if (currentIndex === 0 && initialValue === undefined) {
|
||||
previousValue = currentGeometry;
|
||||
} else {
|
||||
previousValue = callback(previousValue, currentGeometry, currentIndex);
|
||||
}
|
||||
});
|
||||
return previousValue;
|
||||
}
|
||||
module.exports.geomReduce = geomReduce;
|
||||
67
immoweb/node_modules/@turf/meta/package.json
generated
vendored
Normal file
67
immoweb/node_modules/@turf/meta/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
{
|
||||
"_from": "@turf/meta@^3.14.0",
|
||||
"_id": "@turf/meta@3.14.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-jTBQwaD0S/QGpjO2vSjFEPe87ic=",
|
||||
"_location": "/@turf/meta",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "@turf/meta@^3.14.0",
|
||||
"name": "@turf/meta",
|
||||
"escapedName": "@turf%2fmeta",
|
||||
"scope": "@turf",
|
||||
"rawSpec": "^3.14.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^3.14.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@turf/bbox"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@turf/meta/-/meta-3.14.0.tgz",
|
||||
"_shasum": "8d3050c1a0f44bf406a633b6bd28c510f7bcee27",
|
||||
"_spec": "@turf/meta@^3.14.0",
|
||||
"_where": "/home/kadir/workspace/webimmo/node_modules/@turf/bbox",
|
||||
"author": {
|
||||
"name": "Turf Authors"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/Turfjs/turf/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {},
|
||||
"deprecated": false,
|
||||
"description": "turf meta module",
|
||||
"devDependencies": {
|
||||
"@turf/helpers": "^3.13.0",
|
||||
"@turf/random": "^3.14.0",
|
||||
"benchmark": "^2.1.3",
|
||||
"eslint": "^3.14.1",
|
||||
"eslint-config-mourner": "^2.0.1",
|
||||
"tape": "^3.4.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"homepage": "https://github.com/Turfjs/turf",
|
||||
"keywords": [
|
||||
"functional",
|
||||
"programming",
|
||||
"turfjs"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "@turf/meta",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/Turfjs/turf.git"
|
||||
},
|
||||
"scripts": {
|
||||
"bench": "node bench.js",
|
||||
"test": "node test.js"
|
||||
},
|
||||
"types": "index.d.ts",
|
||||
"version": "3.14.0"
|
||||
}
|
||||
3
immoweb/node_modules/crossfilter/.npmignore
generated
vendored
Normal file
3
immoweb/node_modules/crossfilter/.npmignore
generated
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
test/
|
||||
lib/
|
||||
.DS_Store
|
||||
3
immoweb/node_modules/crossfilter/.travis.yml
generated
vendored
Normal file
3
immoweb/node_modules/crossfilter/.travis.yml
generated
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
language: node_js
|
||||
node_js:
|
||||
- 0.8
|
||||
23
immoweb/node_modules/crossfilter/CONTRIBUTING.md
generated
vendored
Normal file
23
immoweb/node_modules/crossfilter/CONTRIBUTING.md
generated
vendored
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
## Contributing To Crossfilter
|
||||
|
||||
### Individual Contributor License Agreement
|
||||
|
||||
Want to add support for a new backend or visualization? We'd love for you to participate in the development of Crossfilter. Before we can accept your pull request, please sign our [Individual Contributor License Agreement][1]. It's a short form that covers our bases and makes sure you're eligible to contribute. Thank you!
|
||||
|
||||
[1]: https://spreadsheets.google.com/spreadsheet/viewform?formkey=dDViT2xzUHAwRkI3X3k5Z0lQM091OGc6MQ&ndplr=1
|
||||
|
||||
### Getting Help
|
||||
|
||||
Full API documentation is kept [in the wiki][2]. If you have a question or need help using Crossfilter, please ask on Stackoverflow using the [crossfilter tag][3]. Feel free to file bug reports and other suggestions in the [github issue tracker][4].
|
||||
|
||||
[2]: https://github.com/square/crossfilter/wiki
|
||||
[3]: http://stackoverflow.com/questions/tagged/crossfilter
|
||||
[4]: https://github.com/square/crossfilter/issues
|
||||
|
||||
### License
|
||||
|
||||
Crossfilter is available under the [Apache License][5].
|
||||
|
||||
[5]: https://github.com/square/crossfilter/blob/master/LICENSE
|
||||
|
||||
|
||||
12
immoweb/node_modules/crossfilter/LICENSE
generated
vendored
Normal file
12
immoweb/node_modules/crossfilter/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
Copyright 2012 Square, Inc.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||||
this file except in compliance with the License. You may obtain a copy of the
|
||||
License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software distributed
|
||||
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
||||
CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations under the License.
|
||||
41
immoweb/node_modules/crossfilter/Makefile
generated
vendored
Normal file
41
immoweb/node_modules/crossfilter/Makefile
generated
vendored
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
.PHONY: test benchmark
|
||||
|
||||
all: crossfilter.min.js
|
||||
|
||||
crossfilter.js: \
|
||||
src/identity.js \
|
||||
src/permute.js \
|
||||
src/bisect.js \
|
||||
src/heap.js \
|
||||
src/heapselect.js \
|
||||
src/insertionsort.js \
|
||||
src/quicksort.js \
|
||||
src/array.js \
|
||||
src/filter.js \
|
||||
src/null.js \
|
||||
src/zero.js \
|
||||
src/reduce.js \
|
||||
src/crossfilter.js \
|
||||
package.json \
|
||||
Makefile
|
||||
|
||||
%.min.js: %.js Makefile
|
||||
@rm -f $@
|
||||
node_modules/.bin/uglifyjs $< -c unsafe=true -m -o $@
|
||||
|
||||
%.js:
|
||||
@rm -f $@
|
||||
@echo '(function(exports){' > $@
|
||||
@echo 'crossfilter.version = "'$(shell node -p 'require("./package.json").version')'";' >> $@
|
||||
cat $(filter %.js,$^) >> $@
|
||||
@echo '})(typeof exports !== '\'undefined\'' && exports || this);' >> $@
|
||||
@chmod a-w $@
|
||||
|
||||
clean:
|
||||
rm -f crossfilter.js crossfilter.min.js
|
||||
|
||||
test: all
|
||||
@npm test
|
||||
|
||||
benchmark: all
|
||||
@node test/benchmark.js
|
||||
7
immoweb/node_modules/crossfilter/README.md
generated
vendored
Normal file
7
immoweb/node_modules/crossfilter/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
# Crossfilter
|
||||
|
||||
**Crossfilter** is a JavaScript library for exploring large multivariate datasets in the browser. Crossfilter supports extremely fast (<30ms) interaction with coordinated views, even with datasets containing a million or more records; we built it to power analytics for Square Register, allowing merchants to slice and dice their payment history fluidly.
|
||||
|
||||
Since most interactions only involve a single dimension, and then only small adjustments are made to the filter values, incremental filtering and reducing is significantly faster than starting from scratch. Crossfilter uses sorted indexes (and a few bit-twiddling hacks) to make this possible, dramatically increasing the performance of live histograms and top-K lists. Crossfilter is available under the [Apache License](/square/crossfilter/blob/master/LICENSE).
|
||||
|
||||
Want to learn more? [See the wiki.](https://github.com/square/crossfilter/wiki)
|
||||
14
immoweb/node_modules/crossfilter/component.json
generated
vendored
Normal file
14
immoweb/node_modules/crossfilter/component.json
generated
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"name": "crossfilter",
|
||||
"repo": "square/crossfilter",
|
||||
"description": "Fast n-dimensional filtering and grouping of records.",
|
||||
"version": "1.3.11",
|
||||
"keywords": [],
|
||||
"main": "crossfilter.js",
|
||||
"scripts": [
|
||||
"crossfilter.js"
|
||||
],
|
||||
"dependencies": {},
|
||||
"development": {},
|
||||
"license": "Apache"
|
||||
}
|
||||
1401
immoweb/node_modules/crossfilter/crossfilter.js
generated
vendored
Normal file
1401
immoweb/node_modules/crossfilter/crossfilter.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
1
immoweb/node_modules/crossfilter/crossfilter.min.js
generated
vendored
Normal file
1
immoweb/node_modules/crossfilter/crossfilter.min.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
immoweb/node_modules/crossfilter/index.js
generated
vendored
Normal file
1
immoweb/node_modules/crossfilter/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
module.exports = require("./crossfilter").crossfilter;
|
||||
69
immoweb/node_modules/crossfilter/package.json
generated
vendored
Normal file
69
immoweb/node_modules/crossfilter/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
{
|
||||
"_from": "crossfilter",
|
||||
"_id": "crossfilter@1.3.12",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-FH1yNqmMRcafeL3DqZ1vsA9wkww=",
|
||||
"_location": "/crossfilter",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "tag",
|
||||
"registry": true,
|
||||
"raw": "crossfilter",
|
||||
"name": "crossfilter",
|
||||
"escapedName": "crossfilter",
|
||||
"rawSpec": "",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "latest"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"#USER",
|
||||
"/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/crossfilter/-/crossfilter-1.3.12.tgz",
|
||||
"_shasum": "147d7236a98c45c69f78bdc3a99d6fb00f70930c",
|
||||
"_spec": "crossfilter",
|
||||
"_where": "/home/kadir/workspace/webimmo",
|
||||
"author": {
|
||||
"name": "Mike Bostock",
|
||||
"url": "http://bost.ocks.org/mike"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/square/crossfilter/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Jason Davies",
|
||||
"url": "http://www.jasondavies.com/"
|
||||
}
|
||||
],
|
||||
"deprecated": false,
|
||||
"description": "Fast multidimensional filtering for coordinated views.",
|
||||
"devDependencies": {
|
||||
"d3": "3",
|
||||
"uglify-js": "2.4.0",
|
||||
"vows": "0.7.0"
|
||||
},
|
||||
"homepage": "http://square.github.com/crossfilter/",
|
||||
"keywords": [
|
||||
"square",
|
||||
"analytics",
|
||||
"visualization"
|
||||
],
|
||||
"main": "./index.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "Tom Carden",
|
||||
"url": "http://github.com/RandomEtc"
|
||||
}
|
||||
],
|
||||
"name": "crossfilter",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+ssh://git@github.com/square/crossfilter.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "vows"
|
||||
},
|
||||
"version": "1.3.12"
|
||||
}
|
||||
46
immoweb/node_modules/crossfilter/src/array.js
generated
vendored
Normal file
46
immoweb/node_modules/crossfilter/src/array.js
generated
vendored
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
var crossfilter_array8 = crossfilter_arrayUntyped,
|
||||
crossfilter_array16 = crossfilter_arrayUntyped,
|
||||
crossfilter_array32 = crossfilter_arrayUntyped,
|
||||
crossfilter_arrayLengthen = crossfilter_arrayLengthenUntyped,
|
||||
crossfilter_arrayWiden = crossfilter_arrayWidenUntyped;
|
||||
|
||||
if (typeof Uint8Array !== "undefined") {
|
||||
crossfilter_array8 = function(n) { return new Uint8Array(n); };
|
||||
crossfilter_array16 = function(n) { return new Uint16Array(n); };
|
||||
crossfilter_array32 = function(n) { return new Uint32Array(n); };
|
||||
|
||||
crossfilter_arrayLengthen = function(array, length) {
|
||||
if (array.length >= length) return array;
|
||||
var copy = new array.constructor(length);
|
||||
copy.set(array);
|
||||
return copy;
|
||||
};
|
||||
|
||||
crossfilter_arrayWiden = function(array, width) {
|
||||
var copy;
|
||||
switch (width) {
|
||||
case 16: copy = crossfilter_array16(array.length); break;
|
||||
case 32: copy = crossfilter_array32(array.length); break;
|
||||
default: throw new Error("invalid array width!");
|
||||
}
|
||||
copy.set(array);
|
||||
return copy;
|
||||
};
|
||||
}
|
||||
|
||||
function crossfilter_arrayUntyped(n) {
|
||||
var array = new Array(n), i = -1;
|
||||
while (++i < n) array[i] = 0;
|
||||
return array;
|
||||
}
|
||||
|
||||
function crossfilter_arrayLengthenUntyped(array, length) {
|
||||
var n = array.length;
|
||||
while (n < length) array[n++] = 0;
|
||||
return array;
|
||||
}
|
||||
|
||||
function crossfilter_arrayWidenUntyped(array, width) {
|
||||
if (width > 32) throw new Error("invalid array width!");
|
||||
return array;
|
||||
}
|
||||
44
immoweb/node_modules/crossfilter/src/bisect.js
generated
vendored
Normal file
44
immoweb/node_modules/crossfilter/src/bisect.js
generated
vendored
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
var bisect = crossfilter.bisect = bisect_by(crossfilter_identity);
|
||||
|
||||
bisect.by = bisect_by;
|
||||
|
||||
function bisect_by(f) {
|
||||
|
||||
// Locate the insertion point for x in a to maintain sorted order. The
|
||||
// arguments lo and hi may be used to specify a subset of the array which
|
||||
// should be considered; by default the entire array is used. If x is already
|
||||
// present in a, the insertion point will be before (to the left of) any
|
||||
// existing entries. The return value is suitable for use as the first
|
||||
// argument to `array.splice` assuming that a is already sorted.
|
||||
//
|
||||
// The returned insertion point i partitions the array a into two halves so
|
||||
// that all v < x for v in a[lo:i] for the left side and all v >= x for v in
|
||||
// a[i:hi] for the right side.
|
||||
function bisectLeft(a, x, lo, hi) {
|
||||
while (lo < hi) {
|
||||
var mid = lo + hi >>> 1;
|
||||
if (f(a[mid]) < x) lo = mid + 1;
|
||||
else hi = mid;
|
||||
}
|
||||
return lo;
|
||||
}
|
||||
|
||||
// Similar to bisectLeft, but returns an insertion point which comes after (to
|
||||
// the right of) any existing entries of x in a.
|
||||
//
|
||||
// The returned insertion point i partitions the array into two halves so that
|
||||
// all v <= x for v in a[lo:i] for the left side and all v > x for v in
|
||||
// a[i:hi] for the right side.
|
||||
function bisectRight(a, x, lo, hi) {
|
||||
while (lo < hi) {
|
||||
var mid = lo + hi >>> 1;
|
||||
if (x < f(a[mid])) hi = mid;
|
||||
else lo = mid + 1;
|
||||
}
|
||||
return lo;
|
||||
}
|
||||
|
||||
bisectRight.right = bisectRight;
|
||||
bisectRight.left = bisectLeft;
|
||||
return bisectRight;
|
||||
}
|
||||
872
immoweb/node_modules/crossfilter/src/crossfilter.js
generated
vendored
Normal file
872
immoweb/node_modules/crossfilter/src/crossfilter.js
generated
vendored
Normal file
|
|
@ -0,0 +1,872 @@
|
|||
exports.crossfilter = crossfilter;
|
||||
|
||||
function crossfilter() {
|
||||
var crossfilter = {
|
||||
add: add,
|
||||
remove: removeData,
|
||||
dimension: dimension,
|
||||
groupAll: groupAll,
|
||||
size: size
|
||||
};
|
||||
|
||||
var data = [], // the records
|
||||
n = 0, // the number of records; data.length
|
||||
m = 0, // a bit mask representing which dimensions are in use
|
||||
M = 8, // number of dimensions that can fit in `filters`
|
||||
filters = crossfilter_array8(0), // M bits per record; 1 is filtered out
|
||||
filterListeners = [], // when the filters change
|
||||
dataListeners = [], // when data is added
|
||||
removeDataListeners = []; // when data is removed
|
||||
|
||||
// Adds the specified new records to this crossfilter.
|
||||
function add(newData) {
|
||||
var n0 = n,
|
||||
n1 = newData.length;
|
||||
|
||||
// If there's actually new data to add…
|
||||
// Merge the new data into the existing data.
|
||||
// Lengthen the filter bitset to handle the new records.
|
||||
// Notify listeners (dimensions and groups) that new data is available.
|
||||
if (n1) {
|
||||
data = data.concat(newData);
|
||||
filters = crossfilter_arrayLengthen(filters, n += n1);
|
||||
dataListeners.forEach(function(l) { l(newData, n0, n1); });
|
||||
}
|
||||
|
||||
return crossfilter;
|
||||
}
|
||||
|
||||
// Removes all records that match the current filters.
|
||||
function removeData() {
|
||||
var newIndex = crossfilter_index(n, n),
|
||||
removed = [];
|
||||
for (var i = 0, j = 0; i < n; ++i) {
|
||||
if (filters[i]) newIndex[i] = j++;
|
||||
else removed.push(i);
|
||||
}
|
||||
|
||||
// Remove all matching records from groups.
|
||||
filterListeners.forEach(function(l) { l(0, [], removed); });
|
||||
|
||||
// Update indexes.
|
||||
removeDataListeners.forEach(function(l) { l(newIndex); });
|
||||
|
||||
// Remove old filters and data by overwriting.
|
||||
for (var i = 0, j = 0, k; i < n; ++i) {
|
||||
if (k = filters[i]) {
|
||||
if (i !== j) filters[j] = k, data[j] = data[i];
|
||||
++j;
|
||||
}
|
||||
}
|
||||
data.length = j;
|
||||
while (n > j) filters[--n] = 0;
|
||||
}
|
||||
|
||||
// Adds a new dimension with the specified value accessor function.
|
||||
function dimension(value) {
|
||||
var dimension = {
|
||||
filter: filter,
|
||||
filterExact: filterExact,
|
||||
filterRange: filterRange,
|
||||
filterFunction: filterFunction,
|
||||
filterAll: filterAll,
|
||||
top: top,
|
||||
bottom: bottom,
|
||||
group: group,
|
||||
groupAll: groupAll,
|
||||
dispose: dispose,
|
||||
remove: dispose // for backwards-compatibility
|
||||
};
|
||||
|
||||
var one = ~m & -~m, // lowest unset bit as mask, e.g., 00001000
|
||||
zero = ~one, // inverted one, e.g., 11110111
|
||||
values, // sorted, cached array
|
||||
index, // value rank ↦ object id
|
||||
newValues, // temporary array storing newly-added values
|
||||
newIndex, // temporary array storing newly-added index
|
||||
sort = quicksort_by(function(i) { return newValues[i]; }),
|
||||
refilter = crossfilter_filterAll, // for recomputing filter
|
||||
refilterFunction, // the custom filter function in use
|
||||
indexListeners = [], // when data is added
|
||||
dimensionGroups = [],
|
||||
lo0 = 0,
|
||||
hi0 = 0;
|
||||
|
||||
// Updating a dimension is a two-stage process. First, we must update the
|
||||
// associated filters for the newly-added records. Once all dimensions have
|
||||
// updated their filters, the groups are notified to update.
|
||||
dataListeners.unshift(preAdd);
|
||||
dataListeners.push(postAdd);
|
||||
|
||||
removeDataListeners.push(removeData);
|
||||
|
||||
// Incorporate any existing data into this dimension, and make sure that the
|
||||
// filter bitset is wide enough to handle the new dimension.
|
||||
m |= one;
|
||||
if (M >= 32 ? !one : m & -(1 << M)) {
|
||||
filters = crossfilter_arrayWiden(filters, M <<= 1);
|
||||
}
|
||||
preAdd(data, 0, n);
|
||||
postAdd(data, 0, n);
|
||||
|
||||
// Incorporates the specified new records into this dimension.
|
||||
// This function is responsible for updating filters, values, and index.
|
||||
function preAdd(newData, n0, n1) {
|
||||
|
||||
// Permute new values into natural order using a sorted index.
|
||||
newValues = newData.map(value);
|
||||
newIndex = sort(crossfilter_range(n1), 0, n1);
|
||||
newValues = permute(newValues, newIndex);
|
||||
|
||||
// Bisect newValues to determine which new records are selected.
|
||||
var bounds = refilter(newValues), lo1 = bounds[0], hi1 = bounds[1], i;
|
||||
if (refilterFunction) {
|
||||
for (i = 0; i < n1; ++i) {
|
||||
if (!refilterFunction(newValues[i], i)) filters[newIndex[i] + n0] |= one;
|
||||
}
|
||||
} else {
|
||||
for (i = 0; i < lo1; ++i) filters[newIndex[i] + n0] |= one;
|
||||
for (i = hi1; i < n1; ++i) filters[newIndex[i] + n0] |= one;
|
||||
}
|
||||
|
||||
// If this dimension previously had no data, then we don't need to do the
|
||||
// more expensive merge operation; use the new values and index as-is.
|
||||
if (!n0) {
|
||||
values = newValues;
|
||||
index = newIndex;
|
||||
lo0 = lo1;
|
||||
hi0 = hi1;
|
||||
return;
|
||||
}
|
||||
|
||||
var oldValues = values,
|
||||
oldIndex = index,
|
||||
i0 = 0,
|
||||
i1 = 0;
|
||||
|
||||
// Otherwise, create new arrays into which to merge new and old.
|
||||
values = new Array(n);
|
||||
index = crossfilter_index(n, n);
|
||||
|
||||
// Merge the old and new sorted values, and old and new index.
|
||||
for (i = 0; i0 < n0 && i1 < n1; ++i) {
|
||||
if (oldValues[i0] < newValues[i1]) {
|
||||
values[i] = oldValues[i0];
|
||||
index[i] = oldIndex[i0++];
|
||||
} else {
|
||||
values[i] = newValues[i1];
|
||||
index[i] = newIndex[i1++] + n0;
|
||||
}
|
||||
}
|
||||
|
||||
// Add any remaining old values.
|
||||
for (; i0 < n0; ++i0, ++i) {
|
||||
values[i] = oldValues[i0];
|
||||
index[i] = oldIndex[i0];
|
||||
}
|
||||
|
||||
// Add any remaining new values.
|
||||
for (; i1 < n1; ++i1, ++i) {
|
||||
values[i] = newValues[i1];
|
||||
index[i] = newIndex[i1] + n0;
|
||||
}
|
||||
|
||||
// Bisect again to recompute lo0 and hi0.
|
||||
bounds = refilter(values), lo0 = bounds[0], hi0 = bounds[1];
|
||||
}
|
||||
|
||||
// When all filters have updated, notify index listeners of the new values.
|
||||
function postAdd(newData, n0, n1) {
|
||||
indexListeners.forEach(function(l) { l(newValues, newIndex, n0, n1); });
|
||||
newValues = newIndex = null;
|
||||
}
|
||||
|
||||
function removeData(reIndex) {
|
||||
for (var i = 0, j = 0, k; i < n; ++i) {
|
||||
if (filters[k = index[i]]) {
|
||||
if (i !== j) values[j] = values[i];
|
||||
index[j] = reIndex[k];
|
||||
++j;
|
||||
}
|
||||
}
|
||||
values.length = j;
|
||||
while (j < n) index[j++] = 0;
|
||||
|
||||
// Bisect again to recompute lo0 and hi0.
|
||||
var bounds = refilter(values);
|
||||
lo0 = bounds[0], hi0 = bounds[1];
|
||||
}
|
||||
|
||||
// Updates the selected values based on the specified bounds [lo, hi].
|
||||
// This implementation is used by all the public filter methods.
|
||||
function filterIndexBounds(bounds) {
|
||||
var lo1 = bounds[0],
|
||||
hi1 = bounds[1];
|
||||
|
||||
if (refilterFunction) {
|
||||
refilterFunction = null;
|
||||
filterIndexFunction(function(d, i) { return lo1 <= i && i < hi1; });
|
||||
lo0 = lo1;
|
||||
hi0 = hi1;
|
||||
return dimension;
|
||||
}
|
||||
|
||||
var i,
|
||||
j,
|
||||
k,
|
||||
added = [],
|
||||
removed = [];
|
||||
|
||||
// Fast incremental update based on previous lo index.
|
||||
if (lo1 < lo0) {
|
||||
for (i = lo1, j = Math.min(lo0, hi1); i < j; ++i) {
|
||||
filters[k = index[i]] ^= one;
|
||||
added.push(k);
|
||||
}
|
||||
} else if (lo1 > lo0) {
|
||||
for (i = lo0, j = Math.min(lo1, hi0); i < j; ++i) {
|
||||
filters[k = index[i]] ^= one;
|
||||
removed.push(k);
|
||||
}
|
||||
}
|
||||
|
||||
// Fast incremental update based on previous hi index.
|
||||
if (hi1 > hi0) {
|
||||
for (i = Math.max(lo1, hi0), j = hi1; i < j; ++i) {
|
||||
filters[k = index[i]] ^= one;
|
||||
added.push(k);
|
||||
}
|
||||
} else if (hi1 < hi0) {
|
||||
for (i = Math.max(lo0, hi1), j = hi0; i < j; ++i) {
|
||||
filters[k = index[i]] ^= one;
|
||||
removed.push(k);
|
||||
}
|
||||
}
|
||||
|
||||
lo0 = lo1;
|
||||
hi0 = hi1;
|
||||
filterListeners.forEach(function(l) { l(one, added, removed); });
|
||||
return dimension;
|
||||
}
|
||||
|
||||
// Filters this dimension using the specified range, value, or null.
|
||||
// If the range is null, this is equivalent to filterAll.
|
||||
// If the range is an array, this is equivalent to filterRange.
|
||||
// Otherwise, this is equivalent to filterExact.
|
||||
function filter(range) {
|
||||
return range == null
|
||||
? filterAll() : Array.isArray(range)
|
||||
? filterRange(range) : typeof range === "function"
|
||||
? filterFunction(range)
|
||||
: filterExact(range);
|
||||
}
|
||||
|
||||
// Filters this dimension to select the exact value.
|
||||
function filterExact(value) {
|
||||
return filterIndexBounds((refilter = crossfilter_filterExact(bisect, value))(values));
|
||||
}
|
||||
|
||||
// Filters this dimension to select the specified range [lo, hi].
|
||||
// The lower bound is inclusive, and the upper bound is exclusive.
|
||||
function filterRange(range) {
|
||||
return filterIndexBounds((refilter = crossfilter_filterRange(bisect, range))(values));
|
||||
}
|
||||
|
||||
// Clears any filters on this dimension.
|
||||
function filterAll() {
|
||||
return filterIndexBounds((refilter = crossfilter_filterAll)(values));
|
||||
}
|
||||
|
||||
// Filters this dimension using an arbitrary function.
|
||||
function filterFunction(f) {
|
||||
refilter = crossfilter_filterAll;
|
||||
|
||||
filterIndexFunction(refilterFunction = f);
|
||||
|
||||
lo0 = 0;
|
||||
hi0 = n;
|
||||
|
||||
return dimension;
|
||||
}
|
||||
|
||||
function filterIndexFunction(f) {
|
||||
var i,
|
||||
k,
|
||||
x,
|
||||
added = [],
|
||||
removed = [];
|
||||
|
||||
for (i = 0; i < n; ++i) {
|
||||
if (!(filters[k = index[i]] & one) ^ !!(x = f(values[i], i))) {
|
||||
if (x) filters[k] &= zero, added.push(k);
|
||||
else filters[k] |= one, removed.push(k);
|
||||
}
|
||||
}
|
||||
filterListeners.forEach(function(l) { l(one, added, removed); });
|
||||
}
|
||||
|
||||
// Returns the top K selected records based on this dimension's order.
|
||||
// Note: observes this dimension's filter, unlike group and groupAll.
|
||||
function top(k) {
|
||||
var array = [],
|
||||
i = hi0,
|
||||
j;
|
||||
|
||||
while (--i >= lo0 && k > 0) {
|
||||
if (!filters[j = index[i]]) {
|
||||
array.push(data[j]);
|
||||
--k;
|
||||
}
|
||||
}
|
||||
|
||||
return array;
|
||||
}
|
||||
|
||||
// Returns the bottom K selected records based on this dimension's order.
|
||||
// Note: observes this dimension's filter, unlike group and groupAll.
|
||||
function bottom(k) {
|
||||
var array = [],
|
||||
i = lo0,
|
||||
j;
|
||||
|
||||
while (i < hi0 && k > 0) {
|
||||
if (!filters[j = index[i]]) {
|
||||
array.push(data[j]);
|
||||
--k;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
return array;
|
||||
}
|
||||
|
||||
// Adds a new group to this dimension, using the specified key function.
|
||||
function group(key) {
|
||||
var group = {
|
||||
top: top,
|
||||
all: all,
|
||||
reduce: reduce,
|
||||
reduceCount: reduceCount,
|
||||
reduceSum: reduceSum,
|
||||
order: order,
|
||||
orderNatural: orderNatural,
|
||||
size: size,
|
||||
dispose: dispose,
|
||||
remove: dispose // for backwards-compatibility
|
||||
};
|
||||
|
||||
// Ensure that this group will be removed when the dimension is removed.
|
||||
dimensionGroups.push(group);
|
||||
|
||||
var groups, // array of {key, value}
|
||||
groupIndex, // object id ↦ group id
|
||||
groupWidth = 8,
|
||||
groupCapacity = crossfilter_capacity(groupWidth),
|
||||
k = 0, // cardinality
|
||||
select,
|
||||
heap,
|
||||
reduceAdd,
|
||||
reduceRemove,
|
||||
reduceInitial,
|
||||
update = crossfilter_null,
|
||||
reset = crossfilter_null,
|
||||
resetNeeded = true,
|
||||
groupAll = key === crossfilter_null;
|
||||
|
||||
if (arguments.length < 1) key = crossfilter_identity;
|
||||
|
||||
// The group listens to the crossfilter for when any dimension changes, so
|
||||
// that it can update the associated reduce values. It must also listen to
|
||||
// the parent dimension for when data is added, and compute new keys.
|
||||
filterListeners.push(update);
|
||||
indexListeners.push(add);
|
||||
removeDataListeners.push(removeData);
|
||||
|
||||
// Incorporate any existing data into the grouping.
|
||||
add(values, index, 0, n);
|
||||
|
||||
// Incorporates the specified new values into this group.
|
||||
// This function is responsible for updating groups and groupIndex.
|
||||
function add(newValues, newIndex, n0, n1) {
|
||||
var oldGroups = groups,
|
||||
reIndex = crossfilter_index(k, groupCapacity),
|
||||
add = reduceAdd,
|
||||
initial = reduceInitial,
|
||||
k0 = k, // old cardinality
|
||||
i0 = 0, // index of old group
|
||||
i1 = 0, // index of new record
|
||||
j, // object id
|
||||
g0, // old group
|
||||
x0, // old key
|
||||
x1, // new key
|
||||
g, // group to add
|
||||
x; // key of group to add
|
||||
|
||||
// If a reset is needed, we don't need to update the reduce values.
|
||||
if (resetNeeded) add = initial = crossfilter_null;
|
||||
|
||||
// Reset the new groups (k is a lower bound).
|
||||
// Also, make sure that groupIndex exists and is long enough.
|
||||
groups = new Array(k), k = 0;
|
||||
groupIndex = k0 > 1 ? crossfilter_arrayLengthen(groupIndex, n) : crossfilter_index(n, groupCapacity);
|
||||
|
||||
// Get the first old key (x0 of g0), if it exists.
|
||||
if (k0) x0 = (g0 = oldGroups[0]).key;
|
||||
|
||||
// Find the first new key (x1), skipping NaN keys.
|
||||
while (i1 < n1 && !((x1 = key(newValues[i1])) >= x1)) ++i1;
|
||||
|
||||
// While new keys remain…
|
||||
while (i1 < n1) {
|
||||
|
||||
// Determine the lesser of the two current keys; new and old.
|
||||
// If there are no old keys remaining, then always add the new key.
|
||||
if (g0 && x0 <= x1) {
|
||||
g = g0, x = x0;
|
||||
|
||||
// Record the new index of the old group.
|
||||
reIndex[i0] = k;
|
||||
|
||||
// Retrieve the next old key.
|
||||
if (g0 = oldGroups[++i0]) x0 = g0.key;
|
||||
} else {
|
||||
g = {key: x1, value: initial()}, x = x1;
|
||||
}
|
||||
|
||||
// Add the lesser group.
|
||||
groups[k] = g;
|
||||
|
||||
// Add any selected records belonging to the added group, while
|
||||
// advancing the new key and populating the associated group index.
|
||||
while (!(x1 > x)) {
|
||||
groupIndex[j = newIndex[i1] + n0] = k;
|
||||
if (!(filters[j] & zero)) g.value = add(g.value, data[j]);
|
||||
if (++i1 >= n1) break;
|
||||
x1 = key(newValues[i1]);
|
||||
}
|
||||
|
||||
groupIncrement();
|
||||
}
|
||||
|
||||
// Add any remaining old groups that were greater than all new keys.
|
||||
// No incremental reduce is needed; these groups have no new records.
|
||||
// Also record the new index of the old group.
|
||||
while (i0 < k0) {
|
||||
groups[reIndex[i0] = k] = oldGroups[i0++];
|
||||
groupIncrement();
|
||||
}
|
||||
|
||||
// If we added any new groups before any old groups,
|
||||
// update the group index of all the old records.
|
||||
if (k > i0) for (i0 = 0; i0 < n0; ++i0) {
|
||||
groupIndex[i0] = reIndex[groupIndex[i0]];
|
||||
}
|
||||
|
||||
// Modify the update and reset behavior based on the cardinality.
|
||||
// If the cardinality is less than or equal to one, then the groupIndex
|
||||
// is not needed. If the cardinality is zero, then there are no records
|
||||
// and therefore no groups to update or reset. Note that we also must
|
||||
// change the registered listener to point to the new method.
|
||||
j = filterListeners.indexOf(update);
|
||||
if (k > 1) {
|
||||
update = updateMany;
|
||||
reset = resetMany;
|
||||
} else {
|
||||
if (!k && groupAll) {
|
||||
k = 1;
|
||||
groups = [{key: null, value: initial()}];
|
||||
}
|
||||
if (k === 1) {
|
||||
update = updateOne;
|
||||
reset = resetOne;
|
||||
} else {
|
||||
update = crossfilter_null;
|
||||
reset = crossfilter_null;
|
||||
}
|
||||
groupIndex = null;
|
||||
}
|
||||
filterListeners[j] = update;
|
||||
|
||||
// Count the number of added groups,
|
||||
// and widen the group index as needed.
|
||||
function groupIncrement() {
|
||||
if (++k === groupCapacity) {
|
||||
reIndex = crossfilter_arrayWiden(reIndex, groupWidth <<= 1);
|
||||
groupIndex = crossfilter_arrayWiden(groupIndex, groupWidth);
|
||||
groupCapacity = crossfilter_capacity(groupWidth);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function removeData() {
|
||||
if (k > 1) {
|
||||
var oldK = k,
|
||||
oldGroups = groups,
|
||||
seenGroups = crossfilter_index(oldK, oldK);
|
||||
|
||||
// Filter out non-matches by copying matching group index entries to
|
||||
// the beginning of the array.
|
||||
for (var i = 0, j = 0; i < n; ++i) {
|
||||
if (filters[i]) {
|
||||
seenGroups[groupIndex[j] = groupIndex[i]] = 1;
|
||||
++j;
|
||||
}
|
||||
}
|
||||
|
||||
// Reassemble groups including only those groups that were referred
|
||||
// to by matching group index entries. Note the new group index in
|
||||
// seenGroups.
|
||||
groups = [], k = 0;
|
||||
for (i = 0; i < oldK; ++i) {
|
||||
if (seenGroups[i]) {
|
||||
seenGroups[i] = k++;
|
||||
groups.push(oldGroups[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (k > 1) {
|
||||
// Reindex the group index using seenGroups to find the new index.
|
||||
for (var i = 0; i < j; ++i) groupIndex[i] = seenGroups[groupIndex[i]];
|
||||
} else {
|
||||
groupIndex = null;
|
||||
}
|
||||
filterListeners[filterListeners.indexOf(update)] = k > 1
|
||||
? (reset = resetMany, update = updateMany)
|
||||
: k === 1 ? (reset = resetOne, update = updateOne)
|
||||
: reset = update = crossfilter_null;
|
||||
} else if (k === 1) {
|
||||
if (groupAll) return;
|
||||
for (var i = 0; i < n; ++i) if (filters[i]) return;
|
||||
groups = [], k = 0;
|
||||
filterListeners[filterListeners.indexOf(update)] =
|
||||
update = reset = crossfilter_null;
|
||||
}
|
||||
}
|
||||
|
||||
// Reduces the specified selected or deselected records.
|
||||
// This function is only used when the cardinality is greater than 1.
|
||||
function updateMany(filterOne, added, removed) {
|
||||
if (filterOne === one || resetNeeded) return;
|
||||
|
||||
var i,
|
||||
k,
|
||||
n,
|
||||
g;
|
||||
|
||||
// Add the added values.
|
||||
for (i = 0, n = added.length; i < n; ++i) {
|
||||
if (!(filters[k = added[i]] & zero)) {
|
||||
g = groups[groupIndex[k]];
|
||||
g.value = reduceAdd(g.value, data[k]);
|
||||
}
|
||||
}
|
||||
|
||||
// Remove the removed values.
|
||||
for (i = 0, n = removed.length; i < n; ++i) {
|
||||
if ((filters[k = removed[i]] & zero) === filterOne) {
|
||||
g = groups[groupIndex[k]];
|
||||
g.value = reduceRemove(g.value, data[k]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Reduces the specified selected or deselected records.
|
||||
// This function is only used when the cardinality is 1.
|
||||
function updateOne(filterOne, added, removed) {
|
||||
if (filterOne === one || resetNeeded) return;
|
||||
|
||||
var i,
|
||||
k,
|
||||
n,
|
||||
g = groups[0];
|
||||
|
||||
// Add the added values.
|
||||
for (i = 0, n = added.length; i < n; ++i) {
|
||||
if (!(filters[k = added[i]] & zero)) {
|
||||
g.value = reduceAdd(g.value, data[k]);
|
||||
}
|
||||
}
|
||||
|
||||
// Remove the removed values.
|
||||
for (i = 0, n = removed.length; i < n; ++i) {
|
||||
if ((filters[k = removed[i]] & zero) === filterOne) {
|
||||
g.value = reduceRemove(g.value, data[k]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Recomputes the group reduce values from scratch.
|
||||
// This function is only used when the cardinality is greater than 1.
|
||||
function resetMany() {
|
||||
var i,
|
||||
g;
|
||||
|
||||
// Reset all group values.
|
||||
for (i = 0; i < k; ++i) {
|
||||
groups[i].value = reduceInitial();
|
||||
}
|
||||
|
||||
// Add any selected records.
|
||||
for (i = 0; i < n; ++i) {
|
||||
if (!(filters[i] & zero)) {
|
||||
g = groups[groupIndex[i]];
|
||||
g.value = reduceAdd(g.value, data[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Recomputes the group reduce values from scratch.
|
||||
// This function is only used when the cardinality is 1.
|
||||
function resetOne() {
|
||||
var i,
|
||||
g = groups[0];
|
||||
|
||||
// Reset the singleton group values.
|
||||
g.value = reduceInitial();
|
||||
|
||||
// Add any selected records.
|
||||
for (i = 0; i < n; ++i) {
|
||||
if (!(filters[i] & zero)) {
|
||||
g.value = reduceAdd(g.value, data[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Returns the array of group values, in the dimension's natural order.
|
||||
function all() {
|
||||
if (resetNeeded) reset(), resetNeeded = false;
|
||||
return groups;
|
||||
}
|
||||
|
||||
// Returns a new array containing the top K group values, in reduce order.
|
||||
function top(k) {
|
||||
var top = select(all(), 0, groups.length, k);
|
||||
return heap.sort(top, 0, top.length);
|
||||
}
|
||||
|
||||
// Sets the reduce behavior for this group to use the specified functions.
|
||||
// This method lazily recomputes the reduce values, waiting until needed.
|
||||
function reduce(add, remove, initial) {
|
||||
reduceAdd = add;
|
||||
reduceRemove = remove;
|
||||
reduceInitial = initial;
|
||||
resetNeeded = true;
|
||||
return group;
|
||||
}
|
||||
|
||||
// A convenience method for reducing by count.
|
||||
function reduceCount() {
|
||||
return reduce(crossfilter_reduceIncrement, crossfilter_reduceDecrement, crossfilter_zero);
|
||||
}
|
||||
|
||||
// A convenience method for reducing by sum(value).
|
||||
function reduceSum(value) {
|
||||
return reduce(crossfilter_reduceAdd(value), crossfilter_reduceSubtract(value), crossfilter_zero);
|
||||
}
|
||||
|
||||
// Sets the reduce order, using the specified accessor.
|
||||
function order(value) {
|
||||
select = heapselect_by(valueOf);
|
||||
heap = heap_by(valueOf);
|
||||
function valueOf(d) { return value(d.value); }
|
||||
return group;
|
||||
}
|
||||
|
||||
// A convenience method for natural ordering by reduce value.
|
||||
function orderNatural() {
|
||||
return order(crossfilter_identity);
|
||||
}
|
||||
|
||||
// Returns the cardinality of this group, irrespective of any filters.
|
||||
function size() {
|
||||
return k;
|
||||
}
|
||||
|
||||
// Removes this group and associated event listeners.
|
||||
function dispose() {
|
||||
var i = filterListeners.indexOf(update);
|
||||
if (i >= 0) filterListeners.splice(i, 1);
|
||||
i = indexListeners.indexOf(add);
|
||||
if (i >= 0) indexListeners.splice(i, 1);
|
||||
i = removeDataListeners.indexOf(removeData);
|
||||
if (i >= 0) removeDataListeners.splice(i, 1);
|
||||
return group;
|
||||
}
|
||||
|
||||
return reduceCount().orderNatural();
|
||||
}
|
||||
|
||||
// A convenience function for generating a singleton group.
|
||||
function groupAll() {
|
||||
var g = group(crossfilter_null), all = g.all;
|
||||
delete g.all;
|
||||
delete g.top;
|
||||
delete g.order;
|
||||
delete g.orderNatural;
|
||||
delete g.size;
|
||||
g.value = function() { return all()[0].value; };
|
||||
return g;
|
||||
}
|
||||
|
||||
// Removes this dimension and associated groups and event listeners.
|
||||
function dispose() {
|
||||
dimensionGroups.forEach(function(group) { group.dispose(); });
|
||||
var i = dataListeners.indexOf(preAdd);
|
||||
if (i >= 0) dataListeners.splice(i, 1);
|
||||
i = dataListeners.indexOf(postAdd);
|
||||
if (i >= 0) dataListeners.splice(i, 1);
|
||||
i = removeDataListeners.indexOf(removeData);
|
||||
if (i >= 0) removeDataListeners.splice(i, 1);
|
||||
m &= zero;
|
||||
return filterAll();
|
||||
}
|
||||
|
||||
return dimension;
|
||||
}
|
||||
|
||||
// A convenience method for groupAll on a dummy dimension.
|
||||
// This implementation can be optimized since it always has cardinality 1.
|
||||
function groupAll() {
|
||||
var group = {
|
||||
reduce: reduce,
|
||||
reduceCount: reduceCount,
|
||||
reduceSum: reduceSum,
|
||||
value: value,
|
||||
dispose: dispose,
|
||||
remove: dispose // for backwards-compatibility
|
||||
};
|
||||
|
||||
var reduceValue,
|
||||
reduceAdd,
|
||||
reduceRemove,
|
||||
reduceInitial,
|
||||
resetNeeded = true;
|
||||
|
||||
// The group listens to the crossfilter for when any dimension changes, so
|
||||
// that it can update the reduce value. It must also listen to the parent
|
||||
// dimension for when data is added.
|
||||
filterListeners.push(update);
|
||||
dataListeners.push(add);
|
||||
|
||||
// For consistency; actually a no-op since resetNeeded is true.
|
||||
add(data, 0, n);
|
||||
|
||||
// Incorporates the specified new values into this group.
|
||||
function add(newData, n0) {
|
||||
var i;
|
||||
|
||||
if (resetNeeded) return;
|
||||
|
||||
// Add the added values.
|
||||
for (i = n0; i < n; ++i) {
|
||||
if (!filters[i]) {
|
||||
reduceValue = reduceAdd(reduceValue, data[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Reduces the specified selected or deselected records.
|
||||
function update(filterOne, added, removed) {
|
||||
var i,
|
||||
k,
|
||||
n;
|
||||
|
||||
if (resetNeeded) return;
|
||||
|
||||
// Add the added values.
|
||||
for (i = 0, n = added.length; i < n; ++i) {
|
||||
if (!filters[k = added[i]]) {
|
||||
reduceValue = reduceAdd(reduceValue, data[k]);
|
||||
}
|
||||
}
|
||||
|
||||
// Remove the removed values.
|
||||
for (i = 0, n = removed.length; i < n; ++i) {
|
||||
if (filters[k = removed[i]] === filterOne) {
|
||||
reduceValue = reduceRemove(reduceValue, data[k]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Recomputes the group reduce value from scratch.
|
||||
function reset() {
|
||||
var i;
|
||||
|
||||
reduceValue = reduceInitial();
|
||||
|
||||
for (i = 0; i < n; ++i) {
|
||||
if (!filters[i]) {
|
||||
reduceValue = reduceAdd(reduceValue, data[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Sets the reduce behavior for this group to use the specified functions.
|
||||
// This method lazily recomputes the reduce value, waiting until needed.
|
||||
function reduce(add, remove, initial) {
|
||||
reduceAdd = add;
|
||||
reduceRemove = remove;
|
||||
reduceInitial = initial;
|
||||
resetNeeded = true;
|
||||
return group;
|
||||
}
|
||||
|
||||
// A convenience method for reducing by count.
|
||||
function reduceCount() {
|
||||
return reduce(crossfilter_reduceIncrement, crossfilter_reduceDecrement, crossfilter_zero);
|
||||
}
|
||||
|
||||
// A convenience method for reducing by sum(value).
|
||||
function reduceSum(value) {
|
||||
return reduce(crossfilter_reduceAdd(value), crossfilter_reduceSubtract(value), crossfilter_zero);
|
||||
}
|
||||
|
||||
// Returns the computed reduce value.
|
||||
function value() {
|
||||
if (resetNeeded) reset(), resetNeeded = false;
|
||||
return reduceValue;
|
||||
}
|
||||
|
||||
// Removes this group and associated event listeners.
|
||||
function dispose() {
|
||||
var i = filterListeners.indexOf(update);
|
||||
if (i >= 0) filterListeners.splice(i);
|
||||
i = dataListeners.indexOf(add);
|
||||
if (i >= 0) dataListeners.splice(i);
|
||||
return group;
|
||||
}
|
||||
|
||||
return reduceCount();
|
||||
}
|
||||
|
||||
// Returns the number of records in this crossfilter, irrespective of any filters.
|
||||
function size() {
|
||||
return n;
|
||||
}
|
||||
|
||||
return arguments.length
|
||||
? add(arguments[0])
|
||||
: crossfilter;
|
||||
}
|
||||
|
||||
// Returns an array of size n, big enough to store ids up to m.
|
||||
function crossfilter_index(n, m) {
|
||||
return (m < 0x101
|
||||
? crossfilter_array8 : m < 0x10001
|
||||
? crossfilter_array16
|
||||
: crossfilter_array32)(n);
|
||||
}
|
||||
|
||||
// Constructs a new array of size n, with sequential values from 0 to n - 1.
|
||||
function crossfilter_range(n) {
|
||||
var range = crossfilter_index(n, n);
|
||||
for (var i = -1; ++i < n;) range[i] = i;
|
||||
return range;
|
||||
}
|
||||
|
||||
function crossfilter_capacity(w) {
|
||||
return w === 8
|
||||
? 0x100 : w === 16
|
||||
? 0x10000
|
||||
: 0x100000000;
|
||||
}
|
||||
19
immoweb/node_modules/crossfilter/src/filter.js
generated
vendored
Normal file
19
immoweb/node_modules/crossfilter/src/filter.js
generated
vendored
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
function crossfilter_filterExact(bisect, value) {
|
||||
return function(values) {
|
||||
var n = values.length;
|
||||
return [bisect.left(values, value, 0, n), bisect.right(values, value, 0, n)];
|
||||
};
|
||||
}
|
||||
|
||||
function crossfilter_filterRange(bisect, range) {
|
||||
var min = range[0],
|
||||
max = range[1];
|
||||
return function(values) {
|
||||
var n = values.length;
|
||||
return [bisect.left(values, min, 0, n), bisect.left(values, max, 0, n)];
|
||||
};
|
||||
}
|
||||
|
||||
function crossfilter_filterAll(values) {
|
||||
return [0, values.length];
|
||||
}
|
||||
44
immoweb/node_modules/crossfilter/src/heap.js
generated
vendored
Normal file
44
immoweb/node_modules/crossfilter/src/heap.js
generated
vendored
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
var heap = crossfilter.heap = heap_by(crossfilter_identity);
|
||||
|
||||
heap.by = heap_by;
|
||||
|
||||
function heap_by(f) {
|
||||
|
||||
// Builds a binary heap within the specified array a[lo:hi]. The heap has the
|
||||
// property such that the parent a[lo+i] is always less than or equal to its
|
||||
// two children: a[lo+2*i+1] and a[lo+2*i+2].
|
||||
function heap(a, lo, hi) {
|
||||
var n = hi - lo,
|
||||
i = (n >>> 1) + 1;
|
||||
while (--i > 0) sift(a, i, n, lo);
|
||||
return a;
|
||||
}
|
||||
|
||||
// Sorts the specified array a[lo:hi] in descending order, assuming it is
|
||||
// already a heap.
|
||||
function sort(a, lo, hi) {
|
||||
var n = hi - lo,
|
||||
t;
|
||||
while (--n > 0) t = a[lo], a[lo] = a[lo + n], a[lo + n] = t, sift(a, 1, n, lo);
|
||||
return a;
|
||||
}
|
||||
|
||||
// Sifts the element a[lo+i-1] down the heap, where the heap is the contiguous
|
||||
// slice of array a[lo:lo+n]. This method can also be used to update the heap
|
||||
// incrementally, without incurring the full cost of reconstructing the heap.
|
||||
function sift(a, i, n, lo) {
|
||||
var d = a[--lo + i],
|
||||
x = f(d),
|
||||
child;
|
||||
while ((child = i << 1) <= n) {
|
||||
if (child < n && f(a[lo + child]) > f(a[lo + child + 1])) child++;
|
||||
if (x <= f(a[lo + child])) break;
|
||||
a[lo + i] = a[lo + child];
|
||||
i = child;
|
||||
}
|
||||
a[lo + i] = d;
|
||||
}
|
||||
|
||||
heap.sort = sort;
|
||||
return heap;
|
||||
}
|
||||
36
immoweb/node_modules/crossfilter/src/heapselect.js
generated
vendored
Normal file
36
immoweb/node_modules/crossfilter/src/heapselect.js
generated
vendored
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
var heapselect = crossfilter.heapselect = heapselect_by(crossfilter_identity);
|
||||
|
||||
heapselect.by = heapselect_by;
|
||||
|
||||
function heapselect_by(f) {
|
||||
var heap = heap_by(f);
|
||||
|
||||
// Returns a new array containing the top k elements in the array a[lo:hi].
|
||||
// The returned array is not sorted, but maintains the heap property. If k is
|
||||
// greater than hi - lo, then fewer than k elements will be returned. The
|
||||
// order of elements in a is unchanged by this operation.
|
||||
function heapselect(a, lo, hi, k) {
|
||||
var queue = new Array(k = Math.min(hi - lo, k)),
|
||||
min,
|
||||
i,
|
||||
x,
|
||||
d;
|
||||
|
||||
for (i = 0; i < k; ++i) queue[i] = a[lo++];
|
||||
heap(queue, 0, k);
|
||||
|
||||
if (lo < hi) {
|
||||
min = f(queue[0]);
|
||||
do {
|
||||
if (x = f(d = a[lo]) > min) {
|
||||
queue[0] = d;
|
||||
min = f(heap(queue, 0, k)[0]);
|
||||
}
|
||||
} while (++lo < hi);
|
||||
}
|
||||
|
||||
return queue;
|
||||
}
|
||||
|
||||
return heapselect;
|
||||
}
|
||||
3
immoweb/node_modules/crossfilter/src/identity.js
generated
vendored
Normal file
3
immoweb/node_modules/crossfilter/src/identity.js
generated
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
function crossfilter_identity(d) {
|
||||
return d;
|
||||
}
|
||||
18
immoweb/node_modules/crossfilter/src/insertionsort.js
generated
vendored
Normal file
18
immoweb/node_modules/crossfilter/src/insertionsort.js
generated
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
var insertionsort = crossfilter.insertionsort = insertionsort_by(crossfilter_identity);
|
||||
|
||||
insertionsort.by = insertionsort_by;
|
||||
|
||||
function insertionsort_by(f) {
|
||||
|
||||
function insertionsort(a, lo, hi) {
|
||||
for (var i = lo + 1; i < hi; ++i) {
|
||||
for (var j = i, t = a[i], x = f(t); j > lo && f(a[j - 1]) > x; --j) {
|
||||
a[j] = a[j - 1];
|
||||
}
|
||||
a[j] = t;
|
||||
}
|
||||
return a;
|
||||
}
|
||||
|
||||
return insertionsort;
|
||||
}
|
||||
3
immoweb/node_modules/crossfilter/src/null.js
generated
vendored
Normal file
3
immoweb/node_modules/crossfilter/src/null.js
generated
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
function crossfilter_null() {
|
||||
return null;
|
||||
}
|
||||
8
immoweb/node_modules/crossfilter/src/permute.js
generated
vendored
Normal file
8
immoweb/node_modules/crossfilter/src/permute.js
generated
vendored
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
crossfilter.permute = permute;
|
||||
|
||||
function permute(array, index) {
|
||||
for (var i = 0, n = index.length, copy = new Array(n); i < n; ++i) {
|
||||
copy[i] = array[index[i]];
|
||||
}
|
||||
return copy;
|
||||
}
|
||||
283
immoweb/node_modules/crossfilter/src/quicksort.js
generated
vendored
Normal file
283
immoweb/node_modules/crossfilter/src/quicksort.js
generated
vendored
Normal file
|
|
@ -0,0 +1,283 @@
|
|||
// Algorithm designed by Vladimir Yaroslavskiy.
|
||||
// Implementation based on the Dart project; see lib/dart/LICENSE for details.
|
||||
|
||||
var quicksort = crossfilter.quicksort = quicksort_by(crossfilter_identity);
|
||||
|
||||
quicksort.by = quicksort_by;
|
||||
|
||||
function quicksort_by(f) {
|
||||
var insertionsort = insertionsort_by(f);
|
||||
|
||||
function sort(a, lo, hi) {
|
||||
return (hi - lo < quicksort_sizeThreshold
|
||||
? insertionsort
|
||||
: quicksort)(a, lo, hi);
|
||||
}
|
||||
|
||||
function quicksort(a, lo, hi) {
|
||||
// Compute the two pivots by looking at 5 elements.
|
||||
var sixth = (hi - lo) / 6 | 0,
|
||||
i1 = lo + sixth,
|
||||
i5 = hi - 1 - sixth,
|
||||
i3 = lo + hi - 1 >> 1, // The midpoint.
|
||||
i2 = i3 - sixth,
|
||||
i4 = i3 + sixth;
|
||||
|
||||
var e1 = a[i1], x1 = f(e1),
|
||||
e2 = a[i2], x2 = f(e2),
|
||||
e3 = a[i3], x3 = f(e3),
|
||||
e4 = a[i4], x4 = f(e4),
|
||||
e5 = a[i5], x5 = f(e5);
|
||||
|
||||
var t;
|
||||
|
||||
// Sort the selected 5 elements using a sorting network.
|
||||
if (x1 > x2) t = e1, e1 = e2, e2 = t, t = x1, x1 = x2, x2 = t;
|
||||
if (x4 > x5) t = e4, e4 = e5, e5 = t, t = x4, x4 = x5, x5 = t;
|
||||
if (x1 > x3) t = e1, e1 = e3, e3 = t, t = x1, x1 = x3, x3 = t;
|
||||
if (x2 > x3) t = e2, e2 = e3, e3 = t, t = x2, x2 = x3, x3 = t;
|
||||
if (x1 > x4) t = e1, e1 = e4, e4 = t, t = x1, x1 = x4, x4 = t;
|
||||
if (x3 > x4) t = e3, e3 = e4, e4 = t, t = x3, x3 = x4, x4 = t;
|
||||
if (x2 > x5) t = e2, e2 = e5, e5 = t, t = x2, x2 = x5, x5 = t;
|
||||
if (x2 > x3) t = e2, e2 = e3, e3 = t, t = x2, x2 = x3, x3 = t;
|
||||
if (x4 > x5) t = e4, e4 = e5, e5 = t, t = x4, x4 = x5, x5 = t;
|
||||
|
||||
var pivot1 = e2, pivotValue1 = x2,
|
||||
pivot2 = e4, pivotValue2 = x4;
|
||||
|
||||
// e2 and e4 have been saved in the pivot variables. They will be written
|
||||
// back, once the partitioning is finished.
|
||||
a[i1] = e1;
|
||||
a[i2] = a[lo];
|
||||
a[i3] = e3;
|
||||
a[i4] = a[hi - 1];
|
||||
a[i5] = e5;
|
||||
|
||||
var less = lo + 1, // First element in the middle partition.
|
||||
great = hi - 2; // Last element in the middle partition.
|
||||
|
||||
// Note that for value comparison, <, <=, >= and > coerce to a primitive via
|
||||
// Object.prototype.valueOf; == and === do not, so in order to be consistent
|
||||
// with natural order (such as for Date objects), we must do two compares.
|
||||
var pivotsEqual = pivotValue1 <= pivotValue2 && pivotValue1 >= pivotValue2;
|
||||
if (pivotsEqual) {
|
||||
|
||||
// Degenerated case where the partitioning becomes a dutch national flag
|
||||
// problem.
|
||||
//
|
||||
// [ | < pivot | == pivot | unpartitioned | > pivot | ]
|
||||
// ^ ^ ^ ^ ^
|
||||
// left less k great right
|
||||
//
|
||||
// a[left] and a[right] are undefined and are filled after the
|
||||
// partitioning.
|
||||
//
|
||||
// Invariants:
|
||||
// 1) for x in ]left, less[ : x < pivot.
|
||||
// 2) for x in [less, k[ : x == pivot.
|
||||
// 3) for x in ]great, right[ : x > pivot.
|
||||
for (var k = less; k <= great; ++k) {
|
||||
var ek = a[k], xk = f(ek);
|
||||
if (xk < pivotValue1) {
|
||||
if (k !== less) {
|
||||
a[k] = a[less];
|
||||
a[less] = ek;
|
||||
}
|
||||
++less;
|
||||
} else if (xk > pivotValue1) {
|
||||
|
||||
// Find the first element <= pivot in the range [k - 1, great] and
|
||||
// put [:ek:] there. We know that such an element must exist:
|
||||
// When k == less, then el3 (which is equal to pivot) lies in the
|
||||
// interval. Otherwise a[k - 1] == pivot and the search stops at k-1.
|
||||
// Note that in the latter case invariant 2 will be violated for a
|
||||
// short amount of time. The invariant will be restored when the
|
||||
// pivots are put into their final positions.
|
||||
while (true) {
|
||||
var greatValue = f(a[great]);
|
||||
if (greatValue > pivotValue1) {
|
||||
great--;
|
||||
// This is the only location in the while-loop where a new
|
||||
// iteration is started.
|
||||
continue;
|
||||
} else if (greatValue < pivotValue1) {
|
||||
// Triple exchange.
|
||||
a[k] = a[less];
|
||||
a[less++] = a[great];
|
||||
a[great--] = ek;
|
||||
break;
|
||||
} else {
|
||||
a[k] = a[great];
|
||||
a[great--] = ek;
|
||||
// Note: if great < k then we will exit the outer loop and fix
|
||||
// invariant 2 (which we just violated).
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
// We partition the list into three parts:
|
||||
// 1. < pivot1
|
||||
// 2. >= pivot1 && <= pivot2
|
||||
// 3. > pivot2
|
||||
//
|
||||
// During the loop we have:
|
||||
// [ | < pivot1 | >= pivot1 && <= pivot2 | unpartitioned | > pivot2 | ]
|
||||
// ^ ^ ^ ^ ^
|
||||
// left less k great right
|
||||
//
|
||||
// a[left] and a[right] are undefined and are filled after the
|
||||
// partitioning.
|
||||
//
|
||||
// Invariants:
|
||||
// 1. for x in ]left, less[ : x < pivot1
|
||||
// 2. for x in [less, k[ : pivot1 <= x && x <= pivot2
|
||||
// 3. for x in ]great, right[ : x > pivot2
|
||||
for (var k = less; k <= great; k++) {
|
||||
var ek = a[k], xk = f(ek);
|
||||
if (xk < pivotValue1) {
|
||||
if (k !== less) {
|
||||
a[k] = a[less];
|
||||
a[less] = ek;
|
||||
}
|
||||
++less;
|
||||
} else {
|
||||
if (xk > pivotValue2) {
|
||||
while (true) {
|
||||
var greatValue = f(a[great]);
|
||||
if (greatValue > pivotValue2) {
|
||||
great--;
|
||||
if (great < k) break;
|
||||
// This is the only location inside the loop where a new
|
||||
// iteration is started.
|
||||
continue;
|
||||
} else {
|
||||
// a[great] <= pivot2.
|
||||
if (greatValue < pivotValue1) {
|
||||
// Triple exchange.
|
||||
a[k] = a[less];
|
||||
a[less++] = a[great];
|
||||
a[great--] = ek;
|
||||
} else {
|
||||
// a[great] >= pivot1.
|
||||
a[k] = a[great];
|
||||
a[great--] = ek;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Move pivots into their final positions.
|
||||
// We shrunk the list from both sides (a[left] and a[right] have
|
||||
// meaningless values in them) and now we move elements from the first
|
||||
// and third partition into these locations so that we can store the
|
||||
// pivots.
|
||||
a[lo] = a[less - 1];
|
||||
a[less - 1] = pivot1;
|
||||
a[hi - 1] = a[great + 1];
|
||||
a[great + 1] = pivot2;
|
||||
|
||||
// The list is now partitioned into three partitions:
|
||||
// [ < pivot1 | >= pivot1 && <= pivot2 | > pivot2 ]
|
||||
// ^ ^ ^ ^
|
||||
// left less great right
|
||||
|
||||
// Recursive descent. (Don't include the pivot values.)
|
||||
sort(a, lo, less - 1);
|
||||
sort(a, great + 2, hi);
|
||||
|
||||
if (pivotsEqual) {
|
||||
// All elements in the second partition are equal to the pivot. No
|
||||
// need to sort them.
|
||||
return a;
|
||||
}
|
||||
|
||||
// In theory it should be enough to call _doSort recursively on the second
|
||||
// partition.
|
||||
// The Android source however removes the pivot elements from the recursive
|
||||
// call if the second partition is too large (more than 2/3 of the list).
|
||||
if (less < i1 && great > i5) {
|
||||
var lessValue, greatValue;
|
||||
while ((lessValue = f(a[less])) <= pivotValue1 && lessValue >= pivotValue1) ++less;
|
||||
while ((greatValue = f(a[great])) <= pivotValue2 && greatValue >= pivotValue2) --great;
|
||||
|
||||
// Copy paste of the previous 3-way partitioning with adaptions.
|
||||
//
|
||||
// We partition the list into three parts:
|
||||
// 1. == pivot1
|
||||
// 2. > pivot1 && < pivot2
|
||||
// 3. == pivot2
|
||||
//
|
||||
// During the loop we have:
|
||||
// [ == pivot1 | > pivot1 && < pivot2 | unpartitioned | == pivot2 ]
|
||||
// ^ ^ ^
|
||||
// less k great
|
||||
//
|
||||
// Invariants:
|
||||
// 1. for x in [ *, less[ : x == pivot1
|
||||
// 2. for x in [less, k[ : pivot1 < x && x < pivot2
|
||||
// 3. for x in ]great, * ] : x == pivot2
|
||||
for (var k = less; k <= great; k++) {
|
||||
var ek = a[k], xk = f(ek);
|
||||
if (xk <= pivotValue1 && xk >= pivotValue1) {
|
||||
if (k !== less) {
|
||||
a[k] = a[less];
|
||||
a[less] = ek;
|
||||
}
|
||||
less++;
|
||||
} else {
|
||||
if (xk <= pivotValue2 && xk >= pivotValue2) {
|
||||
while (true) {
|
||||
var greatValue = f(a[great]);
|
||||
if (greatValue <= pivotValue2 && greatValue >= pivotValue2) {
|
||||
great--;
|
||||
if (great < k) break;
|
||||
// This is the only location inside the loop where a new
|
||||
// iteration is started.
|
||||
continue;
|
||||
} else {
|
||||
// a[great] < pivot2.
|
||||
if (greatValue < pivotValue1) {
|
||||
// Triple exchange.
|
||||
a[k] = a[less];
|
||||
a[less++] = a[great];
|
||||
a[great--] = ek;
|
||||
} else {
|
||||
// a[great] == pivot1.
|
||||
a[k] = a[great];
|
||||
a[great--] = ek;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// The second partition has now been cleared of pivot elements and looks
|
||||
// as follows:
|
||||
// [ * | > pivot1 && < pivot2 | * ]
|
||||
// ^ ^
|
||||
// less great
|
||||
// Sort the second partition using recursive descent.
|
||||
|
||||
// The second partition looks as follows:
|
||||
// [ * | >= pivot1 && <= pivot2 | * ]
|
||||
// ^ ^
|
||||
// less great
|
||||
// Simply sort it by recursive descent.
|
||||
|
||||
return sort(a, less, great + 1);
|
||||
}
|
||||
|
||||
return sort;
|
||||
}
|
||||
|
||||
var quicksort_sizeThreshold = 32;
|
||||
19
immoweb/node_modules/crossfilter/src/reduce.js
generated
vendored
Normal file
19
immoweb/node_modules/crossfilter/src/reduce.js
generated
vendored
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
function crossfilter_reduceIncrement(p) {
|
||||
return p + 1;
|
||||
}
|
||||
|
||||
function crossfilter_reduceDecrement(p) {
|
||||
return p - 1;
|
||||
}
|
||||
|
||||
function crossfilter_reduceAdd(f) {
|
||||
return function(p, v) {
|
||||
return p + +f(v);
|
||||
};
|
||||
}
|
||||
|
||||
function crossfilter_reduceSubtract(f) {
|
||||
return function(p, v) {
|
||||
return p - f(v);
|
||||
};
|
||||
}
|
||||
3
immoweb/node_modules/crossfilter/src/zero.js
generated
vendored
Normal file
3
immoweb/node_modules/crossfilter/src/zero.js
generated
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
function crossfilter_zero() {
|
||||
return 0;
|
||||
}
|
||||
207
immoweb/node_modules/hexgrid-heatmap/HexgridHeatmap.js
generated
vendored
Normal file
207
immoweb/node_modules/hexgrid-heatmap/HexgridHeatmap.js
generated
vendored
Normal file
|
|
@ -0,0 +1,207 @@
|
|||
var rbush = require('rbush');
|
||||
var turf = {
|
||||
center: require('@turf/center'),
|
||||
hexGrid: require('@turf/hex-grid'),
|
||||
destination: require('@turf/destination'),
|
||||
distance: require('@turf/distance'),
|
||||
};
|
||||
/**
|
||||
* Creates a hexgrid-based vector heatmap on the specified map.
|
||||
* @constructor
|
||||
* @param {Map} map - The map object that this heatmap should add itself to and track.
|
||||
* @param {string} [layername=hexgrid-heatmap] - The layer name to use for the heatmap.
|
||||
* @param {string} [addBefore] - Name of a layer to insert this heatmap underneath.
|
||||
*/
|
||||
function HexgridHeatmap(map, layername, addBefore) {
|
||||
if(layername === undefined) layername = "hexgrid-heatmap";
|
||||
this.map = map;
|
||||
this.layername = layername;
|
||||
this._setupLayers(layername, addBefore);
|
||||
this._setupEvents();
|
||||
// Set up an R-tree to look for coordinates as they are stored in GeoJSON Feature objects
|
||||
this._tree = rbush(9,['["geometry"]["coordinates"][0]','["geometry"]["coordinates"][1]','["geometry"]["coordinates"][0]','["geometry"]["coordinates"][1]']);
|
||||
|
||||
this._intensity = 8;
|
||||
this._spread = 0.1;
|
||||
this._minCellIntensity = 0; // Drop out cells that have less than this intensity
|
||||
this._maxPointIntensity = 20; // Don't let a single point have a greater weight than this
|
||||
this._cellDensity = 1;
|
||||
|
||||
var thisthis = this;
|
||||
this._checkUpdateCompleteClosure = function(e) { thisthis._checkUpdateComplete(e); }
|
||||
this._calculatingGrid = false;
|
||||
this._recalcWhenReady = false;
|
||||
}
|
||||
|
||||
HexgridHeatmap.prototype = {
|
||||
_setupLayers: function(layername, addBefore) {
|
||||
this.map.addLayer({
|
||||
'id': layername,
|
||||
'type': 'fill',
|
||||
'source': {
|
||||
type: 'geojson',
|
||||
data: { type: "FeatureCollection", features: [] }
|
||||
},
|
||||
'paint': {
|
||||
'fill-opacity': 1.0,
|
||||
'fill-color': {
|
||||
property: 'count',
|
||||
stops: [
|
||||
// Short rainbow blue
|
||||
[0, "rgba(0,185,243,0)"],
|
||||
[50, "rgba(0,185,243,0.24)"],
|
||||
[130, "rgba(255,223,0,0.3)"],
|
||||
[200, "rgba(255,105,0,0.3)"],
|
||||
]
|
||||
}
|
||||
}
|
||||
}, addBefore);
|
||||
|
||||
this.layer = this.map.getLayer(layername);
|
||||
this.source = this.map.getSource(layername);
|
||||
},
|
||||
_setupEvents: function() {
|
||||
var thisthis = this;
|
||||
this.map.on("moveend", function() {
|
||||
thisthis._updateGrid();
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Set the data to visualize with this heatmap layer
|
||||
* @param {FeatureCollection} data - A GeoJSON FeatureCollection containing data to visualize with this heatmap
|
||||
* @public
|
||||
*/
|
||||
setData: function(data) {
|
||||
// Re-build R-tree index
|
||||
this._tree.clear();
|
||||
this._tree.load(data.features);
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Set how widely points affect their neighbors
|
||||
* @param {number} spread - A good starting point is 0.1. Higher values will result in more blurred heatmaps, lower values will highlight individual points more strongly.
|
||||
* @public
|
||||
*/
|
||||
setSpread: function(spread) {
|
||||
this._spread = spread;
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Set the intensity value for all points.
|
||||
* @param {number} intensity - Setting this too low will result in no data displayed, setting it too high will result in an oversaturated map. The default is 8 so adjust up or down from there according to the density of your data.
|
||||
* @public
|
||||
*/
|
||||
setIntensity: function(intensity) {
|
||||
this._intensity = intensity;
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Set custom stops for the heatmap color schem
|
||||
* @param {array} stops - An array of `stops` in the format of the Mapbox GL Style Spec. Values should range from 0 to about 200, though you can control saturation by setting different values here.
|
||||
*/
|
||||
setColorStops: function(stops) {
|
||||
this.layer.setPaintProperty("fill-color", {property: "count", stops: stops});
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Set the hexgrid cell density
|
||||
* @param {number} density - Values less than 1 will result in a decreased cell density from the default, values greater than 1 will result in increaded density/higher resolution. Setting this value too high will result in slow performance.
|
||||
* @public
|
||||
*/
|
||||
setCellDensity: function(density) {
|
||||
this._cellDensity = density;
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Manually force an update to the heatmap
|
||||
* You can call this method to manually force the heatmap to be redrawn. Use this after calling `setData()`, `setSpread()`, or `setIntensity()`
|
||||
*/
|
||||
update: function() {
|
||||
this._updateGrid();
|
||||
},
|
||||
|
||||
|
||||
_generateGrid: function() {
|
||||
// Rebuild grid
|
||||
//var cellSize = Math.min(Math.max(1000/Math.pow(2,this.map.transform.zoom), 0.01), 0.1); // Constant screen size
|
||||
|
||||
var cellSize = Math.max(500/Math.pow(2,this.map.transform.zoom) / this._cellDensity, 0.01); // Constant screen size
|
||||
|
||||
// TODO: These extents don't work when the map is rotated
|
||||
var extents = this.map.getBounds().toArray()
|
||||
extents = [extents[0][0], extents[0][1], extents[1][0], extents[1][1]];
|
||||
|
||||
var hexgrid = turf.hexGrid(extents, cellSize, 'kilometers');
|
||||
|
||||
var sigma = this._spread;
|
||||
var a = 1 / (sigma * Math.sqrt(2 * Math.PI));
|
||||
var amplitude = this._intensity;
|
||||
|
||||
var cellsToSave = [];
|
||||
|
||||
var thisthis = this;
|
||||
hexgrid.features.forEach(function(cell) {
|
||||
var center = turf.center(cell);
|
||||
var strength = 0;
|
||||
var SW = turf.destination(center, sigma * 4, -135);
|
||||
var NE = turf.destination(center, sigma * 4, 45);
|
||||
var pois = thisthis._tree.search({
|
||||
minX: SW.geometry.coordinates[0],
|
||||
minY: SW.geometry.coordinates[1],
|
||||
maxX: NE.geometry.coordinates[0],
|
||||
maxY: NE.geometry.coordinates[1]
|
||||
});
|
||||
|
||||
pois.forEach(function(poi) {
|
||||
// TODO: Allow weight to be influenced by a property within the POI
|
||||
var distance = turf.distance(center, poi);
|
||||
|
||||
var weighted = Math.min(Math.exp(-(distance * distance / (2 * sigma * sigma))) * a * amplitude, thisthis._maxPointIntensity);
|
||||
strength += weighted;
|
||||
});
|
||||
|
||||
cell.properties.count = strength;
|
||||
|
||||
if(cell.properties.count > thisthis._minCellIntensity) {
|
||||
cellsToSave.push(cell);
|
||||
}
|
||||
});
|
||||
|
||||
hexgrid.features = cellsToSave;
|
||||
return hexgrid;
|
||||
|
||||
},
|
||||
_updateGrid: function() {
|
||||
if(!this._calculatingGrid) {
|
||||
this._calculatingGrid = true;
|
||||
var hexgrid = this._generateGrid();
|
||||
if(hexgrid != null) {
|
||||
var thisthis = this;
|
||||
this.source.on("data", this._checkUpdateCompleteClosure);
|
||||
this.source.setData(hexgrid);
|
||||
}
|
||||
else {
|
||||
this._calculatingGrid = false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
this._recalcWhenReady = true;
|
||||
}
|
||||
},
|
||||
_checkUpdateComplete: function(e) {
|
||||
if(e.dataType == "source") {
|
||||
this.source.off("data", this._checkUpdateCompleteClosure);
|
||||
this._calculatingGrid = false;
|
||||
if(this._recalcWhenReady) this._updateGrid();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = exports = HexgridHeatmap;
|
||||
45
immoweb/node_modules/hexgrid-heatmap/README.md
generated
vendored
Normal file
45
immoweb/node_modules/hexgrid-heatmap/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
## Hexgrid-based vector heatmaps for your Mapbox GL JS Maps
|
||||
|
||||

|
||||
|
||||
|
||||
### Usage
|
||||
See the [examples directory](examples/index.html) for an example of usage. You will need to provide your own Mabox access token to view the map.
|
||||
|
||||
Here's how it works:
|
||||
|
||||
- Create an instance of `HexgridHeatmap`. It will automatically add the necessary layer and events to the specified map:
|
||||
|
||||
```
|
||||
var heatmap = new HexgridHeatmap(map, "hexgrid-heatmap", "waterway-label");
|
||||
```
|
||||
|
||||
- You can control the intensity and spread of the points:
|
||||
|
||||
```
|
||||
heatmap.setIntensity(15);
|
||||
heatmap.setSpread(0.3);
|
||||
```
|
||||
|
||||
- Feed in a GeoJSON `FeatureCollection` full of points to map
|
||||
|
||||
```
|
||||
heatmap.setData(sightseeingPOIs);
|
||||
```
|
||||
|
||||
- Manually call `update()` after changing settings. The heatmap will automatically call update() when moving and zooming the map.
|
||||
|
||||
```
|
||||
heatmap.update();
|
||||
```
|
||||
|
||||
- You can set your own color palette using stops conforming to the Mapbox GL style spec:
|
||||
|
||||
```
|
||||
heatmap.setColorStops([
|
||||
[0, "rgba(0,185,243,0)"],
|
||||
[50, "rgba(0,185,243,0.5)"],
|
||||
[130, "rgba(255,223,0,0.6)"],
|
||||
[200, "rgba(255,105,0,0.6)"]
|
||||
]);
|
||||
```
|
||||
1936
immoweb/node_modules/hexgrid-heatmap/dist/HexgridHeatmap.js
generated
vendored
Normal file
1936
immoweb/node_modules/hexgrid-heatmap/dist/HexgridHeatmap.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
BIN
immoweb/node_modules/hexgrid-heatmap/docs/hexgrid-heatmap.png
generated
vendored
Normal file
BIN
immoweb/node_modules/hexgrid-heatmap/docs/hexgrid-heatmap.png
generated
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 MiB |
37
immoweb/node_modules/hexgrid-heatmap/example/index.html
generated
vendored
Normal file
37
immoweb/node_modules/hexgrid-heatmap/example/index.html
generated
vendored
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
<!doctype html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Hexgrid Heatmap</title>
|
||||
|
||||
<script src='https://api.mapbox.com/mapbox-gl-js/v0.32.1/mapbox-gl.js'></script>
|
||||
<link href='https://api.mapbox.com/mapbox-gl-js/v0.32.1/mapbox-gl.css' rel='stylesheet' />
|
||||
|
||||
<script src='../dist/HexgridHeatmap.js'></script>
|
||||
<script src='sightseeing-pois.js'></script>
|
||||
</head>
|
||||
|
||||
<div id='map' style='width: 800px; height: 600px;'></div>
|
||||
<script>
|
||||
mapboxgl.accessToken = '<INSERT YOUR MAPBOX ACCESS TOKEN HERE>';
|
||||
var map = new mapboxgl.Map({
|
||||
container: 'map',
|
||||
style: 'mapbox://styles/mapbox/light-v9',
|
||||
zoom: 12,
|
||||
center: [-122.42534069839593, 37.77444125366313]
|
||||
});
|
||||
|
||||
map.on("load", function() {
|
||||
var heatmap = new HexgridHeatmap(map, "hexgrid-heatmap", "waterway-label");
|
||||
|
||||
heatmap.setIntensity(15);
|
||||
heatmap.setSpread(0.3);
|
||||
heatmap.setData(sightseeingPOIs);
|
||||
heatmap.update();
|
||||
heatmap.setColorStops([
|
||||
[0, "rgba(0,185,243,0)"],
|
||||
[50, "rgba(0,185,243,0.5)"],
|
||||
[130, "rgba(255,223,0,0.6)"],
|
||||
[200, "rgba(255,105,0,0.6)"]
|
||||
])
|
||||
});
|
||||
</script>
|
||||
7990
immoweb/node_modules/hexgrid-heatmap/example/sightseeing-pois.js
generated
vendored
Normal file
7990
immoweb/node_modules/hexgrid-heatmap/example/sightseeing-pois.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
1
immoweb/node_modules/hexgrid-heatmap/index.js
generated
vendored
Normal file
1
immoweb/node_modules/hexgrid-heatmap/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
window.HexgridHeatmap = require('./HexgridHeatmap');
|
||||
58
immoweb/node_modules/hexgrid-heatmap/package.json
generated
vendored
Normal file
58
immoweb/node_modules/hexgrid-heatmap/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
{
|
||||
"_from": "hexgrid-heatmap",
|
||||
"_id": "hexgrid-heatmap@0.1.2",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-5PNz1fe3e+e9IRzdQNBznnvQb0Q=",
|
||||
"_location": "/hexgrid-heatmap",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "tag",
|
||||
"registry": true,
|
||||
"raw": "hexgrid-heatmap",
|
||||
"name": "hexgrid-heatmap",
|
||||
"escapedName": "hexgrid-heatmap",
|
||||
"rawSpec": "",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "latest"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"#USER",
|
||||
"/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/hexgrid-heatmap/-/hexgrid-heatmap-0.1.2.tgz",
|
||||
"_shasum": "e4f373d5f7b77be7bd211cdd40d0739e7bd06f44",
|
||||
"_spec": "hexgrid-heatmap",
|
||||
"_where": "/home/kadir/workspace/webimmo",
|
||||
"author": {
|
||||
"name": "Sam Kronick",
|
||||
"email": "sam.kronick@mapbox.com",
|
||||
"url": "http://samkronick.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/kronick/HexgridHeatmap/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"@turf/center": "^3.10.3",
|
||||
"@turf/destination": "^3.10.3",
|
||||
"@turf/distance": "^3.10.3",
|
||||
"@turf/hex-grid": "^3.10.3",
|
||||
"rbush": "^2.0.1"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "A hexgrid-based heatmap layer for your Mapbox GL JS map",
|
||||
"homepage": "https://github.com/kronick/HexgridHeatmap#readme",
|
||||
"license": "ISC",
|
||||
"main": "HexgridHeatmap.js",
|
||||
"name": "hexgrid-heatmap",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/kronick/HexgridHeatmap.git"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "browserify index.js -o dist/HexgridHeatmap.js",
|
||||
"dev": "watchify index.js -o dist/HexgridHeatmap.js --verbose",
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"version": "0.1.2"
|
||||
}
|
||||
26
immoweb/node_modules/quickselect/README.md
generated
vendored
Normal file
26
immoweb/node_modules/quickselect/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
## quickselect
|
||||
|
||||
A tiny and fast [selection algorithm](https://en.wikipedia.org/wiki/Selection_algorithm) in JavaScript
|
||||
(specifically, [Floyd-Rivest selection](https://en.wikipedia.org/wiki/Floyd%E2%80%93Rivest_algorithm)).
|
||||
|
||||
```js
|
||||
quickselect(array, k[, left, right, compareFn]);
|
||||
```
|
||||
|
||||
Rearranges items so that all items in the `[left, k]` are the smallest.
|
||||
The `k`-th element will have the `(k - left + 1)`-th smallest value in `[left, right]`.
|
||||
|
||||
- `array`: the array to partially sort (in place)
|
||||
- `k`: middle index for partial sorting (as defined above)
|
||||
- `left`: left index of the range to sort (`0` by default)
|
||||
- `right`: right index (last index of the array by default)
|
||||
- `compareFn`: compare function
|
||||
|
||||
Example:
|
||||
|
||||
```js
|
||||
var arr = [65, 28, 59, 33, 21, 56, 22, 95, 50, 12, 90, 53, 28, 77, 39];
|
||||
quickselect(arr, 8);
|
||||
// [39, 28, 28, 33, 21, 12, 22, 50, 53, 56, 59, 65, 90, 77, 95]
|
||||
// ^^ 8th item
|
||||
```
|
||||
60
immoweb/node_modules/quickselect/index.js
generated
vendored
Normal file
60
immoweb/node_modules/quickselect/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
'use strict';
|
||||
|
||||
module.exports = partialSort;
|
||||
|
||||
// Floyd-Rivest selection algorithm:
|
||||
// Rearrange items so that all items in the [left, k] range are smaller than all items in (k, right];
|
||||
// The k-th element will have the (k - left + 1)th smallest value in [left, right]
|
||||
|
||||
function partialSort(arr, k, left, right, compare) {
|
||||
left = left || 0;
|
||||
right = right || (arr.length - 1);
|
||||
compare = compare || defaultCompare;
|
||||
|
||||
while (right > left) {
|
||||
if (right - left > 600) {
|
||||
var n = right - left + 1;
|
||||
var m = k - left + 1;
|
||||
var z = Math.log(n);
|
||||
var s = 0.5 * Math.exp(2 * z / 3);
|
||||
var sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (m - n / 2 < 0 ? -1 : 1);
|
||||
var newLeft = Math.max(left, Math.floor(k - m * s / n + sd));
|
||||
var newRight = Math.min(right, Math.floor(k + (n - m) * s / n + sd));
|
||||
partialSort(arr, k, newLeft, newRight, compare);
|
||||
}
|
||||
|
||||
var t = arr[k];
|
||||
var i = left;
|
||||
var j = right;
|
||||
|
||||
swap(arr, left, k);
|
||||
if (compare(arr[right], t) > 0) swap(arr, left, right);
|
||||
|
||||
while (i < j) {
|
||||
swap(arr, i, j);
|
||||
i++;
|
||||
j--;
|
||||
while (compare(arr[i], t) < 0) i++;
|
||||
while (compare(arr[j], t) > 0) j--;
|
||||
}
|
||||
|
||||
if (compare(arr[left], t) === 0) swap(arr, left, j);
|
||||
else {
|
||||
j++;
|
||||
swap(arr, j, right);
|
||||
}
|
||||
|
||||
if (j <= k) left = j + 1;
|
||||
if (k <= j) right = j - 1;
|
||||
}
|
||||
}
|
||||
|
||||
function swap(arr, i, j) {
|
||||
var tmp = arr[i];
|
||||
arr[i] = arr[j];
|
||||
arr[j] = tmp;
|
||||
}
|
||||
|
||||
function defaultCompare(a, b) {
|
||||
return a < b ? -1 : a > b ? 1 : 0;
|
||||
}
|
||||
54
immoweb/node_modules/quickselect/package.json
generated
vendored
Normal file
54
immoweb/node_modules/quickselect/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
{
|
||||
"_from": "quickselect@^1.0.0",
|
||||
"_id": "quickselect@1.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-AmMIGPmq5OyrJvAQP5jQYcF8WPM=",
|
||||
"_location": "/quickselect",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "quickselect@^1.0.0",
|
||||
"name": "quickselect",
|
||||
"escapedName": "quickselect",
|
||||
"rawSpec": "^1.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/rbush"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/quickselect/-/quickselect-1.0.0.tgz",
|
||||
"_shasum": "02630818f9aae4ecab26f0103f98d061c17c58f3",
|
||||
"_spec": "quickselect@^1.0.0",
|
||||
"_where": "/home/kadir/workspace/webimmo/node_modules/rbush",
|
||||
"author": {
|
||||
"name": "Vladimir Agafonkin"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {},
|
||||
"deprecated": false,
|
||||
"description": "A tiny and fast selection algorithm in JavaScript.",
|
||||
"devDependencies": {
|
||||
"eslint": "^2.1.0",
|
||||
"eslint-config-mourner": "^2.0.0",
|
||||
"tape": "^4.4.0"
|
||||
},
|
||||
"keywords": [
|
||||
"selection",
|
||||
"algorithm",
|
||||
"quickselect",
|
||||
"sort",
|
||||
"partial",
|
||||
"floyd",
|
||||
"rivest"
|
||||
],
|
||||
"license": "ISC",
|
||||
"main": "index.js",
|
||||
"name": "quickselect",
|
||||
"scripts": {
|
||||
"pretest": "eslint index.js test.js",
|
||||
"test": "tape test.js"
|
||||
},
|
||||
"version": "1.0.0"
|
||||
}
|
||||
11
immoweb/node_modules/quickselect/test.js
generated
vendored
Normal file
11
immoweb/node_modules/quickselect/test.js
generated
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
'use strict';
|
||||
|
||||
var test = require('tape').test;
|
||||
var quickselect = require('./');
|
||||
|
||||
test('selection', function (t) {
|
||||
var arr = [65, 28, 59, 33, 21, 56, 22, 95, 50, 12, 90, 53, 28, 77, 39];
|
||||
quickselect(arr, 8);
|
||||
t.deepEqual(arr, [39, 28, 28, 33, 21, 12, 22, 50, 53, 56, 59, 65, 90, 77, 95]);
|
||||
t.end();
|
||||
});
|
||||
4
immoweb/node_modules/rbush/.npmignore
generated
vendored
Normal file
4
immoweb/node_modules/rbush/.npmignore
generated
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
bench
|
||||
viz
|
||||
test
|
||||
.travis.yml
|
||||
19
immoweb/node_modules/rbush/MIT-LICENSE
generated
vendored
Normal file
19
immoweb/node_modules/rbush/MIT-LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
Copyright (c) 2016 Vladimir Agafonkin
|
||||
|
||||
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.
|
||||
278
immoweb/node_modules/rbush/README.md
generated
vendored
Normal file
278
immoweb/node_modules/rbush/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,278 @@
|
|||
RBush
|
||||
=====
|
||||
|
||||
RBush is a high-performance JavaScript library for 2D **spatial indexing** of points and rectangles.
|
||||
It's based on an optimized **R-tree** data structure with **bulk insertion** support.
|
||||
|
||||
*Spatial index* is a special data structure for points and rectangles
|
||||
that allows you to perform queries like "all items within this bounding box" very efficiently
|
||||
(e.g. hundreds of times faster than looping over all items).
|
||||
It's most commonly used in maps and data visualizations.
|
||||
|
||||
[](https://travis-ci.org/mourner/rbush)
|
||||
[](https://github.com/mourner/projects)
|
||||
|
||||
## Demos
|
||||
|
||||
The demos contain visualization of trees generated from 50k bulk-loaded random points.
|
||||
Open web console to see benchmarks;
|
||||
click on buttons to insert or remove items;
|
||||
click to perform search under the cursor.
|
||||
|
||||
* [uniformly distributed random data](http://mourner.github.io/rbush/viz/viz-uniform.html)
|
||||
* [randomly clustered data](http://mourner.github.io/rbush/viz/viz-cluster.html)
|
||||
|
||||
## Usage
|
||||
|
||||
### Creating a Tree
|
||||
|
||||
```js
|
||||
var tree = rbush(9);
|
||||
```
|
||||
|
||||
An optional argument to `rbush` defines the maximum number of entries in a tree node.
|
||||
It drastically affects the performance, so you should adjust it
|
||||
considering the type of data and search queries you perform.
|
||||
|
||||
### Adding Data
|
||||
|
||||
Insert an item:
|
||||
|
||||
```js
|
||||
var item = {
|
||||
minX: 20,
|
||||
minY: 40,
|
||||
maxX: 30,
|
||||
maxY: 50,
|
||||
foo: 'bar'
|
||||
};
|
||||
tree.insert(item);
|
||||
```
|
||||
|
||||
### Removing Data
|
||||
|
||||
Remove a previously inserted item:
|
||||
|
||||
```js
|
||||
tree.remove(item);
|
||||
```
|
||||
|
||||
By default, RBush removes objects by reference.
|
||||
However, you can pass a custom `equals` function to compare by value for removal,
|
||||
which is useful when you only have a copy of the object you need removed (e.g. loaded from server):
|
||||
|
||||
```js
|
||||
tree.remove(itemCopy, function (a, b) {
|
||||
return a.id === b.id;
|
||||
});
|
||||
|
||||
Remove all items:
|
||||
|
||||
```js
|
||||
tree.clear();
|
||||
```
|
||||
|
||||
### Data Format
|
||||
|
||||
By default, RBush assumes the format of data points to be an object
|
||||
with `minX`, `minY`, `maxX` and `maxY` properties.
|
||||
You can customize this by providing an array with corresponding accessor strings
|
||||
as a second argument to `rbush` like this:
|
||||
|
||||
```js
|
||||
var tree = rbush(9, ['[0]', '[1]', '[0]', '[1]']); // accept [x, y] points
|
||||
tree.insert([20, 50]);
|
||||
```
|
||||
|
||||
### Bulk-Inserting Data
|
||||
|
||||
Bulk-insert the given data into the tree:
|
||||
|
||||
```js
|
||||
tree.load([item1, item2, ...]);
|
||||
```
|
||||
|
||||
Bulk insertion is usually ~2-3 times faster than inserting items one by one.
|
||||
After bulk loading (bulk insertion into an empty tree),
|
||||
subsequent query performance is also ~20-30% better.
|
||||
|
||||
Note that when you do bulk insertion into an existing tree,
|
||||
it bulk-loads the given data into a separate tree
|
||||
and inserts the smaller tree into the larger tree.
|
||||
This means that bulk insertion works very well for clustered data
|
||||
(where items in one update are close to each other),
|
||||
but makes query performance worse if the data is scattered.
|
||||
|
||||
### Search
|
||||
|
||||
```js
|
||||
var result = tree.search({
|
||||
minX: 40,
|
||||
minY: 20,
|
||||
maxX: 80,
|
||||
maxY: 70
|
||||
});
|
||||
```
|
||||
|
||||
Returns an array of data items (points or rectangles) that the given bounding box intersects.
|
||||
|
||||
Note that the `search` method accepts a bounding box in `{minX, minY, maxX, maxY}` format
|
||||
regardless of the format specified in the constructor (which only affects inserted objects).
|
||||
|
||||
```js
|
||||
var allItems = tree.all();
|
||||
```
|
||||
|
||||
Returns all items of the tree.
|
||||
|
||||
### Collisions
|
||||
|
||||
```js
|
||||
var result = tree.collides({minX: 40, minY: 20, maxX: 80, maxY: 70});
|
||||
```
|
||||
|
||||
Returns `true` if there are any items intersecting the given bounding box, otherwise `false`.
|
||||
|
||||
|
||||
### Export and Import
|
||||
|
||||
```js
|
||||
// export data as JSON object
|
||||
var treeData = tree.toJSON();
|
||||
|
||||
// import previously exported data
|
||||
var tree = rbush(9).fromJSON(treeData);
|
||||
```
|
||||
|
||||
Importing and exporting as JSON allows you to use RBush on both the server (using Node.js) and the browser combined,
|
||||
e.g. first indexing the data on the server and and then importing the resulting tree data on the client for searching.
|
||||
|
||||
Note that the `nodeSize` option passed to the constructor must be the same in both trees for export/import to work properly.
|
||||
|
||||
### K-Nearest Neighbors
|
||||
|
||||
For "_k_ nearest neighbors around a point" type of queries for RBush,
|
||||
check out [rbush-knn](https://github.com/mourner/rbush-knn).
|
||||
|
||||
## Performance
|
||||
|
||||
The following sample performance test was done by generating
|
||||
random uniformly distributed rectangles of ~0.01% area and setting `maxEntries` to `16`
|
||||
(see `debug/perf.js` script).
|
||||
Performed with Node.js v6.2.2 on a Retina Macbook Pro 15 (mid-2012).
|
||||
|
||||
Test | RBush | [old RTree](https://github.com/imbcmdth/RTree) | Improvement
|
||||
---------------------------- | ------ | ------ | ----
|
||||
insert 1M items one by one | 3.18s | 7.83s | 2.5x
|
||||
1000 searches of 0.01% area | 0.03s | 0.93s | 30x
|
||||
1000 searches of 1% area | 0.35s | 2.27s | 6.5x
|
||||
1000 searches of 10% area | 2.18s | 9.53s | 4.4x
|
||||
remove 1000 items one by one | 0.02s | 1.18s | 50x
|
||||
bulk-insert 1M items | 1.25s | n/a | 6.7x
|
||||
|
||||
## Algorithms Used
|
||||
|
||||
* single insertion: non-recursive R-tree insertion with overlap minimizing split routine from R\*-tree (split is very effective in JS, while other R\*-tree modifications like reinsertion on overflow and overlap minimizing subtree search are too slow and not worth it)
|
||||
* single deletion: non-recursive R-tree deletion using depth-first tree traversal with free-at-empty strategy (entries in underflowed nodes are not reinserted, instead underflowed nodes are kept in the tree and deleted only when empty, which is a good compromise of query vs removal performance)
|
||||
* bulk loading: OMT algorithm (Overlap Minimizing Top-down Bulk Loading) combined with Floyd–Rivest selection algorithm
|
||||
* bulk insertion: STLT algorithm (Small-Tree-Large-Tree)
|
||||
* search: standard non-recursive R-tree search
|
||||
|
||||
## Papers
|
||||
|
||||
* [R-trees: a Dynamic Index Structure For Spatial Searching](http://www-db.deis.unibo.it/courses/SI-LS/papers/Gut84.pdf)
|
||||
* [The R*-tree: An Efficient and Robust Access Method for Points and Rectangles+](http://dbs.mathematik.uni-marburg.de/publications/myPapers/1990/BKSS90.pdf)
|
||||
* [OMT: Overlap Minimizing Top-down Bulk Loading Algorithm for R-tree](http://ftp.informatik.rwth-aachen.de/Publications/CEUR-WS/Vol-74/files/FORUM_18.pdf)
|
||||
* [Bulk Insertions into R-Trees Using the Small-Tree-Large-Tree Approach](http://www.cs.arizona.edu/~bkmoon/papers/dke06-bulk.pdf)
|
||||
* [R-Trees: Theory and Applications (book)](http://www.apress.com/9781852339777)
|
||||
|
||||
## Development
|
||||
|
||||
```bash
|
||||
npm install # install dependencies
|
||||
|
||||
npm test # check the code with JSHint and run tests
|
||||
npm run perf # run performance benchmarks
|
||||
npm run cov # report test coverage (with more detailed report in coverage/lcov-report/index.html)
|
||||
```
|
||||
|
||||
## Compatibility
|
||||
|
||||
RBush should run on Node and all major browsers. The only caveat: IE 8 needs an [Array#indexOf polyfill](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf#Polyfill) for `remove` method to work.
|
||||
|
||||
## Changelog
|
||||
|
||||
#### 2.0.1 — June 29, 2016
|
||||
|
||||
- Fixed browser builds in NPM.
|
||||
|
||||
#### 2.0.0 — June 29, 2016
|
||||
|
||||
- **Breaking:** changed the default format of inserted items from `[20, 40, 30, 50]` to `{minX: 20, minY: 40, maxX: 30, maxY: 50}`.
|
||||
- **Breaking:** changed the `search` method argument format from `[20, 40, 30, 50]` to `{minX: 20, minY: 40, maxX: 30, maxY: 50}`.
|
||||
- Improved performance by up to 30%.
|
||||
- Added `equalsFn` optional argument to `remove` to be able to remove by value rather than by reference.
|
||||
- Changed the source code to use CommonJS module format. Browser builds are automatically built and published to NPM.
|
||||
- Quickselect algorithm (used internally) is now a [separate module](https://github.com/mourner/quickselect).
|
||||
|
||||
#### 1.4.3 — May 17, 2016
|
||||
|
||||
- Fixed an error when inserting many empty bounding boxes.
|
||||
|
||||
#### 1.4.2 — Dec 16, 2015
|
||||
|
||||
- 50% faster insertion.
|
||||
|
||||
#### 1.4.1 — Sep 16, 2015
|
||||
|
||||
- Fixed insertion in IE8.
|
||||
|
||||
#### 1.4.0 — Apr 22, 2015
|
||||
|
||||
- Added `collides` method for fast collision detection.
|
||||
|
||||
#### 1.3.4 — Aug 31, 2014
|
||||
|
||||
- Improved bulk insertion performance for a large number of items (e.g. up to 100% for inserting a million items).
|
||||
- Fixed performance regression for high node sizes.
|
||||
|
||||
#### 1.3.3 — Aug 30, 2014
|
||||
|
||||
- Improved bulk insertion performance by ~60-70%.
|
||||
- Improved insertion performance by ~40%.
|
||||
- Improved search performance by ~30%.
|
||||
|
||||
#### 1.3.2 — Nov 25, 2013
|
||||
|
||||
- Improved removal performance by ~50%. [#18](https://github.com/mourner/rbush/pull/18)
|
||||
|
||||
#### 1.3.1 — Nov 24, 2013
|
||||
|
||||
- Fixed minor error in the choose split axis algorithm. [#17](https://github.com/mourner/rbush/pull/17)
|
||||
- Much better test coverage (near 100%). [#6](https://github.com/mourner/rbush/issues/6)
|
||||
|
||||
#### 1.3.0 — Nov 21, 2013
|
||||
|
||||
- Significantly improved search performance (especially on large-bbox queries — up to 3x faster). [#11](https://github.com/mourner/rbush/pull/11)
|
||||
- Added `all` method for getting all of the tree items. [#11](https://github.com/mourner/rbush/pull/11)
|
||||
- Made `toBBox`, `compareMinX`, `compareMinY` methods public, made it possible to avoid Content Security Policy issues by overriding them for custom format. [#14](https://github.com/mourner/rbush/pull/14) [#12](https://github.com/mourner/rbush/pull/12)
|
||||
|
||||
#### 1.2.5 — Nov 5, 2013
|
||||
|
||||
- Fixed a bug where insertion failed on a tree that had all items removed previously. [#10](https://github.com/mourner/rbush/issues/10)
|
||||
|
||||
#### 1.2.4 — Oct 25, 2013
|
||||
|
||||
- Added Web Workers support. [#9](https://github.com/mourner/rbush/pull/9)
|
||||
|
||||
#### 1.2.3 — Aug 30, 2013
|
||||
|
||||
- Added AMD support. [#8](https://github.com/mourner/rbush/pull/8)
|
||||
|
||||
#### 1.2.2 — Aug 27, 2013
|
||||
|
||||
- Eliminated recursion when recalculating node bboxes (on insert, remove, load).
|
||||
|
||||
#### 1.2.0 — Jul 19, 2013
|
||||
|
||||
First fully functional RBush release.
|
||||
1
immoweb/node_modules/rbush/coverage/coverage.json
generated
vendored
Normal file
1
immoweb/node_modules/rbush/coverage/coverage.json
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
212
immoweb/node_modules/rbush/coverage/lcov-report/base.css
generated
vendored
Normal file
212
immoweb/node_modules/rbush/coverage/lcov-report/base.css
generated
vendored
Normal file
|
|
@ -0,0 +1,212 @@
|
|||
body, html {
|
||||
margin:0; padding: 0;
|
||||
height: 100%;
|
||||
}
|
||||
body {
|
||||
font-family: Helvetica Neue, Helvetica, Arial;
|
||||
font-size: 14px;
|
||||
color:#333;
|
||||
}
|
||||
.small { font-size: 12px; }
|
||||
*, *:after, *:before {
|
||||
-webkit-box-sizing:border-box;
|
||||
-moz-box-sizing:border-box;
|
||||
box-sizing:border-box;
|
||||
}
|
||||
h1 { font-size: 20px; margin: 0;}
|
||||
h2 { font-size: 14px; }
|
||||
pre {
|
||||
font: 12px/1.4 Consolas, "Liberation Mono", Menlo, Courier, monospace;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
-moz-tab-size: 2;
|
||||
-o-tab-size: 2;
|
||||
tab-size: 2;
|
||||
}
|
||||
a { color:#0074D9; text-decoration:none; }
|
||||
a:hover { text-decoration:underline; }
|
||||
.strong { font-weight: bold; }
|
||||
.space-top1 { padding: 10px 0 0 0; }
|
||||
.pad2y { padding: 20px 0; }
|
||||
.pad1y { padding: 10px 0; }
|
||||
.pad2x { padding: 0 20px; }
|
||||
.pad2 { padding: 20px; }
|
||||
.pad1 { padding: 10px; }
|
||||
.space-left2 { padding-left:55px; }
|
||||
.space-right2 { padding-right:20px; }
|
||||
.center { text-align:center; }
|
||||
.clearfix { display:block; }
|
||||
.clearfix:after {
|
||||
content:'';
|
||||
display:block;
|
||||
height:0;
|
||||
clear:both;
|
||||
visibility:hidden;
|
||||
}
|
||||
.fl { float: left; }
|
||||
@media only screen and (max-width:640px) {
|
||||
.col3 { width:100%; max-width:100%; }
|
||||
.hide-mobile { display:none!important; }
|
||||
}
|
||||
|
||||
.quiet {
|
||||
color: #7f7f7f;
|
||||
color: rgba(0,0,0,0.5);
|
||||
}
|
||||
.quiet a { opacity: 0.7; }
|
||||
|
||||
.fraction {
|
||||
font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace;
|
||||
font-size: 10px;
|
||||
color: #555;
|
||||
background: #E8E8E8;
|
||||
padding: 4px 5px;
|
||||
border-radius: 3px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
div.path a:link, div.path a:visited { color: #333; }
|
||||
table.coverage {
|
||||
border-collapse: collapse;
|
||||
margin: 10px 0 0 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
table.coverage td {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
vertical-align: top;
|
||||
}
|
||||
table.coverage td.line-count {
|
||||
text-align: right;
|
||||
padding: 0 5px 0 20px;
|
||||
}
|
||||
table.coverage td.line-coverage {
|
||||
text-align: right;
|
||||
padding-right: 10px;
|
||||
min-width:20px;
|
||||
}
|
||||
|
||||
table.coverage td span.cline-any {
|
||||
display: inline-block;
|
||||
padding: 0 5px;
|
||||
width: 100%;
|
||||
}
|
||||
.missing-if-branch {
|
||||
display: inline-block;
|
||||
margin-right: 5px;
|
||||
border-radius: 3px;
|
||||
position: relative;
|
||||
padding: 0 4px;
|
||||
background: #333;
|
||||
color: yellow;
|
||||
}
|
||||
|
||||
.skip-if-branch {
|
||||
display: none;
|
||||
margin-right: 10px;
|
||||
position: relative;
|
||||
padding: 0 4px;
|
||||
background: #ccc;
|
||||
color: white;
|
||||
}
|
||||
.missing-if-branch .typ, .skip-if-branch .typ {
|
||||
color: inherit !important;
|
||||
}
|
||||
.coverage-summary {
|
||||
border-collapse: collapse;
|
||||
width: 100%;
|
||||
}
|
||||
.coverage-summary tr { border-bottom: 1px solid #bbb; }
|
||||
.keyline-all { border: 1px solid #ddd; }
|
||||
.coverage-summary td, .coverage-summary th { padding: 10px; }
|
||||
.coverage-summary tbody { border: 1px solid #bbb; }
|
||||
.coverage-summary td { border-right: 1px solid #bbb; }
|
||||
.coverage-summary td:last-child { border-right: none; }
|
||||
.coverage-summary th {
|
||||
text-align: left;
|
||||
font-weight: normal;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.coverage-summary th.file { border-right: none !important; }
|
||||
.coverage-summary th.pct { }
|
||||
.coverage-summary th.pic,
|
||||
.coverage-summary th.abs,
|
||||
.coverage-summary td.pct,
|
||||
.coverage-summary td.abs { text-align: right; }
|
||||
.coverage-summary td.file { white-space: nowrap; }
|
||||
.coverage-summary td.pic { min-width: 120px !important; }
|
||||
.coverage-summary tfoot td { }
|
||||
|
||||
.coverage-summary .sorter {
|
||||
height: 10px;
|
||||
width: 7px;
|
||||
display: inline-block;
|
||||
margin-left: 0.5em;
|
||||
background: url(sort-arrow-sprite.png) no-repeat scroll 0 0 transparent;
|
||||
}
|
||||
.coverage-summary .sorted .sorter {
|
||||
background-position: 0 -20px;
|
||||
}
|
||||
.coverage-summary .sorted-desc .sorter {
|
||||
background-position: 0 -10px;
|
||||
}
|
||||
.status-line { height: 10px; }
|
||||
/* dark red */
|
||||
.red.solid, .status-line.low, .low .cover-fill { background:#C21F39 }
|
||||
.low .chart { border:1px solid #C21F39 }
|
||||
/* medium red */
|
||||
.cstat-no, .fstat-no, .cbranch-no, .cbranch-no { background:#F6C6CE }
|
||||
/* light red */
|
||||
.low, .cline-no { background:#FCE1E5 }
|
||||
/* light green */
|
||||
.high, .cline-yes { background:rgb(230,245,208) }
|
||||
/* medium green */
|
||||
.cstat-yes { background:rgb(161,215,106) }
|
||||
/* dark green */
|
||||
.status-line.high, .high .cover-fill { background:rgb(77,146,33) }
|
||||
.high .chart { border:1px solid rgb(77,146,33) }
|
||||
|
||||
|
||||
.medium .chart { border:1px solid #666; }
|
||||
.medium .cover-fill { background: #666; }
|
||||
|
||||
.cbranch-no { background: yellow !important; color: #111; }
|
||||
|
||||
.cstat-skip { background: #ddd; color: #111; }
|
||||
.fstat-skip { background: #ddd; color: #111 !important; }
|
||||
.cbranch-skip { background: #ddd !important; color: #111; }
|
||||
|
||||
span.cline-neutral { background: #eaeaea; }
|
||||
.medium { background: #eaeaea; }
|
||||
|
||||
.cover-fill, .cover-empty {
|
||||
display:inline-block;
|
||||
height: 12px;
|
||||
}
|
||||
.chart {
|
||||
line-height: 0;
|
||||
}
|
||||
.cover-empty {
|
||||
background: white;
|
||||
}
|
||||
.cover-full {
|
||||
border-right: none !important;
|
||||
}
|
||||
pre.prettyprint {
|
||||
border: none !important;
|
||||
padding: 0 !important;
|
||||
margin: 0 !important;
|
||||
}
|
||||
.com { color: #999 !important; }
|
||||
.ignore-none { color: #999; font-weight: normal; }
|
||||
|
||||
.wrapper {
|
||||
min-height: 100%;
|
||||
height: auto !important;
|
||||
height: 100%;
|
||||
margin: 0 auto -48px;
|
||||
}
|
||||
.footer, .push {
|
||||
height: 48px;
|
||||
}
|
||||
93
immoweb/node_modules/rbush/coverage/lcov-report/index.html
generated
vendored
Normal file
93
immoweb/node_modules/rbush/coverage/lcov-report/index.html
generated
vendored
Normal file
|
|
@ -0,0 +1,93 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for All files</title>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="stylesheet" href="prettify.css" />
|
||||
<link rel="stylesheet" href="base.css" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<style type='text/css'>
|
||||
.coverage-summary .sorter {
|
||||
background-image: url(sort-arrow-sprite.png);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class='wrapper'>
|
||||
<div class='pad1'>
|
||||
<h1>
|
||||
/
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">97.38% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>260/267</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">98.37% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>121/123</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>37/37</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">97.15% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>239/246</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class='status-line high'></div>
|
||||
<div class="pad1">
|
||||
<table class="coverage-summary">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-col="file" data-fmt="html" data-html="true" class="file">File</th>
|
||||
<th data-col="pic" data-type="number" data-fmt="html" data-html="true" class="pic"></th>
|
||||
<th data-col="statements" data-type="number" data-fmt="pct" class="pct">Statements</th>
|
||||
<th data-col="statements_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
<th data-col="branches" data-type="number" data-fmt="pct" class="pct">Branches</th>
|
||||
<th data-col="branches_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
<th data-col="functions" data-type="number" data-fmt="pct" class="pct">Functions</th>
|
||||
<th data-col="functions_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
<th data-col="lines" data-type="number" data-fmt="pct" class="pct">Lines</th>
|
||||
<th data-col="lines_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody><tr>
|
||||
<td class="file high" data-value="rbush/"><a href="rbush/index.html">rbush/</a></td>
|
||||
<td data-value="97.38" class="pic high"><div class="chart"><div class="cover-fill" style="width: 97%;"></div><div class="cover-empty" style="width:3%;"></div></div></td>
|
||||
<td data-value="97.38" class="pct high">97.38%</td>
|
||||
<td data-value="267" class="abs high">260/267</td>
|
||||
<td data-value="98.37" class="pct high">98.37%</td>
|
||||
<td data-value="123" class="abs high">121/123</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="37" class="abs high">37/37</td>
|
||||
<td data-value="97.15" class="pct high">97.15%</td>
|
||||
<td data-value="246" class="abs high">239/246</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div><div class='push'></div><!-- for sticky footer -->
|
||||
</div><!-- /wrapper -->
|
||||
<div class='footer quiet pad2 space-top1 center small'>
|
||||
Code coverage
|
||||
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Wed Jun 29 2016 19:07:46 GMT+0300 (EEST)
|
||||
</div>
|
||||
</div>
|
||||
<script src="prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="sorter.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
1
immoweb/node_modules/rbush/coverage/lcov-report/prettify.css
generated
vendored
Normal file
1
immoweb/node_modules/rbush/coverage/lcov-report/prettify.css
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee}
|
||||
1
immoweb/node_modules/rbush/coverage/lcov-report/prettify.js
generated
vendored
Normal file
1
immoweb/node_modules/rbush/coverage/lcov-report/prettify.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
93
immoweb/node_modules/rbush/coverage/lcov-report/rbush/index.html
generated
vendored
Normal file
93
immoweb/node_modules/rbush/coverage/lcov-report/rbush/index.html
generated
vendored
Normal file
|
|
@ -0,0 +1,93 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for rbush/</title>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="stylesheet" href="../prettify.css" />
|
||||
<link rel="stylesheet" href="../base.css" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<style type='text/css'>
|
||||
.coverage-summary .sorter {
|
||||
background-image: url(../sort-arrow-sprite.png);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class='wrapper'>
|
||||
<div class='pad1'>
|
||||
<h1>
|
||||
<a href="../index.html">all files</a> rbush/
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">97.38% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>260/267</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">98.37% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>121/123</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>37/37</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">97.15% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>239/246</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class='status-line high'></div>
|
||||
<div class="pad1">
|
||||
<table class="coverage-summary">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-col="file" data-fmt="html" data-html="true" class="file">File</th>
|
||||
<th data-col="pic" data-type="number" data-fmt="html" data-html="true" class="pic"></th>
|
||||
<th data-col="statements" data-type="number" data-fmt="pct" class="pct">Statements</th>
|
||||
<th data-col="statements_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
<th data-col="branches" data-type="number" data-fmt="pct" class="pct">Branches</th>
|
||||
<th data-col="branches_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
<th data-col="functions" data-type="number" data-fmt="pct" class="pct">Functions</th>
|
||||
<th data-col="functions_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
<th data-col="lines" data-type="number" data-fmt="pct" class="pct">Lines</th>
|
||||
<th data-col="lines_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody><tr>
|
||||
<td class="file high" data-value="index.js"><a href="index.js.html">index.js</a></td>
|
||||
<td data-value="97.38" class="pic high"><div class="chart"><div class="cover-fill" style="width: 97%;"></div><div class="cover-empty" style="width:3%;"></div></div></td>
|
||||
<td data-value="97.38" class="pct high">97.38%</td>
|
||||
<td data-value="267" class="abs high">260/267</td>
|
||||
<td data-value="98.37" class="pct high">98.37%</td>
|
||||
<td data-value="123" class="abs high">121/123</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="37" class="abs high">37/37</td>
|
||||
<td data-value="97.15" class="pct high">97.15%</td>
|
||||
<td data-value="246" class="abs high">239/246</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div><div class='push'></div><!-- for sticky footer -->
|
||||
</div><!-- /wrapper -->
|
||||
<div class='footer quiet pad2 space-top1 center small'>
|
||||
Code coverage
|
||||
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Wed Jun 29 2016 19:07:46 GMT+0300 (EEST)
|
||||
</div>
|
||||
</div>
|
||||
<script src="../prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="../sorter.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
1748
immoweb/node_modules/rbush/coverage/lcov-report/rbush/index.js.html
generated
vendored
Normal file
1748
immoweb/node_modules/rbush/coverage/lcov-report/rbush/index.js.html
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
1928
immoweb/node_modules/rbush/coverage/lcov-report/rbush/rbush.js.html
generated
vendored
Normal file
1928
immoweb/node_modules/rbush/coverage/lcov-report/rbush/rbush.js.html
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
BIN
immoweb/node_modules/rbush/coverage/lcov-report/sort-arrow-sprite.png
generated
vendored
Normal file
BIN
immoweb/node_modules/rbush/coverage/lcov-report/sort-arrow-sprite.png
generated
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 209 B |
158
immoweb/node_modules/rbush/coverage/lcov-report/sorter.js
generated
vendored
Normal file
158
immoweb/node_modules/rbush/coverage/lcov-report/sorter.js
generated
vendored
Normal file
|
|
@ -0,0 +1,158 @@
|
|||
var addSorting = (function () {
|
||||
"use strict";
|
||||
var cols,
|
||||
currentSort = {
|
||||
index: 0,
|
||||
desc: false
|
||||
};
|
||||
|
||||
// returns the summary table element
|
||||
function getTable() { return document.querySelector('.coverage-summary'); }
|
||||
// returns the thead element of the summary table
|
||||
function getTableHeader() { return getTable().querySelector('thead tr'); }
|
||||
// returns the tbody element of the summary table
|
||||
function getTableBody() { return getTable().querySelector('tbody'); }
|
||||
// returns the th element for nth column
|
||||
function getNthColumn(n) { return getTableHeader().querySelectorAll('th')[n]; }
|
||||
|
||||
// loads all columns
|
||||
function loadColumns() {
|
||||
var colNodes = getTableHeader().querySelectorAll('th'),
|
||||
colNode,
|
||||
cols = [],
|
||||
col,
|
||||
i;
|
||||
|
||||
for (i = 0; i < colNodes.length; i += 1) {
|
||||
colNode = colNodes[i];
|
||||
col = {
|
||||
key: colNode.getAttribute('data-col'),
|
||||
sortable: !colNode.getAttribute('data-nosort'),
|
||||
type: colNode.getAttribute('data-type') || 'string'
|
||||
};
|
||||
cols.push(col);
|
||||
if (col.sortable) {
|
||||
col.defaultDescSort = col.type === 'number';
|
||||
colNode.innerHTML = colNode.innerHTML + '<span class="sorter"></span>';
|
||||
}
|
||||
}
|
||||
return cols;
|
||||
}
|
||||
// attaches a data attribute to every tr element with an object
|
||||
// of data values keyed by column name
|
||||
function loadRowData(tableRow) {
|
||||
var tableCols = tableRow.querySelectorAll('td'),
|
||||
colNode,
|
||||
col,
|
||||
data = {},
|
||||
i,
|
||||
val;
|
||||
for (i = 0; i < tableCols.length; i += 1) {
|
||||
colNode = tableCols[i];
|
||||
col = cols[i];
|
||||
val = colNode.getAttribute('data-value');
|
||||
if (col.type === 'number') {
|
||||
val = Number(val);
|
||||
}
|
||||
data[col.key] = val;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
// loads all row data
|
||||
function loadData() {
|
||||
var rows = getTableBody().querySelectorAll('tr'),
|
||||
i;
|
||||
|
||||
for (i = 0; i < rows.length; i += 1) {
|
||||
rows[i].data = loadRowData(rows[i]);
|
||||
}
|
||||
}
|
||||
// sorts the table using the data for the ith column
|
||||
function sortByIndex(index, desc) {
|
||||
var key = cols[index].key,
|
||||
sorter = function (a, b) {
|
||||
a = a.data[key];
|
||||
b = b.data[key];
|
||||
return a < b ? -1 : a > b ? 1 : 0;
|
||||
},
|
||||
finalSorter = sorter,
|
||||
tableBody = document.querySelector('.coverage-summary tbody'),
|
||||
rowNodes = tableBody.querySelectorAll('tr'),
|
||||
rows = [],
|
||||
i;
|
||||
|
||||
if (desc) {
|
||||
finalSorter = function (a, b) {
|
||||
return -1 * sorter(a, b);
|
||||
};
|
||||
}
|
||||
|
||||
for (i = 0; i < rowNodes.length; i += 1) {
|
||||
rows.push(rowNodes[i]);
|
||||
tableBody.removeChild(rowNodes[i]);
|
||||
}
|
||||
|
||||
rows.sort(finalSorter);
|
||||
|
||||
for (i = 0; i < rows.length; i += 1) {
|
||||
tableBody.appendChild(rows[i]);
|
||||
}
|
||||
}
|
||||
// removes sort indicators for current column being sorted
|
||||
function removeSortIndicators() {
|
||||
var col = getNthColumn(currentSort.index),
|
||||
cls = col.className;
|
||||
|
||||
cls = cls.replace(/ sorted$/, '').replace(/ sorted-desc$/, '');
|
||||
col.className = cls;
|
||||
}
|
||||
// adds sort indicators for current column being sorted
|
||||
function addSortIndicators() {
|
||||
getNthColumn(currentSort.index).className += currentSort.desc ? ' sorted-desc' : ' sorted';
|
||||
}
|
||||
// adds event listeners for all sorter widgets
|
||||
function enableUI() {
|
||||
var i,
|
||||
el,
|
||||
ithSorter = function ithSorter(i) {
|
||||
var col = cols[i];
|
||||
|
||||
return function () {
|
||||
var desc = col.defaultDescSort;
|
||||
|
||||
if (currentSort.index === i) {
|
||||
desc = !currentSort.desc;
|
||||
}
|
||||
sortByIndex(i, desc);
|
||||
removeSortIndicators();
|
||||
currentSort.index = i;
|
||||
currentSort.desc = desc;
|
||||
addSortIndicators();
|
||||
};
|
||||
};
|
||||
for (i =0 ; i < cols.length; i += 1) {
|
||||
if (cols[i].sortable) {
|
||||
// add the click event handler on the th so users
|
||||
// dont have to click on those tiny arrows
|
||||
el = getNthColumn(i).querySelector('.sorter').parentElement;
|
||||
if (el.addEventListener) {
|
||||
el.addEventListener('click', ithSorter(i));
|
||||
} else {
|
||||
el.attachEvent('onclick', ithSorter(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// adds sorting functionality to the UI
|
||||
return function () {
|
||||
if (!getTable()) {
|
||||
return;
|
||||
}
|
||||
cols = loadColumns();
|
||||
loadData(cols);
|
||||
addSortIndicators();
|
||||
enableUI();
|
||||
};
|
||||
})();
|
||||
|
||||
window.addEventListener('load', addSorting);
|
||||
452
immoweb/node_modules/rbush/coverage/lcov.info
generated
vendored
Normal file
452
immoweb/node_modules/rbush/coverage/lcov.info
generated
vendored
Normal file
|
|
@ -0,0 +1,452 @@
|
|||
TN:
|
||||
SF:/Users/mourner/projects/rbush/index.js
|
||||
FN:7,rbush
|
||||
FN:23,(anonymous_2)
|
||||
FN:27,(anonymous_3)
|
||||
FN:56,(anonymous_4)
|
||||
FN:83,(anonymous_5)
|
||||
FN:119,(anonymous_6)
|
||||
FN:124,(anonymous_7)
|
||||
FN:129,(anonymous_8)
|
||||
FN:178,(anonymous_9)
|
||||
FN:183,(anonymous_10)
|
||||
FN:185,(anonymous_11)
|
||||
FN:190,(anonymous_12)
|
||||
FN:201,(anonymous_13)
|
||||
FN:254,(anonymous_14)
|
||||
FN:291,(anonymous_15)
|
||||
FN:317,(anonymous_16)
|
||||
FN:338,(anonymous_17)
|
||||
FN:346,(anonymous_18)
|
||||
FN:379,(anonymous_19)
|
||||
FN:392,(anonymous_20)
|
||||
FN:417,(anonymous_21)
|
||||
FN:424,(anonymous_22)
|
||||
FN:438,(anonymous_23)
|
||||
FN:458,findItem
|
||||
FN:468,calcBBox
|
||||
FN:473,distBBox
|
||||
FN:488,extend
|
||||
FN:496,compareNodeMinX
|
||||
FN:497,compareNodeMinY
|
||||
FN:499,bboxArea
|
||||
FN:500,bboxMargin
|
||||
FN:502,enlargedArea
|
||||
FN:507,intersectionArea
|
||||
FN:517,contains
|
||||
FN:524,intersects
|
||||
FN:531,createNode
|
||||
FN:546,multiSelect
|
||||
FNF:37
|
||||
FNH:37
|
||||
FNDA:74,rbush
|
||||
FNDA:15,(anonymous_2)
|
||||
FNDA:8,(anonymous_3)
|
||||
FNDA:2,(anonymous_4)
|
||||
FNDA:34,(anonymous_5)
|
||||
FNDA:65,(anonymous_6)
|
||||
FNDA:39,(anonymous_7)
|
||||
FNDA:58,(anonymous_8)
|
||||
FNDA:2106,(anonymous_9)
|
||||
FNDA:19,(anonymous_10)
|
||||
FNDA:1,(anonymous_11)
|
||||
FNDA:18,(anonymous_12)
|
||||
FNDA:336,(anonymous_13)
|
||||
FNDA:66,(anonymous_14)
|
||||
FNDA:66,(anonymous_15)
|
||||
FNDA:27,(anonymous_16)
|
||||
FNDA:6,(anonymous_17)
|
||||
FNDA:27,(anonymous_18)
|
||||
FNDA:27,(anonymous_19)
|
||||
FNDA:54,(anonymous_20)
|
||||
FNDA:66,(anonymous_21)
|
||||
FNDA:56,(anonymous_22)
|
||||
FNDA:1,(anonymous_23)
|
||||
FNDA:81,findItem
|
||||
FNDA:547,calcBBox
|
||||
FNDA:765,distBBox
|
||||
FNDA:2925,extend
|
||||
FNDA:7247,compareNodeMinX
|
||||
FNDA:5618,compareNodeMinY
|
||||
FNDA:408,bboxArea
|
||||
FNDA:220,bboxMargin
|
||||
FNDA:298,enlargedArea
|
||||
FNDA:55,intersectionArea
|
||||
FNDA:151,contains
|
||||
FNDA:76,intersects
|
||||
FNDA:626,createNode
|
||||
FNDA:229,multiSelect
|
||||
DA:3,1
|
||||
DA:5,1
|
||||
DA:7,1
|
||||
DA:8,74
|
||||
DA:11,37
|
||||
DA:12,37
|
||||
DA:14,37
|
||||
DA:15,1
|
||||
DA:18,37
|
||||
DA:21,1
|
||||
DA:24,15
|
||||
DA:29,8
|
||||
DA:33,8
|
||||
DA:35,7
|
||||
DA:38,7
|
||||
DA:39,15
|
||||
DA:41,58
|
||||
DA:42,58
|
||||
DA:44,58
|
||||
DA:45,35
|
||||
DA:46,11
|
||||
DA:47,8
|
||||
DA:50,15
|
||||
DA:53,7
|
||||
DA:58,2
|
||||
DA:61,2
|
||||
DA:63,1
|
||||
DA:66,1
|
||||
DA:67,3
|
||||
DA:69,8
|
||||
DA:70,8
|
||||
DA:72,8
|
||||
DA:73,6
|
||||
DA:74,5
|
||||
DA:77,2
|
||||
DA:80,0
|
||||
DA:84,34
|
||||
DA:86,33
|
||||
DA:87,1
|
||||
DA:88,3
|
||||
DA:90,1
|
||||
DA:94,32
|
||||
DA:96,32
|
||||
DA:98,29
|
||||
DA:100,3
|
||||
DA:102,1
|
||||
DA:105,2
|
||||
DA:107,1
|
||||
DA:108,1
|
||||
DA:109,1
|
||||
DA:113,2
|
||||
DA:116,32
|
||||
DA:120,65
|
||||
DA:121,65
|
||||
DA:125,39
|
||||
DA:126,39
|
||||
DA:130,58
|
||||
DA:132,57
|
||||
DA:139,57
|
||||
DA:141,216
|
||||
DA:142,0
|
||||
DA:143,0
|
||||
DA:144,0
|
||||
DA:145,0
|
||||
DA:148,216
|
||||
DA:149,81
|
||||
DA:151,81
|
||||
DA:153,56
|
||||
DA:154,56
|
||||
DA:155,56
|
||||
DA:156,56
|
||||
DA:160,160
|
||||
DA:161,111
|
||||
DA:162,111
|
||||
DA:163,111
|
||||
DA:164,111
|
||||
DA:165,111
|
||||
DA:167,49
|
||||
DA:168,48
|
||||
DA:169,48
|
||||
DA:170,48
|
||||
DA:172,1
|
||||
DA:175,1
|
||||
DA:178,2106
|
||||
DA:183,19
|
||||
DA:186,1
|
||||
DA:187,1
|
||||
DA:191,18
|
||||
DA:192,18
|
||||
DA:193,237
|
||||
DA:194,62
|
||||
DA:196,237
|
||||
DA:198,18
|
||||
DA:203,336
|
||||
DA:207,336
|
||||
DA:209,259
|
||||
DA:210,259
|
||||
DA:211,259
|
||||
DA:214,77
|
||||
DA:216,29
|
||||
DA:219,29
|
||||
DA:222,77
|
||||
DA:223,77
|
||||
DA:224,77
|
||||
DA:228,77
|
||||
DA:232,77
|
||||
DA:234,77
|
||||
DA:236,152
|
||||
DA:238,152
|
||||
DA:240,152
|
||||
DA:242,304
|
||||
DA:245,304
|
||||
DA:249,77
|
||||
DA:251,77
|
||||
DA:256,66
|
||||
DA:258,66
|
||||
DA:259,156
|
||||
DA:261,156
|
||||
DA:263,90
|
||||
DA:265,90
|
||||
DA:266,298
|
||||
DA:267,298
|
||||
DA:268,298
|
||||
DA:271,298
|
||||
DA:272,182
|
||||
DA:273,182
|
||||
DA:274,182
|
||||
DA:276,116
|
||||
DA:278,1
|
||||
DA:279,0
|
||||
DA:280,0
|
||||
DA:285,90
|
||||
DA:288,66
|
||||
DA:293,66
|
||||
DA:298,66
|
||||
DA:301,66
|
||||
DA:302,66
|
||||
DA:305,66
|
||||
DA:306,88
|
||||
DA:307,27
|
||||
DA:308,27
|
||||
DA:309,61
|
||||
DA:313,66
|
||||
DA:319,27
|
||||
DA:323,27
|
||||
DA:325,27
|
||||
DA:327,27
|
||||
DA:328,27
|
||||
DA:329,27
|
||||
DA:331,27
|
||||
DA:332,27
|
||||
DA:334,27
|
||||
DA:335,5
|
||||
DA:340,6
|
||||
DA:341,6
|
||||
DA:342,6
|
||||
DA:343,6
|
||||
DA:348,27
|
||||
DA:350,27
|
||||
DA:352,27
|
||||
DA:353,55
|
||||
DA:354,55
|
||||
DA:356,55
|
||||
DA:357,55
|
||||
DA:360,55
|
||||
DA:361,28
|
||||
DA:362,28
|
||||
DA:364,28
|
||||
DA:366,27
|
||||
DA:368,26
|
||||
DA:369,8
|
||||
DA:370,8
|
||||
DA:375,27
|
||||
DA:381,27
|
||||
DA:388,27
|
||||
DA:394,54
|
||||
DA:396,54
|
||||
DA:402,54
|
||||
DA:403,56
|
||||
DA:404,56
|
||||
DA:405,56
|
||||
DA:408,54
|
||||
DA:409,56
|
||||
DA:410,56
|
||||
DA:411,56
|
||||
DA:414,54
|
||||
DA:419,66
|
||||
DA:420,129
|
||||
DA:426,56
|
||||
DA:427,167
|
||||
DA:428,16
|
||||
DA:429,15
|
||||
DA:430,15
|
||||
DA:432,1
|
||||
DA:434,151
|
||||
DA:445,1
|
||||
DA:447,1
|
||||
DA:448,1
|
||||
DA:450,1
|
||||
DA:458,1
|
||||
DA:459,81
|
||||
DA:461,3
|
||||
DA:462,9
|
||||
DA:464,2
|
||||
DA:468,1
|
||||
DA:469,547
|
||||
DA:473,1
|
||||
DA:474,765
|
||||
DA:475,765
|
||||
DA:476,765
|
||||
DA:477,765
|
||||
DA:478,765
|
||||
DA:480,765
|
||||
DA:481,2618
|
||||
DA:482,2618
|
||||
DA:485,765
|
||||
DA:488,1
|
||||
DA:489,2925
|
||||
DA:490,2925
|
||||
DA:491,2925
|
||||
DA:492,2925
|
||||
DA:493,2925
|
||||
DA:496,7247
|
||||
DA:497,5618
|
||||
DA:499,408
|
||||
DA:500,220
|
||||
DA:502,1
|
||||
DA:503,298
|
||||
DA:507,1
|
||||
DA:508,55
|
||||
DA:513,55
|
||||
DA:517,1
|
||||
DA:518,151
|
||||
DA:524,1
|
||||
DA:525,76
|
||||
DA:531,1
|
||||
DA:532,626
|
||||
DA:546,1
|
||||
DA:547,229
|
||||
DA:550,229
|
||||
DA:551,683
|
||||
DA:552,683
|
||||
DA:554,683
|
||||
DA:556,227
|
||||
DA:557,227
|
||||
DA:559,227
|
||||
LF:246
|
||||
LH:239
|
||||
BRDA:8,1,0,37
|
||||
BRDA:8,1,1,37
|
||||
BRDA:11,2,0,37
|
||||
BRDA:11,2,1,11
|
||||
BRDA:14,3,0,1
|
||||
BRDA:14,3,1,36
|
||||
BRDA:33,4,0,1
|
||||
BRDA:33,4,1,7
|
||||
BRDA:42,5,0,40
|
||||
BRDA:42,5,1,18
|
||||
BRDA:44,6,0,35
|
||||
BRDA:44,6,1,23
|
||||
BRDA:45,7,0,24
|
||||
BRDA:45,7,1,11
|
||||
BRDA:46,8,0,3
|
||||
BRDA:46,8,1,8
|
||||
BRDA:61,9,0,1
|
||||
BRDA:61,9,1,1
|
||||
BRDA:70,10,0,1
|
||||
BRDA:70,10,1,7
|
||||
BRDA:72,11,0,6
|
||||
BRDA:72,11,1,2
|
||||
BRDA:73,12,0,1
|
||||
BRDA:73,12,1,5
|
||||
BRDA:73,13,0,6
|
||||
BRDA:73,13,1,5
|
||||
BRDA:84,14,0,1
|
||||
BRDA:84,14,1,33
|
||||
BRDA:84,15,0,34
|
||||
BRDA:84,15,1,34
|
||||
BRDA:86,16,0,1
|
||||
BRDA:86,16,1,32
|
||||
BRDA:96,17,0,29
|
||||
BRDA:96,17,1,3
|
||||
BRDA:100,18,0,1
|
||||
BRDA:100,18,1,2
|
||||
BRDA:105,19,0,1
|
||||
BRDA:105,19,1,1
|
||||
BRDA:120,20,0,64
|
||||
BRDA:120,20,1,1
|
||||
BRDA:130,21,0,1
|
||||
BRDA:130,21,1,57
|
||||
BRDA:139,22,0,217
|
||||
BRDA:139,22,1,1
|
||||
BRDA:141,23,0,0
|
||||
BRDA:141,23,1,216
|
||||
BRDA:148,24,0,81
|
||||
BRDA:148,24,1,135
|
||||
BRDA:151,25,0,56
|
||||
BRDA:151,25,1,25
|
||||
BRDA:160,26,0,111
|
||||
BRDA:160,26,1,49
|
||||
BRDA:160,27,0,160
|
||||
BRDA:160,27,1,160
|
||||
BRDA:160,27,2,135
|
||||
BRDA:167,28,0,48
|
||||
BRDA:167,28,1,1
|
||||
BRDA:193,29,0,175
|
||||
BRDA:193,29,1,62
|
||||
BRDA:207,30,0,259
|
||||
BRDA:207,30,1,77
|
||||
BRDA:214,31,0,29
|
||||
BRDA:214,31,1,48
|
||||
BRDA:261,32,0,66
|
||||
BRDA:261,32,1,90
|
||||
BRDA:261,33,0,156
|
||||
BRDA:261,33,1,92
|
||||
BRDA:271,34,0,182
|
||||
BRDA:271,34,1,116
|
||||
BRDA:273,35,0,117
|
||||
BRDA:273,35,1,65
|
||||
BRDA:276,36,0,1
|
||||
BRDA:276,36,1,115
|
||||
BRDA:278,37,0,0
|
||||
BRDA:278,37,1,1
|
||||
BRDA:285,38,0,90
|
||||
BRDA:285,38,1,1
|
||||
BRDA:294,39,0,2
|
||||
BRDA:294,39,1,64
|
||||
BRDA:306,40,0,27
|
||||
BRDA:306,40,1,61
|
||||
BRDA:334,41,0,22
|
||||
BRDA:334,41,1,5
|
||||
BRDA:360,42,0,28
|
||||
BRDA:360,42,1,27
|
||||
BRDA:364,43,0,27
|
||||
BRDA:364,43,1,1
|
||||
BRDA:366,44,0,26
|
||||
BRDA:366,44,1,1
|
||||
BRDA:368,45,0,8
|
||||
BRDA:368,45,1,18
|
||||
BRDA:381,46,0,21
|
||||
BRDA:381,46,1,6
|
||||
BRDA:382,47,0,21
|
||||
BRDA:382,47,1,6
|
||||
BRDA:388,48,0,17
|
||||
BRDA:388,48,1,10
|
||||
BRDA:404,49,0,44
|
||||
BRDA:404,49,1,12
|
||||
BRDA:410,50,0,44
|
||||
BRDA:410,50,1,12
|
||||
BRDA:427,51,0,16
|
||||
BRDA:427,51,1,151
|
||||
BRDA:428,52,0,15
|
||||
BRDA:428,52,1,1
|
||||
BRDA:459,53,0,78
|
||||
BRDA:459,53,1,3
|
||||
BRDA:462,54,0,1
|
||||
BRDA:462,54,1,8
|
||||
BRDA:474,55,0,218
|
||||
BRDA:474,55,1,547
|
||||
BRDA:482,56,0,1880
|
||||
BRDA:482,56,1,738
|
||||
BRDA:518,57,0,151
|
||||
BRDA:518,57,1,143
|
||||
BRDA:518,57,2,123
|
||||
BRDA:518,57,3,117
|
||||
BRDA:525,58,0,76
|
||||
BRDA:525,58,1,68
|
||||
BRDA:525,58,2,62
|
||||
BRDA:525,58,3,54
|
||||
BRDA:554,59,0,456
|
||||
BRDA:554,59,1,227
|
||||
BRF:123
|
||||
BRH:121
|
||||
end_of_record
|
||||
561
immoweb/node_modules/rbush/index.js
generated
vendored
Normal file
561
immoweb/node_modules/rbush/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,561 @@
|
|||
'use strict';
|
||||
|
||||
module.exports = rbush;
|
||||
|
||||
var quickselect = require('quickselect');
|
||||
|
||||
function rbush(maxEntries, format) {
|
||||
if (!(this instanceof rbush)) return new rbush(maxEntries, format);
|
||||
|
||||
// max entries in a node is 9 by default; min node fill is 40% for best performance
|
||||
this._maxEntries = Math.max(4, maxEntries || 9);
|
||||
this._minEntries = Math.max(2, Math.ceil(this._maxEntries * 0.4));
|
||||
|
||||
if (format) {
|
||||
this._initFormat(format);
|
||||
}
|
||||
|
||||
this.clear();
|
||||
}
|
||||
|
||||
rbush.prototype = {
|
||||
|
||||
all: function () {
|
||||
return this._all(this.data, []);
|
||||
},
|
||||
|
||||
search: function (bbox) {
|
||||
|
||||
var node = this.data,
|
||||
result = [],
|
||||
toBBox = this.toBBox;
|
||||
|
||||
if (!intersects(bbox, node)) return result;
|
||||
|
||||
var nodesToSearch = [],
|
||||
i, len, child, childBBox;
|
||||
|
||||
while (node) {
|
||||
for (i = 0, len = node.children.length; i < len; i++) {
|
||||
|
||||
child = node.children[i];
|
||||
childBBox = node.leaf ? toBBox(child) : child;
|
||||
|
||||
if (intersects(bbox, childBBox)) {
|
||||
if (node.leaf) result.push(child);
|
||||
else if (contains(bbox, childBBox)) this._all(child, result);
|
||||
else nodesToSearch.push(child);
|
||||
}
|
||||
}
|
||||
node = nodesToSearch.pop();
|
||||
}
|
||||
|
||||
return result;
|
||||
},
|
||||
|
||||
collides: function (bbox) {
|
||||
|
||||
var node = this.data,
|
||||
toBBox = this.toBBox;
|
||||
|
||||
if (!intersects(bbox, node)) return false;
|
||||
|
||||
var nodesToSearch = [],
|
||||
i, len, child, childBBox;
|
||||
|
||||
while (node) {
|
||||
for (i = 0, len = node.children.length; i < len; i++) {
|
||||
|
||||
child = node.children[i];
|
||||
childBBox = node.leaf ? toBBox(child) : child;
|
||||
|
||||
if (intersects(bbox, childBBox)) {
|
||||
if (node.leaf || contains(bbox, childBBox)) return true;
|
||||
nodesToSearch.push(child);
|
||||
}
|
||||
}
|
||||
node = nodesToSearch.pop();
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
load: function (data) {
|
||||
if (!(data && data.length)) return this;
|
||||
|
||||
if (data.length < this._minEntries) {
|
||||
for (var i = 0, len = data.length; i < len; i++) {
|
||||
this.insert(data[i]);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
// recursively build the tree with the given data from stratch using OMT algorithm
|
||||
var node = this._build(data.slice(), 0, data.length - 1, 0);
|
||||
|
||||
if (!this.data.children.length) {
|
||||
// save as is if tree is empty
|
||||
this.data = node;
|
||||
|
||||
} else if (this.data.height === node.height) {
|
||||
// split root if trees have the same height
|
||||
this._splitRoot(this.data, node);
|
||||
|
||||
} else {
|
||||
if (this.data.height < node.height) {
|
||||
// swap trees if inserted one is bigger
|
||||
var tmpNode = this.data;
|
||||
this.data = node;
|
||||
node = tmpNode;
|
||||
}
|
||||
|
||||
// insert the small tree into the large tree at appropriate level
|
||||
this._insert(node, this.data.height - node.height - 1, true);
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
insert: function (item) {
|
||||
if (item) this._insert(item, this.data.height - 1);
|
||||
return this;
|
||||
},
|
||||
|
||||
clear: function () {
|
||||
this.data = createNode([]);
|
||||
return this;
|
||||
},
|
||||
|
||||
remove: function (item, equalsFn) {
|
||||
if (!item) return this;
|
||||
|
||||
var node = this.data,
|
||||
bbox = this.toBBox(item),
|
||||
path = [],
|
||||
indexes = [],
|
||||
i, parent, index, goingUp;
|
||||
|
||||
// depth-first iterative tree traversal
|
||||
while (node || path.length) {
|
||||
|
||||
if (!node) { // go up
|
||||
node = path.pop();
|
||||
parent = path[path.length - 1];
|
||||
i = indexes.pop();
|
||||
goingUp = true;
|
||||
}
|
||||
|
||||
if (node.leaf) { // check current node
|
||||
index = findItem(item, node.children, equalsFn);
|
||||
|
||||
if (index !== -1) {
|
||||
// item found, remove the item and condense tree upwards
|
||||
node.children.splice(index, 1);
|
||||
path.push(node);
|
||||
this._condense(path);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
if (!goingUp && !node.leaf && contains(node, bbox)) { // go down
|
||||
path.push(node);
|
||||
indexes.push(i);
|
||||
i = 0;
|
||||
parent = node;
|
||||
node = node.children[0];
|
||||
|
||||
} else if (parent) { // go right
|
||||
i++;
|
||||
node = parent.children[i];
|
||||
goingUp = false;
|
||||
|
||||
} else node = null; // nothing found
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
toBBox: function (item) { return item; },
|
||||
|
||||
compareMinX: compareNodeMinX,
|
||||
compareMinY: compareNodeMinY,
|
||||
|
||||
toJSON: function () { return this.data; },
|
||||
|
||||
fromJSON: function (data) {
|
||||
this.data = data;
|
||||
return this;
|
||||
},
|
||||
|
||||
_all: function (node, result) {
|
||||
var nodesToSearch = [];
|
||||
while (node) {
|
||||
if (node.leaf) result.push.apply(result, node.children);
|
||||
else nodesToSearch.push.apply(nodesToSearch, node.children);
|
||||
|
||||
node = nodesToSearch.pop();
|
||||
}
|
||||
return result;
|
||||
},
|
||||
|
||||
_build: function (items, left, right, height) {
|
||||
|
||||
var N = right - left + 1,
|
||||
M = this._maxEntries,
|
||||
node;
|
||||
|
||||
if (N <= M) {
|
||||
// reached leaf level; return leaf
|
||||
node = createNode(items.slice(left, right + 1));
|
||||
calcBBox(node, this.toBBox);
|
||||
return node;
|
||||
}
|
||||
|
||||
if (!height) {
|
||||
// target height of the bulk-loaded tree
|
||||
height = Math.ceil(Math.log(N) / Math.log(M));
|
||||
|
||||
// target number of root entries to maximize storage utilization
|
||||
M = Math.ceil(N / Math.pow(M, height - 1));
|
||||
}
|
||||
|
||||
node = createNode([]);
|
||||
node.leaf = false;
|
||||
node.height = height;
|
||||
|
||||
// split the items into M mostly square tiles
|
||||
|
||||
var N2 = Math.ceil(N / M),
|
||||
N1 = N2 * Math.ceil(Math.sqrt(M)),
|
||||
i, j, right2, right3;
|
||||
|
||||
multiSelect(items, left, right, N1, this.compareMinX);
|
||||
|
||||
for (i = left; i <= right; i += N1) {
|
||||
|
||||
right2 = Math.min(i + N1 - 1, right);
|
||||
|
||||
multiSelect(items, i, right2, N2, this.compareMinY);
|
||||
|
||||
for (j = i; j <= right2; j += N2) {
|
||||
|
||||
right3 = Math.min(j + N2 - 1, right2);
|
||||
|
||||
// pack each entry recursively
|
||||
node.children.push(this._build(items, j, right3, height - 1));
|
||||
}
|
||||
}
|
||||
|
||||
calcBBox(node, this.toBBox);
|
||||
|
||||
return node;
|
||||
},
|
||||
|
||||
_chooseSubtree: function (bbox, node, level, path) {
|
||||
|
||||
var i, len, child, targetNode, area, enlargement, minArea, minEnlargement;
|
||||
|
||||
while (true) {
|
||||
path.push(node);
|
||||
|
||||
if (node.leaf || path.length - 1 === level) break;
|
||||
|
||||
minArea = minEnlargement = Infinity;
|
||||
|
||||
for (i = 0, len = node.children.length; i < len; i++) {
|
||||
child = node.children[i];
|
||||
area = bboxArea(child);
|
||||
enlargement = enlargedArea(bbox, child) - area;
|
||||
|
||||
// choose entry with the least area enlargement
|
||||
if (enlargement < minEnlargement) {
|
||||
minEnlargement = enlargement;
|
||||
minArea = area < minArea ? area : minArea;
|
||||
targetNode = child;
|
||||
|
||||
} else if (enlargement === minEnlargement) {
|
||||
// otherwise choose one with the smallest area
|
||||
if (area < minArea) {
|
||||
minArea = area;
|
||||
targetNode = child;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
node = targetNode || node.children[0];
|
||||
}
|
||||
|
||||
return node;
|
||||
},
|
||||
|
||||
_insert: function (item, level, isNode) {
|
||||
|
||||
var toBBox = this.toBBox,
|
||||
bbox = isNode ? item : toBBox(item),
|
||||
insertPath = [];
|
||||
|
||||
// find the best node for accommodating the item, saving all nodes along the path too
|
||||
var node = this._chooseSubtree(bbox, this.data, level, insertPath);
|
||||
|
||||
// put the item into the node
|
||||
node.children.push(item);
|
||||
extend(node, bbox);
|
||||
|
||||
// split on node overflow; propagate upwards if necessary
|
||||
while (level >= 0) {
|
||||
if (insertPath[level].children.length > this._maxEntries) {
|
||||
this._split(insertPath, level);
|
||||
level--;
|
||||
} else break;
|
||||
}
|
||||
|
||||
// adjust bboxes along the insertion path
|
||||
this._adjustParentBBoxes(bbox, insertPath, level);
|
||||
},
|
||||
|
||||
// split overflowed node into two
|
||||
_split: function (insertPath, level) {
|
||||
|
||||
var node = insertPath[level],
|
||||
M = node.children.length,
|
||||
m = this._minEntries;
|
||||
|
||||
this._chooseSplitAxis(node, m, M);
|
||||
|
||||
var splitIndex = this._chooseSplitIndex(node, m, M);
|
||||
|
||||
var newNode = createNode(node.children.splice(splitIndex, node.children.length - splitIndex));
|
||||
newNode.height = node.height;
|
||||
newNode.leaf = node.leaf;
|
||||
|
||||
calcBBox(node, this.toBBox);
|
||||
calcBBox(newNode, this.toBBox);
|
||||
|
||||
if (level) insertPath[level - 1].children.push(newNode);
|
||||
else this._splitRoot(node, newNode);
|
||||
},
|
||||
|
||||
_splitRoot: function (node, newNode) {
|
||||
// split root node
|
||||
this.data = createNode([node, newNode]);
|
||||
this.data.height = node.height + 1;
|
||||
this.data.leaf = false;
|
||||
calcBBox(this.data, this.toBBox);
|
||||
},
|
||||
|
||||
_chooseSplitIndex: function (node, m, M) {
|
||||
|
||||
var i, bbox1, bbox2, overlap, area, minOverlap, minArea, index;
|
||||
|
||||
minOverlap = minArea = Infinity;
|
||||
|
||||
for (i = m; i <= M - m; i++) {
|
||||
bbox1 = distBBox(node, 0, i, this.toBBox);
|
||||
bbox2 = distBBox(node, i, M, this.toBBox);
|
||||
|
||||
overlap = intersectionArea(bbox1, bbox2);
|
||||
area = bboxArea(bbox1) + bboxArea(bbox2);
|
||||
|
||||
// choose distribution with minimum overlap
|
||||
if (overlap < minOverlap) {
|
||||
minOverlap = overlap;
|
||||
index = i;
|
||||
|
||||
minArea = area < minArea ? area : minArea;
|
||||
|
||||
} else if (overlap === minOverlap) {
|
||||
// otherwise choose distribution with minimum area
|
||||
if (area < minArea) {
|
||||
minArea = area;
|
||||
index = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return index;
|
||||
},
|
||||
|
||||
// sorts node children by the best axis for split
|
||||
_chooseSplitAxis: function (node, m, M) {
|
||||
|
||||
var compareMinX = node.leaf ? this.compareMinX : compareNodeMinX,
|
||||
compareMinY = node.leaf ? this.compareMinY : compareNodeMinY,
|
||||
xMargin = this._allDistMargin(node, m, M, compareMinX),
|
||||
yMargin = this._allDistMargin(node, m, M, compareMinY);
|
||||
|
||||
// if total distributions margin value is minimal for x, sort by minX,
|
||||
// otherwise it's already sorted by minY
|
||||
if (xMargin < yMargin) node.children.sort(compareMinX);
|
||||
},
|
||||
|
||||
// total margin of all possible split distributions where each node is at least m full
|
||||
_allDistMargin: function (node, m, M, compare) {
|
||||
|
||||
node.children.sort(compare);
|
||||
|
||||
var toBBox = this.toBBox,
|
||||
leftBBox = distBBox(node, 0, m, toBBox),
|
||||
rightBBox = distBBox(node, M - m, M, toBBox),
|
||||
margin = bboxMargin(leftBBox) + bboxMargin(rightBBox),
|
||||
i, child;
|
||||
|
||||
for (i = m; i < M - m; i++) {
|
||||
child = node.children[i];
|
||||
extend(leftBBox, node.leaf ? toBBox(child) : child);
|
||||
margin += bboxMargin(leftBBox);
|
||||
}
|
||||
|
||||
for (i = M - m - 1; i >= m; i--) {
|
||||
child = node.children[i];
|
||||
extend(rightBBox, node.leaf ? toBBox(child) : child);
|
||||
margin += bboxMargin(rightBBox);
|
||||
}
|
||||
|
||||
return margin;
|
||||
},
|
||||
|
||||
_adjustParentBBoxes: function (bbox, path, level) {
|
||||
// adjust bboxes along the given tree path
|
||||
for (var i = level; i >= 0; i--) {
|
||||
extend(path[i], bbox);
|
||||
}
|
||||
},
|
||||
|
||||
_condense: function (path) {
|
||||
// go through the path, removing empty nodes and updating bboxes
|
||||
for (var i = path.length - 1, siblings; i >= 0; i--) {
|
||||
if (path[i].children.length === 0) {
|
||||
if (i > 0) {
|
||||
siblings = path[i - 1].children;
|
||||
siblings.splice(siblings.indexOf(path[i]), 1);
|
||||
|
||||
} else this.clear();
|
||||
|
||||
} else calcBBox(path[i], this.toBBox);
|
||||
}
|
||||
},
|
||||
|
||||
_initFormat: function (format) {
|
||||
// data format (minX, minY, maxX, maxY accessors)
|
||||
|
||||
// uses eval-type function compilation instead of just accepting a toBBox function
|
||||
// because the algorithms are very sensitive to sorting functions performance,
|
||||
// so they should be dead simple and without inner calls
|
||||
|
||||
var compareArr = ['return a', ' - b', ';'];
|
||||
|
||||
this.compareMinX = new Function('a', 'b', compareArr.join(format[0]));
|
||||
this.compareMinY = new Function('a', 'b', compareArr.join(format[1]));
|
||||
|
||||
this.toBBox = new Function('a',
|
||||
'return {minX: a' + format[0] +
|
||||
', minY: a' + format[1] +
|
||||
', maxX: a' + format[2] +
|
||||
', maxY: a' + format[3] + '};');
|
||||
}
|
||||
};
|
||||
|
||||
function findItem(item, items, equalsFn) {
|
||||
if (!equalsFn) return items.indexOf(item);
|
||||
|
||||
for (var i = 0; i < items.length; i++) {
|
||||
if (equalsFn(item, items[i])) return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
// calculate node's bbox from bboxes of its children
|
||||
function calcBBox(node, toBBox) {
|
||||
distBBox(node, 0, node.children.length, toBBox, node);
|
||||
}
|
||||
|
||||
// min bounding rectangle of node children from k to p-1
|
||||
function distBBox(node, k, p, toBBox, destNode) {
|
||||
if (!destNode) destNode = createNode(null);
|
||||
destNode.minX = Infinity;
|
||||
destNode.minY = Infinity;
|
||||
destNode.maxX = -Infinity;
|
||||
destNode.maxY = -Infinity;
|
||||
|
||||
for (var i = k, child; i < p; i++) {
|
||||
child = node.children[i];
|
||||
extend(destNode, node.leaf ? toBBox(child) : child);
|
||||
}
|
||||
|
||||
return destNode;
|
||||
}
|
||||
|
||||
function extend(a, b) {
|
||||
a.minX = Math.min(a.minX, b.minX);
|
||||
a.minY = Math.min(a.minY, b.minY);
|
||||
a.maxX = Math.max(a.maxX, b.maxX);
|
||||
a.maxY = Math.max(a.maxY, b.maxY);
|
||||
return a;
|
||||
}
|
||||
|
||||
function compareNodeMinX(a, b) { return a.minX - b.minX; }
|
||||
function compareNodeMinY(a, b) { return a.minY - b.minY; }
|
||||
|
||||
function bboxArea(a) { return (a.maxX - a.minX) * (a.maxY - a.minY); }
|
||||
function bboxMargin(a) { return (a.maxX - a.minX) + (a.maxY - a.minY); }
|
||||
|
||||
function enlargedArea(a, b) {
|
||||
return (Math.max(b.maxX, a.maxX) - Math.min(b.minX, a.minX)) *
|
||||
(Math.max(b.maxY, a.maxY) - Math.min(b.minY, a.minY));
|
||||
}
|
||||
|
||||
function intersectionArea(a, b) {
|
||||
var minX = Math.max(a.minX, b.minX),
|
||||
minY = Math.max(a.minY, b.minY),
|
||||
maxX = Math.min(a.maxX, b.maxX),
|
||||
maxY = Math.min(a.maxY, b.maxY);
|
||||
|
||||
return Math.max(0, maxX - minX) *
|
||||
Math.max(0, maxY - minY);
|
||||
}
|
||||
|
||||
function contains(a, b) {
|
||||
return a.minX <= b.minX &&
|
||||
a.minY <= b.minY &&
|
||||
b.maxX <= a.maxX &&
|
||||
b.maxY <= a.maxY;
|
||||
}
|
||||
|
||||
function intersects(a, b) {
|
||||
return b.minX <= a.maxX &&
|
||||
b.minY <= a.maxY &&
|
||||
b.maxX >= a.minX &&
|
||||
b.maxY >= a.minY;
|
||||
}
|
||||
|
||||
function createNode(children) {
|
||||
return {
|
||||
children: children,
|
||||
height: 1,
|
||||
leaf: true,
|
||||
minX: Infinity,
|
||||
minY: Infinity,
|
||||
maxX: -Infinity,
|
||||
maxY: -Infinity
|
||||
};
|
||||
}
|
||||
|
||||
// sort an array so that items come in groups of n unsorted items, with groups sorted between each other;
|
||||
// combines selection algorithm with binary divide & conquer approach
|
||||
|
||||
function multiSelect(arr, left, right, n, compare) {
|
||||
var stack = [left, right],
|
||||
mid;
|
||||
|
||||
while (stack.length) {
|
||||
right = stack.pop();
|
||||
left = stack.pop();
|
||||
|
||||
if (right - left <= n) continue;
|
||||
|
||||
mid = left + Math.ceil((right - left) / n / 2) * n;
|
||||
quickselect(arr, mid, left, right, compare);
|
||||
|
||||
stack.push(left, mid, mid, right);
|
||||
}
|
||||
}
|
||||
79
immoweb/node_modules/rbush/package.json
generated
vendored
Normal file
79
immoweb/node_modules/rbush/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
{
|
||||
"_from": "rbush@^2.0.1",
|
||||
"_id": "rbush@2.0.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-TPrKKMMGS8DudUMaG3mZDode76k=",
|
||||
"_location": "/rbush",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "rbush@^2.0.1",
|
||||
"name": "rbush",
|
||||
"escapedName": "rbush",
|
||||
"rawSpec": "^2.0.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^2.0.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/hexgrid-heatmap"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/rbush/-/rbush-2.0.1.tgz",
|
||||
"_shasum": "4cfaca28c3064bc0ee75431a1b79990e875eefa9",
|
||||
"_spec": "rbush@^2.0.1",
|
||||
"_where": "/home/kadir/workspace/webimmo/node_modules/hexgrid-heatmap",
|
||||
"author": {
|
||||
"name": "Vladimir Agafonkin"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/mourner/rbush/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"quickselect": "^1.0.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "High-performance 2D spatial index for rectangles (based on R*-tree with bulk loading and bulk insertion algorithms)",
|
||||
"devDependencies": {
|
||||
"benchmark": "^2.1.0",
|
||||
"browserify": "^13.0.1",
|
||||
"eslint": "^2.10.2",
|
||||
"eslint-config-mourner": "^2.0.1",
|
||||
"faucet": "0.0.1",
|
||||
"istanbul": "~0.4.3",
|
||||
"tape": "^4.5.1",
|
||||
"uglify-js": "^2.6.4"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": "mourner",
|
||||
"rules": {
|
||||
"new-cap": 0,
|
||||
"consistent-return": 0
|
||||
}
|
||||
},
|
||||
"homepage": "https://github.com/mourner/rbush",
|
||||
"keywords": [
|
||||
"spatial",
|
||||
"tree",
|
||||
"search",
|
||||
"rectangle",
|
||||
"index",
|
||||
"math"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "rbush",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/mourner/rbush.git"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "browserify index.js -s rbush -o rbush.js",
|
||||
"build-min": "browserify index.js -s rbush | uglifyjs -c warnings=false -m > rbush.min.js",
|
||||
"cov": "istanbul cover test/test.js -x test/test.js",
|
||||
"perf": "node ./debug/perf.js",
|
||||
"prepublish": "npm run build && npm run build-min",
|
||||
"test": "eslint index.js test/test.js && node test/test.js | faucet"
|
||||
},
|
||||
"version": "2.0.1"
|
||||
}
|
||||
624
immoweb/node_modules/rbush/rbush.js
generated
vendored
Normal file
624
immoweb/node_modules/rbush/rbush.js
generated
vendored
Normal file
|
|
@ -0,0 +1,624 @@
|
|||
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.rbush = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
module.exports = rbush;
|
||||
|
||||
var quickselect = require('quickselect');
|
||||
|
||||
function rbush(maxEntries, format) {
|
||||
if (!(this instanceof rbush)) return new rbush(maxEntries, format);
|
||||
|
||||
// max entries in a node is 9 by default; min node fill is 40% for best performance
|
||||
this._maxEntries = Math.max(4, maxEntries || 9);
|
||||
this._minEntries = Math.max(2, Math.ceil(this._maxEntries * 0.4));
|
||||
|
||||
if (format) {
|
||||
this._initFormat(format);
|
||||
}
|
||||
|
||||
this.clear();
|
||||
}
|
||||
|
||||
rbush.prototype = {
|
||||
|
||||
all: function () {
|
||||
return this._all(this.data, []);
|
||||
},
|
||||
|
||||
search: function (bbox) {
|
||||
|
||||
var node = this.data,
|
||||
result = [],
|
||||
toBBox = this.toBBox;
|
||||
|
||||
if (!intersects(bbox, node)) return result;
|
||||
|
||||
var nodesToSearch = [],
|
||||
i, len, child, childBBox;
|
||||
|
||||
while (node) {
|
||||
for (i = 0, len = node.children.length; i < len; i++) {
|
||||
|
||||
child = node.children[i];
|
||||
childBBox = node.leaf ? toBBox(child) : child;
|
||||
|
||||
if (intersects(bbox, childBBox)) {
|
||||
if (node.leaf) result.push(child);
|
||||
else if (contains(bbox, childBBox)) this._all(child, result);
|
||||
else nodesToSearch.push(child);
|
||||
}
|
||||
}
|
||||
node = nodesToSearch.pop();
|
||||
}
|
||||
|
||||
return result;
|
||||
},
|
||||
|
||||
collides: function (bbox) {
|
||||
|
||||
var node = this.data,
|
||||
toBBox = this.toBBox;
|
||||
|
||||
if (!intersects(bbox, node)) return false;
|
||||
|
||||
var nodesToSearch = [],
|
||||
i, len, child, childBBox;
|
||||
|
||||
while (node) {
|
||||
for (i = 0, len = node.children.length; i < len; i++) {
|
||||
|
||||
child = node.children[i];
|
||||
childBBox = node.leaf ? toBBox(child) : child;
|
||||
|
||||
if (intersects(bbox, childBBox)) {
|
||||
if (node.leaf || contains(bbox, childBBox)) return true;
|
||||
nodesToSearch.push(child);
|
||||
}
|
||||
}
|
||||
node = nodesToSearch.pop();
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
load: function (data) {
|
||||
if (!(data && data.length)) return this;
|
||||
|
||||
if (data.length < this._minEntries) {
|
||||
for (var i = 0, len = data.length; i < len; i++) {
|
||||
this.insert(data[i]);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
// recursively build the tree with the given data from stratch using OMT algorithm
|
||||
var node = this._build(data.slice(), 0, data.length - 1, 0);
|
||||
|
||||
if (!this.data.children.length) {
|
||||
// save as is if tree is empty
|
||||
this.data = node;
|
||||
|
||||
} else if (this.data.height === node.height) {
|
||||
// split root if trees have the same height
|
||||
this._splitRoot(this.data, node);
|
||||
|
||||
} else {
|
||||
if (this.data.height < node.height) {
|
||||
// swap trees if inserted one is bigger
|
||||
var tmpNode = this.data;
|
||||
this.data = node;
|
||||
node = tmpNode;
|
||||
}
|
||||
|
||||
// insert the small tree into the large tree at appropriate level
|
||||
this._insert(node, this.data.height - node.height - 1, true);
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
insert: function (item) {
|
||||
if (item) this._insert(item, this.data.height - 1);
|
||||
return this;
|
||||
},
|
||||
|
||||
clear: function () {
|
||||
this.data = createNode([]);
|
||||
return this;
|
||||
},
|
||||
|
||||
remove: function (item, equalsFn) {
|
||||
if (!item) return this;
|
||||
|
||||
var node = this.data,
|
||||
bbox = this.toBBox(item),
|
||||
path = [],
|
||||
indexes = [],
|
||||
i, parent, index, goingUp;
|
||||
|
||||
// depth-first iterative tree traversal
|
||||
while (node || path.length) {
|
||||
|
||||
if (!node) { // go up
|
||||
node = path.pop();
|
||||
parent = path[path.length - 1];
|
||||
i = indexes.pop();
|
||||
goingUp = true;
|
||||
}
|
||||
|
||||
if (node.leaf) { // check current node
|
||||
index = findItem(item, node.children, equalsFn);
|
||||
|
||||
if (index !== -1) {
|
||||
// item found, remove the item and condense tree upwards
|
||||
node.children.splice(index, 1);
|
||||
path.push(node);
|
||||
this._condense(path);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
if (!goingUp && !node.leaf && contains(node, bbox)) { // go down
|
||||
path.push(node);
|
||||
indexes.push(i);
|
||||
i = 0;
|
||||
parent = node;
|
||||
node = node.children[0];
|
||||
|
||||
} else if (parent) { // go right
|
||||
i++;
|
||||
node = parent.children[i];
|
||||
goingUp = false;
|
||||
|
||||
} else node = null; // nothing found
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
toBBox: function (item) { return item; },
|
||||
|
||||
compareMinX: compareNodeMinX,
|
||||
compareMinY: compareNodeMinY,
|
||||
|
||||
toJSON: function () { return this.data; },
|
||||
|
||||
fromJSON: function (data) {
|
||||
this.data = data;
|
||||
return this;
|
||||
},
|
||||
|
||||
_all: function (node, result) {
|
||||
var nodesToSearch = [];
|
||||
while (node) {
|
||||
if (node.leaf) result.push.apply(result, node.children);
|
||||
else nodesToSearch.push.apply(nodesToSearch, node.children);
|
||||
|
||||
node = nodesToSearch.pop();
|
||||
}
|
||||
return result;
|
||||
},
|
||||
|
||||
_build: function (items, left, right, height) {
|
||||
|
||||
var N = right - left + 1,
|
||||
M = this._maxEntries,
|
||||
node;
|
||||
|
||||
if (N <= M) {
|
||||
// reached leaf level; return leaf
|
||||
node = createNode(items.slice(left, right + 1));
|
||||
calcBBox(node, this.toBBox);
|
||||
return node;
|
||||
}
|
||||
|
||||
if (!height) {
|
||||
// target height of the bulk-loaded tree
|
||||
height = Math.ceil(Math.log(N) / Math.log(M));
|
||||
|
||||
// target number of root entries to maximize storage utilization
|
||||
M = Math.ceil(N / Math.pow(M, height - 1));
|
||||
}
|
||||
|
||||
node = createNode([]);
|
||||
node.leaf = false;
|
||||
node.height = height;
|
||||
|
||||
// split the items into M mostly square tiles
|
||||
|
||||
var N2 = Math.ceil(N / M),
|
||||
N1 = N2 * Math.ceil(Math.sqrt(M)),
|
||||
i, j, right2, right3;
|
||||
|
||||
multiSelect(items, left, right, N1, this.compareMinX);
|
||||
|
||||
for (i = left; i <= right; i += N1) {
|
||||
|
||||
right2 = Math.min(i + N1 - 1, right);
|
||||
|
||||
multiSelect(items, i, right2, N2, this.compareMinY);
|
||||
|
||||
for (j = i; j <= right2; j += N2) {
|
||||
|
||||
right3 = Math.min(j + N2 - 1, right2);
|
||||
|
||||
// pack each entry recursively
|
||||
node.children.push(this._build(items, j, right3, height - 1));
|
||||
}
|
||||
}
|
||||
|
||||
calcBBox(node, this.toBBox);
|
||||
|
||||
return node;
|
||||
},
|
||||
|
||||
_chooseSubtree: function (bbox, node, level, path) {
|
||||
|
||||
var i, len, child, targetNode, area, enlargement, minArea, minEnlargement;
|
||||
|
||||
while (true) {
|
||||
path.push(node);
|
||||
|
||||
if (node.leaf || path.length - 1 === level) break;
|
||||
|
||||
minArea = minEnlargement = Infinity;
|
||||
|
||||
for (i = 0, len = node.children.length; i < len; i++) {
|
||||
child = node.children[i];
|
||||
area = bboxArea(child);
|
||||
enlargement = enlargedArea(bbox, child) - area;
|
||||
|
||||
// choose entry with the least area enlargement
|
||||
if (enlargement < minEnlargement) {
|
||||
minEnlargement = enlargement;
|
||||
minArea = area < minArea ? area : minArea;
|
||||
targetNode = child;
|
||||
|
||||
} else if (enlargement === minEnlargement) {
|
||||
// otherwise choose one with the smallest area
|
||||
if (area < minArea) {
|
||||
minArea = area;
|
||||
targetNode = child;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
node = targetNode || node.children[0];
|
||||
}
|
||||
|
||||
return node;
|
||||
},
|
||||
|
||||
_insert: function (item, level, isNode) {
|
||||
|
||||
var toBBox = this.toBBox,
|
||||
bbox = isNode ? item : toBBox(item),
|
||||
insertPath = [];
|
||||
|
||||
// find the best node for accommodating the item, saving all nodes along the path too
|
||||
var node = this._chooseSubtree(bbox, this.data, level, insertPath);
|
||||
|
||||
// put the item into the node
|
||||
node.children.push(item);
|
||||
extend(node, bbox);
|
||||
|
||||
// split on node overflow; propagate upwards if necessary
|
||||
while (level >= 0) {
|
||||
if (insertPath[level].children.length > this._maxEntries) {
|
||||
this._split(insertPath, level);
|
||||
level--;
|
||||
} else break;
|
||||
}
|
||||
|
||||
// adjust bboxes along the insertion path
|
||||
this._adjustParentBBoxes(bbox, insertPath, level);
|
||||
},
|
||||
|
||||
// split overflowed node into two
|
||||
_split: function (insertPath, level) {
|
||||
|
||||
var node = insertPath[level],
|
||||
M = node.children.length,
|
||||
m = this._minEntries;
|
||||
|
||||
this._chooseSplitAxis(node, m, M);
|
||||
|
||||
var splitIndex = this._chooseSplitIndex(node, m, M);
|
||||
|
||||
var newNode = createNode(node.children.splice(splitIndex, node.children.length - splitIndex));
|
||||
newNode.height = node.height;
|
||||
newNode.leaf = node.leaf;
|
||||
|
||||
calcBBox(node, this.toBBox);
|
||||
calcBBox(newNode, this.toBBox);
|
||||
|
||||
if (level) insertPath[level - 1].children.push(newNode);
|
||||
else this._splitRoot(node, newNode);
|
||||
},
|
||||
|
||||
_splitRoot: function (node, newNode) {
|
||||
// split root node
|
||||
this.data = createNode([node, newNode]);
|
||||
this.data.height = node.height + 1;
|
||||
this.data.leaf = false;
|
||||
calcBBox(this.data, this.toBBox);
|
||||
},
|
||||
|
||||
_chooseSplitIndex: function (node, m, M) {
|
||||
|
||||
var i, bbox1, bbox2, overlap, area, minOverlap, minArea, index;
|
||||
|
||||
minOverlap = minArea = Infinity;
|
||||
|
||||
for (i = m; i <= M - m; i++) {
|
||||
bbox1 = distBBox(node, 0, i, this.toBBox);
|
||||
bbox2 = distBBox(node, i, M, this.toBBox);
|
||||
|
||||
overlap = intersectionArea(bbox1, bbox2);
|
||||
area = bboxArea(bbox1) + bboxArea(bbox2);
|
||||
|
||||
// choose distribution with minimum overlap
|
||||
if (overlap < minOverlap) {
|
||||
minOverlap = overlap;
|
||||
index = i;
|
||||
|
||||
minArea = area < minArea ? area : minArea;
|
||||
|
||||
} else if (overlap === minOverlap) {
|
||||
// otherwise choose distribution with minimum area
|
||||
if (area < minArea) {
|
||||
minArea = area;
|
||||
index = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return index;
|
||||
},
|
||||
|
||||
// sorts node children by the best axis for split
|
||||
_chooseSplitAxis: function (node, m, M) {
|
||||
|
||||
var compareMinX = node.leaf ? this.compareMinX : compareNodeMinX,
|
||||
compareMinY = node.leaf ? this.compareMinY : compareNodeMinY,
|
||||
xMargin = this._allDistMargin(node, m, M, compareMinX),
|
||||
yMargin = this._allDistMargin(node, m, M, compareMinY);
|
||||
|
||||
// if total distributions margin value is minimal for x, sort by minX,
|
||||
// otherwise it's already sorted by minY
|
||||
if (xMargin < yMargin) node.children.sort(compareMinX);
|
||||
},
|
||||
|
||||
// total margin of all possible split distributions where each node is at least m full
|
||||
_allDistMargin: function (node, m, M, compare) {
|
||||
|
||||
node.children.sort(compare);
|
||||
|
||||
var toBBox = this.toBBox,
|
||||
leftBBox = distBBox(node, 0, m, toBBox),
|
||||
rightBBox = distBBox(node, M - m, M, toBBox),
|
||||
margin = bboxMargin(leftBBox) + bboxMargin(rightBBox),
|
||||
i, child;
|
||||
|
||||
for (i = m; i < M - m; i++) {
|
||||
child = node.children[i];
|
||||
extend(leftBBox, node.leaf ? toBBox(child) : child);
|
||||
margin += bboxMargin(leftBBox);
|
||||
}
|
||||
|
||||
for (i = M - m - 1; i >= m; i--) {
|
||||
child = node.children[i];
|
||||
extend(rightBBox, node.leaf ? toBBox(child) : child);
|
||||
margin += bboxMargin(rightBBox);
|
||||
}
|
||||
|
||||
return margin;
|
||||
},
|
||||
|
||||
_adjustParentBBoxes: function (bbox, path, level) {
|
||||
// adjust bboxes along the given tree path
|
||||
for (var i = level; i >= 0; i--) {
|
||||
extend(path[i], bbox);
|
||||
}
|
||||
},
|
||||
|
||||
_condense: function (path) {
|
||||
// go through the path, removing empty nodes and updating bboxes
|
||||
for (var i = path.length - 1, siblings; i >= 0; i--) {
|
||||
if (path[i].children.length === 0) {
|
||||
if (i > 0) {
|
||||
siblings = path[i - 1].children;
|
||||
siblings.splice(siblings.indexOf(path[i]), 1);
|
||||
|
||||
} else this.clear();
|
||||
|
||||
} else calcBBox(path[i], this.toBBox);
|
||||
}
|
||||
},
|
||||
|
||||
_initFormat: function (format) {
|
||||
// data format (minX, minY, maxX, maxY accessors)
|
||||
|
||||
// uses eval-type function compilation instead of just accepting a toBBox function
|
||||
// because the algorithms are very sensitive to sorting functions performance,
|
||||
// so they should be dead simple and without inner calls
|
||||
|
||||
var compareArr = ['return a', ' - b', ';'];
|
||||
|
||||
this.compareMinX = new Function('a', 'b', compareArr.join(format[0]));
|
||||
this.compareMinY = new Function('a', 'b', compareArr.join(format[1]));
|
||||
|
||||
this.toBBox = new Function('a',
|
||||
'return {minX: a' + format[0] +
|
||||
', minY: a' + format[1] +
|
||||
', maxX: a' + format[2] +
|
||||
', maxY: a' + format[3] + '};');
|
||||
}
|
||||
};
|
||||
|
||||
function findItem(item, items, equalsFn) {
|
||||
if (!equalsFn) return items.indexOf(item);
|
||||
|
||||
for (var i = 0; i < items.length; i++) {
|
||||
if (equalsFn(item, items[i])) return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
// calculate node's bbox from bboxes of its children
|
||||
function calcBBox(node, toBBox) {
|
||||
distBBox(node, 0, node.children.length, toBBox, node);
|
||||
}
|
||||
|
||||
// min bounding rectangle of node children from k to p-1
|
||||
function distBBox(node, k, p, toBBox, destNode) {
|
||||
if (!destNode) destNode = createNode(null);
|
||||
destNode.minX = Infinity;
|
||||
destNode.minY = Infinity;
|
||||
destNode.maxX = -Infinity;
|
||||
destNode.maxY = -Infinity;
|
||||
|
||||
for (var i = k, child; i < p; i++) {
|
||||
child = node.children[i];
|
||||
extend(destNode, node.leaf ? toBBox(child) : child);
|
||||
}
|
||||
|
||||
return destNode;
|
||||
}
|
||||
|
||||
function extend(a, b) {
|
||||
a.minX = Math.min(a.minX, b.minX);
|
||||
a.minY = Math.min(a.minY, b.minY);
|
||||
a.maxX = Math.max(a.maxX, b.maxX);
|
||||
a.maxY = Math.max(a.maxY, b.maxY);
|
||||
return a;
|
||||
}
|
||||
|
||||
function compareNodeMinX(a, b) { return a.minX - b.minX; }
|
||||
function compareNodeMinY(a, b) { return a.minY - b.minY; }
|
||||
|
||||
function bboxArea(a) { return (a.maxX - a.minX) * (a.maxY - a.minY); }
|
||||
function bboxMargin(a) { return (a.maxX - a.minX) + (a.maxY - a.minY); }
|
||||
|
||||
function enlargedArea(a, b) {
|
||||
return (Math.max(b.maxX, a.maxX) - Math.min(b.minX, a.minX)) *
|
||||
(Math.max(b.maxY, a.maxY) - Math.min(b.minY, a.minY));
|
||||
}
|
||||
|
||||
function intersectionArea(a, b) {
|
||||
var minX = Math.max(a.minX, b.minX),
|
||||
minY = Math.max(a.minY, b.minY),
|
||||
maxX = Math.min(a.maxX, b.maxX),
|
||||
maxY = Math.min(a.maxY, b.maxY);
|
||||
|
||||
return Math.max(0, maxX - minX) *
|
||||
Math.max(0, maxY - minY);
|
||||
}
|
||||
|
||||
function contains(a, b) {
|
||||
return a.minX <= b.minX &&
|
||||
a.minY <= b.minY &&
|
||||
b.maxX <= a.maxX &&
|
||||
b.maxY <= a.maxY;
|
||||
}
|
||||
|
||||
function intersects(a, b) {
|
||||
return b.minX <= a.maxX &&
|
||||
b.minY <= a.maxY &&
|
||||
b.maxX >= a.minX &&
|
||||
b.maxY >= a.minY;
|
||||
}
|
||||
|
||||
function createNode(children) {
|
||||
return {
|
||||
children: children,
|
||||
height: 1,
|
||||
leaf: true,
|
||||
minX: Infinity,
|
||||
minY: Infinity,
|
||||
maxX: -Infinity,
|
||||
maxY: -Infinity
|
||||
};
|
||||
}
|
||||
|
||||
// sort an array so that items come in groups of n unsorted items, with groups sorted between each other;
|
||||
// combines selection algorithm with binary divide & conquer approach
|
||||
|
||||
function multiSelect(arr, left, right, n, compare) {
|
||||
var stack = [left, right],
|
||||
mid;
|
||||
|
||||
while (stack.length) {
|
||||
right = stack.pop();
|
||||
left = stack.pop();
|
||||
|
||||
if (right - left <= n) continue;
|
||||
|
||||
mid = left + Math.ceil((right - left) / n / 2) * n;
|
||||
quickselect(arr, mid, left, right, compare);
|
||||
|
||||
stack.push(left, mid, mid, right);
|
||||
}
|
||||
}
|
||||
|
||||
},{"quickselect":2}],2:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
module.exports = partialSort;
|
||||
|
||||
// Floyd-Rivest selection algorithm:
|
||||
// Rearrange items so that all items in the [left, k] range are smaller than all items in (k, right];
|
||||
// The k-th element will have the (k - left + 1)th smallest value in [left, right]
|
||||
|
||||
function partialSort(arr, k, left, right, compare) {
|
||||
|
||||
while (right > left) {
|
||||
if (right - left > 600) {
|
||||
var n = right - left + 1;
|
||||
var m = k - left + 1;
|
||||
var z = Math.log(n);
|
||||
var s = 0.5 * Math.exp(2 * z / 3);
|
||||
var sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (m - n / 2 < 0 ? -1 : 1);
|
||||
var newLeft = Math.max(left, Math.floor(k - m * s / n + sd));
|
||||
var newRight = Math.min(right, Math.floor(k + (n - m) * s / n + sd));
|
||||
partialSort(arr, k, newLeft, newRight, compare);
|
||||
}
|
||||
|
||||
var t = arr[k];
|
||||
var i = left;
|
||||
var j = right;
|
||||
|
||||
swap(arr, left, k);
|
||||
if (compare(arr[right], t) > 0) swap(arr, left, right);
|
||||
|
||||
while (i < j) {
|
||||
swap(arr, i, j);
|
||||
i++;
|
||||
j--;
|
||||
while (compare(arr[i], t) < 0) i++;
|
||||
while (compare(arr[j], t) > 0) j--;
|
||||
}
|
||||
|
||||
if (compare(arr[left], t) === 0) swap(arr, left, j);
|
||||
else {
|
||||
j++;
|
||||
swap(arr, j, right);
|
||||
}
|
||||
|
||||
if (j <= k) left = j + 1;
|
||||
if (k <= j) right = j - 1;
|
||||
}
|
||||
}
|
||||
|
||||
function swap(arr, i, j) {
|
||||
var tmp = arr[i];
|
||||
arr[i] = arr[j];
|
||||
arr[j] = tmp;
|
||||
}
|
||||
|
||||
function defaultCompare(a, b) {
|
||||
return a < b ? -1 : a > b ? 1 : 0;
|
||||
}
|
||||
|
||||
},{}]},{},[1])(1)
|
||||
});
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue