PartSet_OperationSketchBase.h
PartSet_OperationSketch.h
PartSet_OperationFeatureBase.h
- PartSet_TestOCC.h
PartSet_Tools.h
PartSet_WidgetSketchLabel.h
PartSet_Validators.h
PartSet_OperationSketchBase.cpp
PartSet_OperationSketch.cpp
PartSet_OperationFeatureBase.cpp
- PartSet_TestOCC.cpp
PartSet_Tools.cpp
PartSet_WidgetSketchLabel.cpp
PartSet_Validators.cpp
// Very possible it is not displayed
aDisplayer->display(aObj, false);
std::list<int> aModes = aSketchOp->getSelectionModes(aObj);
- aDisplayer->activateInLocalContext(aObj, aModes, false);
+ myModule->activateInLocalContext(aObj, aModes, false);
}
}
std::list<ResultPtr>::iterator aIt;
for (aIt = aResults.begin(); aIt != aResults.end(); ++aIt) {
if (isDisplay)
- aDisplayer->activateInLocalContext((*aIt), aModes, false);
+ activateInLocalContext((*aIt), aModes, false);
else
aDisplayer->erase((*aIt), false);
}
if (aPreviewOp) {
XGUI_Displayer* aDisplayer = xWorkshop()->displayer();
std::list<int> aModes = aPreviewOp->getSelectionModes(theFeature);
- aDisplayer->activateInLocalContext(theFeature, aModes, isUpdateViewer);
+ 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);
std::list<ResultPtr>::const_iterator aRIt;
for (aRIt = aResults.cbegin(); aRIt != aResults.cend(); ++aRIt) {
aDisplayer->display((*aRIt), false);
- aDisplayer->activateInLocalContext((*aRIt), aModes, false);
+ activateInLocalContext((*aRIt), aModes, false);
}
aDisplayer->display(aSPFeature, false);
- aDisplayer->activateInLocalContext(aSPFeature, aModes, false);
+ activateInLocalContext(aSPFeature, aModes, false);
}
aDisplayer->updateViewer();
}
return aConnector->workshop();
}
return 0;
-}
\ No newline at end of file
+}
+
+
+void PartSet_Module::activateInLocalContext(ObjectPtr theResult, const std::list<int>& theModes,
+ const bool isUpdateViewer)
+{
+ XGUI_Displayer* aDisplayer = xWorkshop()->displayer();
+ Handle(AIS_InteractiveContext) aContext = xWorkshop()->viewer()->AISContext();
+ if (aContext.IsNull())
+ return;
+ // 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();
+ }
+ // display or redisplay presentation
+ boost::shared_ptr<GeomAPI_AISObject> anAIS = aDisplayer->getAISObject(theResult);
+ // Activate selection of objects from prs
+ if (anAIS) {
+ Handle(AIS_InteractiveObject) aAISObj = anAIS->impl<Handle(AIS_InteractiveObject)>();
+ aContext->ClearSelected(false); // ToCheck
+ //aContext->upClearSelected(false); // ToCheck
+ aContext->Load(aAISObj, -1, true/*allow decomposition*/);
+ aContext->Deactivate(aAISObj);
+
+ std::list<int>::const_iterator anIt = theModes.begin(), aLast = theModes.end();
+ for (; anIt != aLast; anIt++) {
+ aContext->Activate(aAISObj, (*anIt));
+ }
+ }
+
+ if (isUpdateViewer)
+ aDisplayer->updateViewer();
+}
XGUI_Workshop* xWorkshop() const;
+ /// Display the shape and activate selection of sub-shapes
+ /// \param theFeature a feature instance
+ /// \param theShape a shape
+ /// \param theMode a list of local selection modes
+ /// \param isUpdateViewer the parameter whether the viewer should be update immediatelly
+ void activateInLocalContext(ObjectPtr theFeature, const std::list<int>& theModes,
+ const bool isUpdateViewer = true);
+
public slots:
void onFeatureTriggered();
/// SLOT, that is called after the operation is started. Connect on the focus activated signal
}
}
-void XGUI_Displayer::activateInLocalContext(ObjectPtr theResult, const std::list<int>& theModes,
- const bool isUpdateViewer)
-{
- Handle(AIS_InteractiveContext) aContext = AISContext();
- if (aContext.IsNull())
- return;
- // 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();
- }
- // display or redisplay presentation
- Handle(AIS_InteractiveObject) anAIS;
- if (isVisible(theResult)) {
- boost::shared_ptr<GeomAPI_AISObject> anObj = myResult2AISObjectMap[theResult];
- if (anObj)
- anAIS = anObj->impl<Handle(AIS_InteractiveObject)>();
- }
-
- // Activate selection of objects from prs
- if (!anAIS.IsNull()) {
- aContext->ClearSelected(false); // ToCheck
- //aContext->upClearSelected(false); // ToCheck
- aContext->Load(anAIS, -1, true/*allow decomposition*/);
- aContext->Deactivate(anAIS);
-
- std::list<int>::const_iterator anIt = theModes.begin(), aLast = theModes.end();
- for (; anIt != aLast; anIt++) {
- aContext->Activate(anAIS, (*anIt));
- }
- }
-
- if (isUpdateViewer)
- updateViewer();
-}
-
void XGUI_Displayer::deactivate(ObjectPtr theObject)
{
if (isVisible(theObject)) {
/// Display the given AIS object. To hide this object use corresponde erase method
void display(boost::shared_ptr<GeomAPI_AISObject> theAIS, bool isUpdate = true);
- /// Redisplay the shape and activate selection of sub-shapes
- /// \param theFeature a feature instance
- /// \param isUpdateViewer the parameter whether the viewer should be update immediatelly
- //void redisplay(Handle(AIS_InteractiveObject) theAIS, const bool isUpdateViewer = true);
-
- /// Display the shape and activate selection of sub-shapes
- /// \param theFeature a feature instance
- /// \param theShape a shape
- /// \param theMode a list of local selection modes
- /// \param isUpdateViewer the parameter whether the viewer should be update immediatelly
- void activateInLocalContext(ObjectPtr theFeature, const std::list<int>& theModes,
- const bool isUpdateViewer = true);
-
/// Stop the current selection and color the given features to the selection color
/// \param theFeatures a list of features to be disabled
/// \param theToStop the boolean state whether it it stopped or non stopped