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;
|
|
|
|
|
|
|
|
|
|
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 {
|
2013-05-13 06:40:30 +00:00
|
|
|
private:
|
2018-12-12 16:26:49 +01:00
|
|
|
int id;
|
2023-03-21 20:15:01 +01:00
|
|
|
ifcopenshell::geometry::taxonomy::matrix4 placement;
|
|
|
|
|
ConversionResultShape* shape;
|
|
|
|
|
ifcopenshell::geometry::taxonomy::style style_;
|
2013-05-13 06:40:30 +00:00
|
|
|
public:
|
2023-03-21 20:15:01 +01:00
|
|
|
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; }
|
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
|