mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-23 13:56:28 +00:00
Remaining cpp changes
This commit is contained in:
@@ -1556,7 +1556,7 @@ void fix_quantities(IfcParse::IfcFile& f, bool no_progress, bool quiet, bool std
|
|||||||
auto IfcRelDefinesByProperties = f.schema()->declaration_by_name("IfcRelDefinesByProperties");
|
auto IfcRelDefinesByProperties = f.schema()->declaration_by_name("IfcRelDefinesByProperties");
|
||||||
|
|
||||||
for (auto& eq : element_quantities) {
|
for (auto& eq : element_quantities) {
|
||||||
auto rels = eq.data()->file()->getInverse(eq.id(), IfcRelDefinesByProperties, -1);
|
auto rels = eq.file()->getInverse(eq.id(), IfcRelDefinesByProperties, -1);
|
||||||
for (auto& rel : rels) {
|
for (auto& rel : rels) {
|
||||||
relationships.push_back(rel);
|
relationships.push_back(rel);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -191,6 +191,24 @@ struct hash<express::Entity> {
|
|||||||
|
|
||||||
} // namespace std
|
} // namespace std
|
||||||
|
|
||||||
|
namespace boost {
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct hash<express::Base> {
|
||||||
|
std::size_t operator()(const express::Base& c) const noexcept {
|
||||||
|
return std::hash<uint32_t>{}(c.identity());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct hash<express::Entity> {
|
||||||
|
std::size_t operator()(const express::Entity& c) const noexcept {
|
||||||
|
return std::hash<uint32_t>{}(c.identity());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace boost
|
||||||
|
|
||||||
template <typename T, typename U>
|
template <typename T, typename U>
|
||||||
std::vector<T> cast_vector(const std::vector<U>& vs) {
|
std::vector<T> cast_vector(const std::vector<U>& vs) {
|
||||||
std::vector<T> result;
|
std::vector<T> result;
|
||||||
|
|||||||
@@ -412,9 +412,9 @@ void ColladaSerializer::ColladaExporter::write(const IfcGeom::TriangulationEleme
|
|||||||
deferreds.push_back(deferred);
|
deferreds.push_back(deferred);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string ColladaSerializer::differentiateSlabTypes(const IfcUtil::IfcBaseEntity* slab)
|
std::string ColladaSerializer::differentiateSlabTypes(const express::Entity& slab)
|
||||||
{
|
{
|
||||||
auto value = slab->get("PredefinedType");
|
auto value = slab.get("PredefinedType");
|
||||||
|
|
||||||
if (value.isNull()) {
|
if (value.isNull()) {
|
||||||
return "_Unknown";
|
return "_Unknown";
|
||||||
@@ -434,7 +434,7 @@ std::string ColladaSerializer::differentiateSlabTypes(const IfcUtil::IfcBaseEnti
|
|||||||
} else if (str_value == "NOTDEFINED") {
|
} else if (str_value == "NOTDEFINED") {
|
||||||
result = "_NotDefined";
|
result = "_NotDefined";
|
||||||
} else {
|
} else {
|
||||||
auto otype = slab->get("ObjectType");
|
auto otype = slab.get("ObjectType");
|
||||||
if (otype.isNull()) {
|
if (otype.isNull()) {
|
||||||
result = "_Unknown";
|
result = "_Unknown";
|
||||||
} else {
|
} else {
|
||||||
@@ -448,7 +448,7 @@ std::string ColladaSerializer::differentiateSlabTypes(const IfcUtil::IfcBaseEnti
|
|||||||
std::string ColladaSerializer::object_id(const IfcGeom::Element* o) /*override*/
|
std::string ColladaSerializer::object_id(const IfcGeom::Element* o) /*override*/
|
||||||
{
|
{
|
||||||
if (settings_.get<ifcopenshell::geometry::settings::UseElementTypes>().get()) {
|
if (settings_.get<ifcopenshell::geometry::settings::UseElementTypes>().get()) {
|
||||||
const std::string slabSuffix = (o->product() && o->product()->declaration().name() == "IfcSlab")
|
const std::string slabSuffix = (o->product() && o->product().declaration().name() == "IfcSlab")
|
||||||
? differentiateSlabTypes(o->product())
|
? differentiateSlabTypes(o->product())
|
||||||
: "";
|
: "";
|
||||||
return o->type() + slabSuffix;
|
return o->type() + slabSuffix;
|
||||||
|
|||||||
@@ -243,7 +243,7 @@ public:
|
|||||||
std::string object_id(const IfcGeom::Element* o) /*override*/;
|
std::string object_id(const IfcGeom::Element* o) /*override*/;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static std::string differentiateSlabTypes(const IfcUtil::IfcBaseEntity* slab);
|
static std::string differentiateSlabTypes(const express::Entity& slab);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -251,7 +251,7 @@ void HdfSerializer::read_surface_style(const surface_style_serialization& s,
|
|||||||
gss.specularity = s.specularity;
|
gss.specularity = s.specularity;
|
||||||
}
|
}
|
||||||
if (s.id != 0) {
|
if (s.id != 0) {
|
||||||
gss.instance = f.instance_by_id(s.id)->as<IfcUtil::IfcBaseEntity>();
|
gss.instance = f.instance_by_id(s.id).as<express::Entity>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -290,7 +290,7 @@ IfcGeom::Element* HdfSerializer::read(IfcParse::IfcFile& f, const std::string& g
|
|||||||
auto representation_group = element_group.openGroup(representation_id_str);
|
auto representation_group = element_group.openGroup(representation_id_str);
|
||||||
std::string geom_id = read_scalar_attribute<std::string>(representation_group, "geom_id");
|
std::string geom_id = read_scalar_attribute<std::string>(representation_group, "geom_id");
|
||||||
|
|
||||||
auto inst = f.instance_by_id(id)->as<IfcUtil::IfcBaseEntity>();
|
auto inst = f.instance_by_id(id).as<express::Entity>();
|
||||||
|
|
||||||
boost::shared_ptr<IfcGeom::Representation::BRep> brep_geometry;
|
boost::shared_ptr<IfcGeom::Representation::BRep> brep_geometry;
|
||||||
boost::shared_ptr<IfcGeom::Representation::Triangulation> triangulation_geometry;
|
boost::shared_ptr<IfcGeom::Representation::Triangulation> triangulation_geometry;
|
||||||
@@ -550,8 +550,8 @@ void HdfSerializer::write_style(surface_style_serialization& data, const ifcopen
|
|||||||
data.name = s.name.c_str();
|
data.name = s.name.c_str();
|
||||||
// @todo
|
// @todo
|
||||||
data.original_name = s.name.c_str();
|
data.original_name = s.name.c_str();
|
||||||
auto instance = s.instance->as<IfcUtil::IfcBaseClass>();
|
auto& instance = s.instance;
|
||||||
data.id = instance ? instance->id() : 0;
|
data.id = instance ? instance.id() : 0;
|
||||||
if (s.diffuse) {
|
if (s.diffuse) {
|
||||||
data.diffuse[0] = s.diffuse.ccomponents()(0);
|
data.diffuse[0] = s.diffuse.ccomponents()(0);
|
||||||
data.diffuse[1] = s.diffuse.ccomponents()(1);
|
data.diffuse[1] = s.diffuse.ccomponents()(1);
|
||||||
|
|||||||
@@ -52,6 +52,8 @@ namespace {
|
|||||||
|
|
||||||
class format_value_visitor : public boost::static_visitor<std::string> {
|
class format_value_visitor : public boost::static_visitor<std::string> {
|
||||||
public:
|
public:
|
||||||
|
format_value_visitor() = default;
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
json operator()(const T& t) const {
|
json operator()(const T& t) const {
|
||||||
if constexpr (std::is_same_v<std::decay_t<T>, Derived> || std::is_same_v<std::decay_t<T>, boost::dynamic_bitset<>> || std::is_same_v<std::decay_t<T>, express::Base> || std::is_same_v<std::decay_t<T>, std::vector<int>> || std::is_same_v<std::decay_t<T>, std::vector<double>> || std::is_same_v<std::decay_t<T>, std::vector<std::string>> || std::is_same_v<std::decay_t<T>, std::vector<boost::dynamic_bitset<>>> || std::is_same_v<std::decay_t<T>, std::vector<express::Base>> || std::is_same_v<std::decay_t<T>, std::vector<std::vector<express::Base>>> || std::is_same_v<std::decay_t<T>, std::vector<std::vector<int>>> || std::is_same_v<std::decay_t<T>, std::vector<std::vector<double>>> || std::is_same_v<std::decay_t<T>, empty_aggregate_t> || std::is_same_v<std::decay_t<T>, empty_aggregate_of_aggregate_t> || std::is_same_v<std::decay_t<T>, Blank>) {
|
if constexpr (std::is_same_v<std::decay_t<T>, Derived> || std::is_same_v<std::decay_t<T>, boost::dynamic_bitset<>> || std::is_same_v<std::decay_t<T>, express::Base> || std::is_same_v<std::decay_t<T>, std::vector<int>> || std::is_same_v<std::decay_t<T>, std::vector<double>> || std::is_same_v<std::decay_t<T>, std::vector<std::string>> || std::is_same_v<std::decay_t<T>, std::vector<boost::dynamic_bitset<>>> || std::is_same_v<std::decay_t<T>, std::vector<express::Base>> || std::is_same_v<std::decay_t<T>, std::vector<std::vector<express::Base>>> || std::is_same_v<std::decay_t<T>, std::vector<std::vector<int>>> || std::is_same_v<std::decay_t<T>, std::vector<std::vector<double>>> || std::is_same_v<std::decay_t<T>, empty_aggregate_t> || std::is_same_v<std::decay_t<T>, empty_aggregate_of_aggregate_t> || std::is_same_v<std::decay_t<T>, Blank>) {
|
||||||
@@ -71,6 +73,8 @@ class format_value_visitor : public boost::static_visitor<std::string> {
|
|||||||
|
|
||||||
class get_type_visitor : public boost::static_visitor<std::string> {
|
class get_type_visitor : public boost::static_visitor<std::string> {
|
||||||
public:
|
public:
|
||||||
|
get_type_visitor() = default;
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
std::string operator()(const T& t) const {
|
std::string operator()(const T& t) const {
|
||||||
// @todo more types
|
// @todo more types
|
||||||
|
|||||||
Reference in New Issue
Block a user