geojs 1.8.2 → 1.8.5
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/.github/workflows/main.yml +1 -0
- package/CHANGELOG.md +19 -0
- package/geo.js +332 -102
- package/geo.lean.js +330 -100
- package/geo.lean.min.js +2 -2
- package/geo.min.js +6 -6
- package/package.json +8 -8
- package/src/annotation.js +153 -52
- package/src/annotationLayer.js +28 -13
- package/src/fetchQueue.js +50 -11
- package/src/tileLayer.js +18 -2
- package/src/util/common.js +6 -1
package/geo.lean.js
CHANGED
|
@@ -303,7 +303,7 @@ var annotation = function annotation(type, args) {
|
|
|
303
303
|
|
|
304
304
|
this._rotateHandlePosition = function (offset, rotation) {
|
|
305
305
|
var map = m_this.layer().map(),
|
|
306
|
-
|
|
306
|
+
coord = m_this._coordinates(),
|
|
307
307
|
center = util.centerFromPerimeter(m_this._coordinates()),
|
|
308
308
|
dispCenter = center ? map.gcsToDisplay(center, null) : undefined,
|
|
309
309
|
i,
|
|
@@ -317,9 +317,10 @@ var annotation = function annotation(type, args) {
|
|
|
317
317
|
|
|
318
318
|
offset = offset || 0;
|
|
319
319
|
rotation = rotation || 0;
|
|
320
|
+
coord = coord.outer ? coord.outer : coord;
|
|
320
321
|
|
|
321
|
-
for (i = 0; i <
|
|
322
|
-
pos = map.gcsToDisplay(
|
|
322
|
+
for (i = 0; i < coord.length; i += 1) {
|
|
323
|
+
pos = map.gcsToDisplay(coord[i], null);
|
|
323
324
|
maxr2 = Math.max(maxr2, Math.pow(pos.x - dispCenter.x, 2) + Math.pow(pos.y - dispCenter.y, 2));
|
|
324
325
|
}
|
|
325
326
|
|
|
@@ -511,6 +512,30 @@ var annotation = function annotation(type, args) {
|
|
|
511
512
|
return m_this._processEditActionResize(evt);
|
|
512
513
|
}
|
|
513
514
|
};
|
|
515
|
+
/**
|
|
516
|
+
* Return a copy of the _coordinates or a geo.polygon record so that it
|
|
517
|
+
* doesn't share memory with the original.
|
|
518
|
+
*
|
|
519
|
+
* @param {geo.polygon} [coord] if specified, return a copy of this object.
|
|
520
|
+
* Otherwise, return a copy of this._coordinates.
|
|
521
|
+
* @returns {geo.polygon}
|
|
522
|
+
*/
|
|
523
|
+
|
|
524
|
+
|
|
525
|
+
this._copyOfCoordinates = function (coord) {
|
|
526
|
+
coord = coord || m_this._coordinates();
|
|
527
|
+
|
|
528
|
+
if (!coord.outer) {
|
|
529
|
+
return coord.slice();
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
return {
|
|
533
|
+
outer: coord.outer.slice(),
|
|
534
|
+
inner: (coord.inner || []).map(function (h) {
|
|
535
|
+
return h.slice();
|
|
536
|
+
})
|
|
537
|
+
};
|
|
538
|
+
};
|
|
514
539
|
/**
|
|
515
540
|
* When an edit handle is selected or deselected (for instance, by moving the
|
|
516
541
|
* mouse on or off of it), mark if it is selected and record the current
|
|
@@ -532,7 +557,7 @@ var annotation = function annotation(type, args) {
|
|
|
532
557
|
var amountRotated = (m_this._editHandle || {}).amountRotated || 0;
|
|
533
558
|
m_this._editHandle = {
|
|
534
559
|
handle: handle,
|
|
535
|
-
startCoordinates: m_this.
|
|
560
|
+
startCoordinates: m_this._copyOfCoordinates(),
|
|
536
561
|
center: util.centerFromPerimeter(m_this._coordinates()),
|
|
537
562
|
rotatePosition: m_this._rotateHandlePosition(handle.style.rotateHandleOffset, handle.style.rotateHandleRotation + amountRotated),
|
|
538
563
|
startAmountRotated: amountRotated,
|
|
@@ -592,10 +617,10 @@ var annotation = function annotation(type, args) {
|
|
|
592
617
|
}
|
|
593
618
|
|
|
594
619
|
if (m_options.coordinates) {
|
|
595
|
-
var
|
|
620
|
+
var coord = m_options.coordinates;
|
|
596
621
|
delete m_options.coordinates;
|
|
597
622
|
|
|
598
|
-
m_this._coordinates(
|
|
623
|
+
m_this._coordinates(coord);
|
|
599
624
|
}
|
|
600
625
|
|
|
601
626
|
if (m_options.name !== undefined) {
|
|
@@ -829,7 +854,7 @@ var annotation = function annotation(type, args) {
|
|
|
829
854
|
gcs = gcs === null ? map.gcs() : gcs === undefined ? map.ingcs() : gcs;
|
|
830
855
|
|
|
831
856
|
if (gcs !== map.gcs()) {
|
|
832
|
-
coord =
|
|
857
|
+
coord = m_this._convertCoordinates(map.gcs(), gcs, coord);
|
|
833
858
|
}
|
|
834
859
|
}
|
|
835
860
|
|
|
@@ -912,7 +937,7 @@ var annotation = function annotation(type, args) {
|
|
|
912
937
|
|
|
913
938
|
|
|
914
939
|
this.geojson = function (gcs, includeCrs) {
|
|
915
|
-
var
|
|
940
|
+
var coord = m_this._geojsonCoordinates(gcs),
|
|
916
941
|
geotype = m_this._geojsonGeometryType(),
|
|
917
942
|
styles = m_this._geojsonStyles(),
|
|
918
943
|
objStyle = m_this.options('style') || {},
|
|
@@ -921,7 +946,7 @@ var annotation = function annotation(type, args) {
|
|
|
921
946
|
key,
|
|
922
947
|
value;
|
|
923
948
|
|
|
924
|
-
if (!
|
|
949
|
+
if (!coord || !coord.length || !geotype) {
|
|
925
950
|
return;
|
|
926
951
|
}
|
|
927
952
|
|
|
@@ -929,7 +954,7 @@ var annotation = function annotation(type, args) {
|
|
|
929
954
|
type: 'Feature',
|
|
930
955
|
geometry: {
|
|
931
956
|
type: geotype,
|
|
932
|
-
coordinates:
|
|
957
|
+
coordinates: coord
|
|
933
958
|
},
|
|
934
959
|
properties: {
|
|
935
960
|
annotationType: m_type,
|
|
@@ -1027,39 +1052,45 @@ var annotation = function annotation(type, args) {
|
|
|
1027
1052
|
}
|
|
1028
1053
|
|
|
1029
1054
|
editPoints = features[editHandleFeatureLevel].point;
|
|
1030
|
-
vertices.
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
x: (pt.x + vertices[idx + 1].x) / 2,
|
|
1043
|
-
y: (pt.y + vertices[idx + 1].y) / 2
|
|
1044
|
-
}, {
|
|
1045
|
-
type: 'edge',
|
|
1046
|
-
index: idx,
|
|
1047
|
-
style: style,
|
|
1048
|
-
editHandle: true
|
|
1049
|
-
}));
|
|
1050
|
-
}
|
|
1055
|
+
var vertexList = vertices.outer ? [vertices.outer].concat(vertices.inner || []) : [vertices];
|
|
1056
|
+
vertexList.forEach(function (vert, vidx) {
|
|
1057
|
+
vert.forEach(function (pt, idx) {
|
|
1058
|
+
if (opts.vertex !== false) {
|
|
1059
|
+
editPoints.push($.extend({}, pt, {
|
|
1060
|
+
type: 'vertex',
|
|
1061
|
+
index: idx,
|
|
1062
|
+
vindex: vidx,
|
|
1063
|
+
style: style,
|
|
1064
|
+
editHandle: true
|
|
1065
|
+
}));
|
|
1066
|
+
}
|
|
1051
1067
|
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1068
|
+
if (opts.edge !== false && idx !== vert.length - 1 && (pt.x !== vert[idx + 1].x || pt.y !== vert[idx + 1].y)) {
|
|
1069
|
+
editPoints.push($.extend({
|
|
1070
|
+
x: (pt.x + vert[idx + 1].x) / 2,
|
|
1071
|
+
y: (pt.y + vert[idx + 1].y) / 2
|
|
1072
|
+
}, {
|
|
1073
|
+
type: 'edge',
|
|
1074
|
+
index: idx,
|
|
1075
|
+
vindex: vidx,
|
|
1076
|
+
style: style,
|
|
1077
|
+
editHandle: true
|
|
1078
|
+
}));
|
|
1079
|
+
}
|
|
1080
|
+
|
|
1081
|
+
if (opts.edge !== false && !isOpen && idx === vert.length - 1 && (pt.x !== vert[0].x || pt.y !== vert[0].y)) {
|
|
1082
|
+
editPoints.push($.extend({
|
|
1083
|
+
x: (pt.x + vert[0].x) / 2,
|
|
1084
|
+
y: (pt.y + vert[0].y) / 2
|
|
1085
|
+
}, {
|
|
1086
|
+
type: 'edge',
|
|
1087
|
+
index: idx,
|
|
1088
|
+
vindex: vidx,
|
|
1089
|
+
style: style,
|
|
1090
|
+
editHandle: true
|
|
1091
|
+
}));
|
|
1092
|
+
}
|
|
1093
|
+
});
|
|
1063
1094
|
});
|
|
1064
1095
|
|
|
1065
1096
|
if (opts.center !== false) {
|
|
@@ -1092,12 +1123,47 @@ var annotation = function annotation(type, args) {
|
|
|
1092
1123
|
|
|
1093
1124
|
if (selected) {
|
|
1094
1125
|
editPoints.forEach(function (pt) {
|
|
1095
|
-
if (pt.type === selected.type && pt.index === selected.index) {
|
|
1126
|
+
if (pt.type === selected.type && pt.index === selected.index && pt.vindex === selected.vindex) {
|
|
1096
1127
|
pt.selected = true;
|
|
1097
1128
|
}
|
|
1098
1129
|
});
|
|
1099
1130
|
}
|
|
1100
1131
|
};
|
|
1132
|
+
/**
|
|
1133
|
+
* Apply a map function of a geo.polygon.
|
|
1134
|
+
*
|
|
1135
|
+
* @param {geo.polygon} coord The polygon to apply the function to.
|
|
1136
|
+
* @param {function} func The function to apply.
|
|
1137
|
+
* @returns {array} The map results.
|
|
1138
|
+
*/
|
|
1139
|
+
|
|
1140
|
+
|
|
1141
|
+
this._coordinatesMapFunc = function (coord, func) {
|
|
1142
|
+
if (!coord.outer) {
|
|
1143
|
+
return coord.map(func);
|
|
1144
|
+
}
|
|
1145
|
+
|
|
1146
|
+
return {
|
|
1147
|
+
outer: coord.outer.map(func),
|
|
1148
|
+
inner: (coord.inner || []).map(function (h) {
|
|
1149
|
+
return h.map(func);
|
|
1150
|
+
})
|
|
1151
|
+
};
|
|
1152
|
+
};
|
|
1153
|
+
/**
|
|
1154
|
+
* Check if two geo.polygons differ in their first point.
|
|
1155
|
+
*
|
|
1156
|
+
* @param {geo.polygon} coord1 One polygon to compare.
|
|
1157
|
+
* @param {geo.polygon} coord2 A second polygon to compare.
|
|
1158
|
+
* @returns {boolean} true if the first point matches.
|
|
1159
|
+
*/
|
|
1160
|
+
|
|
1161
|
+
|
|
1162
|
+
this._firstPointDifferent = function (coord1, coord2) {
|
|
1163
|
+
coord1 = coord1.outer ? coord1.outer : coord1;
|
|
1164
|
+
coord2 = coord2.outer ? coord2.outer : coord2;
|
|
1165
|
+
return coord1[0].x !== coord2[0].x || coord1[0].y !== coord2[0].y;
|
|
1166
|
+
};
|
|
1101
1167
|
/**
|
|
1102
1168
|
* Process the edit center action for a general annotation.
|
|
1103
1169
|
*
|
|
@@ -1115,14 +1181,14 @@ var annotation = function annotation(type, args) {
|
|
|
1115
1181
|
},
|
|
1116
1182
|
curPts = m_this._coordinates();
|
|
1117
1183
|
|
|
1118
|
-
var pts =
|
|
1184
|
+
var pts = m_this._coordinatesMapFunc(start, function (elem) {
|
|
1119
1185
|
return {
|
|
1120
1186
|
x: elem.x + delta.x,
|
|
1121
1187
|
y: elem.y + delta.y
|
|
1122
1188
|
};
|
|
1123
1189
|
});
|
|
1124
1190
|
|
|
1125
|
-
if (
|
|
1191
|
+
if (m_this._firstPointDifferent(pts, curPts)) {
|
|
1126
1192
|
m_this._coordinates(pts);
|
|
1127
1193
|
|
|
1128
1194
|
return true;
|
|
@@ -1151,7 +1217,7 @@ var annotation = function annotation(type, args) {
|
|
|
1151
1217
|
ang = ang2 - ang1,
|
|
1152
1218
|
curPts = m_this._coordinates();
|
|
1153
1219
|
|
|
1154
|
-
var pts =
|
|
1220
|
+
var pts = m_this._coordinatesMapFunc(start, function (elem) {
|
|
1155
1221
|
var delta = {
|
|
1156
1222
|
x: elem.x - handle.center.x,
|
|
1157
1223
|
y: elem.y - handle.center.y
|
|
@@ -1162,7 +1228,7 @@ var annotation = function annotation(type, args) {
|
|
|
1162
1228
|
};
|
|
1163
1229
|
});
|
|
1164
1230
|
|
|
1165
|
-
if (
|
|
1231
|
+
if (m_this._firstPointDifferent(pts, curPts)) {
|
|
1166
1232
|
m_this._coordinates(pts);
|
|
1167
1233
|
|
|
1168
1234
|
handle.amountRotated = handle.startAmountRotated + ang;
|
|
@@ -1200,14 +1266,15 @@ var annotation = function annotation(type, args) {
|
|
|
1200
1266
|
|
|
1201
1267
|
if (d02 && d01) {
|
|
1202
1268
|
var scale = d02 / d01;
|
|
1203
|
-
|
|
1269
|
+
|
|
1270
|
+
var pts = m_this._coordinatesMapFunc(start, function (elem) {
|
|
1204
1271
|
return {
|
|
1205
1272
|
x: (elem.x - handle.center.x) * scale + handle.center.x,
|
|
1206
1273
|
y: (elem.y - handle.center.y) * scale + handle.center.y
|
|
1207
1274
|
};
|
|
1208
1275
|
});
|
|
1209
1276
|
|
|
1210
|
-
if (
|
|
1277
|
+
if (m_this._firstPointDifferent(pts, curPts)) {
|
|
1211
1278
|
m_this._coordinates(pts);
|
|
1212
1279
|
|
|
1213
1280
|
return true;
|
|
@@ -1228,15 +1295,25 @@ var annotation = function annotation(type, args) {
|
|
|
1228
1295
|
this._processEditActionEdge = function (evt) {
|
|
1229
1296
|
var handle = m_this._editHandle,
|
|
1230
1297
|
index = handle.handle.index,
|
|
1298
|
+
vindex = handle.handle.vindex,
|
|
1231
1299
|
curPts = m_this._coordinates();
|
|
1232
1300
|
|
|
1233
|
-
curPts.
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1301
|
+
if (!curPts.outer) {
|
|
1302
|
+
curPts.splice(index + 1, 0, {
|
|
1303
|
+
x: handle.handle.x,
|
|
1304
|
+
y: handle.handle.y
|
|
1305
|
+
});
|
|
1306
|
+
} else {
|
|
1307
|
+
var loop = vindex ? curPts.inner[vindex - 1] : curPts.outer;
|
|
1308
|
+
loop.splice(index + 1, 0, {
|
|
1309
|
+
x: handle.handle.x,
|
|
1310
|
+
y: handle.handle.y
|
|
1311
|
+
});
|
|
1312
|
+
}
|
|
1313
|
+
|
|
1237
1314
|
handle.handle.type = 'vertex';
|
|
1238
1315
|
handle.handle.index += 1;
|
|
1239
|
-
handle.startCoordinates =
|
|
1316
|
+
handle.startCoordinates = m_this._copyOfCoordinates(curPts);
|
|
1240
1317
|
m_this.modified();
|
|
1241
1318
|
return true;
|
|
1242
1319
|
};
|
|
@@ -1255,8 +1332,10 @@ var annotation = function annotation(type, args) {
|
|
|
1255
1332
|
this._processEditActionVertex = function (evt, canClose) {
|
|
1256
1333
|
var handle = m_this._editHandle,
|
|
1257
1334
|
index = handle.handle.index,
|
|
1335
|
+
vindex = handle.handle.vindex,
|
|
1258
1336
|
start = handle.startCoordinates,
|
|
1259
|
-
|
|
1337
|
+
ptsRef = m_this._coordinates(),
|
|
1338
|
+
curPts = ptsRef.outer ? vindex ? ptsRef.inner[vindex - 1] : ptsRef.outer : ptsRef,
|
|
1260
1339
|
origLen = curPts.length,
|
|
1261
1340
|
origPt = curPts[index],
|
|
1262
1341
|
delta = {
|
|
@@ -1268,6 +1347,10 @@ var annotation = function annotation(type, args) {
|
|
|
1268
1347
|
near,
|
|
1269
1348
|
atEnd;
|
|
1270
1349
|
|
|
1350
|
+
if (start.outer) {
|
|
1351
|
+
start = vindex ? start.inner[vindex - 1] : start.outer;
|
|
1352
|
+
}
|
|
1353
|
+
|
|
1271
1354
|
curPts[index] = {
|
|
1272
1355
|
x: start[index].x + delta.x,
|
|
1273
1356
|
y: start[index].y + delta.y
|
|
@@ -1308,10 +1391,43 @@ var annotation = function annotation(type, args) {
|
|
|
1308
1391
|
return false;
|
|
1309
1392
|
}
|
|
1310
1393
|
|
|
1311
|
-
m_this._coordinates(
|
|
1394
|
+
m_this._coordinates(ptsRef);
|
|
1312
1395
|
|
|
1313
1396
|
return true;
|
|
1314
1397
|
};
|
|
1398
|
+
/**
|
|
1399
|
+
* Transform the annotations coordinates from one gcs to another.
|
|
1400
|
+
*
|
|
1401
|
+
* @param {string|geo.transform} oldgcs The current gcs.
|
|
1402
|
+
* @param {string|geo.transform} newgcs The new gcs.
|
|
1403
|
+
* @param {geo.polygon} [coord] If not specified, convert the coordinates in
|
|
1404
|
+
* place. If specified, convert these coordinates and return them (don't
|
|
1405
|
+
* alter the existing values).
|
|
1406
|
+
* @returns {geo.polygon}
|
|
1407
|
+
*/
|
|
1408
|
+
|
|
1409
|
+
|
|
1410
|
+
this._convertCoordinates = function (oldgcs, newgcs, coord) {
|
|
1411
|
+
var store = !coord;
|
|
1412
|
+
coord = coord || m_this._coordinates();
|
|
1413
|
+
|
|
1414
|
+
if (!coord.outer) {
|
|
1415
|
+
coord = transform.transformCoordinates(oldgcs, newgcs, coord);
|
|
1416
|
+
} else {
|
|
1417
|
+
coord = {
|
|
1418
|
+
outer: transform.transformCoordinates(oldgcs, newgcs, coord.outer),
|
|
1419
|
+
inner: (coord.inner || []).map(function (h) {
|
|
1420
|
+
return transform.transformCoordinates(oldgcs, newgcs, h);
|
|
1421
|
+
})
|
|
1422
|
+
};
|
|
1423
|
+
}
|
|
1424
|
+
|
|
1425
|
+
if (store) {
|
|
1426
|
+
m_this._coordinates(coord);
|
|
1427
|
+
}
|
|
1428
|
+
|
|
1429
|
+
return coord;
|
|
1430
|
+
};
|
|
1315
1431
|
};
|
|
1316
1432
|
/* Functions used by multiple annotations */
|
|
1317
1433
|
|
|
@@ -1664,14 +1780,14 @@ var rectangleAnnotation = function rectangleAnnotation(args, annotationName) {
|
|
|
1664
1780
|
return;
|
|
1665
1781
|
}
|
|
1666
1782
|
|
|
1667
|
-
var
|
|
1783
|
+
var coord = [];
|
|
1668
1784
|
|
|
1669
1785
|
for (var i = 0; i < 4; i += 1) {
|
|
1670
|
-
|
|
1786
|
+
coord.push([src[i].x, src[i].y]);
|
|
1671
1787
|
}
|
|
1672
1788
|
|
|
1673
|
-
|
|
1674
|
-
return [
|
|
1789
|
+
coord.push([src[0].x, src[0].y]);
|
|
1790
|
+
return [coord];
|
|
1675
1791
|
};
|
|
1676
1792
|
/**
|
|
1677
1793
|
* Return the geometry type that is used to store this annotation in geojson.
|
|
@@ -2115,13 +2231,20 @@ var polygonAnnotation = function polygonAnnotation(args) {
|
|
|
2115
2231
|
},
|
|
2116
2232
|
fillOpacity: 0.25,
|
|
2117
2233
|
line: function line(d) {
|
|
2234
|
+
var coord = m_this._coordinates();
|
|
2118
2235
|
/* Return an array that has the same number of items as we have
|
|
2119
2236
|
* vertices. */
|
|
2120
|
-
|
|
2237
|
+
|
|
2238
|
+
|
|
2239
|
+
return Array.apply(null, Array((coord.outer || coord).length)).map(function () {
|
|
2121
2240
|
return d;
|
|
2122
2241
|
});
|
|
2123
2242
|
},
|
|
2124
2243
|
position: function position(d, i) {
|
|
2244
|
+
if (d.x !== undefined) {
|
|
2245
|
+
return d.x;
|
|
2246
|
+
}
|
|
2247
|
+
|
|
2125
2248
|
return m_this.options('vertices')[i];
|
|
2126
2249
|
},
|
|
2127
2250
|
stroke: false,
|
|
@@ -2155,7 +2278,7 @@ var polygonAnnotation = function polygonAnnotation(args) {
|
|
|
2155
2278
|
case annotationState.create:
|
|
2156
2279
|
features = [];
|
|
2157
2280
|
|
|
2158
|
-
if (opt.vertices && opt.vertices.length >= 3) {
|
|
2281
|
+
if (opt.vertices && (opt.vertices.outer || opt.vertices.length >= 3)) {
|
|
2159
2282
|
features[1] = {
|
|
2160
2283
|
polygon: {
|
|
2161
2284
|
polygon: opt.vertices,
|
|
@@ -2340,18 +2463,32 @@ var polygonAnnotation = function polygonAnnotation(args) {
|
|
|
2340
2463
|
this._geojsonCoordinates = function (gcs) {
|
|
2341
2464
|
var src = m_this.coordinates(gcs);
|
|
2342
2465
|
|
|
2343
|
-
if (!src || src.length < 3 || m_this.state() === annotationState.create) {
|
|
2466
|
+
if (!src || !src.outer && src.length < 3 || m_this.state() === annotationState.create) {
|
|
2344
2467
|
return;
|
|
2345
2468
|
}
|
|
2346
2469
|
|
|
2347
|
-
var
|
|
2470
|
+
var coord = [];
|
|
2348
2471
|
|
|
2349
|
-
|
|
2350
|
-
|
|
2472
|
+
if (!src.outer) {
|
|
2473
|
+
coord = [src.map(function (pt) {
|
|
2474
|
+
return [pt.x, pt.y];
|
|
2475
|
+
})];
|
|
2476
|
+
coord[0].push(coord[0][0].slice());
|
|
2477
|
+
} else {
|
|
2478
|
+
coord = [src.outer.map(function (pt) {
|
|
2479
|
+
return [pt.x, pt.y];
|
|
2480
|
+
})];
|
|
2481
|
+
coord[0].push(coord[0][0].slice());
|
|
2482
|
+
(src.inner || []).forEach(function (h) {
|
|
2483
|
+
var poly = h.map(function (pt) {
|
|
2484
|
+
return [pt.x, pt.y];
|
|
2485
|
+
});
|
|
2486
|
+
poly.push(poly[0].slice());
|
|
2487
|
+
coord.push(poly);
|
|
2488
|
+
});
|
|
2351
2489
|
}
|
|
2352
2490
|
|
|
2353
|
-
|
|
2354
|
-
return [coor];
|
|
2491
|
+
return coord;
|
|
2355
2492
|
};
|
|
2356
2493
|
/**
|
|
2357
2494
|
* Return the geometry type that is used to store this annotation in geojson.
|
|
@@ -2659,13 +2796,13 @@ var lineAnnotation = function lineAnnotation(args) {
|
|
|
2659
2796
|
return;
|
|
2660
2797
|
}
|
|
2661
2798
|
|
|
2662
|
-
var
|
|
2799
|
+
var coord = [];
|
|
2663
2800
|
|
|
2664
2801
|
for (var i = 0; i < src.length; i += 1) {
|
|
2665
|
-
|
|
2802
|
+
coord.push([src[i].x, src[i].y]);
|
|
2666
2803
|
}
|
|
2667
2804
|
|
|
2668
|
-
return
|
|
2805
|
+
return coord;
|
|
2669
2806
|
};
|
|
2670
2807
|
/**
|
|
2671
2808
|
* Return the geometry type that is used to store this annotation in geojson.
|
|
@@ -3675,7 +3812,7 @@ var annotationLayer = function annotationLayer(arg) {
|
|
|
3675
3812
|
gcs = gcs === null ? map.gcs() : gcs === undefined ? map.ingcs() : gcs;
|
|
3676
3813
|
|
|
3677
3814
|
if (gcs !== map.gcs()) {
|
|
3678
|
-
annotation.
|
|
3815
|
+
annotation._convertCoordinates(gcs, map.gcs());
|
|
3679
3816
|
}
|
|
3680
3817
|
|
|
3681
3818
|
if (update !== false) {
|
|
@@ -4028,16 +4165,31 @@ var annotationLayer = function annotationLayer(arg) {
|
|
|
4028
4165
|
} // make a copy of the position array to avoid mutating the original.
|
|
4029
4166
|
|
|
4030
4167
|
|
|
4031
|
-
position =
|
|
4168
|
+
position = {
|
|
4169
|
+
outer: position.outer.slice(),
|
|
4170
|
+
inner: (position.inner || []).map(function (h) {
|
|
4171
|
+
return h.slice();
|
|
4172
|
+
})
|
|
4173
|
+
};
|
|
4032
4174
|
|
|
4033
|
-
if (position[position.length - 1][0] === position[0][0] && position[position.length - 1][1] === position[0][1]) {
|
|
4034
|
-
position.splice(position.length - 1, 1);
|
|
4175
|
+
if (position.outer[position.outer.length - 1][0] === position.outer[0][0] && position.outer[position.outer.length - 1][1] === position.outer[0][1]) {
|
|
4176
|
+
position.outer.splice(position.outer.length - 1, 1);
|
|
4035
4177
|
|
|
4036
|
-
if (position.length < 3) {
|
|
4178
|
+
if (position.outer.length < 3) {
|
|
4037
4179
|
return;
|
|
4038
4180
|
}
|
|
4039
4181
|
}
|
|
4040
4182
|
|
|
4183
|
+
position.inner.forEach(function (h) {
|
|
4184
|
+
if (h.length > 3 && h[h.length - 1][0] === h[0][0] && h[h.length - 1][1] === h[0][1]) {
|
|
4185
|
+
h.splice(h.length - 1, 1);
|
|
4186
|
+
}
|
|
4187
|
+
});
|
|
4188
|
+
|
|
4189
|
+
if (!position.inner || !position.inner.length) {
|
|
4190
|
+
position = position.outer;
|
|
4191
|
+
}
|
|
4192
|
+
|
|
4041
4193
|
break;
|
|
4042
4194
|
|
|
4043
4195
|
case 'marker':
|
|
@@ -4049,16 +4201,20 @@ var annotationLayer = function annotationLayer(arg) {
|
|
|
4049
4201
|
break;
|
|
4050
4202
|
}
|
|
4051
4203
|
|
|
4052
|
-
for (i = 0; i < position.length; i += 1) {
|
|
4053
|
-
position[i] = util.normalizeCoordinates(position[i]);
|
|
4054
|
-
}
|
|
4055
|
-
|
|
4056
4204
|
datagcs = data.crs && data.crs.type === 'name' && data.crs.properties && data.crs.properties.type === 'proj4' && data.crs.properties.name ? data.crs.properties.name : gcs;
|
|
4205
|
+
[position.outer || position].concat(position.inner || []).forEach(function (poslist) {
|
|
4206
|
+
for (i = 0; i < poslist.length; i += 1) {
|
|
4207
|
+
poslist[i] = util.normalizeCoordinates(poslist[i]);
|
|
4208
|
+
}
|
|
4057
4209
|
|
|
4058
|
-
|
|
4059
|
-
|
|
4060
|
-
}
|
|
4210
|
+
if (datagcs !== map.gcs()) {
|
|
4211
|
+
var transposlist = transform.transformCoordinates(datagcs, map.gcs(), poslist);
|
|
4061
4212
|
|
|
4213
|
+
for (i = 0; i < poslist.length; i += 1) {
|
|
4214
|
+
poslist[i] = transposlist[i];
|
|
4215
|
+
}
|
|
4216
|
+
}
|
|
4217
|
+
});
|
|
4062
4218
|
options.coordinates = position;
|
|
4063
4219
|
/* For each style listed in the geojsonStyleProperties object, check if
|
|
4064
4220
|
* is given under any of the variety of keys as a valid instance of the
|
|
@@ -10624,6 +10780,7 @@ var fetchQueue = function fetchQueue(options) {
|
|
|
10624
10780
|
this._size = options.size || 6;
|
|
10625
10781
|
this._initialSize = options.initialSize || 0;
|
|
10626
10782
|
this._track = options.track || 600;
|
|
10783
|
+
this._initialTrack = this._track;
|
|
10627
10784
|
this._needed = options.needed || null;
|
|
10628
10785
|
this._batch = false;
|
|
10629
10786
|
var m_this = this,
|
|
@@ -10664,6 +10821,38 @@ var fetchQueue = function fetchQueue(options) {
|
|
|
10664
10821
|
m_this.next_item();
|
|
10665
10822
|
}
|
|
10666
10823
|
});
|
|
10824
|
+
/**
|
|
10825
|
+
* Get/set the track size. This is used to determine when to check if
|
|
10826
|
+
* entries can be discarded.
|
|
10827
|
+
* @property {number} track The number of entries to track without checking
|
|
10828
|
+
* for discards.
|
|
10829
|
+
* @name geo.fetchQueue#track
|
|
10830
|
+
*/
|
|
10831
|
+
|
|
10832
|
+
Object.defineProperty(this, 'track', {
|
|
10833
|
+
get: function get() {
|
|
10834
|
+
return m_this._track;
|
|
10835
|
+
},
|
|
10836
|
+
set: function set(n) {
|
|
10837
|
+
m_this._track = n;
|
|
10838
|
+
}
|
|
10839
|
+
});
|
|
10840
|
+
/**
|
|
10841
|
+
* Get/set the initial track size. Unless changed, this is the value used
|
|
10842
|
+
* for track on class initialization.
|
|
10843
|
+
* @property {number} initialTrack The number of entries to track without
|
|
10844
|
+
* checking for discards.
|
|
10845
|
+
* @name geo.fetchQueue#intitialTrack
|
|
10846
|
+
*/
|
|
10847
|
+
|
|
10848
|
+
Object.defineProperty(this, 'initialTrack', {
|
|
10849
|
+
get: function get() {
|
|
10850
|
+
return m_this._initialTrack;
|
|
10851
|
+
},
|
|
10852
|
+
set: function set(n) {
|
|
10853
|
+
m_this._initialTrack = n;
|
|
10854
|
+
}
|
|
10855
|
+
});
|
|
10667
10856
|
/**
|
|
10668
10857
|
* Get the current queue size. Read only.
|
|
10669
10858
|
* @property {number} length The current queue size.
|
|
@@ -10716,9 +10905,8 @@ var fetchQueue = function fetchQueue(options) {
|
|
|
10716
10905
|
var pos = $.inArray(defer, m_this._queue);
|
|
10717
10906
|
|
|
10718
10907
|
if (pos >= 0) {
|
|
10719
|
-
m_this._queue.splice(pos, 1);
|
|
10720
|
-
|
|
10721
|
-
m_this._addToQueue(defer, atEnd);
|
|
10908
|
+
// m_this._queue.splice(pos, 1);
|
|
10909
|
+
m_this._addToQueue(defer, atEnd, pos);
|
|
10722
10910
|
|
|
10723
10911
|
return defer;
|
|
10724
10912
|
}
|
|
@@ -10752,24 +10940,40 @@ var fetchQueue = function fetchQueue(options) {
|
|
|
10752
10940
|
* @param {boolean} atEnd If falsy, add the item to the front of the queue
|
|
10753
10941
|
* if batching is turned off or at the end of the current batch if it is
|
|
10754
10942
|
* turned on. If truthy, always add the item to the end of the queue.
|
|
10943
|
+
* @param {number} [pos] If specified, the current location in the queue of
|
|
10944
|
+
* the object being added. This avoids having to splice, push, or unshift
|
|
10945
|
+
* the queue.
|
|
10755
10946
|
*/
|
|
10756
10947
|
|
|
10757
10948
|
|
|
10758
|
-
this._addToQueue = function (defer, atEnd) {
|
|
10949
|
+
this._addToQueue = function (defer, atEnd, pos) {
|
|
10950
|
+
var move = atEnd ? m_this._queue.length - 1 : 0;
|
|
10759
10951
|
defer.__fetchQueue._batch = m_this._batch;
|
|
10760
10952
|
|
|
10761
|
-
if (atEnd) {
|
|
10762
|
-
m_this._queue.
|
|
10763
|
-
|
|
10764
|
-
m_this._queue.unshift(defer);
|
|
10765
|
-
} else {
|
|
10766
|
-
for (var i = 0; i < m_this._queue.length; i += 1) {
|
|
10767
|
-
if (m_this._queue[i].__fetchQueue._batch !== m_this._batch) {
|
|
10953
|
+
if (!atEnd && m_this._batch) {
|
|
10954
|
+
for (move = 0; move < m_this._queue.length - (pos === undefined ? 0 : 1); move += 1) {
|
|
10955
|
+
if (m_this._queue[move].__fetchQueue._batch !== m_this._batch) {
|
|
10768
10956
|
break;
|
|
10769
10957
|
}
|
|
10770
10958
|
}
|
|
10959
|
+
}
|
|
10771
10960
|
|
|
10772
|
-
|
|
10961
|
+
if (pos === undefined) {
|
|
10962
|
+
if (atEnd) {
|
|
10963
|
+
m_this._queue.push(defer);
|
|
10964
|
+
} else if (!move) {
|
|
10965
|
+
m_this._queue.unshift(defer);
|
|
10966
|
+
} else {
|
|
10967
|
+
m_this._queue.splice(move, 0, defer);
|
|
10968
|
+
}
|
|
10969
|
+
} else if (pos !== move) {
|
|
10970
|
+
var dir = pos < move ? 1 : -1;
|
|
10971
|
+
|
|
10972
|
+
for (var i = pos; i !== move; i += dir) {
|
|
10973
|
+
m_this._queue[i] = m_this._queue[i + dir];
|
|
10974
|
+
}
|
|
10975
|
+
|
|
10976
|
+
m_this._queue[move] = defer;
|
|
10773
10977
|
}
|
|
10774
10978
|
};
|
|
10775
10979
|
/**
|
|
@@ -26667,7 +26871,7 @@ module.exports = sceneObject;
|
|
|
26667
26871
|
* @constant
|
|
26668
26872
|
* @type {string}
|
|
26669
26873
|
*/
|
|
26670
|
-
module.exports = "
|
|
26874
|
+
module.exports = "c8c9edda606de6cb2990b41bfdfe2c4a82c885cb";
|
|
26671
26875
|
|
|
26672
26876
|
/***/ }),
|
|
26673
26877
|
|
|
@@ -29510,7 +29714,7 @@ var featureLayer = __webpack_require__(3715);
|
|
|
29510
29714
|
* @property {function} [tilesAtZoom=null] A function that is given a zoom
|
|
29511
29715
|
* level and returns `{x: (num), y: (num)}` with the number of tiles at that
|
|
29512
29716
|
* zoom level.
|
|
29513
|
-
* @property {number} [cacheSize=
|
|
29717
|
+
* @property {number} [cacheSize=600] The maximum number of tiles to cache.
|
|
29514
29718
|
* The default is 200 if keepLower is false.
|
|
29515
29719
|
* @property {geo.fetchQueue} [queue] A fetch queue to use. If unspecified, a
|
|
29516
29720
|
* new queue is created.
|
|
@@ -29695,6 +29899,10 @@ var tileLayer = function tileLayer(arg) {
|
|
|
29695
29899
|
|
|
29696
29900
|
if (!arg.cacheSize) {
|
|
29697
29901
|
// this size should be sufficient for a 4k display
|
|
29902
|
+
// where display size is (w, h), minimum tile dimension is ts, and total
|
|
29903
|
+
// number of levels is ml, this is roughly
|
|
29904
|
+
// sum([(math.ceil((w**2+h**2)**0.5 / (ts*2**l)) + 1) *
|
|
29905
|
+
// (math.ceil(min(w, h) / (ts*2**l)) + 1) for l in range(ml)])
|
|
29698
29906
|
arg.cacheSize = arg.keepLower ? 600 : 200;
|
|
29699
29907
|
}
|
|
29700
29908
|
|
|
@@ -29772,6 +29980,10 @@ var tileLayer = function tileLayer(arg) {
|
|
|
29772
29980
|
|
|
29773
29981
|
this._queue._tileLayers.push(m_this);
|
|
29774
29982
|
|
|
29983
|
+
if (this._queue.initialTrack && this._queue.track) {
|
|
29984
|
+
this._queue.track = this._queue.initialTrack * this._queue._tileLayers.length;
|
|
29985
|
+
}
|
|
29986
|
+
|
|
29775
29987
|
var m_tileOffsetValues = {};
|
|
29776
29988
|
/**
|
|
29777
29989
|
* Readonly accessor to the options object.
|
|
@@ -29828,12 +30040,20 @@ var tileLayer = function tileLayer(arg) {
|
|
|
29828
30040
|
if (m_this._queue !== queue) {
|
|
29829
30041
|
if (this._queue && this._queue._tileLayers && this._queue._tileLayers.indexOf(m_this) >= 0) {
|
|
29830
30042
|
this._queue._tileLayers.splice(this._queue._tileLayers.indexOf(m_this), 1);
|
|
30043
|
+
|
|
30044
|
+
if (this._queue.initialTrack && this._queue.track && this._queue._tileLayers.length) {
|
|
30045
|
+
this._queue.track = this._queue.initialTrack * this._queue._tileLayers.length;
|
|
30046
|
+
}
|
|
29831
30047
|
}
|
|
29832
30048
|
|
|
29833
30049
|
m_this._queue = queue;
|
|
29834
30050
|
m_this._queue._tileLayers = m_this._queue._tileLayers || [];
|
|
29835
30051
|
|
|
29836
30052
|
m_this._queue._tileLayers.push(m_this);
|
|
30053
|
+
|
|
30054
|
+
if (m_this._queue.initialTrack && m_this._queue.track) {
|
|
30055
|
+
m_this._queue.track = m_this._queue.initialTrack * m_this._queue._tileLayers.length;
|
|
30056
|
+
}
|
|
29837
30057
|
}
|
|
29838
30058
|
}
|
|
29839
30059
|
});
|
|
@@ -31442,6 +31662,10 @@ var tileLayer = function tileLayer(arg) {
|
|
|
31442
31662
|
|
|
31443
31663
|
if (this._queue && this._queue._tileLayers && this._queue._tileLayers.indexOf(m_this) >= 0) {
|
|
31444
31664
|
this._queue._tileLayers.splice(this._queue._tileLayers.indexOf(m_this), 1);
|
|
31665
|
+
|
|
31666
|
+
if (this._queue.initialTrack && this._queue.track && this._queue._tileLayers.length) {
|
|
31667
|
+
this._queue.track = this._queue.initialTrack * this._queue._tileLayers.length;
|
|
31668
|
+
}
|
|
31445
31669
|
}
|
|
31446
31670
|
|
|
31447
31671
|
return m_this;
|
|
@@ -31478,7 +31702,7 @@ tileLayer.defaults = {
|
|
|
31478
31702
|
topDown: false,
|
|
31479
31703
|
keepLower: true,
|
|
31480
31704
|
idleAfter: 'view',
|
|
31481
|
-
// cacheSize:
|
|
31705
|
+
// cacheSize: 600, // set depending on keepLower
|
|
31482
31706
|
tileRounding: Math.round,
|
|
31483
31707
|
attribution: '',
|
|
31484
31708
|
animationDuration: 0
|
|
@@ -37216,7 +37440,9 @@ var util = {
|
|
|
37216
37440
|
* this is the same as the average of all the points of the lines of the
|
|
37217
37441
|
* perimeter.
|
|
37218
37442
|
*
|
|
37219
|
-
* @param {geo.
|
|
37443
|
+
* @param {geo.geoPolygon} coor An array of coordinates. This can also be
|
|
37444
|
+
* a polygon object with an ``outer`` element with an array of
|
|
37445
|
+
* coordinates.
|
|
37220
37446
|
* @returns {geo.geoPosition|undefined} The position for the center, or
|
|
37221
37447
|
* `undefined` if no such position exists.
|
|
37222
37448
|
* @memberof geo.util
|
|
@@ -37224,6 +37450,10 @@ var util = {
|
|
|
37224
37450
|
centerFromPerimeter: function centerFromPerimeter(coor) {
|
|
37225
37451
|
var position, p0, p1, w, sumw, i;
|
|
37226
37452
|
|
|
37453
|
+
if (coor && coor.outer) {
|
|
37454
|
+
coor = coor.outer;
|
|
37455
|
+
}
|
|
37456
|
+
|
|
37227
37457
|
if (!coor || !coor.length) {
|
|
37228
37458
|
return;
|
|
37229
37459
|
}
|
|
@@ -39131,7 +39361,7 @@ module.exports = vectorFeature;
|
|
|
39131
39361
|
* @constant
|
|
39132
39362
|
* @type {string}
|
|
39133
39363
|
*/
|
|
39134
|
-
module.exports = "1.8.
|
|
39364
|
+
module.exports = "1.8.5";
|
|
39135
39365
|
|
|
39136
39366
|
/***/ }),
|
|
39137
39367
|
|