2021-11-05 16:54:16 +01:00
|
|
|
/********************************************************************************
|
2011-11-30 11:50:17 +00:00
|
|
|
* *
|
|
|
|
|
* This file is part of IfcOpenShell. *
|
|
|
|
|
* *
|
|
|
|
|
* IfcOpenShell is free software: you can redistribute it and/or modify *
|
|
|
|
|
* it under the terms of the Lesser GNU General Public License as published by *
|
|
|
|
|
* the Free Software Foundation, either version 3.0 of the License, or *
|
|
|
|
|
* (at your option) any later version. *
|
|
|
|
|
* *
|
|
|
|
|
* IfcOpenShell is distributed in the hope that it will be useful, *
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
|
|
|
* Lesser GNU General Public License for more details. *
|
|
|
|
|
* *
|
|
|
|
|
* You should have received a copy of the Lesser GNU General Public License *
|
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
|
|
|
|
* *
|
|
|
|
|
********************************************************************************/
|
|
|
|
|
|
|
|
|
|
#ifndef IFCSHAPELIST_H
|
|
|
|
|
#define IFCSHAPELIST_H
|
|
|
|
|
|
2023-03-21 20:15:01 +01:00
|
|
|
#include "../ifcgeom/IfcGeomRenderStyles.h"
|
|
|
|
|
#include "../ifcgeom/IteratorSettings.h"
|
|
|
|
|
#include "../ifcgeom/taxonomy.h"
|
2022-11-14 09:23:59 +01:00
|
|
|
|
|
|
|
|
#include <vector>
|
2013-05-13 06:40:30 +00:00
|
|
|
|
|
|
|
|
namespace IfcGeom {
|
2023-03-21 20:15:01 +01:00
|
|
|
|
|
|
|
|
namespace Representation {
|
|
|
|
|
class IFC_GEOM_API Triangulation;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class IFC_GEOM_API ConversionResultShape {
|
|
|
|
|
public:
|
|
|
|
|
virtual void Triangulate(const IteratorSettings& settings, const ifcopenshell::geometry::taxonomy::matrix4& place, Representation::Triangulation* t, int surface_style_id) const = 0;
|
|
|
|
|
|
2023-08-26 11:35:23 +02:00
|
|
|
virtual void Serialize(const ifcopenshell::geometry::taxonomy::matrix4& place, std::string&) const = 0;
|
2023-03-21 20:15:01 +01:00
|
|
|
virtual ConversionResultShape* clone() const = 0;
|
|
|
|
|
virtual int surface_genus() const = 0;
|
|
|
|
|
virtual bool is_manifold() const = 0;
|
|
|
|
|
// @todo this must be something with a virtual dtor so that we can delete it.
|
|
|
|
|
virtual double bounding_box(void*& b) const = 0;
|
|
|
|
|
virtual int num_vertices() const = 0;
|
|
|
|
|
virtual void set_box(void* b) = 0;
|
|
|
|
|
virtual ~ConversionResultShape() {}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class IFC_GEOM_API ConversionResult {
|
2013-05-13 06:40:30 +00:00
|
|
|
private:
|
2018-12-12 16:26:49 +01:00
|
|
|
int id;
|
2023-07-27 16:42:06 +08:00
|
|
|
ifcopenshell::geometry::taxonomy::matrix4::ptr placement_;
|
|
|
|
|
ConversionResultShape* shape_;
|
|
|
|
|
ifcopenshell::geometry::taxonomy::style::ptr style_;
|
2013-05-13 06:40:30 +00:00
|
|
|
public:
|
2023-07-27 16:42:06 +08:00
|
|
|
ConversionResult(int id, ifcopenshell::geometry::taxonomy::matrix4::ptr placement, ConversionResultShape* shape, ifcopenshell::geometry::taxonomy::style::ptr style)
|
|
|
|
|
: id(id), placement_(placement ? placement : ifcopenshell::geometry::taxonomy::make<ifcopenshell::geometry::taxonomy::matrix4>()), shape_(shape), style_(style)
|
|
|
|
|
{}
|
|
|
|
|
ConversionResult(int id, ifcopenshell::geometry::taxonomy::matrix4::ptr placement, ConversionResultShape* shape)
|
|
|
|
|
: id(id), placement_(placement ? placement : ifcopenshell::geometry::taxonomy::make<ifcopenshell::geometry::taxonomy::matrix4>()), shape_(shape)
|
|
|
|
|
{}
|
|
|
|
|
ConversionResult(int id, ConversionResultShape* shape, ifcopenshell::geometry::taxonomy::style::ptr style)
|
|
|
|
|
: id(id), placement_(ifcopenshell::geometry::taxonomy::make<ifcopenshell::geometry::taxonomy::matrix4>()), shape_(shape), style_(style)
|
|
|
|
|
{}
|
|
|
|
|
ConversionResult(int id, ConversionResultShape* shape)
|
|
|
|
|
: id(id), placement_(ifcopenshell::geometry::taxonomy::make<ifcopenshell::geometry::taxonomy::matrix4>()), shape_(shape)
|
|
|
|
|
{}
|
|
|
|
|
void append(ifcopenshell::geometry::taxonomy::matrix4::ptr trsf) {
|
2023-03-21 20:15:01 +01:00
|
|
|
// @todo verify order
|
2023-07-27 16:42:06 +08:00
|
|
|
placement_->components() = placement_->ccomponents() * trsf->ccomponents();
|
2023-03-21 20:15:01 +01:00
|
|
|
}
|
2023-07-27 16:42:06 +08:00
|
|
|
void prepend(ifcopenshell::geometry::taxonomy::matrix4::ptr trsf) {
|
2023-03-21 20:15:01 +01:00
|
|
|
// @todo verify order
|
2023-07-27 16:42:06 +08:00
|
|
|
placement_->components() = trsf->ccomponents() * placement_->ccomponents();
|
2023-03-21 20:15:01 +01:00
|
|
|
}
|
2023-07-27 16:42:06 +08:00
|
|
|
ConversionResultShape* Shape() const { return shape_; }
|
|
|
|
|
ifcopenshell::geometry::taxonomy::matrix4::ptr Placement() const { return placement_; }
|
|
|
|
|
bool hasStyle() const { return !!style_; }
|
|
|
|
|
const ifcopenshell::geometry::taxonomy::style& Style() const { return *style_; }
|
|
|
|
|
ifcopenshell::geometry::taxonomy::style::ptr StylePtr() const { return style_; }
|
|
|
|
|
void setStyle(ifcopenshell::geometry::taxonomy::style::ptr newStyle) { style_ = newStyle; }
|
2018-12-10 11:33:54 +01:00
|
|
|
int ItemId() const { return id; }
|
2013-05-13 06:40:30 +00:00
|
|
|
};
|
2022-11-14 09:23:59 +01:00
|
|
|
|
2023-03-21 20:15:01 +01:00
|
|
|
typedef std::vector<ConversionResult> ConversionResults;
|
|
|
|
|
|
2022-11-14 09:23:59 +01:00
|
|
|
|
|
|
|
|
namespace util {
|
2023-03-21 20:15:01 +01:00
|
|
|
// @todo this is now moved to occt kernel, do we need something similar in cgal?
|
|
|
|
|
// bool flatten_shape_list(const IfcGeom::ConversionResults& shapes, TopoDS_Shape& result, bool fuse, double tol);
|
2022-11-14 09:23:59 +01:00
|
|
|
}
|
2011-11-30 11:50:17 +00:00
|
|
|
}
|
|
|
|
|
#endif
|