geojs 1.8.6 → 1.8.7
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 +6 -0
- package/geo.js +33 -7
- package/geo.lean.js +33 -7
- package/geo.lean.min.js +1 -1
- package/geo.min.js +1 -1
- package/package.json +1 -1
- package/src/transform.js +15 -0
- package/src/webgl/lineFeature.js +7 -3
- package/src/webgl/polygonFeature.js +11 -8
package/package.json
CHANGED
package/src/transform.js
CHANGED
|
@@ -767,6 +767,21 @@ transform.vincentyDistance = function (pt1, pt2, gcs, baseGcs, ellipsoid, maxIte
|
|
|
767
767
|
};
|
|
768
768
|
};
|
|
769
769
|
|
|
770
|
+
/**
|
|
771
|
+
* Return a boolean indicating if the projections only differ in their y
|
|
772
|
+
* coordinate.
|
|
773
|
+
*
|
|
774
|
+
* @param {string} srcPrj The source projection.
|
|
775
|
+
* @param {string} tgtPrj The destination projection.
|
|
776
|
+
* @returns {boolean} truthy if only the y coordinate is different between
|
|
777
|
+
* projections.
|
|
778
|
+
*/
|
|
779
|
+
transform.onlyInvertedY = function (srcPrj, tgtPrj) {
|
|
780
|
+
const smatch = srcPrj.match(axisPattern),
|
|
781
|
+
tmatch = tgtPrj.match(axisPattern);
|
|
782
|
+
return smatch && tmatch && smatch[1] === tmatch[1] && smatch[3] === tmatch[3];
|
|
783
|
+
};
|
|
784
|
+
|
|
770
785
|
/* Expose proj4 to make it easier to debug */
|
|
771
786
|
transform.proj4 = proj4;
|
|
772
787
|
|
package/src/webgl/lineFeature.js
CHANGED
|
@@ -134,6 +134,9 @@ var webgl_lineFeature = function (arg) {
|
|
|
134
134
|
strokeOffset: 0, posStrokeOffset: 0, negStrokeOffset: 0
|
|
135
135
|
}],
|
|
136
136
|
v = vert[1],
|
|
137
|
+
target_gcs = m_this.gcs(),
|
|
138
|
+
map_gcs = m_this.layer().map().gcs(),
|
|
139
|
+
simpleInverse = transform.onlyInvertedY(target_gcs, map_gcs),
|
|
137
140
|
pos, posIdx3, firstpos, firstPosIdx3,
|
|
138
141
|
lineFunc = m_this.line(),
|
|
139
142
|
strokeWidthFunc = m_this.style.get('strokeWidth'), strokeWidthVal,
|
|
@@ -188,7 +191,7 @@ var webgl_lineFeature = function (arg) {
|
|
|
188
191
|
for (j = 0; j < lineItem.length; j += 1) {
|
|
189
192
|
pos = posFunc(lineItem[j], j, d, i);
|
|
190
193
|
position.push(pos.x);
|
|
191
|
-
position.push(pos.y);
|
|
194
|
+
position.push(simpleInverse ? -pos.y : pos.y);
|
|
192
195
|
position.push(pos.z || 0.0);
|
|
193
196
|
if (!j) {
|
|
194
197
|
firstpos = pos;
|
|
@@ -208,8 +211,9 @@ var webgl_lineFeature = function (arg) {
|
|
|
208
211
|
}
|
|
209
212
|
}
|
|
210
213
|
|
|
211
|
-
|
|
212
|
-
|
|
214
|
+
if (!simpleInverse) {
|
|
215
|
+
position = transform.transformCoordinates(target_gcs, map_gcs, position, 3);
|
|
216
|
+
}
|
|
213
217
|
m_origin = new Float32Array(m_this.style.get('origin')(position));
|
|
214
218
|
if (m_origin[0] || m_origin[1] || m_origin[2]) {
|
|
215
219
|
for (i = 0; i < position.length; i += 3) {
|
|
@@ -82,6 +82,7 @@ var webgl_polygonFeature = function (arg) {
|
|
|
82
82
|
items = [],
|
|
83
83
|
target_gcs = m_this.gcs(),
|
|
84
84
|
map_gcs = m_this.layer().map().gcs(),
|
|
85
|
+
simpleInverse = transform.onlyInvertedY(target_gcs, map_gcs),
|
|
85
86
|
numPts = 0,
|
|
86
87
|
geom = m_mapper.geometryData(),
|
|
87
88
|
color, opacity, fill, d, d3, vertices, i, j, k, n,
|
|
@@ -117,7 +118,7 @@ var webgl_polygonFeature = function (arg) {
|
|
|
117
118
|
for (i = d3 = 0; i < outer.length; i += 1, d3 += 3) {
|
|
118
119
|
c = posFunc(outer[i], i, item, itemIndex);
|
|
119
120
|
geometry[d3] = c.x;
|
|
120
|
-
geometry[d3 + 1] = c.y;
|
|
121
|
+
geometry[d3 + 1] = simpleInverse ? -c.y : c.y;
|
|
121
122
|
// ignore the z values until we support them
|
|
122
123
|
geometry[d3 + 2] = 0; // c.z || 0;
|
|
123
124
|
}
|
|
@@ -134,7 +135,7 @@ var webgl_polygonFeature = function (arg) {
|
|
|
134
135
|
for (i = 0; i < hole.length; i += 1, d3 += 3) {
|
|
135
136
|
c = posFunc(hole[i], i, item, itemIndex);
|
|
136
137
|
geometry.vertices[d3] = c.x;
|
|
137
|
-
geometry.vertices[d3 + 1] = c.y;
|
|
138
|
+
geometry.vertices[d3 + 1] = simpleInverse ? -c.y : c.y;
|
|
138
139
|
// ignore the z values until we support them
|
|
139
140
|
geometry.vertices[d3 + 2] = 0; // c.z || 0;
|
|
140
141
|
}
|
|
@@ -142,12 +143,14 @@ var webgl_polygonFeature = function (arg) {
|
|
|
142
143
|
}
|
|
143
144
|
|
|
144
145
|
// transform to map gcs
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
146
|
+
if (!simpleInverse) {
|
|
147
|
+
geometry.vertices = transform.transformCoordinates(
|
|
148
|
+
target_gcs,
|
|
149
|
+
map_gcs,
|
|
150
|
+
geometry.vertices,
|
|
151
|
+
geometry.dimensions
|
|
152
|
+
);
|
|
153
|
+
}
|
|
151
154
|
|
|
152
155
|
record = {
|
|
153
156
|
// triangulate
|