X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FConstructionPlugin%2FConstructionPlugin_Axis.cpp;h=280da1e7fd28869a24c27f8e23cc3189db3f5af1;hb=1b9dd3633d644c358424227423b330e9551be38f;hp=e3d7eb34c4f58e7f2edf07b540e17386bf62c61a;hpb=a24b7e6f4d112d5e7889fd76f030298fc428cd01;p=modules%2Fshaper.git diff --git a/src/ConstructionPlugin/ConstructionPlugin_Axis.cpp b/src/ConstructionPlugin/ConstructionPlugin_Axis.cpp index e3d7eb34c..280da1e7f 100644 --- a/src/ConstructionPlugin/ConstructionPlugin_Axis.cpp +++ b/src/ConstructionPlugin/ConstructionPlugin_Axis.cpp @@ -59,6 +59,19 @@ void ConstructionPlugin_Axis::createAxisByTwoPoints() } } +void ConstructionPlugin_Axis::createAxisByCylindricalFace() +{ + std::shared_ptr aSelection = data()->selection(CYLINDRICAL_FACE())->value(); + // update arguments due to the selection value + if (aSelection && !aSelection->isNull() && aSelection->isFace()) { + std::shared_ptr anEdge = GeomAlgoAPI_EdgeBuilder::cylinderAxis(aSelection); + + ResultConstructionPtr aConstr = document()->createConstruction(data()); + aConstr->setShape(anEdge); + setResult(aConstr); + } +} + void ConstructionPlugin_Axis::execute() { AttributeStringPtr aMethodTypeAttr = string(ConstructionPlugin_Axis::METHOD()); @@ -66,19 +79,18 @@ void ConstructionPlugin_Axis::execute() if (aMethodType == "AxisByPointsCase") { createAxisByTwoPoints(); } else if (aMethodType == "AxisByCylindricalFaceCase") { - #ifdef _DEBUG - std::cout << "ConstructionPlugin_Axis::execute: " << "AxisByCylindricalFaceCase is not supported yet." << std::endl; - #endif + createAxisByCylindricalFace(); } } bool ConstructionPlugin_Axis::customisePresentation(ResultPtr theResult, AISObjectPtr thePrs, - std::shared_ptr theDefaultPrs) + std::shared_ptr theDefaultPrs) { bool isCustomized = theDefaultPrs.get() != NULL && theDefaultPrs->customisePresentation(theResult, thePrs, theDefaultPrs); - isCustomized = thePrs->setLineStyle(3); + isCustomized = thePrs->setLineStyle(3) || isCustomized; + isCustomized = thePrs->setWidth(2) || isCustomized; return isCustomized; }