mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +03:00
0032632: Visualization, AIS_ViewCube - the class AIS_ViewCubeSensitive is hidden inside CXX file
This commit is contained in:
parent
bcb2a742a7
commit
19da974edc
@ -27,13 +27,13 @@
|
|||||||
#include <Prs3d_Text.hxx>
|
#include <Prs3d_Text.hxx>
|
||||||
#include <Prs3d_ToolDisk.hxx>
|
#include <Prs3d_ToolDisk.hxx>
|
||||||
#include <Prs3d_ToolSphere.hxx>
|
#include <Prs3d_ToolSphere.hxx>
|
||||||
#include <Select3D_SensitivePrimitiveArray.hxx>
|
|
||||||
#include <SelectMgr_SequenceOfOwner.hxx>
|
#include <SelectMgr_SequenceOfOwner.hxx>
|
||||||
#include <V3d.hxx>
|
#include <V3d.hxx>
|
||||||
#include <V3d_View.hxx>
|
#include <V3d_View.hxx>
|
||||||
|
|
||||||
IMPLEMENT_STANDARD_RTTIEXT(AIS_ViewCube, AIS_InteractiveObject)
|
IMPLEMENT_STANDARD_RTTIEXT(AIS_ViewCube, AIS_InteractiveObject)
|
||||||
IMPLEMENT_STANDARD_RTTIEXT(AIS_ViewCubeOwner, SelectMgr_EntityOwner)
|
IMPLEMENT_STANDARD_RTTIEXT(AIS_ViewCubeOwner, SelectMgr_EntityOwner)
|
||||||
|
IMPLEMENT_STANDARD_RTTIEXT(AIS_ViewCubeSensitive, Select3D_SensitivePrimitiveArray)
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
@ -56,46 +56,48 @@ namespace
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Simple sensitive element for picking by point only.
|
//=======================================================================
|
||||||
class AIS_ViewCubeSensitive : public Select3D_SensitivePrimitiveArray
|
//function : AIS_ViewCubeSensitive
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
AIS_ViewCubeSensitive::AIS_ViewCubeSensitive (const Handle(SelectMgr_EntityOwner)& theOwner,
|
||||||
|
const Handle(Graphic3d_ArrayOfTriangles)& theTris)
|
||||||
|
: Select3D_SensitivePrimitiveArray (theOwner)
|
||||||
{
|
{
|
||||||
DEFINE_STANDARD_RTTI_INLINE(AIS_ViewCubeSensitive, Select3D_SensitivePrimitiveArray)
|
InitTriangulation (theTris->Attributes(), theTris->Indices(), TopLoc_Location());
|
||||||
public:
|
}
|
||||||
//! Constructor.
|
|
||||||
AIS_ViewCubeSensitive (const Handle(SelectMgr_EntityOwner)& theOwner,
|
//=======================================================================
|
||||||
const Handle(Graphic3d_ArrayOfTriangles)& theTris)
|
//function : Matches
|
||||||
: Select3D_SensitivePrimitiveArray (theOwner)
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
Standard_Boolean AIS_ViewCubeSensitive::Matches (SelectBasics_SelectingVolumeManager& theMgr,
|
||||||
|
SelectBasics_PickResult& thePickResult)
|
||||||
|
{
|
||||||
|
return isValidRay (theMgr) && Select3D_SensitivePrimitiveArray::Matches (theMgr, thePickResult);
|
||||||
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : isValidRay
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
bool AIS_ViewCubeSensitive::isValidRay (const SelectBasics_SelectingVolumeManager& theMgr) const
|
||||||
|
{
|
||||||
|
if (theMgr.GetActiveSelectionType() != SelectMgr_SelectionType_Point)
|
||||||
{
|
{
|
||||||
InitTriangulation (theTris->Attributes(), theTris->Indices(), TopLoc_Location());
|
// disallow rectangular selection
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Checks whether element overlaps current selecting volume.
|
if (AIS_ViewCubeOwner* anOwner = dynamic_cast<AIS_ViewCubeOwner* >(myOwnerId.get()))
|
||||||
virtual Standard_Boolean Matches (SelectBasics_SelectingVolumeManager& theMgr,
|
|
||||||
SelectBasics_PickResult& thePickResult) Standard_OVERRIDE
|
|
||||||
{
|
{
|
||||||
return isValidRay (theMgr)
|
const Standard_Real anAngleToler = 10.0 * M_PI / 180.0;
|
||||||
&& Select3D_SensitivePrimitiveArray::Matches (theMgr, thePickResult);
|
const gp_Dir aRay = theMgr.GetViewRayDirection();
|
||||||
|
const gp_Dir aDir = V3d::GetProjAxis (anOwner->MainOrientation());
|
||||||
|
return !aRay.IsNormal (aDir, anAngleToler);
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
//! Checks if picking ray can be used for detection.
|
}
|
||||||
bool isValidRay (const SelectBasics_SelectingVolumeManager& theMgr) const
|
|
||||||
{
|
|
||||||
if (theMgr.GetActiveSelectionType() != SelectMgr_SelectionType_Point)
|
|
||||||
{
|
|
||||||
// disallow rectangular selection
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (AIS_ViewCubeOwner* anOwner = dynamic_cast<AIS_ViewCubeOwner* >(myOwnerId.get()))
|
|
||||||
{
|
|
||||||
const Standard_Real anAngleToler = 10.0 * M_PI / 180.0;
|
|
||||||
const gp_Dir aRay = theMgr.GetViewRayDirection();
|
|
||||||
const gp_Dir aDir = V3d::GetProjAxis (anOwner->MainOrientation());
|
|
||||||
return !aRay.IsNormal (aDir, anAngleToler);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : IsBoxSide
|
//function : IsBoxSide
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
#include <Prs3d_TextAspect.hxx>
|
#include <Prs3d_TextAspect.hxx>
|
||||||
#include <SelectMgr_EntityOwner.hxx>
|
#include <SelectMgr_EntityOwner.hxx>
|
||||||
#include <V3d_TypeOfOrientation.hxx>
|
#include <V3d_TypeOfOrientation.hxx>
|
||||||
|
#include <Select3D_SensitivePrimitiveArray.hxx>
|
||||||
|
|
||||||
class AIS_AnimationCamera;
|
class AIS_AnimationCamera;
|
||||||
class AIS_ViewCubeOwner;
|
class AIS_ViewCubeOwner;
|
||||||
@ -724,4 +725,25 @@ protected:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//! Simple sensitive element for picking by point only.
|
||||||
|
class AIS_ViewCubeSensitive : public Select3D_SensitivePrimitiveArray
|
||||||
|
{
|
||||||
|
DEFINE_STANDARD_RTTIEXT(AIS_ViewCubeSensitive, Select3D_SensitivePrimitiveArray)
|
||||||
|
public:
|
||||||
|
|
||||||
|
//! Constructor.
|
||||||
|
Standard_EXPORT AIS_ViewCubeSensitive (const Handle(SelectMgr_EntityOwner)& theOwner,
|
||||||
|
const Handle(Graphic3d_ArrayOfTriangles)& theTris);
|
||||||
|
|
||||||
|
//! Checks whether element overlaps current selecting volume.
|
||||||
|
Standard_EXPORT virtual Standard_Boolean Matches (SelectBasics_SelectingVolumeManager& theMgr,
|
||||||
|
SelectBasics_PickResult& thePickResult) Standard_OVERRIDE;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
//! Checks if picking ray can be used for detection.
|
||||||
|
Standard_EXPORT bool isValidRay (const SelectBasics_SelectingVolumeManager& theMgr) const;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
#endif // _AIS_ViewCube_HeaderFile
|
#endif // _AIS_ViewCube_HeaderFile
|
||||||
|
Loading…
x
Reference in New Issue
Block a user