Using infinite state to do not select inifinte objects(construction plane, axis).
isCustomized = thePrs->setLineStyle(3) || isCustomized;
isCustomized = thePrs->setWidth(2) || isCustomized;
+ thePrs->setInfiniteState(true);
+
return isCustomized;
}
return isChanged;
}
+bool GeomAPI_AISObject::setInfiniteState(const bool theState)
+{
+ bool isChanged = false;
+ Handle(AIS_InteractiveObject) anAIS = impl<Handle(AIS_InteractiveObject)>();
+ 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)
{
/// \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);
PartSet_WidgetShapeSelector.h
PartSet_WidgetFileSelector.h
PartSet_Filters.h
+ PartSet_FilterInfinite.h
PartSet_SketcherMgr.h
PartSet_MenuMgr.h
PartSet_DocumentDataModel.h
PartSet_WidgetShapeSelector.cpp
PartSet_WidgetFileSelector.cpp
PartSet_Filters.cpp
+ PartSet_FilterInfinite.cpp
PartSet_SketcherMgr.cpp
PartSet_MenuMgr.cpp
PartSet_DocumentDataModel.cpp
--- /dev/null
+// 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 <AIS_InteractiveObject.hxx>
+
+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;
+}
--- /dev/null
+// 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 <ModuleBase_ViewerFilters.h>
+
+#include <SelectMgr_Filter.hxx>
+
+/**
+* \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
{
if (!myPlaneFilter.IsNull())
myPlaneFilter.Nullify();
+ if (!myFilterInfinite.IsNull())
+ myFilterInfinite.Nullify();
+
}
void PartSet_SketcherMgr::onEnterViewPort()
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;
}
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
// The sketch was aborted
myCurrentSketch = CompositeFeaturePtr();
myModule->workshop()->viewer()->removeSelectionFilter(myPlaneFilter);
+ myModule->workshop()->viewer()->removeSelectionFilter(myFilterInfinite);
// Erase all sketcher objects
QStringList aSketchIds = sketchOperationIdList();
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
#include "PartSet.h"
+#include "PartSet_FilterInfinite.h"
+
#include <ModelAPI_Feature.h>
#include <ModelAPI_Attribute.h>
#include <ModelAPI_CompositeFeature.h>
CompositeFeaturePtr myCurrentSketch;
Handle(ModuleBase_ShapeInPlaneFilter) myPlaneFilter;
+ Handle(PartSet_FilterInfinite) myFilterInfinite;
FeatureToSelectionMap myCurrentSelection;
bool myPreviousUpdateViewerEnabled;