Commit 197c4e42 authored by Sven Schneider's avatar Sven Schneider
Browse files

first commit using the simplify data method.

parent 6c9c84ee
......@@ -32,9 +32,9 @@
<script src="https://cdn.jsdelivr.net/npm/apexcharts"></script>
<link rel="stylesheet" href="css/styles.css" />
<!-- Cesium lib -->
<script src="https://cesium.com/downloads/cesiumjs/releases/1.48/Build/Cesium/Cesium.js"></script>
<script src="https://cesium.com/downloads/cesiumjs/releases/1.69/Build/Cesium/Cesium.js"></script>
<link
href="https://cesium.com/downloads/cesiumjs/releases/1.48/Build/Cesium/Widgets/widgets.css"
href="https://cesium.com/downloads/cesiumjs/releases/1.69/Build/Cesium/Widgets/widgets.css"
rel="stylesheet"
/>
<!-- Bootstrap dashboard template -->
......@@ -49,6 +49,7 @@
crossorigin="anonymous"
></script>
<script defer src="js/thirdparty/scripts.js"></script>
<script defer src="js/thirdparty/simplify.js"></script>
<!--
Custom JS -->
<script defer src="js/appCesium.js"></script>
......
{
"name": "chart-visualization",
"name": "energydashboard",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
......@@ -13,11 +13,21 @@
"negotiator": "0.6.2"
}
},
"amdefine": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz",
"integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU="
},
"array-flatten": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
"integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI="
},
"async": {
"version": "0.2.10",
"resolved": "https://registry.npmjs.org/async/-/async-0.2.10.tgz",
"integrity": "sha1-trvgsGdLnXGXCMo43owjfLUmw9E="
},
"axios": {
"version": "0.21.1",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.21.1.tgz",
......@@ -226,16 +236,16 @@
"integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg=="
},
"mime-db": {
"version": "1.45.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.45.0.tgz",
"integrity": "sha512-CkqLUxUk15hofLoLyljJSrukZi8mAtgd+yE5uO4tqRZsdsAJKv0O+rFMhVDRJgozy+yG6md5KwuXhD4ocIoP+w=="
"version": "1.47.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.47.0.tgz",
"integrity": "sha512-QBmA/G2y+IfeS4oktet3qRZ+P5kPhCKRXxXnQEudYqUaEioAU1/Lq2us3D/t1Jfo4hE9REQPrbB7K5sOczJVIw=="
},
"mime-types": {
"version": "2.1.28",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.28.tgz",
"integrity": "sha512-0TO2yJ5YHYr7M2zzT7gDU1tbwHxEUWBCLt0lscSNpcdAfFyJOVEpRYNS7EXVcTLNj/25QO8gulHC5JtTzSE2UQ==",
"version": "2.1.30",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.30.tgz",
"integrity": "sha512-crmjA4bLtR8m9qLpHvgxSChT+XoSlZi8J4n/aIdn3z92e/U47Z0V/yl+Wh9W046GgFVAmoNR/fmdbZYcSSIUeg==",
"requires": {
"mime-db": "1.45.0"
"mime-db": "1.47.0"
}
},
"ms": {
......@@ -256,6 +266,14 @@
"ee-first": "1.1.1"
}
},
"optimist": {
"version": "0.3.7",
"resolved": "https://registry.npmjs.org/optimist/-/optimist-0.3.7.tgz",
"integrity": "sha1-yQlBrVnkJzMokjB00s8ufLxuwNk=",
"requires": {
"wordwrap": "~0.0.2"
}
},
"parseurl": {
"version": "1.3.3",
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
......@@ -296,6 +314,15 @@
"unpipe": "1.0.0"
}
},
"require": {
"version": "2.4.20",
"resolved": "https://registry.npmjs.org/require/-/require-2.4.20.tgz",
"integrity": "sha1-Zstrqqu2XeinHXk/XGX9GE83mLY=",
"requires": {
"std": "0.1.40",
"uglify-js": "2.3.0"
}
},
"safe-buffer": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
......@@ -349,11 +376,24 @@
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz",
"integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw=="
},
"source-map": {
"version": "0.1.43",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.1.43.tgz",
"integrity": "sha1-wkvBRspRfBRx9drL4lcbK3+eM0Y=",
"requires": {
"amdefine": ">=0.0.4"
}
},
"statuses": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz",
"integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow="
},
"std": {
"version": "0.1.40",
"resolved": "https://registry.npmjs.org/std/-/std-0.1.40.tgz",
"integrity": "sha1-Nnil9lCU2eG2teJu2/wCErg0K3E="
},
"toidentifier": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz",
......@@ -368,6 +408,16 @@
"mime-types": "~2.1.24"
}
},
"uglify-js": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-2.3.0.tgz",
"integrity": "sha1-LN7BbTeKiituz7aYl4TPi3rlSR8=",
"requires": {
"async": "~0.2.6",
"optimist": "~0.3.5",
"source-map": "~0.1.7"
}
},
"unpipe": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
......@@ -382,6 +432,11 @@
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
"integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw="
},
"wordwrap": {
"version": "0.0.3",
"resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz",
"integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc="
}
}
}
{
"name": "chart-visualization",
"name": "energydashboard",
"version": "1.0.0",
"description": "",
"description": "Development of dashboard for Bosch Schwieberdingen",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
......@@ -10,6 +10,11 @@
"license": "ISC",
"dependencies": {
"axios": "^0.21.1",
"express": "^4.17.1"
"express": "^4.17.1",
"require": "^2.4.20"
},
"repository": {
"type": "git",
"url": "https://transfer.hft-stuttgart.de/gitlab/icity/energydashboard.git"
}
}
{"asset":{"version":"0.0"},"geometricError":219.28313534945207,"root":{"refine":"add","boundingVolume":{"region":[0.1584738511179245,0.8531339603933314,0.15873528756025984,0.8531878739110335,0.0,45.992999999999995]},"children":[{"boundingVolume":{"region":[0.1584738511179245,0.8531339603933314,0.15859247234863882,0.8531878739110335,0.0,23.899999999999977]},"content":{"url":"/b3dms/R/E.b3dm","boundingVolume":{"region":[0.1584738511179245,0.8531339603933314,0.15859247234863882,0.8531878739110335,0.0,23.899999999999977]}},"geometricError":0.0},{"boundingVolume":{"region":[0.15858287250337338,0.8531425951235618,0.15873528756025984,0.8531873139263567,0.0,18.771000000000015]},"content":{"url":"/b3dms/R/W.b3dm","boundingVolume":{"region":[0.15858287250337338,0.8531425951235618,0.15873528756025984,0.8531873139263567,0.0,18.771000000000015]}},"geometricError":0.0}],"content":{"url":"/b3dms/R.b3dm","boundingVolume":{"region":[0.1584811358859679,0.8531423166682495,0.15872563084804878,0.8531836827163873,0.0,45.992999999999995]}},"geometricError":91.69443154404571},"properties":{"Comment":{},"Modified":{"maximum":0,"minimum":0},"GEMEINDESCHLUESSEL":{"maximum":8118067,"minimum":8118067},"ClassQuality":{"maximum":94.9,"minimum":0},"DATENQUELLELAGE":{"maximum":1000,"minimum":1000},"1-gml_id":{},"CreationUser":{},"DATENQUELLEBODENHOEHE":{"maximum":1100,"minimum":1100},"MeasuredHeight":{"maximum":45.992,"minimum":2.428},"Bodenhoehe":{"maximum":319.699,"minimum":299.44},"Function":{},"FeatureType":{},"gmlID":{},"Dachhoehe":{"maximum":353.502,"minimum":302.4},"DATENQUELLEDACHHOEHE":{"maximum":5000,"minimum":1000},"RoofType":{"maximum":3100,"minimum":1000},"StoreysAboveGround":{"maximum":15,"minimum":1},"Gebaeudehoehe":{"maximum":45.992,"minimum":2.428},"Baujahr":{"maximum":2017,"minimum":-1},"FunctionCode":{"maximum":2700,"minimum":1120},"2-gml_descr":{"maximum":657,"minimum":101},"Dachform":{},"YearOfConstruction":{"maximum":2004,"minimum":1968},"3-yoc":{"maximum":2017,"minimum":-1},"CreationDate":{},"4-func":{},"LocalityName":{},"CountryName":{},"ThoroughfareName":{},"CoreName":{},"Longitude":{"maximum":9.094862036998366,"minimum":9.080012180673906},"Latitude":{"maximum":48.884064306842056,"minimum":48.881024934531204}}}
\ No newline at end of file
{
"asset": { "version": "0.0" },
"geometricError": 219.28313534945207,
"root": {
"refine": "add",
"boundingVolume": {
"region": [
0.1584738511179245,
0.8531339603933314,
0.15873528756025984,
0.8531878739110335,
0.0,
45.992999999999995
]
},
"children": [
{
"boundingVolume": {
"region": [
0.1584738511179245,
0.8531339603933314,
0.15859247234863882,
0.8531878739110335,
0.0,
23.899999999999977
]
},
"content": {
"url": "b3dms/R/E.b3dm",
"boundingVolume": {
"region": [
0.1584738511179245,
0.8531339603933314,
0.15859247234863882,
0.8531878739110335,
0.0,
23.899999999999977
]
}
},
"geometricError": 0.0
},
{
"boundingVolume": {
"region": [
0.15858287250337338,
0.8531425951235618,
0.15873528756025984,
0.8531873139263567,
0.0,
18.771000000000015
]
},
"content": {
"url": "b3dms/R/W.b3dm",
"boundingVolume": {
"region": [
0.15858287250337338,
0.8531425951235618,
0.15873528756025984,
0.8531873139263567,
0.0,
18.771000000000015
]
}
},
"geometricError": 0.0
}
],
"content": {
"url": "b3dms/R.b3dm",
"boundingVolume": {
"region": [
0.1584811358859679,
0.8531423166682495,
0.15872563084804878,
0.8531836827163873,
0.0,
45.992999999999995
]
}
},
"geometricError": 91.69443154404571
},
"properties": {
"Comment": {},
"Modified": { "maximum": 0, "minimum": 0 },
"GEMEINDESCHLUESSEL": { "maximum": 8118067, "minimum": 8118067 },
"ClassQuality": { "maximum": 94.9, "minimum": 0 },
"DATENQUELLELAGE": { "maximum": 1000, "minimum": 1000 },
"1-gml_id": {},
"CreationUser": {},
"DATENQUELLEBODENHOEHE": { "maximum": 1100, "minimum": 1100 },
"MeasuredHeight": { "maximum": 45.992, "minimum": 2.428 },
"Bodenhoehe": { "maximum": 319.699, "minimum": 299.44 },
"Function": {},
"FeatureType": {},
"gmlID": {},
"Dachhoehe": { "maximum": 353.502, "minimum": 302.4 },
"DATENQUELLEDACHHOEHE": { "maximum": 5000, "minimum": 1000 },
"RoofType": { "maximum": 3100, "minimum": 1000 },
"StoreysAboveGround": { "maximum": 15, "minimum": 1 },
"Gebaeudehoehe": { "maximum": 45.992, "minimum": 2.428 },
"Baujahr": { "maximum": 2017, "minimum": -1 },
"FunctionCode": { "maximum": 2700, "minimum": 1120 },
"2-gml_descr": { "maximum": 657, "minimum": 101 },
"Dachform": {},
"YearOfConstruction": { "maximum": 2004, "minimum": 1968 },
"3-yoc": { "maximum": 2017, "minimum": -1 },
"CreationDate": {},
"4-func": {},
"LocalityName": {},
"CountryName": {},
"ThoroughfareName": {},
"CoreName": {},
"Longitude": { "maximum": 9.094862036998366, "minimum": 9.080012180673906 },
"Latitude": { "maximum": 48.884064306842056, "minimum": 48.881024934531204 }
}
}
{"asset":{"version":"0.0"},"geometricError":219.28313534945207,"root":{"refine":"add","boundingVolume":{"region":[0.1584738511179245,0.8531339603933314,0.15873528756025984,0.8531878739110335,0.0,45.992999999999995]},"children":[{"boundingVolume":{"region":[0.1584738511179245,0.8531339603933314,0.15858326731329325,0.8531878739110335,0.0,13.600000000000023]},"content":{"url":"/b3dms/R/E.b3dm","boundingVolume":{"region":[0.1584738511179245,0.8531339603933314,0.15858326731329325,0.8531878739110335,0.0,13.600000000000023]}},"geometricError":0.0},{"boundingVolume":{"region":[0.15858287250337338,0.8531425951235618,0.15873528756025984,0.8531871661728766,0.0,18.512999999999977]},"content":{"url":"/b3dms/R/W.b3dm","boundingVolume":{"region":[0.15858287250337338,0.8531425951235618,0.15873528756025984,0.8531871661728766,0.0,18.512999999999977]}},"geometricError":0.0}],"content":{"url":"/b3dms/R.b3dm","boundingVolume":{"region":[0.15848022617436155,0.8531413194464635,0.15872563084804878,0.8531873139263567,0.0,45.992999999999995]}},"geometricError":67.37680475033933},"properties":{"FunctionCode":{"maximum":2700,"minimum":1120},"RoofType":{"maximum":3100,"minimum":1000},"FeatureType":{},"Gebaeudehoehe":{"maximum":45.992,"minimum":2.428},"DATENQUELLEBODENHOEHE":{"maximum":1100,"minimum":1100},"Modified":{"maximum":0,"minimum":0},"StoreysAboveGround":{"maximum":15,"minimum":1},"Bodenhoehe":{"maximum":319.699,"minimum":299.44},"YearOfConstruction":{"maximum":2004,"minimum":1968},"Dachform":{},"DATENQUELLELAGE":{"maximum":1000,"minimum":1000},"DATENQUELLEDACHHOEHE":{"maximum":5000,"minimum":1000},"gmlID":{},"ClassQuality":{"maximum":94.9,"minimum":0},"MeasuredHeight":{"maximum":45.992,"minimum":2.428},"Comment":{},"GEMEINDESCHLUESSEL":{"maximum":8118067,"minimum":8118067},"CreationUser":{},"CreationDate":{},"Dachhoehe":{"maximum":353.502,"minimum":302.4},"Function":{},"CoreName":{},"Longitude":{"maximum":9.094862036998366,"minimum":9.080012180673906},"Latitude":{"maximum":48.884064306842056,"minimum":48.881024934531204}}}
\ No newline at end of file
{
"asset": { "version": "0.0" },
"geometricError": 219.28313534945207,
"root": {
"refine": "add",
"boundingVolume": {
"region": [
0.1584738511179245,
0.8531339603933314,
0.15873528756025984,
0.8531878739110335,
0.0,
45.992999999999995
]
},
"children": [
{
"boundingVolume": {
"region": [
0.1584738511179245,
0.8531339603933314,
0.15858326731329325,
0.8531878739110335,
0.0,
13.600000000000023
]
},
"content": {
"url": "b3dms/R/E.b3dm",
"boundingVolume": {
"region": [
0.1584738511179245,
0.8531339603933314,
0.15858326731329325,
0.8531878739110335,
0.0,
13.600000000000023
]
}
},
"geometricError": 0.0
},
{
"boundingVolume": {
"region": [
0.15858287250337338,
0.8531425951235618,
0.15873528756025984,
0.8531871661728766,
0.0,
18.512999999999977
]
},
"content": {
"url": "b3dms/R/W.b3dm",
"boundingVolume": {
"region": [
0.15858287250337338,
0.8531425951235618,
0.15873528756025984,
0.8531871661728766,
0.0,
18.512999999999977
]
}
},
"geometricError": 0.0
}
],
"content": {
"url": "b3dms/R.b3dm",
"boundingVolume": {
"region": [
0.15848022617436155,
0.8531413194464635,
0.15872563084804878,
0.8531873139263567,
0.0,
45.992999999999995
]
}
},
"geometricError": 67.37680475033933
},
"properties": {
"FunctionCode": { "maximum": 2700, "minimum": 1120 },
"RoofType": { "maximum": 3100, "minimum": 1000 },
"FeatureType": {},
"Gebaeudehoehe": { "maximum": 45.992, "minimum": 2.428 },
"DATENQUELLEBODENHOEHE": { "maximum": 1100, "minimum": 1100 },
"Modified": { "maximum": 0, "minimum": 0 },
"StoreysAboveGround": { "maximum": 15, "minimum": 1 },
"Bodenhoehe": { "maximum": 319.699, "minimum": 299.44 },
"YearOfConstruction": { "maximum": 2004, "minimum": 1968 },
"Dachform": {},
"DATENQUELLELAGE": { "maximum": 1000, "minimum": 1000 },
"DATENQUELLEDACHHOEHE": { "maximum": 5000, "minimum": 1000 },
"gmlID": {},
"ClassQuality": { "maximum": 94.9, "minimum": 0 },
"MeasuredHeight": { "maximum": 45.992, "minimum": 2.428 },
"Comment": {},
"GEMEINDESCHLUESSEL": { "maximum": 8118067, "minimum": 8118067 },
"CreationUser": {},
"CreationDate": {},
"Dachhoehe": { "maximum": 353.502, "minimum": 302.4 },
"Function": {},
"CoreName": {},
"Longitude": { "maximum": 9.094862036998366, "minimum": 9.080012180673906 },
"Latitude": { "maximum": 48.884064306842056, "minimum": 48.881024934531204 }
}
}
......@@ -5,7 +5,7 @@ Cesium.Ion.defaultAccessToken =
// Flag to determine models that will be loaded
// Set to `true` or `false`
const LOAD_DETAILED_BLDG225 = false;
const LOAD_DETAILED_BLDG225 = true;
// Global variable
const viewer = new Cesium.Viewer("myCesiumContainer", {
......
......@@ -403,8 +403,44 @@ const followNextLink = function (responsePromise) {
});
};
///////////////////////////////////////////////////////////////
function getDataReadyForSimplifyJS(pts) {
var val = [];
for (var i = 0, len = pts.length; i < len; i++)
val.push(pts[i][1]);
pts = val;
let newPts = [];
for (var i = 0, len = pts.length; i < len; i++)
newPts.push({ x: i, y: pts[i] });
return newPts;
}
///////////////////////////////////////////////////////////////
function getPointIndiciesFromXYjson(pts) {
let newPts = [];
for (var i = 0, len = pts.length; i < len; i++)
newPts.push(pts[i].x);
return newPts;
}
///////////////////////////////////////////////////////////////
function getReducedDataFromSimplifiedData(originalData, simplified_data) {
let red_data = [];
let new_start = 0;
for (var i = 0; i < originalData.length; i++)
for (var j=new_start; j < simplified_data.length; j++){
if (i == simplified_data[j].x){
red_data.push([originalData[i][0],originalData[i][1]]);
new_start = j+1;
}
}
return red_data;
}
// Get "ALL" the Observations that satisfy our query
followNextLink(
var res = followNextLink(
axios.get(BASE_URL, {
params: {
"$resultFormat": PARAM_RESULT_FORMAT,
......@@ -437,6 +473,15 @@ followNextLink(
console.log(err);
})
.then((observationArr) => {
updateLineChartAC(chart1LineTitle, observationArr);
drawHeatMapAC2(observationArr);
// updateLineChartAC(chart1LineTitle, observationArr);
let simplified_data = simplify(getDataReadyForSimplifyJS(observationArr),2,true);
let reducedData = getReducedDataFromSimplifiedData(observationArr, simplified_data);
updateLineChartAC(chart1LineTitle, reducedData);
// drawHeatMapAC2(observationArr);
drawHeatMapAC2(reducedData);
console.log(reducedData.length, observationArr.length);
return reducedData;
});
/*
(c) 2017, Vladimir Agafonkin
Simplify.js, a high-performance JS polyline simplification library
mourner.github.io/simplify-js
*/
(function () { 'use strict';
// to suit your point format, run search/replace for '.x' and '.y';
// for 3D version, see 3d branch (configurability would draw significant performance overhead)
// square distance between 2 points
function getSqDist(p1, p2) {
var dx = p1.x - p2.x,
dy = p1.y - p2.y;
return dx * dx + dy * dy;
}
// square distance from a point to a segment
function getSqSegDist(p, p1, p2) {
var x = p1.x,
y = p1.y,
dx = p2.x - x,
dy = p2.y - y;
if (dx !== 0 || dy !== 0) {
var t = ((p.x - x) * dx + (p.y - y) * dy) / (dx * dx + dy * dy);
if (t > 1) {
x = p2.x;
y = p2.y;
} else if (t > 0) {
x += dx * t;
y += dy * t;
}
}
dx = p.x - x;
dy = p.y - y;
return dx * dx + dy * dy;
}
// rest of the code doesn't care about point format
// basic distance-based simplification
function simplifyRadialDist(points, sqTolerance) {
var prevPoint = points[0],
newPoints = [prevPoint],
point;
for (var i = 1, len = points.length; i < len; i++) {
point = points[i];
if (getSqDist(point, prevPoint) > sqTolerance) {
newPoints.push(point);
prevPoint = point;
}
}
if (prevPoint !== point) newPoints.push(point);
return newPoints;
}
function simplifyDPStep(points, first, last, sqTolerance, simplified) {
var maxSqDist = sqTolerance,
index;
for (var i = first + 1; i < last; i++) {
var sqDist = getSqSegDist(points[i], points[first], points[last]);
if (sqDist > maxSqDist) {
index = i;
maxSqDist = sqDist;
}
}
if (maxSqDist > sqTolerance) {
if (index - first > 1) {
simplifyDPStep(points, first, index, sqTolerance, simplified);
// simplifyDPStep(points, first, index, sqTolerance, simplified, simplified_idx);
}
simplified.push(points[index]);
// simplified_idx.push(index);
if (last - index > 1) {
simplifyDPStep(points, index, last, sqTolerance, simplified);
// simplifyDPStep(points, index, last, sqTolerance, simplified, simplified_idx);
}
}
}
// simplification using Ramer-Douglas-Peucker algorithm
function simplifyDouglasPeucker(points, sqTolerance) {
var last = points.length - 1;
var simplified = [points[0]];
// var simplified_idx = [0];
simplifyDPStep(points, 0, last, sqTolerance, simplified);
// simplifyDPStep(points, 0, last, sqTolerance, simplified,simplified_idx);
simplified.push(points[last]);
// simplified_idx.push(last);
// var simpleObj = {'x':simplified_idx, 'y':simplified};
return simplified;
// return simpleObj;
}
// both algorithms combined for awesome performance
function simplify(points, tolerance, highestQuality) {
if (points.length <= 2) return points;
var sqTolerance = tolerance !== undefined ? tolerance * tolerance : 1;
points = highestQuality ? points : simplifyRadialDist(points, sqTolerance);
points = simplifyDouglasPeucker(points, sqTolerance);
return points;
}
// export as AMD module / Node module / browser or worker variable
if (typeof define === 'function' && define.amd) define(function() { return simplify; });
else if (typeof module !== 'undefined') {
module.exports = simplify;
module.exports.default = simplify;
} else if (typeof self !== 'undefined') self.simplify = simplify;
else window.simplify = simplify;
})();
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment