From: nds Date: Fri, 19 Jun 2015 05:29:34 +0000 (+0300) Subject: Issue #555 Make a number of shifted/rotated copies - selected object does not appear... X-Git-Tag: V_1.3.0~220 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=5e9152f6da5141e26c07727e26a0ec89255ade87;p=modules%2Fshaper.git Issue #555 Make a number of shifted/rotated copies - selected object does not appear in List of objects. Using infinite state to do not select inifinte objects(construction plane, axis). --- diff --git a/src/ConstructionPlugin/ConstructionPlugin_Axis.cpp b/src/ConstructionPlugin/ConstructionPlugin_Axis.cpp index e97fba83e..8741df7dc 100644 --- a/src/ConstructionPlugin/ConstructionPlugin_Axis.cpp +++ b/src/ConstructionPlugin/ConstructionPlugin_Axis.cpp @@ -96,5 +96,7 @@ bool ConstructionPlugin_Axis::customisePresentation(ResultPtr theResult, AISObje isCustomized = thePrs->setLineStyle(3) || isCustomized; isCustomized = thePrs->setWidth(2) || isCustomized; + thePrs->setInfiniteState(true); + return isCustomized; } diff --git a/src/GeomAPI/GeomAPI_AISObject.cpp b/src/GeomAPI/GeomAPI_AISObject.cpp index c09d9a421..8c98c449c 100644 --- a/src/GeomAPI/GeomAPI_AISObject.cpp +++ b/src/GeomAPI/GeomAPI_AISObject.cpp @@ -392,6 +392,20 @@ bool GeomAPI_AISObject::setLineStyle(int theStyle) return isChanged; } +bool GeomAPI_AISObject::setInfiniteState(const bool theState) +{ + bool isChanged = false; + Handle(AIS_InteractiveObject) anAIS = impl(); + if (!anAIS.IsNull() && anAIS->IsInfinite() != theState) { + anAIS->SetInfiniteState(theState); + isChanged = true; + + bool isInfinite = anAIS->IsInfinite(); + int aValue = 9; + } + return isChanged; +} + bool GeomAPI_AISObject::setTransparensy(double theVal) { diff --git a/src/GeomAPI/GeomAPI_AISObject.h b/src/GeomAPI/GeomAPI_AISObject.h index 06bc2e905..6652a4279 100644 --- a/src/GeomAPI/GeomAPI_AISObject.h +++ b/src/GeomAPI/GeomAPI_AISObject.h @@ -119,6 +119,13 @@ class GEOMAPI_EXPORT GeomAPI_AISObject : public GeomAPI_Interface /// \returns true if the object value differs from the current bool setLineStyle(int theStyle); + //! Sets the infinite state flag aFlage. + //! considered as infinite, i.e. its graphic presentations + //! are not taken in account for View FitAll... + //! \param theState a state + /// \returns true if the object value differs from the current + bool setInfiniteState(const bool theState); + /// Set transparency of the presentation (theVal = 0 ... 1) /// \returns true if the object value differs from the current bool setTransparensy(double theVal); diff --git a/src/PartSet/CMakeLists.txt b/src/PartSet/CMakeLists.txt index 5a243ebfb..8148df0a0 100644 --- a/src/PartSet/CMakeLists.txt +++ b/src/PartSet/CMakeLists.txt @@ -20,6 +20,7 @@ SET(PROJECT_HEADERS PartSet_WidgetShapeSelector.h PartSet_WidgetFileSelector.h PartSet_Filters.h + PartSet_FilterInfinite.h PartSet_SketcherMgr.h PartSet_MenuMgr.h PartSet_DocumentDataModel.h @@ -42,6 +43,7 @@ SET(PROJECT_SOURCES PartSet_WidgetShapeSelector.cpp PartSet_WidgetFileSelector.cpp PartSet_Filters.cpp + PartSet_FilterInfinite.cpp PartSet_SketcherMgr.cpp PartSet_MenuMgr.cpp PartSet_DocumentDataModel.cpp diff --git a/src/PartSet/PartSet_FilterInfinite.cpp b/src/PartSet/PartSet_FilterInfinite.cpp new file mode 100755 index 000000000..28f679550 --- /dev/null +++ b/src/PartSet/PartSet_FilterInfinite.cpp @@ -0,0 +1,22 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D + +// File: PartSet_Filters.cpp +// Created: 19 Jun 2015 +// Author: Natalia ERMOLAEVA + +#include "PartSet_FilterInfinite.h" + +#include + +IMPLEMENT_STANDARD_HANDLE(PartSet_FilterInfinite, SelectMgr_Filter); +IMPLEMENT_STANDARD_RTTIEXT(PartSet_FilterInfinite, SelectMgr_Filter); + +Standard_Boolean PartSet_FilterInfinite::IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const +{ + Handle(AIS_InteractiveObject) anAISObj = + Handle(AIS_InteractiveObject)::DownCast(theOwner->Selectable()); + if (!anAISObj.IsNull() && anAISObj->IsInfinite()) { + return Standard_False; + } + return Standard_True; +} diff --git a/src/PartSet/PartSet_FilterInfinite.h b/src/PartSet/PartSet_FilterInfinite.h new file mode 100755 index 000000000..8fe53055b --- /dev/null +++ b/src/PartSet/PartSet_FilterInfinite.h @@ -0,0 +1,35 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D + +// File: PartSet_Filters.h +// Created: 19 Jun 2015 +// Author: Natalia ERMOLAEVA + +#ifndef PartSet_FilterInfinite_H +#define PartSet_FilterInfinite_H + +#include + +#include + +/** +* \class PartSet_FilterInfinite +* \ingroup Modules +* A class which filters AIS objects with the true infinite state +*/ +DEFINE_STANDARD_HANDLE(PartSet_FilterInfinite, SelectMgr_Filter); +class PartSet_FilterInfinite : public SelectMgr_Filter +{ +public: + /// Constructor + /// \param theWorkshop a pointer to workshop + PartSet_FilterInfinite() + : SelectMgr_Filter() {} + + /// Returns True if selected presentation can be selected + /// \param theOwner an owner of the persentation + Standard_EXPORT virtual Standard_Boolean IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const; + + DEFINE_STANDARD_RTTI(PartSet_FilterInfinite) +}; + +#endif \ No newline at end of file diff --git a/src/PartSet/PartSet_SketcherMgr.cpp b/src/PartSet/PartSet_SketcherMgr.cpp index caf321882..b1d45d56f 100644 --- a/src/PartSet/PartSet_SketcherMgr.cpp +++ b/src/PartSet/PartSet_SketcherMgr.cpp @@ -157,6 +157,9 @@ PartSet_SketcherMgr::~PartSet_SketcherMgr() { if (!myPlaneFilter.IsNull()) myPlaneFilter.Nullify(); + if (!myFilterInfinite.IsNull()) + myFilterInfinite.Nullify(); + } void PartSet_SketcherMgr::onEnterViewPort() @@ -298,7 +301,7 @@ void PartSet_SketcherMgr::onMousePressed(ModuleBase_IViewWindow* theWnd, QMouseE if (aOperation && aOperation->isEditOperation()) { ModuleBase_IPropertyPanel* aPanel = aOperation->propertyPanel(); ModuleBase_ModelWidget* aActiveWgt = aPanel->activeWidget(); - // If the current widget is a selector, do do nothing, it processes the mouse press + // If the current widget is a selector, do nothing, it processes the mouse press if(aActiveWgt && aActiveWgt->isViewerSelector()) { return; } @@ -715,7 +718,12 @@ void PartSet_SketcherMgr::startSketch(ModuleBase_Operation* theOperation) if (myPlaneFilter.IsNull()) myPlaneFilter = new ModuleBase_ShapeInPlaneFilter(); + if (myFilterInfinite.IsNull()) + myFilterInfinite = new PartSet_FilterInfinite(); + myModule->workshop()->viewer()->addSelectionFilter(myPlaneFilter); + myModule->workshop()->viewer()->addSelectionFilter(myFilterInfinite); + bool aHasPlane = false; if (theOperation->isEditOperation()) { // If it is editing of sketch then it means that plane is already defined @@ -747,6 +755,7 @@ void PartSet_SketcherMgr::stopSketch(ModuleBase_Operation* theOperation) // The sketch was aborted myCurrentSketch = CompositeFeaturePtr(); myModule->workshop()->viewer()->removeSelectionFilter(myPlaneFilter); + myModule->workshop()->viewer()->removeSelectionFilter(myFilterInfinite); // Erase all sketcher objects QStringList aSketchIds = sketchOperationIdList(); @@ -778,6 +787,8 @@ void PartSet_SketcherMgr::stopSketch(ModuleBase_Operation* theOperation) myCurrentSketch = CompositeFeaturePtr(); myModule->workshop()->viewer()->removeSelectionFilter(myPlaneFilter); + myModule->workshop()->viewer()->removeSelectionFilter(myFilterInfinite); + Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); } // restore the module selection modes, which were changed on startSketch diff --git a/src/PartSet/PartSet_SketcherMgr.h b/src/PartSet/PartSet_SketcherMgr.h index 973924a3e..e0a9e06f5 100644 --- a/src/PartSet/PartSet_SketcherMgr.h +++ b/src/PartSet/PartSet_SketcherMgr.h @@ -9,6 +9,8 @@ #include "PartSet.h" +#include "PartSet_FilterInfinite.h" + #include #include #include @@ -283,6 +285,7 @@ private: CompositeFeaturePtr myCurrentSketch; Handle(ModuleBase_ShapeInPlaneFilter) myPlaneFilter; + Handle(PartSet_FilterInfinite) myFilterInfinite; FeatureToSelectionMap myCurrentSelection; bool myPreviousUpdateViewerEnabled;