mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +03:00
0032015: Visualization - Select3D_SensitiveTriangulation::myDetectedIdx is inaccessible
Added Select3D_SensitiveTriangulation::LastDetectedTriangle() property.
This commit is contained in:
parent
b81b237fa4
commit
73dc2d3ae5
@ -254,6 +254,39 @@ void Select3D_SensitiveTriangulation::Swap (const Standard_Integer theIdx1,
|
|||||||
myBVHPrimIndexes->ChangeValue (theIdx2) = anElemIdx1;
|
myBVHPrimIndexes->ChangeValue (theIdx2) = anElemIdx1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
// function : LastDetectedTriangle
|
||||||
|
// purpose :
|
||||||
|
//=======================================================================
|
||||||
|
bool Select3D_SensitiveTriangulation::LastDetectedTriangle (Poly_Triangle& theTriangle) const
|
||||||
|
{
|
||||||
|
const Standard_Integer anIndex = LastDetectedTriangleIndex();
|
||||||
|
if (anIndex != -1)
|
||||||
|
{
|
||||||
|
theTriangle = myTriangul->Triangle (anIndex);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
// function : LastDetectedTriangle
|
||||||
|
// purpose :
|
||||||
|
//=======================================================================
|
||||||
|
bool Select3D_SensitiveTriangulation::LastDetectedTriangle (Poly_Triangle& theTriangle,
|
||||||
|
gp_Pnt theTriNodes[3]) const
|
||||||
|
{
|
||||||
|
if (!LastDetectedTriangle (theTriangle))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
theTriNodes[0] = myTriangul->Nodes().Value (theTriangle.Value (1)).Transformed (myInitLocation.Transformation());;
|
||||||
|
theTriNodes[1] = myTriangul->Nodes().Value (theTriangle.Value (2)).Transformed (myInitLocation.Transformation());;
|
||||||
|
theTriNodes[2] = myTriangul->Nodes().Value (theTriangle.Value (3)).Transformed (myInitLocation.Transformation());;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
// function : overlapsElement
|
// function : overlapsElement
|
||||||
// purpose : Checks whether the element with index theIdx overlaps the
|
// purpose : Checks whether the element with index theIdx overlaps the
|
||||||
|
@ -53,6 +53,29 @@ public:
|
|||||||
const Handle(TColStd_HArray1OfInteger)& theFreeEdges,
|
const Handle(TColStd_HArray1OfInteger)& theFreeEdges,
|
||||||
const gp_Pnt& theCOG,
|
const gp_Pnt& theCOG,
|
||||||
const Standard_Boolean theIsInterior);
|
const Standard_Boolean theIsInterior);
|
||||||
|
public:
|
||||||
|
|
||||||
|
//! Get last detected triangle.
|
||||||
|
//! @param theTriangle [out] triangle node indexes
|
||||||
|
//! @return TRUE if defined
|
||||||
|
Standard_EXPORT bool LastDetectedTriangle (Poly_Triangle& theTriangle) const;
|
||||||
|
|
||||||
|
//! Get last detected triangle.
|
||||||
|
//! @param theTriangle [out] triangle node indexes
|
||||||
|
//! @param theTriNodes [out] triangle nodes (with pre-applied transformation)
|
||||||
|
//! @return TRUE if defined
|
||||||
|
Standard_EXPORT bool LastDetectedTriangle (Poly_Triangle& theTriangle,
|
||||||
|
gp_Pnt theTriNodes[3]) const;
|
||||||
|
|
||||||
|
//! Return index of last detected triangle within [1..NbTris] range, or -1 if undefined.
|
||||||
|
Standard_Integer LastDetectedTriangleIndex() const
|
||||||
|
{
|
||||||
|
return (myDetectedIdx != -1 && mySensType == Select3D_TOS_INTERIOR && !myBVHPrimIndexes.IsNull())
|
||||||
|
? myBVHPrimIndexes->Value (myDetectedIdx) + 1
|
||||||
|
: -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
//! Returns the amount of nodes in triangulation
|
//! Returns the amount of nodes in triangulation
|
||||||
Standard_EXPORT virtual Standard_Integer NbSubElements() const Standard_OVERRIDE;
|
Standard_EXPORT virtual Standard_Integer NbSubElements() const Standard_OVERRIDE;
|
||||||
@ -118,7 +141,7 @@ private:
|
|||||||
Standard_Integer theElemIdx,
|
Standard_Integer theElemIdx,
|
||||||
Standard_Boolean theIsFullInside) Standard_OVERRIDE;
|
Standard_Boolean theIsFullInside) Standard_OVERRIDE;
|
||||||
|
|
||||||
private:
|
protected:
|
||||||
|
|
||||||
Handle(Poly_Triangulation) myTriangul;
|
Handle(Poly_Triangulation) myTriangul;
|
||||||
TopLoc_Location myInitLocation;
|
TopLoc_Location myInitLocation;
|
||||||
|
@ -60,6 +60,7 @@
|
|||||||
#include <Prs3d_PointAspect.hxx>
|
#include <Prs3d_PointAspect.hxx>
|
||||||
#include <Select3D_SensitiveWire.hxx>
|
#include <Select3D_SensitiveWire.hxx>
|
||||||
#include <Select3D_SensitivePrimitiveArray.hxx>
|
#include <Select3D_SensitivePrimitiveArray.hxx>
|
||||||
|
#include <Select3D_SensitiveTriangulation.hxx>
|
||||||
#include <SelectMgr_EntityOwner.hxx>
|
#include <SelectMgr_EntityOwner.hxx>
|
||||||
#include <StdSelect_BRepOwner.hxx>
|
#include <StdSelect_BRepOwner.hxx>
|
||||||
#include <StdSelect_ViewerSelector3d.hxx>
|
#include <StdSelect_ViewerSelector3d.hxx>
|
||||||
@ -5514,30 +5515,32 @@ static Standard_Integer VState (Draw_Interpretor& theDI,
|
|||||||
<< " (" << anEntity->DynamicType()->Name() << ")"
|
<< " (" << anEntity->DynamicType()->Name() << ")"
|
||||||
<< "\n";
|
<< "\n";
|
||||||
|
|
||||||
Handle(StdSelect_BRepOwner) aBRepOwner = Handle(StdSelect_BRepOwner)::DownCast (anOwner);
|
if (Handle(StdSelect_BRepOwner) aBRepOwner = Handle(StdSelect_BRepOwner)::DownCast (anOwner))
|
||||||
if (!aBRepOwner.IsNull())
|
|
||||||
{
|
{
|
||||||
theDI << " Detected Shape: "
|
theDI << " Detected Shape: "
|
||||||
<< aBRepOwner->Shape().TShape()->DynamicType()->Name()
|
<< aBRepOwner->Shape().TShape()->DynamicType()->Name()
|
||||||
<< "\n";
|
<< "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
Handle(Select3D_SensitiveWire) aWire = Handle(Select3D_SensitiveWire)::DownCast (anEntity);
|
if (Handle(Select3D_SensitiveWire) aWire = Handle(Select3D_SensitiveWire)::DownCast (anEntity))
|
||||||
if (!aWire.IsNull())
|
|
||||||
{
|
{
|
||||||
Handle(Select3D_SensitiveEntity) aSen = aWire->GetLastDetected();
|
Handle(Select3D_SensitiveEntity) aSen = aWire->GetLastDetected();
|
||||||
theDI << " Detected Child: "
|
theDI << " Detected Child: "
|
||||||
<< aSen->DynamicType()->Name()
|
<< aSen->DynamicType()->Name()
|
||||||
<< "\n";
|
<< "\n";
|
||||||
}
|
}
|
||||||
|
else if (Handle(Select3D_SensitivePrimitiveArray) aPrimArr = Handle(Select3D_SensitivePrimitiveArray)::DownCast (anEntity))
|
||||||
Handle(Select3D_SensitivePrimitiveArray) aPrimArr = Handle(Select3D_SensitivePrimitiveArray)::DownCast (anEntity);
|
|
||||||
if (!aPrimArr.IsNull())
|
|
||||||
{
|
{
|
||||||
theDI << " Detected Element: "
|
theDI << " Detected Element: "
|
||||||
<< aPrimArr->LastDetectedElement()
|
<< aPrimArr->LastDetectedElement()
|
||||||
<< "\n";
|
<< "\n";
|
||||||
}
|
}
|
||||||
|
else if (Handle(Select3D_SensitiveTriangulation) aTriSens = Handle(Select3D_SensitiveTriangulation)::DownCast (anEntity))
|
||||||
|
{
|
||||||
|
theDI << " Detected Triangle: "
|
||||||
|
<< aTriSens->LastDetectedTriangleIndex()
|
||||||
|
<< "\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user