Skip to content

Commit

Permalink
Temp
Browse files Browse the repository at this point in the history
  • Loading branch information
lilleyse committed Aug 29, 2024
1 parent 956039e commit 5018126
Show file tree
Hide file tree
Showing 42 changed files with 545 additions and 340 deletions.
25 changes: 15 additions & 10 deletions Cesium3DTiles/src/MetadataQuery.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
#include <Cesium3DTiles/ClassProperty.h>
#include <Cesium3DTiles/MetadataEntity.h>
#include <Cesium3DTiles/MetadataQuery.h>
#include <Cesium3DTiles/Schema.h>

#include <optional>
#include <string>

namespace Cesium3DTiles {

Expand All @@ -12,23 +18,22 @@ MetadataQuery::findFirstPropertyWithSemantic(
return std::nullopt;
}

const Cesium3DTiles::Class& klass = classIt->second;
const auto& [classId, klass] = *classIt;

for (auto it = entity.properties.begin(); it != entity.properties.end();
++it) {
const std::pair<std::string, CesiumUtility::JsonValue>& property = *it;
auto propertyIt = klass.properties.find(property.first);
if (propertyIt == klass.properties.end())
for (const auto& [propertyId, property] : entity.properties) {
auto propertyIt = klass.properties.find(propertyId);
if (propertyIt == klass.properties.end()) {
continue;
}

const ClassProperty& classProperty = propertyIt->second;
if (classProperty.semantic == semantic) {
return FoundMetadataProperty{
classIt->first,
classIt->second,
it->first,
classId,
klass,
propertyId,
propertyIt->second,
it->second};
property};
}
}

Expand Down
13 changes: 9 additions & 4 deletions Cesium3DTilesContent/src/BatchTableHierarchyPropertyValues.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
#include <CesiumUtility/Assert.h>

#include <glm/common.hpp>
#include <rapidjson/document.h>
#include <rapidjson/rapidjson.h>

#include <cstddef>
#include <cstdint>
#include <string>
#include <vector>

using namespace Cesium3DTilesContent::CesiumImpl;

Expand All @@ -22,9 +29,7 @@ BatchTableHierarchyPropertyValues::BatchTableHierarchyPropertyValues(
: _batchTableHierarchy(batchTableHierarchy),
_batchLength(batchLength),
_pClassIDs(nullptr),
_pParentIDs(nullptr),
_instanceIndices(),
_propertyInClass() {
_pParentIDs(nullptr) {
static const rapidjson::Value emptyArray = createEmptyArray();

auto classIdsIt = this->_batchTableHierarchy.FindMember("classIds");
Expand Down Expand Up @@ -101,7 +106,7 @@ void BatchTableHierarchyPropertyValues::setProperty(
propertyName.data(),
rapidjson::SizeType(propertyName.size()));

for (auto it = classes.Begin(); it != classes.End(); ++it) {
for (const auto* it = classes.Begin(); it != classes.End(); ++it) {
auto instancesIt = it->FindMember("instances");
if (instancesIt == it->MemberEnd()) {
this->_propertyInClass.emplace_back(nullptr);
Expand Down
24 changes: 18 additions & 6 deletions Cesium3DTilesContent/src/TileBoundingVolumes.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
#include <Cesium3DTiles/BoundingVolume.h>
#include <Cesium3DTiles/Extension3dTilesBoundingVolumeS2.h>
#include <Cesium3DTilesContent/TileBoundingVolumes.h>
#include <CesiumGeometry/BoundingSphere.h>
#include <CesiumGeometry/OrientedBoundingBox.h>
#include <CesiumGeospatial/BoundingRegion.h>
#include <CesiumGeospatial/Ellipsoid.h>
#include <CesiumGeospatial/S2CellID.h>

#include <optional>
#include <vector>

using namespace Cesium3DTiles;
using namespace CesiumGeometry;
Expand All @@ -10,8 +18,9 @@ namespace Cesium3DTilesContent {

std::optional<OrientedBoundingBox> TileBoundingVolumes::getOrientedBoundingBox(
const BoundingVolume& boundingVolume) {
if (boundingVolume.box.size() < 12)
if (boundingVolume.box.size() < 12) {
return std::nullopt;
}

const std::vector<double>& a = boundingVolume.box;
return CesiumGeometry::OrientedBoundingBox(
Expand Down Expand Up @@ -42,8 +51,9 @@ void TileBoundingVolumes::setOrientedBoundingBox(
std::optional<BoundingRegion> TileBoundingVolumes::getBoundingRegion(
const BoundingVolume& boundingVolume,
const Ellipsoid& ellipsoid) {
if (boundingVolume.region.size() < 6)
if (boundingVolume.region.size() < 6) {
return std::nullopt;
}

const std::vector<double>& a = boundingVolume.region;
return CesiumGeospatial::BoundingRegion(
Expand All @@ -69,8 +79,9 @@ void TileBoundingVolumes::setBoundingRegion(

std::optional<BoundingSphere>
TileBoundingVolumes::getBoundingSphere(const BoundingVolume& boundingVolume) {
if (boundingVolume.sphere.size() < 4)
if (boundingVolume.sphere.size() < 4) {
return std::nullopt;
}

const std::vector<double>& a = boundingVolume.sphere;
return CesiumGeometry::BoundingSphere(glm::dvec3(a[0], a[1], a[2]), a[3]);
Expand All @@ -88,10 +99,11 @@ std::optional<S2CellBoundingVolume>
TileBoundingVolumes::getS2CellBoundingVolume(
const BoundingVolume& boundingVolume,
const CesiumGeospatial::Ellipsoid& ellipsoid) {
const Extension3dTilesBoundingVolumeS2* pExtension =
const auto* pExtension =
boundingVolume.getExtension<Extension3dTilesBoundingVolumeS2>();
if (!pExtension)
if (!pExtension) {
return std::nullopt;
}

return CesiumGeospatial::S2CellBoundingVolume(
CesiumGeospatial::S2CellID::fromToken(pExtension->token),
Expand All @@ -103,7 +115,7 @@ TileBoundingVolumes::getS2CellBoundingVolume(
void TileBoundingVolumes::setS2CellBoundingVolume(
Cesium3DTiles::BoundingVolume& boundingVolume,
const CesiumGeospatial::S2CellBoundingVolume& s2BoundingVolume) {
Extension3dTilesBoundingVolumeS2& extension =
auto& extension =
boundingVolume.addExtension<Extension3dTilesBoundingVolumeS2>();
extension.token = s2BoundingVolume.getCellID().toToken();
extension.minimumHeight = s2BoundingVolume.getMinimumHeight();
Expand Down
50 changes: 25 additions & 25 deletions Cesium3DTilesReader/generated/src/GeneratedJsonHandlers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ CesiumJsonReader::IJsonHandler* Extension3dTilesBoundingVolumeS2JsonHandler::
const std::string& objectType,
const std::string_view& str,
Cesium3DTiles::Extension3dTilesBoundingVolumeS2& o) {
using namespace std::string_literals;
using std::string_literals::operator""s; // NOLINT(misc-include-cleaner)

if ("token"s == str)
return property("token", this->_token, o.token);
Expand Down Expand Up @@ -152,7 +152,7 @@ CesiumJsonReader::IJsonHandler* StatisticsJsonHandler::readObjectKeyStatistics(
const std::string& objectType,
const std::string_view& str,
Cesium3DTiles::Statistics& o) {
using namespace std::string_literals;
using std::string_literals::operator""s; // NOLINT(misc-include-cleaner)

if ("classes"s == str)
return property("classes", this->_classes, o.classes);
Expand Down Expand Up @@ -236,7 +236,7 @@ ClassStatisticsJsonHandler::readObjectKeyClassStatistics(
const std::string& objectType,
const std::string_view& str,
Cesium3DTiles::ClassStatistics& o) {
using namespace std::string_literals;
using std::string_literals::operator""s; // NOLINT(misc-include-cleaner)

if ("count"s == str)
return property("count", this->_count, o.count);
Expand Down Expand Up @@ -330,7 +330,7 @@ PropertyStatisticsJsonHandler::readObjectKeyPropertyStatistics(
const std::string& objectType,
const std::string_view& str,
Cesium3DTiles::PropertyStatistics& o) {
using namespace std::string_literals;
using std::string_literals::operator""s; // NOLINT(misc-include-cleaner)

if ("min"s == str)
return property("min", this->_min, o.min);
Expand Down Expand Up @@ -437,7 +437,7 @@ CesiumJsonReader::IJsonHandler* SchemaJsonHandler::readObjectKeySchema(
const std::string& objectType,
const std::string_view& str,
Cesium3DTiles::Schema& o) {
using namespace std::string_literals;
using std::string_literals::operator""s; // NOLINT(misc-include-cleaner)

if ("id"s == str)
return property("id", this->_id, o.id);
Expand Down Expand Up @@ -528,7 +528,7 @@ CesiumJsonReader::IJsonHandler* EnumJsonHandler::readObjectKeyEnum(
const std::string& objectType,
const std::string_view& str,
Cesium3DTiles::Enum& o) {
using namespace std::string_literals;
using std::string_literals::operator""s; // NOLINT(misc-include-cleaner)

if ("name"s == str)
return property("name", this->_name, o.name);
Expand Down Expand Up @@ -614,7 +614,7 @@ CesiumJsonReader::IJsonHandler* EnumValueJsonHandler::readObjectKeyEnumValue(
const std::string& objectType,
const std::string_view& str,
Cesium3DTiles::EnumValue& o) {
using namespace std::string_literals;
using std::string_literals::operator""s; // NOLINT(misc-include-cleaner)

if ("name"s == str)
return property("name", this->_name, o.name);
Expand Down Expand Up @@ -699,7 +699,7 @@ CesiumJsonReader::IJsonHandler* ClassJsonHandler::readObjectKeyClass(
const std::string& objectType,
const std::string_view& str,
Cesium3DTiles::Class& o) {
using namespace std::string_literals;
using std::string_literals::operator""s; // NOLINT(misc-include-cleaner)

if ("name"s == str)
return property("name", this->_name, o.name);
Expand Down Expand Up @@ -797,7 +797,7 @@ ClassPropertyJsonHandler::readObjectKeyClassProperty(
const std::string& objectType,
const std::string_view& str,
Cesium3DTiles::ClassProperty& o) {
using namespace std::string_literals;
using std::string_literals::operator""s; // NOLINT(misc-include-cleaner)

if ("name"s == str)
return property("name", this->_name, o.name);
Expand Down Expand Up @@ -918,7 +918,7 @@ CesiumJsonReader::IJsonHandler* SubtreeJsonHandler::readObjectKeySubtree(
const std::string& objectType,
const std::string_view& str,
Cesium3DTiles::Subtree& o) {
using namespace std::string_literals;
using std::string_literals::operator""s; // NOLINT(misc-include-cleaner)

if ("buffers"s == str)
return property("buffers", this->_buffers, o.buffers);
Expand Down Expand Up @@ -1029,7 +1029,7 @@ MetadataEntityJsonHandler::readObjectKeyMetadataEntity(
const std::string& objectType,
const std::string_view& str,
Cesium3DTiles::MetadataEntity& o) {
using namespace std::string_literals;
using std::string_literals::operator""s; // NOLINT(misc-include-cleaner)

if ("class"s == str)
return property("class", this->_classProperty, o.classProperty);
Expand Down Expand Up @@ -1117,7 +1117,7 @@ AvailabilityJsonHandler::readObjectKeyAvailability(
const std::string& objectType,
const std::string_view& str,
Cesium3DTiles::Availability& o) {
using namespace std::string_literals;
using std::string_literals::operator""s; // NOLINT(misc-include-cleaner)

if ("bitstream"s == str)
return property("bitstream", this->_bitstream, o.bitstream);
Expand Down Expand Up @@ -1207,7 +1207,7 @@ PropertyTableJsonHandler::readObjectKeyPropertyTable(
const std::string& objectType,
const std::string_view& str,
Cesium3DTiles::PropertyTable& o) {
using namespace std::string_literals;
using std::string_literals::operator""s; // NOLINT(misc-include-cleaner)

if ("name"s == str)
return property("name", this->_name, o.name);
Expand Down Expand Up @@ -1305,7 +1305,7 @@ PropertyTablePropertyJsonHandler::readObjectKeyPropertyTableProperty(
const std::string& objectType,
const std::string_view& str,
Cesium3DTiles::PropertyTableProperty& o) {
using namespace std::string_literals;
using std::string_literals::operator""s; // NOLINT(misc-include-cleaner)

if ("values"s == str)
return property("values", this->_values, o.values);
Expand Down Expand Up @@ -1416,7 +1416,7 @@ CesiumJsonReader::IJsonHandler* BufferViewJsonHandler::readObjectKeyBufferView(
const std::string& objectType,
const std::string_view& str,
Cesium3DTiles::BufferView& o) {
using namespace std::string_literals;
using std::string_literals::operator""s; // NOLINT(misc-include-cleaner)

if ("buffer"s == str)
return property("buffer", this->_buffer, o.buffer);
Expand Down Expand Up @@ -1506,7 +1506,7 @@ CesiumJsonReader::IJsonHandler* BufferJsonHandler::readObjectKeyBuffer(
const std::string& objectType,
const std::string_view& str,
Cesium3DTiles::Buffer& o) {
using namespace std::string_literals;
using std::string_literals::operator""s; // NOLINT(misc-include-cleaner)

if ("uri"s == str)
return property("uri", this->_uri, o.uri);
Expand Down Expand Up @@ -1598,7 +1598,7 @@ CesiumJsonReader::IJsonHandler* TilesetJsonHandler::readObjectKeyTileset(
const std::string& objectType,
const std::string_view& str,
Cesium3DTiles::Tileset& o) {
using namespace std::string_literals;
using std::string_literals::operator""s; // NOLINT(misc-include-cleaner)

if ("asset"s == str)
return property("asset", this->_asset, o.asset);
Expand Down Expand Up @@ -1708,7 +1708,7 @@ CesiumJsonReader::IJsonHandler* TileJsonHandler::readObjectKeyTile(
const std::string& objectType,
const std::string_view& str,
Cesium3DTiles::Tile& o) {
using namespace std::string_literals;
using std::string_literals::operator""s; // NOLINT(misc-include-cleaner)

if ("boundingVolume"s == str)
return property("boundingVolume", this->_boundingVolume, o.boundingVolume);
Expand Down Expand Up @@ -1811,7 +1811,7 @@ ImplicitTilingJsonHandler::readObjectKeyImplicitTiling(
const std::string& objectType,
const std::string_view& str,
Cesium3DTiles::ImplicitTiling& o) {
using namespace std::string_literals;
using std::string_literals::operator""s; // NOLINT(misc-include-cleaner)

if ("subdivisionScheme"s == str)
return property(
Expand Down Expand Up @@ -1905,7 +1905,7 @@ CesiumJsonReader::IJsonHandler* SubtreesJsonHandler::readObjectKeySubtrees(
const std::string& objectType,
const std::string_view& str,
Cesium3DTiles::Subtrees& o) {
using namespace std::string_literals;
using std::string_literals::operator""s; // NOLINT(misc-include-cleaner)

if ("uri"s == str)
return property("uri", this->_uri, o.uri);
Expand Down Expand Up @@ -1987,7 +1987,7 @@ CesiumJsonReader::IJsonHandler* ContentJsonHandler::readObjectKeyContent(
const std::string& objectType,
const std::string_view& str,
Cesium3DTiles::Content& o) {
using namespace std::string_literals;
using std::string_literals::operator""s; // NOLINT(misc-include-cleaner)

if ("boundingVolume"s == str)
return property("boundingVolume", this->_boundingVolume, o.boundingVolume);
Expand Down Expand Up @@ -2074,7 +2074,7 @@ BoundingVolumeJsonHandler::readObjectKeyBoundingVolume(
const std::string& objectType,
const std::string_view& str,
Cesium3DTiles::BoundingVolume& o) {
using namespace std::string_literals;
using std::string_literals::operator""s; // NOLINT(misc-include-cleaner)

if ("box"s == str)
return property("box", this->_box, o.box);
Expand Down Expand Up @@ -2161,7 +2161,7 @@ GroupMetadataJsonHandler::readObjectKeyGroupMetadata(
const std::string& objectType,
const std::string_view& str,
Cesium3DTiles::GroupMetadata& o) {
using namespace std::string_literals;
using std::string_literals::operator""s; // NOLINT(misc-include-cleaner)

(void)o;

Expand Down Expand Up @@ -2244,7 +2244,7 @@ CesiumJsonReader::IJsonHandler* PropertiesJsonHandler::readObjectKeyProperties(
const std::string& objectType,
const std::string_view& str,
Cesium3DTiles::Properties& o) {
using namespace std::string_literals;
using std::string_literals::operator""s; // NOLINT(misc-include-cleaner)

if ("maximum"s == str)
return property("maximum", this->_maximum, o.maximum);
Expand Down Expand Up @@ -2329,7 +2329,7 @@ CesiumJsonReader::IJsonHandler* AssetJsonHandler::readObjectKeyAsset(
const std::string& objectType,
const std::string_view& str,
Cesium3DTiles::Asset& o) {
using namespace std::string_literals;
using std::string_literals::operator""s; // NOLINT(misc-include-cleaner)

if ("version"s == str)
return property("version", this->_version, o.version);
Expand Down
Loading

0 comments on commit 5018126

Please sign in to comment.