#include <GeomAPI_AISObject.h>
#include <AIS_Shape.hxx>
+#include <StdSelect_FaceFilter.hxx>
+#include <StdSelect_TypeOfFace.hxx>
+
#include <QObject>
#include <QMouseEvent>
#include <QString>
void PartSet_Module::onCloseLocalContext()
{
XGUI_Displayer* aDisplayer = myWorkshop->displayer();
+ aDisplayer->deactivateObjectsOutOfContext();
aDisplayer->closeLocalContexts();
}
XGUI_Displayer* aDisplayer = myWorkshop->displayer();
std::list<int> aModes = aPreviewOp->getSelectionModes(theFeature);
aDisplayer->activateInLocalContext(theFeature, aModes, isUpdateViewer);
+
+ // If this is a Sketcher then activate objects (planar faces) outside of context
+ PartSet_OperationSketch* aSketchOp = dynamic_cast<PartSet_OperationSketch*>(aPreviewOp);
+ if (aSketchOp) {
+ Handle(StdSelect_FaceFilter) aFilter = new StdSelect_FaceFilter(StdSelect_Plane);
+ aDisplayer->activateObjectsOutOfContext(aModes, aFilter);
+ }
}
}
if (theSelected.size() == 1) {
ObjectPtr aObject = theSelected.front().object();
if (aObject) {
- FeaturePtr aFeature = ModelAPI_Feature::feature(aObject);
- if (aFeature) {
- QStringList aNested = this->nestedFeatures();
- if ((!aNested.isEmpty()) && aNested.contains(QString(aFeature->getKind().c_str()))) {
- restartOperation(PartSet_OperationFeatureEdit::Type(), aObject);
- }
- }
+ restartOperation(PartSet_OperationFeatureEdit::Type(), aObject);
}
}
}
{
PartSet_OperationSketchBase* aPreviewOp = dynamic_cast<PartSet_OperationSketchBase*>(theOperation);
return aPreviewOp != NULL;
-}
\ No newline at end of file
+}
+
void PartSet_OperationSketchBase::restartOperation(const std::string& theType, ObjectPtr theFeature)
{
+ FeaturePtr aFeature = ModelAPI_Feature::feature(theFeature);
+ if (aFeature) {
+ QStringList aNested = this->nestedFeatures();
+ if (!aNested.isEmpty()) {
+ if (aNested.contains(QString(aFeature->getKind().c_str())))
+ emit launchOperation(theType, theFeature);
+ else
+ return;
+ }
+ }
emit launchOperation(theType, theFeature);
}
#include <AIS_ListOfInteractive.hxx>
#include <AIS_ListIteratorOfListOfInteractive.hxx>
#include <AIS_DimensionSelectionMode.hxx>
-
#include <AIS_Shape.hxx>
#include <set>
// Open local context if there is no one
if (!aContext->HasOpenedContext()) {
aContext->ClearCurrents(false);
- aContext->OpenLocalContext(false/*use displayed objects*/, true/*allow shape decomposition*/);
- //aContext->OpenLocalContext();
- //aContext->NotUseDisplayedObjects();
+ //aContext->OpenLocalContext(false/*use displayed objects*/, true/*allow shape decomposition*/);
+ aContext->OpenLocalContext();
+ aContext->NotUseDisplayedObjects();
}
- //!!! Test
- //aContext->UseDisplayedObjects();
- //std::list<int>::const_iterator anIt = theModes.begin(), aLast = theModes.end();
- //for (; anIt != aLast; anIt++) {
- // aContext->ActivateStandardMode((TopAbs_ShapeEnum)(*anIt));
- //}
- //!!! Test end
// display or redisplay presentation
Handle(AIS_InteractiveObject) anAIS;
if (isVisible(theResult)) {
void XGUI_Displayer::closeLocalContexts(const bool isUpdateViewer)
{
+ AISContext()->ClearSelected(false);
closeAllContexts(true);
}
}
}
+void XGUI_Displayer::activateObjectsOutOfContext(const std::list<int>& theModes,
+ Handle(SelectMgr_Filter) theFilter)
+{
+ Handle(AIS_InteractiveContext) aContext = AISContext();
+ // Open local context if there is no one
+ if (!aContext->HasOpenedContext())
+ return;
+
+ aContext->UseDisplayedObjects();
+ std::list<int>::const_iterator anIt = theModes.begin(), aLast = theModes.end();
+ for (; anIt != aLast; anIt++) {
+ aContext->ActivateStandardMode((TopAbs_ShapeEnum)(*anIt));
+ }
+
+ if (!theFilter.IsNull())
+ aContext->AddFilter(theFilter);
+}
+
+
+void XGUI_Displayer::deactivateObjectsOutOfContext()
+{
+ Handle(AIS_InteractiveContext) aContext = AISContext();
+ // Open local context if there is no one
+ if (!aContext->HasOpenedContext())
+ return;
+
+ aContext->RemoveFilters();
+ aContext->NotUseDisplayedObjects();
+}
\ No newline at end of file
void activate(ObjectPtr theFeature);
+ /// Activates in local context displayed outside of the context.
+ /// \param theModes - selection modes to activate
+ /// \param theFilter - filter for selection
+ void activateObjectsOutOfContext(const std::list<int>& theModes,
+ Handle(SelectMgr_Filter) theFilter);
+
+ void deactivateObjectsOutOfContext();
+
protected:
/// Deactivate local selection
/// \param isUpdateViewer the state wether the viewer should be updated immediatelly