Skip to content

Commit

Permalink
Merge pull request #1210 from OpenGeoscience/revert-simple-inverse
Browse files Browse the repository at this point in the history
fix: Revert an optimization that caused a problem
  • Loading branch information
manthey authored May 23, 2022
2 parents 412779e + 12e3e15 commit eacf9ad
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 16 deletions.
7 changes: 2 additions & 5 deletions src/webgl/lineFeature.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ var webgl_lineFeature = function (arg) {
v = vert[1],
target_gcs = m_this.gcs(),
map_gcs = m_this.layer().map().gcs(),
simpleInverse = transform.onlyInvertedY(target_gcs, map_gcs),
pos, posIdx3, firstpos, firstPosIdx3,
lineFunc = m_this.line(),
strokeWidthFunc = m_this.style.get('strokeWidth'), strokeWidthVal,
Expand Down Expand Up @@ -192,7 +191,7 @@ var webgl_lineFeature = function (arg) {
for (j = 0; j < lineItem.length; j += 1) {
pos = posFunc ? posFunc(lineItem[j], j, d, i) : lineItem[j];
position.push(pos.x);
position.push(simpleInverse ? -pos.y : pos.y);
position.push(pos.y);
position.push(pos.z || 0.0);
if (!j) {
firstpos = pos;
Expand All @@ -212,9 +211,7 @@ var webgl_lineFeature = function (arg) {
}
}

if (!simpleInverse) {
position = transform.transformCoordinates(target_gcs, map_gcs, position, 3);
}
position = transform.transformCoordinates(target_gcs, map_gcs, position, 3);
m_origin = new Float32Array(m_this.style.get('origin')(position));
if (m_origin[0] || m_origin[1] || m_origin[2]) {
for (i = 0; i < position.length; i += 3) {
Expand Down
19 changes: 8 additions & 11 deletions src/webgl/polygonFeature.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ var webgl_polygonFeature = function (arg) {
items = [],
target_gcs = m_this.gcs(),
map_gcs = m_this.layer().map().gcs(),
simpleInverse = transform.onlyInvertedY(target_gcs, map_gcs),
numPts = 0,
geom = m_mapper.geometryData(),
color, opacity, fill, d, d3, vertices, i, j, k, n,
Expand Down Expand Up @@ -120,7 +119,7 @@ var webgl_polygonFeature = function (arg) {
for (i = d3 = 0; i < outer.length; i += 1, d3 += 3) {
c = posFunc ? posFunc(outer[i], i, item, itemIndex) : outer[i];
geometry[d3] = c.x;
geometry[d3 + 1] = simpleInverse ? -c.y : c.y;
geometry[d3 + 1] = c.y;
// ignore the z values until we support them
geometry[d3 + 2] = 0; // c.z || 0;
}
Expand All @@ -137,22 +136,20 @@ var webgl_polygonFeature = function (arg) {
for (i = 0; i < hole.length; i += 1, d3 += 3) {
c = posFunc ? posFunc(hole[i], i, item, itemIndex) : hole[i];
geometry.vertices[d3] = c.x;
geometry.vertices[d3 + 1] = simpleInverse ? -c.y : c.y;
geometry.vertices[d3 + 1] = c.y;
// ignore the z values until we support them
geometry.vertices[d3 + 2] = 0; // c.z || 0;
}
});
}

// transform to map gcs
if (!simpleInverse) {
geometry.vertices = transform.transformCoordinates(
target_gcs,
map_gcs,
geometry.vertices,
geometry.dimensions
);
}
geometry.vertices = transform.transformCoordinates(
target_gcs,
map_gcs,
geometry.vertices,
geometry.dimensions
);

record = {
// triangulate
Expand Down

0 comments on commit eacf9ad

Please sign in to comment.