From aa32d461a6e60409d2473ebffa0e255c860589ab Mon Sep 17 00:00:00 2001 From: sbh Date: Wed, 11 Mar 2015 20:26:26 +0300 Subject: [PATCH] Axis creation on cylindrical face stub --- .../ConstructionPlugin_Axis.cpp | 21 ++++++++++++++++++- .../ConstructionPlugin_Axis.h | 3 +++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/ConstructionPlugin/ConstructionPlugin_Axis.cpp b/src/ConstructionPlugin/ConstructionPlugin_Axis.cpp index 7678b51a4..8e90fae27 100644 --- a/src/ConstructionPlugin/ConstructionPlugin_Axis.cpp +++ b/src/ConstructionPlugin/ConstructionPlugin_Axis.cpp @@ -16,6 +16,10 @@ #include #include +#ifdef _DEBUG +#include +#endif + using namespace std; ConstructionPlugin_Axis::ConstructionPlugin_Axis() @@ -34,7 +38,7 @@ void ConstructionPlugin_Axis::initAttributes() ModelAPI_AttributeSelection::type()); } -void ConstructionPlugin_Axis::execute() +void ConstructionPlugin_Axis::createAxisByTwoPoints() { AttributeSelectionPtr aRef1 = data()->selection(ConstructionPlugin_Axis::POINT_FIRST()); AttributeSelectionPtr aRef2 = data()->selection(ConstructionPlugin_Axis::POINT_SECOND()); @@ -55,6 +59,21 @@ void ConstructionPlugin_Axis::execute() } } +void ConstructionPlugin_Axis::execute() +{ + AttributePtr anAttr = data()->attribute(ConstructionPlugin_Axis::METHOD()); + AttributeStringPtr aMethodTypeAttr = + std::dynamic_pointer_cast(anAttr); + std::string aMethodType = aMethodTypeAttr->value(); + if (aMethodType == "AxisByPointsCase") { + createAxisByTwoPoints(); + } else if (aMethodType == "AxisByCylindricalFaceCase") { + #ifdef _DEBUG + std::cout << "ConstructionPlugin_Axis::execute: " << "AxisByCylindricalFaceCase is not supported yet." << std::endl; + #endif + } +} + bool ConstructionPlugin_Axis::customisePresentation(ResultPtr theResult, AISObjectPtr thePrs, std::shared_ptr theDefaultPrs) { diff --git a/src/ConstructionPlugin/ConstructionPlugin_Axis.h b/src/ConstructionPlugin/ConstructionPlugin_Axis.h index b92e0842c..cbf40fce7 100644 --- a/src/ConstructionPlugin/ConstructionPlugin_Axis.h +++ b/src/ConstructionPlugin/ConstructionPlugin_Axis.h @@ -75,6 +75,9 @@ class ConstructionPlugin_Axis : public ModelAPI_Feature, public GeomAPI_ICustomP /// Customize presentation of the feature virtual bool customisePresentation(ResultPtr theResult, AISObjectPtr thePrs, std::shared_ptr theDefaultPrs); + + protected: + void createAxisByTwoPoints(); }; -- 2.39.2