mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 09:21:46 +00:00
Remove templates on iterator and element
This commit is contained in:
@@ -920,7 +920,7 @@ int main(int argc, char** argv) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
IfcGeom::Iterator<double> tmp_context_iterator(settings, ifc_file, filter_funcs, num_threads);
|
||||
IfcGeom::Iterator tmp_context_iterator(settings, ifc_file, filter_funcs, num_threads);
|
||||
|
||||
time_t start, end;
|
||||
time(&start);
|
||||
@@ -961,7 +961,7 @@ int main(int argc, char** argv) {
|
||||
Logger::Notice(msg.str());
|
||||
}
|
||||
|
||||
IfcGeom::Iterator<double> context_iterator(settings, ifc_file, filter_funcs, num_threads);
|
||||
IfcGeom::Iterator context_iterator(settings, ifc_file, filter_funcs, num_threads);
|
||||
if (!context_iterator.initialize()) {
|
||||
/// @todo It would be nice to know and print separate error prints for a case where we found no entities
|
||||
/// and for a case we found no entities that satisfy our filtering criteria.
|
||||
@@ -1074,15 +1074,15 @@ int main(int argc, char** argv) {
|
||||
|
||||
do {
|
||||
|
||||
IfcGeom::Element<double> *geom_object = context_iterator.get();
|
||||
IfcGeom::Element* geom_object = context_iterator.get();
|
||||
|
||||
if (is_tesselated)
|
||||
{
|
||||
serializer->write(static_cast<const IfcGeom::TriangulationElement<double>*>(geom_object));
|
||||
serializer->write(static_cast<const IfcGeom::TriangulationElement*>(geom_object));
|
||||
}
|
||||
else
|
||||
{
|
||||
serializer->write(static_cast<const IfcGeom::BRepElement<double>*>(geom_object));
|
||||
serializer->write(static_cast<const IfcGeom::BRepElement*>(geom_object));
|
||||
}
|
||||
|
||||
if (!no_progress) {
|
||||
@@ -1485,7 +1485,7 @@ void fix_quantities(IfcParse::IfcFile& f, bool no_progress, bool quiet, bool std
|
||||
settings.set(IfcGeom::IteratorSettings::CONVERT_BACK_UNITS, true);
|
||||
settings.set(IfcGeom::IteratorSettings::DISABLE_TRIANGULATION, true);
|
||||
|
||||
IfcGeom::Iterator<double> context_iterator(settings, &f);
|
||||
IfcGeom::Iterator context_iterator(settings, &f);
|
||||
|
||||
if (!context_iterator.initialize()) {
|
||||
return;
|
||||
@@ -1526,7 +1526,7 @@ void fix_quantities(IfcParse::IfcFile& f, bool no_progress, bool quiet, bool std
|
||||
if (num_created) {
|
||||
has_more = context_iterator.next();
|
||||
}
|
||||
IfcGeom::BRepElement<double>* geom_object = nullptr;
|
||||
IfcGeom::BRepElement* geom_object = nullptr;
|
||||
if (has_more) {
|
||||
geom_object = context_iterator.get_native();
|
||||
}
|
||||
|
||||
@@ -434,13 +434,11 @@ public:
|
||||
|
||||
std::pair<std::string, double> initializeUnits(IfcSchema::IfcUnitAssignment*);
|
||||
|
||||
template <typename P, typename PP>
|
||||
IfcGeom::BRepElement<P, PP>* create_brep_for_representation_and_product(
|
||||
IfcGeom::BRepElement* create_brep_for_representation_and_product(
|
||||
const IteratorSettings&, IfcSchema::IfcRepresentation*, IfcSchema::IfcProduct*);
|
||||
|
||||
template <typename P, typename PP>
|
||||
IfcGeom::BRepElement<P, PP>* create_brep_for_processed_representation(
|
||||
const IteratorSettings&, IfcSchema::IfcRepresentation*, IfcSchema::IfcProduct*, IfcGeom::BRepElement<P, PP>*);
|
||||
IfcGeom::BRepElement* create_brep_for_processed_representation(
|
||||
const IteratorSettings&, IfcSchema::IfcRepresentation*, IfcSchema::IfcProduct*, IfcGeom::BRepElement*);
|
||||
|
||||
const IfcSchema::IfcMaterial* get_single_material_association(const IfcSchema::IfcProduct*);
|
||||
IfcSchema::IfcRepresentation* representation_mapped_to(const IfcSchema::IfcRepresentation* representation);
|
||||
@@ -543,11 +541,11 @@ public:
|
||||
virtual void setValue(GeomValue var, double value);
|
||||
virtual double getValue(GeomValue var) const;
|
||||
|
||||
virtual IfcGeom::BRepElement<double>* convert(
|
||||
virtual IfcGeom::BRepElement* convert(
|
||||
const IteratorSettings& settings, IfcUtil::IfcBaseClass* representation,
|
||||
IfcUtil::IfcBaseClass* product)
|
||||
{
|
||||
return create_brep_for_representation_and_product<double, double>(settings, (IfcSchema::IfcRepresentation*) representation, (IfcSchema::IfcProduct*) product);
|
||||
return create_brep_for_representation_and_product(settings, (IfcSchema::IfcRepresentation*) representation, (IfcSchema::IfcProduct*) product);
|
||||
}
|
||||
|
||||
virtual IfcRepresentationShapeItems convert(IfcUtil::IfcBaseClass* item) {
|
||||
|
||||
@@ -32,10 +32,9 @@
|
||||
|
||||
namespace IfcGeom {
|
||||
|
||||
template <typename P>
|
||||
class Matrix {
|
||||
private:
|
||||
std::vector<P> _data;
|
||||
std::vector<double> _data;
|
||||
public:
|
||||
Matrix(const ElementSettings& settings, const gp_Trsf& trsf) {
|
||||
// Convert the gp_Trsf into a 4x3 Matrix
|
||||
@@ -49,19 +48,18 @@ namespace IfcGeom {
|
||||
const double matrix_value = i == 4 && settings.get(IteratorSettings::CONVERT_BACK_UNITS)
|
||||
? trsf_value / settings.unit_magnitude()
|
||||
: trsf_value;
|
||||
_data.push_back(static_cast<P>(matrix_value));
|
||||
_data.push_back(static_cast<double>(matrix_value));
|
||||
}
|
||||
}
|
||||
}
|
||||
const std::vector<P>& data() const { return _data; }
|
||||
const std::vector<double>& data() const { return _data; }
|
||||
};
|
||||
|
||||
template <typename P>
|
||||
class Transformation {
|
||||
private:
|
||||
ElementSettings settings_;
|
||||
gp_Trsf trsf_;
|
||||
Matrix<P> matrix_;
|
||||
Matrix matrix_;
|
||||
public:
|
||||
Transformation(const ElementSettings& settings, const gp_Trsf& trsf)
|
||||
: settings_(settings)
|
||||
@@ -69,7 +67,7 @@ namespace IfcGeom {
|
||||
, matrix_(settings, trsf)
|
||||
{}
|
||||
const gp_Trsf& data() const { return trsf_; }
|
||||
const Matrix<P>& matrix() const { return matrix_; }
|
||||
const Matrix& matrix() const { return matrix_; }
|
||||
|
||||
Transformation inverted() const {
|
||||
return Transformation(settings_, trsf_.Inverted());
|
||||
@@ -80,7 +78,6 @@ namespace IfcGeom {
|
||||
}
|
||||
};
|
||||
|
||||
template <typename P = double, typename PP = P>
|
||||
class Element {
|
||||
private:
|
||||
int _id;
|
||||
@@ -90,17 +87,17 @@ namespace IfcGeom {
|
||||
std::string _guid;
|
||||
std::string _context;
|
||||
std::string _unique_id;
|
||||
Transformation<PP> _transformation;
|
||||
Transformation _transformation;
|
||||
IfcUtil::IfcBaseEntity* product_;
|
||||
std::vector<const IfcGeom::Element<P, PP>*> _parents;
|
||||
std::vector<const IfcGeom::Element*> _parents;
|
||||
public:
|
||||
|
||||
friend bool operator == (const Element<P, PP> & element1, const Element<P, PP> & element2) {
|
||||
friend bool operator == (const Element& element1, const Element& element2) {
|
||||
return element1.id() == element2.id();
|
||||
}
|
||||
|
||||
// Use the id to compare, or the elevation is the elements are IfcBuildingStoreys and the elevation is set
|
||||
friend bool operator < (const Element<P, PP> & element1, const Element<P, PP> & element2) {
|
||||
friend bool operator < (const Element& element1, const Element& element2) {
|
||||
if (element1.type() == "IfcBuildingStorey" && element2.type() == "IfcBuildingStorey") {
|
||||
size_t attr_index = element1.product()->declaration().attribute_index("Elevation");
|
||||
Argument* elev_attr1 = element1.product()->data().getArgument(attr_index);
|
||||
@@ -124,10 +121,10 @@ namespace IfcGeom {
|
||||
const std::string& guid() const { return _guid; }
|
||||
const std::string& context() const { return _context; }
|
||||
const std::string& unique_id() const { return _unique_id; }
|
||||
const Transformation<PP>& transformation() const { return _transformation; }
|
||||
const Transformation& transformation() const { return _transformation; }
|
||||
IfcUtil::IfcBaseEntity* product() const { return product_; }
|
||||
const std::vector<const IfcGeom::Element<P, PP>*> parents() const { return _parents; }
|
||||
void SetParents(std::vector<const IfcGeom::Element<P, PP>*> newparents) { _parents = newparents; }
|
||||
const std::vector<const IfcGeom::Element*> parents() const { return _parents; }
|
||||
void SetParents(std::vector<const IfcGeom::Element*> newparents) { _parents = newparents; }
|
||||
|
||||
Element(const ElementSettings& settings, int id, int parent_id, const std::string& name, const std::string& type,
|
||||
const std::string& guid, const std::string& context, const gp_Trsf& trsf, IfcUtil::IfcBaseEntity* product)
|
||||
@@ -159,17 +156,16 @@ namespace IfcGeom {
|
||||
virtual ~Element() {}
|
||||
};
|
||||
|
||||
template <typename P = double, typename PP = P>
|
||||
class BRepElement : public Element<P, PP> {
|
||||
class BRepElement : public Element {
|
||||
private:
|
||||
boost::shared_ptr<Representation::BRep> _geometry;
|
||||
boost::shared_ptr<IfcGeom::Representation::BRep> _geometry;
|
||||
public:
|
||||
const boost::shared_ptr<Representation::BRep>& geometry_pointer() const { return _geometry; }
|
||||
const Representation::BRep& geometry() const { return *_geometry; }
|
||||
const boost::shared_ptr<IfcGeom::Representation::BRep>& geometry_pointer() const { return _geometry; }
|
||||
const IfcGeom::Representation::BRep& geometry() const { return *_geometry; }
|
||||
BRepElement(int id, int parent_id, const std::string& name, const std::string& type, const std::string& guid,
|
||||
const std::string& context, const gp_Trsf& trsf, const boost::shared_ptr<Representation::BRep>& geometry,
|
||||
const std::string& context, const gp_Trsf& trsf, const boost::shared_ptr<IfcGeom::Representation::BRep>& geometry,
|
||||
IfcUtil::IfcBaseEntity* product)
|
||||
: Element<P, PP>(geometry->settings() ,id, parent_id, name, type, guid, context, trsf, product)
|
||||
: Element(geometry->settings() ,id, parent_id, name, type, guid, context, trsf, product)
|
||||
, _geometry(geometry)
|
||||
{}
|
||||
|
||||
@@ -184,19 +180,18 @@ namespace IfcGeom {
|
||||
BRepElement& operator=(const BRepElement& other);
|
||||
};
|
||||
|
||||
template <typename P = double, typename PP = P>
|
||||
class TriangulationElement : public Element<P, PP> {
|
||||
class TriangulationElement : public Element {
|
||||
private:
|
||||
boost::shared_ptr< Representation::Triangulation<P> > _geometry;
|
||||
boost::shared_ptr< IfcGeom::Representation::Triangulation > _geometry;
|
||||
public:
|
||||
const Representation::Triangulation<P>& geometry() const { return *_geometry; }
|
||||
const boost::shared_ptr< Representation::Triangulation<P> >& geometry_pointer() const { return _geometry; }
|
||||
TriangulationElement(const BRepElement<P, PP>& shape_model)
|
||||
: Element<P, PP>(shape_model)
|
||||
, _geometry(boost::shared_ptr<Representation::Triangulation<P> >(new Representation::Triangulation<P>(shape_model.geometry())))
|
||||
const IfcGeom::Representation::Triangulation& geometry() const { return *_geometry; }
|
||||
const boost::shared_ptr< IfcGeom::Representation::Triangulation>& geometry_pointer() const { return _geometry; }
|
||||
TriangulationElement(const IfcGeom::BRepElement& shape_model)
|
||||
: Element(shape_model)
|
||||
, _geometry(boost::shared_ptr<IfcGeom::Representation::Triangulation>(new IfcGeom::Representation::Triangulation(shape_model.geometry())))
|
||||
{}
|
||||
TriangulationElement(const Element<P, PP>& element, const boost::shared_ptr<Representation::Triangulation<P> >& geometry)
|
||||
: Element<P, PP>(element)
|
||||
TriangulationElement(const IfcGeom::Element& element, const boost::shared_ptr<IfcGeom::Representation::Triangulation>& geometry)
|
||||
: Element(element)
|
||||
, _geometry(geometry)
|
||||
{}
|
||||
private:
|
||||
@@ -204,15 +199,14 @@ namespace IfcGeom {
|
||||
TriangulationElement& operator=(const TriangulationElement& other);
|
||||
};
|
||||
|
||||
template <typename P = double, typename PP = P>
|
||||
class SerializedElement : public Element<P, PP> {
|
||||
class SerializedElement : public Element {
|
||||
private:
|
||||
Representation::Serialization* _geometry;
|
||||
IfcGeom::Representation::Serialization* _geometry;
|
||||
public:
|
||||
const Representation::Serialization& geometry() const { return *_geometry; }
|
||||
SerializedElement(const BRepElement<P, PP>& shape_model)
|
||||
: Element<P, PP>(shape_model)
|
||||
, _geometry(new Representation::Serialization(shape_model.geometry()))
|
||||
const IfcGeom::Representation::Serialization& geometry() const { return *_geometry; }
|
||||
SerializedElement(const BRepElement& shape_model)
|
||||
: Element(shape_model)
|
||||
, _geometry(new IfcGeom::Representation::Serialization(shape_model.geometry()))
|
||||
{}
|
||||
virtual ~SerializedElement() {
|
||||
delete _geometry;
|
||||
|
||||
@@ -1828,8 +1828,7 @@ const IfcSchema::IfcMaterial* IfcGeom::Kernel::get_single_material_association(c
|
||||
return single_material;
|
||||
}
|
||||
|
||||
template <typename P, typename PP>
|
||||
IfcGeom::BRepElement<P, PP>* IfcGeom::Kernel::create_brep_for_representation_and_product(
|
||||
IfcGeom::BRepElement* IfcGeom::Kernel::create_brep_for_representation_and_product(
|
||||
const IteratorSettings& settings, IfcSchema::IfcRepresentation* representation, IfcSchema::IfcProduct* product)
|
||||
{
|
||||
std::stringstream representation_id_builder;
|
||||
@@ -2020,7 +2019,7 @@ IfcGeom::BRepElement<P, PP>* IfcGeom::Kernel::create_brep_for_representation_and
|
||||
context_string = representation->ContextOfItems()->ContextType();
|
||||
}
|
||||
|
||||
auto elem = new BRepElement<P, PP>(
|
||||
auto elem = new BRepElement(
|
||||
product->data().id(),
|
||||
parent_id,
|
||||
name,
|
||||
@@ -2187,10 +2186,9 @@ IfcSchema::IfcProduct::list::ptr IfcGeom::Kernel::products_represented_by(const
|
||||
return products;
|
||||
}
|
||||
|
||||
template <typename P, typename PP>
|
||||
IfcGeom::BRepElement<P, PP>* IfcGeom::Kernel::create_brep_for_processed_representation(
|
||||
IfcGeom::BRepElement* IfcGeom::Kernel::create_brep_for_processed_representation(
|
||||
const IteratorSettings& /*settings*/, IfcSchema::IfcRepresentation* representation, IfcSchema::IfcProduct* product,
|
||||
IfcGeom::BRepElement<P, PP>* brep)
|
||||
IfcGeom::BRepElement* brep)
|
||||
{
|
||||
int parent_id = -1;
|
||||
try {
|
||||
@@ -2223,7 +2221,7 @@ IfcGeom::BRepElement<P, PP>* IfcGeom::Kernel::create_brep_for_processed_represen
|
||||
|
||||
const std::string product_type = product->declaration().name();
|
||||
|
||||
return new BRepElement<P, PP>(
|
||||
return new BRepElement(
|
||||
product->data().id(),
|
||||
parent_id,
|
||||
name,
|
||||
@@ -2236,20 +2234,6 @@ IfcGeom::BRepElement<P, PP>* IfcGeom::Kernel::create_brep_for_processed_represen
|
||||
);
|
||||
}
|
||||
|
||||
template IFC_GEOM_API IfcGeom::BRepElement<float, float>* IfcGeom::Kernel::create_brep_for_representation_and_product<float, float>(
|
||||
const IteratorSettings& settings, IfcSchema::IfcRepresentation* representation, IfcSchema::IfcProduct* product);
|
||||
template IFC_GEOM_API IfcGeom::BRepElement<float, double>* IfcGeom::Kernel::create_brep_for_representation_and_product<float, double>(
|
||||
const IteratorSettings& settings, IfcSchema::IfcRepresentation* representation, IfcSchema::IfcProduct* product);
|
||||
template IFC_GEOM_API IfcGeom::BRepElement<double, double>* IfcGeom::Kernel::create_brep_for_representation_and_product<double, double>(
|
||||
const IteratorSettings& settings, IfcSchema::IfcRepresentation* representation, IfcSchema::IfcProduct* product);
|
||||
|
||||
template IFC_GEOM_API IfcGeom::BRepElement<float, float>* IfcGeom::Kernel::create_brep_for_processed_representation<float, float>(
|
||||
const IteratorSettings& settings, IfcSchema::IfcRepresentation* representation, IfcSchema::IfcProduct* product, IfcGeom::BRepElement<float, float>* brep);
|
||||
template IFC_GEOM_API IfcGeom::BRepElement<float, double>* IfcGeom::Kernel::create_brep_for_processed_representation<float, double>(
|
||||
const IteratorSettings& settings, IfcSchema::IfcRepresentation* representation, IfcSchema::IfcProduct* product, IfcGeom::BRepElement<float, double>* brep);
|
||||
template IFC_GEOM_API IfcGeom::BRepElement<double, double>* IfcGeom::Kernel::create_brep_for_processed_representation<double, double>(
|
||||
const IteratorSettings& settings, IfcSchema::IfcRepresentation* representation, IfcSchema::IfcProduct* product, IfcGeom::BRepElement<double, double>* brep);
|
||||
|
||||
std::pair<std::string, double> IfcGeom::Kernel::initializeUnits(IfcSchema::IfcUnitAssignment* unit_assignment) {
|
||||
// Set default units, set length to meters, angles to undefined
|
||||
setValue(IfcGeom::Kernel::GV_LENGTH_UNIT, 1.0);
|
||||
|
||||
@@ -1,32 +1,20 @@
|
||||
#include "IfcGeomIteratorImplementation.h"
|
||||
#include "../ifcgeom_schema_agnostic/IteratorImplementation.h"
|
||||
|
||||
namespace IfcGeom {
|
||||
template class MAKE_TYPE_NAME(IteratorImplementation_)<float, float>;
|
||||
template class MAKE_TYPE_NAME(IteratorImplementation_)<float, double>;
|
||||
template class MAKE_TYPE_NAME(IteratorImplementation_)<double, double>;
|
||||
}
|
||||
|
||||
#define MAKE_INIT_FN__(a, b) init_ ## a ## b
|
||||
#define MAKE_INIT_FN_(a, b) MAKE_INIT_FN__(a, b)
|
||||
#define MAKE_INIT_FN(t) MAKE_INIT_FN_(t, IfcSchema)
|
||||
|
||||
namespace {
|
||||
template <typename P, typename PP>
|
||||
struct MAKE_TYPE_NAME(factory_t) {
|
||||
IfcGeom::IteratorImplementation<P, PP>* operator()(const IfcGeom::IteratorSettings& settings, IfcParse::IfcFile* file, const std::vector<IfcGeom::filter_t>& filters, int num_threads) const {
|
||||
return new IfcGeom::MAKE_TYPE_NAME(IteratorImplementation_)<P, PP>(settings, file, filters, num_threads);
|
||||
IfcGeom::IteratorImplementation* operator()(const IfcGeom::IteratorSettings& settings, IfcParse::IfcFile* file, const std::vector<IfcGeom::filter_t>& filters, int num_threads) const {
|
||||
return new IfcGeom::MAKE_TYPE_NAME(IteratorImplementation_)(settings, file, filters, num_threads);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
template <typename P, typename PP>
|
||||
void MAKE_INIT_FN(IteratorImplementation_)(IteratorFactoryImplementation<P, PP>* mapping) {
|
||||
void MAKE_INIT_FN(IteratorImplementation_)(IteratorFactoryImplementation* mapping) {
|
||||
static const std::string schema_name = STRINGIFY(IfcSchema);
|
||||
MAKE_TYPE_NAME(factory_t)<P, PP> factory;
|
||||
MAKE_TYPE_NAME(factory_t) factory;
|
||||
mapping->bind(schema_name, factory);
|
||||
}
|
||||
|
||||
template void MAKE_INIT_FN(IteratorImplementation_)<float, float>(IteratorFactoryImplementation<float, float>*);
|
||||
template void MAKE_INIT_FN(IteratorImplementation_)<float, double>(IteratorFactoryImplementation<float, double>*);
|
||||
template void MAKE_INIT_FN(IteratorImplementation_)<double, double>(IteratorFactoryImplementation<double, double>*);
|
||||
|
||||
@@ -100,24 +100,22 @@
|
||||
#endif
|
||||
|
||||
namespace {
|
||||
template <typename P, typename PP=P>
|
||||
struct geometry_conversion_task {
|
||||
int index;
|
||||
IfcSchema::IfcRepresentation *representation;
|
||||
IfcSchema::IfcProduct::list::ptr products;
|
||||
std::vector<IfcGeom::BRepElement<P, PP>*> breps;
|
||||
std::vector<IfcGeom::Element<P, PP>*> elements;
|
||||
std::vector<IfcGeom::BRepElement*> breps;
|
||||
std::vector<IfcGeom::Element*> elements;
|
||||
};
|
||||
|
||||
template <typename P, typename PP=P>
|
||||
IfcGeom::Element<P, PP>* process_based_on_settings(
|
||||
IfcGeom::Element* process_based_on_settings(
|
||||
const IfcGeom::IteratorSettings& settings,
|
||||
IfcGeom::BRepElement<P, PP>* elem,
|
||||
IfcGeom::TriangulationElement<P, PP>* previous=nullptr)
|
||||
IfcGeom::BRepElement* elem,
|
||||
IfcGeom::TriangulationElement* previous=nullptr)
|
||||
{
|
||||
if (settings.get(IfcGeom::IteratorSettings::USE_BREP_DATA)) {
|
||||
try {
|
||||
return new IfcGeom::SerializedElement<P, PP>(*elem);
|
||||
return new IfcGeom::SerializedElement(*elem);
|
||||
} catch (...) {
|
||||
Logger::Message(Logger::LOG_ERROR, "Getting a serialized element from model failed.");
|
||||
return nullptr;
|
||||
@@ -125,9 +123,9 @@ namespace {
|
||||
} else if (!settings.get(IfcGeom::IteratorSettings::DISABLE_TRIANGULATION)) {
|
||||
try {
|
||||
if (!previous) {
|
||||
return new IfcGeom::TriangulationElement<P, PP>(*elem);
|
||||
return new IfcGeom::TriangulationElement(*elem);
|
||||
} else {
|
||||
return new IfcGeom::TriangulationElement<P, PP>(*elem, previous->geometry_pointer());
|
||||
return new IfcGeom::TriangulationElement(*elem, previous->geometry_pointer());
|
||||
}
|
||||
} catch (...) {
|
||||
Logger::Message(Logger::LOG_ERROR, "Getting a triangulation element from model failed.");
|
||||
@@ -138,15 +136,14 @@ namespace {
|
||||
}
|
||||
}
|
||||
|
||||
template <typename P, typename PP = P>
|
||||
void create_element(
|
||||
IfcGeom::MAKE_TYPE_NAME(Kernel)* kernel,
|
||||
const IfcGeom::IteratorSettings& settings,
|
||||
geometry_conversion_task<P, PP>* rep)
|
||||
geometry_conversion_task* rep)
|
||||
{
|
||||
IfcSchema::IfcRepresentation *representation = rep->representation;
|
||||
IfcSchema::IfcProduct *product = *rep->products->begin();
|
||||
auto brep = kernel->create_brep_for_representation_and_product<P, PP>(settings, representation, product);
|
||||
auto brep = kernel->create_brep_for_representation_and_product(settings, representation, product);
|
||||
if (!brep) {
|
||||
return;
|
||||
}
|
||||
@@ -160,9 +157,9 @@ namespace {
|
||||
rep->elements = { elem };
|
||||
|
||||
for (auto it = rep->products->begin() + 1; it != rep->products->end(); ++it) {
|
||||
auto brep2 = kernel->create_brep_for_processed_representation<P, PP>(settings, representation, *it, brep);
|
||||
auto brep2 = kernel->create_brep_for_processed_representation(settings, representation, *it, brep);
|
||||
if (brep2) {
|
||||
auto elem2 = process_based_on_settings(settings, brep2, dynamic_cast<IfcGeom::TriangulationElement<P, PP>*>(elem));
|
||||
auto elem2 = process_based_on_settings(settings, brep2, dynamic_cast<IfcGeom::TriangulationElement*>(elem));
|
||||
if (elem2) {
|
||||
rep->breps.push_back(brep2);
|
||||
rep->elements.push_back(elem2);
|
||||
@@ -174,16 +171,15 @@ namespace {
|
||||
|
||||
namespace IfcGeom {
|
||||
|
||||
template <typename P, typename PP>
|
||||
class MAKE_TYPE_NAME(IteratorImplementation_) : public IteratorImplementation<P, PP> {
|
||||
class MAKE_TYPE_NAME(IteratorImplementation_) : public IteratorImplementation {
|
||||
private:
|
||||
|
||||
std::atomic<int> progress_;
|
||||
std::vector<geometry_conversion_task<P, PP>> tasks_;
|
||||
std::vector<IfcGeom::Element<P, PP>*> all_processed_elements_;
|
||||
std::vector<IfcGeom::BRepElement<P, PP>*> all_processed_native_elements_;
|
||||
typename std::vector<IfcGeom::Element<P, PP>*>::const_iterator task_result_iterator_;
|
||||
typename std::vector<IfcGeom::BRepElement<P, PP>*>::const_iterator native_task_result_iterator_;
|
||||
std::vector<geometry_conversion_task> tasks_;
|
||||
std::vector<IfcGeom::Element*> all_processed_elements_;
|
||||
std::vector<IfcGeom::BRepElement*> all_processed_native_elements_;
|
||||
typename std::vector<IfcGeom::Element*>::const_iterator task_result_iterator_;
|
||||
typename std::vector<IfcGeom::BRepElement*>::const_iterator native_task_result_iterator_;
|
||||
|
||||
MAKE_TYPE_NAME(IteratorImplementation_)(const MAKE_TYPE_NAME(IteratorImplementation_)&); // N/I
|
||||
MAKE_TYPE_NAME(IteratorImplementation_)& operator=(const MAKE_TYPE_NAME(IteratorImplementation_)&); // N/I
|
||||
@@ -201,9 +197,9 @@ namespace IfcGeom {
|
||||
IfcSchema::IfcRepresentation::list::it representation_iterator;
|
||||
|
||||
// The object is fetched beforehand to be sure that get() returns a valid element
|
||||
TriangulationElement<P, PP>* current_triangulation;
|
||||
BRepElement<P, PP>* current_shape_model;
|
||||
SerializedElement<P, PP>* current_serialization;
|
||||
TriangulationElement* current_triangulation;
|
||||
BRepElement* current_shape_model;
|
||||
SerializedElement* current_serialization;
|
||||
|
||||
// A container and iterator for IfcBuildingElements for the current IfcRepresentation referenced by *representation_iterator
|
||||
IfcSchema::IfcProduct::list::ptr ifcproducts;
|
||||
@@ -243,8 +239,6 @@ namespace IfcGeom {
|
||||
|
||||
/// @todo public/private sections all over the place: move all public to the beginning of the class
|
||||
public:
|
||||
typedef P Precision;
|
||||
typedef PP PlacementPrecision;
|
||||
|
||||
boost::optional<bool> initialization_outcome_;
|
||||
|
||||
@@ -402,7 +396,7 @@ namespace IfcGeom {
|
||||
if (ifcproducts.get() != previous) {
|
||||
previous = ifcproducts.get();
|
||||
if (ifcproducts->size()) {
|
||||
geometry_conversion_task<P, PP> t;
|
||||
geometry_conversion_task t;
|
||||
t.index = i++;
|
||||
t.representation = *representation_iterator;
|
||||
t.products = ifcproducts;
|
||||
@@ -467,7 +461,7 @@ namespace IfcGeom {
|
||||
} // for
|
||||
} // while
|
||||
|
||||
std::future<void> fu = std::async(std::launch::async, create_element<P, PP>, K, std::ref(settings), &rep);
|
||||
std::future<void> fu = std::async(std::launch::async, create_element, K, std::ref(settings), &rep);
|
||||
threadpool.emplace_back(std::move(fu));
|
||||
}
|
||||
|
||||
@@ -506,15 +500,15 @@ namespace IfcGeom {
|
||||
if (with_geometry) {
|
||||
size_t num_created = 0;
|
||||
do {
|
||||
IfcGeom::Element<P, PP>* geom_object = get();
|
||||
const IfcGeom::TriangulationElement<P, PP>* o = static_cast<const IfcGeom::TriangulationElement<P, PP>*>(geom_object);
|
||||
const IfcGeom::Representation::Triangulation<P>& mesh = o->geometry();
|
||||
IfcGeom::Element* geom_object = get();
|
||||
const IfcGeom::TriangulationElement* o = static_cast<const IfcGeom::TriangulationElement*>(geom_object);
|
||||
const IfcGeom::Representation::Triangulation& mesh = o->geometry();
|
||||
const gp_XYZ& pos = o->transformation().data().TranslationPart();
|
||||
|
||||
for (typename std::vector<P>::const_iterator it = mesh.verts().begin(); it != mesh.verts().end();) {
|
||||
const P x = *(it++);
|
||||
const P y = *(it++);
|
||||
const P z = *(it++);
|
||||
for (typename std::vector<double>::const_iterator it = mesh.verts().begin(); it != mesh.verts().end();) {
|
||||
const double& x = *(it++);
|
||||
const double& y = *(it++);
|
||||
const double& z = *(it++);
|
||||
|
||||
bounds_min_.SetX(std::min(bounds_min_.X(), pos.X() + x));
|
||||
bounds_min_.SetY(std::min(bounds_min_.Y(), pos.Y() + y));
|
||||
@@ -729,7 +723,7 @@ namespace IfcGeom {
|
||||
}
|
||||
}
|
||||
|
||||
BRepElement<P, PP>* create_shape_model_for_next_entity() {
|
||||
BRepElement* create_shape_model_for_next_entity() {
|
||||
for (;;) {
|
||||
auto rp = get_next_task();
|
||||
if (!rp) {
|
||||
@@ -740,9 +734,9 @@ namespace IfcGeom {
|
||||
|
||||
Logger::SetProduct(product);
|
||||
|
||||
BRepElement<P, PP>* element;
|
||||
BRepElement* element;
|
||||
if (ifcproduct_iterator == ifcproducts->begin() || !geometry_reuse_ok_for_current_representation_) {
|
||||
element = kernel.create_brep_for_representation_and_product<P, PP>(settings, representation, product);
|
||||
element = kernel.create_brep_for_representation_and_product(settings, representation, product);
|
||||
} else {
|
||||
element = kernel.create_brep_for_processed_representation(settings, representation, product, current_shape_model);
|
||||
}
|
||||
@@ -806,10 +800,10 @@ namespace IfcGeom {
|
||||
}
|
||||
|
||||
/// Gets the representation of the current geometrical entity.
|
||||
Element<P, PP>* get()
|
||||
Element* get()
|
||||
{
|
||||
// TODO: Test settings and throw
|
||||
Element<P, PP>* ret = 0;
|
||||
Element* ret = 0;
|
||||
|
||||
if (num_threads_ != 1) {
|
||||
ret = *task_result_iterator_;
|
||||
@@ -828,12 +822,12 @@ namespace IfcGeom {
|
||||
{
|
||||
// We are going to build a vector with the element parents.
|
||||
// First, create the parent vector
|
||||
std::vector<const IfcGeom::Element<P, PP>*> parents;
|
||||
std::vector<const IfcGeom::Element*> parents;
|
||||
|
||||
// if the element has a parent
|
||||
if (ret->parent_id() != -1)
|
||||
{
|
||||
const IfcGeom::Element<P, PP>* parent_object = NULL;
|
||||
const IfcGeom::Element* parent_object = NULL;
|
||||
bool hasParent = true;
|
||||
|
||||
// get the parent
|
||||
@@ -873,7 +867,7 @@ namespace IfcGeom {
|
||||
}
|
||||
|
||||
/// Gets the native (Open Cascade) representation of the current geometrical entity.
|
||||
BRepElement<P, PP>* get_native()
|
||||
BRepElement* get_native()
|
||||
{
|
||||
// TODO: Test settings and throw
|
||||
if (num_threads_ != 1) {
|
||||
@@ -883,7 +877,7 @@ namespace IfcGeom {
|
||||
}
|
||||
}
|
||||
|
||||
const Element<P, PP>* get_object(int id) {
|
||||
const Element* get_object(int id) {
|
||||
gp_Trsf trsf;
|
||||
int parent_id = -1;
|
||||
std::string instance_type, product_name, product_guid;
|
||||
@@ -935,14 +929,14 @@ namespace IfcGeom {
|
||||
|
||||
ElementSettings element_settings(settings, unit_magnitude, instance_type);
|
||||
|
||||
Element<P, PP>* ifc_object = new Element<P, PP>(element_settings, id, parent_id, product_name, instance_type, product_guid, "", trsf, ifc_product);
|
||||
Element* ifc_object = new Element(element_settings, id, parent_id, product_name, instance_type, product_guid, "", trsf, ifc_product);
|
||||
return ifc_object;
|
||||
}
|
||||
|
||||
IfcUtil::IfcBaseClass* create() {
|
||||
IfcGeom::BRepElement<P, PP>* next_shape_model = 0;
|
||||
IfcGeom::SerializedElement<P, PP>* next_serialization = 0;
|
||||
IfcGeom::TriangulationElement<P, PP>* next_triangulation = 0;
|
||||
IfcGeom::BRepElement* next_shape_model = 0;
|
||||
IfcGeom::SerializedElement* next_serialization = 0;
|
||||
IfcGeom::TriangulationElement* next_triangulation = 0;
|
||||
|
||||
try {
|
||||
next_shape_model = create_shape_model_for_next_entity();
|
||||
@@ -961,16 +955,16 @@ namespace IfcGeom {
|
||||
if (next_shape_model) {
|
||||
if (settings.get(IteratorSettings::USE_BREP_DATA)) {
|
||||
try {
|
||||
next_serialization = new SerializedElement<P, PP>(*next_shape_model);
|
||||
next_serialization = new SerializedElement(*next_shape_model);
|
||||
} catch (...) {
|
||||
Logger::Message(Logger::LOG_ERROR, "Getting a serialized element from model failed.");
|
||||
}
|
||||
} else if (!settings.get(IteratorSettings::DISABLE_TRIANGULATION)) {
|
||||
try {
|
||||
if (ifcproduct_iterator == ifcproducts->begin() || !geometry_reuse_ok_for_current_representation_) {
|
||||
next_triangulation = new TriangulationElement<P, PP>(*next_shape_model);
|
||||
next_triangulation = new TriangulationElement(*next_shape_model);
|
||||
} else {
|
||||
next_triangulation = new TriangulationElement<P, PP>(*next_shape_model, current_triangulation->geometry_pointer());
|
||||
next_triangulation = new TriangulationElement(*next_shape_model, current_triangulation->geometry_pointer());
|
||||
}
|
||||
} catch (...) {
|
||||
Logger::Message(Logger::LOG_ERROR, "Getting a triangulation element from model failed.");
|
||||
|
||||
@@ -101,22 +101,21 @@ namespace IfcGeom {
|
||||
Serialization& operator=(const Serialization&);
|
||||
};
|
||||
|
||||
template <typename P>
|
||||
class Triangulation : public Representation {
|
||||
private:
|
||||
// A nested pair of floats and a material index to be able to store an XYZ coordinate in a map.
|
||||
// TODO: Make this a std::tuple when compilers add support for that.
|
||||
typedef typename std::pair<P, std::pair<P, P> > Coordinate;
|
||||
typedef typename std::pair<double, std::pair<double, double> > Coordinate;
|
||||
typedef typename std::pair<int, Coordinate> VertexKey;
|
||||
typedef std::map<VertexKey, int> VertexKeyMap;
|
||||
typedef std::pair<int, int> Edge;
|
||||
|
||||
std::string id_;
|
||||
std::vector<P> _verts;
|
||||
std::vector<double> _verts;
|
||||
std::vector<int> _faces;
|
||||
std::vector<int> _edges;
|
||||
std::vector<P> _normals;
|
||||
std::vector<P> uvs_;
|
||||
std::vector<double> _normals;
|
||||
std::vector<double> uvs_;
|
||||
std::vector<int> _material_ids;
|
||||
std::vector<Material> _materials;
|
||||
size_t weld_offset_;
|
||||
@@ -124,11 +123,11 @@ namespace IfcGeom {
|
||||
|
||||
public:
|
||||
const std::string& id() const { return id_; }
|
||||
const std::vector<P>& verts() const { return _verts; }
|
||||
const std::vector<double>& verts() const { return _verts; }
|
||||
const std::vector<int>& faces() const { return _faces; }
|
||||
const std::vector<int>& edges() const { return _edges; }
|
||||
const std::vector<P>& normals() const { return _normals; }
|
||||
const std::vector<P>& uvs() const { return uvs_; }
|
||||
const std::vector<double>& normals() const { return _normals; }
|
||||
const std::vector<double>& uvs() const { return uvs_; }
|
||||
const std::vector<int>& material_ids() const { return _material_ids; }
|
||||
const std::vector<Material>& materials() const { return _materials; }
|
||||
|
||||
@@ -232,9 +231,9 @@ namespace IfcGeom {
|
||||
}
|
||||
// TODO: Do the same for conical surfaces, but they are rare in IFC.
|
||||
}
|
||||
_normals.push_back(static_cast<P>(normal.X()));
|
||||
_normals.push_back(static_cast<P>(normal.Y()));
|
||||
_normals.push_back(static_cast<P>(normal.Z()));
|
||||
_normals.push_back(normal.X());
|
||||
_normals.push_back(normal.Y());
|
||||
_normals.push_back(normal.Z());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -336,9 +335,9 @@ namespace IfcGeom {
|
||||
segments.push_back(std::make_pair(right, current));
|
||||
}
|
||||
|
||||
for (auto& s : segments) {
|
||||
_edges.push_back(s.first);
|
||||
_edges.push_back(s.second);
|
||||
for (auto& sgmt : segments) {
|
||||
_edges.push_back(sgmt.first);
|
||||
_edges.push_back(sgmt.second);
|
||||
_material_ids.push_back(surface_style_id);
|
||||
}
|
||||
|
||||
@@ -354,16 +353,16 @@ namespace IfcGeom {
|
||||
|
||||
/// Generates UVs for a single mesh using box projection.
|
||||
/// @todo Very simple impl. Assumes that input vertices and normals match 1:1.
|
||||
static std::vector<P> box_project_uvs(const std::vector<P> &vertices, const std::vector<P> &normals)
|
||||
static std::vector<double> box_project_uvs(const std::vector<double> &vertices, const std::vector<double> &normals)
|
||||
{
|
||||
std::vector<P> uvs;
|
||||
std::vector<double> uvs;
|
||||
uvs.resize(vertices.size() / 3 * 2);
|
||||
for (size_t uv_idx = 0, v_idx = 0;
|
||||
uv_idx < uvs.size() && v_idx < vertices.size() && v_idx < normals.size();
|
||||
uv_idx += 2, v_idx += 3) {
|
||||
|
||||
P n_x = normals[v_idx], n_y = normals[v_idx + 1], n_z = normals[v_idx + 2];
|
||||
P v_x = vertices[v_idx], v_y = vertices[v_idx + 1], v_z = vertices[v_idx + 2];
|
||||
double n_x = normals[v_idx], n_y = normals[v_idx + 1], n_z = normals[v_idx + 2];
|
||||
double v_x = vertices[v_idx], v_y = vertices[v_idx + 1], v_z = vertices[v_idx + 2];
|
||||
|
||||
if (std::abs(n_x) > std::abs(n_y) && std::abs(n_x) > std::abs(n_z)) {
|
||||
uvs[uv_idx] = v_z;
|
||||
@@ -386,15 +385,15 @@ namespace IfcGeom {
|
||||
// Welds vertices that belong to different faces
|
||||
int addVertex(int material_index, const gp_XYZ& p) {
|
||||
const bool convert = settings().get(IteratorSettings::CONVERT_BACK_UNITS);
|
||||
const P X = static_cast<P>(convert ? (p.X() / settings().unit_magnitude()) : p.X());
|
||||
const P Y = static_cast<P>(convert ? (p.Y() / settings().unit_magnitude()) : p.Y());
|
||||
const P Z = static_cast<P>(convert ? (p.Z() / settings().unit_magnitude()) : p.Z());
|
||||
const double X = convert ? (p.X() / settings().unit_magnitude()) : p.X();
|
||||
const double Y = convert ? (p.Y() / settings().unit_magnitude()) : p.Y();
|
||||
const double Z = convert ? (p.Z() / settings().unit_magnitude()) : p.Z();
|
||||
int i = (int) _verts.size() / 3;
|
||||
if (settings().get(IteratorSettings::WELD_VERTICES)) {
|
||||
const VertexKey key = std::make_pair(material_index, std::make_pair(X, std::make_pair(Y, Z)));
|
||||
typename VertexKeyMap::const_iterator it = welds.find(key);
|
||||
if ( it != welds.end() ) return it->second;
|
||||
i = (int) welds.size() + weld_offset_;
|
||||
i = (int) (welds.size() + weld_offset_);
|
||||
welds[key] = i;
|
||||
}
|
||||
_verts.push_back(X);
|
||||
|
||||
@@ -287,7 +287,7 @@ namespace IfcGeom {
|
||||
add_file(f, settings);
|
||||
}
|
||||
|
||||
tree(IfcGeom::Iterator<double>& it) {
|
||||
tree(IfcGeom::Iterator& it) {
|
||||
add_file(it);
|
||||
}
|
||||
|
||||
@@ -297,15 +297,15 @@ namespace IfcGeom {
|
||||
settings_.set(IfcGeom::IteratorSettings::USE_WORLD_COORDS, true);
|
||||
settings_.set(IfcGeom::IteratorSettings::SEW_SHELLS, true);
|
||||
|
||||
IfcGeom::Iterator<double> it(settings_, &f);
|
||||
IfcGeom::Iterator it(settings_, &f);
|
||||
|
||||
add_file(it);
|
||||
}
|
||||
|
||||
void add_file(IfcGeom::Iterator<double>& it) {
|
||||
void add_file(IfcGeom::Iterator& it) {
|
||||
if (it.initialize()) {
|
||||
do {
|
||||
IfcGeom::BRepElement<double>* elem = (IfcGeom::BRepElement<double>*)it.get();
|
||||
IfcGeom::BRepElement* elem = (IfcGeom::BRepElement*)it.get();
|
||||
auto compound = elem->geometry().as_compound();
|
||||
compound.Move(elem->transformation().data());
|
||||
add((IfcUtil::IfcBaseEntity*)it.file()->instance_by_id(elem->id()), compound);
|
||||
|
||||
@@ -70,7 +70,6 @@
|
||||
|
||||
namespace IfcGeom {
|
||||
|
||||
template <typename P = double, typename PP = P>
|
||||
class Iterator {
|
||||
private:
|
||||
Iterator(const Iterator&); // N/I
|
||||
@@ -80,7 +79,7 @@ namespace IfcGeom {
|
||||
IfcGeom::IteratorSettings settings_;
|
||||
std::vector<IfcGeom::filter_t> filters_;
|
||||
|
||||
IteratorImplementation<P, PP>* implementation_;
|
||||
IteratorImplementation* implementation_;
|
||||
|
||||
public:
|
||||
Iterator(const IfcGeom::IteratorSettings& settings, IfcParse::IfcFile* file, int num_threads = 1)
|
||||
@@ -88,20 +87,20 @@ namespace IfcGeom {
|
||||
, settings_(settings)
|
||||
{
|
||||
try {
|
||||
implementation_ = iterator_implementations<P, PP>().construct(file_->schema()->name(), settings, file, filters_, num_threads);
|
||||
implementation_ = iterator_implementations().construct(file_->schema()->name(), settings, file, filters_, num_threads);
|
||||
} catch (const std::exception& e) {
|
||||
Logger::Error(e);
|
||||
implementation_ = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
Iterator(const IfcGeom::IteratorSettings& settings, IfcParse::IfcFile* file, const std::vector<IfcGeom::filter_t>& filters, size_t num_threads = 1)
|
||||
Iterator(const IfcGeom::IteratorSettings& settings, IfcParse::IfcFile* file, const std::vector<IfcGeom::filter_t>& filters, int num_threads = 1)
|
||||
: file_(file)
|
||||
, settings_(settings)
|
||||
, filters_(filters)
|
||||
{
|
||||
try {
|
||||
implementation_ = iterator_implementations<P, PP>().construct(file_->schema()->name(), settings, file, filters_, num_threads);
|
||||
implementation_ = iterator_implementations().construct(file_->schema()->name(), settings, file, filters_, num_threads);
|
||||
} catch (const std::exception& e) {
|
||||
Logger::Error(e);
|
||||
implementation_ = nullptr;
|
||||
@@ -131,11 +130,11 @@ namespace IfcGeom {
|
||||
|
||||
IfcUtil::IfcBaseClass* next() const { return implementation_->next(); }
|
||||
|
||||
Element<P, PP>* get() { return implementation_->get(); }
|
||||
Element* get() { return implementation_->get(); }
|
||||
|
||||
BRepElement<P, PP>* get_native() { return implementation_->get_native(); }
|
||||
BRepElement* get_native() { return implementation_->get_native(); }
|
||||
|
||||
const Element<P, PP>* get_object(int id) { return implementation_->get_object(id); }
|
||||
const Element* get_object(int id) { return implementation_->get_object(id); }
|
||||
|
||||
IfcUtil::IfcBaseClass* create() { return implementation_->create(); }
|
||||
};
|
||||
|
||||
@@ -2,48 +2,36 @@
|
||||
|
||||
#include <boost/algorithm/string/case_conv.hpp>
|
||||
|
||||
template <typename P, typename PP>
|
||||
IteratorFactoryImplementation<P, PP>& iterator_implementations() {
|
||||
static IteratorFactoryImplementation<P, PP> impl;
|
||||
IteratorFactoryImplementation& iterator_implementations() {
|
||||
static IteratorFactoryImplementation impl;
|
||||
return impl;
|
||||
}
|
||||
|
||||
template IteratorFactoryImplementation<float, float>& iterator_implementations<float, float>();
|
||||
template IteratorFactoryImplementation<float, double>& iterator_implementations<float, double>();
|
||||
template IteratorFactoryImplementation<double, double>& iterator_implementations<double, double>();
|
||||
|
||||
#ifdef HAS_SCHEMA_2x3
|
||||
template <typename P, typename PP>
|
||||
extern void init_IteratorImplementation_Ifc2x3(IteratorFactoryImplementation<P, PP>*);
|
||||
extern void init_IteratorImplementation_Ifc2x3(IteratorFactoryImplementation*);
|
||||
#endif
|
||||
|
||||
#ifdef HAS_SCHEMA_4
|
||||
template <typename P, typename PP>
|
||||
extern void init_IteratorImplementation_Ifc4(IteratorFactoryImplementation<P, PP>*);
|
||||
extern void init_IteratorImplementation_Ifc4(IteratorFactoryImplementation*);
|
||||
#endif
|
||||
|
||||
#ifdef HAS_SCHEMA_4x1
|
||||
template <typename P, typename PP>
|
||||
extern void init_IteratorImplementation_Ifc4x1(IteratorFactoryImplementation<P, PP>*);
|
||||
extern void init_IteratorImplementation_Ifc4x1(IteratorFactoryImplementation*);
|
||||
#endif
|
||||
|
||||
#ifdef HAS_SCHEMA_4x2
|
||||
template <typename P, typename PP>
|
||||
extern void init_IteratorImplementation_Ifc4x2(IteratorFactoryImplementation<P, PP>*);
|
||||
extern void init_IteratorImplementation_Ifc4x2(IteratorFactoryImplementation*);
|
||||
#endif
|
||||
|
||||
#ifdef HAS_SCHEMA_4x3_rc1
|
||||
template <typename P, typename PP>
|
||||
extern void init_IteratorImplementation_Ifc4x3_rc1(IteratorFactoryImplementation<P, PP>*);
|
||||
extern void init_IteratorImplementation_Ifc4x3_rc1(IteratorFactoryImplementation*);
|
||||
#endif
|
||||
|
||||
#ifdef HAS_SCHEMA_4x3_rc2
|
||||
template <typename P, typename PP>
|
||||
extern void init_IteratorImplementation_Ifc4x3_rc2(IteratorFactoryImplementation<P, PP>*);
|
||||
extern void init_IteratorImplementation_Ifc4x3_rc2(IteratorFactoryImplementation*);
|
||||
#endif
|
||||
|
||||
template <typename P, typename PP>
|
||||
IteratorFactoryImplementation<P, PP>::IteratorFactoryImplementation() {
|
||||
IteratorFactoryImplementation::IteratorFactoryImplementation() {
|
||||
#ifdef HAS_SCHEMA_2x3
|
||||
init_IteratorImplementation_Ifc2x3(this);
|
||||
#endif
|
||||
@@ -64,24 +52,17 @@ IteratorFactoryImplementation<P, PP>::IteratorFactoryImplementation() {
|
||||
#endif
|
||||
}
|
||||
|
||||
template <typename P, typename PP>
|
||||
void IteratorFactoryImplementation<P, PP>::bind(const std::string& schema_name, typename get_factory_type<P, PP>::type fn) {
|
||||
void IteratorFactoryImplementation::bind(const std::string& schema_name, iterator_fn fn) {
|
||||
const std::string schema_name_lower = boost::to_lower_copy(schema_name);
|
||||
this->insert(std::make_pair(schema_name_lower, fn));
|
||||
}
|
||||
|
||||
template <typename P, typename PP>
|
||||
IfcGeom::IteratorImplementation<P, PP>* IteratorFactoryImplementation<P, PP>::construct(const std::string& schema_name, const IfcGeom::IteratorSettings& settings, IfcParse::IfcFile* file, const std::vector<IfcGeom::filter_t>& filters, int num_threads) {
|
||||
IfcGeom::IteratorImplementation* IteratorFactoryImplementation::construct(const std::string& schema_name, const IfcGeom::IteratorSettings& settings, IfcParse::IfcFile* file, const std::vector<IfcGeom::filter_t>& filters, int num_threads) {
|
||||
const std::string schema_name_lower = boost::to_lower_copy(schema_name);
|
||||
typename std::map<std::string, typename get_factory_type<P, PP>::type>::const_iterator it;
|
||||
typename std::map<std::string, iterator_fn>::const_iterator it;
|
||||
it = this->find(schema_name_lower);
|
||||
if (it == this->end()) {
|
||||
throw IfcParse::IfcException("No geometry iterator registered for " + schema_name);
|
||||
}
|
||||
return it->second(settings, file, filters, num_threads);
|
||||
}
|
||||
|
||||
|
||||
template class IteratorFactoryImplementation<float, float>;
|
||||
template class IteratorFactoryImplementation<float, double>;
|
||||
template class IteratorFactoryImplementation<double, double>;
|
||||
|
||||
@@ -13,52 +13,26 @@
|
||||
#include <string>
|
||||
|
||||
namespace IfcGeom {
|
||||
template <typename P, typename PP>
|
||||
class IteratorImplementation;
|
||||
|
||||
template <typename P, typename PP>
|
||||
class Element;
|
||||
|
||||
template <typename P, typename PP>
|
||||
class BRepElement;
|
||||
}
|
||||
|
||||
typedef boost::function4<IfcGeom::IteratorImplementation<float, float>*, const IfcGeom::IteratorSettings&, IfcParse::IfcFile*, const std::vector<IfcGeom::filter_t>&, int> iterator_float_float_fn;
|
||||
typedef boost::function4<IfcGeom::IteratorImplementation<float, double>*, const IfcGeom::IteratorSettings&, IfcParse::IfcFile*, const std::vector<IfcGeom::filter_t>&, int> iterator_float_double_fn;
|
||||
typedef boost::function4<IfcGeom::IteratorImplementation<double, double>*, const IfcGeom::IteratorSettings&, IfcParse::IfcFile*, const std::vector<IfcGeom::filter_t>&, int> iterator_double_double_fn;
|
||||
typedef boost::function4<IfcGeom::IteratorImplementation*, const IfcGeom::IteratorSettings&, IfcParse::IfcFile*, const std::vector<IfcGeom::filter_t>&, int> iterator_fn;
|
||||
|
||||
template <typename P, typename PP>
|
||||
struct get_factory_type {};
|
||||
|
||||
template <>
|
||||
struct get_factory_type<float, float> {
|
||||
typedef iterator_float_float_fn type;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct get_factory_type<float, double> {
|
||||
typedef iterator_float_double_fn type;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct get_factory_type<double, double> {
|
||||
typedef iterator_double_double_fn type;
|
||||
};
|
||||
|
||||
template <typename P, typename PP>
|
||||
class IteratorFactoryImplementation : public std::map<std::string, typename get_factory_type<P, PP>::type> {
|
||||
class IteratorFactoryImplementation : public std::map<std::string, iterator_fn> {
|
||||
public:
|
||||
IteratorFactoryImplementation();
|
||||
void bind(const std::string& schema_name, typename get_factory_type<P, PP>::type fn);
|
||||
IfcGeom::IteratorImplementation<P, PP>* construct(const std::string& schema_name, const IfcGeom::IteratorSettings&, IfcParse::IfcFile*, const std::vector<IfcGeom::filter_t>&, int);
|
||||
void bind(const std::string& schema_name, iterator_fn fn);
|
||||
IfcGeom::IteratorImplementation* construct(const std::string& schema_name, const IfcGeom::IteratorSettings&, IfcParse::IfcFile*, const std::vector<IfcGeom::filter_t>&, int);
|
||||
};
|
||||
|
||||
template <typename P, typename PP>
|
||||
IteratorFactoryImplementation<P, PP>& iterator_implementations();
|
||||
IteratorFactoryImplementation& iterator_implementations();
|
||||
|
||||
namespace IfcGeom {
|
||||
|
||||
template <typename P, typename PP>
|
||||
class IteratorImplementation {
|
||||
public:
|
||||
virtual bool initialize() = 0;
|
||||
@@ -70,9 +44,9 @@ namespace IfcGeom {
|
||||
virtual double getUnitMagnitude() const = 0;
|
||||
virtual IfcParse::IfcFile* file() const = 0;
|
||||
virtual IfcUtil::IfcBaseClass* next() = 0;
|
||||
virtual Element<P, PP>* get() = 0;
|
||||
virtual BRepElement<P, PP>* get_native() = 0;
|
||||
virtual const Element<P, PP>* get_object(int id) = 0;
|
||||
virtual Element* get() = 0;
|
||||
virtual BRepElement* get_native() = 0;
|
||||
virtual const Element* get_object(int id) = 0;
|
||||
virtual IfcUtil::IfcBaseClass* create() = 0;
|
||||
};
|
||||
|
||||
|
||||
@@ -36,7 +36,6 @@
|
||||
|
||||
namespace IfcGeom {
|
||||
|
||||
template <typename P, typename PP>
|
||||
class BRepElement;
|
||||
|
||||
class Kernel {
|
||||
@@ -91,7 +90,7 @@ namespace IfcGeom {
|
||||
return implementation_->getValue(var);
|
||||
}
|
||||
|
||||
virtual BRepElement<double, double>* convert(
|
||||
virtual BRepElement* convert(
|
||||
const IteratorSettings& settings, IfcUtil::IfcBaseClass* representation,
|
||||
IfcUtil::IfcBaseClass* product)
|
||||
{
|
||||
|
||||
@@ -179,7 +179,7 @@ void ColladaSerializer::ColladaExporter::ColladaGeometries::close() {
|
||||
|
||||
void ColladaSerializer::ColladaExporter::ColladaScene::add(
|
||||
const std::string& node_id, const std::string& node_name, const std::string& geom_name,
|
||||
const std::vector<std::string>& material_ids, const IfcGeom::Transformation<double>& transformation)
|
||||
const std::vector<std::string>& material_ids, const IfcGeom::Transformation& transformation)
|
||||
{
|
||||
if (!scene_opened) {
|
||||
openVisualScene(scene_id);
|
||||
@@ -194,13 +194,13 @@ void ColladaSerializer::ColladaExporter::ColladaScene::add(
|
||||
// The matrix attribute of an entity is basically a 4x3 representation of its ObjectPlacement.
|
||||
// Note that this placement is absolute, ie it is multiplied with all parent placements.
|
||||
|
||||
IfcGeom::Transformation<double>* relative_trsf = 0;
|
||||
const IfcGeom::Transformation<double>* transformation_towrite = &transformation;
|
||||
IfcGeom::Transformation* relative_trsf = 0;
|
||||
const IfcGeom::Transformation* transformation_towrite = &transformation;
|
||||
|
||||
// If this is not the first parent, get the relative placement
|
||||
if (parentNodes.size() > 0)
|
||||
{
|
||||
relative_trsf = new IfcGeom::Transformation<double>(matrixStack.top().multiplied(transformation));
|
||||
relative_trsf = new IfcGeom::Transformation(matrixStack.top().multiplied(transformation));
|
||||
transformation_towrite = relative_trsf;
|
||||
}
|
||||
|
||||
@@ -231,22 +231,22 @@ void ColladaSerializer::ColladaExporter::ColladaScene::add(
|
||||
node.end();
|
||||
}
|
||||
|
||||
void ColladaSerializer::ColladaExporter::ColladaScene::addParent(const IfcGeom::Element<double>& parent){
|
||||
void ColladaSerializer::ColladaExporter::ColladaScene::addParent(const IfcGeom::Element& parent){
|
||||
//we open the visual scene tag if it's not.
|
||||
if (!scene_opened) {
|
||||
openVisualScene(scene_id);
|
||||
scene_opened = true;
|
||||
}
|
||||
|
||||
const IfcGeom::Transformation<double>& parent_trsf = parent.transformation();
|
||||
const IfcGeom::Transformation& parent_trsf = parent.transformation();
|
||||
|
||||
IfcGeom::Transformation<double>* relative_trsf = 0;
|
||||
const IfcGeom::Transformation<double>* transformation_towrite = &parent_trsf;
|
||||
IfcGeom::Transformation* relative_trsf = 0;
|
||||
const IfcGeom::Transformation* transformation_towrite = &parent_trsf;
|
||||
|
||||
// If this is not the first parent, get the relative placement
|
||||
if (parentNodes.size() > 0)
|
||||
{
|
||||
relative_trsf = new IfcGeom::Transformation<double>(matrixStack.top().multiplied(parent_trsf));
|
||||
relative_trsf = new IfcGeom::Transformation(matrixStack.top().multiplied(parent_trsf));
|
||||
transformation_towrite = relative_trsf;
|
||||
}
|
||||
|
||||
@@ -390,9 +390,9 @@ void ColladaSerializer::ColladaExporter::startDocument(const std::string& unit_n
|
||||
asset.add();
|
||||
}
|
||||
|
||||
void ColladaSerializer::ColladaExporter::write(const IfcGeom::TriangulationElement<double>* o)
|
||||
void ColladaSerializer::ColladaExporter::write(const IfcGeom::TriangulationElement* o)
|
||||
{
|
||||
const IfcGeom::Representation::Triangulation<double>& mesh = o->geometry();
|
||||
const IfcGeom::Representation::Triangulation& mesh = o->geometry();
|
||||
|
||||
std::string name = serializer->object_id(o);
|
||||
collada_id(name);
|
||||
@@ -451,7 +451,7 @@ std::string ColladaSerializer::differentiateSlabTypes(const IfcUtil::IfcBaseEnti
|
||||
return result;
|
||||
}
|
||||
|
||||
std::string ColladaSerializer::object_id(const IfcGeom::Element<double>* o) /*override*/
|
||||
std::string ColladaSerializer::object_id(const IfcGeom::Element* o) /*override*/
|
||||
{
|
||||
if (settings_.get(SerializerSettings::USE_ELEMENT_TYPES)) {
|
||||
const std::string slabSuffix = (o->product() && o->product()->declaration().name() == "IfcSlab")
|
||||
@@ -544,7 +544,7 @@ void ColladaSerializer::writeHeader() {
|
||||
exporter.startDocument(unit_name, unit_magnitude);
|
||||
}
|
||||
|
||||
void ColladaSerializer::write(const IfcGeom::TriangulationElement<double>* o) {
|
||||
void ColladaSerializer::write(const IfcGeom::TriangulationElement* o) {
|
||||
exporter.write(o);
|
||||
}
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ private:
|
||||
const std::string scene_id;
|
||||
bool scene_opened;
|
||||
std::stack<COLLADASW::Node*> parentNodes;
|
||||
std::stack<IfcGeom::Transformation<double> > matrixStack;
|
||||
std::stack<IfcGeom::Transformation> matrixStack;
|
||||
public:
|
||||
ColladaScene(const std::string& scene_id, COLLADASW::StreamWriter& stream, ColladaSerializer *_serializer)
|
||||
: COLLADASW::LibraryVisualScenes(&stream)
|
||||
@@ -97,8 +97,8 @@ private:
|
||||
, serializer(_serializer)
|
||||
{}
|
||||
void add(const std::string& node_id, const std::string& node_name, const std::string& geom_name,
|
||||
const std::vector<std::string>& material_ids, const IfcGeom::Transformation<double>& matrix);
|
||||
void addParent(const IfcGeom::Element<double>& parent);
|
||||
const std::vector<std::string>& material_ids, const IfcGeom::Transformation& matrix);
|
||||
void addParent(const IfcGeom::Element& parent);
|
||||
void closeParent();
|
||||
COLLADASW::Node* GetDirectParent();
|
||||
void write();
|
||||
@@ -158,7 +158,7 @@ private:
|
||||
|
||||
public:
|
||||
std::string unique_id, representation_id, type;
|
||||
IfcGeom::Transformation<double> transformation;
|
||||
IfcGeom::Transformation transformation;
|
||||
std::vector<double> vertices;
|
||||
std::vector<double> normals;
|
||||
std::vector<int> faces;
|
||||
@@ -167,9 +167,9 @@ private:
|
||||
std::vector<IfcGeom::Material> materials;
|
||||
std::vector<std::string> material_references;
|
||||
std::vector<double> uvs;
|
||||
std::vector<const IfcGeom::Element<double>*> parents_;
|
||||
std::vector<const IfcGeom::Element*> parents_;
|
||||
|
||||
DeferredObject(const std::string& unique_id, const std::string& representation_id, const std::string& type, const IfcGeom::Transformation<double>& transformation,
|
||||
DeferredObject(const std::string& unique_id, const std::string& representation_id, const std::string& type, const IfcGeom::Transformation& transformation,
|
||||
const std::vector<double>& vertices, const std::vector<double>& normals, const std::vector<int>& faces,
|
||||
const std::vector<int>& edges, const std::vector<int>& material_ids, const std::vector<IfcGeom::Material>& materials,
|
||||
const std::vector<std::string>& material_references, const std::vector<double>& uvs)
|
||||
@@ -187,8 +187,8 @@ private:
|
||||
, uvs(uvs)
|
||||
{}
|
||||
|
||||
std::vector<const IfcGeom::Element<double>*>& parents() { return parents_; }
|
||||
const std::vector<const IfcGeom::Element<double>*>& parents() const { return parents_; }
|
||||
std::vector<const IfcGeom::Element*>& parents() { return parents_; }
|
||||
const std::vector<const IfcGeom::Element*>& parents() const { return parents_; }
|
||||
};
|
||||
COLLADABU::NativeString filename;
|
||||
COLLADASW::StreamWriter stream;
|
||||
@@ -211,7 +211,7 @@ private:
|
||||
std::vector<DeferredObject> deferreds;
|
||||
virtual ~ColladaExporter() {}
|
||||
void startDocument(const std::string& unit_name, float unit_magnitude);
|
||||
void write(const IfcGeom::TriangulationElement<double>* o);
|
||||
void write(const IfcGeom::TriangulationElement* o);
|
||||
void endDocument();
|
||||
};
|
||||
ColladaExporter exporter;
|
||||
@@ -229,8 +229,8 @@ public:
|
||||
}
|
||||
bool ready();
|
||||
void writeHeader();
|
||||
void write(const IfcGeom::TriangulationElement<double>* o);
|
||||
void write(const IfcGeom::BRepElement<double>* /*o*/) {}
|
||||
void write(const IfcGeom::TriangulationElement* o);
|
||||
void write(const IfcGeom::BRepElement* /*o*/) {}
|
||||
void finalize();
|
||||
bool isTesselated() const { return true; }
|
||||
void setUnitNameAndMagnitude(const std::string& name, float magnitude) {
|
||||
@@ -239,7 +239,7 @@ public:
|
||||
}
|
||||
void setFile(IfcParse::IfcFile*) {}
|
||||
|
||||
std::string object_id(const IfcGeom::Element<double>* o) /*override*/;
|
||||
std::string object_id(const IfcGeom::Element* o) /*override*/;
|
||||
|
||||
private:
|
||||
static std::string differentiateSlabTypes(const IfcUtil::IfcBaseEntity* slab);
|
||||
|
||||
@@ -70,15 +70,15 @@ public:
|
||||
virtual ~GeometrySerializer() {}
|
||||
|
||||
virtual bool isTesselated() const = 0;
|
||||
virtual void write(const IfcGeom::TriangulationElement<double>* o) = 0;
|
||||
virtual void write(const IfcGeom::BRepElement<double>* o) = 0;
|
||||
virtual void write(const IfcGeom::TriangulationElement* o) = 0;
|
||||
virtual void write(const IfcGeom::BRepElement* o) = 0;
|
||||
virtual void setUnitNameAndMagnitude(const std::string& name, float magnitude) = 0;
|
||||
|
||||
const SerializerSettings& settings() const { return settings_; }
|
||||
SerializerSettings& settings() { return settings_; }
|
||||
|
||||
/// Returns ID for the object depending on the used setting.
|
||||
virtual std::string object_id(const IfcGeom::Element<double>* o)
|
||||
virtual std::string object_id(const IfcGeom::Element* o)
|
||||
{
|
||||
if (settings_.get(SerializerSettings::USE_ELEMENT_GUIDS)) return o->guid();
|
||||
if (settings_.get(SerializerSettings::USE_ELEMENT_NAMES)) return o->name();
|
||||
|
||||
@@ -157,7 +157,7 @@ size_t write_accessor(json& j, std::ofstream& ofs, It begin, It end) {
|
||||
return j["accessors"].size() - 1;
|
||||
}
|
||||
|
||||
void GltfSerializer::write(const IfcGeom::TriangulationElement<double>* o) {
|
||||
void GltfSerializer::write(const IfcGeom::TriangulationElement* o) {
|
||||
if (o->geometry().material_ids().empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -42,8 +42,8 @@ public:
|
||||
virtual ~GltfSerializer();
|
||||
bool ready();
|
||||
void writeHeader();
|
||||
void write(const IfcGeom::TriangulationElement<double>* o);
|
||||
void write(const IfcGeom::BRepElement<double>* /*o*/) {}
|
||||
void write(const IfcGeom::TriangulationElement* o);
|
||||
void write(const IfcGeom::BRepElement* /*o*/) {}
|
||||
void finalize();
|
||||
bool isTesselated() const { return true; }
|
||||
void setUnitNameAndMagnitude(const std::string& /*name*/, float /*magnitude*/) {}
|
||||
|
||||
@@ -54,7 +54,7 @@ void HdfSerializer::writeHeader() {
|
||||
}
|
||||
|
||||
|
||||
void HdfSerializer::write(const IfcGeom::BRepElement<double>* o) {
|
||||
void HdfSerializer::write(const IfcGeom::BRepElement* o) {
|
||||
|
||||
std::string guid = o->guid();
|
||||
|
||||
@@ -72,8 +72,8 @@ void HdfSerializer::write(const IfcGeom::BRepElement<double>* o) {
|
||||
const IfcGeom::Representation::Serialization serialization(brepmesh);
|
||||
std::string brep_data = serialization.brep_data();
|
||||
|
||||
const IfcGeom::TriangulationElement<double>triangular_element(*o);
|
||||
const IfcGeom::Representation::Triangulation<double>& mesh = triangular_element.geometry();
|
||||
const IfcGeom::TriangulationElement triangular_element(*o);
|
||||
const IfcGeom::Representation::Triangulation& mesh = triangular_element.geometry();
|
||||
const int vcount = (int)mesh.verts().size() / 3;
|
||||
const int fcount = (int)mesh.faces().size() / 3;
|
||||
const bool isyup = settings().get(SerializerSettings::USE_Y_UP);
|
||||
|
||||
@@ -46,8 +46,8 @@ public:
|
||||
virtual ~HdfSerializer() {}
|
||||
bool ready();
|
||||
void writeHeader();
|
||||
void write(const IfcGeom::BRepElement<double>* o);
|
||||
void write(const IfcGeom::TriangulationElement<double>* /*o*/) {}
|
||||
void write(const IfcGeom::BRepElement* o);
|
||||
void write(const IfcGeom::TriangulationElement* /*o*/) {}
|
||||
void finalize() {}
|
||||
bool isTesselated() const { return false; }
|
||||
void setUnitNameAndMagnitude(const std::string& /*name*/, float /*magnitude*/) {}
|
||||
|
||||
@@ -36,7 +36,7 @@ bool OpenCascadeBasedSerializer::ready() {
|
||||
return succeeded;
|
||||
}
|
||||
|
||||
void OpenCascadeBasedSerializer::write(const IfcGeom::BRepElement<double>* o) {
|
||||
void OpenCascadeBasedSerializer::write(const IfcGeom::BRepElement* o) {
|
||||
TopoDS_Shape compound = o->geometry().as_compound();
|
||||
gp_Trsf trsf = o->transformation().data();
|
||||
const IfcGeom::ElementSettings& settings = o->geometry().settings();
|
||||
|
||||
@@ -39,8 +39,8 @@ public:
|
||||
void writeHeader() {}
|
||||
bool ready();
|
||||
virtual void writeShape(const std::string& name, const TopoDS_Shape& shape) = 0;
|
||||
void write(const IfcGeom::TriangulationElement<double>* /*o*/) {}
|
||||
void write(const IfcGeom::BRepElement<double>* o);
|
||||
void write(const IfcGeom::TriangulationElement* /*o*/) {}
|
||||
void write(const IfcGeom::BRepElement* o);
|
||||
bool isTesselated() const { return false; }
|
||||
void setFile(IfcParse::IfcFile*) {}
|
||||
};
|
||||
|
||||
@@ -339,7 +339,7 @@ SvgSerializer::path_object& SvgSerializer::start_path(const gp_Pln& pln, const s
|
||||
}
|
||||
|
||||
namespace {
|
||||
boost::optional<std::pair<IfcUtil::IfcBaseEntity*, double>> storey_elevation_from_element(const IfcGeom::BRepElement<double>* o) {
|
||||
boost::optional<std::pair<IfcUtil::IfcBaseEntity*, double>> storey_elevation_from_element(const IfcGeom::BRepElement* o) {
|
||||
for (const auto& p : o->parents()) {
|
||||
if (p->type() == "IfcBuildingStorey") {
|
||||
try {
|
||||
@@ -503,7 +503,7 @@ namespace {
|
||||
}
|
||||
}
|
||||
|
||||
void SvgSerializer::write(const IfcGeom::BRepElement<double>* brep_obj) {
|
||||
void SvgSerializer::write(const IfcGeom::BRepElement* brep_obj) {
|
||||
|
||||
boost::optional<std::string> object_type;
|
||||
if (!brep_obj->product()->get("ObjectType")->isNull()) {
|
||||
@@ -2052,7 +2052,7 @@ return oss.str();
|
||||
}
|
||||
}
|
||||
|
||||
std::string SvgSerializer::nameElement(const IfcUtil::IfcBaseEntity* storey, const IfcGeom::Element<double>* elem) {
|
||||
std::string SvgSerializer::nameElement(const IfcUtil::IfcBaseEntity* storey, const IfcGeom::Element* elem) {
|
||||
auto n = elem->name();
|
||||
IfcUtil::escape_xml(n);
|
||||
|
||||
@@ -2178,7 +2178,7 @@ namespace {
|
||||
std::string SvgSerializer::writeMetadata(const drawing_meta& m) {
|
||||
gp_Trsf trsf;
|
||||
trsf.SetTransformation(m.pln_3d.Position(), gp::XOY());
|
||||
auto m43 = IfcGeom::Matrix<double>(IfcGeom::ElementSettings(IfcGeom::IteratorSettings(), 1., ""), trsf).data();
|
||||
auto m43 = IfcGeom::Matrix(IfcGeom::ElementSettings(IfcGeom::IteratorSettings(), 1., ""), trsf).data();
|
||||
std::array<std::array<double, 4>, 4> m4 = {{
|
||||
{{ (double)m43[0], (double)m43[3], (double)m43[6], (double)m43[9] }},
|
||||
{{ (double)m43[1], (double)m43[4], (double)m43[7], (double)m43[10] }},
|
||||
|
||||
@@ -215,8 +215,8 @@ public:
|
||||
void writeHeader();
|
||||
void doWriteHeader();
|
||||
bool ready();
|
||||
void write(const IfcGeom::TriangulationElement<double>* /*o*/) {}
|
||||
void write(const IfcGeom::BRepElement<double>* o);
|
||||
void write(const IfcGeom::TriangulationElement* /*o*/) {}
|
||||
void write(const IfcGeom::BRepElement* o);
|
||||
void write(path_object& p, const TopoDS_Wire& wire, boost::optional<std::vector<double>> dash_array=boost::none);
|
||||
void write(const geometry_data& data);
|
||||
path_object& start_path(const gp_Pln& p, IfcUtil::IfcBaseEntity* storey, const std::string& id);
|
||||
@@ -279,10 +279,10 @@ public:
|
||||
void setDrawingCenter(double x, double y) {
|
||||
center_x_ = x; center_y_ = y;
|
||||
}
|
||||
std::string nameElement(const IfcUtil::IfcBaseEntity* storey, const IfcGeom::Element<double>* elem);
|
||||
std::string nameElement(const IfcUtil::IfcBaseEntity* storey, const IfcGeom::Element* elem);
|
||||
std::string nameElement(const IfcUtil::IfcBaseEntity* elem);
|
||||
std::string idElement(const IfcUtil::IfcBaseEntity* elem);
|
||||
std::string object_id(const IfcUtil::IfcBaseEntity* storey, const IfcGeom::Element<double>* o) {
|
||||
std::string object_id(const IfcUtil::IfcBaseEntity* storey, const IfcGeom::Element* o) {
|
||||
if (storey) {
|
||||
return idElement(storey) + "-" + GeometrySerializer::object_id(o);
|
||||
} else {
|
||||
|
||||
@@ -84,7 +84,7 @@ void WaveFrontOBJSerializer::writeMaterial(const IfcGeom::Material& style)
|
||||
}
|
||||
}
|
||||
|
||||
void WaveFrontOBJSerializer::write(const IfcGeom::TriangulationElement<double>* o)
|
||||
void WaveFrontOBJSerializer::write(const IfcGeom::TriangulationElement* o)
|
||||
{
|
||||
obj_stream << "g " << object_id(o) << "\n";
|
||||
obj_stream << "s 1" << "\n";
|
||||
|
||||
@@ -40,8 +40,8 @@ public:
|
||||
bool ready();
|
||||
void writeHeader();
|
||||
void writeMaterial(const IfcGeom::Material& style);
|
||||
void write(const IfcGeom::TriangulationElement<double>* o);
|
||||
void write(const IfcGeom::BRepElement<double>* /*o*/) {}
|
||||
void write(const IfcGeom::TriangulationElement* o);
|
||||
void write(const IfcGeom::BRepElement* /*o*/) {}
|
||||
void finalize() {}
|
||||
bool isTesselated() const { return true; }
|
||||
void setUnitNameAndMagnitude(const std::string& /*name*/, float /*magnitude*/) {}
|
||||
|
||||
Reference in New Issue
Block a user