Skip to content

Commit 26ba761

Browse files
authored
Refactors alignment geometry
1 parent bb9be86 commit 26ba761

23 files changed

+947
-554
lines changed

src/ifcgeom/AbstractKernel.cpp

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#include "../ifcgeom/IfcGeomElement.h"
44
#include "../ifcgeom/ConversionSettings.h"
55
#include "../ifcgeom/abstract_mapping.h"
6-
#include "../ifcgeom/piecewise_function_evaluator.h"
6+
#include "../ifcgeom/function_item_evaluator.h"
77

88
#ifdef IFOPSH_WITH_OPENCASCADE
99
#include "../ifcgeom/kernels/opencascade/OpenCascadeKernel.h"
@@ -71,6 +71,7 @@ bool is_valid_for_kernel(const ifcopenshell::geometry::kernels::AbstractKernel*
7171
return dynamic_cast<ifcopenshell::geometry::CgalShape*>(shp.Shape().get()) != nullptr;
7272
}
7373
#endif
74+
return false;
7475
}
7576

7677
class HybridKernel : public ifcopenshell::geometry::kernels::AbstractKernel {
@@ -237,9 +238,44 @@ bool ifcopenshell::geometry::kernels::AbstractKernel::convert_impl(const taxonom
237238
return r.size() > s;
238239
}
239240

240-
bool ifcopenshell::geometry::kernels::AbstractKernel::convert_impl(const taxonomy::piecewise_function::ptr item, IfcGeom::ConversionResults& cs) {
241-
piecewise_function_evaluator evaluator(item);
241+
bool ifcopenshell::geometry::kernels::AbstractKernel::convert_impl(const taxonomy::function_item::ptr item, IfcGeom::ConversionResults& cs) {
242+
function_item_evaluator evaluator(settings(),item);
242243
auto expl = evaluator.evaluate();
243244
expl->instance = item->instance;
244245
return convert(expl, cs);
245246
}
247+
248+
bool ifcopenshell::geometry::kernels::AbstractKernel::convert_impl(const taxonomy::functor_item::ptr item, IfcGeom::ConversionResults& cs) {
249+
function_item_evaluator evaluator(settings(), item);
250+
auto expl = evaluator.evaluate();
251+
expl->instance = item->instance;
252+
return convert(expl, cs);
253+
}
254+
255+
bool ifcopenshell::geometry::kernels::AbstractKernel::convert_impl(const taxonomy::piecewise_function::ptr item, IfcGeom::ConversionResults& cs) {
256+
function_item_evaluator evaluator(settings(), item);
257+
auto expl = evaluator.evaluate();
258+
expl->instance = item->instance;
259+
return convert(expl, cs);
260+
}
261+
262+
bool ifcopenshell::geometry::kernels::AbstractKernel::convert_impl(const taxonomy::gradient_function::ptr item, IfcGeom::ConversionResults& cs) {
263+
function_item_evaluator evaluator(settings(), item);
264+
auto expl = evaluator.evaluate();
265+
expl->instance = item->instance;
266+
return convert(expl, cs);
267+
}
268+
269+
bool ifcopenshell::geometry::kernels::AbstractKernel::convert_impl(const taxonomy::cant_function::ptr item, IfcGeom::ConversionResults& cs) {
270+
function_item_evaluator evaluator(settings(), item);
271+
auto expl = evaluator.evaluate();
272+
expl->instance = item->instance;
273+
return convert(expl, cs);
274+
}
275+
276+
bool ifcopenshell::geometry::kernels::AbstractKernel::convert_impl(const taxonomy::offset_function::ptr item, IfcGeom::ConversionResults& cs) {
277+
function_item_evaluator evaluator(settings(), item);
278+
auto expl = evaluator.evaluate();
279+
expl->instance = item->instance;
280+
return convert(expl, cs);
281+
}

src/ifcgeom/AbstractKernel.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,12 @@ namespace ifcopenshell {
7676
virtual bool convert_impl(const taxonomy::sweep_along_curve::ptr, IfcGeom::ConversionResults&) { throw not_implemented_error(); }
7777
virtual bool convert_impl(const taxonomy::loft::ptr, IfcGeom::ConversionResults&) { throw not_implemented_error(); }
7878
virtual bool convert_impl(const taxonomy::collection::ptr, IfcGeom::ConversionResults&);
79-
virtual bool convert_impl(const taxonomy::piecewise_function::ptr item, IfcGeom::ConversionResults& cs);
79+
virtual bool convert_impl(const taxonomy::function_item::ptr item, IfcGeom::ConversionResults& cs);
80+
virtual bool convert_impl(const taxonomy::functor_item::ptr item, IfcGeom::ConversionResults& cs);
81+
virtual bool convert_impl(const taxonomy::piecewise_function::ptr item, IfcGeom::ConversionResults& cs);
82+
virtual bool convert_impl(const taxonomy::gradient_function::ptr item, IfcGeom::ConversionResults& cs);
83+
virtual bool convert_impl(const taxonomy::cant_function::ptr item, IfcGeom::ConversionResults& cs);
84+
virtual bool convert_impl(const taxonomy::offset_function::ptr item, IfcGeom::ConversionResults& cs);
8085

8186
/*
8287
virtual void set_offset(const std::array<double, 3> &p_offset);

src/ifcgeom/ConversionSettings.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ std::istream& ifcopenshell::geometry::settings::operator>>(std::istream& in, Ite
4949
return in;
5050
}
5151

52-
std::istream& ifcopenshell::geometry::settings::operator>>(std::istream& in, PiecewiseStepMethod& ioo) {
52+
std::istream& ifcopenshell::geometry::settings::operator>>(std::istream& in, FunctionStepMethod& ioo) {
5353
std::string token;
5454
in >> token;
5555
boost::to_upper(token);

src/ifcgeom/ConversionSettings.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -365,22 +365,22 @@ namespace ifcopenshell {
365365
static constexpr bool defaultvalue = false;
366366
};
367367

368-
enum PiecewiseStepMethod {
368+
enum FunctionStepMethod {
369369
MAXSTEPSIZE,
370370
MINSTEPS };
371371

372-
std::istream& operator>>(std::istream& in, PiecewiseStepMethod& ioo);
372+
std::istream& operator>>(std::istream& in, FunctionStepMethod& ioo);
373373

374-
struct PiecewiseStepType : public SettingBase<PiecewiseStepType, PiecewiseStepMethod> {
375-
static constexpr const char* const name = "piecewise-step-type";
376-
static constexpr const char* const description = "Indicates the method used for defining step size when evaluating piecewise curves. Provides interpretation of piecewise-step-param";
377-
static constexpr PiecewiseStepMethod defaultvalue = MAXSTEPSIZE;
374+
struct FunctionStepType : public SettingBase<FunctionStepType, FunctionStepMethod> {
375+
static constexpr const char* const name = "function-step-type";
376+
static constexpr const char* const description = "Indicates the method used for defining step size when evaluating function-based curves. Provides interpretation of function-step-param";
377+
static constexpr FunctionStepMethod defaultvalue = MAXSTEPSIZE;
378378
};
379379

380-
struct PiecewiseStepParam : public SettingBase<PiecewiseStepParam, double> {
381-
static constexpr const char* const name = "piecewise-step-param";
382-
static constexpr const char* const description = "Indicates the parameter value for defining step size when evaluating piecewise curves.";
383-
static constexpr double defaultvalue = 0.5; // ceiling of this value is used when PiecewiseStepMethod is MinSteps
380+
struct FunctionStepParam : public SettingBase<FunctionStepParam, double> {
381+
static constexpr const char* const name = "function-step-param";
382+
static constexpr const char* const description = "Indicates the parameter value for defining step size when evaluating function-based curves.";
383+
static constexpr double defaultvalue = 0.5; // ceiling of this value is used when FunctionStepMethod is MinSteps
384384
};
385385

386386
struct ModelOffset : public SettingBase<ModelOffset, std::vector<double>> {
@@ -413,7 +413,7 @@ namespace ifcopenshell {
413413
template <typename settings_t>
414414
class IFC_GEOM_API SettingsContainer {
415415
public:
416-
typedef boost::variant<bool, int, double, std::string, std::set<int>, std::set<std::string>, std::vector<double>, IteratorOutputOptions, PiecewiseStepMethod, OutputDimensionalityTypes, TriangulationMethod> value_variant_t;
416+
typedef boost::variant<bool, int, double, std::string, std::set<int>, std::set<std::string>, std::vector<double>, IteratorOutputOptions, FunctionStepMethod, OutputDimensionalityTypes, TriangulationMethod> value_variant_t;
417417
private:
418418
settings_t settings;
419419

@@ -500,7 +500,7 @@ namespace ifcopenshell {
500500
};
501501

502502
class IFC_GEOM_API Settings : public SettingsContainer<
503-
std::tuple<MesherLinearDeflection, MesherAngularDeflection, ReorientShells, LengthUnit, PlaneUnit, Precision, OutputDimensionality, LayersetFirst, DisableBooleanResult, NoWireIntersectionCheck, NoWireIntersectionTolerance, PrecisionFactor, DebugBooleanOperations, BooleanAttempt2d, SurfaceColour, WeldVertices, UseWorldCoords, UnifyShapes, UseMaterialNames, ConvertBackUnits, ContextIds, ContextTypes, ContextIdentifiers, IteratorOutput, DisableOpeningSubtractions, ApplyDefaultMaterials, DontEmitNormals, GenerateUvs, ApplyLayerSets, UseElementHierarchy, ValidateQuantities, EdgeArrows, BuildingLocalPlacement, SiteLocalPlacement, ForceSpaceTransparency, CircleSegments, KeepBoundingBoxes, PiecewiseStepType, PiecewiseStepParam, NoParallelMapping, ModelOffset, ModelRotation, TriangulationType>
503+
std::tuple<MesherLinearDeflection, MesherAngularDeflection, ReorientShells, LengthUnit, PlaneUnit, Precision, OutputDimensionality, LayersetFirst, DisableBooleanResult, NoWireIntersectionCheck, NoWireIntersectionTolerance, PrecisionFactor, DebugBooleanOperations, BooleanAttempt2d, SurfaceColour, WeldVertices, UseWorldCoords, UnifyShapes, UseMaterialNames, ConvertBackUnits, ContextIds, ContextTypes, ContextIdentifiers, IteratorOutput, DisableOpeningSubtractions, ApplyDefaultMaterials, DontEmitNormals, GenerateUvs, ApplyLayerSets, UseElementHierarchy, ValidateQuantities, EdgeArrows, BuildingLocalPlacement, SiteLocalPlacement, ForceSpaceTransparency, CircleSegments, KeepBoundingBoxes, FunctionStepType, FunctionStepParam, NoParallelMapping, ModelOffset, ModelRotation, TriangulationType>
504504
>
505505
{};
506506
}

0 commit comments

Comments
 (0)