From dfa1b8bb6e648b4a5d31a7c08757e38f3a89259c Mon Sep 17 00:00:00 2001 From: nds Date: Thu, 18 Feb 2016 16:34:19 +0300 Subject: [PATCH] Debug modification for translation/rotate argument visualization, not completed. 1. Hide translate/rotate presentation if point is deselected. 2. Do not show copied feature as an argument Todo: hide copied lines in case 1. --- src/PartSet/PartSet_OperationPrs.cpp | 21 ++++++++++++++++++- .../SketcherPrs_Transformation.cpp | 18 ++++++++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/src/PartSet/PartSet_OperationPrs.cpp b/src/PartSet/PartSet_OperationPrs.cpp index 1b4491e6d..99e5e1624 100755 --- a/src/PartSet/PartSet_OperationPrs.cpp +++ b/src/PartSet/PartSet_OperationPrs.cpp @@ -37,6 +37,13 @@ static const int AIS_DEFAULT_WIDTH = 2; +//#define DEBUG_HIDE_COPY_ATTRIBUTE + +#ifdef DEBUG_HIDE_COPY_ATTRIBUTE +#include +#include +#endif + IMPLEMENT_STANDARD_HANDLE(PartSet_OperationPrs, ViewerData_AISShape); IMPLEMENT_STANDARD_RTTIEXT(PartSet_OperationPrs, ViewerData_AISShape); @@ -180,9 +187,21 @@ void addValue(const ObjectPtr& theObject, const GeomShapePtr& theShape, } return; } +#ifdef DEBUG_HIDE_COPY_ATTRIBUTE + else { + FeaturePtr aFeature = ModelAPI_Feature::feature(theObject); + if (aFeature.get()) { + AttributeBooleanPtr aCopyAttr = aFeature->data()->boolean(SketchPlugin_SketchEntity::COPY_ID()); + if (aCopyAttr.get()) { + bool isCopy = aCopyAttr->value(); + if (isCopy) + return; + } + } + } +#endif } - GeomShapePtr aShape = theShape; if (!aShape.get()) { ResultPtr aResult = std::dynamic_pointer_cast(theObject); diff --git a/src/SketcherPrs/SketcherPrs_Transformation.cpp b/src/SketcherPrs/SketcherPrs_Transformation.cpp index 347f8c357..d9dc0ab7f 100644 --- a/src/SketcherPrs/SketcherPrs_Transformation.cpp +++ b/src/SketcherPrs/SketcherPrs_Transformation.cpp @@ -48,6 +48,24 @@ bool SketcherPrs_Transformation::IsReadyToDisplay(ModelAPI_Feature* theConstrain int aNbB = anAttrB->size(); aReadyToDisplay = aNbB > 0; + +#ifdef DEBUG_HIDE_COPY_ATTRIBUTE + // additional check + if (theConstraint->getKind() == SketchPlugin_MultiTranslation::ID()) { + // If it is translation + AttributePoint2DPtr aStart = GeomDataAPI_Point2D::getPoint2D(aData, + SketchPlugin_MultiTranslation::START_POINT_ID()); + AttributePoint2DPtr aEnd = GeomDataAPI_Point2D::getPoint2D(aData, + SketchPlugin_MultiTranslation::END_POINT_ID()); + + aReadyToDisplay = aStart.get() && aEnd.get() && aStart->isInitialized() && aEnd->isInitialized(); + } + else if (theConstraint->getKind() == SketchPlugin_MultiRotation::ID()) { + // if it is rotation + AttributePoint2DPtr aCenter = GeomDataAPI_Point2D::getPoint2D(aData, SketchPlugin_MultiRotation::CENTER_ID()); + aReadyToDisplay = aCenter.get() && aCenter->isInitialized(); + } +#endif return aReadyToDisplay; } -- 2.39.2