1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-06 18:26:22 +03:00

0027819: Visualization - provide a possibility to redefine SelectMgr_SelectableObject::UpdateSelection

- SelectMgr_SelectableObject::UpdateSelection calls redefineable SelectMgr_SelectableObject::updateSelection
This commit is contained in:
vpa 2016-08-31 17:42:50 +03:00 committed by bugmaster
parent 26d9c83516
commit 21a2b7ccf4
4 changed files with 50 additions and 84 deletions

View File

@ -26,7 +26,6 @@ SelectMgr_RectangularFrustum.cxx
SelectMgr_RectangularFrustum.hxx SelectMgr_RectangularFrustum.hxx
SelectMgr_SelectableObject.cxx SelectMgr_SelectableObject.cxx
SelectMgr_SelectableObject.hxx SelectMgr_SelectableObject.hxx
SelectMgr_SelectableObject.lxx
SelectMgr_SelectableObjectSet.cxx SelectMgr_SelectableObjectSet.cxx
SelectMgr_SelectableObjectSet.hxx SelectMgr_SelectableObjectSet.hxx
SelectMgr_SelectableObjectTrsfPersSet.cxx SelectMgr_SelectableObjectTrsfPersSet.cxx

View File

@ -411,12 +411,12 @@ void SelectMgr_SelectableObject::SetZLayer (const Graphic3d_ZLayerId theLayerId)
} }
//======================================================================= //=======================================================================
//function : UpdateSelection //function : updateSelection
//purpose : Sets update status FULL to selections of the object. Must be //purpose : Sets update status FULL to selections of the object. Must be
// used as the only method of UpdateSelection from outer classes // used as the only method of UpdateSelection from outer classes
// to prevent BVH structures from being outdated. // to prevent BVH structures from being outdated.
//======================================================================= //=======================================================================
void SelectMgr_SelectableObject::UpdateSelection (const Standard_Integer theMode) void SelectMgr_SelectableObject::updateSelection (const Standard_Integer theMode)
{ {
if (theMode == -1) if (theMode == -1)
{ {

View File

@ -101,16 +101,28 @@ public:
Standard_EXPORT virtual Standard_Boolean HasSelection (const Standard_Integer theMode) const; Standard_EXPORT virtual Standard_Boolean HasSelection (const Standard_Integer theMode) const;
//! Begins the iteration scanning for sensitive primitives. //! Begins the iteration scanning for sensitive primitives.
void Init(); void Init()
{
mycurrent = 1;
}
//! Continues the iteration scanning for sensitive primitives. //! Continues the iteration scanning for sensitive primitives.
Standard_Boolean More() const; Standard_Boolean More() const
{
return mycurrent <= myselections.Length();
}
//! Continues the iteration scanning for sensitive primitives. //! Continues the iteration scanning for sensitive primitives.
void Next(); void Next()
{
mycurrent++;
}
//! Returns the current selection in this framework. //! Returns the current selection in this framework.
const Handle(SelectMgr_Selection)& CurrentSelection() const; const Handle(SelectMgr_Selection)& CurrentSelection() const
{
return myselections (mycurrent);
}
Standard_EXPORT void ResetTransformation() Standard_OVERRIDE; Standard_EXPORT void ResetTransformation() Standard_OVERRIDE;
@ -153,7 +165,10 @@ public:
//! Sets update status FULL to selections of the object. Must be used as the only method of UpdateSelection //! Sets update status FULL to selections of the object. Must be used as the only method of UpdateSelection
//! from outer classes to prevent BVH structures from being outdated. //! from outer classes to prevent BVH structures from being outdated.
Standard_EXPORT void UpdateSelection (const Standard_Integer theMode = -1); void UpdateSelection (const Standard_Integer theMode = -1)
{
updateSelection (theMode);
}
//! Returns bounding box of selectable object //! Returns bounding box of selectable object
//! by storing its minimum and maximum 3d coordinates //! by storing its minimum and maximum 3d coordinates
@ -164,7 +179,10 @@ public:
Standard_EXPORT virtual void SetAttributes (const Handle(Prs3d_Drawer)& theDrawer); Standard_EXPORT virtual void SetAttributes (const Handle(Prs3d_Drawer)& theDrawer);
//! Returns the attributes settings. //! Returns the attributes settings.
const Handle(Prs3d_Drawer)& Attributes() const; const Handle(Prs3d_Drawer)& Attributes() const
{
return myDrawer;
}
//! Clears settings provided by the drawing tool theDrawer. //! Clears settings provided by the drawing tool theDrawer.
Standard_EXPORT virtual void UnsetAttributes(); Standard_EXPORT virtual void UnsetAttributes();
@ -173,7 +191,10 @@ public:
Standard_EXPORT virtual void SetHilightAttributes (const Handle(Prs3d_Drawer)& theDrawer); Standard_EXPORT virtual void SetHilightAttributes (const Handle(Prs3d_Drawer)& theDrawer);
//! Returns the hilight attributes settings. //! Returns the hilight attributes settings.
const Handle(Prs3d_Drawer)& HilightAttributes() const; const Handle(Prs3d_Drawer)& HilightAttributes() const
{
return myHilightDrawer;
}
//! Clears settings provided by the hilight drawing tool theDrawer. //! Clears settings provided by the hilight drawing tool theDrawer.
Standard_EXPORT virtual void UnsetHilightAttributes(); Standard_EXPORT virtual void UnsetHilightAttributes();
@ -192,7 +213,10 @@ public:
Standard_EXPORT Bnd_Box BndBoxOfSelected (Handle(SelectMgr_IndexedMapOfOwner)& theOwners); Standard_EXPORT Bnd_Box BndBoxOfSelected (Handle(SelectMgr_IndexedMapOfOwner)& theOwners);
//! Returns the mode for selection of object as a whole //! Returns the mode for selection of object as a whole
inline Standard_Integer GlobalSelectionMode() const; Standard_Integer GlobalSelectionMode() const
{
return myGlobalSelMode;
}
//! Returns the owner of mode for selection of object as a whole //! Returns the owner of mode for selection of object as a whole
Standard_EXPORT virtual Handle(SelectMgr_EntityOwner) GlobalSelOwner() const; Standard_EXPORT virtual Handle(SelectMgr_EntityOwner) GlobalSelOwner() const;
@ -205,34 +229,29 @@ friend class SelectMgr_SelectionManager;
protected: protected:
Standard_EXPORT SelectMgr_SelectableObject(const PrsMgr_TypeOfPresentation3d aTypeOfPresentation3d = PrsMgr_TOP_AllView); Standard_EXPORT SelectMgr_SelectableObject(const PrsMgr_TypeOfPresentation3d aTypeOfPresentation3d = PrsMgr_TOP_AllView);
inline void setGlobalSelMode (const Standard_Integer theMode); void setGlobalSelMode (const Standard_Integer theMode)
{
myGlobalSelMode = theMode > 0 ? theMode : 0;
}
Standard_EXPORT virtual void updateSelection (const Standard_Integer theMode);
protected:
SelectMgr_SequenceOfSelection myselections; SelectMgr_SequenceOfSelection myselections;
Handle(Prs3d_Drawer) myDrawer; Handle(Prs3d_Drawer) myDrawer;
Handle(Prs3d_Drawer) myHilightDrawer; Handle(Prs3d_Drawer) myHilightDrawer;
Handle(SelectMgr_EntityOwner) myAssemblyOwner; Handle(SelectMgr_EntityOwner) myAssemblyOwner;
Standard_Boolean myAutoHilight;
private: private:
Standard_Integer mycurrent; Standard_Integer mycurrent;
Standard_Boolean myAutoHilight;
Handle(Prs3d_Presentation) mySelectionPrs; Handle(Prs3d_Presentation) mySelectionPrs;
Handle(Prs3d_Presentation) myHilightPrs; Handle(Prs3d_Presentation) myHilightPrs;
Standard_Integer myGlobalSelMode; Standard_Integer myGlobalSelMode;
}; };
#include <SelectMgr_SelectableObject.lxx>
#endif // _SelectMgr_SelectableObject_HeaderFile #endif // _SelectMgr_SelectableObject_HeaderFile

View File

@ -1,52 +0,0 @@
// Copyright (c) 1998-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
inline void SelectMgr_SelectableObject::Init()
{mycurrent=1;}
inline Standard_Boolean SelectMgr_SelectableObject::More() const
{return (mycurrent<=myselections.Length());}
inline void SelectMgr_SelectableObject::Next()
{mycurrent++;}
inline const Handle(SelectMgr_Selection)& SelectMgr_SelectableObject::
CurrentSelection() const
{return myselections(mycurrent);}
inline const Handle(Prs3d_Drawer)& SelectMgr_SelectableObject::
Attributes() const
{return myDrawer;}
inline const Handle(Prs3d_Drawer)& SelectMgr_SelectableObject::
HilightAttributes() const
{return myHilightDrawer;}
//=======================================================================
//function : GlobalSelectionMode
//purpose :
//=======================================================================
inline Standard_Integer SelectMgr_SelectableObject::GlobalSelectionMode() const
{
return myGlobalSelMode;
}
//=======================================================================
//function : setGlobalSelMode
//purpose :
//=======================================================================
inline void SelectMgr_SelectableObject::setGlobalSelMode (const Standard_Integer theMode)
{
myGlobalSelMode = theMode > 0 ? theMode : 0;
}