mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 01:41:57 +00:00
#2805 Apply changes to v0.8 geometry mapping as well
This commit is contained in:
@@ -47,9 +47,9 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcIndexedPolyCurve* inst) {
|
||||
auto loop = taxonomy::make<taxonomy::loop>();
|
||||
|
||||
if(inst->Segments()) {
|
||||
aggregate_of_instance::ptr segments = *inst->Segments();
|
||||
for (aggregate_of_instance::it it = segments->begin(); it != segments->end(); ++it) {
|
||||
IfcUtil::IfcBaseClass* segment = *it;
|
||||
auto segments = *inst->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;
|
||||
|
||||
@@ -34,8 +34,8 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcTrimmedCurve* inst) {
|
||||
tc->basis = map(inst->BasisCurve());
|
||||
|
||||
bool trim_cartesian = inst->MasterRepresentation() != IfcSchema::IfcTrimmingPreference::IfcTrimmingPreference_PARAMETER;
|
||||
aggregate_of_instance::ptr trims1 = inst->Trim1();
|
||||
aggregate_of_instance::ptr trims2 = inst->Trim2();
|
||||
auto trims1 = inst->Trim1();
|
||||
auto trims2 = inst->Trim2();
|
||||
|
||||
// reversed orientation handling happens in geometry kernel
|
||||
unsigned sense_agreement = 0;
|
||||
@@ -46,8 +46,8 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcTrimmedCurve* inst) {
|
||||
|
||||
tc->orientation = inst->SenseAgreement();
|
||||
|
||||
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()) ) {
|
||||
pnts[sense_agreement] = taxonomy::cast<taxonomy::point3>(map(i));
|
||||
has_pnts[sense_agreement] = true;
|
||||
@@ -58,8 +58,8 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcTrimmedCurve* inst) {
|
||||
}
|
||||
}
|
||||
|
||||
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()) ) {
|
||||
pnts[1 - sense_agreement] = taxonomy::cast<taxonomy::point3>(map(i));
|
||||
has_pnts[1-sense_agreement] = true;
|
||||
|
||||
@@ -318,8 +318,8 @@ namespace {
|
||||
template <typename T>
|
||||
std::pair<IfcSchema::IfcSurfaceStyle*, T*> get_surface_style(const IfcSchema::IfcStyledItem* si) {
|
||||
#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) {
|
||||
if (!(*kt)->declaration().is(IfcSchema::IfcPresentationStyleAssignment::Class())) {
|
||||
continue;
|
||||
}
|
||||
@@ -338,12 +338,12 @@ namespace {
|
||||
auto styles = si->Styles();
|
||||
#endif
|
||||
for (auto lt = styles->begin(); lt != styles->end(); ++lt) {
|
||||
IfcUtil::IfcBaseClass* style = *lt;
|
||||
auto style = *lt;
|
||||
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);
|
||||
}
|
||||
@@ -596,12 +596,12 @@ void mapping::initialize_units_() {
|
||||
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 ||
|
||||
|
||||
@@ -746,8 +746,8 @@ void POSTFIX_SCHEMA(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(mapping_, named_unit, units);
|
||||
|
||||
Reference in New Issue
Block a user