mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-10 06:00:51 +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>();
|
auto loop = taxonomy::make<taxonomy::loop>();
|
||||||
|
|
||||||
if(inst->Segments()) {
|
if(inst->Segments()) {
|
||||||
aggregate_of_instance::ptr segments = *inst->Segments();
|
auto segments = *inst->Segments();
|
||||||
for (aggregate_of_instance::it it = segments->begin(); it != segments->end(); ++it) {
|
for (auto it = segments->begin(); it != segments->end(); ++it) {
|
||||||
IfcUtil::IfcBaseClass* segment = *it;
|
auto segment = *it;
|
||||||
if (segment->declaration().is(IfcSchema::IfcLineIndex::Class())) {
|
if (segment->declaration().is(IfcSchema::IfcLineIndex::Class())) {
|
||||||
IfcSchema::IfcLineIndex* line = (IfcSchema::IfcLineIndex*) segment;
|
IfcSchema::IfcLineIndex* line = (IfcSchema::IfcLineIndex*) segment;
|
||||||
std::vector<int> indices = *line;
|
std::vector<int> indices = *line;
|
||||||
|
|||||||
@@ -34,8 +34,8 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcTrimmedCurve* inst) {
|
|||||||
tc->basis = map(inst->BasisCurve());
|
tc->basis = map(inst->BasisCurve());
|
||||||
|
|
||||||
bool trim_cartesian = inst->MasterRepresentation() != IfcSchema::IfcTrimmingPreference::IfcTrimmingPreference_PARAMETER;
|
bool trim_cartesian = inst->MasterRepresentation() != IfcSchema::IfcTrimmingPreference::IfcTrimmingPreference_PARAMETER;
|
||||||
aggregate_of_instance::ptr trims1 = inst->Trim1();
|
auto trims1 = inst->Trim1();
|
||||||
aggregate_of_instance::ptr trims2 = inst->Trim2();
|
auto trims2 = inst->Trim2();
|
||||||
|
|
||||||
// reversed orientation handling happens in geometry kernel
|
// reversed orientation handling happens in geometry kernel
|
||||||
unsigned sense_agreement = 0;
|
unsigned sense_agreement = 0;
|
||||||
@@ -46,8 +46,8 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcTrimmedCurve* inst) {
|
|||||||
|
|
||||||
tc->orientation = inst->SenseAgreement();
|
tc->orientation = inst->SenseAgreement();
|
||||||
|
|
||||||
for ( aggregate_of_instance::it it = trims1->begin(); it != trims1->end(); it ++ ) {
|
for (auto it = trims1->begin(); it != trims1->end(); it ++) {
|
||||||
IfcUtil::IfcBaseClass* i = *it;
|
auto i = *it;
|
||||||
if ( i->declaration().is(IfcSchema::IfcCartesianPoint::Class()) ) {
|
if ( i->declaration().is(IfcSchema::IfcCartesianPoint::Class()) ) {
|
||||||
pnts[sense_agreement] = taxonomy::cast<taxonomy::point3>(map(i));
|
pnts[sense_agreement] = taxonomy::cast<taxonomy::point3>(map(i));
|
||||||
has_pnts[sense_agreement] = true;
|
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 ++ ) {
|
for (auto it = trims2->begin(); it != trims2->end(); it ++) {
|
||||||
IfcUtil::IfcBaseClass* i = *it;
|
auto i = *it;
|
||||||
if ( i->declaration().is(IfcSchema::IfcCartesianPoint::Class()) ) {
|
if ( i->declaration().is(IfcSchema::IfcCartesianPoint::Class()) ) {
|
||||||
pnts[1 - sense_agreement] = taxonomy::cast<taxonomy::point3>(map(i));
|
pnts[1 - sense_agreement] = taxonomy::cast<taxonomy::point3>(map(i));
|
||||||
has_pnts[1-sense_agreement] = true;
|
has_pnts[1-sense_agreement] = true;
|
||||||
|
|||||||
@@ -318,8 +318,8 @@ namespace {
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
std::pair<IfcSchema::IfcSurfaceStyle*, T*> get_surface_style(const IfcSchema::IfcStyledItem* si) {
|
std::pair<IfcSchema::IfcSurfaceStyle*, T*> get_surface_style(const IfcSchema::IfcStyledItem* si) {
|
||||||
#ifdef SCHEMA_HAS_IfcStyleAssignmentSelect
|
#ifdef SCHEMA_HAS_IfcStyleAssignmentSelect
|
||||||
aggregate_of_instance::ptr style_assignments = si->Styles();
|
auto style_assignments = si->Styles();
|
||||||
for (aggregate_of_instance::it kt = style_assignments->begin(); kt != style_assignments->end(); ++kt) {
|
for (auto kt = style_assignments->begin(); kt != style_assignments->end(); ++kt) {
|
||||||
if (!(*kt)->declaration().is(IfcSchema::IfcPresentationStyleAssignment::Class())) {
|
if (!(*kt)->declaration().is(IfcSchema::IfcPresentationStyleAssignment::Class())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -338,12 +338,12 @@ namespace {
|
|||||||
auto styles = si->Styles();
|
auto styles = si->Styles();
|
||||||
#endif
|
#endif
|
||||||
for (auto lt = styles->begin(); lt != styles->end(); ++lt) {
|
for (auto lt = styles->begin(); lt != styles->end(); ++lt) {
|
||||||
IfcUtil::IfcBaseClass* style = *lt;
|
auto style = *lt;
|
||||||
if (style->declaration().is(IfcSchema::IfcSurfaceStyle::Class())) {
|
if (style->declaration().is(IfcSchema::IfcSurfaceStyle::Class())) {
|
||||||
IfcSchema::IfcSurfaceStyle* surface_style = (IfcSchema::IfcSurfaceStyle*) style;
|
IfcSchema::IfcSurfaceStyle* surface_style = (IfcSchema::IfcSurfaceStyle*) style;
|
||||||
if (surface_style->Side() != IfcSchema::IfcSurfaceSide::IfcSurfaceSide_NEGATIVE) {
|
if (surface_style->Side() != IfcSchema::IfcSurfaceSide::IfcSurfaceSide_NEGATIVE) {
|
||||||
aggregate_of_instance::ptr styles_elements = surface_style->Styles();
|
auto styles_elements = surface_style->Styles();
|
||||||
for (aggregate_of_instance::it mt = styles_elements->begin(); mt != styles_elements->end(); ++mt) {
|
for (auto mt = styles_elements->begin(); mt != styles_elements->end(); ++mt) {
|
||||||
if ((*mt)->declaration().is(T::Class())) {
|
if ((*mt)->declaration().is(T::Class())) {
|
||||||
return std::make_pair(surface_style, (T*)*mt);
|
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;
|
bool length_unit_encountered = false, angle_unit_encountered = false;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
aggregate_of_instance::ptr units = unit_assignment->Units();
|
auto units = unit_assignment->Units();
|
||||||
if (!units || !units->size()) {
|
if (!units || !units->size()) {
|
||||||
Logger::Warning("No unit information found");
|
Logger::Warning("No unit information found");
|
||||||
} else {
|
} else {
|
||||||
for (aggregate_of_instance::it it = units->begin(); it != units->end(); ++it) {
|
for (auto it = units->begin(); it != units->end(); ++it) {
|
||||||
IfcUtil::IfcBaseClass* base = *it;
|
IfcSchema::IfcUnit* base = *it;
|
||||||
if (base->declaration().is(IfcSchema::IfcNamedUnit::Class())) {
|
if (base->declaration().is(IfcSchema::IfcNamedUnit::Class())) {
|
||||||
IfcSchema::IfcNamedUnit* named_unit = base->as<IfcSchema::IfcNamedUnit>();
|
IfcSchema::IfcNamedUnit* named_unit = base->as<IfcSchema::IfcNamedUnit>();
|
||||||
if (named_unit->UnitType() == IfcSchema::IfcUnitEnum::IfcUnit_LENGTHUNIT ||
|
if (named_unit->UnitType() == IfcSchema::IfcUnitEnum::IfcUnit_LENGTHUNIT ||
|
||||||
|
|||||||
@@ -746,8 +746,8 @@ void POSTFIX_SCHEMA(XmlSerializer)::finalize() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Write all assigned units as XML nodes.
|
// Write all assigned units as XML nodes.
|
||||||
aggregate_of_instance::ptr unit_assignments = project->UnitsInContext()->Units();
|
auto unit_assignments = project->UnitsInContext()->Units();
|
||||||
for (aggregate_of_instance::it it = unit_assignments->begin(); it != unit_assignments->end(); ++it) {
|
for (auto it = unit_assignments->begin(); it != unit_assignments->end(); ++it) {
|
||||||
if ((*it)->declaration().is(IfcSchema::IfcNamedUnit::Class())) {
|
if ((*it)->declaration().is(IfcSchema::IfcNamedUnit::Class())) {
|
||||||
IfcSchema::IfcNamedUnit* named_unit = (*it)->as<IfcSchema::IfcNamedUnit>();
|
IfcSchema::IfcNamedUnit* named_unit = (*it)->as<IfcSchema::IfcNamedUnit>();
|
||||||
ptree* node = format_entity_instance(mapping_, named_unit, units);
|
ptree* node = format_entity_instance(mapping_, named_unit, units);
|
||||||
|
|||||||
Reference in New Issue
Block a user