geojs 1.9.1 → 1.9.4
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/CHANGELOG.md +16 -0
- package/geo.js +138 -25
- package/geo.lean.js +137 -24
- package/geo.lean.min.js +2 -2
- package/geo.min.js +7 -7
- package/package.json +3 -3
- package/src/action.js +1 -4
- package/src/annotation/annotation.js +8 -0
- package/src/annotationLayer.js +28 -9
- package/src/lineFeature.js +7 -4
- package/src/mapInteractor.js +46 -3
- package/src/registry.js +3 -0
- package/src/trackFeature.js +3 -1
- package/src/util/polyops.js +4 -1
- package/src/webgl/lineFeature.js +14 -0
package/geo.lean.js
CHANGED
|
@@ -31,10 +31,7 @@ var geo_action = {
|
|
|
31
31
|
zoom: 'geo_action_zoom',
|
|
32
32
|
zoomrotate: 'geo_action_zoom_rotate',
|
|
33
33
|
zoomselect: 'geo_action_zoomselect',
|
|
34
|
-
// annotation actions
|
|
35
|
-
annotation_line: 'geo_annotation_line',
|
|
36
|
-
annotation_polygon: 'geo_annotation_polygon',
|
|
37
|
-
annotation_rectangle: 'geo_annotation_rectangle',
|
|
34
|
+
// annotation actions -- some are also added by the registry
|
|
38
35
|
annotation_edit_handle: 'geo_annotation_edit_handle'
|
|
39
36
|
};
|
|
40
37
|
module.exports = geo_action;
|
|
@@ -221,6 +218,15 @@ var annotation = function annotation(type, args) {
|
|
|
221
218
|
this.id = function () {
|
|
222
219
|
return m_id;
|
|
223
220
|
};
|
|
221
|
+
/**
|
|
222
|
+
* Assign a new id to this annotation.
|
|
223
|
+
*/
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
this.newId = function () {
|
|
227
|
+
annotationId += 1;
|
|
228
|
+
m_id = annotationId;
|
|
229
|
+
};
|
|
224
230
|
/**
|
|
225
231
|
* Get or set the name of this annotation.
|
|
226
232
|
*
|
|
@@ -3725,6 +3731,17 @@ var textFeature = __webpack_require__(9757);
|
|
|
3725
3731
|
* style object.
|
|
3726
3732
|
*/
|
|
3727
3733
|
|
|
3734
|
+
/**
|
|
3735
|
+
* @typedef {geo.util.polyop.spec} geo.util.polyop.annotationLayerSpec
|
|
3736
|
+
* @extends {geo.util.polyop.spec}
|
|
3737
|
+
* @property {string} [keepAnnotations='exact'] Determine which annotations are
|
|
3738
|
+
* present after a boolean operation. `'exact'` replaces modified
|
|
3739
|
+
* annotations with the results; unmodified annotations are left as is.
|
|
3740
|
+
* `'all'` replaces all annotations, so unchanged annotations may be
|
|
3741
|
+
* converted to polygonAnnotations. `'none'` discards all existing
|
|
3742
|
+
* annotations and only keeps modified results.
|
|
3743
|
+
*/
|
|
3744
|
+
|
|
3728
3745
|
/**
|
|
3729
3746
|
* Layer to handle direct interactions with different features. Annotations
|
|
3730
3747
|
* (features) can be created by calling mode(<name of feature>) or cancelled
|
|
@@ -4243,6 +4260,10 @@ var annotationLayer = function annotationLayer(arg) {
|
|
|
4243
4260
|
var pos = $.inArray(annotation, m_annotations);
|
|
4244
4261
|
|
|
4245
4262
|
if (pos < 0) {
|
|
4263
|
+
while (m_this.annotationById(annotation.id())) {
|
|
4264
|
+
annotation.newId();
|
|
4265
|
+
}
|
|
4266
|
+
|
|
4246
4267
|
m_this.geoTrigger(geo_event.annotation.add_before, {
|
|
4247
4268
|
annotation: annotation
|
|
4248
4269
|
});
|
|
@@ -5177,13 +5198,19 @@ var annotationLayer = function annotationLayer(arg) {
|
|
|
5177
5198
|
this.toPolygonList = function (opts) {
|
|
5178
5199
|
var poly = [];
|
|
5179
5200
|
opts = opts || {};
|
|
5180
|
-
|
|
5201
|
+
var indices = [];
|
|
5202
|
+
|
|
5203
|
+
if (!opts.annotationIndices) {
|
|
5204
|
+
opts.annotationIndices = {};
|
|
5205
|
+
}
|
|
5206
|
+
|
|
5207
|
+
opts.annotationIndices[m_this.id()] = indices;
|
|
5181
5208
|
m_annotations.forEach(function (annotation, idx) {
|
|
5182
5209
|
if (annotation.toPolygonList) {
|
|
5183
5210
|
annotation.toPolygonList(opts).forEach(function (p) {
|
|
5184
5211
|
return poly.push(p);
|
|
5185
5212
|
});
|
|
5186
|
-
|
|
5213
|
+
indices.push(idx);
|
|
5187
5214
|
}
|
|
5188
5215
|
});
|
|
5189
5216
|
return poly;
|
|
@@ -5192,8 +5219,8 @@ var annotationLayer = function annotationLayer(arg) {
|
|
|
5192
5219
|
* Replace appropriate annotations with a list of polygons.
|
|
5193
5220
|
*
|
|
5194
5221
|
* @param {geo.polygonList} poly A list of polygons.
|
|
5195
|
-
* @param {geo.util.polyop.
|
|
5196
|
-
* correspondence used to track annotations.
|
|
5222
|
+
* @param {geo.util.polyop.annotationLayerSpec} [opts] This contains
|
|
5223
|
+
* annotationIndices and correspondence used to track annotations.
|
|
5197
5224
|
* @returns {this}
|
|
5198
5225
|
*/
|
|
5199
5226
|
|
|
@@ -5209,16 +5236,17 @@ var annotationLayer = function annotationLayer(arg) {
|
|
|
5209
5236
|
var keepIds = {};
|
|
5210
5237
|
var reusedIds = {};
|
|
5211
5238
|
var correspond, exact, annot;
|
|
5239
|
+
var indices = (opts.annotationIndices || {})[m_this.id()];
|
|
5212
5240
|
|
|
5213
|
-
if (
|
|
5241
|
+
if (indices && opts.correspond && opts.correspond.poly1 && indices.length === opts.correspond.poly1.length) {
|
|
5214
5242
|
correspond = opts.correspond.poly1;
|
|
5215
5243
|
exact = opts.correspond.exact1;
|
|
5216
5244
|
annot = m_this.annotations();
|
|
5217
5245
|
}
|
|
5218
5246
|
|
|
5219
|
-
if (keep !== 'all' && keep !== 'none') {
|
|
5247
|
+
if (keep !== 'all' && keep !== 'none' && annot) {
|
|
5220
5248
|
annot.forEach(function (oldAnnot, idx) {
|
|
5221
|
-
if (
|
|
5249
|
+
if (indices.indexOf(idx) < 0) {
|
|
5222
5250
|
keepIds[oldAnnot.id()] = true;
|
|
5223
5251
|
}
|
|
5224
5252
|
});
|
|
@@ -5245,7 +5273,7 @@ var annotationLayer = function annotationLayer(arg) {
|
|
|
5245
5273
|
for (var i = 0; i < correspond.length; i += 1) {
|
|
5246
5274
|
if (correspond[i] && correspond[i].indexOf(idx) >= 0) {
|
|
5247
5275
|
var _ret = function () {
|
|
5248
|
-
var orig = annot[
|
|
5276
|
+
var orig = annot[indices[i]];
|
|
5249
5277
|
|
|
5250
5278
|
if (keep !== 'all' && keep !== 'none' && exact && exact[i] && exact[i].indexOf(idx) >= 0) {
|
|
5251
5279
|
keepIds[orig.id()] = true;
|
|
@@ -5297,7 +5325,7 @@ var annotationLayer = function annotationLayer(arg) {
|
|
|
5297
5325
|
|
|
5298
5326
|
|
|
5299
5327
|
polyAnnot.forEach(function (p) {
|
|
5300
|
-
m_this.addAnnotation(registry.createAnnotation('polygon', p), m_this.gcs(), false);
|
|
5328
|
+
m_this.addAnnotation(registry.createAnnotation('polygon', p), m_this.map().gcs(), false);
|
|
5301
5329
|
update = true;
|
|
5302
5330
|
});
|
|
5303
5331
|
|
|
@@ -15578,9 +15606,12 @@ var util = __webpack_require__(4634);
|
|
|
15578
15606
|
* divided by the sine of half the angle between segments, then a bevel join
|
|
15579
15607
|
* is used instead. This is a single value that applies to all lines. If a
|
|
15580
15608
|
* function, it is called with `(data)`.
|
|
15581
|
-
* @property {boolean|function} [uniformLine=false] Boolean indicating
|
|
15582
|
-
* line has a uniform style (uniform stroke color, opacity, and
|
|
15583
|
-
* vary by line.
|
|
15609
|
+
* @property {boolean|string|function} [uniformLine=false] Boolean indicating
|
|
15610
|
+
* if each line has a uniform style (uniform stroke color, opacity, and
|
|
15611
|
+
* width). Can vary by line. A value of `'drop'` will modify rendered
|
|
15612
|
+
* vertex order by dropping duplicates and setting later values to zero
|
|
15613
|
+
* opacity. This can be faster but makes it so updating the style array
|
|
15614
|
+
* can no longer be used.
|
|
15584
15615
|
* @property {number|function} [antialiasing] Antialiasing distance in pixels.
|
|
15585
15616
|
* Values must be non-negative. A value greater than 1 will produce a
|
|
15586
15617
|
* visible gradient. This is a single value that applies to all lines.
|
|
@@ -15728,7 +15759,10 @@ var lineFeature = function lineFeature(arg) {
|
|
|
15728
15759
|
var p = posFunc(current, j, d, index);
|
|
15729
15760
|
|
|
15730
15761
|
if (onlyInvertedY) {
|
|
15731
|
-
p
|
|
15762
|
+
p = {
|
|
15763
|
+
x: p.x,
|
|
15764
|
+
y: -p.y
|
|
15765
|
+
};
|
|
15732
15766
|
} else if (gcs !== mapgcs) {
|
|
15733
15767
|
p = transform.transformCoordinates(gcs, mapgcs, p);
|
|
15734
15768
|
}
|
|
@@ -19011,8 +19045,8 @@ var Mousetrap = __webpack_require__(3345);
|
|
|
19011
19045
|
* event must occur within this time in milliseconds of the mouse down
|
|
19012
19046
|
* event for it to be considered a click.
|
|
19013
19047
|
* @property {boolean|number} [click.cancelOnMove=true] If true, don't generate
|
|
19014
|
-
* click events if the mouse moved at all. If a positive number, the
|
|
19015
|
-
* at which to cancel click events when the mouse moves.
|
|
19048
|
+
* click events if the mouse moved at all. If a positive number, the
|
|
19049
|
+
* distance at which to cancel click events when the mouse moves.
|
|
19016
19050
|
* @property {object} [keyboard] An object describing which keyboard events are
|
|
19017
19051
|
* handled.
|
|
19018
19052
|
* @property {object} [keyboard.actions] An object with different actions that
|
|
@@ -19025,6 +19059,9 @@ var Mousetrap = __webpack_require__(3345);
|
|
|
19025
19059
|
* an object with keys of the meta keys that are required to be down or
|
|
19026
19060
|
* up for that scale action to trigger. If the value of the meta key is
|
|
19027
19061
|
* truthy, it must be down. If `false`, it must be up.
|
|
19062
|
+
* @property {string[]} [keyboard.metakeyMouseEvents] A list of meta keys
|
|
19063
|
+
* * that, when typed singly, trigger a repeat of the last mousemove or
|
|
19064
|
+
* actionmove event so that listeners can update metakey information.
|
|
19028
19065
|
* @property {boolean} [keyboard.focusHighlight=true] If truthy, when the map
|
|
19029
19066
|
* gains focus, a highlight style is shown around it. This gives an
|
|
19030
19067
|
* indicator that keyboard events will affect the map, but may not be
|
|
@@ -19324,6 +19361,11 @@ var mapInteractor = function mapInteractor(args) {
|
|
|
19324
19361
|
}
|
|
19325
19362
|
},
|
|
19326
19363
|
|
|
19364
|
+
/* This is a list of meta keys that when typed singly trigger a repeat
|
|
19365
|
+
* of the last mousemove or actionmove event so that listeners can
|
|
19366
|
+
* update metakey information. */
|
|
19367
|
+
metakeyMouseEvents: ['shift', 'ctrl', 'shift+ctrl', 'shift+alt', 'shift+meta'],
|
|
19368
|
+
|
|
19327
19369
|
/* if focusHighlight is truthy, then a class is added to the map such
|
|
19328
19370
|
* that when the map gets focus, it is indicated inside the border of
|
|
19329
19371
|
* the map -- browsers usually show focus on the outside, which isn't
|
|
@@ -19751,6 +19793,43 @@ var mapInteractor = function mapInteractor(args) {
|
|
|
19751
19793
|
m_touchHandler.lastEventType = evtType[2];
|
|
19752
19794
|
}
|
|
19753
19795
|
};
|
|
19796
|
+
/**
|
|
19797
|
+
* Repeat a mousemove or actionmove event with new metakey information.
|
|
19798
|
+
*
|
|
19799
|
+
* @param {event} [evt] A Mousetrap event with the key change.
|
|
19800
|
+
* @fires geo.event.mousemove
|
|
19801
|
+
* @fires geo.event.actionmove
|
|
19802
|
+
*/
|
|
19803
|
+
|
|
19804
|
+
|
|
19805
|
+
this._repeatMouseMoveEvent = function (evt) {
|
|
19806
|
+
if (!m_mouse || !m_mouse.modifiers) {
|
|
19807
|
+
return;
|
|
19808
|
+
}
|
|
19809
|
+
|
|
19810
|
+
var old = {
|
|
19811
|
+
alt: m_mouse.modifiers.alt,
|
|
19812
|
+
ctrl: m_mouse.modifiers.ctrl,
|
|
19813
|
+
meta: m_mouse.modifiers.meta,
|
|
19814
|
+
shift: m_mouse.modifiers.shift
|
|
19815
|
+
};
|
|
19816
|
+
|
|
19817
|
+
m_this._getMouseModifiers(evt);
|
|
19818
|
+
|
|
19819
|
+
if (m_mouse.modifiers.alt === old.alt && m_mouse.modifiers.ctrl === old.ctrl && m_mouse.modifiers.meta === old.meta && m_mouse.modifiers.shift === old.shift) {
|
|
19820
|
+
return;
|
|
19821
|
+
}
|
|
19822
|
+
|
|
19823
|
+
if (m_state.boundDocumentHandlers) {
|
|
19824
|
+
m_this.map().geoTrigger(geo_event.actionmove, {
|
|
19825
|
+
state: m_this.state(),
|
|
19826
|
+
mouse: m_this.mouse(),
|
|
19827
|
+
event: evt
|
|
19828
|
+
});
|
|
19829
|
+
} else {
|
|
19830
|
+
m_this.map().geoTrigger(geo_event.mousemove, m_this.mouse());
|
|
19831
|
+
}
|
|
19832
|
+
};
|
|
19754
19833
|
/**
|
|
19755
19834
|
* Retrigger a mouse movement with the current mouse state.
|
|
19756
19835
|
* @fires geo.event.mousemove
|
|
@@ -19819,6 +19898,14 @@ var mapInteractor = function mapInteractor(args) {
|
|
|
19819
19898
|
}
|
|
19820
19899
|
}
|
|
19821
19900
|
|
|
19901
|
+
if (m_options.keyboard.metakeyMouseEvents) {
|
|
19902
|
+
m_options.keyboard.metakeyMouseEvents.forEach(function (meta) {
|
|
19903
|
+
m_keyHandler.bind(meta, m_this._repeatMouseMoveEvent, 'keydown');
|
|
19904
|
+
m_keyHandler.bind(meta, m_this._repeatMouseMoveEvent, 'keyup');
|
|
19905
|
+
bound.push(meta);
|
|
19906
|
+
});
|
|
19907
|
+
}
|
|
19908
|
+
|
|
19822
19909
|
m_boundKeys = bound;
|
|
19823
19910
|
}
|
|
19824
19911
|
|
|
@@ -21367,7 +21454,7 @@ var mapInteractor = function mapInteractor(args) {
|
|
|
21367
21454
|
preventDefault: function preventDefault() {},
|
|
21368
21455
|
simulated: true
|
|
21369
21456
|
};
|
|
21370
|
-
m_keyHandler.trigger(keys);
|
|
21457
|
+
m_keyHandler.trigger(keys, options.event);
|
|
21371
21458
|
return;
|
|
21372
21459
|
}
|
|
21373
21460
|
|
|
@@ -26586,6 +26673,8 @@ module.exports = quadFeature;
|
|
|
26586
26673
|
|
|
26587
26674
|
var $ = __webpack_require__(5638);
|
|
26588
26675
|
|
|
26676
|
+
var geo_action = __webpack_require__(7839);
|
|
26677
|
+
|
|
26589
26678
|
var widgets = {
|
|
26590
26679
|
dom: {}
|
|
26591
26680
|
};
|
|
@@ -27044,6 +27133,7 @@ util.registerAnnotation = function (name, func, features) {
|
|
|
27044
27133
|
func: func,
|
|
27045
27134
|
features: features || {}
|
|
27046
27135
|
};
|
|
27136
|
+
geo_action['annotation_' + name] = 'geo_annotation_' + name;
|
|
27047
27137
|
return old;
|
|
27048
27138
|
};
|
|
27049
27139
|
/**
|
|
@@ -27560,7 +27650,7 @@ module.exports = sceneObject;
|
|
|
27560
27650
|
* @constant
|
|
27561
27651
|
* @type {string}
|
|
27562
27652
|
*/
|
|
27563
|
-
module.exports = "
|
|
27653
|
+
module.exports = "f6ebaf74f3f8b523860d8b780cbd38782bdd81ca";
|
|
27564
27654
|
|
|
27565
27655
|
/***/ }),
|
|
27566
27656
|
|
|
@@ -33438,7 +33528,9 @@ var trackFeature = function trackFeature(arg) {
|
|
|
33438
33528
|
position: util.identityFunction,
|
|
33439
33529
|
time: function time(d, i) {
|
|
33440
33530
|
return d.t !== undefined ? d.t : i;
|
|
33441
|
-
}
|
|
33531
|
+
},
|
|
33532
|
+
uniformLine: 'drop',
|
|
33533
|
+
closed: false
|
|
33442
33534
|
}, arg.style === undefined ? {} : arg.style);
|
|
33443
33535
|
var markerStyle = $.extend(true, {}, {
|
|
33444
33536
|
rotateWithMap: true,
|
|
@@ -40152,6 +40244,7 @@ function generateCorrespondence(poly1, poly2, newpoly, results) {
|
|
|
40152
40244
|
results[ekey] = Array(poly.length);
|
|
40153
40245
|
poly.forEach(function (p, idx) {
|
|
40154
40246
|
var found = {};
|
|
40247
|
+
var missed = 0;
|
|
40155
40248
|
p.forEach(function (h) {
|
|
40156
40249
|
return h.forEach(function (pt) {
|
|
40157
40250
|
var key = '_' + pt[0] + '_' + pt[1];
|
|
@@ -40160,11 +40253,13 @@ function generateCorrespondence(poly1, poly2, newpoly, results) {
|
|
|
40160
40253
|
pts[key].forEach(function (val) {
|
|
40161
40254
|
found[val] = (found[val] || 0) + 1;
|
|
40162
40255
|
});
|
|
40256
|
+
} else {
|
|
40257
|
+
missed += 1;
|
|
40163
40258
|
}
|
|
40164
40259
|
});
|
|
40165
40260
|
});
|
|
40166
40261
|
Object.keys(found).forEach(function (nidx) {
|
|
40167
|
-
if (found[nidx] === counts[+nidx]) {
|
|
40262
|
+
if (found[nidx] === counts[+nidx] && !missed && p.length === newpoly[+nidx].length) {
|
|
40168
40263
|
if (!results[ekey][idx]) {
|
|
40169
40264
|
results[ekey][idx] = [];
|
|
40170
40265
|
}
|
|
@@ -40680,7 +40775,7 @@ module.exports = vectorFeature;
|
|
|
40680
40775
|
* @constant
|
|
40681
40776
|
* @type {string}
|
|
40682
40777
|
*/
|
|
40683
|
-
module.exports = "1.9.
|
|
40778
|
+
module.exports = "1.9.4";
|
|
40684
40779
|
|
|
40685
40780
|
/***/ }),
|
|
40686
40781
|
|
|
@@ -42079,6 +42174,7 @@ var webgl_lineFeature = function webgl_lineFeature(arg) {
|
|
|
42079
42174
|
closedVal = closed[i];
|
|
42080
42175
|
firstPosIdx3 = posIdx3;
|
|
42081
42176
|
maxj = lineItem.length + (closedVal === 2 ? 1 : 0);
|
|
42177
|
+
var skipped = 0;
|
|
42082
42178
|
|
|
42083
42179
|
for (j = 0; j < maxj; j += 1, posIdx3 += 3) {
|
|
42084
42180
|
lidx = j;
|
|
@@ -42145,9 +42241,20 @@ var webgl_lineFeature = function webgl_lineFeature(arg) {
|
|
|
42145
42241
|
}
|
|
42146
42242
|
|
|
42147
42243
|
if (j) {
|
|
42244
|
+
if (uniform === 'drop' && j > 1 && position[vert[0].pos] === position[vert[1].pos] && position[vert[0].pos + 1] === position[vert[1].pos + 1]) {
|
|
42245
|
+
skipped += 1;
|
|
42246
|
+
continue;
|
|
42247
|
+
}
|
|
42148
42248
|
/* zero out the z position. This can be changed if we handle it in
|
|
42149
42249
|
* the shader. */
|
|
42250
|
+
|
|
42251
|
+
|
|
42150
42252
|
for (k = 0; k < orderLen; k += 1, dest += 1, dest3 += 3) {
|
|
42253
|
+
if (uniform === 'drop' && vert[0].strokeOpacity <= 0 && vert[1].strokeOpacity <= 0) {
|
|
42254
|
+
strokeOpacityBuf[dest] = -1;
|
|
42255
|
+
continue;
|
|
42256
|
+
}
|
|
42257
|
+
|
|
42151
42258
|
orderk0 = order[k][0];
|
|
42152
42259
|
v1 = vert[orderk0];
|
|
42153
42260
|
v2 = vert[1 - orderk0];
|
|
@@ -42190,6 +42297,12 @@ var webgl_lineFeature = function webgl_lineFeature(arg) {
|
|
|
42190
42297
|
}
|
|
42191
42298
|
}
|
|
42192
42299
|
}
|
|
42300
|
+
|
|
42301
|
+
if (skipped) {
|
|
42302
|
+
for (k = 0; k < skipped * orderLen; k += 1, dest += 1, dest3 += 3) {
|
|
42303
|
+
strokeOpacityBuf[dest] = -1;
|
|
42304
|
+
}
|
|
42305
|
+
}
|
|
42193
42306
|
}
|
|
42194
42307
|
|
|
42195
42308
|
if (!onlyStyle) {
|