mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-11 18:16:40 +00:00
Fixes for gcc
This commit is contained in:
@@ -845,7 +845,7 @@ bool IfcGeom::util::boolean_operation(const boolean_settings& settings, const To
|
||||
|
||||
std::string debug_identifier;
|
||||
if (debug) {
|
||||
static my_thread_local size_t operation_counter_ = 0;
|
||||
static thread_local size_t operation_counter_ = 0;
|
||||
std::stringstream ss;
|
||||
ss << "bool-" << std::this_thread::get_id() << "-" << (operation_counter_++);
|
||||
debug_identifier = ss.str();
|
||||
|
||||
@@ -50,7 +50,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcObjectPlacement& inst) {
|
||||
relative_to = inst.PlacementRelTo();
|
||||
#else
|
||||
if (inst.as<IfcSchema::IfcLocalPlacement>()) {
|
||||
relative_to = inst.as<IfcSchema::IfcLocalPlacement>()->PlacementRelTo();
|
||||
relative_to = inst.as<IfcSchema::IfcLocalPlacement>().PlacementRelTo();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -325,30 +325,30 @@ const express::Base mapping::get_single_material_association(const express::Base
|
||||
}
|
||||
}
|
||||
if (associated_materials.size() == 1) {
|
||||
IfcSchema::IfcMaterialSelect associated_material;
|
||||
express::Base associated_material;
|
||||
|
||||
try {
|
||||
associated_material = associated_materials.front().RelatingMaterial();
|
||||
associated_material = associated_materials.front().RelatingMaterial().concrete();
|
||||
} catch(IfcParse::IfcException& e) {
|
||||
Logger::Error(e.what());
|
||||
}
|
||||
|
||||
if (associated_material) {
|
||||
// @todo make sure that chaining as() works in nullptrs
|
||||
single_material = associated_material.as<IfcSchema::IfcMaterialDefinition>().as<IfcSchema::IfcMaterial>();
|
||||
single_material = associated_material.as<IfcSchema::IfcMaterial>();
|
||||
|
||||
// NB: Single-layer layersets are also considered, regardless of --enable-layerset-slicing, this
|
||||
// in accordance with other viewers.
|
||||
if (!single_material) {
|
||||
if (associated_material.as<IfcSchema::IfcMaterialUsageDefinition>().as<IfcSchema::IfcMaterialLayerSetUsage>() || associated_material.as<IfcSchema::IfcMaterialDefinition>().as<IfcSchema::IfcMaterialLayerSet>()) {
|
||||
if (associated_material.as<IfcSchema::IfcMaterialLayerSetUsage>() || associated_material.as<IfcSchema::IfcMaterialLayerSet>()) {
|
||||
IfcSchema::IfcMaterialLayerSet layerset;
|
||||
if (auto m = associated_material.as<IfcSchema::IfcMaterialUsageDefinition>().as<IfcSchema::IfcMaterialLayerSetUsage>()) {
|
||||
if (auto m = associated_material.as<IfcSchema::IfcMaterialLayerSetUsage>()) {
|
||||
if (m.get("ForLayerSet").isNull()) {
|
||||
Logger::Warning("Missing ForLayerSet for:", m);
|
||||
return express::Base{};
|
||||
}
|
||||
layerset = m.ForLayerSet();
|
||||
} else {
|
||||
layerset = associated_material.as<IfcSchema::IfcMaterialDefinition>().as<IfcSchema::IfcMaterialLayerSet>();
|
||||
layerset = associated_material.as<IfcSchema::IfcMaterialLayerSet>();
|
||||
}
|
||||
if (settings_.get<settings::LayersetFirst>().value ? layerset.MaterialLayers().size() >= 1 : layerset.MaterialLayers().size() == 1) {
|
||||
IfcSchema::IfcMaterialLayer layer = layerset.MaterialLayers().front();
|
||||
@@ -359,16 +359,16 @@ const express::Base mapping::get_single_material_association(const express::Base
|
||||
}
|
||||
|
||||
#ifdef SCHEMA_HAS_IfcMaterialProfileSet
|
||||
if (associated_material.as<IfcSchema::IfcMaterialUsageDefinition>().as<IfcSchema::IfcMaterialProfileSetUsage>() || associated_material.as<IfcSchema::IfcMaterialDefinition>().as<IfcSchema::IfcMaterialProfileSet>()) {
|
||||
if (associated_material.as<IfcSchema::IfcMaterialProfileSetUsage>() || associated_material.as<IfcSchema::IfcMaterialProfileSet>()) {
|
||||
IfcSchema::IfcMaterialProfileSet profileset;
|
||||
if (auto m = associated_material.as<IfcSchema::IfcMaterialUsageDefinition>().as<IfcSchema::IfcMaterialProfileSetUsage>()) {
|
||||
if (auto m = associated_material.as<IfcSchema::IfcMaterialProfileSetUsage>()) {
|
||||
if (m.get("ForProfileSet").isNull()) {
|
||||
Logger::Warning("Missing ForProfileSet for:", m);
|
||||
return express::Base{};
|
||||
}
|
||||
profileset = m.ForProfileSet();
|
||||
} else {
|
||||
profileset = associated_material.as<IfcSchema::IfcMaterialDefinition>().as<IfcSchema::IfcMaterialProfileSet>();
|
||||
profileset = associated_material.as<IfcSchema::IfcMaterialProfileSet>();
|
||||
}
|
||||
if (settings_.get<settings::LayersetFirst>().value ? profileset.MaterialProfiles().size() >= 1 : profileset.MaterialProfiles().size() == 1) {
|
||||
IfcSchema::IfcMaterialProfile profile = profileset.MaterialProfiles().front();
|
||||
@@ -380,8 +380,8 @@ const express::Base mapping::get_single_material_association(const express::Base
|
||||
#endif
|
||||
|
||||
#ifdef SCHEMA_HAS_IfcMaterialConstituentSet
|
||||
if (associated_material.as<IfcSchema::IfcMaterialDefinition>().as<IfcSchema::IfcMaterialConstituentSet>() && associated_material.as<IfcSchema::IfcMaterialDefinition>().as<IfcSchema::IfcMaterialConstituentSet>().MaterialConstituents()) {
|
||||
IfcSchema::IfcMaterialConstituentSet constituentset = associated_material.as<IfcSchema::IfcMaterialDefinition>().as<IfcSchema::IfcMaterialConstituentSet>();
|
||||
if (associated_material.as<IfcSchema::IfcMaterialConstituentSet>() && associated_material.as<IfcSchema::IfcMaterialConstituentSet>().MaterialConstituents()) {
|
||||
IfcSchema::IfcMaterialConstituentSet constituentset = associated_material.as<IfcSchema::IfcMaterialConstituentSet>();
|
||||
if (settings_.get<settings::LayersetFirst>().value ? constituentset.MaterialConstituents().value().size() >= 1 : constituentset.MaterialConstituents().value().size() == 1) {
|
||||
IfcSchema::IfcMaterialConstituent constituent = constituentset.MaterialConstituents().value().front();
|
||||
if (auto m_ = constituent.Material()) {
|
||||
@@ -469,12 +469,10 @@ namespace {
|
||||
// Only in case of 2x3 or old style IfcPresentationStyleAssignment
|
||||
auto styles = style_assignment->Styles();
|
||||
#elif defined(SCHEMA_HAS_IfcPresentationStyleAssignment)
|
||||
std::vector<IfcSchema::IfcPresentationStyleAssignment> style_assignments = si->Styles();
|
||||
for (IfcSchema::IfcPresentationStyleAssignment::list::it kt = style_assignments->begin(); kt != style_assignments->end(); ++kt) {
|
||||
IfcSchema::IfcPresentationStyleAssignment* style_assignment = *kt;
|
||||
|
||||
std::vector<IfcSchema::IfcPresentationStyleAssignment> style_assignments = si.Styles();
|
||||
for (auto& style_assignment : style_assignments) {
|
||||
// Only in case of 2x3 or old style IfcPresentationStyleAssignment
|
||||
auto styles = style_assignment->Styles();
|
||||
auto styles = style_assignment.Styles();
|
||||
#else
|
||||
auto styles = si.Styles();
|
||||
#endif
|
||||
@@ -735,7 +733,7 @@ taxonomy::ptr mapping::map(const express::Base& inst) {
|
||||
namespace {
|
||||
express::Base get_RelatingObject(IfcSchema::IfcRelDecomposes& decompose) {
|
||||
#ifdef SCHEMA_IfcRelDecomposes_HAS_RelatingObject
|
||||
return decompose->RelatingObject();
|
||||
return decompose.RelatingObject();
|
||||
#else
|
||||
IfcSchema::IfcRelAggregates aggr = decompose.as<IfcSchema::IfcRelAggregates>();
|
||||
if (aggr) {
|
||||
@@ -990,7 +988,7 @@ bool mapping::get_layerset_information(const express::Base& p, layerset_informat
|
||||
for (auto it = associations.begin(); it != associations.end(); ++it) {
|
||||
IfcSchema::IfcRelAssociatesMaterial associates_material = (*it).as<IfcSchema::IfcRelAssociatesMaterial>();
|
||||
if (associates_material) {
|
||||
usage = associates_material.RelatingMaterial().as<IfcSchema::IfcMaterialUsageDefinition>().as<IfcSchema::IfcMaterialLayerSetUsage>();
|
||||
usage = associates_material.RelatingMaterial().as<IfcSchema::IfcMaterialLayerSetUsage>();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-11
@@ -433,17 +433,7 @@ namespace impl {
|
||||
|
||||
template <typename T>
|
||||
T IfcParse::impl::in_memory_file_storage::create(int id) {
|
||||
express::Base inst;
|
||||
// T::Class() yadaya, id or freshid() I though I changed this elsewhere already
|
||||
if constexpr (std::is_same_v<std::decay_t<std::invoke_result_t<typename T::Class>>, IfcParse::entity>) {
|
||||
inst = new T(in_memory_attribute_storage(T::Class().attribute_count()));
|
||||
} else if constexpr (std::is_same_v<std::decay_t<std::invoke_result_t<typename T::Class>>, IfcParse::type_declaration>) {
|
||||
inst = new T(in_memory_attribute_storage(1));
|
||||
} else {
|
||||
static_assert(dependent_false_v<T>, "Requires and entity or type declaration");
|
||||
}
|
||||
inst->file_ = file;
|
||||
return file->addEntity(inst)->as<T>();
|
||||
return create(&T::declaration(), id).template as<T>();
|
||||
}
|
||||
|
||||
#ifdef IFOPSH_WITH_ROCKSDB
|
||||
|
||||
@@ -66,7 +66,7 @@ typename Schema::IfcLocalPlacement IfcHierarchyHelper<Schema>::addLocalPlacement
|
||||
double xx,
|
||||
double xy,
|
||||
double xz) {
|
||||
auto local_placement = create<Schema::IfcLocalPlacement>();
|
||||
auto local_placement = create<typename Schema::IfcLocalPlacement>();
|
||||
if (parent) {
|
||||
local_placement.setPlacementRelTo(parent);
|
||||
}
|
||||
@@ -76,24 +76,31 @@ typename Schema::IfcLocalPlacement IfcHierarchyHelper<Schema>::addLocalPlacement
|
||||
|
||||
template <typename Schema>
|
||||
typename Schema::IfcOwnerHistory IfcHierarchyHelper<Schema>::addOwnerHistory() {
|
||||
typename Schema::IfcPerson person = create<Schema::IfcPerson>();
|
||||
person.setIdentification("");
|
||||
typename Schema::IfcPerson person = create<typename Schema::IfcPerson>();
|
||||
#ifdef HAS_SCHEMA_2x3
|
||||
if constexpr (std::is_same_v<Schema, Ifc2x3>) {
|
||||
person.setId("");
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
person.setIdentification("");
|
||||
}
|
||||
|
||||
auto organization = create<Schema::IfcOrganization>();
|
||||
auto organization = create<typename Schema::IfcOrganization>();
|
||||
organization.setName("IfcOpenShell");
|
||||
|
||||
auto person_and_org = create<Schema::IfcPersonAndOrganization>();
|
||||
auto person_and_org = create<typename Schema::IfcPersonAndOrganization>();
|
||||
person_and_org.setThePerson(person);
|
||||
person_and_org.setTheOrganization(organization);
|
||||
|
||||
auto application = create<Schema::IfcApplication>();
|
||||
auto application = create<typename Schema::IfcApplication>();
|
||||
application.setApplicationDeveloper(organization);
|
||||
application.setVersion(IFCOPENSHELL_VERSION);
|
||||
application.setApplicationFullName("IfcOpenShell");
|
||||
application.setApplicationIdentifier("IfcOpenShell");
|
||||
|
||||
int timestamp = (int)time(0);
|
||||
auto owner_hist = create<Schema::IfcOwnerHistory>();
|
||||
auto owner_hist = create<typename Schema::IfcOwnerHistory>();
|
||||
owner_hist.setOwningUser(person_and_org);
|
||||
owner_hist.setOwningApplication(application);
|
||||
owner_hist.setChangeAction(Schema::IfcChangeActionEnum::IfcChangeAction_ADDED);
|
||||
@@ -109,7 +116,7 @@ template <typename Schema>
|
||||
typename Schema::IfcProject IfcHierarchyHelper<Schema>::addProject(typename Schema::IfcOwnerHistory owner_hist) {
|
||||
std::vector<typename Schema::IfcRepresentationContext> rep_contexts;
|
||||
|
||||
auto dimexp = create<Schema::IfcDimensionalExponents>();
|
||||
auto dimexp = create<typename Schema::IfcDimensionalExponents>();
|
||||
dimexp.setLengthExponent(0);
|
||||
dimexp.setMassExponent(0);
|
||||
dimexp.setTimeExponent(0);
|
||||
@@ -118,32 +125,32 @@ typename Schema::IfcProject IfcHierarchyHelper<Schema>::addProject(typename Sche
|
||||
dimexp.setAmountOfSubstanceExponent(0);
|
||||
dimexp.setLuminousIntensityExponent(0);
|
||||
|
||||
auto unit1 = create<Schema::IfcSIUnit>();
|
||||
auto unit1 = create<typename Schema::IfcSIUnit>();
|
||||
unit1.setUnitType(Schema::IfcUnitEnum::IfcUnit_LENGTHUNIT);
|
||||
unit1.setPrefix(Schema::IfcSIPrefix::IfcSIPrefix_MILLI);
|
||||
unit1.setName(Schema::IfcSIUnitName::IfcSIUnitName_METRE);
|
||||
|
||||
auto unit2a = create<Schema::IfcSIUnit>();
|
||||
auto unit2a = create<typename Schema::IfcSIUnit>();
|
||||
unit2a.setUnitType(Schema::IfcUnitEnum::IfcUnit_PLANEANGLEUNIT);
|
||||
unit2a.setName(Schema::IfcSIUnitName::IfcSIUnitName_RADIAN);
|
||||
|
||||
auto unit2b = create<Schema::IfcMeasureWithUnit>();
|
||||
auto measure = create<Schema::IfcPlaneAngleMeasure>();
|
||||
auto unit2b = create<typename Schema::IfcMeasureWithUnit>();
|
||||
auto measure = create<typename Schema::IfcPlaneAngleMeasure>();
|
||||
measure.set_attribute_value(0, 0.01745329251);
|
||||
unit2b.setValueComponent(measure);
|
||||
unit2b.setUnitComponent(unit2a);
|
||||
|
||||
auto unit2 = create<Schema::IfcConversionBasedUnit>();
|
||||
auto unit2 = create<typename Schema::IfcConversionBasedUnit>();
|
||||
unit2.setDimensions(dimexp);
|
||||
unit2.setUnitType(Schema::IfcUnitEnum::IfcUnit_PLANEANGLEUNIT);
|
||||
unit2.setName("Degrees");
|
||||
unit2.setConversionFactor(unit2b);
|
||||
|
||||
std::vector<typename Schema::IfcUnit> units = {unit1, unit2};
|
||||
auto unit_assignment = create<Schema::IfcUnitAssignment>();
|
||||
auto unit_assignment = create<typename Schema::IfcUnitAssignment>();
|
||||
unit_assignment.setUnits(units);
|
||||
|
||||
auto project = create<Schema::IfcProject>();
|
||||
auto project = create<typename Schema::IfcProject>();
|
||||
project.setGlobalId(IfcParse::IfcGlobalId());
|
||||
project.setOwnerHistory(owner_hist ? owner_hist : addOwnerHistory());
|
||||
project.setRepresentationContexts(rep_contexts);
|
||||
@@ -156,7 +163,7 @@ template <typename Schema>
|
||||
void IfcHierarchyHelper<Schema>::relatePlacements(typename Schema::IfcProduct parent, typename Schema::IfcProduct product) {
|
||||
typename Schema::IfcObjectPlacement place = product.ObjectPlacement();
|
||||
if (place) {
|
||||
if (auto local_place = place.as<typename Schema::IfcLocalPlacement>()) {
|
||||
if (auto local_place = place.template as<typename Schema::IfcLocalPlacement>()) {
|
||||
if (parent.ObjectPlacement()) {
|
||||
if (local_place != parent.ObjectPlacement()) {
|
||||
local_place.setPlacementRelTo(parent.ObjectPlacement());
|
||||
@@ -183,7 +190,7 @@ typename Schema::IfcSite IfcHierarchyHelper<Schema>::addSite(typename Schema::If
|
||||
proj = addProject(owner_hist);
|
||||
}
|
||||
|
||||
auto site = create<Schema::IfcSite>();
|
||||
auto site = create<typename Schema::IfcSite>();
|
||||
site.setGlobalId(IfcParse::IfcGlobalId());
|
||||
site.setOwnerHistory(owner_hist);
|
||||
site.setObjectPlacement(addLocalPlacement());
|
||||
@@ -208,7 +215,7 @@ typename Schema::IfcBuilding IfcHierarchyHelper<Schema>::addBuilding(typename Sc
|
||||
site = addSite(typename Schema::IfcProject{}, owner_hist);
|
||||
}
|
||||
|
||||
auto building = create<Schema::IfcBuilding>();
|
||||
auto building = create<typename Schema::IfcBuilding>();
|
||||
building.setGlobalId(IfcParse::IfcGlobalId());
|
||||
building.setOwnerHistory(owner_hist);
|
||||
building.setObjectPlacement(addLocalPlacement());
|
||||
@@ -236,7 +243,7 @@ typename Schema::IfcBuildingStorey IfcHierarchyHelper<Schema>::addBuildingStorey
|
||||
building = addBuilding(typename Schema::IfcSite{}, owner_hist);
|
||||
}
|
||||
|
||||
auto storey = create<Schema::IfcBuildingStorey>();
|
||||
auto storey = create<typename Schema::IfcBuildingStorey>();
|
||||
storey.setGlobalId(IfcParse::IfcGlobalId());
|
||||
storey.setOwnerHistory(owner_hist);
|
||||
storey.setObjectPlacement(addLocalPlacement());
|
||||
@@ -292,14 +299,14 @@ void IfcHierarchyHelper<Schema>::addExtrudedPolyline(typename Schema::IfcShapeRe
|
||||
cartesian_points.push_back(cartesian_points.front());
|
||||
}
|
||||
|
||||
auto line = create<Schema::IfcPolyline>();
|
||||
auto line = create<typename Schema::IfcPolyline>();
|
||||
line.setPoints(cartesian_points);
|
||||
|
||||
auto profile = create<Schema::IfcArbitraryClosedProfileDef>();
|
||||
auto profile = create<typename Schema::IfcArbitraryClosedProfileDef>();
|
||||
profile.setProfileType(Schema::IfcProfileTypeEnum::IfcProfileType_AREA);
|
||||
profile.setOuterCurve(line);
|
||||
|
||||
auto solid = create<Schema::IfcExtrudedAreaSolid>();
|
||||
auto solid = create<typename Schema::IfcExtrudedAreaSolid>();
|
||||
solid.setSweptArea(profile);
|
||||
solid.setPosition(place2 ? place2 : addPlacement3d());
|
||||
solid.setExtrudedDirection(dir ? dir : addTriplet<typename Schema::IfcDirection>(0, 0, 1));
|
||||
@@ -315,13 +322,13 @@ typename Schema::IfcProductDefinitionShape IfcHierarchyHelper<Schema>::addExtrud
|
||||
typename Schema::IfcAxis2Placement3D place2,
|
||||
typename Schema::IfcDirection dir,
|
||||
typename Schema::IfcRepresentationContext context) {
|
||||
auto rep = create<Schema::IfcShapeRepresentation>();
|
||||
auto rep = create<typename Schema::IfcShapeRepresentation>();
|
||||
rep.setContextOfItems(context ? context : getRepresentationContext("Model"));
|
||||
rep.setRepresentationIdentifier(std::string("Body"));
|
||||
rep.setRepresentationType(std::string("SweptSolid"));
|
||||
rep.setItems(std::vector<typename Schema::IfcRepresentationItem>{});
|
||||
|
||||
auto shape = create<Schema::IfcProductDefinitionShape>();
|
||||
auto shape = create<typename Schema::IfcProductDefinitionShape>();
|
||||
shape.setRepresentations(std::vector<typename Schema::IfcRepresentation>{rep});
|
||||
addExtrudedPolyline(rep, points, h, place, place2, dir, context);
|
||||
|
||||
@@ -355,9 +362,9 @@ void IfcHierarchyHelper<Schema>::addAxis(
|
||||
{
|
||||
auto p1 = addDoublet<typename Schema::IfcCartesianPoint>(-l / 2., 0.);
|
||||
auto p2 = addDoublet<typename Schema::IfcCartesianPoint>(+l / 2., 0.);
|
||||
std::vector<Schema::IfcCartesianPoint> pts{p1, p2};
|
||||
std::vector<typename Schema::IfcCartesianPoint> pts{p1, p2};
|
||||
|
||||
auto poly = create<Schema::IfcPolyline>();
|
||||
auto poly = create<typename Schema::IfcPolyline>();
|
||||
poly.setPoints(pts);
|
||||
|
||||
auto items = rep.Items();
|
||||
@@ -373,13 +380,13 @@ typename Schema::IfcProductDefinitionShape IfcHierarchyHelper<Schema>::addBox(do
|
||||
typename Schema::IfcAxis2Placement3D place2,
|
||||
typename Schema::IfcDirection dir,
|
||||
typename Schema::IfcRepresentationContext context) {
|
||||
typename Schema::IfcShapeRepresentation rep = create<Schema::IfcShapeRepresentation>();
|
||||
typename Schema::IfcShapeRepresentation rep = create<typename Schema::IfcShapeRepresentation>();
|
||||
rep.setContextOfItems(context ? context : getRepresentationContext("Model"));
|
||||
rep.setRepresentationIdentifier(std::string("Body"));
|
||||
rep.setRepresentationType(std::string("SweptSolid"));
|
||||
rep.setItems(std::vector<typename Schema::IfcRepresentationItem>{});
|
||||
|
||||
auto shape = create<Schema::IfcProductDefinitionShape>();
|
||||
auto shape = create<typename Schema::IfcProductDefinitionShape>();
|
||||
shape.setRepresentations(std::vector<typename Schema::IfcRepresentation>{rep});
|
||||
|
||||
addBox(rep, w, d, h, place, place2, dir, context);
|
||||
@@ -389,19 +396,19 @@ typename Schema::IfcProductDefinitionShape IfcHierarchyHelper<Schema>::addBox(do
|
||||
template <typename Schema>
|
||||
typename Schema::IfcProductDefinitionShape IfcHierarchyHelper<Schema>::addAxisBox(
|
||||
double w, double d, double h, typename Schema::IfcRepresentationContext context) {
|
||||
auto body_rep = create<Schema::IfcShapeRepresentation>();
|
||||
auto body_rep = create<typename Schema::IfcShapeRepresentation>();
|
||||
body_rep.setContextOfItems(context ? context : getRepresentationContext("Model"));
|
||||
body_rep.setRepresentationIdentifier(std::string("Body"));
|
||||
body_rep.setRepresentationType(std::string("SweptSolid"));
|
||||
body_rep.setItems(std::vector<typename Schema::IfcRepresentationItem>{});
|
||||
|
||||
auto axis_rep = create<Schema::IfcShapeRepresentation>();
|
||||
auto axis_rep = create<typename Schema::IfcShapeRepresentation>();
|
||||
axis_rep.setContextOfItems(context ? context : getRepresentationContext("Plan"));
|
||||
axis_rep.setRepresentationIdentifier(std::string("Axis"));
|
||||
axis_rep.setRepresentationType(std::string("Curve2D"));
|
||||
axis_rep.setItems(std::vector<typename Schema::IfcRepresentationItem>{});
|
||||
|
||||
auto shape = create<Schema::IfcProductDefinitionShape>();
|
||||
auto shape = create<typename Schema::IfcProductDefinitionShape>();
|
||||
shape.setRepresentations(std::vector<typename Schema::IfcRepresentation>{axis_rep, body_rep});
|
||||
|
||||
addBox(body_rep, w, d, h, typename Schema::IfcAxis2Placement2D{}, typename Schema::IfcAxis2Placement3D{}, typename Schema::IfcDirection{}, context);
|
||||
@@ -428,9 +435,9 @@ void IfcHierarchyHelper<Schema>::clipRepresentation(typename Schema::IfcRepresen
|
||||
return;
|
||||
}
|
||||
|
||||
auto plane = create<Schema::IfcPlane>();
|
||||
auto plane = create<typename Schema::IfcPlane>();
|
||||
plane.setPosition(place);
|
||||
auto half_space = create<Schema::IfcHalfSpaceSolid>();
|
||||
auto half_space = create<typename Schema::IfcHalfSpaceSolid>();
|
||||
half_space.setBaseSurface(plane);
|
||||
half_space.setAgreementFlag(agree);
|
||||
|
||||
@@ -438,8 +445,8 @@ void IfcHierarchyHelper<Schema>::clipRepresentation(typename Schema::IfcRepresen
|
||||
auto items = rep.Items();
|
||||
decltype(items) new_items;
|
||||
for (auto& item : items) {
|
||||
if (auto bop = item.as<typename Schema::IfcBooleanOperand>()) {
|
||||
auto clip = create<Schema::IfcBooleanClippingResult>();
|
||||
if (auto bop = item.template as<typename Schema::IfcBooleanOperand>()) {
|
||||
auto clip = create<typename Schema::IfcBooleanClippingResult>();
|
||||
clip.setOperator(Schema::IfcBooleanOperator::IfcBooleanOperator_DIFFERENCE);
|
||||
clip.setFirstOperand(bop);
|
||||
clip.setSecondOperand(half_space);
|
||||
@@ -451,19 +458,19 @@ void IfcHierarchyHelper<Schema>::clipRepresentation(typename Schema::IfcRepresen
|
||||
|
||||
template <typename Schema>
|
||||
typename Schema::IfcSurfaceStyle getSurfaceStyle(IfcHierarchyHelper<Schema>& file, double r, double g, double b, double a = 1.0) {
|
||||
auto colour = file.create<typename Schema::IfcColourRgb>();
|
||||
auto colour = file.template create<typename Schema::IfcColourRgb>();
|
||||
colour.setRed(r);
|
||||
colour.setGreen(g);
|
||||
colour.setBlue(b);
|
||||
|
||||
auto rendering = file.create<typename Schema::IfcSurfaceStyleRendering>();
|
||||
auto rendering = file.template create<typename Schema::IfcSurfaceStyleRendering>();
|
||||
rendering.setSurfaceColour(colour);
|
||||
if (a != 1.0) {
|
||||
rendering.setTransparency(1.0 - a);
|
||||
}
|
||||
rendering.setReflectanceMethod(Schema::IfcReflectanceMethodEnum::IfcReflectanceMethod_FLAT);
|
||||
|
||||
auto surface_style = file.create<typename Schema::IfcSurfaceStyle>();
|
||||
auto surface_style = file.template create<typename Schema::IfcSurfaceStyle>();
|
||||
surface_style.setSide(Schema::IfcSurfaceSide::IfcSurfaceSide_BOTH);
|
||||
surface_style.setStyles(std::vector<typename Schema::IfcSurfaceStyleElementSelect>{rendering});
|
||||
|
||||
@@ -473,7 +480,7 @@ typename Schema::IfcSurfaceStyle getSurfaceStyle(IfcHierarchyHelper<Schema>& fil
|
||||
template <typename Schema>
|
||||
typename Schema::IfcPresentationStyleAssignment addStyleAssignment_2x3(IfcHierarchyHelper<Schema>& file, double r, double g, double b, double a = 1.0) {
|
||||
auto surface_style = getSurfaceStyle<Schema>(file, r, g, b, a);
|
||||
auto style_assignment = file.create<typename Schema::IfcPresentationStyleAssignment>();
|
||||
auto style_assignment = file.template create<typename Schema::IfcPresentationStyleAssignment>();
|
||||
style_assignment.setStyles(std::vector<typename Schema::IfcPresentationStyleSelect>{surface_style});
|
||||
return style_assignment;
|
||||
}
|
||||
@@ -513,7 +520,7 @@ typename Schema::IfcPresentationStyle setSurfaceColour_4x3(IfcHierarchyHelper<Sc
|
||||
|
||||
template <typename Schema>
|
||||
void setSurfaceColour_2x3(IfcHierarchyHelper<Schema>& file, typename Schema::IfcProductRepresentation shape, typename Schema::IfcPresentationStyleAssignment style_assignment) {
|
||||
auto reps = shape->Representations();
|
||||
auto reps = shape.Representations();
|
||||
for (auto& rep : reps) {
|
||||
setSurfaceColour_2x3(file, rep, style_assignment);
|
||||
}
|
||||
@@ -927,7 +934,7 @@ typename Schema::IfcProductDefinitionShape IfcHierarchyHelper<Schema>::addMapped
|
||||
if (maps.size() == 1) {
|
||||
map = maps.front();
|
||||
} else {
|
||||
map = create<Schema::IfcRepresentationMap>();
|
||||
map = create<typename Schema::IfcRepresentationMap>();
|
||||
map.setMappingOrigin(addPlacement3d());
|
||||
map.setMappedRepresentation(rep);
|
||||
}
|
||||
@@ -938,14 +945,14 @@ typename Schema::IfcProductDefinitionShape IfcHierarchyHelper<Schema>::addMapped
|
||||
}
|
||||
|
||||
if (!transform) {
|
||||
transform = create<Schema::IfcCartesianTransformationOperator3D>();
|
||||
transform = create<typename Schema::IfcCartesianTransformationOperator3D>();
|
||||
transform.setLocalOrigin(addTriplet<typename Schema::IfcCartesianPoint>(0, 0, 0));
|
||||
}
|
||||
auto item = create<Schema::IfcMappedItem>();
|
||||
auto item = create<typename Schema::IfcMappedItem>();
|
||||
item.setMappingSource(map);
|
||||
item.setMappingTarget(transform);
|
||||
|
||||
auto new_rep = create<Schema::IfcShapeRepresentation>();
|
||||
auto new_rep = create<typename Schema::IfcShapeRepresentation>();
|
||||
new_rep.setContextOfItems(rep.ContextOfItems());
|
||||
new_rep.setRepresentationType(std::string("MappedRepresentation"));
|
||||
new_rep.setItems(std::vector<typename Schema::IfcRepresentationItem>{item});
|
||||
@@ -957,7 +964,7 @@ typename Schema::IfcProductDefinitionShape IfcHierarchyHelper<Schema>::addMapped
|
||||
representations.push_back(new_rep);
|
||||
|
||||
if (!def) {
|
||||
def = create<Schema::IfcProductDefinitionShape>();
|
||||
def = create<typename Schema::IfcProductDefinitionShape>();
|
||||
def.setRepresentations(representations);
|
||||
} else {
|
||||
def.setRepresentations(representations);
|
||||
@@ -980,11 +987,11 @@ typename Schema::IfcProductDefinitionShape IfcHierarchyHelper<Schema>::addMapped
|
||||
|
||||
template <typename Schema>
|
||||
typename Schema::IfcShapeRepresentation IfcHierarchyHelper<Schema>::addEmptyRepresentation(const std::string& repid, const std::string& reptype) {
|
||||
auto shape_rep = create<Schema::IfcShapeRepresentation>();
|
||||
auto shape_rep = create<typename Schema::IfcShapeRepresentation>();
|
||||
shape_rep.setContextOfItems(getRepresentationContext(reptype == "Curve2D" ? "Plan" : "Model"));
|
||||
shape_rep.setRepresentationIdentifier(repid);
|
||||
shape_rep.setRepresentationType(reptype);
|
||||
shape_rep.setItems(std::vector<Schema::IfcRepresentationItem>{});
|
||||
shape_rep.setItems(std::vector<typename Schema::IfcRepresentationItem>{});
|
||||
addEntity(shape_rep);
|
||||
return shape_rep;
|
||||
}
|
||||
@@ -1017,7 +1024,7 @@ typename Schema::IfcGeometricRepresentationContext IfcHierarchyHelper<Schema>::g
|
||||
project = addProject();
|
||||
}
|
||||
auto project_contexts = project.RepresentationContexts();
|
||||
auto context = create<Schema::IfcGeometricRepresentationContext>();
|
||||
auto context = create<typename Schema::IfcGeometricRepresentationContext>();
|
||||
context.setContextIdentifier(s);
|
||||
context.setCoordinateSpaceDimension(3);
|
||||
context.setPrecision(1.e-5);
|
||||
@@ -1046,7 +1053,7 @@ typename Schema::IfcGeometricRepresentationSubContext IfcHierarchyHelper<Schema>
|
||||
|
||||
if (!rep_subcontext) {
|
||||
// didn't find the subcontext, create it
|
||||
rep_subcontext = create<Schema::IfcGeometricRepresentationSubContext>();
|
||||
rep_subcontext = create<typename Schema::IfcGeometricRepresentationSubContext>();
|
||||
rep_subcontext.setContextIdentifier(ident);
|
||||
rep_subcontext.setContextType(type);
|
||||
rep_subcontext.setParentContext(geometric_representation_context);
|
||||
|
||||
@@ -426,7 +426,7 @@ class IFC_PARSE_API IfcHierarchyHelper : public IfcParse::IfcFile {
|
||||
if (!owner_hist) {
|
||||
owner_hist = addOwnerHistory();
|
||||
}
|
||||
std::vector<Schema::IfcObject> related_objects = {related_object.template as<typename Schema::IfcObject>()};
|
||||
std::vector<typename Schema::IfcObject> related_objects = {related_object.template as<typename Schema::IfcObject>()};
|
||||
auto t = create<Schema::IfcRelDefinesByType>();
|
||||
t.setGlobalId(IfcParse::IfcGlobalId());
|
||||
t.setOwnerHistory(owner_hist);
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
#include <iostream>
|
||||
#include <mutex>
|
||||
|
||||
static my_thread_local express::Base current_product_;
|
||||
static thread_local express::Base current_product_;
|
||||
|
||||
namespace {
|
||||
|
||||
|
||||
@@ -2447,14 +2447,14 @@ std::vector<express::Entity> IfcFile::getInverse(int instance_id, const IfcParse
|
||||
|
||||
for (auto it = lower; it != upper; ++it) {
|
||||
for (auto& i : it->second) {
|
||||
return_value.push_back(instance_by_id(i).as<express::Entity>());
|
||||
return_value.push_back(instance_by_id(i).template as<express::Entity>());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
auto it = x.byref_excl_.find({ instance_id, ent->index_in_schema(), attribute_index });
|
||||
if (it != x.byref_excl_.end()) {
|
||||
for (auto& i : it->second) {
|
||||
return_value.push_back(instance_by_id(i).as<express::Entity>());
|
||||
return_value.push_back(instance_by_id(i).template as<express::Entity>());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ class IFC_PARSE_API IfcSpfLexer {
|
||||
|
||||
public:
|
||||
std::string& GetTempString() const {
|
||||
static my_thread_local std::string string;
|
||||
static thread_local std::string string;
|
||||
return string;
|
||||
}
|
||||
FileReader* stream;
|
||||
|
||||
@@ -141,7 +141,7 @@ class IFC_PARSE_API declaration {
|
||||
mutable const schema_definition* schema_;
|
||||
|
||||
std::string& temp_string_() const {
|
||||
static my_thread_local std::string string;
|
||||
static thread_local std::string string;
|
||||
return string;
|
||||
}
|
||||
|
||||
@@ -457,7 +457,7 @@ class IFC_PARSE_API schema_definition {
|
||||
};
|
||||
|
||||
std::string& temp_string_() const {
|
||||
static my_thread_local std::string string;
|
||||
static thread_local std::string string;
|
||||
return string;
|
||||
}
|
||||
|
||||
|
||||
@@ -113,7 +113,7 @@ class IFC_PARSE_API Base {
|
||||
return T{};
|
||||
}
|
||||
} else if constexpr (std::is_same_v<Select, T>) {
|
||||
static_assert(false, "Select is abstract");
|
||||
static_assert(std::is_same_v<Select, T>, "Select is abstract");
|
||||
} else {
|
||||
if (declaration().is(T::Class())) {
|
||||
return T(data_weak());
|
||||
@@ -189,14 +189,14 @@ template <typename T, typename U>
|
||||
std::vector<T> cast_vector(const std::vector<U>& vs) {
|
||||
std::vector<T> result;
|
||||
for (const auto& v : vs) {
|
||||
if constexpr (std::is_base_of_v<T, U> || std::is_same_v<T, U>) {
|
||||
if constexpr (std::is_base_of_v<T, U>) {
|
||||
// For a base or identity transform we can just rely on static cast
|
||||
result.push_back(v);
|
||||
} else if constexpr (std::is_base_of_v<express::Select, U> && std::is_same_v<T, express::Base>) {
|
||||
// From a select to concrete we simply call the appropriate method
|
||||
result.push_back(v.concrete());
|
||||
} else {
|
||||
if (auto u = v.as<T>()) {
|
||||
if (auto u = v.template as<T>()) {
|
||||
result.push_back(u);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,17 +34,4 @@
|
||||
#define IFC_PARSE_API
|
||||
#endif
|
||||
|
||||
#if defined(__clang__)
|
||||
#define my_thread_local thread_local
|
||||
#elif defined(__GNUC__)
|
||||
#define my_thread_local __thread
|
||||
#elif __STDC_VERSION__ >= 201112L
|
||||
#define my_thread_local _Thread_local
|
||||
#elif defined(_MSC_VER)
|
||||
#define my_thread_local __declspec(thread)
|
||||
#elif defined(SWIG)
|
||||
#else
|
||||
#error Cannot define thread_local
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user