//! Returns list of currently selected QModelIndexes
virtual ObjectPtr getSelectableObject(const Handle_SelectMgr_EntityOwner& theOwner) const = 0;
- //! Returns list of currently selected shapes and their owners (objects).
- //! Both lists are synchronized
- //! \param theList returning list of selected AIS objects
- //! \param theOwners list of objects
- virtual void selectedShapes(NCollection_List<TopoDS_Shape>& theList,
- std::list<ObjectPtr>& theOwners) const = 0;
-
//! Return the shape from the viewer presentation.
//! If the shape is equal to the shape of selected object, it returns an empty shape
//! \param thePrs a selected object
QList<ModuleBase_ViewerPrsPtr> aList = aSelection->getSelected(ModuleBase_ISelection::Viewer);
ModuleBase_ViewerPrsPtr aFirstValue = aList.size() > 0 ? aList.first() : ModuleBase_ViewerPrsPtr();
- //NCollection_List<TopoDS_Shape> aShapes;
- //std::list<ObjectPtr> aObjects;
- //aSelection->selectedShapes(aShapes, aObjects);
// if we have selection and use it
- //if (/*aShapes.Extent() > 0 && useSelectedShapes() &&*/ isValidSelectionCustom() {
if (aFirstValue.get() && isValidSelectionCustom(aFirstValue)) {
- //TopoDS_Shape aShape = aShapes.First();
- //ObjectPtr aObject = aObjects.front();
-
GeomShapePtr aGeomShape = aFirstValue->shape();
- TopoDS_Shape aShape = aGeomShape->impl<TopoDS_Shape>(); /// to find axis shape
- ObjectPtr aObject = aFirstValue->object(); /// to find owner
+ TopoDS_Shape aShape = aGeomShape->impl<TopoDS_Shape>();
+ ObjectPtr aObject = aFirstValue->object();
FeaturePtr aSelectedFeature = ModelAPI_Feature::feature(aObject);
bool anExternal = false;
return anObject;
}
-//**************************************************************
-void XGUI_Selection::selectedShapes(NCollection_List<TopoDS_Shape>& theList,
- std::list<ObjectPtr>& theOwners) const
-{
- theList.Clear();
- Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext();
- if (aContext.IsNull())
- return;
-
- for (aContext->InitSelected(); aContext->MoreSelected(); aContext->NextSelected()) {
- TopoDS_Shape aShape = aContext->SelectedShape();
- if (aShape.IsNull()) {
- aShape = findAxisShape(aContext->SelectedInteractive());
- }
- if (!aShape.IsNull()) {
- theList.Append(aShape);
- Handle(SelectMgr_EntityOwner) aEO = aContext->SelectedOwner();
- if (!aEO.IsNull()) {
- Handle(AIS_InteractiveObject) anObj =
- Handle(AIS_InteractiveObject)::DownCast(aEO->Selectable());
- ObjectPtr anObject = myWorkshop->displayer()->getObject(anObj);
- theOwners.push_back(anObject);
- }
- }
- }
-}
-
//**************************************************************
void XGUI_Selection::selectedOwners(SelectMgr_IndexedMapOfOwner& theSelectedOwners) const
{
/// \return a found object or NULL
ObjectPtr getSelectableObject(const Handle(SelectMgr_EntityOwner)& theOwner) const;
- //! Returns list of currently selected shapes
- virtual void selectedShapes(NCollection_List<TopoDS_Shape>& theShapes,
- std::list<ObjectPtr>& theOwners) const;
-
//! Returns list of currently selected owners
/// \return list of owners
void selectedOwners(SelectMgr_IndexedMapOfOwner& theSelectedOwners) const;