mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-14 13:30:48 +03:00
0032015: Visualization - Select3D_SensitiveTriangulation::myDetectedIdx is inaccessible
Added Select3D_SensitiveTriangulation::LastDetectedTriangle() property.
This commit is contained in:
@@ -254,6 +254,39 @@ void Select3D_SensitiveTriangulation::Swap (const Standard_Integer theIdx1,
|
||||
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
|
||||
// purpose : Checks whether the element with index theIdx overlaps the
|
||||
|
@@ -53,6 +53,29 @@ public:
|
||||
const Handle(TColStd_HArray1OfInteger)& theFreeEdges,
|
||||
const gp_Pnt& theCOG,
|
||||
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
|
||||
Standard_EXPORT virtual Standard_Integer NbSubElements() const Standard_OVERRIDE;
|
||||
@@ -118,7 +141,7 @@ private:
|
||||
Standard_Integer theElemIdx,
|
||||
Standard_Boolean theIsFullInside) Standard_OVERRIDE;
|
||||
|
||||
private:
|
||||
protected:
|
||||
|
||||
Handle(Poly_Triangulation) myTriangul;
|
||||
TopLoc_Location myInitLocation;
|
||||
|
Reference in New Issue
Block a user