#2805 IfcGeom updates

This commit is contained in:
Thomas Krijnen
2023-06-22 12:07:10 +02:00
parent 0bb9bcd9fb
commit e9d0b8ab66
8 changed files with 28 additions and 28 deletions
+3 -3
View File
@@ -985,12 +985,12 @@ std::pair<std::string, double> IfcGeom::Kernel::initializeUnits(IfcSchema::IfcUn
bool length_unit_encountered = false, angle_unit_encountered = false;
try {
aggregate_of_instance::ptr units = unit_assignment->Units();
auto units = unit_assignment->Units();
if (!units || !units->size()) {
Logger::Warning("No unit information found");
} else {
for (aggregate_of_instance::it it = units->begin(); it != units->end(); ++it) {
IfcUtil::IfcBaseClass* base = *it;
for (auto it = units->begin(); it != units->end(); ++it) {
IfcSchema::IfcUnit* base = *it;
if (base->declaration().is(IfcSchema::IfcNamedUnit::Class())) {
IfcSchema::IfcNamedUnit* named_unit = base->as<IfcSchema::IfcNamedUnit>();
if (named_unit->UnitType() == IfcSchema::IfcUnitEnum::IfcUnit_LENGTHUNIT ||
+4 -4
View File
@@ -299,8 +299,8 @@ public:
std::vector<IfcSchema::IfcPresentationStyle*> prs_styles;
#ifdef SCHEMA_HAS_IfcStyleAssignmentSelect
aggregate_of_instance::ptr style_assignments = si->Styles();
for (aggregate_of_instance::it kt = style_assignments->begin(); kt != style_assignments->end(); ++kt) {
auto style_assignments = si->Styles();
for (auto kt = style_assignments->begin(); kt != style_assignments->end(); ++kt) {
// Using IfcPresentationStyleAssignment is deprecated, use the direct assignment of a subtype of IfcPresentationStyle instead.
auto style_k = (*kt)->as<IfcSchema::IfcPresentationStyle>();
@@ -345,8 +345,8 @@ public:
if (style->declaration().is(IfcSchema::IfcSurfaceStyle::Class())) {
IfcSchema::IfcSurfaceStyle* surface_style = (IfcSchema::IfcSurfaceStyle*) style;
if (surface_style->Side() != IfcSchema::IfcSurfaceSide::IfcSurfaceSide_NEGATIVE) {
aggregate_of_instance::ptr styles_elements = surface_style->Styles();
for (aggregate_of_instance::it mt = styles_elements->begin(); mt != styles_elements->end(); ++mt) {
auto styles_elements = surface_style->Styles();
for (auto mt = styles_elements->begin(); mt != styles_elements->end(); ++mt) {
if ((*mt)->declaration().is(T::Class())) {
return std::make_pair(surface_style, (T*) *mt);
}
+3 -3
View File
@@ -30,11 +30,11 @@ bool IfcGeom::Kernel::convert(const IfcSchema::IfcGeometricSet* l, IfcRepresenta
const bool include_curves = getValue(GV_DIMENSIONALITY) != +1;
const bool include_solids_and_surfaces = getValue(GV_DIMENSIONALITY) != -1;
aggregate_of_instance::ptr elements = l->Elements();
if ( !elements->size() ) return false;
auto elements = l->Elements();
if (!elements->size()) return false;
bool part_succes = false;
auto parent_style = get_style(l);
for (aggregate_of_instance::it it = elements->begin(); it != elements->end(); ++it) {
for (auto it = elements->begin(); it != elements->end(); ++it) {
auto element = *it;
TopoDS_Shape s;
if (shape_type(element) == ST_SHAPELIST) {
+3 -3
View File
@@ -58,9 +58,9 @@ bool IfcGeom::Kernel::convert(const IfcSchema::IfcIndexedPolyCurve* l, TopoDS_Wi
double u, v;
if(l->Segments()) {
aggregate_of_instance::ptr segments = *l->Segments();
for (aggregate_of_instance::it it = segments->begin(); it != segments->end(); ++it) {
IfcUtil::IfcBaseClass* segment = *it;
auto segments = *l->Segments();
for (auto it = segments->begin(); it != segments->end(); ++it) {
auto segment = *it;
if (segment->declaration().is(IfcSchema::IfcLineIndex::Class())) {
IfcSchema::IfcLineIndex* line = (IfcSchema::IfcLineIndex*) segment;
std::vector<int> indices = *line;
+2 -2
View File
@@ -23,9 +23,9 @@
#define Kernel MAKE_TYPE_NAME(Kernel)
bool IfcGeom::Kernel::convert(const IfcSchema::IfcShellBasedSurfaceModel* l, IfcRepresentationShapeItems& shapes) {
aggregate_of_instance::ptr shells = l->SbsmBoundary();
auto shells = l->SbsmBoundary();
auto collective_style = get_style(l);
for( aggregate_of_instance::it it = shells->begin(); it != shells->end(); ++ it ) {
for(auto it = shells->begin(); it != shells->end(); ++ it) {
TopoDS_Shape s;
decltype(collective_style) shell_style;
if ((*it)->declaration().is(IfcSchema::IfcRepresentationItem::Class())) {
+6 -6
View File
@@ -72,8 +72,8 @@ bool IfcGeom::Kernel::convert(const IfcSchema::IfcTrimmedCurve* l, TopoDS_Wire&
}
bool trim_cartesian = l->MasterRepresentation() != IfcSchema::IfcTrimmingPreference::IfcTrimmingPreference_PARAMETER;
aggregate_of_instance::ptr trims1 = l->Trim1();
aggregate_of_instance::ptr trims2 = l->Trim2();
auto trims1 = l->Trim1();
auto trims2 = l->Trim2();
unsigned sense_agreement = l->SenseAgreement() ? 0 : 1;
double flts[2];
@@ -83,8 +83,8 @@ bool IfcGeom::Kernel::convert(const IfcSchema::IfcTrimmedCurve* l, TopoDS_Wire&
TopoDS_Edge e;
for ( aggregate_of_instance::it it = trims1->begin(); it != trims1->end(); it ++ ) {
IfcUtil::IfcBaseClass* i = *it;
for (auto it = trims1->begin(); it != trims1->end(); it ++ ) {
auto i = *it;
if ( i->declaration().is(IfcSchema::IfcCartesianPoint::Class()) ) {
IfcGeom::Kernel::convert((IfcSchema::IfcCartesianPoint*)i, pnts[sense_agreement] );
has_pnts[sense_agreement] = true;
@@ -95,8 +95,8 @@ bool IfcGeom::Kernel::convert(const IfcSchema::IfcTrimmedCurve* l, TopoDS_Wire&
}
}
for ( aggregate_of_instance::it it = trims2->begin(); it != trims2->end(); it ++ ) {
IfcUtil::IfcBaseClass* i = *it;
for (auto it = trims2->begin(); it != trims2->end(); it ++ ) {
auto i = *it;
if ( i->declaration().is(IfcSchema::IfcCartesianPoint::Class()) ) {
IfcGeom::Kernel::convert((IfcSchema::IfcCartesianPoint*)i, pnts[1-sense_agreement] );
has_pnts[1-sense_agreement] = true;
+5 -5
View File
@@ -395,8 +395,8 @@ int convert_to_ifc(const TopoDS_Edge& e, IfcSchema::IfcCurve*& c, bool advanced)
return 0;
}
aggregate_of_instance::ptr trim1(new aggregate_of_instance);
aggregate_of_instance::ptr trim2(new aggregate_of_instance);
IfcSchema::IfcTrimmingSelect::list::ptr trim1(new IfcSchema::IfcTrimmingSelect::list);
IfcSchema::IfcTrimmingSelect::list::ptr trim2(new IfcSchema::IfcTrimmingSelect::list);
trim1->push(new IfcSchema::IfcParameterValue(a));
trim2->push(new IfcSchema::IfcParameterValue(b));
@@ -631,7 +631,7 @@ IfcUtil::IfcBaseClass* IfcGeom::MAKE_TYPE_NAME(serialise_)(const TopoDS_Shape& s
} else {
// If not, see if there is a shell
IfcSchema::IfcOpenShell::list::ptr shells(new IfcSchema::IfcOpenShell::list);
IfcSchema::IfcShell::list::ptr shells(new IfcSchema::IfcShell::list);
for (TopExp_Explorer exp(shape, TopAbs_SHELL); exp.More(); exp.Next()) {
IfcSchema::IfcOpenShell* shell;
if (!convert_to_ifc(exp.Current(), shell, advanced)) {
@@ -641,7 +641,7 @@ IfcUtil::IfcBaseClass* IfcGeom::MAKE_TYPE_NAME(serialise_)(const TopoDS_Shape& s
}
if (shells->size() > 0) {
items->push(new IfcSchema::IfcShellBasedSurfaceModel(shells->generalize()));
items->push(new IfcSchema::IfcShellBasedSurfaceModel(shells));
rep = new IfcSchema::IfcShapeRepresentation(0, std::string("Body"), advanced ? std::string("AdvancedBrep") : std::string("Brep"), items);
} else {
@@ -674,7 +674,7 @@ IfcUtil::IfcBaseClass* IfcGeom::MAKE_TYPE_NAME(serialise_)(const TopoDS_Shape& s
rep = new IfcSchema::IfcShapeRepresentation(0, std::string("Axis"), std::string("Curve2D"), edges->as<IfcSchema::IfcRepresentationItem>());
} else {
// A geometric set is created as that probably (?) makes more sense in IFC
IfcSchema::IfcGeometricCurveSet* curves = new IfcSchema::IfcGeometricCurveSet(edges);
IfcSchema::IfcGeometricCurveSet* curves = new IfcSchema::IfcGeometricCurveSet(edges->as<IfcSchema::IfcGeometricSetSelect>());
items->push(curves);
rep = new IfcSchema::IfcShapeRepresentation(0, std::string("Axis"), std::string("GeometricCurveSet"), items->as<IfcSchema::IfcRepresentationItem>());
}
@@ -747,8 +747,8 @@ void MAKE_TYPE_NAME(XmlSerializer)::finalize() {
}
// Write all assigned units as XML nodes.
aggregate_of_instance::ptr unit_assignments = project->UnitsInContext()->Units();
for (aggregate_of_instance::it it = unit_assignments->begin(); it != unit_assignments->end(); ++it) {
auto unit_assignments = project->UnitsInContext()->Units();
for (auto it = unit_assignments->begin(); it != unit_assignments->end(); ++it) {
if ((*it)->declaration().is(IfcSchema::IfcNamedUnit::Class())) {
IfcSchema::IfcNamedUnit* named_unit = (*it)->as<IfcSchema::IfcNamedUnit>();
ptree* node = format_entity_instance(named_unit, units);