-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- polygons with coincident points - polygons with less than four points fix #8999
- Loading branch information
Showing
4 changed files
with
158 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
test/integration/query-tests/regressions/mapbox-gl-js#8999/expected.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
[ | ||
{ | ||
"geometry": { | ||
"type": "Polygon", | ||
"coordinates": [ | ||
[ | ||
[ | ||
-19.9951171875, | ||
-40.01078714046552 | ||
], | ||
[ | ||
-19.9951171875, | ||
40.01078714046551 | ||
], | ||
[ | ||
39.990234375, | ||
40.01078714046551 | ||
], | ||
[ | ||
-19.9951171875, | ||
-40.01078714046552 | ||
] | ||
] | ||
] | ||
}, | ||
"type": "Feature", | ||
"properties": { | ||
"layer": "extrusion_three_points" | ||
}, | ||
"source": "extrusion_three_points", | ||
"state": {} | ||
} | ||
] |
65 changes: 65 additions & 0 deletions
65
test/integration/query-tests/regressions/mapbox-gl-js#8999/style.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
{ | ||
"version": 8, | ||
"metadata": { | ||
"test": { | ||
"debug": true, | ||
"width": 200, | ||
"height": 200, | ||
"queryGeometry": [ | ||
100, | ||
40 | ||
] | ||
} | ||
}, | ||
"pitch": 0, | ||
"center": [ | ||
0, | ||
0 | ||
], | ||
"zoom": 0, | ||
"sources": { | ||
"extrusion_three_points": { | ||
"type": "geojson", | ||
"data": { | ||
"type": "Feature", | ||
"properties": { | ||
"layer": "extrusion_three_points" | ||
}, | ||
"geometry": { | ||
"type": "Polygon", | ||
"coordinates": [ | ||
[ | ||
[ | ||
-20, | ||
-40 | ||
], | ||
[ | ||
-20, | ||
40 | ||
], | ||
[ | ||
40, | ||
40 | ||
], | ||
[ | ||
-20, | ||
-40 | ||
] | ||
] | ||
] | ||
} | ||
} | ||
} | ||
}, | ||
"layers": [ | ||
{ | ||
"id": "extrusion_three_points", | ||
"type": "fill-extrusion", | ||
"source": "extrusion_three_points", | ||
"paint": { | ||
"fill-extrusion-color": "#ecc", | ||
"fill-extrusion-height": 0 | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import {test} from '../../../util/test'; | ||
import {getIntersectionDistance} from '../../../../src/style/style_layer/fill_extrusion_style_layer'; | ||
import Point from '@mapbox/point-geometry'; | ||
|
||
test('getIntersectionDistance', (t) => { | ||
const queryPoint = [new Point(100, 100)]; | ||
const z = 3; | ||
const a = new Point(100, -90); | ||
const b = new Point(110, 110); | ||
const c = new Point(-110, 110); | ||
a.z = z; | ||
b.z = z; | ||
c.z = z; | ||
|
||
t.test('one point', (t) => { | ||
const projectedFace = [a, a]; | ||
t.equal(getIntersectionDistance(queryPoint, projectedFace), Infinity); | ||
t.end(); | ||
}); | ||
|
||
t.test('two points', (t) => { | ||
const projectedFace = [a, b, a]; | ||
t.equal(getIntersectionDistance(queryPoint, projectedFace), Infinity); | ||
t.end(); | ||
}); | ||
|
||
t.test('two points coincident', (t) => { | ||
const projectedFace = [a, a, a, b, b, b, b, a]; | ||
t.equal(getIntersectionDistance(queryPoint, projectedFace), Infinity); | ||
t.end(); | ||
}); | ||
|
||
t.test('three points', (t) => { | ||
const projectedFace = [a, b, c, a]; | ||
t.equal(getIntersectionDistance(queryPoint, projectedFace), z); | ||
t.end(); | ||
}); | ||
|
||
t.test('three points coincident points', (t) => { | ||
const projectedFace = [a, a, b, b, b, c, c, a]; | ||
t.equal(getIntersectionDistance(queryPoint, projectedFace), z); | ||
t.end(); | ||
}); | ||
t.end(); | ||
}); |