geojs 1.10.5 → 1.10.8
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 +19 -0
- package/geo.js +65 -15
- package/geo.lean.js +65 -15
- package/geo.lean.min.js +2 -2
- package/geo.min.js +2 -2
- package/package.json +1 -1
- package/src/annotation/annotation.js +1 -2
- package/src/annotation/polygonAnnotation.js +42 -1
- package/src/annotation/rectangleAnnotation.js +0 -1
- package/src/polygonFeature.js +7 -2
- package/src/webgl/quadFeature.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# GeoJS Change Log
|
|
2
2
|
|
|
3
|
+
## Version 1.10.6
|
|
4
|
+
|
|
5
|
+
### Improvements
|
|
6
|
+
|
|
7
|
+
- Uncross polygon annotations ([#1236](../../pull/1236))
|
|
8
|
+
|
|
9
|
+
## Version 1.10.5
|
|
10
|
+
|
|
11
|
+
### Improvements
|
|
12
|
+
|
|
13
|
+
- Allow using the rdp functions on non-feature polygons ([#1234](../../pull/1234))
|
|
14
|
+
- Allow annotations to be created regardless of metakeys ([#1235](../../pull/1235))
|
|
15
|
+
|
|
16
|
+
## Version 1.10.5
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
- Guard texture update calls ([#1233](../../pull/1233))
|
|
21
|
+
|
|
3
22
|
## Version 1.10.5
|
|
4
23
|
|
|
5
24
|
### Bug Fixes
|
package/geo.js
CHANGED
|
@@ -1540,11 +1540,7 @@ function continuousVerticesActions(m_this, s_actions, state, name, originalArgs)
|
|
|
1540
1540
|
action: geo_action['annotation_' + name],
|
|
1541
1541
|
name: name + ' create',
|
|
1542
1542
|
owner: annotationActionOwner,
|
|
1543
|
-
input: 'left'
|
|
1544
|
-
modifiers: {
|
|
1545
|
-
shift: false,
|
|
1546
|
-
ctrl: false
|
|
1547
|
-
}
|
|
1543
|
+
input: 'left'
|
|
1548
1544
|
}, {
|
|
1549
1545
|
action: geo_action['annotation_' + name],
|
|
1550
1546
|
name: name + ' create',
|
|
@@ -2821,7 +2817,8 @@ var polygonAnnotation = function polygonAnnotation(args) {
|
|
|
2821
2817
|
delete args.coordinates;
|
|
2822
2818
|
annotation.call(this, 'polygon', args);
|
|
2823
2819
|
var m_this = this,
|
|
2824
|
-
s_actions = this.actions
|
|
2820
|
+
s_actions = this.actions,
|
|
2821
|
+
s_state = this.state;
|
|
2825
2822
|
/**
|
|
2826
2823
|
* Get a list of renderable features for this annotation. When the polygon
|
|
2827
2824
|
* is done, this is just a single polygon. During creation this can be a
|
|
@@ -3029,6 +3026,56 @@ var polygonAnnotation = function polygonAnnotation(args) {
|
|
|
3029
3026
|
this.actions = function (state) {
|
|
3030
3027
|
return continuousVerticesActions(m_this, s_actions, state, 'polygon', arguments);
|
|
3031
3028
|
};
|
|
3029
|
+
/**
|
|
3030
|
+
* Get or set the state of this annotation.
|
|
3031
|
+
*
|
|
3032
|
+
* @param {string|undefined} [arg] If `undefined`, return the state,
|
|
3033
|
+
* otherwise change it. This should be one of the
|
|
3034
|
+
* {@link geo.annotation.state} values.
|
|
3035
|
+
* @returns {this|string} The current state or this annotation.
|
|
3036
|
+
* @fires geo.event.annotation.state
|
|
3037
|
+
*/
|
|
3038
|
+
|
|
3039
|
+
|
|
3040
|
+
this.state = function (arg) {
|
|
3041
|
+
var oldState = s_state();
|
|
3042
|
+
|
|
3043
|
+
if (arg && arg !== oldState && (oldState === annotationState.create || oldState === annotationState.edit) && arg === annotationState.done) {
|
|
3044
|
+
/* Uncross polygons when they are complete. */
|
|
3045
|
+
var opts = {
|
|
3046
|
+
style: 'object-listlist-outer-list'
|
|
3047
|
+
};
|
|
3048
|
+
var polys = util.polyops.union(m_this.options('vertices'), [], opts);
|
|
3049
|
+
var merged = true;
|
|
3050
|
+
|
|
3051
|
+
while (polys.length > 1 && merged) {
|
|
3052
|
+
merged = false;
|
|
3053
|
+
|
|
3054
|
+
for (var i = 0; !merged && i < polys[0].outer.length; i += 1) {
|
|
3055
|
+
var pt1 = polys[0].outer[i];
|
|
3056
|
+
|
|
3057
|
+
for (var p = 1; !merged && p < polys.length; p += 1) {
|
|
3058
|
+
for (var j = 0; !merged && j < polys[p].outer.length; j += 1) {
|
|
3059
|
+
var pt2 = polys[p].outer[j];
|
|
3060
|
+
|
|
3061
|
+
if (pt1.x === pt2.x && pt1.y === pt2.y) {
|
|
3062
|
+
polys[0].inner = polys[0].inner.concat(polys[p].inner);
|
|
3063
|
+
polys[0].outer = polys[0].outer.slice(0, i).concat(polys[p].outer.slice(j)).concat(polys[p].outer.slice(0, j)).concat(polys[0].outer.slice(i));
|
|
3064
|
+
polys.splice(p, 1);
|
|
3065
|
+
merged = true;
|
|
3066
|
+
}
|
|
3067
|
+
}
|
|
3068
|
+
}
|
|
3069
|
+
}
|
|
3070
|
+
}
|
|
3071
|
+
|
|
3072
|
+
if (polys.length === 1) {
|
|
3073
|
+
m_this.options('vertices', polys[0].inner.length ? polys[0] : polys[0].outer);
|
|
3074
|
+
}
|
|
3075
|
+
}
|
|
3076
|
+
|
|
3077
|
+
return s_state(arg);
|
|
3078
|
+
};
|
|
3032
3079
|
/**
|
|
3033
3080
|
* Process any actions for this annotation.
|
|
3034
3081
|
*
|
|
@@ -3268,10 +3315,6 @@ var rectangleAnnotation = function rectangleAnnotation(args, annotationName) {
|
|
|
3268
3315
|
name: 'rectangle create',
|
|
3269
3316
|
owner: annotationActionOwner,
|
|
3270
3317
|
input: 'left',
|
|
3271
|
-
modifiers: {
|
|
3272
|
-
shift: false,
|
|
3273
|
-
ctrl: false
|
|
3274
|
-
},
|
|
3275
3318
|
selectionRectangle: true,
|
|
3276
3319
|
selectionConstraint: this._selectionConstraint
|
|
3277
3320
|
}];
|
|
@@ -25699,11 +25742,13 @@ var polygonFeature = function polygonFeature(arg) {
|
|
|
25699
25742
|
* get the position of each vertex.
|
|
25700
25743
|
* @param {function} [polyFunc=this.style.get('polygon')] The function to
|
|
25701
25744
|
* get each polygon.
|
|
25702
|
-
* @
|
|
25745
|
+
* @param {boolean} [returnData=false] If truthy, return the new data array
|
|
25746
|
+
* rather than modifying the feature.
|
|
25747
|
+
* @returns {this|array}
|
|
25703
25748
|
*/
|
|
25704
25749
|
|
|
25705
25750
|
|
|
25706
|
-
this.rdpSimplifyData = function (data, tolerance, posFunc, polyFunc) {
|
|
25751
|
+
this.rdpSimplifyData = function (data, tolerance, posFunc, polyFunc, returnData) {
|
|
25707
25752
|
var map = m_this.layer().map(),
|
|
25708
25753
|
mapgcs = map.gcs(),
|
|
25709
25754
|
featuregcs = m_this.gcs(),
|
|
@@ -25767,8 +25812,13 @@ var polygonFeature = function polygonFeature(arg) {
|
|
|
25767
25812
|
|
|
25768
25813
|
return elem;
|
|
25769
25814
|
});
|
|
25815
|
+
|
|
25816
|
+
if (returnData) {
|
|
25817
|
+
return data;
|
|
25818
|
+
}
|
|
25770
25819
|
/* Set the reduced polgons as the data and use simple accessors. */
|
|
25771
25820
|
|
|
25821
|
+
|
|
25772
25822
|
m_this.style('position', util.identityFunction);
|
|
25773
25823
|
m_this.style('polygon', util.identityFunction);
|
|
25774
25824
|
m_this.data(data);
|
|
@@ -27887,7 +27937,7 @@ module.exports = sceneObject;
|
|
|
27887
27937
|
* @constant
|
|
27888
27938
|
* @type {string}
|
|
27889
27939
|
*/
|
|
27890
|
-
module.exports = "
|
|
27940
|
+
module.exports = "6d3d1ea33e76f663157a1b49805c119f55b634ed";
|
|
27891
27941
|
|
|
27892
27942
|
/***/ }),
|
|
27893
27943
|
|
|
@@ -41047,7 +41097,7 @@ module.exports = vectorFeature;
|
|
|
41047
41097
|
* @constant
|
|
41048
41098
|
* @type {string}
|
|
41049
41099
|
*/
|
|
41050
|
-
module.exports = "1.10.
|
|
41100
|
+
module.exports = "1.10.8";
|
|
41051
41101
|
|
|
41052
41102
|
/***/ }),
|
|
41053
41103
|
|
|
@@ -45718,7 +45768,7 @@ var webgl_quadFeature = function webgl_quadFeature(arg) {
|
|
|
45718
45768
|
}
|
|
45719
45769
|
|
|
45720
45770
|
m_quads.imgQuads.forEach(function (quad) {
|
|
45721
|
-
if (quad.image && quad.texture && quad.texture.nearestPixel() !== nearestPixel) {
|
|
45771
|
+
if (quad.image && quad.texture && quad.texture.nearestPixel() !== nearestPixel && quad.texture.textureHandle()) {
|
|
45722
45772
|
/* This could just be
|
|
45723
45773
|
* quad.texture.setNearestPixel(nearestPixel);
|
|
45724
45774
|
* but that needlessly redecodes the image. Instead, just change the
|
package/geo.lean.js
CHANGED
|
@@ -1540,11 +1540,7 @@ function continuousVerticesActions(m_this, s_actions, state, name, originalArgs)
|
|
|
1540
1540
|
action: geo_action['annotation_' + name],
|
|
1541
1541
|
name: name + ' create',
|
|
1542
1542
|
owner: annotationActionOwner,
|
|
1543
|
-
input: 'left'
|
|
1544
|
-
modifiers: {
|
|
1545
|
-
shift: false,
|
|
1546
|
-
ctrl: false
|
|
1547
|
-
}
|
|
1543
|
+
input: 'left'
|
|
1548
1544
|
}, {
|
|
1549
1545
|
action: geo_action['annotation_' + name],
|
|
1550
1546
|
name: name + ' create',
|
|
@@ -2821,7 +2817,8 @@ var polygonAnnotation = function polygonAnnotation(args) {
|
|
|
2821
2817
|
delete args.coordinates;
|
|
2822
2818
|
annotation.call(this, 'polygon', args);
|
|
2823
2819
|
var m_this = this,
|
|
2824
|
-
s_actions = this.actions
|
|
2820
|
+
s_actions = this.actions,
|
|
2821
|
+
s_state = this.state;
|
|
2825
2822
|
/**
|
|
2826
2823
|
* Get a list of renderable features for this annotation. When the polygon
|
|
2827
2824
|
* is done, this is just a single polygon. During creation this can be a
|
|
@@ -3029,6 +3026,56 @@ var polygonAnnotation = function polygonAnnotation(args) {
|
|
|
3029
3026
|
this.actions = function (state) {
|
|
3030
3027
|
return continuousVerticesActions(m_this, s_actions, state, 'polygon', arguments);
|
|
3031
3028
|
};
|
|
3029
|
+
/**
|
|
3030
|
+
* Get or set the state of this annotation.
|
|
3031
|
+
*
|
|
3032
|
+
* @param {string|undefined} [arg] If `undefined`, return the state,
|
|
3033
|
+
* otherwise change it. This should be one of the
|
|
3034
|
+
* {@link geo.annotation.state} values.
|
|
3035
|
+
* @returns {this|string} The current state or this annotation.
|
|
3036
|
+
* @fires geo.event.annotation.state
|
|
3037
|
+
*/
|
|
3038
|
+
|
|
3039
|
+
|
|
3040
|
+
this.state = function (arg) {
|
|
3041
|
+
var oldState = s_state();
|
|
3042
|
+
|
|
3043
|
+
if (arg && arg !== oldState && (oldState === annotationState.create || oldState === annotationState.edit) && arg === annotationState.done) {
|
|
3044
|
+
/* Uncross polygons when they are complete. */
|
|
3045
|
+
var opts = {
|
|
3046
|
+
style: 'object-listlist-outer-list'
|
|
3047
|
+
};
|
|
3048
|
+
var polys = util.polyops.union(m_this.options('vertices'), [], opts);
|
|
3049
|
+
var merged = true;
|
|
3050
|
+
|
|
3051
|
+
while (polys.length > 1 && merged) {
|
|
3052
|
+
merged = false;
|
|
3053
|
+
|
|
3054
|
+
for (var i = 0; !merged && i < polys[0].outer.length; i += 1) {
|
|
3055
|
+
var pt1 = polys[0].outer[i];
|
|
3056
|
+
|
|
3057
|
+
for (var p = 1; !merged && p < polys.length; p += 1) {
|
|
3058
|
+
for (var j = 0; !merged && j < polys[p].outer.length; j += 1) {
|
|
3059
|
+
var pt2 = polys[p].outer[j];
|
|
3060
|
+
|
|
3061
|
+
if (pt1.x === pt2.x && pt1.y === pt2.y) {
|
|
3062
|
+
polys[0].inner = polys[0].inner.concat(polys[p].inner);
|
|
3063
|
+
polys[0].outer = polys[0].outer.slice(0, i).concat(polys[p].outer.slice(j)).concat(polys[p].outer.slice(0, j)).concat(polys[0].outer.slice(i));
|
|
3064
|
+
polys.splice(p, 1);
|
|
3065
|
+
merged = true;
|
|
3066
|
+
}
|
|
3067
|
+
}
|
|
3068
|
+
}
|
|
3069
|
+
}
|
|
3070
|
+
}
|
|
3071
|
+
|
|
3072
|
+
if (polys.length === 1) {
|
|
3073
|
+
m_this.options('vertices', polys[0].inner.length ? polys[0] : polys[0].outer);
|
|
3074
|
+
}
|
|
3075
|
+
}
|
|
3076
|
+
|
|
3077
|
+
return s_state(arg);
|
|
3078
|
+
};
|
|
3032
3079
|
/**
|
|
3033
3080
|
* Process any actions for this annotation.
|
|
3034
3081
|
*
|
|
@@ -3268,10 +3315,6 @@ var rectangleAnnotation = function rectangleAnnotation(args, annotationName) {
|
|
|
3268
3315
|
name: 'rectangle create',
|
|
3269
3316
|
owner: annotationActionOwner,
|
|
3270
3317
|
input: 'left',
|
|
3271
|
-
modifiers: {
|
|
3272
|
-
shift: false,
|
|
3273
|
-
ctrl: false
|
|
3274
|
-
},
|
|
3275
3318
|
selectionRectangle: true,
|
|
3276
3319
|
selectionConstraint: this._selectionConstraint
|
|
3277
3320
|
}];
|
|
@@ -25699,11 +25742,13 @@ var polygonFeature = function polygonFeature(arg) {
|
|
|
25699
25742
|
* get the position of each vertex.
|
|
25700
25743
|
* @param {function} [polyFunc=this.style.get('polygon')] The function to
|
|
25701
25744
|
* get each polygon.
|
|
25702
|
-
* @
|
|
25745
|
+
* @param {boolean} [returnData=false] If truthy, return the new data array
|
|
25746
|
+
* rather than modifying the feature.
|
|
25747
|
+
* @returns {this|array}
|
|
25703
25748
|
*/
|
|
25704
25749
|
|
|
25705
25750
|
|
|
25706
|
-
this.rdpSimplifyData = function (data, tolerance, posFunc, polyFunc) {
|
|
25751
|
+
this.rdpSimplifyData = function (data, tolerance, posFunc, polyFunc, returnData) {
|
|
25707
25752
|
var map = m_this.layer().map(),
|
|
25708
25753
|
mapgcs = map.gcs(),
|
|
25709
25754
|
featuregcs = m_this.gcs(),
|
|
@@ -25767,8 +25812,13 @@ var polygonFeature = function polygonFeature(arg) {
|
|
|
25767
25812
|
|
|
25768
25813
|
return elem;
|
|
25769
25814
|
});
|
|
25815
|
+
|
|
25816
|
+
if (returnData) {
|
|
25817
|
+
return data;
|
|
25818
|
+
}
|
|
25770
25819
|
/* Set the reduced polgons as the data and use simple accessors. */
|
|
25771
25820
|
|
|
25821
|
+
|
|
25772
25822
|
m_this.style('position', util.identityFunction);
|
|
25773
25823
|
m_this.style('polygon', util.identityFunction);
|
|
25774
25824
|
m_this.data(data);
|
|
@@ -27887,7 +27937,7 @@ module.exports = sceneObject;
|
|
|
27887
27937
|
* @constant
|
|
27888
27938
|
* @type {string}
|
|
27889
27939
|
*/
|
|
27890
|
-
module.exports = "
|
|
27940
|
+
module.exports = "6d3d1ea33e76f663157a1b49805c119f55b634ed";
|
|
27891
27941
|
|
|
27892
27942
|
/***/ }),
|
|
27893
27943
|
|
|
@@ -41047,7 +41097,7 @@ module.exports = vectorFeature;
|
|
|
41047
41097
|
* @constant
|
|
41048
41098
|
* @type {string}
|
|
41049
41099
|
*/
|
|
41050
|
-
module.exports = "1.10.
|
|
41100
|
+
module.exports = "1.10.8";
|
|
41051
41101
|
|
|
41052
41102
|
/***/ }),
|
|
41053
41103
|
|
|
@@ -45718,7 +45768,7 @@ var webgl_quadFeature = function webgl_quadFeature(arg) {
|
|
|
45718
45768
|
}
|
|
45719
45769
|
|
|
45720
45770
|
m_quads.imgQuads.forEach(function (quad) {
|
|
45721
|
-
if (quad.image && quad.texture && quad.texture.nearestPixel() !== nearestPixel) {
|
|
45771
|
+
if (quad.image && quad.texture && quad.texture.nearestPixel() !== nearestPixel && quad.texture.textureHandle()) {
|
|
45722
45772
|
/* This could just be
|
|
45723
45773
|
* quad.texture.setNearestPixel(nearestPixel);
|
|
45724
45774
|
* but that needlessly redecodes the image. Instead, just change the
|