mapshaper 0.6.42 → 0.6.43
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 +62 -28
- package/package.json +1 -1
- package/www/mapshaper-gui.js +1 -1
- package/www/mapshaper.js +62 -28
package/mapshaper.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
(function () {
|
|
2
2
|
|
|
3
|
-
var VERSION = "0.6.
|
|
3
|
+
var VERSION = "0.6.43";
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
var utils = /*#__PURE__*/Object.freeze({
|
|
@@ -16438,19 +16438,40 @@
|
|
|
16438
16438
|
buildPolygonMosaic: buildPolygonMosaic
|
|
16439
16439
|
});
|
|
16440
16440
|
|
|
16441
|
+
// Map non-negative integers to non-negative integer ids
|
|
16442
|
+
function IdLookupIndex(n) {
|
|
16443
|
+
var index = new Uint32Array(n);
|
|
16444
|
+
|
|
16445
|
+
this.setId = function(id, val) {
|
|
16446
|
+
if (id >= 0 && val >= 0 && val < n - 1) {
|
|
16447
|
+
index[id] = val + 1;
|
|
16448
|
+
} else {
|
|
16449
|
+
error('Invalid value');
|
|
16450
|
+
}
|
|
16451
|
+
};
|
|
16452
|
+
|
|
16453
|
+
this.hasId = function(id) {
|
|
16454
|
+
return this.getId(id) > -1;
|
|
16455
|
+
};
|
|
16456
|
+
|
|
16457
|
+
this.getId = function(id) {
|
|
16458
|
+
if (id >= 0 && id < n) {
|
|
16459
|
+
return index[id] - 1;
|
|
16460
|
+
} else {
|
|
16461
|
+
error('Invalid index');
|
|
16462
|
+
}
|
|
16463
|
+
};
|
|
16464
|
+
}
|
|
16465
|
+
|
|
16466
|
+
|
|
16441
16467
|
// Map positive or negative integer ids to non-negative integer ids
|
|
16442
|
-
function
|
|
16468
|
+
function ArcLookupIndex(n) {
|
|
16443
16469
|
var fwdIndex = new Int32Array(n);
|
|
16444
16470
|
var revIndex = new Int32Array(n);
|
|
16445
|
-
var index = this;
|
|
16446
|
-
var setList = [];
|
|
16447
16471
|
utils.initializeArray(fwdIndex, -1);
|
|
16448
16472
|
utils.initializeArray(revIndex, -1);
|
|
16449
16473
|
|
|
16450
16474
|
this.setId = function(id, val) {
|
|
16451
|
-
if (clearable && !index.hasId(id)) {
|
|
16452
|
-
setList.push(id);
|
|
16453
|
-
}
|
|
16454
16475
|
if (id < 0) {
|
|
16455
16476
|
revIndex[~id] = val;
|
|
16456
16477
|
} else {
|
|
@@ -16458,25 +16479,8 @@
|
|
|
16458
16479
|
}
|
|
16459
16480
|
};
|
|
16460
16481
|
|
|
16461
|
-
this.clear = function() {
|
|
16462
|
-
if (!clearable) {
|
|
16463
|
-
error('Index is not clearable');
|
|
16464
|
-
}
|
|
16465
|
-
setList.forEach(function(id) {
|
|
16466
|
-
index.setId(id, -1);
|
|
16467
|
-
});
|
|
16468
|
-
setList = [];
|
|
16469
|
-
};
|
|
16470
|
-
|
|
16471
|
-
this.clearId = function(id) {
|
|
16472
|
-
if (!index.hasId(id)) {
|
|
16473
|
-
error('Tried to clear an unset id');
|
|
16474
|
-
}
|
|
16475
|
-
index.setId(id, -1);
|
|
16476
|
-
};
|
|
16477
|
-
|
|
16478
16482
|
this.hasId = function(id) {
|
|
16479
|
-
var val =
|
|
16483
|
+
var val = this.getId(id);
|
|
16480
16484
|
return val > -1;
|
|
16481
16485
|
};
|
|
16482
16486
|
|
|
@@ -16489,6 +16493,36 @@
|
|
|
16489
16493
|
};
|
|
16490
16494
|
}
|
|
16491
16495
|
|
|
16496
|
+
// Support clearing the index (for efficient reuse)
|
|
16497
|
+
function ClearableArcLookupIndex(n) {
|
|
16498
|
+
var setList = [];
|
|
16499
|
+
var idx = new ArcLookupIndex(n);
|
|
16500
|
+
var _setId = idx.setId;
|
|
16501
|
+
|
|
16502
|
+
idx.setId = function(id, val) {
|
|
16503
|
+
if (!idx.hasId(id)) {
|
|
16504
|
+
setList.push(id);
|
|
16505
|
+
}
|
|
16506
|
+
_setId(id, val);
|
|
16507
|
+
};
|
|
16508
|
+
|
|
16509
|
+
idx.clear = function() {
|
|
16510
|
+
setList.forEach(function(id) {
|
|
16511
|
+
_setId(id, -1);
|
|
16512
|
+
});
|
|
16513
|
+
setList = [];
|
|
16514
|
+
};
|
|
16515
|
+
|
|
16516
|
+
this.clearId = function(id) {
|
|
16517
|
+
if (!idx.hasId(id)) {
|
|
16518
|
+
error('Tried to clear an unset id');
|
|
16519
|
+
}
|
|
16520
|
+
_setId(id, -1);
|
|
16521
|
+
};
|
|
16522
|
+
|
|
16523
|
+
return idx;
|
|
16524
|
+
}
|
|
16525
|
+
|
|
16492
16526
|
// Associate mosaic tiles with shapes (i.e. identify the groups of tiles that
|
|
16493
16527
|
// belong to each shape)
|
|
16494
16528
|
//
|
|
@@ -16740,7 +16774,7 @@
|
|
|
16740
16774
|
// Supports looking up a shape id using an arc id.
|
|
16741
16775
|
function ShapeArcIndex(shapes, arcs) {
|
|
16742
16776
|
var n = arcs.size();
|
|
16743
|
-
var index = new
|
|
16777
|
+
var index = new ArcLookupIndex(n);
|
|
16744
16778
|
var shapeId;
|
|
16745
16779
|
shapes.forEach(onShape);
|
|
16746
16780
|
|
|
@@ -16892,7 +16926,7 @@
|
|
|
16892
16926
|
var arcs = dataset.arcs;
|
|
16893
16927
|
var filter = getArcPresenceTest(lyr.shapes, arcs);
|
|
16894
16928
|
var nodes = new NodeCollection(arcs, filter);
|
|
16895
|
-
var arcIndex = new
|
|
16929
|
+
var arcIndex = new ClearableArcLookupIndex(arcs.size());
|
|
16896
16930
|
lyr.shapes = lyr.shapes.map(function(shp, i) {
|
|
16897
16931
|
if (!shp) return null;
|
|
16898
16932
|
// split parts at nodes (where multiple arcs intersect)
|
|
@@ -38262,7 +38296,7 @@ ${svg}
|
|
|
38262
38296
|
// polygon layer, @clipData). This avoids performing unnecessary intersection
|
|
38263
38297
|
// tests on each line segment.
|
|
38264
38298
|
var layers = dataset.layers.filter(function(lyr) {
|
|
38265
|
-
return !layerIsFullyEnclosed(lyr, dataset, clipData);
|
|
38299
|
+
return layerHasGeometry(lyr) && !layerIsFullyEnclosed(lyr, dataset, clipData);
|
|
38266
38300
|
});
|
|
38267
38301
|
if (layers.length > 0) {
|
|
38268
38302
|
clipLayersInPlace(layers, clipData, dataset, 'clip');
|
package/package.json
CHANGED
package/www/mapshaper-gui.js
CHANGED
|
@@ -8112,7 +8112,7 @@
|
|
|
8112
8112
|
el.addClass('option-menu');
|
|
8113
8113
|
var html = `<input type="text" class="field-name text-input" placeholder="field name"><br>
|
|
8114
8114
|
<input type="text" class="field-value text-input" placeholder="value"><br>
|
|
8115
|
-
<div class="btn dialog-btn">Apply</div> <span class="inline-checkbox"><input type="checkbox" class="all" />assign value to all records</span>`;
|
|
8115
|
+
<div tabindex="0" class="btn dialog-btn">Apply</div> <span class="inline-checkbox"><input type="checkbox" class="all" />assign value to all records</span>`;
|
|
8116
8116
|
el.html(html);
|
|
8117
8117
|
|
|
8118
8118
|
var name = el.findChild('.field-name');
|
package/www/mapshaper.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
(function () {
|
|
2
2
|
|
|
3
|
-
var VERSION = "0.6.
|
|
3
|
+
var VERSION = "0.6.43";
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
var utils = /*#__PURE__*/Object.freeze({
|
|
@@ -16438,19 +16438,40 @@
|
|
|
16438
16438
|
buildPolygonMosaic: buildPolygonMosaic
|
|
16439
16439
|
});
|
|
16440
16440
|
|
|
16441
|
+
// Map non-negative integers to non-negative integer ids
|
|
16442
|
+
function IdLookupIndex(n) {
|
|
16443
|
+
var index = new Uint32Array(n);
|
|
16444
|
+
|
|
16445
|
+
this.setId = function(id, val) {
|
|
16446
|
+
if (id >= 0 && val >= 0 && val < n - 1) {
|
|
16447
|
+
index[id] = val + 1;
|
|
16448
|
+
} else {
|
|
16449
|
+
error('Invalid value');
|
|
16450
|
+
}
|
|
16451
|
+
};
|
|
16452
|
+
|
|
16453
|
+
this.hasId = function(id) {
|
|
16454
|
+
return this.getId(id) > -1;
|
|
16455
|
+
};
|
|
16456
|
+
|
|
16457
|
+
this.getId = function(id) {
|
|
16458
|
+
if (id >= 0 && id < n) {
|
|
16459
|
+
return index[id] - 1;
|
|
16460
|
+
} else {
|
|
16461
|
+
error('Invalid index');
|
|
16462
|
+
}
|
|
16463
|
+
};
|
|
16464
|
+
}
|
|
16465
|
+
|
|
16466
|
+
|
|
16441
16467
|
// Map positive or negative integer ids to non-negative integer ids
|
|
16442
|
-
function
|
|
16468
|
+
function ArcLookupIndex(n) {
|
|
16443
16469
|
var fwdIndex = new Int32Array(n);
|
|
16444
16470
|
var revIndex = new Int32Array(n);
|
|
16445
|
-
var index = this;
|
|
16446
|
-
var setList = [];
|
|
16447
16471
|
utils.initializeArray(fwdIndex, -1);
|
|
16448
16472
|
utils.initializeArray(revIndex, -1);
|
|
16449
16473
|
|
|
16450
16474
|
this.setId = function(id, val) {
|
|
16451
|
-
if (clearable && !index.hasId(id)) {
|
|
16452
|
-
setList.push(id);
|
|
16453
|
-
}
|
|
16454
16475
|
if (id < 0) {
|
|
16455
16476
|
revIndex[~id] = val;
|
|
16456
16477
|
} else {
|
|
@@ -16458,25 +16479,8 @@
|
|
|
16458
16479
|
}
|
|
16459
16480
|
};
|
|
16460
16481
|
|
|
16461
|
-
this.clear = function() {
|
|
16462
|
-
if (!clearable) {
|
|
16463
|
-
error('Index is not clearable');
|
|
16464
|
-
}
|
|
16465
|
-
setList.forEach(function(id) {
|
|
16466
|
-
index.setId(id, -1);
|
|
16467
|
-
});
|
|
16468
|
-
setList = [];
|
|
16469
|
-
};
|
|
16470
|
-
|
|
16471
|
-
this.clearId = function(id) {
|
|
16472
|
-
if (!index.hasId(id)) {
|
|
16473
|
-
error('Tried to clear an unset id');
|
|
16474
|
-
}
|
|
16475
|
-
index.setId(id, -1);
|
|
16476
|
-
};
|
|
16477
|
-
|
|
16478
16482
|
this.hasId = function(id) {
|
|
16479
|
-
var val =
|
|
16483
|
+
var val = this.getId(id);
|
|
16480
16484
|
return val > -1;
|
|
16481
16485
|
};
|
|
16482
16486
|
|
|
@@ -16489,6 +16493,36 @@
|
|
|
16489
16493
|
};
|
|
16490
16494
|
}
|
|
16491
16495
|
|
|
16496
|
+
// Support clearing the index (for efficient reuse)
|
|
16497
|
+
function ClearableArcLookupIndex(n) {
|
|
16498
|
+
var setList = [];
|
|
16499
|
+
var idx = new ArcLookupIndex(n);
|
|
16500
|
+
var _setId = idx.setId;
|
|
16501
|
+
|
|
16502
|
+
idx.setId = function(id, val) {
|
|
16503
|
+
if (!idx.hasId(id)) {
|
|
16504
|
+
setList.push(id);
|
|
16505
|
+
}
|
|
16506
|
+
_setId(id, val);
|
|
16507
|
+
};
|
|
16508
|
+
|
|
16509
|
+
idx.clear = function() {
|
|
16510
|
+
setList.forEach(function(id) {
|
|
16511
|
+
_setId(id, -1);
|
|
16512
|
+
});
|
|
16513
|
+
setList = [];
|
|
16514
|
+
};
|
|
16515
|
+
|
|
16516
|
+
this.clearId = function(id) {
|
|
16517
|
+
if (!idx.hasId(id)) {
|
|
16518
|
+
error('Tried to clear an unset id');
|
|
16519
|
+
}
|
|
16520
|
+
_setId(id, -1);
|
|
16521
|
+
};
|
|
16522
|
+
|
|
16523
|
+
return idx;
|
|
16524
|
+
}
|
|
16525
|
+
|
|
16492
16526
|
// Associate mosaic tiles with shapes (i.e. identify the groups of tiles that
|
|
16493
16527
|
// belong to each shape)
|
|
16494
16528
|
//
|
|
@@ -16740,7 +16774,7 @@
|
|
|
16740
16774
|
// Supports looking up a shape id using an arc id.
|
|
16741
16775
|
function ShapeArcIndex(shapes, arcs) {
|
|
16742
16776
|
var n = arcs.size();
|
|
16743
|
-
var index = new
|
|
16777
|
+
var index = new ArcLookupIndex(n);
|
|
16744
16778
|
var shapeId;
|
|
16745
16779
|
shapes.forEach(onShape);
|
|
16746
16780
|
|
|
@@ -16892,7 +16926,7 @@
|
|
|
16892
16926
|
var arcs = dataset.arcs;
|
|
16893
16927
|
var filter = getArcPresenceTest(lyr.shapes, arcs);
|
|
16894
16928
|
var nodes = new NodeCollection(arcs, filter);
|
|
16895
|
-
var arcIndex = new
|
|
16929
|
+
var arcIndex = new ClearableArcLookupIndex(arcs.size());
|
|
16896
16930
|
lyr.shapes = lyr.shapes.map(function(shp, i) {
|
|
16897
16931
|
if (!shp) return null;
|
|
16898
16932
|
// split parts at nodes (where multiple arcs intersect)
|
|
@@ -38262,7 +38296,7 @@ ${svg}
|
|
|
38262
38296
|
// polygon layer, @clipData). This avoids performing unnecessary intersection
|
|
38263
38297
|
// tests on each line segment.
|
|
38264
38298
|
var layers = dataset.layers.filter(function(lyr) {
|
|
38265
|
-
return !layerIsFullyEnclosed(lyr, dataset, clipData);
|
|
38299
|
+
return layerHasGeometry(lyr) && !layerIsFullyEnclosed(lyr, dataset, clipData);
|
|
38266
38300
|
});
|
|
38267
38301
|
if (layers.length > 0) {
|
|
38268
38302
|
clipLayersInPlace(layers, clipData, dataset, 'clip');
|