ModuleBase_IWorkshop.h
ModuleBase_Definitions.h
ModuleBase_SelectionValidator.h
- ModuleBase_ISelection.h
ModuleBase_ViewerPrs.h
ModuleBase_WidgetChoice.h
ModuleBase_WidgetFileSelector.h
ModuleBase_DoubleSpinBox.h
ModuleBase_IPropertyPanel.h
+ ModuleBase_ISelection.h
ModuleBase_IViewer.h
ModuleBase_WidgetLineEdit.h
ModuleBase_WidgetMultiSelector.h
ModuleBase_FilterValidated.cpp
ModuleBase_Tools.cpp
ModuleBase_IModule.cpp
+ ModuleBase_ISelection.cpp
ModuleBase_IWorkshop.cpp
ModuleBase_Operation.cpp
ModuleBase_OperationDescription.cpp
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+#include "ModuleBase_ISelection.h"
+
+QList<ModuleBase_ViewerPrs> ModuleBase_ISelection::getViewerPrs(const QObjectPtrList& theObjects)
+{
+ QList<ModuleBase_ViewerPrs> aSelectedPrs;
+ QObjectPtrList::const_iterator anIt = theObjects.begin(), aLast = theObjects.end();
+ for (; anIt != aLast; anIt++) {
+ ObjectPtr anObject = *anIt;
+ if (anObject.get() != NULL) {
+ aSelectedPrs.append(ModuleBase_ViewerPrs(anObject, TopoDS_Shape(), NULL));
+ }
+ }
+ return aSelectedPrs;
+}
virtual void selectedShapes(NCollection_List<TopoDS_Shape>& theList,
std::list<ObjectPtr>& theOwners) const = 0;
+ //! Wraps the object list into the viewer prs list
+ //! \param theObjects a list of objects
+ //! \return a list of prs, where only object is not empty
+ static MODULEBASE_EXPORT QList<ModuleBase_ViewerPrs> getViewerPrs(
+ const QObjectPtrList& theObjects);
};
#endif
if (aSelectedPrs.empty()) {
// the selection in Object Browser
QObjectPtrList anObjects = theSelection->selectedObjects();
- QObjectPtrList::const_iterator anIt = anObjects.begin(), aLast = anObjects.end();
- for (; anIt != aLast; anIt++) {
- ObjectPtr anObject = *anIt;
- if (anObject.get() != NULL) {
- aSelectedPrs.append(ModuleBase_ViewerPrs(anObject, TopoDS_Shape(), NULL));
- }
- }
+ aSelectedPrs = ModuleBase_ISelection::getViewerPrs(anObjects);
}
return aSelectedPrs;
}
return aModes.Extent() > 0;
}
-void XGUI_Displayer::setSelected(const QObjectPtrList& theResults, const bool isUpdateViewer)
-{
- Handle(AIS_InteractiveContext) aContext = AISContext();
- if (aContext.IsNull())
- return;
- if (aContext->HasOpenedContext()) {
- aContext->UnhilightSelected();
- aContext->ClearSelected();
- foreach(ObjectPtr aResult, theResults) {
- if (isVisible(aResult)) {
- AISObjectPtr anObj = myResult2AISObjectMap[aResult];
- Handle(AIS_InteractiveObject) anAIS = anObj->impl<Handle(AIS_InteractiveObject)>();
- if (!anAIS.IsNull()) {
- // The methods are replaced in order to provide multi-selection, e.g. restore selection
- // by activating multi selector widget. It also gives an advantage that the multi
- // selection in OB gives multi-selection in the viewer
- //aContext->SetSelected(anAIS, false);
- // The selection in the context was cleared, so the method sets the objects are selected
- aContext->AddOrRemoveSelected(anAIS, false);
- }
- }
- }
- } else {
- aContext->UnhilightCurrents();
- aContext->ClearCurrents();
- foreach(ObjectPtr aResult, theResults) {
- if (isVisible(aResult)) {
- AISObjectPtr anObj = myResult2AISObjectMap[aResult];
- Handle(AIS_InteractiveObject) anAIS = anObj->impl<Handle(AIS_InteractiveObject)>();
- if (!anAIS.IsNull())
- aContext->SetCurrentObject(anAIS, false);
- }
- }
- }
- if (isUpdateViewer)
- updateViewer();
-}
-
void XGUI_Displayer::setSelected(const QList<ModuleBase_ViewerPrs>& theValues, bool isUpdateViewer)
{
Handle(AIS_InteractiveContext) aContext = AISContext();