//! \param isEnabled new state of the viewer update
virtual bool enableUpdateViewer(bool isEnabled) = 0;
+ //! The methods applys current defined selection modes to given AIS presentation.
+ //! The AIS presentation has to be already displayed. After activation viewer has to be updated
+ //! \param theAIS the object which has to be activated
+ virtual void applyCurrentSelectionModes(const AISObjectPtr& theAIS) = 0;
+
signals:
/// Signal selection changed.
void selectionChanged();
Handle(AIS_InteractiveContext) aCtx = myWorkshop->viewer()->AISContext();
aCtx->Remove(myPreview, false);
myPreview.Nullify();
- if (myShowBtn->isChecked()) {
+ if (myListIO.Size() > 0) {
+ Handle(AIS_InteractiveContext) aCtx = myWorkshop->viewer()->AISContext();
AIS_ListOfInteractive::const_iterator aIt;
Handle(AIS_Shape) aShapeIO;
for (aIt = myListIO.cbegin(); aIt != myListIO.cend(); aIt++) {
aShapeIO = Handle(AIS_Shape)::DownCast(*aIt);
if (!aShapeIO.IsNull()) {
aCtx->Display(aShapeIO, false);
+ std::shared_ptr<GeomAPI_AISObject> anAISObj = AISObjectPtr(new GeomAPI_AISObject());
+ anAISObj->setImpl(new Handle(AIS_InteractiveObject)(aShapeIO));
+ myWorkshop->applyCurrentSelectionModes(anAISObj);
}
}
+ myListIO.Clear();
+ myShowBtn->setChecked(false);
}
aCtx->UpdateCurrentViewer();
}
if (!aShapeIO.IsNull()) {
if (theShow)
aCtx->Erase(aShapeIO, false);
- else
+ else {
aCtx->Display(aShapeIO, false);
+ std::shared_ptr<GeomAPI_AISObject> anAISObj = AISObjectPtr(new GeomAPI_AISObject());
+ anAISObj->setImpl(new Handle(AIS_InteractiveObject)(aShapeIO));
+ myWorkshop->applyCurrentSelectionModes(anAISObj);
+ }
}
}
aCtx->UpdateCurrentViewer();
void ModuleBase_WidgetSelectionFilter::onObjectUpdated()
{
+ myShowBtn->setChecked(false);
clearCurrentSelection(true);
updateNumberSelected();
updateObject(myFeature);
bool XGUI_ModuleConnector::enableUpdateViewer(bool isEnabled)
{
return myWorkshop->displayer()->enableUpdateViewer(isEnabled);
+}
+
+
+void XGUI_ModuleConnector::applyCurrentSelectionModes(const AISObjectPtr& theAIS)
+{
+ Handle(AIS_InteractiveObject) anIO = theAIS->impl<Handle(AIS_InteractiveObject)>();
+ myWorkshop->selectionActivate()->activate(anIO, false);
}
\ No newline at end of file
//! Returns workshop
XGUI_Workshop* workshop() const { return myWorkshop; }
+ //! The methods applys current defined selection modes to given AIS presentation.
+ //! The AIS presentation has to be already displayed. After activation viewer has to be updated
+ //! \param theAIS the object which has to be activated
+ virtual void applyCurrentSelectionModes(const AISObjectPtr& theAIS);
+
private:
QObjectPtrList activeObjects(const QObjectPtrList& theObjList) const;