Switch to using mpark::variant instead of std::variant.

This commit is contained in:
Kevin Ring 2023-10-05 15:48:13 +11:00
parent 374a26a8ac
commit 0a296cf044
47 changed files with 386 additions and 357 deletions

1
.gitignore vendored
View File

@ -9,3 +9,4 @@ CMakeSettings.json
*.DS_Store
test.db
build-wsl
build-android

View File

@ -114,8 +114,10 @@
"ktxint.h": "c",
"texture.h": "c",
"gl_format.h": "c",
"complex": "cpp"
"complex": "cpp",
"util": "cpp",
"expected": "cpp"
},
"C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools",
"cmake.configureOnOpen": true
}
}

View File

@ -214,3 +214,6 @@ install(TARGETS expected-lite)
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/extern/expected-lite/include/nonstd TYPE INCLUDE)
install(TARGETS meshoptimizer)
install(TARGETS mpark_variant)
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/extern/variant/include/mpark TYPE INCLUDE)

View File

@ -9,15 +9,16 @@
#include <CesiumGeospatial/GlobeRectangle.h>
#include <CesiumGeospatial/S2CellBoundingVolume.h>
#include <mpark/variant.hpp>
#include <optional>
#include <variant>
namespace Cesium3DTilesSelection {
/**
* @brief A bounding volume.
*
* This is a `std::variant` for different types of bounding volumes.
* This is a `mpark::variant` for different types of bounding volumes.
*
* @see CesiumGeometry::BoundingSphere
* @see CesiumGeometry::OrientedBoundingBox
@ -25,7 +26,7 @@ namespace Cesium3DTilesSelection {
* @see CesiumGeospatial::BoundingRegionWithLooseFittingHeights
* @see CesiumGeospatial::S2CellBoundingVolume
*/
typedef std::variant<
typedef mpark::variant<
CesiumGeometry::BoundingSphere,
CesiumGeometry::OrientedBoundingBox,
CesiumGeospatial::BoundingRegion,

View File

@ -8,8 +8,9 @@
#include <CesiumGeospatial/Projection.h>
#include <CesiumGltf/Model.h>
#include <mpark/variant.hpp>
#include <memory>
#include <variant>
#include <vector>
namespace Cesium3DTilesSelection {
@ -202,7 +203,7 @@ private:
* that is currently being owned by the tile
*/
class CESIUM3DTILESSELECTION_API TileContent {
using TileContentKindImpl = std::variant<
using TileContentKindImpl = mpark::variant<
TileUnknownContent,
TileEmptyContent,
std::unique_ptr<TileExternalContent>,

View File

@ -5,8 +5,9 @@
#include <CesiumGeometry/OctreeTileID.h>
#include <CesiumGeometry/QuadtreeTileID.h>
#include <mpark/variant.hpp>
#include <string>
#include <variant>
namespace Cesium3DTilesSelection {
@ -32,7 +33,7 @@ namespace Cesium3DTilesSelection {
* have any content, but content for it can be created by subdividing
* the parent tile's content.
*/
typedef std::variant<
typedef mpark::variant<
std::string,
CesiumGeometry::QuadtreeTileID,
CesiumGeometry::OctreeTileID,

View File

@ -8,10 +8,11 @@
#include <CesiumGeometry/Axis.h>
#include <CesiumGltf/Model.h>
#include <mpark/variant.hpp>
#include <functional>
#include <memory>
#include <optional>
#include <variant>
namespace Cesium3DTilesSelection {
@ -34,7 +35,7 @@ class Tile;
*
* 4. Returning {@link CesiumGltf::Model} means that this tile has glTF model
*/
using TileContentKind = std::variant<
using TileContentKind = mpark::variant<
TileUnknownContent,
TileEmptyContent,
TileExternalContent,

View File

@ -140,7 +140,7 @@ private:
* MaskedType or MaskedArrayType, they are considered incompatible with the
* other type.
*/
std::variant<std::monostate, MaskedType, MaskedArrayType> _type;
mpark::variant<std::monostate, MaskedType, MaskedArrayType> _type;
/**
* Whether the property has encountered a null value. A
@ -182,7 +182,7 @@ public:
* "compatible" with everything.
*/
bool isExclusivelyArray() const noexcept {
return std::holds_alternative<MaskedArrayType>(_type);
return mpark::holds_alternative<MaskedArrayType>(_type);
}
/**
@ -190,15 +190,15 @@ public:
* count arrays.
*/
bool isCompatibleWithUnsignedInteger() const noexcept {
if (std::holds_alternative<MaskedArrayType>(_type)) {
if (mpark::holds_alternative<MaskedArrayType>(_type)) {
return false;
}
if (std::holds_alternative<std::monostate>(_type)) {
if (mpark::holds_alternative<std::monostate>(_type)) {
return true;
}
MaskedType type = std::get<MaskedType>(_type);
MaskedType type = mpark::get<MaskedType>(_type);
return type.isUint8 || type.isUint16 || type.isUint32 || type.isUint64;
}
@ -207,15 +207,15 @@ public:
* Does not count arrays.
*/
bool isCompatibleWithSignedInteger() const noexcept {
if (std::holds_alternative<MaskedArrayType>(_type)) {
if (mpark::holds_alternative<MaskedArrayType>(_type)) {
return false;
}
if (std::holds_alternative<std::monostate>(_type)) {
if (mpark::holds_alternative<std::monostate>(_type)) {
return true;
}
MaskedType type = std::get<MaskedType>(_type);
MaskedType type = mpark::get<MaskedType>(_type);
return type.isInt8 || type.isInt16 || type.isInt32 || type.isInt64;
}
@ -224,7 +224,7 @@ public:
* happens when a CompatibleTypes is initialized and never modified.
*/
bool isFullyCompatible() const noexcept {
return std::holds_alternative<std::monostate>(_type);
return mpark::holds_alternative<std::monostate>(_type);
}
/**
@ -232,12 +232,12 @@ public:
* Fully-incompatible properties will be treated as string properties.
*/
bool isIncompatible() const noexcept {
if (std::holds_alternative<MaskedType>(_type)) {
return std::get<MaskedType>(_type).isIncompatible();
if (mpark::holds_alternative<MaskedType>(_type)) {
return mpark::get<MaskedType>(_type).isIncompatible();
}
if (std::holds_alternative<MaskedArrayType>(_type)) {
return std::get<MaskedArrayType>(_type).isIncompatible();
if (mpark::holds_alternative<MaskedArrayType>(_type)) {
return mpark::get<MaskedArrayType>(_type).isIncompatible();
}
// std::monostate means compatibility with all types.
@ -254,13 +254,13 @@ public:
* Merges a MaskedType into this BatchTableProperty.
*/
void operator&=(const MaskedType& inMaskedType) noexcept {
if (std::holds_alternative<MaskedType>(_type)) {
MaskedType& maskedType = std::get<MaskedType>(_type);
if (mpark::holds_alternative<MaskedType>(_type)) {
MaskedType& maskedType = mpark::get<MaskedType>(_type);
maskedType &= inMaskedType;
return;
}
if (std::holds_alternative<MaskedArrayType>(_type)) {
if (mpark::holds_alternative<MaskedArrayType>(_type)) {
makeIncompatible();
return;
}
@ -272,13 +272,13 @@ public:
* Merges a MaskedArrayType into this CompatibleTypes.
*/
void operator&=(const MaskedArrayType& inArrayType) noexcept {
if (std::holds_alternative<MaskedArrayType>(_type)) {
MaskedArrayType& arrayType = std::get<MaskedArrayType>(_type);
if (mpark::holds_alternative<MaskedArrayType>(_type)) {
MaskedArrayType& arrayType = mpark::get<MaskedArrayType>(_type);
arrayType &= inArrayType;
return;
}
if (std::holds_alternative<MaskedType>(_type)) {
if (mpark::holds_alternative<MaskedType>(_type)) {
makeIncompatible();
return;
}
@ -290,17 +290,17 @@ public:
* Merges another CompatibleTypes into this one.
*/
void operator&=(const CompatibleTypes& inTypes) noexcept {
if (std::holds_alternative<std::monostate>(inTypes._type)) {
if (mpark::holds_alternative<std::monostate>(inTypes._type)) {
// The other CompatibleTypes is compatible with everything, so it does not
// change this one.
} else
if (std::holds_alternative<MaskedArrayType>(inTypes._type)) {
if (mpark::holds_alternative<MaskedArrayType>(inTypes._type)) {
const MaskedArrayType& arrayType =
std::get<MaskedArrayType>(inTypes._type);
mpark::get<MaskedArrayType>(inTypes._type);
operator&=(arrayType);
} else {
const MaskedType& maskedType = std::get<MaskedType>(inTypes._type);
const MaskedType& maskedType = mpark::get<MaskedType>(inTypes._type);
operator&=(maskedType);
}
@ -316,11 +316,11 @@ public:
* MaskedType.
*/
MaskedType toMaskedType() const noexcept {
if (std::holds_alternative<MaskedType>(_type)) {
return std::get<MaskedType>(_type);
if (mpark::holds_alternative<MaskedType>(_type)) {
return mpark::get<MaskedType>(_type);
}
bool isArray = std::holds_alternative<MaskedArrayType>(_type);
bool isArray = mpark::holds_alternative<MaskedArrayType>(_type);
return MaskedType(!isArray);
}
@ -330,11 +330,11 @@ public:
* MaskedArrayType.
*/
MaskedArrayType toMaskedArrayType() const noexcept {
if (std::holds_alternative<MaskedArrayType>(_type)) {
return std::get<MaskedArrayType>(_type);
if (mpark::holds_alternative<MaskedArrayType>(_type)) {
return mpark::get<MaskedArrayType>(_type);
}
bool isNonArray = std::holds_alternative<MaskedType>(_type);
bool isNonArray = mpark::holds_alternative<MaskedType>(_type);
return MaskedArrayType(!isNonArray);
}

View File

@ -55,7 +55,7 @@ BoundingVolume transformBoundingVolume(
}
};
return std::visit(Operation{transform}, boundingVolume);
return mpark::visit(Operation{transform}, boundingVolume);
}
glm::dvec3 getBoundingVolumeCenter(const BoundingVolume& boundingVolume) {
@ -82,7 +82,7 @@ glm::dvec3 getBoundingVolumeCenter(const BoundingVolume& boundingVolume) {
}
};
return std::visit(Operation{}, boundingVolume);
return mpark::visit(Operation{}, boundingVolume);
}
std::optional<GlobeRectangle>
@ -194,15 +194,16 @@ estimateGlobeRectangle(const BoundingVolume& boundingVolume) {
}
};
return std::visit(Operation{}, boundingVolume);
return mpark::visit(Operation{}, boundingVolume);
}
const CesiumGeospatial::BoundingRegion*
getBoundingRegionFromBoundingVolume(const BoundingVolume& boundingVolume) {
const BoundingRegion* pResult = std::get_if<BoundingRegion>(&boundingVolume);
const BoundingRegion* pResult =
mpark::get_if<BoundingRegion>(&boundingVolume);
if (!pResult) {
const BoundingRegionWithLooseFittingHeights* pLoose =
std::get_if<BoundingRegionWithLooseFittingHeights>(&boundingVolume);
mpark::get_if<BoundingRegionWithLooseFittingHeights>(&boundingVolume);
if (pLoose) {
pResult = &pLoose->getBoundingRegion();
}
@ -241,7 +242,7 @@ getOrientedBoundingBoxFromBoundingVolume(const BoundingVolume& boundingVolume) {
}
};
return std::visit(Operation(), boundingVolume);
return mpark::visit(Operation(), boundingVolume);
}
} // namespace Cesium3DTilesSelection

View File

@ -69,7 +69,7 @@ struct BoundingVolumeSubdivision {
BoundingVolume subdivideBoundingVolume(
const CesiumGeometry::OctreeTileID& tileID,
const ImplicitOctreeBoundingVolume& rootBoundingVolume) {
return std::visit(BoundingVolumeSubdivision{tileID}, rootBoundingVolume);
return mpark::visit(BoundingVolumeSubdivision{tileID}, rootBoundingVolume);
}
std::vector<Tile> populateSubtree(
@ -84,7 +84,7 @@ std::vector<Tile> populateSubtree(
}
const CesiumGeometry::OctreeTileID& octreeID =
std::get<CesiumGeometry::OctreeTileID>(tile.getTileID());
mpark::get<CesiumGeometry::OctreeTileID>(tile.getTileID());
std::vector<Tile> children;
children.reserve(8);
@ -242,7 +242,7 @@ ImplicitOctreeLoader::loadTileContent(const TileLoadInput& loadInput) {
// make sure the tile is a octree tile
const CesiumGeometry::OctreeTileID* pOctreeID =
std::get_if<CesiumGeometry::OctreeTileID>(&tile.getTileID());
mpark::get_if<CesiumGeometry::OctreeTileID>(&tile.getTileID());
if (!pOctreeID) {
return asyncSystem.createResolvedFuture(
TileLoadResult::createFailedResult(nullptr));
@ -322,7 +322,7 @@ ImplicitOctreeLoader::loadTileContent(const TileLoadInput& loadInput) {
TileChildrenResult ImplicitOctreeLoader::createTileChildren(const Tile& tile) {
const CesiumGeometry::OctreeTileID* pOctreeID =
std::get_if<CesiumGeometry::OctreeTileID>(&tile.getTileID());
mpark::get_if<CesiumGeometry::OctreeTileID>(&tile.getTileID());
assert(pOctreeID != nullptr && "This loader only serves quadtree tile");
// find the subtree ID

View File

@ -7,14 +7,15 @@
#include <CesiumGeometry/OrientedBoundingBox.h>
#include <CesiumGeospatial/BoundingRegion.h>
#include <mpark/variant.hpp>
#include <cmath>
#include <string>
#include <unordered_map>
#include <variant>
#include <vector>
namespace Cesium3DTilesSelection {
using ImplicitOctreeBoundingVolume = std::variant<
using ImplicitOctreeBoundingVolume = mpark::variant<
CesiumGeospatial::BoundingRegion,
CesiumGeometry::OrientedBoundingBox>;

View File

@ -9,10 +9,10 @@
#include <CesiumUtility/Uri.h>
#include <libmorton/morton.h>
#include <mpark/variant.hpp>
#include <spdlog/logger.h>
#include <type_traits>
#include <variant>
namespace Cesium3DTilesSelection {
namespace {
@ -75,7 +75,7 @@ struct BoundingVolumeSubdivision {
BoundingVolume subdivideBoundingVolume(
const CesiumGeometry::QuadtreeTileID& tileID,
const ImplicitQuadtreeBoundingVolume& rootBoundingVolume) {
return std::visit(BoundingVolumeSubdivision{tileID}, rootBoundingVolume);
return mpark::visit(BoundingVolumeSubdivision{tileID}, rootBoundingVolume);
}
std::vector<Tile> populateSubtree(
@ -90,7 +90,7 @@ std::vector<Tile> populateSubtree(
}
const CesiumGeometry::QuadtreeTileID& quadtreeID =
std::get<CesiumGeometry::QuadtreeTileID>(tile.getTileID());
mpark::get<CesiumGeometry::QuadtreeTileID>(tile.getTileID());
std::vector<Tile> children;
children.reserve(4);
@ -260,7 +260,7 @@ ImplicitQuadtreeLoader::loadTileContent(const TileLoadInput& loadInput) {
// make sure the tile is a quadtree tile
const CesiumGeometry::QuadtreeTileID* pQuadtreeID =
std::get_if<CesiumGeometry::QuadtreeTileID>(&tile.getTileID());
mpark::get_if<CesiumGeometry::QuadtreeTileID>(&tile.getTileID());
if (!pQuadtreeID) {
return asyncSystem.createResolvedFuture<TileLoadResult>(
TileLoadResult::createFailedResult(nullptr));
@ -346,7 +346,7 @@ ImplicitQuadtreeLoader::loadTileContent(const TileLoadInput& loadInput) {
TileChildrenResult
ImplicitQuadtreeLoader::createTileChildren(const Tile& tile) {
const CesiumGeometry::QuadtreeTileID* pQuadtreeID =
std::get_if<CesiumGeometry::QuadtreeTileID>(&tile.getTileID());
mpark::get_if<CesiumGeometry::QuadtreeTileID>(&tile.getTileID());
assert(pQuadtreeID != nullptr && "This loader only serves quadtree tile");
// find the subtree ID

View File

@ -8,14 +8,15 @@
#include <CesiumGeospatial/BoundingRegion.h>
#include <CesiumGeospatial/S2CellBoundingVolume.h>
#include <mpark/variant.hpp>
#include <cmath>
#include <string>
#include <unordered_map>
#include <variant>
#include <vector>
namespace Cesium3DTilesSelection {
using ImplicitQuadtreeBoundingVolume = std::variant<
using ImplicitQuadtreeBoundingVolume = mpark::variant<
CesiumGeospatial::BoundingRegion,
CesiumGeospatial::S2CellBoundingVolume,
CesiumGeometry::OrientedBoundingBox>;

View File

@ -201,13 +201,13 @@ void generateRasterOverlayUVs(
const BoundingRegion* pParentRegion = nullptr;
if (result.updatedBoundingVolume) {
pParentRegion =
std::get_if<BoundingRegion>(&result.updatedBoundingVolume.value());
mpark::get_if<BoundingRegion>(&result.updatedBoundingVolume.value());
} else {
pParentRegion = std::get_if<BoundingRegion>(&tileBoundingVolume);
pParentRegion = mpark::get_if<BoundingRegion>(&tileBoundingVolume);
}
CesiumGltf::Model* pModel =
std::get_if<CesiumGltf::Model>(&result.contentKind);
mpark::get_if<CesiumGltf::Model>(&result.contentKind);
if (pModel) {
result.rasterOverlayDetails =
GltfUtilities::createRasterOverlayTextureCoordinates(
@ -723,11 +723,11 @@ LayerJsonTerrainLoader::loadTileContent(const TileLoadInput& loadInput) {
assert(tile.getLoader() == this);
const QuadtreeTileID* pQuadtreeTileID =
std::get_if<QuadtreeTileID>(&tile.getTileID());
mpark::get_if<QuadtreeTileID>(&tile.getTileID());
if (!pQuadtreeTileID) {
// check if we need to upsample this tile
const UpsampledQuadtreeNode* pUpsampleTileID =
std::get_if<UpsampledQuadtreeNode>(&tile.getTileID());
mpark::get_if<UpsampledQuadtreeNode>(&tile.getTileID());
if (!pUpsampleTileID) {
// This loader only handles QuadtreeTileIDs and UpsampledQuadtreeNode.
return asyncSystem.createResolvedFuture(
@ -824,7 +824,7 @@ LayerJsonTerrainLoader::loadTileContent(const TileLoadInput& loadInput) {
QuantizedMeshLoadResult&& loadResult) {
if (shouldCurrLayerLoadAvailability) {
const QuadtreeTileID& tileID =
std::get<QuadtreeTileID>(tile.getTileID());
mpark::get<QuadtreeTileID>(tile.getTileID());
addRectangleAvailabilityToLayer(
currentLayer,
tileID,
@ -885,7 +885,7 @@ LayerJsonTerrainLoader::loadTileContent(const TileLoadInput& loadInput) {
TileChildrenResult
LayerJsonTerrainLoader::createTileChildren(const Tile& tile) {
const CesiumGeometry::QuadtreeTileID* pQuadtreeID =
std::get_if<CesiumGeometry::QuadtreeTileID>(&tile.getTileID());
mpark::get_if<CesiumGeometry::QuadtreeTileID>(&tile.getTileID());
if (pQuadtreeID) {
// For the tile that is in the middle of subtree, it is safe to create the
// children. However for tile that is at the availability level, we have
@ -931,7 +931,7 @@ bool LayerJsonTerrainLoader::tileHasUpsampledChild(const Tile& tile) const {
const auto& tileChildren = tile.getChildren();
if (tileChildren.empty()) {
const QuadtreeTileID* pQuadtreeTileID =
std::get_if<QuadtreeTileID>(&tile.getTileID());
mpark::get_if<QuadtreeTileID>(&tile.getTileID());
const QuadtreeTileID swID(
pQuadtreeTileID->level + 1,
@ -949,7 +949,7 @@ bool LayerJsonTerrainLoader::tileHasUpsampledChild(const Tile& tile) const {
return totalChildren > 0 && totalChildren < 4;
} else {
for (const auto& child : tileChildren) {
if (std::holds_alternative<UpsampledQuadtreeNode>(child.getTileID())) {
if (mpark::holds_alternative<UpsampledQuadtreeNode>(child.getTileID())) {
return true;
}
}
@ -961,7 +961,7 @@ bool LayerJsonTerrainLoader::tileHasUpsampledChild(const Tile& tile) const {
std::vector<Tile>
LayerJsonTerrainLoader::createTileChildrenImpl(const Tile& tile) {
const QuadtreeTileID* pQuadtreeTileID =
std::get_if<QuadtreeTileID>(&tile.getTileID());
mpark::get_if<QuadtreeTileID>(&tile.getTileID());
// Now that all our availability is sorted out, create this tile's
// children.
@ -1061,9 +1061,10 @@ void LayerJsonTerrainLoader::createChildTile(
const BoundingVolume& parentBoundingVolume = parent.getBoundingVolume();
const BoundingRegion* pRegion =
std::get_if<BoundingRegion>(&parentBoundingVolume);
mpark::get_if<BoundingRegion>(&parentBoundingVolume);
const BoundingRegionWithLooseFittingHeights* pLooseRegion =
std::get_if<BoundingRegionWithLooseFittingHeights>(&parentBoundingVolume);
mpark::get_if<BoundingRegionWithLooseFittingHeights>(
&parentBoundingVolume);
double minHeight = -1000.0;
double maxHeight = 9000.0;
@ -1097,7 +1098,7 @@ CesiumAsync::Future<TileLoadResult> LayerJsonTerrainLoader::upsampleParentTile(
}
const UpsampledQuadtreeNode* pUpsampledTileID =
std::get_if<UpsampledQuadtreeNode>(&tile.getTileID());
mpark::get_if<UpsampledQuadtreeNode>(&tile.getTileID());
int32_t index = -1;
const std::vector<CesiumGeospatial::Projection>& parentProjections =

View File

@ -670,7 +670,7 @@ static std::vector<std::byte> generateNormals(
CESIUM_TRACE("Cesium3DTilesSelection::QuantizedMeshLoader::load");
const QuadtreeTileID& id = std::get<QuadtreeTileID>(tileID);
const QuadtreeTileID& id = mpark::get<QuadtreeTileID>(tileID);
QuantizedMeshLoadResult result;
@ -682,10 +682,11 @@ static std::vector<std::byte> generateNormals(
}
const BoundingRegion* pRegion =
std::get_if<BoundingRegion>(&tileBoundingVolume);
mpark::get_if<BoundingRegion>(&tileBoundingVolume);
if (!pRegion) {
const BoundingRegionWithLooseFittingHeights* pLooseRegion =
std::get_if<BoundingRegionWithLooseFittingHeights>(&tileBoundingVolume);
mpark::get_if<BoundingRegionWithLooseFittingHeights>(
&tileBoundingVolume);
if (pLooseRegion) {
pRegion = &pLooseRegion->getBoundingRegion();
}

View File

@ -9,8 +9,9 @@
#include <CesiumGeometry/QuadtreeTileID.h>
#include <CesiumGeospatial/Projection.h>
#include <mpark/variant.hpp>
#include <cassert>
#include <variant>
namespace Cesium3DTilesSelection {
CesiumAsync::Future<TileLoadResult>
@ -22,7 +23,7 @@ RasterOverlayUpsampler::loadTileContent(const TileLoadInput& loadInput) {
}
const CesiumGeometry::UpsampledQuadtreeNode* pTileID =
std::get_if<CesiumGeometry::UpsampledQuadtreeNode>(
mpark::get_if<CesiumGeometry::UpsampledQuadtreeNode>(
&loadInput.tile.getTileID());
if (pTileID == nullptr) {
// this tile is not marked to be upsampled, so just fail it

View File

@ -485,7 +485,7 @@ bool SubtreeAvailability::isContentAvailable(
bool SubtreeAvailability::isSubtreeAvailable(
uint64_t relativeSubtreeMortonId) const noexcept {
const SubtreeConstantAvailability* constantAvailability =
std::get_if<SubtreeConstantAvailability>(&this->_subtreeAvailability);
mpark::get_if<SubtreeConstantAvailability>(&this->_subtreeAvailability);
if (constantAvailability) {
return constantAvailability->constant;
}
@ -547,7 +547,7 @@ bool SubtreeAvailability::isAvailable(
}
const SubtreeConstantAvailability* constantAvailability =
std::get_if<SubtreeConstantAvailability>(&availabilityView);
mpark::get_if<SubtreeConstantAvailability>(&availabilityView);
if (constantAvailability) {
return constantAvailability->constant;
}
@ -570,7 +570,7 @@ bool SubtreeAvailability::isAvailableUsingBufferView(
numOfTilesFromRootToParentLevel + relativeTileMortonId;
const SubtreeBufferViewAvailability* bufferViewAvailability =
std::get_if<SubtreeBufferViewAvailability>(&availabilityView);
mpark::get_if<SubtreeBufferViewAvailability>(&availabilityView);
const uint64_t byteIndex = availabilityBitIndex / 8;
if (byteIndex >= bufferViewAvailability->view.size()) {

View File

@ -16,7 +16,7 @@ struct SubtreeBufferViewAvailability {
};
using AvailabilityView =
std::variant<SubtreeConstantAvailability, SubtreeBufferViewAvailability>;
mpark::variant<SubtreeConstantAvailability, SubtreeBufferViewAvailability>;
class SubtreeAvailability {
public:

View File

@ -99,26 +99,26 @@ void TileContent::setContentKind(std::unique_ptr<TileRenderContent>&& content) {
}
bool TileContent::isUnknownContent() const noexcept {
return std::holds_alternative<TileUnknownContent>(this->_contentKind);
return mpark::holds_alternative<TileUnknownContent>(this->_contentKind);
}
bool TileContent::isEmptyContent() const noexcept {
return std::holds_alternative<TileEmptyContent>(this->_contentKind);
return mpark::holds_alternative<TileEmptyContent>(this->_contentKind);
}
bool TileContent::isExternalContent() const noexcept {
return std::holds_alternative<std::unique_ptr<TileExternalContent>>(
return mpark::holds_alternative<std::unique_ptr<TileExternalContent>>(
this->_contentKind);
}
bool TileContent::isRenderContent() const noexcept {
return std::holds_alternative<std::unique_ptr<TileRenderContent>>(
return mpark::holds_alternative<std::unique_ptr<TileRenderContent>>(
this->_contentKind);
}
const TileRenderContent* TileContent::getRenderContent() const noexcept {
const std::unique_ptr<TileRenderContent>* pRenderContent =
std::get_if<std::unique_ptr<TileRenderContent>>(&this->_contentKind);
mpark::get_if<std::unique_ptr<TileRenderContent>>(&this->_contentKind);
if (pRenderContent) {
return pRenderContent->get();
}
@ -128,7 +128,7 @@ const TileRenderContent* TileContent::getRenderContent() const noexcept {
TileRenderContent* TileContent::getRenderContent() noexcept {
std::unique_ptr<TileRenderContent>* pRenderContent =
std::get_if<std::unique_ptr<TileRenderContent>>(&this->_contentKind);
mpark::get_if<std::unique_ptr<TileRenderContent>>(&this->_contentKind);
if (pRenderContent) {
return pRenderContent->get();
}
@ -138,7 +138,7 @@ TileRenderContent* TileContent::getRenderContent() noexcept {
const TileExternalContent* TileContent::getExternalContent() const noexcept {
const std::unique_ptr<TileExternalContent>* pExternalContent =
std::get_if<std::unique_ptr<TileExternalContent>>(&this->_contentKind);
mpark::get_if<std::unique_ptr<TileExternalContent>>(&this->_contentKind);
if (pExternalContent) {
return pExternalContent->get();
}
@ -148,7 +148,7 @@ const TileExternalContent* TileContent::getExternalContent() const noexcept {
TileExternalContent* TileContent::getExternalContent() noexcept {
std::unique_ptr<TileExternalContent>* pExternalContent =
std::get_if<std::unique_ptr<TileExternalContent>>(&this->_contentKind);
mpark::get_if<std::unique_ptr<TileExternalContent>>(&this->_contentKind);
if (pExternalContent) {
return pExternalContent->get();
}

View File

@ -1,7 +1,8 @@
#include "Cesium3DTilesSelection/TileID.h"
#include <mpark/variant.hpp>
#include <string>
#include <variant>
namespace Cesium3DTilesSelection {
@ -37,7 +38,7 @@ TileIdUtilities::createTileIdString(const TileID& tileId) {
std::to_string(upsampledQuadtreeNode.tileID.y);
}
};
return std::visit(Operation{}, tileId);
return mpark::visit(Operation{}, tileId);
}
} // namespace Cesium3DTilesSelection

View File

@ -4,7 +4,7 @@
#include <CesiumGeospatial/BoundingRegionWithLooseFittingHeights.h>
#include <CesiumGeospatial/GlobeRectangle.h>
#include <variant>
#include <mpark/variant.hpp>
using namespace CesiumGeospatial;

View File

@ -140,10 +140,11 @@ void createQuadtreeSubdividedChildren(
// use the standard tile bounds for the ID. But having a tile ID that reflects
// the level and _approximate_ location is helpful for debugging.
const CesiumGeometry::QuadtreeTileID* pRealParentTileID =
std::get_if<CesiumGeometry::QuadtreeTileID>(&parent.getTileID());
mpark::get_if<CesiumGeometry::QuadtreeTileID>(&parent.getTileID());
if (!pRealParentTileID) {
const CesiumGeometry::UpsampledQuadtreeNode* pUpsampledID =
std::get_if<CesiumGeometry::UpsampledQuadtreeNode>(&parent.getTileID());
mpark::get_if<CesiumGeometry::UpsampledQuadtreeNode>(
&parent.getTileID());
if (pUpsampledID) {
pRealParentTileID = &pUpsampledID->tileID;
}
@ -336,7 +337,7 @@ void calcRasterOverlayDetailsInWorkerThread(
TileLoadResult& result,
std::vector<CesiumGeospatial::Projection>&& projections,
const TileContentLoadInfo& tileLoadInfo) {
CesiumGltf::Model& model = std::get<CesiumGltf::Model>(result.contentKind);
CesiumGltf::Model& model = mpark::get<CesiumGltf::Model>(result.contentKind);
// we will use the fittest bounding volume to calculate raster overlay details
// below
@ -428,13 +429,13 @@ void calcRasterOverlayDetailsInWorkerThread(
void calcFittestBoundingRegionForLooseTile(
TileLoadResult& result,
const TileContentLoadInfo& tileLoadInfo) {
CesiumGltf::Model& model = std::get<CesiumGltf::Model>(result.contentKind);
CesiumGltf::Model& model = mpark::get<CesiumGltf::Model>(result.contentKind);
const BoundingVolume& boundingVolume = getEffectiveBoundingVolume(
tileLoadInfo.tileBoundingVolume,
result.updatedBoundingVolume,
result.updatedContentBoundingVolume);
if (std::get_if<CesiumGeospatial::BoundingRegionWithLooseFittingHeights>(
if (mpark::get_if<CesiumGeospatial::BoundingRegionWithLooseFittingHeights>(
&boundingVolume) != nullptr) {
if (result.rasterOverlayDetails) {
// We already computed the bounding region for overlays, so use it.
@ -453,7 +454,7 @@ void postProcessGltfInWorkerThread(
TileLoadResult& result,
std::vector<CesiumGeospatial::Projection>&& projections,
const TileContentLoadInfo& tileLoadInfo) {
CesiumGltf::Model& model = std::get<CesiumGltf::Model>(result.contentKind);
CesiumGltf::Model& model = mpark::get<CesiumGltf::Model>(result.contentKind);
if (result.pCompletedRequest) {
model.extras["Cesium3DTiles_TileUrl"] = result.pCompletedRequest->url();
@ -489,7 +490,7 @@ postProcessContentInWorkerThread(
result.state == TileLoadResultState::Success &&
"This function requires result to be success");
CesiumGltf::Model& model = std::get<CesiumGltf::Model>(result.contentKind);
CesiumGltf::Model& model = mpark::get<CesiumGltf::Model>(result.contentKind);
// Download any external image or buffer urls in the gltf if there are any
CesiumGltfReader::GltfReaderResult gltfResult{std::move(model), {}, {}};
@ -871,7 +872,7 @@ void TilesetContentManager::loadTileContent(
// the current tile. Warning: it's not thread-safe to modify the parent
// geometry in the worker thread at the same time though
const CesiumGeometry::UpsampledQuadtreeNode* pUpsampleID =
std::get_if<CesiumGeometry::UpsampledQuadtreeNode>(&tile.getTileID());
mpark::get_if<CesiumGeometry::UpsampledQuadtreeNode>(&tile.getTileID());
if (pUpsampleID) {
// We can't upsample this tile until its parent tile is done loading.
Tile* pParentTile = tile.getParent();
@ -943,7 +944,7 @@ void TilesetContentManager::loadTileContent(
// related to render content. We only ever spawn a new task in the
// worker thread if the content is a render content
if (result.state == TileLoadResultState::Success) {
if (std::holds_alternative<CesiumGltf::Model>(result.contentKind)) {
if (mpark::holds_alternative<CesiumGltf::Model>(result.contentKind)) {
auto asyncSystem = tileLoadInfo.asyncSystem;
return asyncSystem.runInWorkerThread(
[result = std::move(result),
@ -1047,7 +1048,7 @@ bool TilesetContentManager::unloadTileContent(Tile& tile) {
// Are any children currently being upsampled from this tile?
for (const Tile& child : tile.getChildren()) {
if (child.getState() == TileLoadState::ContentLoading &&
std::holds_alternative<CesiumGeometry::UpsampledQuadtreeNode>(
mpark::holds_alternative<CesiumGeometry::UpsampledQuadtreeNode>(
child.getTileID())) {
// Yes, a child is upsampling from this tile, so it may be using the
// tile's content from another thread via lambda capture. We can't unload
@ -1221,7 +1222,7 @@ void TilesetContentManager::setTileContent(
}
auto& content = tile.getContent();
std::visit(
mpark::visit(
ContentKindSetter{
content,
std::move(result.rasterOverlayDetails),

View File

@ -211,16 +211,17 @@ void createImplicitQuadtreeLoader(
TilesetJsonLoader& currentLoader) {
// Quadtree does not support bounding sphere subdivision
const BoundingVolume& boundingVolume = implicitTile.getBoundingVolume();
if (std::holds_alternative<CesiumGeometry::BoundingSphere>(boundingVolume)) {
if (mpark::holds_alternative<CesiumGeometry::BoundingSphere>(
boundingVolume)) {
return;
}
const CesiumGeospatial::BoundingRegion* pRegion =
std::get_if<CesiumGeospatial::BoundingRegion>(&boundingVolume);
mpark::get_if<CesiumGeospatial::BoundingRegion>(&boundingVolume);
const CesiumGeometry::OrientedBoundingBox* pBox =
std::get_if<CesiumGeometry::OrientedBoundingBox>(&boundingVolume);
mpark::get_if<CesiumGeometry::OrientedBoundingBox>(&boundingVolume);
const CesiumGeospatial::S2CellBoundingVolume* pS2Cell =
std::get_if<CesiumGeospatial::S2CellBoundingVolume>(&boundingVolume);
mpark::get_if<CesiumGeospatial::S2CellBoundingVolume>(&boundingVolume);
// the implicit loader will be the child loader of this tileset json loader
TilesetContentLoader* pImplicitLoader = nullptr;
@ -275,19 +276,20 @@ void createImplicitOctreeLoader(
Tile& implicitTile,
TilesetJsonLoader& currentLoader) {
const BoundingVolume& boundingVolume = implicitTile.getBoundingVolume();
if (std::holds_alternative<CesiumGeometry::BoundingSphere>(boundingVolume)) {
if (mpark::holds_alternative<CesiumGeometry::BoundingSphere>(
boundingVolume)) {
return;
}
if (std::holds_alternative<CesiumGeospatial::S2CellBoundingVolume>(
if (mpark::holds_alternative<CesiumGeospatial::S2CellBoundingVolume>(
boundingVolume)) {
return;
}
const CesiumGeospatial::BoundingRegion* pRegion =
std::get_if<CesiumGeospatial::BoundingRegion>(&boundingVolume);
mpark::get_if<CesiumGeospatial::BoundingRegion>(&boundingVolume);
const CesiumGeometry::OrientedBoundingBox* pBox =
std::get_if<CesiumGeometry::OrientedBoundingBox>(&boundingVolume);
mpark::get_if<CesiumGeometry::OrientedBoundingBox>(&boundingVolume);
// the implicit loader will be the child loader of this tileset json loader
TilesetContentLoader* pImplicitLoader = nullptr;
@ -838,7 +840,7 @@ TilesetJsonLoader::loadTileContent(const TileLoadInput& loadInput) {
}
// this loader only handles Url ID
const std::string* url = std::get_if<std::string>(&tile.getTileID());
const std::string* url = mpark::get_if<std::string>(&tile.getTileID());
if (!url) {
return loadInput.asyncSystem.createResolvedFuture<TileLoadResult>(
TileLoadResult::createFailedResult(nullptr));

View File

@ -119,7 +119,7 @@ bool ViewState::isBoundingVolumeVisible(
}
};
return std::visit(Operation{*this}, boundingVolume);
return mpark::visit(Operation{*this}, boundingVolume);
}
double ViewState::computeDistanceSquaredToBoundingVolume(
@ -162,7 +162,7 @@ double ViewState::computeDistanceSquaredToBoundingVolume(
}
};
return std::visit(Operation{*this}, boundingVolume);
return mpark::visit(Operation{*this}, boundingVolume);
}
double ViewState::computeScreenSpaceError(

View File

@ -233,7 +233,7 @@ static void copyVertexAttributes(
}
};
std::visit(Operation{vertexAttributes, output, skipMinMaxUpdate}, vertex);
mpark::visit(Operation{vertexAttributes, output, skipMinMaxUpdate}, vertex);
}
static void copyVertexAttributes(
@ -309,7 +309,7 @@ static void copyVertexAttributes(
}
};
std::visit(
mpark::visit(
Operation{
vertexAttributes,
complements,
@ -334,7 +334,7 @@ static T getVertexValue(
}
};
return std::visit(Operation{accessor}, vertex);
return mpark::visit(Operation{accessor}, vertex);
}
template <class T>
@ -382,7 +382,7 @@ static T getVertexValue(
}
};
return std::visit(Operation{accessor, complements}, vertex);
return mpark::visit(Operation{accessor, complements}, vertex);
}
template <class TIndex>
@ -792,7 +792,7 @@ static uint32_t getOrCreateVertex(
std::vector<uint32_t>& vertexMap,
const std::vector<CesiumGeometry::TriangleClipVertex>& complements,
const CesiumGeometry::TriangleClipVertex& clipVertex) {
const int* pIndex = std::get_if<int>(&clipVertex);
const int* pIndex = mpark::get_if<int>(&clipVertex);
if (pIndex) {
if (*pIndex < 0) {
return getOrCreateVertex(

View File

@ -89,7 +89,8 @@ TEST_CASE("Test implicit octree loader") {
asyncSystem.dispatchMainThreadTasks();
auto tileLoadResult = tileLoadResultFuture.wait();
CHECK(std::holds_alternative<TileEmptyContent>(tileLoadResult.contentKind));
CHECK(
mpark::holds_alternative<TileEmptyContent>(tileLoadResult.contentKind));
CHECK(!tileLoadResult.updatedBoundingVolume);
CHECK(!tileLoadResult.updatedContentBoundingVolume);
CHECK(!tileLoadResult.tileInitializer);
@ -140,8 +141,8 @@ TEST_CASE("Test implicit octree loader") {
asyncSystem.dispatchMainThreadTasks();
auto tileLoadResult = tileLoadResultFuture.wait();
CHECK(
std::holds_alternative<CesiumGltf::Model>(tileLoadResult.contentKind));
CHECK(mpark::holds_alternative<CesiumGltf::Model>(
tileLoadResult.contentKind));
CHECK(!tileLoadResult.updatedBoundingVolume);
CHECK(!tileLoadResult.updatedContentBoundingVolume);
CHECK(!tileLoadResult.tileInitializer);
@ -238,10 +239,10 @@ TEST_CASE("Test tile subdivision for implicit octree loader") {
const auto& tile_1_0_0_0 = tileChildren[0];
CHECK(
std::get<OctreeTileID>(tile_1_0_0_0.getTileID()) ==
mpark::get<OctreeTileID>(tile_1_0_0_0.getTileID()) ==
OctreeTileID(1, 0, 0, 0));
const auto& box_1_0_0_0 =
std::get<OrientedBoundingBox>(tile_1_0_0_0.getBoundingVolume());
mpark::get<OrientedBoundingBox>(tile_1_0_0_0.getBoundingVolume());
CHECK(box_1_0_0_0.getCenter() == glm::dvec3(-10.0, -10.0, -10.0));
CHECK(box_1_0_0_0.getHalfAxes()[0] == glm::dvec3(10.0, 0.0, 0.0));
CHECK(box_1_0_0_0.getHalfAxes()[1] == glm::dvec3(0.0, 10.0, 0.0));
@ -249,10 +250,10 @@ TEST_CASE("Test tile subdivision for implicit octree loader") {
const auto& tile_1_1_0_0 = tileChildren[1];
CHECK(
std::get<OctreeTileID>(tile_1_1_0_0.getTileID()) ==
mpark::get<OctreeTileID>(tile_1_1_0_0.getTileID()) ==
OctreeTileID(1, 1, 0, 0));
const auto& box_1_1_0_0 =
std::get<OrientedBoundingBox>(tile_1_1_0_0.getBoundingVolume());
mpark::get<OrientedBoundingBox>(tile_1_1_0_0.getBoundingVolume());
CHECK(box_1_1_0_0.getCenter() == glm::dvec3(10.0, -10.0, -10.0));
CHECK(box_1_1_0_0.getHalfAxes()[0] == glm::dvec3(10.0, 0.0, 0.0));
CHECK(box_1_1_0_0.getHalfAxes()[1] == glm::dvec3(0.0, 10.0, 0.0));
@ -260,10 +261,10 @@ TEST_CASE("Test tile subdivision for implicit octree loader") {
const auto& tile_1_0_0_1 = tileChildren[2];
CHECK(
std::get<OctreeTileID>(tile_1_0_0_1.getTileID()) ==
mpark::get<OctreeTileID>(tile_1_0_0_1.getTileID()) ==
OctreeTileID(1, 0, 0, 1));
const auto& box_1_0_0_1 =
std::get<OrientedBoundingBox>(tile_1_0_0_1.getBoundingVolume());
mpark::get<OrientedBoundingBox>(tile_1_0_0_1.getBoundingVolume());
CHECK(box_1_0_0_1.getCenter() == glm::dvec3(-10.0, -10.0, 10.0));
CHECK(box_1_0_0_1.getHalfAxes()[0] == glm::dvec3(10.0, 0.0, 0.0));
CHECK(box_1_0_0_1.getHalfAxes()[1] == glm::dvec3(0.0, 10.0, 0.0));
@ -271,10 +272,10 @@ TEST_CASE("Test tile subdivision for implicit octree loader") {
const auto& tile_1_1_0_1 = tileChildren[3];
CHECK(
std::get<OctreeTileID>(tile_1_1_0_1.getTileID()) ==
mpark::get<OctreeTileID>(tile_1_1_0_1.getTileID()) ==
OctreeTileID(1, 1, 0, 1));
const auto& box_1_1_0_1 =
std::get<OrientedBoundingBox>(tile_1_1_0_1.getBoundingVolume());
mpark::get<OrientedBoundingBox>(tile_1_1_0_1.getBoundingVolume());
CHECK(box_1_1_0_1.getCenter() == glm::dvec3(10.0, -10.0, 10.0));
CHECK(box_1_1_0_1.getHalfAxes()[0] == glm::dvec3(10.0, 0.0, 0.0));
CHECK(box_1_1_0_1.getHalfAxes()[1] == glm::dvec3(0.0, 10.0, 0.0));
@ -282,10 +283,10 @@ TEST_CASE("Test tile subdivision for implicit octree loader") {
const auto& tile_1_0_1_0 = tileChildren[4];
CHECK(
std::get<OctreeTileID>(tile_1_0_1_0.getTileID()) ==
mpark::get<OctreeTileID>(tile_1_0_1_0.getTileID()) ==
OctreeTileID(1, 0, 1, 0));
const auto& box_1_0_1_0 =
std::get<OrientedBoundingBox>(tile_1_0_1_0.getBoundingVolume());
mpark::get<OrientedBoundingBox>(tile_1_0_1_0.getBoundingVolume());
CHECK(box_1_0_1_0.getCenter() == glm::dvec3(-10.0, 10.0, -10.0));
CHECK(box_1_0_1_0.getHalfAxes()[0] == glm::dvec3(10.0, 0.0, 0.0));
CHECK(box_1_0_1_0.getHalfAxes()[1] == glm::dvec3(0.0, 10.0, 0.0));
@ -293,10 +294,10 @@ TEST_CASE("Test tile subdivision for implicit octree loader") {
const auto& tile_1_1_1_0 = tileChildren[5];
CHECK(
std::get<OctreeTileID>(tile_1_1_1_0.getTileID()) ==
mpark::get<OctreeTileID>(tile_1_1_1_0.getTileID()) ==
OctreeTileID(1, 1, 1, 0));
const auto& box_1_1_1_0 =
std::get<OrientedBoundingBox>(tile_1_1_1_0.getBoundingVolume());
mpark::get<OrientedBoundingBox>(tile_1_1_1_0.getBoundingVolume());
CHECK(box_1_1_1_0.getCenter() == glm::dvec3(10.0, 10.0, -10.0));
CHECK(box_1_1_1_0.getHalfAxes()[0] == glm::dvec3(10.0, 0.0, 0.0));
CHECK(box_1_1_1_0.getHalfAxes()[1] == glm::dvec3(0.0, 10.0, 0.0));
@ -304,10 +305,10 @@ TEST_CASE("Test tile subdivision for implicit octree loader") {
const auto& tile_1_0_1_1 = tileChildren[6];
CHECK(
std::get<OctreeTileID>(tile_1_0_1_1.getTileID()) ==
mpark::get<OctreeTileID>(tile_1_0_1_1.getTileID()) ==
OctreeTileID(1, 0, 1, 1));
const auto& box_1_0_1_1 =
std::get<OrientedBoundingBox>(tile_1_0_1_1.getBoundingVolume());
mpark::get<OrientedBoundingBox>(tile_1_0_1_1.getBoundingVolume());
CHECK(box_1_0_1_1.getCenter() == glm::dvec3(-10.0, 10.0, 10.0));
CHECK(box_1_0_1_1.getHalfAxes()[0] == glm::dvec3(10.0, 0.0, 0.0));
CHECK(box_1_0_1_1.getHalfAxes()[1] == glm::dvec3(0.0, 10.0, 0.0));
@ -315,10 +316,10 @@ TEST_CASE("Test tile subdivision for implicit octree loader") {
const auto& tile_1_1_1_1 = tileChildren[7];
CHECK(
std::get<OctreeTileID>(tile_1_1_1_1.getTileID()) ==
mpark::get<OctreeTileID>(tile_1_1_1_1.getTileID()) ==
OctreeTileID(1, 1, 1, 1));
const auto& box_1_1_1_1 =
std::get<OrientedBoundingBox>(tile_1_1_1_1.getBoundingVolume());
mpark::get<OrientedBoundingBox>(tile_1_1_1_1.getBoundingVolume());
CHECK(box_1_1_1_1.getCenter() == glm::dvec3(10.0, 10.0, 10.0));
CHECK(box_1_1_1_1.getHalfAxes()[0] == glm::dvec3(10.0, 0.0, 0.0));
CHECK(box_1_1_1_1.getHalfAxes()[1] == glm::dvec3(0.0, 10.0, 0.0));
@ -339,10 +340,10 @@ TEST_CASE("Test tile subdivision for implicit octree loader") {
const auto& tile_2_2_0_0 = tileChildren[0];
CHECK(
std::get<OctreeTileID>(tile_2_2_0_0.getTileID()) ==
mpark::get<OctreeTileID>(tile_2_2_0_0.getTileID()) ==
OctreeTileID(2, 2, 0, 0));
const auto& box_2_2_0_0 =
std::get<OrientedBoundingBox>(tile_2_2_0_0.getBoundingVolume());
mpark::get<OrientedBoundingBox>(tile_2_2_0_0.getBoundingVolume());
CHECK(box_2_2_0_0.getCenter() == glm::dvec3(5.0, -15.0, -15.0));
CHECK(box_2_2_0_0.getHalfAxes()[0] == glm::dvec3(5.0, 0.0, 0.0));
CHECK(box_2_2_0_0.getHalfAxes()[1] == glm::dvec3(0.0, 5.0, 0.0));
@ -350,10 +351,10 @@ TEST_CASE("Test tile subdivision for implicit octree loader") {
const auto& tile_2_3_0_0 = tileChildren[1];
CHECK(
std::get<OctreeTileID>(tile_2_3_0_0.getTileID()) ==
mpark::get<OctreeTileID>(tile_2_3_0_0.getTileID()) ==
OctreeTileID(2, 3, 0, 0));
const auto& box_2_3_0_0 =
std::get<OrientedBoundingBox>(tile_2_3_0_0.getBoundingVolume());
mpark::get<OrientedBoundingBox>(tile_2_3_0_0.getBoundingVolume());
CHECK(box_2_3_0_0.getCenter() == glm::dvec3(15.0, -15.0, -15.0));
CHECK(box_2_3_0_0.getHalfAxes()[0] == glm::dvec3(5.0, 0.0, 0.0));
CHECK(box_2_3_0_0.getHalfAxes()[1] == glm::dvec3(0.0, 5.0, 0.0));
@ -361,10 +362,10 @@ TEST_CASE("Test tile subdivision for implicit octree loader") {
const auto& tile_2_2_0_1 = tileChildren[2];
CHECK(
std::get<OctreeTileID>(tile_2_2_0_1.getTileID()) ==
mpark::get<OctreeTileID>(tile_2_2_0_1.getTileID()) ==
OctreeTileID(2, 2, 0, 1));
const auto& box_2_2_0_1 =
std::get<OrientedBoundingBox>(tile_2_2_0_1.getBoundingVolume());
mpark::get<OrientedBoundingBox>(tile_2_2_0_1.getBoundingVolume());
CHECK(box_2_2_0_1.getCenter() == glm::dvec3(5.0, -15.0, -5.0));
CHECK(box_2_2_0_1.getHalfAxes()[0] == glm::dvec3(5.0, 0.0, 0.0));
CHECK(box_2_2_0_1.getHalfAxes()[1] == glm::dvec3(0.0, 5.0, 0.0));
@ -372,10 +373,10 @@ TEST_CASE("Test tile subdivision for implicit octree loader") {
const auto& tile_2_3_0_1 = tileChildren[3];
CHECK(
std::get<OctreeTileID>(tile_2_3_0_1.getTileID()) ==
mpark::get<OctreeTileID>(tile_2_3_0_1.getTileID()) ==
OctreeTileID(2, 3, 0, 1));
const auto& box_2_3_0_1 =
std::get<OrientedBoundingBox>(tile_2_3_0_1.getBoundingVolume());
mpark::get<OrientedBoundingBox>(tile_2_3_0_1.getBoundingVolume());
CHECK(box_2_3_0_1.getCenter() == glm::dvec3(15.0, -15.0, -5.0));
CHECK(box_2_3_0_1.getHalfAxes()[0] == glm::dvec3(5.0, 0.0, 0.0));
CHECK(box_2_3_0_1.getHalfAxes()[1] == glm::dvec3(0.0, 5.0, 0.0));
@ -383,10 +384,10 @@ TEST_CASE("Test tile subdivision for implicit octree loader") {
const auto& tile_2_2_1_0 = tileChildren[4];
CHECK(
std::get<OctreeTileID>(tile_2_2_1_0.getTileID()) ==
mpark::get<OctreeTileID>(tile_2_2_1_0.getTileID()) ==
OctreeTileID(2, 2, 1, 0));
const auto& box_2_2_1_0 =
std::get<OrientedBoundingBox>(tile_2_2_1_0.getBoundingVolume());
mpark::get<OrientedBoundingBox>(tile_2_2_1_0.getBoundingVolume());
CHECK(box_2_2_1_0.getCenter() == glm::dvec3(5.0, -5.0, -15.0));
CHECK(box_2_2_1_0.getHalfAxes()[0] == glm::dvec3(5.0, 0.0, 0.0));
CHECK(box_2_2_1_0.getHalfAxes()[1] == glm::dvec3(0.0, 5.0, 0.0));
@ -394,10 +395,10 @@ TEST_CASE("Test tile subdivision for implicit octree loader") {
const auto& tile_2_3_1_0 = tileChildren[5];
CHECK(
std::get<OctreeTileID>(tile_2_3_1_0.getTileID()) ==
mpark::get<OctreeTileID>(tile_2_3_1_0.getTileID()) ==
OctreeTileID(2, 3, 1, 0));
const auto& box_2_3_1_0 =
std::get<OrientedBoundingBox>(tile_2_3_1_0.getBoundingVolume());
mpark::get<OrientedBoundingBox>(tile_2_3_1_0.getBoundingVolume());
CHECK(box_2_3_1_0.getCenter() == glm::dvec3(15.0, -5.0, -15.0));
CHECK(box_2_3_1_0.getHalfAxes()[0] == glm::dvec3(5.0, 0.0, 0.0));
CHECK(box_2_3_1_0.getHalfAxes()[1] == glm::dvec3(0.0, 5.0, 0.0));
@ -405,10 +406,10 @@ TEST_CASE("Test tile subdivision for implicit octree loader") {
const auto& tile_2_2_1_1 = tileChildren[6];
CHECK(
std::get<OctreeTileID>(tile_2_2_1_1.getTileID()) ==
mpark::get<OctreeTileID>(tile_2_2_1_1.getTileID()) ==
OctreeTileID(2, 2, 1, 1));
const auto& box_2_2_1_1 =
std::get<OrientedBoundingBox>(tile_2_2_1_1.getBoundingVolume());
mpark::get<OrientedBoundingBox>(tile_2_2_1_1.getBoundingVolume());
CHECK(box_2_2_1_1.getCenter() == glm::dvec3(5.0, -5.0, -5.0));
CHECK(box_2_2_1_1.getHalfAxes()[0] == glm::dvec3(5.0, 0.0, 0.0));
CHECK(box_2_2_1_1.getHalfAxes()[1] == glm::dvec3(0.0, 5.0, 0.0));
@ -416,10 +417,10 @@ TEST_CASE("Test tile subdivision for implicit octree loader") {
const auto& tile_2_3_1_1 = tileChildren[7];
CHECK(
std::get<OctreeTileID>(tile_2_3_1_1.getTileID()) ==
mpark::get<OctreeTileID>(tile_2_3_1_1.getTileID()) ==
OctreeTileID(2, 3, 1, 1));
const auto& box_2_3_1_1 =
std::get<OrientedBoundingBox>(tile_2_3_1_1.getBoundingVolume());
mpark::get<OrientedBoundingBox>(tile_2_3_1_1.getBoundingVolume());
CHECK(box_2_3_1_1.getCenter() == glm::dvec3(15.0, -5.0, -5.0));
CHECK(box_2_3_1_1.getHalfAxes()[0] == glm::dvec3(5.0, 0.0, 0.0));
CHECK(box_2_3_1_1.getHalfAxes()[1] == glm::dvec3(0.0, 5.0, 0.0));
@ -469,7 +470,7 @@ TEST_CASE("Test tile subdivision for implicit octree loader") {
const auto& tile_1_0_0_0 = tileChildren[0];
const auto& region_1_0_0_0 =
std::get<BoundingRegion>(tile_1_0_0_0.getBoundingVolume());
mpark::get<BoundingRegion>(tile_1_0_0_0.getBoundingVolume());
CHECK(region_1_0_0_0.getRectangle().getWest() == Approx(-Math::OnePi));
CHECK(
region_1_0_0_0.getRectangle().getSouth() == Approx(-Math::PiOverTwo));
@ -480,7 +481,7 @@ TEST_CASE("Test tile subdivision for implicit octree loader") {
const auto& tile_1_1_0_0 = tileChildren[1];
const auto& region_1_1_0_0 =
std::get<BoundingRegion>(tile_1_1_0_0.getBoundingVolume());
mpark::get<BoundingRegion>(tile_1_1_0_0.getBoundingVolume());
CHECK(region_1_1_0_0.getRectangle().getWest() == Approx(0.0));
CHECK(
region_1_1_0_0.getRectangle().getSouth() == Approx(-Math::PiOverTwo));
@ -491,7 +492,7 @@ TEST_CASE("Test tile subdivision for implicit octree loader") {
const auto& tile_1_0_0_1 = tileChildren[2];
const auto& region_1_0_0_1 =
std::get<BoundingRegion>(tile_1_0_0_1.getBoundingVolume());
mpark::get<BoundingRegion>(tile_1_0_0_1.getBoundingVolume());
CHECK(region_1_0_0_0.getRectangle().getWest() == Approx(-Math::OnePi));
CHECK(
region_1_0_0_0.getRectangle().getSouth() == Approx(-Math::PiOverTwo));
@ -502,7 +503,7 @@ TEST_CASE("Test tile subdivision for implicit octree loader") {
const auto& tile_1_1_0_1 = tileChildren[3];
const auto& region_1_1_0_1 =
std::get<BoundingRegion>(tile_1_1_0_1.getBoundingVolume());
mpark::get<BoundingRegion>(tile_1_1_0_1.getBoundingVolume());
CHECK(region_1_1_0_0.getRectangle().getWest() == Approx(0.0));
CHECK(
region_1_1_0_0.getRectangle().getSouth() == Approx(-Math::PiOverTwo));
@ -513,7 +514,7 @@ TEST_CASE("Test tile subdivision for implicit octree loader") {
const auto& tile_1_0_1_0 = tileChildren[4];
const auto& region_1_0_1_0 =
std::get<BoundingRegion>(tile_1_0_1_0.getBoundingVolume());
mpark::get<BoundingRegion>(tile_1_0_1_0.getBoundingVolume());
CHECK(region_1_0_1_0.getRectangle().getWest() == Approx(-Math::OnePi));
CHECK(region_1_0_1_0.getRectangle().getSouth() == Approx(0.0));
CHECK(region_1_0_1_0.getRectangle().getEast() == Approx(0.0));
@ -524,7 +525,7 @@ TEST_CASE("Test tile subdivision for implicit octree loader") {
const auto& tile_1_1_1_0 = tileChildren[5];
const auto& region_1_1_1_0 =
std::get<BoundingRegion>(tile_1_1_1_0.getBoundingVolume());
mpark::get<BoundingRegion>(tile_1_1_1_0.getBoundingVolume());
CHECK(region_1_1_1_0.getRectangle().getWest() == Approx(0.0));
CHECK(region_1_1_1_0.getRectangle().getSouth() == Approx(0.0));
CHECK(region_1_1_1_0.getRectangle().getEast() == Approx(Math::OnePi));
@ -535,7 +536,7 @@ TEST_CASE("Test tile subdivision for implicit octree loader") {
const auto& tile_1_0_1_1 = tileChildren[6];
const auto& region_1_0_1_1 =
std::get<BoundingRegion>(tile_1_0_1_1.getBoundingVolume());
mpark::get<BoundingRegion>(tile_1_0_1_1.getBoundingVolume());
CHECK(region_1_0_1_1.getRectangle().getWest() == Approx(-Math::OnePi));
CHECK(region_1_0_1_1.getRectangle().getSouth() == Approx(0.0));
CHECK(region_1_0_1_1.getRectangle().getEast() == Approx(0.0));
@ -546,7 +547,7 @@ TEST_CASE("Test tile subdivision for implicit octree loader") {
const auto& tile_1_1_1_1 = tileChildren[7];
const auto& region_1_1_1_1 =
std::get<BoundingRegion>(tile_1_1_1_1.getBoundingVolume());
mpark::get<BoundingRegion>(tile_1_1_1_1.getBoundingVolume());
CHECK(region_1_1_1_1.getRectangle().getWest() == Approx(0.0));
CHECK(region_1_1_1_1.getRectangle().getSouth() == Approx(0.0));
CHECK(region_1_1_1_1.getRectangle().getEast() == Approx(Math::OnePi));
@ -569,7 +570,7 @@ TEST_CASE("Test tile subdivision for implicit octree loader") {
const auto& tile_2_2_0_0 = tileChildren[0];
const auto& region_2_2_0_0 =
std::get<BoundingRegion>(tile_2_2_0_0.getBoundingVolume());
mpark::get<BoundingRegion>(tile_2_2_0_0.getBoundingVolume());
CHECK(region_2_2_0_0.getRectangle().getWest() == Approx(0.0));
CHECK(
region_2_2_0_0.getRectangle().getSouth() == Approx(-Math::PiOverTwo));
@ -582,7 +583,7 @@ TEST_CASE("Test tile subdivision for implicit octree loader") {
const auto& tile_2_3_0_0 = tileChildren[1];
const auto& region_2_3_0_0 =
std::get<BoundingRegion>(tile_2_3_0_0.getBoundingVolume());
mpark::get<BoundingRegion>(tile_2_3_0_0.getBoundingVolume());
CHECK(region_2_3_0_0.getRectangle().getWest() == Approx(Math::PiOverTwo));
CHECK(
region_2_3_0_0.getRectangle().getSouth() == Approx(-Math::PiOverTwo));
@ -595,7 +596,7 @@ TEST_CASE("Test tile subdivision for implicit octree loader") {
const auto& tile_2_2_0_1 = tileChildren[2];
const auto& region_2_2_0_1 =
std::get<BoundingRegion>(tile_2_2_0_1.getBoundingVolume());
mpark::get<BoundingRegion>(tile_2_2_0_1.getBoundingVolume());
CHECK(region_2_2_0_1.getRectangle().getWest() == Approx(0.0));
CHECK(
region_2_2_0_1.getRectangle().getSouth() == Approx(-Math::PiOverTwo));
@ -608,7 +609,7 @@ TEST_CASE("Test tile subdivision for implicit octree loader") {
const auto& tile_2_3_0_1 = tileChildren[3];
const auto& region_2_3_0_1 =
std::get<BoundingRegion>(tile_2_3_0_1.getBoundingVolume());
mpark::get<BoundingRegion>(tile_2_3_0_1.getBoundingVolume());
CHECK(region_2_3_0_1.getRectangle().getWest() == Approx(Math::PiOverTwo));
CHECK(
region_2_3_0_1.getRectangle().getSouth() == Approx(-Math::PiOverTwo));
@ -621,7 +622,7 @@ TEST_CASE("Test tile subdivision for implicit octree loader") {
const auto& tile_2_2_1_0 = tileChildren[4];
const auto& region_2_2_1_0 =
std::get<BoundingRegion>(tile_2_2_1_0.getBoundingVolume());
mpark::get<BoundingRegion>(tile_2_2_1_0.getBoundingVolume());
CHECK(region_2_2_1_0.getRectangle().getWest() == Approx(0.0));
CHECK(
region_2_2_1_0.getRectangle().getSouth() ==
@ -634,7 +635,7 @@ TEST_CASE("Test tile subdivision for implicit octree loader") {
const auto& tile_2_3_1_0 = tileChildren[5];
const auto& region_2_3_1_0 =
std::get<BoundingRegion>(tile_2_3_1_0.getBoundingVolume());
mpark::get<BoundingRegion>(tile_2_3_1_0.getBoundingVolume());
CHECK(region_2_3_1_0.getRectangle().getWest() == Approx(Math::PiOverTwo));
CHECK(
region_2_3_1_0.getRectangle().getSouth() ==
@ -646,7 +647,7 @@ TEST_CASE("Test tile subdivision for implicit octree loader") {
const auto& tile_2_2_1_1 = tileChildren[6];
const auto& region_2_2_1_1 =
std::get<BoundingRegion>(tile_2_2_1_1.getBoundingVolume());
mpark::get<BoundingRegion>(tile_2_2_1_1.getBoundingVolume());
CHECK(region_2_2_1_1.getRectangle().getWest() == Approx(0.0));
CHECK(
region_2_2_1_1.getRectangle().getSouth() ==
@ -659,7 +660,7 @@ TEST_CASE("Test tile subdivision for implicit octree loader") {
const auto& tile_2_3_1_1 = tileChildren[7];
const auto& region_2_3_1_1 =
std::get<BoundingRegion>(tile_2_3_1_1.getBoundingVolume());
mpark::get<BoundingRegion>(tile_2_3_1_1.getBoundingVolume());
CHECK(region_2_3_1_1.getRectangle().getWest() == Approx(Math::PiOverTwo));
CHECK(
region_2_3_1_1.getRectangle().getSouth() ==

View File

@ -89,7 +89,8 @@ TEST_CASE("Test implicit quadtree loader") {
asyncSystem.dispatchMainThreadTasks();
auto tileLoadResult = tileLoadResultFuture.wait();
CHECK(std::holds_alternative<TileEmptyContent>(tileLoadResult.contentKind));
CHECK(
mpark::holds_alternative<TileEmptyContent>(tileLoadResult.contentKind));
CHECK(!tileLoadResult.updatedBoundingVolume);
CHECK(!tileLoadResult.updatedContentBoundingVolume);
CHECK(!tileLoadResult.tileInitializer);
@ -140,8 +141,8 @@ TEST_CASE("Test implicit quadtree loader") {
asyncSystem.dispatchMainThreadTasks();
auto tileLoadResult = tileLoadResultFuture.wait();
CHECK(
std::holds_alternative<CesiumGltf::Model>(tileLoadResult.contentKind));
CHECK(mpark::holds_alternative<CesiumGltf::Model>(
tileLoadResult.contentKind));
CHECK(!tileLoadResult.updatedBoundingVolume);
CHECK(!tileLoadResult.updatedContentBoundingVolume);
CHECK(!tileLoadResult.tileInitializer);
@ -238,10 +239,10 @@ TEST_CASE("Test tile subdivision for implicit quadtree loader") {
const auto& tile_1_0_0 = tileChildren[0];
CHECK(
std::get<QuadtreeTileID>(tile_1_0_0.getTileID()) ==
mpark::get<QuadtreeTileID>(tile_1_0_0.getTileID()) ==
QuadtreeTileID(1, 0, 0));
const auto& box_1_0_0 =
std::get<OrientedBoundingBox>(tile_1_0_0.getBoundingVolume());
mpark::get<OrientedBoundingBox>(tile_1_0_0.getBoundingVolume());
CHECK(box_1_0_0.getCenter() == glm::dvec3(-10.0, -10.0, 0.0));
CHECK(box_1_0_0.getHalfAxes()[0] == glm::dvec3(10.0, 0.0, 0.0));
CHECK(box_1_0_0.getHalfAxes()[1] == glm::dvec3(0.0, 10.0, 0.0));
@ -249,10 +250,10 @@ TEST_CASE("Test tile subdivision for implicit quadtree loader") {
const auto& tile_1_1_0 = tileChildren[1];
CHECK(
std::get<QuadtreeTileID>(tile_1_1_0.getTileID()) ==
mpark::get<QuadtreeTileID>(tile_1_1_0.getTileID()) ==
QuadtreeTileID(1, 1, 0));
const auto& box_1_1_0 =
std::get<OrientedBoundingBox>(tile_1_1_0.getBoundingVolume());
mpark::get<OrientedBoundingBox>(tile_1_1_0.getBoundingVolume());
CHECK(box_1_1_0.getCenter() == glm::dvec3(10.0, -10.0, 0.0));
CHECK(box_1_1_0.getHalfAxes()[0] == glm::dvec3(10.0, 0.0, 0.0));
CHECK(box_1_1_0.getHalfAxes()[1] == glm::dvec3(0.0, 10.0, 0.0));
@ -260,10 +261,10 @@ TEST_CASE("Test tile subdivision for implicit quadtree loader") {
const auto& tile_1_0_1 = tileChildren[2];
CHECK(
std::get<QuadtreeTileID>(tile_1_0_1.getTileID()) ==
mpark::get<QuadtreeTileID>(tile_1_0_1.getTileID()) ==
QuadtreeTileID(1, 0, 1));
const auto& box_1_0_1 =
std::get<OrientedBoundingBox>(tile_1_0_1.getBoundingVolume());
mpark::get<OrientedBoundingBox>(tile_1_0_1.getBoundingVolume());
CHECK(box_1_0_1.getCenter() == glm::dvec3(-10.0, 10.0, 0.0));
CHECK(box_1_0_1.getHalfAxes()[0] == glm::dvec3(10.0, 0.0, 0.0));
CHECK(box_1_0_1.getHalfAxes()[1] == glm::dvec3(0.0, 10.0, 0.0));
@ -271,10 +272,10 @@ TEST_CASE("Test tile subdivision for implicit quadtree loader") {
const auto& tile_1_1_1 = tileChildren[3];
CHECK(
std::get<QuadtreeTileID>(tile_1_1_1.getTileID()) ==
mpark::get<QuadtreeTileID>(tile_1_1_1.getTileID()) ==
QuadtreeTileID(1, 1, 1));
const auto& box_1_1_1 =
std::get<OrientedBoundingBox>(tile_1_1_1.getBoundingVolume());
mpark::get<OrientedBoundingBox>(tile_1_1_1.getBoundingVolume());
CHECK(box_1_1_1.getCenter() == glm::dvec3(10.0, 10.0, 0.0));
CHECK(box_1_1_1.getHalfAxes()[0] == glm::dvec3(10.0, 0.0, 0.0));
CHECK(box_1_1_1.getHalfAxes()[1] == glm::dvec3(0.0, 10.0, 0.0));
@ -294,10 +295,10 @@ TEST_CASE("Test tile subdivision for implicit quadtree loader") {
const auto& tile_2_2_0 = tileChildren[0];
CHECK(
std::get<QuadtreeTileID>(tile_2_2_0.getTileID()) ==
mpark::get<QuadtreeTileID>(tile_2_2_0.getTileID()) ==
QuadtreeTileID(2, 2, 0));
const auto& box_2_2_0 =
std::get<OrientedBoundingBox>(tile_2_2_0.getBoundingVolume());
mpark::get<OrientedBoundingBox>(tile_2_2_0.getBoundingVolume());
CHECK(box_2_2_0.getCenter() == glm::dvec3(5.0, -15.0, 0.0));
CHECK(box_2_2_0.getHalfAxes()[0] == glm::dvec3(5.0, 0.0, 0.0));
CHECK(box_2_2_0.getHalfAxes()[1] == glm::dvec3(0.0, 5.0, 0.0));
@ -305,10 +306,10 @@ TEST_CASE("Test tile subdivision for implicit quadtree loader") {
const auto& tile_2_3_0 = tileChildren[1];
CHECK(
std::get<QuadtreeTileID>(tile_2_3_0.getTileID()) ==
mpark::get<QuadtreeTileID>(tile_2_3_0.getTileID()) ==
QuadtreeTileID(2, 3, 0));
const auto& box_2_3_0 =
std::get<OrientedBoundingBox>(tile_2_3_0.getBoundingVolume());
mpark::get<OrientedBoundingBox>(tile_2_3_0.getBoundingVolume());
CHECK(box_2_3_0.getCenter() == glm::dvec3(15.0, -15.0, 0.0));
CHECK(box_2_3_0.getHalfAxes()[0] == glm::dvec3(5.0, 0.0, 0.0));
CHECK(box_2_3_0.getHalfAxes()[1] == glm::dvec3(0.0, 5.0, 0.0));
@ -316,10 +317,10 @@ TEST_CASE("Test tile subdivision for implicit quadtree loader") {
const auto& tile_2_2_1 = tileChildren[2];
CHECK(
std::get<QuadtreeTileID>(tile_2_2_1.getTileID()) ==
mpark::get<QuadtreeTileID>(tile_2_2_1.getTileID()) ==
QuadtreeTileID(2, 2, 1));
const auto& box_2_2_1 =
std::get<OrientedBoundingBox>(tile_2_2_1.getBoundingVolume());
mpark::get<OrientedBoundingBox>(tile_2_2_1.getBoundingVolume());
CHECK(box_2_2_1.getCenter() == glm::dvec3(5.0, -5.0, 0.0));
CHECK(box_2_2_1.getHalfAxes()[0] == glm::dvec3(5.0, 0.0, 0.0));
CHECK(box_2_2_1.getHalfAxes()[1] == glm::dvec3(0.0, 5.0, 0.0));
@ -327,10 +328,10 @@ TEST_CASE("Test tile subdivision for implicit quadtree loader") {
const auto& tile_2_3_1 = tileChildren[3];
CHECK(
std::get<QuadtreeTileID>(tile_2_3_1.getTileID()) ==
mpark::get<QuadtreeTileID>(tile_2_3_1.getTileID()) ==
QuadtreeTileID(2, 3, 1));
const auto& box_2_3_1 =
std::get<OrientedBoundingBox>(tile_2_3_1.getBoundingVolume());
mpark::get<OrientedBoundingBox>(tile_2_3_1.getBoundingVolume());
CHECK(box_2_3_1.getCenter() == glm::dvec3(15.0, -5.0, 0.0));
CHECK(box_2_3_1.getHalfAxes()[0] == glm::dvec3(5.0, 0.0, 0.0));
CHECK(box_2_3_1.getHalfAxes()[1] == glm::dvec3(0.0, 5.0, 0.0));
@ -379,7 +380,7 @@ TEST_CASE("Test tile subdivision for implicit quadtree loader") {
const auto& tile_1_0_0 = tileChildren[0];
const auto& region_1_0_0 =
std::get<BoundingRegion>(tile_1_0_0.getBoundingVolume());
mpark::get<BoundingRegion>(tile_1_0_0.getBoundingVolume());
CHECK(region_1_0_0.getRectangle().getWest() == Approx(-Math::OnePi));
CHECK(region_1_0_0.getRectangle().getSouth() == Approx(-Math::PiOverTwo));
CHECK(region_1_0_0.getRectangle().getEast() == Approx(0.0));
@ -389,7 +390,7 @@ TEST_CASE("Test tile subdivision for implicit quadtree loader") {
const auto& tile_1_1_0 = tileChildren[1];
const auto& region_1_1_0 =
std::get<BoundingRegion>(tile_1_1_0.getBoundingVolume());
mpark::get<BoundingRegion>(tile_1_1_0.getBoundingVolume());
CHECK(region_1_1_0.getRectangle().getWest() == Approx(0.0));
CHECK(region_1_1_0.getRectangle().getSouth() == Approx(-Math::PiOverTwo));
CHECK(region_1_1_0.getRectangle().getEast() == Approx(Math::OnePi));
@ -399,7 +400,7 @@ TEST_CASE("Test tile subdivision for implicit quadtree loader") {
const auto& tile_1_0_1 = tileChildren[2];
const auto& region_1_0_1 =
std::get<BoundingRegion>(tile_1_0_1.getBoundingVolume());
mpark::get<BoundingRegion>(tile_1_0_1.getBoundingVolume());
CHECK(region_1_0_1.getRectangle().getWest() == Approx(-Math::OnePi));
CHECK(region_1_0_1.getRectangle().getSouth() == Approx(0.0));
CHECK(region_1_0_1.getRectangle().getEast() == Approx(0.0));
@ -409,7 +410,7 @@ TEST_CASE("Test tile subdivision for implicit quadtree loader") {
const auto& tile_1_1_1 = tileChildren[3];
const auto& region_1_1_1 =
std::get<BoundingRegion>(tile_1_1_1.getBoundingVolume());
mpark::get<BoundingRegion>(tile_1_1_1.getBoundingVolume());
CHECK(region_1_1_1.getRectangle().getWest() == Approx(0.0));
CHECK(region_1_1_1.getRectangle().getSouth() == Approx(0.0));
CHECK(region_1_1_1.getRectangle().getEast() == Approx(Math::OnePi));
@ -431,7 +432,7 @@ TEST_CASE("Test tile subdivision for implicit quadtree loader") {
const auto& tile_2_2_0 = tileChildren[0];
const auto& region_2_2_0 =
std::get<BoundingRegion>(tile_2_2_0.getBoundingVolume());
mpark::get<BoundingRegion>(tile_2_2_0.getBoundingVolume());
CHECK(region_2_2_0.getRectangle().getWest() == Approx(0.0));
CHECK(region_2_2_0.getRectangle().getSouth() == Approx(-Math::PiOverTwo));
CHECK(region_2_2_0.getRectangle().getEast() == Approx(Math::PiOverTwo));
@ -442,7 +443,7 @@ TEST_CASE("Test tile subdivision for implicit quadtree loader") {
const auto& tile_2_3_0 = tileChildren[1];
const auto& region_2_3_0 =
std::get<BoundingRegion>(tile_2_3_0.getBoundingVolume());
mpark::get<BoundingRegion>(tile_2_3_0.getBoundingVolume());
CHECK(region_2_3_0.getRectangle().getWest() == Approx(Math::PiOverTwo));
CHECK(region_2_3_0.getRectangle().getSouth() == Approx(-Math::PiOverTwo));
CHECK(region_2_3_0.getRectangle().getEast() == Approx(Math::OnePi));
@ -453,7 +454,7 @@ TEST_CASE("Test tile subdivision for implicit quadtree loader") {
const auto& tile_2_2_1 = tileChildren[2];
const auto& region_2_2_1 =
std::get<BoundingRegion>(tile_2_2_1.getBoundingVolume());
mpark::get<BoundingRegion>(tile_2_2_1.getBoundingVolume());
CHECK(region_2_2_1.getRectangle().getWest() == Approx(0.0));
CHECK(
region_2_2_1.getRectangle().getSouth() == Approx(-Math::OnePi / 4.0));
@ -464,7 +465,7 @@ TEST_CASE("Test tile subdivision for implicit quadtree loader") {
const auto& tile_2_3_1 = tileChildren[3];
const auto& region_2_3_1 =
std::get<BoundingRegion>(tile_2_3_1.getBoundingVolume());
mpark::get<BoundingRegion>(tile_2_3_1.getBoundingVolume());
CHECK(region_2_3_1.getRectangle().getWest() == Approx(Math::PiOverTwo));
CHECK(
region_2_3_1.getRectangle().getSouth() == Approx(-Math::OnePi / 4.0));
@ -511,34 +512,34 @@ TEST_CASE("Test tile subdivision for implicit quadtree loader") {
const auto& tile_1_0_0 = tileChildren[0];
CHECK(
std::get<QuadtreeTileID>(tile_1_0_0.getTileID()) ==
mpark::get<QuadtreeTileID>(tile_1_0_0.getTileID()) ==
QuadtreeTileID(1, 0, 0));
const auto& box_1_0_0 =
std::get<S2CellBoundingVolume>(tile_1_0_0.getBoundingVolume());
mpark::get<S2CellBoundingVolume>(tile_1_0_0.getBoundingVolume());
CHECK(box_1_0_0.getCellID().toToken() == "04");
const auto& tile_1_1_0 = tileChildren[1];
CHECK(
std::get<QuadtreeTileID>(tile_1_1_0.getTileID()) ==
mpark::get<QuadtreeTileID>(tile_1_1_0.getTileID()) ==
QuadtreeTileID(1, 1, 0));
const auto& box_1_1_0 =
std::get<S2CellBoundingVolume>(tile_1_1_0.getBoundingVolume());
mpark::get<S2CellBoundingVolume>(tile_1_1_0.getBoundingVolume());
CHECK(box_1_1_0.getCellID().toToken() == "1c");
const auto& tile_1_0_1 = tileChildren[2];
CHECK(
std::get<QuadtreeTileID>(tile_1_0_1.getTileID()) ==
mpark::get<QuadtreeTileID>(tile_1_0_1.getTileID()) ==
QuadtreeTileID(1, 0, 1));
const auto& box_1_0_1 =
std::get<S2CellBoundingVolume>(tile_1_0_1.getBoundingVolume());
mpark::get<S2CellBoundingVolume>(tile_1_0_1.getBoundingVolume());
CHECK(box_1_0_1.getCellID().toToken() == "0c");
const auto& tile_1_1_1 = tileChildren[3];
CHECK(
std::get<QuadtreeTileID>(tile_1_1_1.getTileID()) ==
mpark::get<QuadtreeTileID>(tile_1_1_1.getTileID()) ==
QuadtreeTileID(1, 1, 1));
const auto& box_1_1_1 =
std::get<S2CellBoundingVolume>(tile_1_1_1.getBoundingVolume());
mpark::get<S2CellBoundingVolume>(tile_1_1_1.getBoundingVolume());
CHECK(box_1_1_1.getCellID().toToken() == "14");
}
}

View File

@ -110,7 +110,7 @@ TEST_CASE("Test create layer json terrain loader") {
// check projection
const auto& projection = loaderResult.pLoader->getProjection();
CHECK(std::holds_alternative<GeographicProjection>(projection));
CHECK(mpark::holds_alternative<GeographicProjection>(projection));
// check layer
const auto& layers = loaderResult.pLoader->getLayers();
@ -123,7 +123,7 @@ TEST_CASE("Test create layer json terrain loader") {
// check root tile
const Tile& rootTile = *loaderResult.pRootTile;
const auto& rootLooseRegion =
std::get<BoundingRegionWithLooseFittingHeights>(
mpark::get<BoundingRegionWithLooseFittingHeights>(
rootTile.getBoundingVolume());
const auto& rootRegion = rootLooseRegion.getBoundingRegion();
CHECK(rootTile.isEmptyContent());
@ -142,11 +142,11 @@ TEST_CASE("Test create layer json terrain loader") {
const Tile& tile_0_0_0 = tileChildren[0];
const auto& looseRegion_0_0_0 =
std::get<BoundingRegionWithLooseFittingHeights>(
mpark::get<BoundingRegionWithLooseFittingHeights>(
tile_0_0_0.getBoundingVolume());
const auto& region_0_0_0 = looseRegion_0_0_0.getBoundingRegion();
CHECK(
std::get<QuadtreeTileID>(tile_0_0_0.getTileID()) ==
mpark::get<QuadtreeTileID>(tile_0_0_0.getTileID()) ==
QuadtreeTileID(0, 0, 0));
CHECK(tile_0_0_0.getGeometricError() == Approx(616538.71824));
CHECK(region_0_0_0.getRectangle().getWest() == Approx(-Math::OnePi));
@ -158,11 +158,11 @@ TEST_CASE("Test create layer json terrain loader") {
const Tile& tile_0_1_0 = tileChildren[1];
const auto& looseRegion_0_1_0 =
std::get<BoundingRegionWithLooseFittingHeights>(
mpark::get<BoundingRegionWithLooseFittingHeights>(
tile_0_1_0.getBoundingVolume());
const auto& region_0_1_0 = looseRegion_0_1_0.getBoundingRegion();
CHECK(
std::get<QuadtreeTileID>(tile_0_1_0.getTileID()) ==
mpark::get<QuadtreeTileID>(tile_0_1_0.getTileID()) ==
QuadtreeTileID(0, 1, 0));
CHECK(tile_0_1_0.getGeometricError() == Approx(616538.71824));
CHECK(region_0_1_0.getRectangle().getWest() == Approx(0.0));
@ -229,7 +229,7 @@ TEST_CASE("Test create layer json terrain loader") {
CHECK(loaderResult.pRootTile);
CHECK(!loaderResult.errors);
CHECK(std::holds_alternative<GeographicProjection>(
CHECK(mpark::holds_alternative<GeographicProjection>(
loaderResult.pLoader->getProjection()));
const auto& layers = loaderResult.pLoader->getLayers();
@ -258,7 +258,7 @@ TEST_CASE("Test create layer json terrain loader") {
CHECK(loaderResult.pRootTile);
CHECK(!loaderResult.errors);
CHECK(std::holds_alternative<GeographicProjection>(
CHECK(mpark::holds_alternative<GeographicProjection>(
loaderResult.pLoader->getProjection()));
const auto& layers = loaderResult.pLoader->getLayers();
@ -447,8 +447,8 @@ TEST_CASE("Test load layer json tile content") {
asyncSystem,
pMockedAssetAccessor);
auto tileLoadResult = tileLoadResultFuture.wait();
CHECK(
std::holds_alternative<CesiumGltf::Model>(tileLoadResult.contentKind));
CHECK(mpark::holds_alternative<CesiumGltf::Model>(
tileLoadResult.contentKind));
CHECK(tileLoadResult.updatedBoundingVolume);
CHECK(!tileLoadResult.updatedContentBoundingVolume);
CHECK(!tileLoadResult.tileInitializer);
@ -499,8 +499,8 @@ TEST_CASE("Test load layer json tile content") {
// check the load result
auto tileLoadResult = tileLoadResultFuture.wait();
CHECK(
std::holds_alternative<CesiumGltf::Model>(tileLoadResult.contentKind));
CHECK(mpark::holds_alternative<CesiumGltf::Model>(
tileLoadResult.contentKind));
CHECK(tileLoadResult.updatedBoundingVolume);
CHECK(!tileLoadResult.updatedContentBoundingVolume);
CHECK(!tileLoadResult.tileInitializer);
@ -565,7 +565,7 @@ TEST_CASE("Test load layer json tile content") {
pMockedAssetAccessor);
auto tileLoadResult = tileLoadResultFuture.wait();
CHECK(std::holds_alternative<CesiumGltf::Model>(
CHECK(mpark::holds_alternative<CesiumGltf::Model>(
tileLoadResult.contentKind));
CHECK(tileLoadResult.updatedBoundingVolume);
CHECK(!tileLoadResult.updatedContentBoundingVolume);
@ -585,7 +585,7 @@ TEST_CASE("Test load layer json tile content") {
pMockedAssetAccessor);
auto tileLoadResult = tileLoadResultFuture.wait();
CHECK(std::holds_alternative<CesiumGltf::Model>(
CHECK(mpark::holds_alternative<CesiumGltf::Model>(
tileLoadResult.contentKind));
CHECK(tileLoadResult.updatedBoundingVolume);
CHECK(!tileLoadResult.updatedContentBoundingVolume);
@ -642,7 +642,7 @@ TEST_CASE("Test load layer json tile content") {
pMockedAssetAccessor);
auto tileLoadResult = tileLoadResultFuture.wait();
CHECK(std::holds_alternative<CesiumGltf::Model>(
CHECK(mpark::holds_alternative<CesiumGltf::Model>(
tileLoadResult.contentKind));
CHECK(tileLoadResult.updatedBoundingVolume);
CHECK(!tileLoadResult.updatedContentBoundingVolume);
@ -672,7 +672,7 @@ TEST_CASE("Test load layer json tile content") {
pMockedAssetAccessor);
auto tileLoadResult = tileLoadResultFuture.wait();
CHECK(std::holds_alternative<CesiumGltf::Model>(
CHECK(mpark::holds_alternative<CesiumGltf::Model>(
tileLoadResult.contentKind));
CHECK(tileLoadResult.updatedBoundingVolume);
CHECK(!tileLoadResult.updatedContentBoundingVolume);
@ -778,11 +778,11 @@ TEST_CASE("Test creating tile children for layer json") {
const auto& tile_1_0_0 = tileChildren[0];
const auto& looseRegion_1_0_0 =
std::get<BoundingRegionWithLooseFittingHeights>(
mpark::get<BoundingRegionWithLooseFittingHeights>(
tile_1_0_0.getBoundingVolume());
const auto& region_1_0_0 = looseRegion_1_0_0.getBoundingRegion();
CHECK(
std::get<QuadtreeTileID>(tile_1_0_0.getTileID()) ==
mpark::get<QuadtreeTileID>(tile_1_0_0.getTileID()) ==
QuadtreeTileID(1, 0, 0));
CHECK(region_1_0_0.getRectangle().getWest() == Approx(-Math::OnePi));
CHECK(region_1_0_0.getRectangle().getSouth() == Approx(-Math::PiOverTwo));
@ -791,11 +791,11 @@ TEST_CASE("Test creating tile children for layer json") {
const auto& tile_1_1_0 = tileChildren[1];
const auto& looseRegion_1_1_0 =
std::get<BoundingRegionWithLooseFittingHeights>(
mpark::get<BoundingRegionWithLooseFittingHeights>(
tile_1_1_0.getBoundingVolume());
const auto& region_1_1_0 = looseRegion_1_1_0.getBoundingRegion();
CHECK(
std::get<QuadtreeTileID>(tile_1_1_0.getTileID()) ==
mpark::get<QuadtreeTileID>(tile_1_1_0.getTileID()) ==
QuadtreeTileID(1, 1, 0));
CHECK(region_1_1_0.getRectangle().getWest() == Approx(-Math::PiOverTwo));
CHECK(region_1_1_0.getRectangle().getSouth() == Approx(-Math::PiOverTwo));
@ -804,11 +804,11 @@ TEST_CASE("Test creating tile children for layer json") {
const auto& tile_1_0_1 = tileChildren[2];
const auto& looseRegion_1_0_1 =
std::get<BoundingRegionWithLooseFittingHeights>(
mpark::get<BoundingRegionWithLooseFittingHeights>(
tile_1_0_1.getBoundingVolume());
const auto& region_1_0_1 = looseRegion_1_0_1.getBoundingRegion();
CHECK(
std::get<QuadtreeTileID>(tile_1_0_1.getTileID()) ==
mpark::get<QuadtreeTileID>(tile_1_0_1.getTileID()) ==
QuadtreeTileID(1, 0, 1));
CHECK(region_1_0_1.getRectangle().getWest() == Approx(-Math::OnePi));
CHECK(region_1_0_1.getRectangle().getSouth() == 0.0);
@ -817,11 +817,11 @@ TEST_CASE("Test creating tile children for layer json") {
const auto& tile_1_1_1 = tileChildren[3];
const auto& looseRegion_1_1_1 =
std::get<BoundingRegionWithLooseFittingHeights>(
mpark::get<BoundingRegionWithLooseFittingHeights>(
tile_1_1_1.getBoundingVolume());
const auto& region_1_1_1 = looseRegion_1_1_1.getBoundingRegion();
CHECK(
std::get<QuadtreeTileID>(tile_1_1_1.getTileID()) ==
mpark::get<QuadtreeTileID>(tile_1_1_1.getTileID()) ==
QuadtreeTileID(1, 1, 1));
CHECK(region_1_1_1.getRectangle().getWest() == Approx(-Math::PiOverTwo));
CHECK(region_1_1_1.getRectangle().getSouth() == 0.0);
@ -845,11 +845,11 @@ TEST_CASE("Test creating tile children for layer json") {
const auto& tile_2_0_2 = tileChildren[0];
const auto& looseRegion_2_0_2 =
std::get<BoundingRegionWithLooseFittingHeights>(
mpark::get<BoundingRegionWithLooseFittingHeights>(
tile_2_0_2.getBoundingVolume());
const auto& region_2_0_2 = looseRegion_2_0_2.getBoundingRegion();
CHECK(
std::get<QuadtreeTileID>(tile_2_0_2.getTileID()) ==
mpark::get<QuadtreeTileID>(tile_2_0_2.getTileID()) ==
QuadtreeTileID(2, 0, 2));
CHECK(region_2_0_2.getRectangle().getWest() == Approx(-Math::OnePi));
CHECK(region_2_0_2.getRectangle().getSouth() == 0.0);
@ -860,11 +860,11 @@ TEST_CASE("Test creating tile children for layer json") {
const auto& tile_2_1_2 = tileChildren[1];
const auto& looseRegion_2_1_2 =
std::get<BoundingRegionWithLooseFittingHeights>(
mpark::get<BoundingRegionWithLooseFittingHeights>(
tile_2_1_2.getBoundingVolume());
const auto& region_2_1_2 = looseRegion_2_1_2.getBoundingRegion();
CHECK(
std::get<QuadtreeTileID>(tile_2_1_2.getTileID()) ==
mpark::get<QuadtreeTileID>(tile_2_1_2.getTileID()) ==
QuadtreeTileID(2, 1, 2));
CHECK(
region_2_1_2.getRectangle().getWest() ==
@ -875,11 +875,11 @@ TEST_CASE("Test creating tile children for layer json") {
const auto& tile_2_0_3 = tileChildren[2];
const auto& looseRegion_2_0_3 =
std::get<BoundingRegionWithLooseFittingHeights>(
mpark::get<BoundingRegionWithLooseFittingHeights>(
tile_2_0_3.getBoundingVolume());
const auto& region_2_0_3 = looseRegion_2_0_3.getBoundingRegion();
CHECK(
std::get<QuadtreeTileID>(tile_2_0_3.getTileID()) ==
mpark::get<QuadtreeTileID>(tile_2_0_3.getTileID()) ==
QuadtreeTileID(2, 0, 3));
CHECK(region_2_0_3.getRectangle().getWest() == Approx(-Math::OnePi));
CHECK(region_2_0_3.getRectangle().getSouth() == Approx(Math::OnePi / 4.0));
@ -890,11 +890,11 @@ TEST_CASE("Test creating tile children for layer json") {
const auto& tile_2_1_3 = tileChildren[3];
const auto& looseRegion_2_1_3 =
std::get<BoundingRegionWithLooseFittingHeights>(
mpark::get<BoundingRegionWithLooseFittingHeights>(
tile_2_1_3.getBoundingVolume());
const auto& region_2_1_3 = looseRegion_2_1_3.getBoundingRegion();
CHECK(
std::get<QuadtreeTileID>(tile_2_1_3.getTileID()) ==
mpark::get<QuadtreeTileID>(tile_2_1_3.getTileID()) ==
QuadtreeTileID(2, 1, 3));
CHECK(
region_2_1_3.getRectangle().getWest() ==
@ -919,22 +919,22 @@ TEST_CASE("Test creating tile children for layer json") {
const auto& tile_2_2_0 = tileChildren[0];
CHECK(
std::get<QuadtreeTileID>(tile_2_2_0.getTileID()) ==
mpark::get<QuadtreeTileID>(tile_2_2_0.getTileID()) ==
QuadtreeTileID(2, 2, 0));
const auto& tile_2_3_0 = tileChildren[1];
const auto& upsampleID_2_3_0 =
std::get<UpsampledQuadtreeNode>(tile_2_3_0.getTileID());
mpark::get<UpsampledQuadtreeNode>(tile_2_3_0.getTileID());
CHECK(upsampleID_2_3_0.tileID == QuadtreeTileID(2, 3, 0));
const auto& tile_2_2_1 = tileChildren[2];
const auto& upsampleID_2_2_1 =
std::get<UpsampledQuadtreeNode>(tile_2_2_1.getTileID());
mpark::get<UpsampledQuadtreeNode>(tile_2_2_1.getTileID());
CHECK(upsampleID_2_2_1.tileID == QuadtreeTileID(2, 2, 1));
const auto& tile_2_3_1 = tileChildren[3];
const auto& upsampleID_2_3_1 =
std::get<UpsampledQuadtreeNode>(tile_2_3_1.getTileID());
mpark::get<UpsampledQuadtreeNode>(tile_2_3_1.getTileID());
CHECK(upsampleID_2_3_1.tileID == QuadtreeTileID(2, 3, 1));
}
}

View File

@ -223,7 +223,7 @@ TEST_CASE("Test the manager can be initialized with correct loaders") {
REQUIRE(pTilesetJson);
REQUIRE(pTilesetJson->getChildren().size() == 1);
const Tile* pRootTile = &pTilesetJson->getChildren()[0];
CHECK(std::get<std::string>(pRootTile->getTileID()) == "parent.b3dm");
CHECK(mpark::get<std::string>(pRootTile->getTileID()) == "parent.b3dm");
CHECK(pRootTile->getGeometricError() == 70.0);
CHECK(pRootTile->getRefine() == TileRefine::Add);
}
@ -258,10 +258,10 @@ TEST_CASE("Test the manager can be initialized with correct loaders") {
const gsl::span<const Tile> children = pRootTile->getChildren();
CHECK(
std::get<QuadtreeTileID>(children[0].getTileID()) ==
mpark::get<QuadtreeTileID>(children[0].getTileID()) ==
QuadtreeTileID(0, 0, 0));
CHECK(
std::get<QuadtreeTileID>(children[1].getTileID()) ==
mpark::get<QuadtreeTileID>(children[1].getTileID()) ==
QuadtreeTileID(0, 1, 0));
}
@ -1056,7 +1056,7 @@ TEST_CASE("Test the tileset content manager's post processing for gltf") {
// check the tile whole region which will be more fitted
const BoundingRegion& tileRegion =
std::get<BoundingRegion>(tile.getBoundingVolume());
mpark::get<BoundingRegion>(tile.getBoundingVolume());
CHECK(
tileRegion.getRectangle().getWest() == Approx(beginCarto.longitude));
CHECK(
@ -1125,7 +1125,7 @@ TEST_CASE("Test the tileset content manager's post processing for gltf") {
// check the tile whole region which will be more fitted
const BoundingRegion& tileRegion =
std::get<BoundingRegion>(tile.getBoundingVolume());
mpark::get<BoundingRegion>(tile.getBoundingVolume());
CHECK(
tileRegion.getRectangle().getWest() == Approx(beginCarto.longitude));
CHECK(

View File

@ -127,11 +127,11 @@ TEST_CASE("Test creating tileset json loader") {
REQUIRE(pRootTile->getChildren().size() == 4);
CHECK(pRootTile->getGeometricError() == 70.0);
CHECK(pRootTile->getRefine() == TileRefine::Replace);
CHECK(std::get<std::string>(pRootTile->getTileID()) == "parent.b3dm");
CHECK(mpark::get<std::string>(pRootTile->getTileID()) == "parent.b3dm");
const auto& boundingVolume = pRootTile->getBoundingVolume();
const auto* pRegion =
std::get_if<CesiumGeospatial::BoundingRegion>(&boundingVolume);
mpark::get_if<CesiumGeospatial::BoundingRegion>(&boundingVolume);
CHECK(pRegion != nullptr);
CHECK(pRegion->getMinimumHeight() == Approx(0.0));
CHECK(pRegion->getMaximumHeight() == Approx(88.0));
@ -146,32 +146,32 @@ TEST_CASE("Test creating tileset json loader") {
CHECK(children[0].getChildren().size() == 1);
CHECK(children[0].getGeometricError() == 5.0);
CHECK(children[0].getRefine() == TileRefine::Replace);
CHECK(std::get<std::string>(children[0].getTileID()) == "ll.b3dm");
CHECK(std::holds_alternative<CesiumGeospatial::BoundingRegion>(
CHECK(mpark::get<std::string>(children[0].getTileID()) == "ll.b3dm");
CHECK(mpark::holds_alternative<CesiumGeospatial::BoundingRegion>(
children[0].getBoundingVolume()));
CHECK(children[1].getParent() == pRootTile);
CHECK(children[1].getChildren().size() == 0);
CHECK(children[1].getGeometricError() == 0.0);
CHECK(children[1].getRefine() == TileRefine::Replace);
CHECK(std::get<std::string>(children[1].getTileID()) == "lr.b3dm");
CHECK(std::holds_alternative<CesiumGeospatial::BoundingRegion>(
CHECK(mpark::get<std::string>(children[1].getTileID()) == "lr.b3dm");
CHECK(mpark::holds_alternative<CesiumGeospatial::BoundingRegion>(
children[1].getBoundingVolume()));
CHECK(children[2].getParent() == pRootTile);
CHECK(children[2].getChildren().size() == 0);
CHECK(children[2].getGeometricError() == 0.0);
CHECK(children[2].getRefine() == TileRefine::Replace);
CHECK(std::get<std::string>(children[2].getTileID()) == "ur.b3dm");
CHECK(std::holds_alternative<CesiumGeospatial::BoundingRegion>(
CHECK(mpark::get<std::string>(children[2].getTileID()) == "ur.b3dm");
CHECK(mpark::holds_alternative<CesiumGeospatial::BoundingRegion>(
children[2].getBoundingVolume()));
CHECK(children[3].getParent() == pRootTile);
CHECK(children[3].getChildren().size() == 0);
CHECK(children[3].getGeometricError() == 0.0);
CHECK(children[3].getRefine() == TileRefine::Replace);
CHECK(std::get<std::string>(children[3].getTileID()) == "ul.b3dm");
CHECK(std::holds_alternative<CesiumGeospatial::BoundingRegion>(
CHECK(mpark::get<std::string>(children[3].getTileID()) == "ul.b3dm");
CHECK(mpark::holds_alternative<CesiumGeospatial::BoundingRegion>(
children[3].getBoundingVolume()));
// check loader up axis
@ -194,11 +194,11 @@ TEST_CASE("Test creating tileset json loader") {
CHECK(pRootTile->getChildren().size() == 4);
CHECK(pRootTile->getGeometricError() == 70.0);
CHECK(pRootTile->getRefine() == TileRefine::Add);
CHECK(std::get<std::string>(pRootTile->getTileID()) == "parent.b3dm");
CHECK(mpark::get<std::string>(pRootTile->getTileID()) == "parent.b3dm");
const auto& boundingVolume = pRootTile->getBoundingVolume();
const auto* pRegion =
std::get_if<CesiumGeospatial::BoundingRegion>(&boundingVolume);
mpark::get_if<CesiumGeospatial::BoundingRegion>(&boundingVolume);
CHECK(pRegion != nullptr);
CHECK(pRegion->getMinimumHeight() == Approx(0.0));
CHECK(pRegion->getMaximumHeight() == Approx(88.0));
@ -216,8 +216,8 @@ TEST_CASE("Test creating tileset json loader") {
CHECK(child.getChildren().size() == 0);
CHECK(child.getGeometricError() == 0.0);
CHECK(child.getRefine() == TileRefine::Add);
CHECK(std::get<std::string>(child.getTileID()) == *expectedUrlIt);
CHECK(std::holds_alternative<CesiumGeospatial::BoundingRegion>(
CHECK(mpark::get<std::string>(child.getTileID()) == *expectedUrlIt);
CHECK(mpark::holds_alternative<CesiumGeospatial::BoundingRegion>(
child.getBoundingVolume()));
++expectedUrlIt;
}
@ -236,7 +236,8 @@ TEST_CASE("Test creating tileset json loader") {
const Tile& rootTile = loaderResult.pRootTile->getChildren()[0];
const CesiumGeometry::BoundingSphere& sphere =
std::get<CesiumGeometry::BoundingSphere>(rootTile.getBoundingVolume());
mpark::get<CesiumGeometry::BoundingSphere>(
rootTile.getBoundingVolume());
CHECK(sphere.getCenter() == glm::dvec3(0.0, 0.0, 10.0));
CHECK(sphere.getRadius() == 141.4214);
@ -254,7 +255,7 @@ TEST_CASE("Test creating tileset json loader") {
const Tile& rootTile = loaderResult.pRootTile->getChildren()[0];
const CesiumGeometry::OrientedBoundingBox& box =
std::get<CesiumGeometry::OrientedBoundingBox>(
mpark::get<CesiumGeometry::OrientedBoundingBox>(
rootTile.getBoundingVolume());
const glm::dmat3& halfAxis = box.getHalfAxes();
CHECK(halfAxis[0] == glm::dvec3(100.0, 0.0, 0.0));
@ -373,7 +374,7 @@ TEST_CASE("Test creating tileset json loader") {
CHECK(child.getRefine() == pRootTile->getRefine());
CHECK(child.getTransform() == pRootTile->getTransform());
CHECK(
std::get<CesiumGeometry::QuadtreeTileID>(child.getTileID()) ==
mpark::get<CesiumGeometry::QuadtreeTileID>(child.getTileID()) ==
CesiumGeometry::QuadtreeTileID(0, 0, 0));
}
@ -396,7 +397,7 @@ TEST_CASE("Test creating tileset json loader") {
CHECK(child.getRefine() == pRootTile->getRefine());
CHECK(child.getTransform() == pRootTile->getTransform());
CHECK(
std::get<CesiumGeometry::OctreeTileID>(child.getTileID()) ==
mpark::get<CesiumGeometry::OctreeTileID>(child.getTileID()) ==
CesiumGeometry::OctreeTileID(0, 0, 0, 0));
}
@ -430,7 +431,7 @@ TEST_CASE("Test loading individual tile of tileset json") {
auto pRootTile = &loaderResult.pRootTile->getChildren()[0];
const auto& tileID = std::get<std::string>(pRootTile->getTileID());
const auto& tileID = mpark::get<std::string>(pRootTile->getTileID());
CHECK(tileID == "parent.b3dm");
// check tile content
@ -438,8 +439,8 @@ TEST_CASE("Test loading individual tile of tileset json") {
testDataPath / "ReplaceTileset" / tileID,
*loaderResult.pLoader,
*pRootTile);
CHECK(
std::holds_alternative<CesiumGltf::Model>(tileLoadResult.contentKind));
CHECK(mpark::holds_alternative<CesiumGltf::Model>(
tileLoadResult.contentKind));
CHECK(tileLoadResult.updatedBoundingVolume == std::nullopt);
CHECK(tileLoadResult.updatedContentBoundingVolume == std::nullopt);
CHECK(tileLoadResult.state == TileLoadResultState::Success);
@ -455,7 +456,7 @@ TEST_CASE("Test loading individual tile of tileset json") {
auto pRootTile = &loaderResult.pRootTile->getChildren()[0];
const auto& tileID = std::get<std::string>(pRootTile->getTileID());
const auto& tileID = mpark::get<std::string>(pRootTile->getTileID());
CHECK(tileID == "tileset2.json");
// check tile content
@ -465,7 +466,7 @@ TEST_CASE("Test loading individual tile of tileset json") {
*pRootTile);
CHECK(tileLoadResult.updatedBoundingVolume == std::nullopt);
CHECK(tileLoadResult.updatedContentBoundingVolume == std::nullopt);
CHECK(std::holds_alternative<TileExternalContent>(
CHECK(mpark::holds_alternative<TileExternalContent>(
tileLoadResult.contentKind));
CHECK(tileLoadResult.state == TileLoadResultState::Success);
CHECK(tileLoadResult.tileInitializer);
@ -473,13 +474,13 @@ TEST_CASE("Test loading individual tile of tileset json") {
// check tile is really an external tile
pRootTile->getContent().setContentKind(
std::make_unique<TileExternalContent>(
std::get<TileExternalContent>(tileLoadResult.contentKind)));
mpark::get<TileExternalContent>(tileLoadResult.contentKind)));
tileLoadResult.tileInitializer(*pRootTile);
const auto& children = pRootTile->getChildren();
REQUIRE(children.size() == 1);
const Tile& parentB3dmTile = children[0];
CHECK(std::get<std::string>(parentB3dmTile.getTileID()) == "parent.b3dm");
CHECK(mpark::get<std::string>(parentB3dmTile.getTileID()) == "parent.b3dm");
CHECK(parentB3dmTile.getGeometricError() == Approx(70.0));
std::vector<std::string> expectedChildUrls{
@ -490,10 +491,10 @@ TEST_CASE("Test loading individual tile of tileset json") {
const auto& parentB3dmChildren = parentB3dmTile.getChildren();
for (std::size_t i = 0; i < parentB3dmChildren.size(); ++i) {
const Tile& child = parentB3dmChildren[i];
CHECK(std::get<std::string>(child.getTileID()) == expectedChildUrls[i]);
CHECK(mpark::get<std::string>(child.getTileID()) == expectedChildUrls[i]);
CHECK(child.getGeometricError() == Approx(0.0));
CHECK(child.getRefine() == TileRefine::Add);
CHECK(std::holds_alternative<CesiumGeospatial::BoundingRegion>(
CHECK(mpark::holds_alternative<CesiumGeospatial::BoundingRegion>(
child.getBoundingVolume()));
}
}
@ -511,7 +512,7 @@ TEST_CASE("Test loading individual tile of tileset json") {
auto& implicitTile = pRootTile->getChildren().front();
const auto& tileID =
std::get<CesiumGeometry::QuadtreeTileID>(implicitTile.getTileID());
mpark::get<CesiumGeometry::QuadtreeTileID>(implicitTile.getTileID());
CHECK(tileID == CesiumGeometry::QuadtreeTileID(0, 0, 0));
// mock subtree content response
@ -588,7 +589,7 @@ TEST_CASE("Test loading individual tile of tileset json") {
asyncSystem.dispatchMainThreadTasks();
auto implicitContentResult = implicitContentResultFuture.wait();
CHECK(std::holds_alternative<CesiumGltf::Model>(
CHECK(mpark::holds_alternative<CesiumGltf::Model>(
implicitContentResult.contentKind));
CHECK(!implicitContentResult.updatedBoundingVolume);
CHECK(!implicitContentResult.updatedContentBoundingVolume);
@ -610,7 +611,7 @@ TEST_CASE("Test loading individual tile of tileset json") {
auto& implicitTile = pRootTile->getChildren().front();
const auto& tileID =
std::get<CesiumGeometry::QuadtreeTileID>(implicitTile.getTileID());
mpark::get<CesiumGeometry::QuadtreeTileID>(implicitTile.getTileID());
CHECK(tileID == CesiumGeometry::QuadtreeTileID(0, 0, 0));
const auto pLoader =

View File

@ -82,7 +82,7 @@ static void initializeTileset(Tileset& tileset) {
static ViewState zoomToTile(const Tile& tile) {
const BoundingRegion* region =
std::get_if<BoundingRegion>(&tile.getBoundingVolume());
mpark::get_if<BoundingRegion>(&tile.getBoundingVolume());
REQUIRE(region != nullptr);
const GlobeRectangle& rectangle = region->getRectangle();
@ -620,7 +620,7 @@ TEST_CASE("Test additive refinement") {
for (const Tile& child : parentB3DM.getChildren()) {
REQUIRE(child.getState() == TileLoadState::Done);
if (*std::get_if<std::string>(&child.getTileID()) !=
if (*mpark::get_if<std::string>(&child.getTileID()) !=
"tileset3/tileset3.json") {
REQUIRE(doesTileMeetSSE(viewState, child, tileset));
} else {
@ -1052,7 +1052,7 @@ TEST_CASE("Can load example tileset.json from 3DTILES_bounding_volume_S2 "
const Tile* pRoot = &pTilesetJson->getChildren()[0];
const S2CellBoundingVolume* pS2 =
std::get_if<S2CellBoundingVolume>(&pRoot->getBoundingVolume());
mpark::get_if<S2CellBoundingVolume>(&pRoot->getBoundingVolume());
REQUIRE(pS2);
CHECK(pS2->getCellID().toToken() == "3");
@ -1062,7 +1062,7 @@ TEST_CASE("Can load example tileset.json from 3DTILES_bounding_volume_S2 "
REQUIRE(pRoot->getChildren().size() == 1);
const Tile* pChild = &pRoot->getChildren()[0];
const S2CellBoundingVolume* pS2Child =
std::get_if<S2CellBoundingVolume>(&pChild->getBoundingVolume());
mpark::get_if<S2CellBoundingVolume>(&pChild->getBoundingVolume());
REQUIRE(pS2Child);
CHECK(pS2Child->getCellID().toToken() == "2c");
@ -1072,7 +1072,7 @@ TEST_CASE("Can load example tileset.json from 3DTILES_bounding_volume_S2 "
REQUIRE(pChild->getChildren().size() == 1);
const Tile* pGrandchild = &pChild->getChildren()[0];
const S2CellBoundingVolume* pS2Grandchild =
std::get_if<S2CellBoundingVolume>(&pGrandchild->getBoundingVolume());
mpark::get_if<S2CellBoundingVolume>(&pGrandchild->getBoundingVolume());
REQUIRE(pS2Grandchild);
CHECK(pS2Grandchild->getCellID().toToken() == "2f");
@ -1082,7 +1082,8 @@ TEST_CASE("Can load example tileset.json from 3DTILES_bounding_volume_S2 "
REQUIRE(pGrandchild->getChildren().size() == 1);
const Tile* pGreatGrandchild = &pGrandchild->getChildren()[0];
const S2CellBoundingVolume* pS2GreatGrandchild =
std::get_if<S2CellBoundingVolume>(&pGreatGrandchild->getBoundingVolume());
mpark::get_if<S2CellBoundingVolume>(
&pGreatGrandchild->getBoundingVolume());
REQUIRE(pS2GreatGrandchild);
CHECK(pS2GreatGrandchild->getCellID().toToken() == "2ec");

View File

@ -9,7 +9,7 @@
#include <CesiumUtility/Tracing.h>
#include <variant>
#include <mpark/variant.hpp>
namespace CesiumAsync {

View File

@ -8,8 +8,9 @@
#include <CesiumUtility/Tracing.h>
#include <mpark/variant.hpp>
#include <type_traits>
#include <variant>
namespace CesiumAsync {

View File

@ -3,12 +3,12 @@
#include "Library.h"
#include <gsl/span>
#include <mpark/variant.hpp>
#include <cstdint>
#include <memory>
#include <optional>
#include <utility>
#include <variant>
#include <vector>
namespace CesiumGeometry {
@ -28,7 +28,8 @@ struct CESIUMGEOMETRY_API SubtreeBufferView {
uint8_t buffer;
};
typedef std::variant<ConstantAvailability, SubtreeBufferView> AvailabilityView;
typedef mpark::variant<ConstantAvailability, SubtreeBufferView>
AvailabilityView;
struct CESIUMGEOMETRY_API AvailabilitySubtree {
AvailabilityView tileAvailability;

View File

@ -1,8 +1,8 @@
#pragma once
#include <glm/glm.hpp>
#include <mpark/variant.hpp>
#include <variant>
#include <vector>
namespace CesiumGeometry {
@ -48,7 +48,7 @@ struct InterpolatedVertex {
* It may either be a simple index referring to an existing vertex,
* or an interpolation between two vertices.
*/
using TriangleClipVertex = std::variant<int, InterpolatedVertex>;
using TriangleClipVertex = mpark::variant<int, InterpolatedVertex>;
/**
* @brief Splits a 2D triangle at given axis-aligned threshold value and returns

View File

@ -58,8 +58,8 @@ void AvailabilityNode::setLoadedSubtree(
AvailabilityAccessor::AvailabilityAccessor(
const AvailabilityView& view,
const AvailabilitySubtree& subtree) noexcept {
this->pBufferView = std::get_if<SubtreeBufferView>(&view);
this->pConstant = std::get_if<ConstantAvailability>(&view);
this->pBufferView = mpark::get_if<SubtreeBufferView>(&view);
this->pConstant = mpark::get_if<ConstantAvailability>(&view);
if (this->pBufferView) {
if (this->pBufferView->buffer < subtree.buffers.size()) {

View File

@ -7,21 +7,20 @@
#include "WebMercatorProjection.h"
#include <glm/vec2.hpp>
#include <variant>
#include <mpark/variant.hpp>
namespace CesiumGeospatial {
/**
* @brief A projection.
*
* This is a `std::variant` of different types of map projections that
* This is a `mpark::variant` of different types of map projections that
* can convert between projected map coordinates and Cartographic coordinates.
*
* @see GeographicProjection
* @see WebMercatorProjection
*/
typedef std::variant<GeographicProjection, WebMercatorProjection> Projection;
typedef mpark::variant<GeographicProjection, WebMercatorProjection> Projection;
/**
* @brief Projects a position on the globe using the given {@link Projection}.

View File

@ -19,7 +19,7 @@ projectPosition(const Projection& projection, const Cartographic& position) {
}
};
return std::visit(Operation{position}, projection);
return mpark::visit(Operation{position}, projection);
}
Cartographic
@ -36,7 +36,7 @@ unprojectPosition(const Projection& projection, const glm::dvec3& position) {
}
};
return std::visit(Operation{position}, projection);
return mpark::visit(Operation{position}, projection);
}
CesiumGeometry::Rectangle projectRectangleSimple(
@ -56,7 +56,7 @@ CesiumGeometry::Rectangle projectRectangleSimple(
}
};
return std::visit(Operation{rectangle}, projection);
return mpark::visit(Operation{rectangle}, projection);
}
GlobeRectangle unprojectRectangleSimple(
@ -75,7 +75,7 @@ GlobeRectangle unprojectRectangleSimple(
}
};
return std::visit(Operation{rectangle}, projection);
return mpark::visit(Operation{rectangle}, projection);
}
CesiumGeometry::AxisAlignedBox projectRegionSimple(
@ -212,6 +212,6 @@ double computeApproximateConversionFactorToMetersNearPosition(
}
};
return std::visit(Operation{position}, projection);
return mpark::visit(Operation{position}, projection);
}
} // namespace CesiumGeospatial

View File

@ -6,10 +6,10 @@
#include <CesiumUtility/SpanHelper.h>
#include <gsl/span>
#include <mpark/variant.hpp>
#include <cassert>
#include <cstddef>
#include <variant>
#include <vector>
namespace CesiumGltf {
@ -45,13 +45,13 @@ public:
: _values{std::move(values)} {}
const ElementType& operator[](int64_t index) const noexcept {
return std::visit(
return mpark::visit(
[index](auto const& values) -> auto const& { return values[index]; },
_values);
}
int64_t size() const noexcept {
return std::visit(
return mpark::visit(
[](auto const& values) { return static_cast<int64_t>(values.size()); },
_values);
}
@ -76,7 +76,7 @@ public:
private:
using ArrayType =
std::variant<gsl::span<const ElementType>, std::vector<ElementType>>;
mpark::variant<gsl::span<const ElementType>, std::vector<ElementType>>;
ArrayType _values;
};

View File

@ -562,7 +562,7 @@ private:
}
}
using PropertyDefinitionType = std::variant<
using PropertyDefinitionType = mpark::variant<
ClassProperty,
PropertyTableProperty,
PropertyTextureProperty,
@ -573,7 +573,7 @@ private:
* given property type.
*/
void getNumericPropertyValues(const PropertyDefinitionType& inProperty) {
std::visit(
mpark::visit(
[this](auto property) {
if (property.offset) {
// Only floating point types can specify an offset.
@ -899,7 +899,7 @@ private:
}
}
using PropertyDefinitionType = std::variant<
using PropertyDefinitionType = mpark::variant<
ClassProperty,
PropertyTableProperty,
PropertyTextureProperty,
@ -910,7 +910,7 @@ private:
* given property type.
*/
void getNumericPropertyValues(const PropertyDefinitionType& inProperty) {
std::visit(
mpark::visit(
[this](auto property) {
if (property.offset) {
_offset = getValue<NormalizedType>(*property.offset);
@ -1570,10 +1570,10 @@ private:
std::optional<std::vector<std::byte>> _noData;
std::optional<std::vector<std::byte>> _defaultValue;
using PropertyDefinitionType = std::
using PropertyDefinitionType = mpark::
variant<ClassProperty, PropertyTableProperty, PropertyTextureProperty>;
void getNumericPropertyValues(const PropertyDefinitionType& inProperty) {
std::visit(
mpark::visit(
[this](auto property) {
if (property.offset) {
// Only floating point types can specify an offset.
@ -1967,10 +1967,10 @@ private:
std::optional<std::vector<std::byte>> _noData;
std::optional<std::vector<std::byte>> _defaultValue;
using PropertyDefinitionType = std::
using PropertyDefinitionType = mpark::
variant<ClassProperty, PropertyTableProperty, PropertyTextureProperty>;
void getNumericPropertyValues(const PropertyDefinitionType& inProperty) {
std::visit(
mpark::visit(
[this](auto property) {
if (property.offset) {
if (_count > 0) {

View File

@ -272,7 +272,8 @@ TEST_CASE("Nested extras deserializes properly") {
REQUIRE(pC2 != nullptr);
CHECK(pC2->isArray());
std::vector<JsonValue>& array = std::get<std::vector<JsonValue>>(pC2->value);
std::vector<JsonValue>& array =
mpark::get<std::vector<JsonValue>>(pC2->value);
CHECK(array.size() == 5);
CHECK(array[0].getSafeNumber<double>() == 1.0);
CHECK(array[1].getSafeNumber<std::uint64_t>() == 2);

View File

@ -7,7 +7,7 @@ namespace {
template <typename T>
void addOrReplace(CesiumUtility::JsonValue& json, T value) {
CesiumUtility::JsonValue::Array* pArray =
std::get_if<CesiumUtility::JsonValue::Array>(&json.value);
mpark::get_if<CesiumUtility::JsonValue::Array>(&json.value);
if (pArray) {
pArray->emplace_back(value);
} else {
@ -64,7 +64,7 @@ IJsonHandler* JsonObjectJsonHandler::readDouble(double d) {
IJsonHandler* JsonObjectJsonHandler::readString(const std::string_view& str) {
CesiumUtility::JsonValue& current = *this->_stack.back();
CesiumUtility::JsonValue::Array* pArray =
std::get_if<CesiumUtility::JsonValue::Array>(&current.value);
mpark::get_if<CesiumUtility::JsonValue::Array>(&current.value);
if (pArray) {
pArray->emplace_back(std::string(str));
} else {
@ -77,7 +77,7 @@ IJsonHandler* JsonObjectJsonHandler::readString(const std::string_view& str) {
IJsonHandler* JsonObjectJsonHandler::readObjectStart() {
CesiumUtility::JsonValue& current = *this->_stack.back();
CesiumUtility::JsonValue::Array* pArray =
std::get_if<CesiumUtility::JsonValue::Array>(&current.value);
mpark::get_if<CesiumUtility::JsonValue::Array>(&current.value);
if (pArray) {
CesiumUtility::JsonValue& newObject =
pArray->emplace_back(CesiumUtility::JsonValue::Object());
@ -93,7 +93,7 @@ IJsonHandler*
JsonObjectJsonHandler::readObjectKey(const std::string_view& str) {
CesiumUtility::JsonValue& json = *this->_stack.back();
CesiumUtility::JsonValue::Object* pObject =
std::get_if<CesiumUtility::JsonValue::Object>(&json.value);
mpark::get_if<CesiumUtility::JsonValue::Object>(&json.value);
auto it = pObject->emplace(str, CesiumUtility::JsonValue()).first;
this->_stack.push_back(&it->second);
@ -108,7 +108,7 @@ IJsonHandler* JsonObjectJsonHandler::readObjectEnd() {
IJsonHandler* JsonObjectJsonHandler::readArrayStart() {
CesiumUtility::JsonValue& current = *this->_stack.back();
CesiumUtility::JsonValue::Array* pArray =
std::get_if<CesiumUtility::JsonValue::Array>(&current.value);
mpark::get_if<CesiumUtility::JsonValue::Array>(&current.value);
if (pArray) {
CesiumUtility::JsonValue& newArray =
pArray->emplace_back(CesiumUtility::JsonValue::Array());
@ -128,7 +128,7 @@ IJsonHandler* JsonObjectJsonHandler::readArrayEnd() {
IJsonHandler* JsonObjectJsonHandler::doneElement() {
CesiumUtility::JsonValue& current = *this->_stack.back();
CesiumUtility::JsonValue::Array* pArray =
std::get_if<CesiumUtility::JsonValue::Array>(&current.value);
mpark::get_if<CesiumUtility::JsonValue::Array>(&current.value);
if (!pArray) {
this->_stack.pop_back();
return this->_stack.empty() ? this->parent() : this;

View File

@ -74,13 +74,13 @@ void recursiveObjectWriter(
j.Key(key);
if (item.isArray()) {
recursiveArrayWriter(
std::get<CesiumUtility::JsonValue::Array>(item.value),
mpark::get<CesiumUtility::JsonValue::Array>(item.value),
j);
}
if (item.isObject()) {
recursiveObjectWriter(
std::get<CesiumUtility::JsonValue::Object>(item.value),
mpark::get<CesiumUtility::JsonValue::Object>(item.value),
j);
}
@ -99,11 +99,11 @@ void writeJsonValue(
if (value.isArray()) {
recursiveArrayWriter(
std::get<CesiumUtility::JsonValue::Array>(value.value),
mpark::get<CesiumUtility::JsonValue::Array>(value.value),
jsonWriter);
} else if (value.isObject()) {
recursiveObjectWriter(
std::get<CesiumUtility::JsonValue::Object>(value.value),
mpark::get<CesiumUtility::JsonValue::Object>(value.value),
jsonWriter);
} else {
primitiveWriter(value, jsonWriter);

View File

@ -53,6 +53,7 @@ target_link_libraries(CesiumUtility
PUBLIC
GSL
zlibstatic
mpark_variant
)
install(TARGETS CesiumUtility

View File

@ -3,6 +3,7 @@
#include "Library.h"
#include <gsl/narrow>
#include <mpark/variant.hpp>
#include <cmath>
#include <cstdint>
@ -13,7 +14,6 @@
#include <string>
#include <string_view>
#include <type_traits>
#include <variant>
#include <vector>
namespace CesiumUtility {
@ -222,7 +222,7 @@ public:
return nullptr;
}
return std::get_if<T>(&pValue->value);
return mpark::get_if<T>(&pValue->value);
}
/**
@ -241,7 +241,7 @@ public:
*/
template <typename T> T* getValuePtrForKey(const std::string& key) {
JsonValue* pValue = this->getValuePtrForKey(key);
return std::get_if<T>(&pValue->value);
return mpark::get_if<T>(&pValue->value);
}
/**
@ -269,7 +269,7 @@ public:
std::is_integral<To>::value ||
std::is_floating_point<To>::value>::type* = nullptr>
[[nodiscard]] To getSafeNumericalValueForKey(const std::string& key) const {
const Object& pObject = std::get<Object>(this->value);
const Object& pObject = mpark::get<Object>(this->value);
const auto it = pObject.find(key);
if (it == pObject.end()) {
throw JsonValueMissingKey(key);
@ -302,7 +302,7 @@ public:
[[nodiscard]] To getSafeNumericalValueOrDefaultForKey(
const std::string& key,
To defaultValue) const {
const Object& pObject = std::get<Object>(this->value);
const Object& pObject = mpark::get<Object>(this->value);
const auto it = pObject.find(key);
if (it == pObject.end()) {
return defaultValue;
@ -318,7 +318,7 @@ public:
* or does not contain the given key.
*/
[[nodiscard]] inline bool hasKey(const std::string& key) const {
const Object* pObject = std::get_if<Object>(&this->value);
const Object* pObject = mpark::get_if<Object>(&this->value);
if (!pObject) {
return false;
}
@ -341,17 +341,17 @@ public:
std::is_integral<To>::value ||
std::is_floating_point<To>::value>::type* = nullptr>
[[nodiscard]] To getSafeNumber() const {
const std::uint64_t* uInt = std::get_if<std::uint64_t>(&this->value);
const std::uint64_t* uInt = mpark::get_if<std::uint64_t>(&this->value);
if (uInt) {
return gsl::narrow<To>(*uInt);
}
const std::int64_t* sInt = std::get_if<std::int64_t>(&this->value);
const std::int64_t* sInt = mpark::get_if<std::int64_t>(&this->value);
if (sInt) {
return gsl::narrow<To>(*sInt);
}
const double* real = std::get_if<double>(&this->value);
const double* real = mpark::get_if<double>(&this->value);
if (real) {
return gsl::narrow<To>(*real);
}
@ -372,17 +372,17 @@ public:
std::is_integral<To>::value ||
std::is_floating_point<To>::value>::type* = nullptr>
[[nodiscard]] To getSafeNumberOrDefault(To defaultValue) const noexcept {
const std::uint64_t* uInt = std::get_if<std::uint64_t>(&this->value);
const std::uint64_t* uInt = mpark::get_if<std::uint64_t>(&this->value);
if (uInt) {
return losslessNarrowOrDefault<To>(*uInt, defaultValue);
}
const std::int64_t* sInt = std::get_if<std::int64_t>(&this->value);
const std::int64_t* sInt = mpark::get_if<std::int64_t>(&this->value);
if (sInt) {
return losslessNarrowOrDefault<To>(*sInt, defaultValue);
}
const double* real = std::get_if<double>(&this->value);
const double* real = mpark::get_if<double>(&this->value);
if (real) {
return losslessNarrowOrDefault<To>(*real, defaultValue);
}
@ -398,7 +398,7 @@ public:
*/
[[nodiscard]] inline const JsonValue::Object& getObject() const {
return std::get<JsonValue::Object>(this->value);
return mpark::get<JsonValue::Object>(this->value);
}
/**
@ -408,7 +408,7 @@ public:
* JsonValue::String
*/
[[nodiscard]] inline const JsonValue::String& getString() const {
return std::get<String>(this->value);
return mpark::get<String>(this->value);
}
/**
@ -418,7 +418,7 @@ public:
* JsonValue::Array
*/
[[nodiscard]] inline const JsonValue::Array& getArray() const {
return std::get<JsonValue::Array>(this->value);
return mpark::get<JsonValue::Array>(this->value);
}
/**
@ -439,7 +439,7 @@ public:
* JsonValue::Bool
*/
[[nodiscard]] inline bool getBool() const {
return std::get<bool>(this->value);
return mpark::get<bool>(this->value);
}
/**
@ -448,7 +448,7 @@ public:
* @throws std::bad_variant_access if the underlying type is not a double
*/
[[nodiscard]] inline double getDouble() const {
return std::get<double>(this->value);
return mpark::get<double>(this->value);
}
/**
@ -458,7 +458,7 @@ public:
* std::uint64_t
*/
[[nodiscard]] std::uint64_t getUint64() const {
return std::get<std::uint64_t>(this->value);
return mpark::get<std::uint64_t>(this->value);
}
/**
@ -468,7 +468,7 @@ public:
* std::int64_t
*/
[[nodiscard]] std::int64_t getInt64() const {
return std::get<std::int64_t>(this->value);
return mpark::get<std::int64_t>(this->value);
}
/**
@ -476,7 +476,7 @@ public:
* @return The bool or defaultValue if this->value is not a bool.
*/
[[nodiscard]] inline bool getBoolOrDefault(bool defaultValue) const noexcept {
const auto* v = std::get_if<bool>(&this->value);
const auto* v = mpark::get_if<bool>(&this->value);
if (v) {
return *v;
}
@ -490,7 +490,7 @@ public:
*/
[[nodiscard]] inline const JsonValue::String
getStringOrDefault(String defaultValue) const {
const auto* v = std::get_if<JsonValue::String>(&this->value);
const auto* v = mpark::get_if<JsonValue::String>(&this->value);
if (v) {
return *v;
}
@ -504,7 +504,7 @@ public:
*/
[[nodiscard]] inline double
getDoubleOrDefault(double defaultValue) const noexcept {
const auto* v = std::get_if<double>(&this->value);
const auto* v = mpark::get_if<double>(&this->value);
if (v) {
return *v;
}
@ -518,7 +518,7 @@ public:
*/
[[nodiscard]] inline std::uint64_t
getUint64OrDefault(std::uint64_t defaultValue) const noexcept {
const auto* v = std::get_if<std::uint64_t>(&this->value);
const auto* v = mpark::get_if<std::uint64_t>(&this->value);
if (v) {
return *v;
}
@ -532,7 +532,7 @@ public:
*/
[[nodiscard]] inline std::int64_t
getInt64OrDefault(std::int64_t defaultValue) const noexcept {
const auto* v = std::get_if<std::int64_t>(&this->value);
const auto* v = mpark::get_if<std::int64_t>(&this->value);
if (v) {
return *v;
}
@ -544,7 +544,7 @@ public:
* @brief Returns whether this value is a `null` value.
*/
[[nodiscard]] inline bool isNull() const noexcept {
return std::holds_alternative<Null>(this->value);
return mpark::holds_alternative<Null>(this->value);
}
/**
@ -560,49 +560,49 @@ public:
* @brief Returns whether this value is a `Bool` value.
*/
[[nodiscard]] inline bool isBool() const noexcept {
return std::holds_alternative<Bool>(this->value);
return mpark::holds_alternative<Bool>(this->value);
}
/**
* @brief Returns whether this value is a `String` value.
*/
[[nodiscard]] inline bool isString() const noexcept {
return std::holds_alternative<String>(this->value);
return mpark::holds_alternative<String>(this->value);
}
/**
* @brief Returns whether this value is an `Object` value.
*/
[[nodiscard]] inline bool isObject() const noexcept {
return std::holds_alternative<Object>(this->value);
return mpark::holds_alternative<Object>(this->value);
}
/**
* @brief Returns whether this value is an `Array` value.
*/
[[nodiscard]] inline bool isArray() const noexcept {
return std::holds_alternative<Array>(this->value);
return mpark::holds_alternative<Array>(this->value);
}
/**
* @brief Returns whether this value is a `double` value.
*/
[[nodiscard]] inline bool isDouble() const noexcept {
return std::holds_alternative<double>(this->value);
return mpark::holds_alternative<double>(this->value);
}
/**
* @brief Returns whether this value is a `std::uint64_t` value.
*/
[[nodiscard]] inline bool isUint64() const noexcept {
return std::holds_alternative<std::uint64_t>(this->value);
return mpark::holds_alternative<std::uint64_t>(this->value);
}
/**
* @brief Returns whether this value is a `std::int64_t` value.
*/
[[nodiscard]] inline bool isInt64() const noexcept {
return std::holds_alternative<std::int64_t>(this->value);
return mpark::holds_alternative<std::int64_t>(this->value);
}
/**
@ -617,7 +617,7 @@ public:
* `Object` values, the properties may be accessed with the
* `getValueForKey` functions.
*/
std::variant<
mpark::variant<
Null,
double,
std::uint64_t,

View File

@ -5,7 +5,7 @@
namespace CesiumUtility {
const JsonValue* JsonValue::getValuePtrForKey(const std::string& key) const {
const Object* pObject = std::get_if<Object>(&this->value);
const Object* pObject = mpark::get_if<Object>(&this->value);
if (!pObject) {
return nullptr;
}
@ -19,7 +19,7 @@ const JsonValue* JsonValue::getValuePtrForKey(const std::string& key) const {
}
JsonValue* JsonValue::getValuePtrForKey(const std::string& key) {
Object* pObject = std::get_if<Object>(&this->value);
Object* pObject = mpark::get_if<Object>(&this->value);
if (!pObject) {
return nullptr;
}

View File

@ -200,3 +200,5 @@ set_property(TARGET turbojpeg PROPERTY IMPORTED_LOCATION ${TJ_INSTALL_PREFIX}/li
set_property(TARGET turbojpeg PROPERTY IMPORTED_LOCATION_DEBUG ${TJ_INSTALL_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}turbojpeg${CMAKE_DEBUG_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX})
target_include_directories(turbojpeg INTERFACE "${CMAKE_CURRENT_LIST_DIR}/libjpeg-turbo")
add_dependencies(turbojpeg libjpeg-turbo)
add_subdirectory(variant)