X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FConstructionPlugin%2FConstructionPlugin_Axis.cpp;h=e3d7eb34c4f58e7f2edf07b540e17386bf62c61a;hb=a731f82dccbfdb67cbf8e8d617222a4d3e32018a;hp=4f3fae9dbdd66352d6b8713368fea1c43ee7ef7e;hpb=26eb9df03b20bbec3ecafbda1a1b1fcfe5f06bbc;p=modules%2Fshaper.git diff --git a/src/ConstructionPlugin/ConstructionPlugin_Axis.cpp b/src/ConstructionPlugin/ConstructionPlugin_Axis.cpp index 4f3fae9db..e3d7eb34c 100644 --- a/src/ConstructionPlugin/ConstructionPlugin_Axis.cpp +++ b/src/ConstructionPlugin/ConstructionPlugin_Axis.cpp @@ -10,11 +10,16 @@ #include #include +#include #include #include #include +#ifdef _DEBUG +#include +#endif + using namespace std; ConstructionPlugin_Axis::ConstructionPlugin_Axis() @@ -23,13 +28,17 @@ ConstructionPlugin_Axis::ConstructionPlugin_Axis() void ConstructionPlugin_Axis::initAttributes() { + data()->addAttribute(ConstructionPlugin_Axis::METHOD(), + ModelAPI_AttributeString::typeId()); data()->addAttribute(ConstructionPlugin_Axis::POINT_FIRST(), - ModelAPI_AttributeSelection::type()); + ModelAPI_AttributeSelection::typeId()); data()->addAttribute(ConstructionPlugin_Axis::POINT_SECOND(), - ModelAPI_AttributeSelection::type()); + ModelAPI_AttributeSelection::typeId()); + data()->addAttribute(ConstructionPlugin_Axis::CYLINDRICAL_FACE(), + ModelAPI_AttributeSelection::typeId()); } -void ConstructionPlugin_Axis::execute() +void ConstructionPlugin_Axis::createAxisByTwoPoints() { AttributeSelectionPtr aRef1 = data()->selection(ConstructionPlugin_Axis::POINT_FIRST()); AttributeSelectionPtr aRef2 = data()->selection(ConstructionPlugin_Axis::POINT_SECOND()); @@ -50,11 +59,26 @@ void ConstructionPlugin_Axis::execute() } } -void ConstructionPlugin_Axis::customisePresentation(AISObjectPtr thePrs) +void ConstructionPlugin_Axis::execute() { - std::vector aRGB = Config_PropManager::color("Visualization", "construction_axis_color", - ConstructionPlugin_Axis::DEFAULT_COLOR()); - thePrs->setColor(aRGB[0], aRGB[1], aRGB[2]); - thePrs->setLineStyle(3); - thePrs->redisplay(); + AttributeStringPtr aMethodTypeAttr = string(ConstructionPlugin_Axis::METHOD()); + 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) +{ + bool isCustomized = theDefaultPrs.get() != NULL && + theDefaultPrs->customisePresentation(theResult, thePrs, theDefaultPrs); + + isCustomized = thePrs->setLineStyle(3); + + return isCustomized; }