PartSet_OperationSketch* aSketchOp = dynamic_cast<PartSet_OperationSketch*>(aPreviewOp);
if (aSketchOp) {
if (aSketchOp->isEditOperation()) {
- aDisplayer->openLocalContext();
- //setSketchingMode();
+ setSketchingMode();
} else {
aDisplayer->openLocalContext();
- aDisplayer->activateObjectsOutOfContext();
+ aDisplayer->activateObjectsOutOfContext(QIntList());
myPlaneFilter = new StdSelect_FaceFilter(StdSelect_Plane);
aDisplayer->addSelectionFilter(myPlaneFilter);
QIntList aModes = sketchSelectionModes(aPreviewOp->feature());
//aModes << TopAbs_VERTEX << TopAbs_EDGE;
//aModes << AIS_DSM_Text << AIS_DSM_Line;
aDisplayer->setSelectionModes(aModes);
+ aDisplayer->openLocalContext();
+ // Get default selection modes
+ aModes = sketchSelectionModes(ObjectPtr());
+ aDisplayer->activateObjectsOutOfContext(aModes);
}
void PartSet_Module::onFeatureConstructed(ObjectPtr theFeature, int theMode)
}
}
-void XGUI_Displayer::activateObjectsOutOfContext()
+void XGUI_Displayer::activateObjectsOutOfContext(const QIntList& theModes)
{
Handle(AIS_InteractiveContext) aContext = AISContext();
// Open local context if there is no one
for (aIt = myResult2AISObjectMap.begin(); aIt != myResult2AISObjectMap.end(); aIt++) {
anAISIO = (*aIt).second->impl<Handle(AIS_InteractiveObject)>();
aContext->Load(anAISIO, -1, true);
+ if (theModes.size() == 0)
+ aContext->Activate(anAISIO);
+ else {
+ foreach(int aMode, theModes) {
+ aContext->Activate(anAISIO, aMode);
+ }
+ }
}
}
/// \param isUpdateViewer the parameter whether the viewer should be update immediatelly
void eraseDeletedResults(const bool isUpdateViewer = true);
+ /// Opens local context. Does nothing if it is already opened.
void openLocalContext();
/// Deactivates selection of sub-shapes
void deactivate(ObjectPtr theFeature);
/// Activates the given object (it can be selected)
+ /// \param theModes - modes on which it has to be activated (can be empty)
void activate(ObjectPtr theFeature, const QIntList& theModes);
/// Returns true if the given object can be selected
bool isActive(ObjectPtr theObject) const;
/// Activates in local context displayed outside of the context.
- /// \param theModes - selection modes to activate
- /// \param theFilter - filter for selection
- void activateObjectsOutOfContext();
+ /// \param theModes - modes on which it has to be activated (can be empty)
+ void activateObjectsOutOfContext(const QIntList& theModes);
+ /// Activates in local context displayed outside of the context.
void deactivateObjectsOutOfContext();
/// Sets display mode for the given object if this object is displayed
{
XGUI_Displayer* aDisp = myWorkshop->displayer();
aDisp->openLocalContext();
- aDisp->activateObjectsOutOfContext();
+ // Use empty list because we will use standard modes
+ aDisp->activateObjectsOutOfContext(QIntList());
aDisp->setSelectionModes(theTypes);
}