Skip to content

Commit 58a5f88

Browse files
committed
Retrieve length unit info from underlying mapping in iterator #6355
1 parent 4d5a3ec commit 58a5f88

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

src/ifcgeom/Iterator.h

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,6 @@ namespace IfcGeom {
150150
int done;
151151
int total;
152152

153-
// @todo these appear uninitialized?
154-
std::string unit_name_;
155-
double unit_magnitude_;
156-
157153
ifcopenshell::geometry::taxonomy::point3 bounds_min_;
158154
ifcopenshell::geometry::taxonomy::point3 bounds_max_;
159155

@@ -166,8 +162,8 @@ namespace IfcGeom {
166162
public:
167163
void set_cache(GeometrySerializer* cache) { cache_ = cache; }
168164

169-
const std::string& unit_name() const { return unit_name_; }
170-
double unit_magnitude() const { return unit_magnitude_; }
165+
const std::string& unit_name() const { return converter_->mapping()->get_length_unit_name(); }
166+
double unit_magnitude() const { return converter_->mapping()->get_length_unit(); }
171167
// Check if error occurred during iterator initialization or iteration over elements.
172168
bool had_error_processing_elements() const { return had_error_processing_elements_; }
173169

@@ -903,6 +899,8 @@ namespace IfcGeom {
903899
for (auto& p : all_processed_elements_) {
904900
delete p;
905901
}
902+
903+
delete converter_;
906904
}
907905
};
908906
}

src/ifcgeom/abstract_mapping.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ namespace geometry {
4545
virtual const IfcUtil::IfcBaseEntity* get_product_type(const IfcUtil::IfcBaseEntity*) = 0;
4646
virtual const IfcUtil::IfcBaseEntity* get_single_material_association(const IfcUtil::IfcBaseEntity*) = 0;
4747
virtual double get_length_unit() const = 0;
48+
virtual const std::string& get_length_unit_name() const = 0;
4849
virtual IfcUtil::IfcBaseEntity* representation_of(const IfcUtil::IfcBaseEntity* product) = 0;
4950

5051
const Settings& settings() const { return settings_; }

src/ifcgeom/mapping/mapping.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ namespace geometry {
8686
virtual std::map<std::string, IfcUtil::IfcBaseEntity*> get_layers(IfcUtil::IfcBaseEntity*);
8787
virtual void initialize_settings();
8888
virtual double get_length_unit() const { return length_unit_; }
89+
virtual const std::string& get_length_unit_name() const { return length_unit_name_; }
8990
virtual aggregate_of_instance::ptr find_openings(const IfcUtil::IfcBaseEntity*);
9091
virtual IfcUtil::IfcBaseEntity* representation_of(const IfcUtil::IfcBaseEntity* product);
9192

0 commit comments

Comments
 (0)