mapshaper 0.6.70 → 0.6.71
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/mapshaper.js +75 -11
- package/package.json +1 -1
- package/www/index.html +1 -0
- package/www/mapshaper-gui.js +1240 -659
- package/www/mapshaper.js +75 -11
- package/www/page.css +13 -9
package/www/mapshaper.js
CHANGED
|
@@ -1819,6 +1819,21 @@
|
|
|
1819
1819
|
return [xmin, ymin, xmax, ymax];
|
|
1820
1820
|
}
|
|
1821
1821
|
|
|
1822
|
+
function getUnfilteredArcLength(arcId, arcs) {
|
|
1823
|
+
var data = arcs.getVertexData();
|
|
1824
|
+
return data.nn[arcId];
|
|
1825
|
+
}
|
|
1826
|
+
|
|
1827
|
+
function getUnfilteredArcCoords(arcId, arcs) {
|
|
1828
|
+
var data = arcs.getVertexData();
|
|
1829
|
+
var coords = [];
|
|
1830
|
+
var start = data.ii[arcId];
|
|
1831
|
+
var n = data.nn[arcId];
|
|
1832
|
+
for (var i=0; i<n; i++) {
|
|
1833
|
+
coords.push([data.xx[start + i], data.yy[start + i]]);
|
|
1834
|
+
}
|
|
1835
|
+
return coords;
|
|
1836
|
+
}
|
|
1822
1837
|
|
|
1823
1838
|
function findArcIdFromVertexId(i, ii) {
|
|
1824
1839
|
// binary search
|
|
@@ -1836,6 +1851,22 @@
|
|
|
1836
1851
|
return lower; // assumes dataset is not empty
|
|
1837
1852
|
}
|
|
1838
1853
|
|
|
1854
|
+
function deleteLastArc(arcs) {
|
|
1855
|
+
var data = arcs.getVertexData();
|
|
1856
|
+
var arcId = arcs.size() - 1;
|
|
1857
|
+
var arcLen = data.nn[arcId];
|
|
1858
|
+
var n = data.xx.length;
|
|
1859
|
+
var z = arcs.getRetainedInterval();
|
|
1860
|
+
var xx2 = new Float64Array(data.xx.buffer, 0, n-arcLen);
|
|
1861
|
+
var yy2 = new Float64Array(data.yy.buffer, 0, n-arcLen);
|
|
1862
|
+
var nn2 = new Int32Array(data.nn.buffer, 0, arcs.size() - 1);
|
|
1863
|
+
var zz2 = arcs.isFlat() ?
|
|
1864
|
+
null :
|
|
1865
|
+
new Float64Array(data.zz.buffer, 0, n-arcLen);
|
|
1866
|
+
arcs.updateVertexData(nn2, xx2, yy2, zz2);
|
|
1867
|
+
arcs.setRetainedInterval(z);
|
|
1868
|
+
}
|
|
1869
|
+
|
|
1839
1870
|
function deleteVertex(arcs, i) {
|
|
1840
1871
|
var data = arcs.getVertexData();
|
|
1841
1872
|
var nn = data.nn;
|
|
@@ -1866,12 +1897,25 @@
|
|
|
1866
1897
|
arcs.setRetainedInterval(z);
|
|
1867
1898
|
}
|
|
1868
1899
|
|
|
1900
|
+
function appendEmptyArc(arcs) {
|
|
1901
|
+
var data = arcs.getVertexData();
|
|
1902
|
+
var nn = utils.extendBuffer(data.nn, data.nn.length + 1, data.nn.length);
|
|
1903
|
+
arcs.updateVertexData(nn, data.xx, data.yy, data.zz);
|
|
1904
|
+
}
|
|
1905
|
+
|
|
1906
|
+
// adds vertex to last arc
|
|
1907
|
+
// (used when adding lines in the GUI)
|
|
1908
|
+
// p: [x, y] point in display coordinates
|
|
1909
|
+
function appendVertex(arcs, p) {
|
|
1910
|
+
var i = arcs.getPointCount(); // one past the last idx
|
|
1911
|
+
insertVertex(arcs, i, p);
|
|
1912
|
+
}
|
|
1913
|
+
|
|
1869
1914
|
function insertVertex(arcs, i, p) {
|
|
1870
1915
|
var data = arcs.getVertexData();
|
|
1871
1916
|
var nn = data.nn;
|
|
1872
1917
|
var n = data.xx.length;
|
|
1873
1918
|
var count = 0;
|
|
1874
|
-
var found = false;
|
|
1875
1919
|
var xx2, yy2, zz2;
|
|
1876
1920
|
// avoid re-allocating memory on each insertion
|
|
1877
1921
|
if (data.xx.buffer.byteLength >= data.xx.length * 8 + 8) {
|
|
@@ -1884,13 +1928,21 @@
|
|
|
1884
1928
|
if (!arcs.isFlat()) {
|
|
1885
1929
|
zz2 = new Float64Array(new ArrayBuffer((n + 1) * 8), 0, n+1);
|
|
1886
1930
|
}
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1931
|
+
if (i < 0 || i > n) {
|
|
1932
|
+
error('Out-of-range vertex insertion index:', i);
|
|
1933
|
+
} else if (i == n) {
|
|
1934
|
+
// appending vertex to last arc
|
|
1935
|
+
nn[nn.length - 1]++;
|
|
1936
|
+
} else {
|
|
1937
|
+
for (var j=0; j<nn.length; j++) {
|
|
1938
|
+
count += nn[j];
|
|
1939
|
+
if (count >= i) { // TODO: confirm this
|
|
1940
|
+
nn[j] = nn[j] + 1;
|
|
1941
|
+
break;
|
|
1942
|
+
}
|
|
1892
1943
|
}
|
|
1893
1944
|
}
|
|
1945
|
+
|
|
1894
1946
|
utils.copyElements(data.xx, 0, xx2, 0, i);
|
|
1895
1947
|
utils.copyElements(data.yy, 0, yy2, 0, i);
|
|
1896
1948
|
utils.copyElements(data.xx, i, xx2, i+1, n-i);
|
|
@@ -1962,8 +2014,13 @@
|
|
|
1962
2014
|
__proto__: null,
|
|
1963
2015
|
absArcId: absArcId,
|
|
1964
2016
|
calcArcBounds: calcArcBounds,
|
|
2017
|
+
getUnfilteredArcLength: getUnfilteredArcLength,
|
|
2018
|
+
getUnfilteredArcCoords: getUnfilteredArcCoords,
|
|
1965
2019
|
findArcIdFromVertexId: findArcIdFromVertexId,
|
|
2020
|
+
deleteLastArc: deleteLastArc,
|
|
1966
2021
|
deleteVertex: deleteVertex,
|
|
2022
|
+
appendEmptyArc: appendEmptyArc,
|
|
2023
|
+
appendVertex: appendVertex,
|
|
1967
2024
|
insertVertex: insertVertex,
|
|
1968
2025
|
countFilteredVertices: countFilteredVertices,
|
|
1969
2026
|
filterVertexData: filterVertexData
|
|
@@ -13520,12 +13577,19 @@
|
|
|
13520
13577
|
function parseSizeParam(p) {
|
|
13521
13578
|
var str = String(p),
|
|
13522
13579
|
num = parseFloat(str),
|
|
13523
|
-
units = /px|pix/.test(str) && 'px' ||
|
|
13524
|
-
|
|
13525
|
-
|
|
13580
|
+
units = /px|pix/.test(str) && 'px' ||
|
|
13581
|
+
/pt|point/.test(str) && 'pt' ||
|
|
13582
|
+
/in/.test(str) && 'in' ||
|
|
13583
|
+
/cm/.test(str) && 'cm' ||
|
|
13584
|
+
!isNaN(+str) && 'px' || // px is the default
|
|
13585
|
+
null;
|
|
13586
|
+
var px = units == 'in' && num * 72 ||
|
|
13587
|
+
units == 'cm' && Math.round(num * 28.3465) ||
|
|
13588
|
+
num;
|
|
13589
|
+
if (px > 0 === false || !units) {
|
|
13526
13590
|
stop('Invalid size:', str);
|
|
13527
13591
|
}
|
|
13528
|
-
return
|
|
13592
|
+
return px;
|
|
13529
13593
|
}
|
|
13530
13594
|
|
|
13531
13595
|
// Return coeff. for converting a distance measure to dataset coordinates
|
|
@@ -45428,7 +45492,7 @@ ${svg}
|
|
|
45428
45492
|
});
|
|
45429
45493
|
}
|
|
45430
45494
|
|
|
45431
|
-
var version = "0.6.
|
|
45495
|
+
var version = "0.6.71";
|
|
45432
45496
|
|
|
45433
45497
|
// Parse command line args into commands and run them
|
|
45434
45498
|
// Function takes an optional Node-style callback. A Promise is returned if no callback is given.
|
package/www/page.css
CHANGED
|
@@ -59,7 +59,8 @@ body {
|
|
|
59
59
|
.save-menu-link,
|
|
60
60
|
.save-menu-btn,
|
|
61
61
|
.add-field-btn,
|
|
62
|
-
.nav-menu-item
|
|
62
|
+
.nav-menu-item,
|
|
63
|
+
.edit-data-btn {
|
|
63
64
|
color: #10699b;
|
|
64
65
|
}
|
|
65
66
|
|
|
@@ -560,7 +561,7 @@ body.dragover #import-options-drop-area .drop-area {
|
|
|
560
561
|
white-space: pre-line;
|
|
561
562
|
margin: 0 0 7px 0;
|
|
562
563
|
line-height: 1.2;
|
|
563
|
-
font-size: 90%;
|
|
564
|
+
/* font-size: 90%; */
|
|
564
565
|
}
|
|
565
566
|
|
|
566
567
|
|
|
@@ -816,7 +817,7 @@ img.close-btn {
|
|
|
816
817
|
|
|
817
818
|
.close2-btn {
|
|
818
819
|
display: inline-block;
|
|
819
|
-
background-color: #
|
|
820
|
+
background-color: #eee;
|
|
820
821
|
background-image: url("images/close2.png");
|
|
821
822
|
background-size: cover;
|
|
822
823
|
float: right;
|
|
@@ -829,7 +830,7 @@ img.close-btn {
|
|
|
829
830
|
}
|
|
830
831
|
|
|
831
832
|
.close2-btn:hover {
|
|
832
|
-
background-color: #
|
|
833
|
+
background-color: #d5d5d5;
|
|
833
834
|
}
|
|
834
835
|
|
|
835
836
|
.pin-all img {
|
|
@@ -1193,7 +1194,7 @@ div.basemap-style-btn.active img {
|
|
|
1193
1194
|
}
|
|
1194
1195
|
|
|
1195
1196
|
.map-layers.add-points,
|
|
1196
|
-
.map-layers.
|
|
1197
|
+
.map-layers.edit-lines {
|
|
1197
1198
|
cursor: crosshair;
|
|
1198
1199
|
}
|
|
1199
1200
|
|
|
@@ -1364,20 +1365,23 @@ div.basemap-style-btn.active img {
|
|
|
1364
1365
|
padding: 1px 2px 3px 2px;
|
|
1365
1366
|
}
|
|
1366
1367
|
|
|
1367
|
-
.add-field-btn
|
|
1368
|
+
.add-field-btn,
|
|
1369
|
+
.edit-data-btn {
|
|
1368
1370
|
display: inline-block;
|
|
1369
1371
|
font-size: 12px;
|
|
1370
|
-
margin-top:
|
|
1372
|
+
margin-top: 3px;
|
|
1371
1373
|
}
|
|
1372
1374
|
|
|
1373
1375
|
.save-menu-btn:hover,
|
|
1374
|
-
.add-field-btn:hover
|
|
1376
|
+
.add-field-btn:hover,
|
|
1377
|
+
.edit-data-btn:hover {
|
|
1375
1378
|
color: black;
|
|
1376
1379
|
}
|
|
1377
1380
|
|
|
1378
1381
|
.save-menu-link,
|
|
1379
1382
|
.save-menu-btn,
|
|
1380
|
-
.add-field-btn
|
|
1383
|
+
.add-field-btn,
|
|
1384
|
+
.edit-data-btn {
|
|
1381
1385
|
cursor: pointer;
|
|
1382
1386
|
}
|
|
1383
1387
|
|