mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-21 13:23:40 +00:00
Proceed with merge
This commit is contained in:
@@ -20,7 +20,9 @@
|
||||
#ifndef IFCSHAPELIST_H
|
||||
#define IFCSHAPELIST_H
|
||||
|
||||
#include "../ifcgeom_schema_agnostic/IfcGeomRenderStyles.h"
|
||||
#include "../ifcgeom/IfcGeomRenderStyles.h"
|
||||
#include "../ifcgeom/IteratorSettings.h"
|
||||
#include "../ifcgeom/taxonomy.h"
|
||||
|
||||
#include <gp_GTrsf.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
@@ -28,37 +30,74 @@
|
||||
#include <vector>
|
||||
|
||||
namespace IfcGeom {
|
||||
|
||||
class IFC_GEOM_API IfcRepresentationShapeItem {
|
||||
|
||||
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;
|
||||
|
||||
virtual void Serialize(std::string&) const = 0;
|
||||
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 {
|
||||
private:
|
||||
int id;
|
||||
gp_GTrsf placement;
|
||||
TopoDS_Shape shape;
|
||||
std::shared_ptr<const SurfaceStyle> style;
|
||||
ifcopenshell::geometry::taxonomy::matrix4 placement;
|
||||
ConversionResultShape* shape;
|
||||
ifcopenshell::geometry::taxonomy::style style_;
|
||||
public:
|
||||
IfcRepresentationShapeItem(int id, const gp_GTrsf& placement, const TopoDS_Shape& shape, std::shared_ptr<const SurfaceStyle> style)
|
||||
: id(id), placement(placement), shape(shape), style(style) {}
|
||||
IfcRepresentationShapeItem(int id, const gp_GTrsf& placement, const TopoDS_Shape& shape)
|
||||
: id(id), placement(placement), shape(shape), style(0) {}
|
||||
IfcRepresentationShapeItem(int id, const TopoDS_Shape& shape, std::shared_ptr<const SurfaceStyle> style)
|
||||
: id(id), shape(shape), style(style) {}
|
||||
IfcRepresentationShapeItem(int id, const TopoDS_Shape& shape)
|
||||
: id(id), shape(shape), style(0) {}
|
||||
void append(const gp_GTrsf& trsf) { placement.Multiply(trsf); }
|
||||
void prepend(const gp_GTrsf& trsf) { placement.PreMultiply(trsf); }
|
||||
const TopoDS_Shape& Shape() const { return shape; }
|
||||
const gp_GTrsf& Placement() const { return placement; }
|
||||
bool hasStyle() const { return !!style; }
|
||||
const SurfaceStyle& Style() const { return *style; }
|
||||
const std::shared_ptr<const SurfaceStyle> StylePtr() const { return style; }
|
||||
void setStyle(std::shared_ptr<const SurfaceStyle> newStyle) { style = newStyle; }
|
||||
ConversionResult(int id, const ifcopenshell::geometry::taxonomy::matrix4& placement, const ConversionResultShape* shape, const ifcopenshell::geometry::taxonomy::style* style)
|
||||
: id(id), placement(placement), shape(shape->clone())
|
||||
{
|
||||
if (style) {
|
||||
style_ = *style;
|
||||
}
|
||||
}
|
||||
ConversionResult(int id, const ifcopenshell::geometry::taxonomy::matrix4& placement, const ConversionResultShape* shape)
|
||||
: id(id), placement(placement), shape(shape->clone()) {}
|
||||
ConversionResult(int id, const ConversionResultShape* shape, const ifcopenshell::geometry::taxonomy::style* style)
|
||||
: id(id), shape(shape->clone())
|
||||
{
|
||||
if (style) {
|
||||
style_ = *style;
|
||||
}
|
||||
}
|
||||
ConversionResult(int id, const ConversionResultShape* shape)
|
||||
: id(id), shape(shape->clone()) {}
|
||||
void append(const ifcopenshell::geometry::taxonomy::matrix4& trsf) {
|
||||
// @todo verify order
|
||||
placement.components() = placement.ccomponents() * trsf.ccomponents();
|
||||
}
|
||||
void prepend(const ifcopenshell::geometry::taxonomy::matrix4& trsf) {
|
||||
// @todo verify order
|
||||
placement.components() = trsf.ccomponents() * placement.ccomponents();
|
||||
}
|
||||
const ConversionResultShape* Shape() const { return shape; }
|
||||
ConversionResultShape* Shape() { return shape; }
|
||||
const ifcopenshell::geometry::taxonomy::matrix4& Placement() const { return placement; }
|
||||
bool hasStyle() const { return !!style_.diffuse; }
|
||||
const ifcopenshell::geometry::taxonomy::style& Style() const { return style_; }
|
||||
void setStyle(const ifcopenshell::geometry::taxonomy::style& newStyle) { style_ = newStyle; }
|
||||
int ItemId() const { return id; }
|
||||
};
|
||||
|
||||
typedef std::vector<IfcRepresentationShapeItem> IfcRepresentationShapeItems;
|
||||
typedef std::vector<ConversionResult> ConversionResults;
|
||||
|
||||
|
||||
namespace util {
|
||||
bool flatten_shape_list(const IfcGeom::IfcRepresentationShapeItems& shapes, TopoDS_Shape& result, bool fuse, double tol);
|
||||
// @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);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user