Skip to content

Commit b9d9464

Browse files
authored
Merge pull request #1302 from CesiumGS/geojson-fixes
Fix more GeoJSON rasterization issues
2 parents 7413afb + 4e7ef09 commit b9d9464

File tree

13 files changed

+626
-73
lines changed

13 files changed

+626
-73
lines changed

CHANGES.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# Change Log
22

3+
### ? - ?
4+
5+
##### Fixes :wrench:
6+
7+
- Fixed various bugs with `CesiumRasterOverlays::GeoJsonDocumentRasterOverlay`:
8+
- Line width is now factored in to calculations of what geometry is visible in any given tile, reducing the possibility that certain geometry (like perfectly vertical or horizontal lines) would be incorrectly ignored.
9+
- Geometry near the antimeridian, such as lines that need to wrap around the entire globe, will now render correctly without gaps.
10+
- Geometry contained in other objects, such as polygons within feature collections, will no longer cause the geometry to be incorrectly rendered multiple times.
11+
312
### v0.57.0 - 2026-02-02
413

514
##### Additions :tada:

CesiumGeospatial/src/GlobeRectangle.cpp

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,19 @@ GlobeRectangle::computeUnion(const GlobeRectangle& other) const noexcept {
131131
rectangleWest += CesiumUtility::Math::TwoPi;
132132
}
133133

134-
const double west = CesiumUtility::Math::convertLongitudeRange(
135-
glm::min(rectangleWest, otherRectangleWest));
136-
const double east = CesiumUtility::Math::convertLongitudeRange(
137-
glm::max(rectangleEast, otherRectangleEast));
134+
double west = glm::min(rectangleWest, otherRectangleWest);
135+
double east = glm::max(rectangleEast, otherRectangleEast);
136+
137+
// convertLongitudeRange will wrap values that are greater *or equal* to PI,
138+
// which means a rectangle from [-PI, PI] would be wrapped to [-PI, -PI] - a
139+
// completely different result. This is not what we want.
140+
if (west != CesiumUtility::Math::OnePi) {
141+
west = CesiumUtility::Math::convertLongitudeRange(west);
142+
}
143+
144+
if (east != CesiumUtility::Math::OnePi) {
145+
east = CesiumUtility::Math::convertLongitudeRange(east);
146+
}
138147

139148
return GlobeRectangle(
140149
west,
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#pragma once
2+
3+
#include <filesystem>
4+
5+
namespace CesiumNativeTests {
6+
/**
7+
* @brief Tests that the contents of `fileA` are equal to the contents of
8+
* `fileB`.
9+
*/
10+
void checkFilesEqual(
11+
const std::filesystem::path& fileA,
12+
const std::filesystem::path& fileB);
13+
} // namespace CesiumNativeTests
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#include <CesiumNativeTests/checkFilesEqual.h>
2+
#include <CesiumNativeTests/readFile.h>
3+
4+
#include <doctest/doctest.h>
5+
6+
#include <cstddef>
7+
#include <filesystem>
8+
#include <vector>
9+
10+
namespace CesiumNativeTests {
11+
void checkFilesEqual(
12+
const std::filesystem::path& fileA,
13+
const std::filesystem::path& fileB) {
14+
const std::vector<std::byte>& bytes = readFile(fileA);
15+
const std::vector<std::byte>& bytes2 = readFile(fileB);
16+
17+
REQUIRE(bytes == bytes2);
18+
}
19+
} // namespace CesiumNativeTests

0 commit comments

Comments
 (0)