1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

0028778: Coding Rules - clean up confusing code from Select3D

This commit is contained in:
kgv
2017-05-23 19:05:41 +03:00
committed by bugmaster
parent 69f1a8997e
commit 0609d8ee53
37 changed files with 143 additions and 644 deletions

View File

@@ -3,7 +3,6 @@ Select3D_BVHIndexBuffer.hxx
Select3D_EntitySequence.hxx
Select3D_InteriorSensitivePointSet.cxx
Select3D_InteriorSensitivePointSet.hxx
Select3D_Macro.hxx
Select3D_Pnt.hxx
Select3D_PointData.hxx
Select3D_SensitiveBox.cxx
@@ -18,24 +17,20 @@ Select3D_SensitiveFace.cxx
Select3D_SensitiveFace.hxx
Select3D_SensitiveGroup.cxx
Select3D_SensitiveGroup.hxx
Select3D_SensitiveGroup.lxx
Select3D_SensitivePoint.cxx
Select3D_SensitivePoint.hxx
Select3D_SensitivePoly.cxx
Select3D_SensitivePoly.hxx
Select3D_SensitivePoly.lxx
Select3D_SensitivePrimitiveArray.cxx
Select3D_SensitivePrimitiveArray.hxx
Select3D_SensitiveSegment.cxx
Select3D_SensitiveSegment.hxx
Select3D_SensitiveSegment.lxx
Select3D_SensitiveSet.cxx
Select3D_SensitiveSet.hxx
Select3D_SensitiveTriangle.cxx
Select3D_SensitiveTriangle.hxx
Select3D_SensitiveTriangulation.cxx
Select3D_SensitiveTriangulation.hxx
Select3D_SensitiveTriangulation.lxx
Select3D_SensitiveWire.cxx
Select3D_SensitiveWire.hxx
Select3D_TypeOfSensitivity.hxx

View File

@@ -1,26 +0,0 @@
// 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.
#ifndef _Select3D_Macro_HeaderFile
#define _Select3D_Macro_HeaderFile
#include <Standard_ShortReal.hxx>
// Safe conversion of Standard_ShortReal(float) to Standard_Real(double)
inline Standard_ShortReal DToF (Standard_Real a)
{
return a > ShortRealLast() ? ShortRealLast() :
a < ShortRealFirst() ? ShortRealFirst() : (Standard_ShortReal)a;
}
#endif

View File

@@ -14,33 +14,23 @@
#ifndef _Select3D_Pnt_HeaderFile
#define _Select3D_Pnt_HeaderFile
#include<gp_Pnt.hxx>
#include<Standard_ShortReal.hxx>
#include<Select3D_Macro.hxx>
#include <gp_Pnt.hxx>
struct Select3D_Pnt{
struct Select3D_Pnt
{
Standard_ShortReal x, y, z;
Standard_ShortReal x, y, z;
inline operator gp_Pnt() const
{
return gp_Pnt(x, y, z);
}
operator gp_Pnt() const { return gp_Pnt(x, y, z); }
inline operator gp_XYZ() const
{
return gp_XYZ(x, y, z);
}
inline gp_Pnt operator = (const gp_Pnt& thePnt)
{
x = DToF(thePnt.X());
y = DToF(thePnt.Y());
z = DToF(thePnt.Z());
return *this;
}
operator gp_XYZ() const { return gp_XYZ(x, y, z); }
gp_Pnt operator= (const gp_Pnt& thePnt)
{
x = RealToShortReal (thePnt.X());
y = RealToShortReal (thePnt.Y());
z = RealToShortReal (thePnt.Z());
return *this;
}
};
#endif

View File

@@ -17,7 +17,8 @@
#include <Select3D_Pnt.hxx>
// A framework for safe management of Select3D_SensitivePoly polygons of 3D points
class Select3D_PointData {
class Select3D_PointData
{
public:
@@ -60,7 +61,7 @@ public:
// Returns 3D point from internal array
// if theIndex is valid
Select3D_Pnt Pnt (const Standard_Integer theIndex) const
const Select3D_Pnt& Pnt (const Standard_Integer theIndex) const
{
if (theIndex < 0 || theIndex >= mynbpoints)
throw Standard_OutOfRange("Select3D_PointData::Pnt");

View File

@@ -15,11 +15,6 @@
// commercial license or contractual agreement.
#include <Select3D_SensitiveBox.hxx>
#include <gp_Pnt2d.hxx>
#include <gp_Pnt.hxx>
#include <Bnd_Box.hxx>
#include <ElCLib.hxx>
IMPLEMENT_STANDARD_RTTIEXT(Select3D_SensitiveBox,Select3D_SensitiveEntity)
@@ -130,16 +125,3 @@ Select3D_BndBox3d Select3D_SensitiveBox::BoundingBox()
{
return myBox;
}
//=======================================================================
// function : Box
// purpose :
//=======================================================================
Bnd_Box Select3D_SensitiveBox::Box() const
{
Bnd_Box aBox;
aBox.Update (myBox.CornerMin().x(), myBox.CornerMin().y(), myBox.CornerMin().z(),
myBox.CornerMax().x(), myBox.CornerMax().y(), myBox.CornerMax().z());
return aBox;
}

View File

@@ -17,24 +17,13 @@
#ifndef _Select3D_SensitiveBox_HeaderFile
#define _Select3D_SensitiveBox_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <Standard_Type.hxx>
#include <Bnd_Box.hxx>
#include <gp_Pnt.hxx>
#include <Select3D_SensitiveEntity.hxx>
#include <SelectMgr_SelectingVolumeManager.hxx>
#include <Standard_OStream.hxx>
class SelectBasics_EntityOwner;
class Bnd_Box;
class TopLoc_Location;
//! A framework to define selection by a sensitive box.
class Select3D_SensitiveBox : public Select3D_SensitiveEntity
{
DEFINE_STANDARD_RTTIEXT(Select3D_SensitiveBox, Select3D_SensitiveEntity)
public:
//! Constructs a sensitive box object defined by the
@@ -64,7 +53,14 @@ public:
Standard_EXPORT virtual Standard_Boolean Matches (SelectBasics_SelectingVolumeManager& theMgr,
SelectBasics_PickResult& thePickResult) Standard_OVERRIDE;
Standard_EXPORT Bnd_Box Box() const;
Bnd_Box Box() const
{
Bnd_Box aBox;
aBox.Update (myBox.CornerMin().x(), myBox.CornerMin().y(), myBox.CornerMin().z(),
myBox.CornerMax().x(), myBox.CornerMax().y(), myBox.CornerMax().z());
return aBox;
}
//! Returns center of the box. If location
//! transformation is set, it will be applied
@@ -74,8 +70,6 @@ public:
//! transformation is set, it will be applied
Standard_EXPORT virtual Select3D_BndBox3d BoundingBox() Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT(Select3D_SensitiveBox,Select3D_SensitiveEntity)
private:
Select3D_BndBox3d myBox; //!< 3d coordinates of box corners

View File

@@ -14,44 +14,44 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <Geom_Circle.hxx>
#include <Select3D_Pnt.hxx>
#include <Select3D_SensitiveTriangle.hxx>
#include <Precision.hxx>
#include <Select3D_SensitiveCircle.hxx>
#include <Geom_Circle.hxx>
#include <Precision.hxx>
#include <Select3D_SensitiveTriangle.hxx>
IMPLEMENT_STANDARD_RTTIEXT(Select3D_SensitiveCircle,Select3D_SensitivePoly)
static Standard_Integer GetCircleNbPoints (const Handle(Geom_Circle)& theCircle,
const Standard_Integer theNbPnts)
namespace
{
// Check if number of points is invalid.
// In this case myPolyg raises Standard_ConstructionError
// exception (look constructor bellow).
if (theNbPnts <= 0)
return 0;
static Standard_Integer GetCircleNbPoints (const Handle(Geom_Circle)& theCircle,
const Standard_Integer theNbPnts)
{
// Check if number of points is invalid.
// In this case myPolyg raises Standard_ConstructionError
// exception (look constructor bellow).
if (theNbPnts <= 0)
return 0;
if (theCircle->Radius() > Precision::Confusion())
return 2 * theNbPnts + 1;
if (theCircle->Radius() > Precision::Confusion())
return 2 * theNbPnts + 1;
// The radius is too small and circle degenerates into point
return 1;
}
// The radius is too small and circle degenerates into point
return 1;
}
static Standard_Integer GetArcNbPoints (const Handle(Geom_Circle)& theCircle,
const Standard_Integer theNbPnts)
{
// There is no need to check number of points here.
// In case of invalid number of points this method returns
// -1 or smaller value.
if (theCircle->Radius() > Precision::Confusion())
return 2 * theNbPnts - 1;
static Standard_Integer GetArcNbPoints (const Handle(Geom_Circle)& theCircle,
const Standard_Integer theNbPnts)
{
// There is no need to check number of points here.
// In case of invalid number of points this method returns
// -1 or smaller value.
if (theCircle->Radius() > Precision::Confusion())
return 2 * theNbPnts - 1;
// The radius is too small and circle degenerates into point
return 1;
// The radius is too small and circle degenerates into point
return 1;
}
}
//=======================================================================

View File

@@ -14,17 +14,10 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
// Modified Tue Apr 14 1998 by rob : fix Bug : Case of Null Radius Circle...
#ifndef _Select3D_SensitiveCircle_HeaderFile
#define _Select3D_SensitiveCircle_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <Standard_Type.hxx>
#include <Select3D_SensitivePoly.hxx>
#include <Select3D_Pnt.hxx>
#include <TColgp_HArray1OfPnt.hxx>
#include <SelectMgr_SelectingVolumeManager.hxx>
#include <Select3D_TypeOfSensitivity.hxx>
@@ -32,16 +25,13 @@
class Geom_Circle;
class Standard_ConstructionError;
class Standard_OutOfRange;
class SelectBasics_EntityOwner;
class gp_Pnt;
class TopLoc_Location;
//! A framework to define sensitive 3D arcs and circles.
//! In some cases this class can raise Standard_ConstructionError and
//! Standard_OutOfRange exceptions. For more details see Select3D_SensitivePoly.
class Select3D_SensitiveCircle : public Select3D_SensitivePoly
{
DEFINE_STANDARD_RTTIEXT(Select3D_SensitiveCircle, Select3D_SensitivePoly)
public:
//! Constructs the sensitive circle object defined by the
@@ -99,8 +89,6 @@ public:
//! Builds BVH tree for a circle's edge segments if needed
Standard_EXPORT virtual void BVH() Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT(Select3D_SensitiveCircle,Select3D_SensitivePoly)
protected:
//! Calculates distance from the 3d projection of used-picked screen point
@@ -114,11 +102,11 @@ private:
private:
Select3D_TypeOfSensitivity mySensType; //!< True if type of selection is interior, false otherwise
gp_Pnt myCenter3D; //!< Center of a circle
Handle(Geom_Circle) myCircle; //!< Points of the circle
Standard_Real myStart; //!< Sensitive arc parameter
Standard_Real myEnd; //!< Sensitive arc parameter
Select3D_TypeOfSensitivity mySensType; //!< True if type of selection is interior, false otherwise
gp_Pnt myCenter3D; //!< Center of a circle
Handle(Geom_Circle) myCircle; //!< Points of the circle
Standard_Real myStart; //!< Sensitive arc parameter
Standard_Real myEnd; //!< Sensitive arc parameter
};
DEFINE_STANDARD_HANDLE(Select3D_SensitiveCircle, Select3D_SensitivePoly)

View File

@@ -17,31 +17,20 @@
#ifndef _Select3D_SensitiveCurve_HeaderFile
#define _Select3D_SensitiveCurve_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <Standard_Type.hxx>
#include <Geom_Curve.hxx>
#include <Select3D_SensitivePoly.hxx>
#include <TColgp_HArray1OfPnt.hxx>
#include <Standard_Boolean.hxx>
#include <SelectMgr_SelectingVolumeManager.hxx>
#include <Standard_Real.hxx>
#include <Standard_OStream.hxx>
class Geom_Curve;
class Standard_ConstructionError;
class Standard_OutOfRange;
class SelectBasics_EntityOwner;
class Select3D_SensitiveEntity;
class TopLoc_Location;
//! A framework to define a sensitive 3D curve.
//! In some cases this class can raise Standard_ConstructionError and
//! Standard_OutOfRange exceptions. For more details see Select3D_SensitivePoly.
class Select3D_SensitiveCurve : public Select3D_SensitivePoly
{
DEFINE_STANDARD_RTTIEXT(Select3D_SensitiveCurve, Select3D_SensitivePoly)
public:
//! Constructs a sensitive curve object defined by the
@@ -64,10 +53,6 @@ public:
//! Returns the copy of this
Standard_EXPORT virtual Handle(Select3D_SensitiveEntity) GetConnected() Standard_OVERRIDE;
public:
DEFINE_STANDARD_RTTIEXT(Select3D_SensitiveCurve,Select3D_SensitivePoly)
private:
void loadPoints (const Handle(Geom_Curve)& aCurve,

View File

@@ -15,11 +15,9 @@
// commercial license or contractual agreement.
#include <Select3D_SensitiveEntity.hxx>
#include <Precision.hxx>
#include <SelectBasics_EntityOwner.hxx>
#include <Select3D_Macro.hxx>
#include <TopLoc_Location.hxx>
IMPLEMENT_STANDARD_RTTIEXT(Select3D_SensitiveEntity,SelectBasics_SensitiveEntity)

View File

@@ -17,19 +17,10 @@
#ifndef _Select3D_SensitiveEntity_HeaderFile
#define _Select3D_SensitiveEntity_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <SelectBasics_SensitiveEntity.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_Integer.hxx>
#include <SelectMgr_SelectingVolumeManager.hxx>
#include <Standard_Real.hxx>
#include <Standard_OStream.hxx>
#include <TopLoc_Location.hxx>
class Select3D_SensitiveEntity;
class SelectBasics_EntityOwner;
//! Abstract framework to define 3D sensitive entities.

View File

@@ -14,18 +14,11 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
//Modif on jun-24-97 : introduction de CSLib_Class2d de LBR
// pour teste si on est dedans ou dehors...
//Modif on jul-21-97 : changement en harray1 pour eventuelles connexions ...
#include <Select3D_SensitiveFace.hxx>
#include <Select3D_SensitivePoly.hxx>
#include <Select3D_InteriorSensitivePointSet.hxx>
#include <gp_Pnt.hxx>
#include <Precision.hxx>
IMPLEMENT_STANDARD_RTTIEXT(Select3D_SensitiveFace,Select3D_SensitiveEntity)
//==================================================

View File

@@ -14,34 +14,23 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
//Modif on jun-24-97 : introduction de CSLib_Class2d de LBR
// pour teste si on est dedans ou dehors...
//Modif on jul-21-97 : changement en harray1 pour eventuelles connexions ...
#ifndef _Select3D_SensitiveFace_HeaderFile
#define _Select3D_SensitiveFace_HeaderFile
#include <Standard_Type.hxx>
#include <Select3D_TypeOfSensitivity.hxx>
#include <Select3D_SensitiveSet.hxx>
#include <TColgp_HArray1OfPnt.hxx>
#include <Standard_Boolean.hxx>
#include <SelectBasics_SelectingVolumeManager.hxx>
#include <Standard_Real.hxx>
#include <Standard_OStream.hxx>
class Standard_ConstructionError;
class Standard_OutOfRange;
class SelectBasics_EntityOwner;
class TopLoc_Location;
//! Sensitive Entity to make a face selectable.
//! In some cases this class can raise Standard_ConstructionError and
//! Standard_OutOfRange exceptions. For more details see Select3D_SensitivePoly.
class Select3D_SensitiveFace : public Select3D_SensitiveEntity
{
DEFINE_STANDARD_RTTIEXT(Select3D_SensitiveFace, Select3D_SensitiveEntity)
public:
//! Constructs a sensitive face object defined by the
@@ -84,8 +73,6 @@ public:
//! Returns the amount of sub-entities (points or planar convex polygons)
Standard_EXPORT virtual Standard_Integer NbSubElements() Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT(Select3D_SensitiveFace,Select3D_SensitiveEntity)
private:
Select3D_TypeOfSensitivity mySensType; //!< Type of sensitivity: interior or boundary

View File

@@ -14,10 +14,9 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <Precision.hxx>
#include <Select3D_SensitiveGroup.hxx>
#include <TopLoc_Location.hxx>
#include <Precision.hxx>
IMPLEMENT_STANDARD_RTTIEXT(Select3D_SensitiveGroup,Select3D_SensitiveSet)

View File

@@ -14,23 +14,14 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _Select3D_SensitiveGroup_HeaderFile
#define _Select3D_SensitiveGroup_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <Standard_Type.hxx>
#include <Select3D_EntitySequence.hxx>
#include <Select3D_SensitiveEntity.hxx>
#include <Select3D_SensitiveSet.hxx>
#include <SelectMgr_SelectingVolumeManager.hxx>
class SelectBasics_EntityOwner;
class TopLoc_Location;
//! A framework to define selection of a sensitive group
//! by a sensitive entity which is a set of 3D sensitive entities.
//! Remark: 2 modes are possible for rectangle selection
@@ -40,6 +31,7 @@ class TopLoc_Location;
//! By default the "Match All entities" mode is set.
class Select3D_SensitiveGroup : public Select3D_SensitiveSet
{
DEFINE_STANDARD_RTTIEXT(Select3D_SensitiveGroup, Select3D_SensitiveSet)
public:
//! Constructs an empty sensitive group object.
@@ -76,11 +68,11 @@ public:
//! Sets the requirement that all sensitive entities in the
//! list used at the time of construction, or added using
//! the function Add must be matched.
void SetMatchType (const Standard_Boolean theIsMustMatchAll);
void SetMatchType (const Standard_Boolean theIsMustMatchAll) { myMustMatchAll = theIsMustMatchAll; }
//! Returns true if all sensitive entities in the list used
//! at the time of construction, or added using the function Add must be matched.
Standard_Boolean MustMatchAll() const;
Standard_Boolean MustMatchAll() const { return myMustMatchAll; }
//! Checks whether the group overlaps current selecting volume
Standard_EXPORT virtual Standard_Boolean Matches (SelectBasics_SelectingVolumeManager& theMgr,
@@ -95,7 +87,7 @@ public:
Standard_EXPORT void Set (const Handle(SelectBasics_EntityOwner)& theOwnerId) Standard_OVERRIDE;
//! Gets group content
const Select3D_EntitySequence& GetEntities() const;
const Select3D_EntitySequence& GetEntities() const { return myEntities; }
//! Returns bounding box of the group. If location transformation
//! is set, it will be applied
@@ -120,8 +112,6 @@ public:
//! Returns the length of vector of sensitive entities
Standard_EXPORT virtual Standard_Integer Size() const Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT(Select3D_SensitiveGroup,Select3D_SensitiveSet)
private:
//! Checks whether the entity with index theIdx overlaps the current selecting volume
@@ -147,6 +137,4 @@ private:
DEFINE_STANDARD_HANDLE(Select3D_SensitiveGroup, Select3D_SensitiveEntity)
#include <Select3D_SensitiveGroup.lxx>
#endif // _Select3D_SensitiveGroup_HeaderFile

View File

@@ -1,42 +0,0 @@
// Created on: 1998-04-16
// Created by: Robert COUBLANC
// 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.
//=======================================================================
//function : SetMatchType
//purpose :
//=======================================================================
inline void Select3D_SensitiveGroup::SetMatchType (const Standard_Boolean theIsMustMatchAll)
{
myMustMatchAll = theIsMustMatchAll;
}
//=======================================================================
//function : MustMatchAll
//purpose :
//=======================================================================
inline Standard_Boolean Select3D_SensitiveGroup::MustMatchAll() const
{
return myMustMatchAll;
}
//=======================================================================
//function : GetEntities
//purpose :
//=======================================================================
inline const Select3D_EntitySequence& Select3D_SensitiveGroup::GetEntities() const
{
return myEntities;
}

View File

@@ -16,9 +16,6 @@
#include <Select3D_SensitivePoint.hxx>
#include <TopLoc_Location.hxx>
IMPLEMENT_STANDARD_RTTIEXT(Select3D_SensitivePoint,Select3D_SensitiveEntity)
//==================================================
@@ -53,15 +50,6 @@ Standard_Boolean Select3D_SensitivePoint::Matches (SelectBasics_SelectingVolumeM
return Standard_True;
}
//=======================================================================
//function : Point
//purpose :
//=======================================================================
gp_Pnt Select3D_SensitivePoint::Point() const
{
return myPoint;
}
//=======================================================================
//function : GetConnected
//purpose :

View File

@@ -17,24 +17,13 @@
#ifndef _Select3D_SensitivePoint_HeaderFile
#define _Select3D_SensitivePoint_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <Standard_Type.hxx>
#include <Select3D_Pnt.hxx>
#include <Select3D_SensitiveEntity.hxx>
#include <Standard_Boolean.hxx>
#include <SelectMgr_SelectingVolumeManager.hxx>
#include <Standard_Real.hxx>
#include <Standard_OStream.hxx>
class SelectBasics_EntityOwner;
class gp_Pnt;
class TopLoc_Location;
//! A framework to define sensitive 3D points.
class Select3D_SensitivePoint : public Select3D_SensitiveEntity
{
DEFINE_STANDARD_RTTIEXT(Select3D_SensitivePoint, Select3D_SensitiveEntity)
public:
//! Constructs a sensitive point object defined by the
@@ -51,7 +40,7 @@ public:
SelectBasics_PickResult& thePickResult) Standard_OVERRIDE;
//! Returns the point used at the time of construction.
Standard_EXPORT gp_Pnt Point() const;
const gp_Pnt& Point() const { return myPoint; }
//! Returns center of point. If location transformation
//! is set, it will be applied
@@ -61,8 +50,6 @@ public:
//! transformation is set, it will be applied
Standard_EXPORT virtual Select3D_BndBox3d BoundingBox() Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT(Select3D_SensitivePoint,Select3D_SensitiveEntity)
private:
gp_Pnt myPoint; //!< 3d coordinates of the point

View File

@@ -11,14 +11,8 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <gp_Pnt.hxx>
#include <TopLoc_Location.hxx>
#include <Select3D_Pnt.hxx>
#include <Select3D_SensitivePoly.hxx>
IMPLEMENT_STANDARD_RTTIEXT(Select3D_SensitivePoly,Select3D_SensitiveSet)
//==================================================
@@ -199,7 +193,7 @@ Standard_Real Select3D_SensitivePoly::Center (const Standard_Integer theIdx,
return RealLast();
const Select3D_BndBox3d aBndBox = Box (theIdx);
const SelectMgr_Vec3& aCenter = (aBndBox.CornerMin() + aBndBox.CornerMax()) * 0.5;
const SelectMgr_Vec3 aCenter = (aBndBox.CornerMin() + aBndBox.CornerMax()) * 0.5;
return theAxis == 0 ? aCenter.x() : (theAxis == 1 ? aCenter.y() : aCenter.z());
}
@@ -218,7 +212,6 @@ void Select3D_SensitivePoly::Swap (const Standard_Integer theIdx1,
const Standard_Integer aSegmentIdx2 = mySegmentIndexes->Value (theIdx2);
mySegmentIndexes->ChangeValue (theIdx1) = aSegmentIdx2;
mySegmentIndexes->ChangeValue (theIdx2) = aSegmentIdx1;
return;
}
//==================================================

View File

@@ -14,24 +14,14 @@
#ifndef _Select3D_SensitivePoly_HeaderFile
#define _Select3D_SensitivePoly_HeaderFile
#include <NCollection_Handle.hxx>
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <Standard_Type.hxx>
#include <Select3D_PointData.hxx>
#include <Select3D_SensitiveSet.hxx>
#include <Select3D_TypeOfSensitivity.hxx>
#include <TColStd_HArray1OfInteger.hxx>
#include <TColgp_HArray1OfPnt.hxx>
#include <Select3D_PointData.hxx>
#include <Select3D_Pnt.hxx>
#include <Select3D_SensitiveSet.hxx>
#include <Select3D_TypeOfSensitivity.hxx>
class Standard_ConstructionError;
class Standard_OutOfRange;
class SelectBasics_EntityOwner;
//! Sensitive Entity to make a face selectable.
//! In some cases this class can raise Standard_ConstructionError and
@@ -39,6 +29,7 @@ class SelectBasics_EntityOwner;
//! myPolyg.
class Select3D_SensitivePoly : public Select3D_SensitiveSet
{
DEFINE_STANDARD_RTTIEXT(Select3D_SensitivePoly, Select3D_SensitiveSet)
public:
//! Constructs a sensitive face object defined by the
@@ -68,7 +59,15 @@ public:
Standard_EXPORT virtual Standard_Integer NbSubElements() Standard_OVERRIDE;
//! Returns the 3D points of the array used at construction time.
void Points3D (Handle(TColgp_HArray1OfPnt)& theHArrayOfPnt);
void Points3D (Handle(TColgp_HArray1OfPnt)& theHArrayOfPnt)
{
Standard_Integer aSize = myPolyg.Size();
theHArrayOfPnt = new TColgp_HArray1OfPnt (1,aSize);
for(Standard_Integer anIndex = 1; anIndex <= aSize; anIndex++)
{
theHArrayOfPnt->SetValue (anIndex, myPolyg.Pnt (anIndex-1));
}
}
//! Returns bounding box of a polygon. If location
//! transformation is set, it will be applied
@@ -93,8 +92,6 @@ public:
Standard_EXPORT virtual void Swap (const Standard_Integer theIdx1,
const Standard_Integer theIdx2) Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT(Select3D_SensitivePoly,Select3D_SensitiveSet)
private:
//! Checks whether the segment with index theIdx overlaps the current selecting volume
@@ -121,6 +118,4 @@ protected:
DEFINE_STANDARD_HANDLE(Select3D_SensitivePoly, Select3D_SensitiveSet)
#include <Select3D_SensitivePoly.lxx>
#endif // _Select3D_SensitivePoly_HeaderFile

View File

@@ -1,30 +0,0 @@
// 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.
#include<Select3D_Pnt.hxx>
#include<TColgp_HArray1OfPnt.hxx>
#include<TColgp_Array1OfPnt2d.hxx>
//==================================================
// Function: Points3D
// Purpose :
//==================================================
inline void Select3D_SensitivePoly::Points3D (Handle(TColgp_HArray1OfPnt)& theHArrayOfPnt)
{
Standard_Integer aSize = myPolyg.Size();
theHArrayOfPnt = new TColgp_HArray1OfPnt (1,aSize);
for(Standard_Integer anIndex = 1; anIndex <= aSize; anIndex++)
{
theHArrayOfPnt->SetValue (anIndex, myPolyg.Pnt (anIndex-1));
}
}

View File

@@ -17,25 +17,14 @@
#ifndef _Select3D_SensitiveSegment_HeaderFile
#define _Select3D_SensitiveSegment_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <Standard_Type.hxx>
#include <Standard_Integer.hxx>
#include <Select3D_Pnt.hxx>
#include <Select3D_SensitiveEntity.hxx>
#include <gp_Pnt.hxx>
#include <SelectMgr_SelectingVolumeManager.hxx>
#include <Standard_OStream.hxx>
class SelectBasics_EntityOwner;
class gp_Pnt;
class TopLoc_Location;
//! A framework to define sensitive zones along a segment
//! One gives the 3D start and end point
class Select3D_SensitiveSegment : public Select3D_SensitiveEntity
{
DEFINE_STANDARD_RTTIEXT(Select3D_SensitiveSegment, Select3D_SensitiveEntity)
public:
//! Constructs the sensitive segment object defined by
@@ -45,16 +34,16 @@ public:
const gp_Pnt& theLastPnt);
//! changes the start Point of the Segment;
void StartPoint (const gp_Pnt& thePnt);
void SetStartPoint (const gp_Pnt& thePnt) { myStart = thePnt; }
//! changes the end point of the segment
void EndPoint (const gp_Pnt& thePnt);
void SetEndPoint (const gp_Pnt& thePnt) { myEnd = thePnt; }
//! gives the 3D start Point of the Segment
gp_Pnt StartPoint() const;
const gp_Pnt& StartPoint() const { return myStart; }
//! gives the 3D End Point of the Segment
gp_Pnt EndPoint() const;
const gp_Pnt& EndPoint() const { return myEnd; }
//! Returns the amount of points
Standard_EXPORT virtual Standard_Integer NbSubElements() Standard_OVERRIDE;
@@ -73,7 +62,13 @@ public:
//! transformation is set, it will be applied
Standard_EXPORT virtual Select3D_BndBox3d BoundingBox() Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT(Select3D_SensitiveSegment,Select3D_SensitiveEntity)
public:
//! changes the start Point of the Segment;
void StartPoint (const gp_Pnt& thePnt) { myStart = thePnt; }
//! changes the end point of the segment
void EndPoint (const gp_Pnt& thePnt) { myEnd = thePnt; }
private:
@@ -83,6 +78,4 @@ private:
DEFINE_STANDARD_HANDLE(Select3D_SensitiveSegment, Select3D_SensitiveEntity)
#include <Select3D_SensitiveSegment.lxx>
#endif // _Select3D_SensitiveSegment_HeaderFile

View File

@@ -1,51 +0,0 @@
// Created on: 1995-02-23
// Created by: Mister rmi
// Copyright (c) 1995-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.
//=======================================================================
//function : StartPoint
//purpose :
//=======================================================================
inline void Select3D_SensitiveSegment::StartPoint (const gp_Pnt& thePnt)
{
myStart = thePnt;
}
//=======================================================================
//function : EndPoint
//purpose :
//=======================================================================
inline void Select3D_SensitiveSegment::EndPoint (const gp_Pnt& thePnt)
{
myEnd = thePnt;
}
//=======================================================================
//function : StartPoint
//purpose :
//=======================================================================
inline gp_Pnt Select3D_SensitiveSegment::StartPoint() const
{
return myStart;
}
//=======================================================================
//function : EndPoint
//purpose :
//=======================================================================
inline gp_Pnt Select3D_SensitiveSegment::EndPoint() const
{
return myEnd;
}

View File

@@ -17,8 +17,6 @@
#define _Select3D_SensitiveSet_Header
#include <BVH_PrimitiveSet.hxx>
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <Select3D_BndBox3d.hxx>
#include <Select3D_SensitiveEntity.hxx>
#include <SelectBasics_EntityOwner.hxx>

View File

@@ -16,12 +16,10 @@
#include <Select3D_SensitiveTriangle.hxx>
#include <gp_Pnt.hxx>
#include <Precision.hxx>
#include <Bnd_Box.hxx>
#include <TopLoc_Location.hxx>
IMPLEMENT_STANDARD_RTTIEXT(Select3D_SensitiveTriangle,Select3D_SensitiveEntity)
//==================================================
@@ -70,26 +68,6 @@ Standard_Boolean Select3D_SensitiveTriangle::Matches (SelectBasics_SelectingVolu
return Standard_True;
}
//==================================================
// Function: Points3D
// Purpose :
//==================================================
void Select3D_SensitiveTriangle::Points3D (gp_Pnt& thePnt0, gp_Pnt& thePnt1, gp_Pnt& thePnt2) const
{
thePnt0 = myPoints[0];
thePnt1 = myPoints[1];
thePnt2 = myPoints[2];
}
//==================================================
// Function: Center3D
// Purpose :
//==================================================
gp_Pnt Select3D_SensitiveTriangle::Center3D() const
{
return myCentroid;
}
//==================================================
// Function: GetConnected
// Purpose :

View File

@@ -17,23 +17,12 @@
#ifndef _Select3D_SensitiveTriangle_HeaderFile
#define _Select3D_SensitiveTriangle_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <Standard_Type.hxx>
#include <Select3D_TypeOfSensitivity.hxx>
#include <Select3D_Pnt.hxx>
#include <Select3D_SensitivePoly.hxx>
#include <SelectMgr_SelectingVolumeManager.hxx>
#include <Standard_OStream.hxx>
class Standard_ConstructionError;
class Standard_OutOfRange;
class SelectBasics_EntityOwner;
class gp_Pnt;
class Select3D_SensitiveEntity;
class TopLoc_Location;
//! A framework to define selection of triangles in a view.
//! This comes into play in the detection of meshing and triangulation in surfaces.
@@ -56,10 +45,15 @@ public:
SelectBasics_PickResult& thePickResult) Standard_OVERRIDE;
//! Returns the 3D points P1, P2, P3 used at the time of construction.
Standard_EXPORT void Points3D (gp_Pnt& thePnt0, gp_Pnt& thePnt1, gp_Pnt& thePnt2) const;
void Points3D (gp_Pnt& thePnt0, gp_Pnt& thePnt1, gp_Pnt& thePnt2) const
{
thePnt0 = myPoints[0];
thePnt1 = myPoints[1];
thePnt2 = myPoints[2];
}
//! Returns the center point of the sensitive triangle created at construction time.
Standard_EXPORT gp_Pnt Center3D() const;
Standard_EXPORT gp_Pnt Center3D() const { return myCentroid; }
//! Returns the copy of this
Standard_EXPORT virtual Handle(Select3D_SensitiveEntity) GetConnected() Standard_OVERRIDE;

View File

@@ -14,7 +14,7 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <algorithm>
#include <Select3D_SensitiveTriangulation.hxx>
#include <Poly.hxx>
#include <Poly_Connect.hxx>
@@ -23,24 +23,30 @@
#include <Precision.hxx>
#include <Select3D_TypeOfSensitivity.hxx>
#include <Select3D_SensitiveTriangulation.hxx>
#include <algorithm>
IMPLEMENT_STANDARD_RTTIEXT(Select3D_SensitiveTriangulation,Select3D_SensitiveSet)
static Standard_Integer NbOfFreeEdges (const Handle(Poly_Triangulation)& theTriangulation)
namespace
{
Standard_Integer aNbFree = 0;
Poly_Connect aPoly (theTriangulation);
Standard_Integer aTriangleNodes[3];
for (Standard_Integer aTrgIdx = 1; aTrgIdx <= theTriangulation->NbTriangles(); aTrgIdx++)
static Standard_Integer NbOfFreeEdges (const Handle(Poly_Triangulation)& theTriangulation)
{
aPoly.Triangles (aTrgIdx, aTriangleNodes[0], aTriangleNodes[1], aTriangleNodes[2]);
for (Standard_Integer aNodeIdx = 0; aNodeIdx < 3; aNodeIdx++)
if (aTriangleNodes[aNodeIdx] == 0)
aNbFree++;
Standard_Integer aNbFree = 0;
Poly_Connect aPoly (theTriangulation);
Standard_Integer aTriangleNodes[3];
for (Standard_Integer aTrgIdx = 1; aTrgIdx <= theTriangulation->NbTriangles(); aTrgIdx++)
{
aPoly.Triangles (aTrgIdx, aTriangleNodes[0], aTriangleNodes[1], aTriangleNodes[2]);
for (Standard_Integer aNodeIdx = 0; aNodeIdx < 3; ++aNodeIdx)
{
if (aTriangleNodes[aNodeIdx] == 0)
{
++aNbFree;
}
}
}
return aNbFree;
}
return aNbFree;
}
//=======================================================================
@@ -130,7 +136,6 @@ Select3D_SensitiveTriangulation::Select3D_SensitiveTriangulation (const Handle(S
}
}
//=======================================================================
//function : Select3D_SensitiveTriangulation
//purpose :

View File

@@ -14,40 +14,23 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
//Modified Thur Apr 09 98 by rob : No more computation of free edges.
// fix bug on Compute Depth (don't forget
// Location...)
#ifndef _Select3D_SensitiveTriangulation_Header
#define _Select3D_SensitiveTriangulation_Header
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <Standard_Type.hxx>
#include <TopLoc_Location.hxx>
#include <gp_Trsf.hxx>
#include <gp_Pnt.hxx>
#include <TColStd_HArray1OfInteger.hxx>
#include <TColStd_HArray1OfInteger.hxx>
#include <Standard_Boolean.hxx>
#include <TColgp_HArray1OfPnt.hxx>
#include <Select3D_SensitiveEntity.hxx>
#include <SelectMgr_SelectingVolumeManager.hxx>
#include <Standard_OStream.hxx>
#include <Select3D_SensitiveSet.hxx>
#include <NCollection_Handle.hxx>
class Poly_Triangulation;
class SelectBasics_EntityOwner;
class TopLoc_Location;
class gp_Pnt;
class Select3D_SensitiveEntity;
//! A framework to define selection of a sensitive entity made of a set of triangles.
class Select3D_SensitiveTriangulation : public Select3D_SensitiveSet
{
DEFINE_STANDARD_RTTIEXT(Select3D_SensitiveTriangulation, Select3D_SensitiveSet)
public:
//! Constructs a sensitive triangulation object defined by
@@ -76,7 +59,7 @@ public:
Standard_EXPORT Handle(Select3D_SensitiveEntity) GetConnected() Standard_OVERRIDE;
const Handle(Poly_Triangulation)& Triangulation() const;
const Handle(Poly_Triangulation)& Triangulation() const { return myTriangul; }
//! Returns the length of array of triangles or edges
Standard_EXPORT virtual Standard_Integer Size() const Standard_OVERRIDE;
@@ -108,10 +91,7 @@ public:
//! to this entity has init location set. Otherwise, returns identity matrix.
Standard_EXPORT virtual gp_GTrsf InvInitLocation() const Standard_OVERRIDE;
inline const TopLoc_Location& GetInitLocation() const;
public:
DEFINE_STANDARD_RTTIEXT(Select3D_SensitiveTriangulation,Select3D_SensitiveSet)
const TopLoc_Location& GetInitLocation() const { return myInitLocation; }
protected:
@@ -119,7 +99,6 @@ protected:
//! box of the triangulation
Select3D_BndBox3d applyTransformation();
private:
//! Checks whether the element with index theIdx overlaps the current selecting volume
@@ -149,7 +128,4 @@ private:
DEFINE_STANDARD_HANDLE(Select3D_SensitiveTriangulation, Select3D_SensitiveSet)
#include <Select3D_SensitiveTriangulation.lxx>
#endif // _Select3D_SensitiveTriangulation_Header

View File

@@ -1,33 +0,0 @@
// Created on: 1997-05-15
// Created by: Robert COUBLANC
// Copyright (c) 1997-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.
//=======================================================================
//function : Triangulation
//purpose :
//=======================================================================
inline const Handle(Poly_Triangulation)& Select3D_SensitiveTriangulation::Triangulation() const
{
return myTriangul;
}
//=======================================================================
//function : GetInitLocation
//purpose :
//=======================================================================
inline const TopLoc_Location& Select3D_SensitiveTriangulation::GetInitLocation() const
{
return myInitLocation;
}

View File

@@ -17,18 +17,7 @@
#ifndef _Select3D_SensitiveWire_HeaderFile
#define _Select3D_SensitiveWire_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <Standard_Type.hxx>
#include <Select3D_SensitiveSet.hxx>
#include <Standard_OStream.hxx>
#include <NCollection_Sequence.hxx>
class SelectBasics_EntityOwner;
class TopLoc_Location;
class Select3D_SensitiveEntitySequence;
//! A framework to define selection of a wire owner by an
//! elastic wire band.

View File

@@ -2,9 +2,7 @@ SelectBasics.cxx
SelectBasics.hxx
SelectBasics_EntityOwner.cxx
SelectBasics_EntityOwner.hxx
SelectBasics_EntityOwner.lxx
SelectBasics_PickResult.hxx
SelectBasics_SelectingVolumeManager.hxx
SelectBasics_SensitiveEntity.cxx
SelectBasics_SensitiveEntity.hxx
SelectBasics_SensitiveEntity.lxx

View File

@@ -19,12 +19,7 @@
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <Standard_Integer.hxx>
class SelectBasics_EntityOwner;
class SelectBasics_SensitiveEntity;
//! interface class for dynamic selection
class SelectBasics
@@ -33,36 +28,12 @@ public:
DEFINE_STANDARD_ALLOC
//! Structure to provide all-in-one result of selection of sensitive
//! for "Matches" method of SelectBasics_SensitiveEntity.
Standard_EXPORT static Standard_Integer MaxOwnerPriority();
Standard_EXPORT static Standard_Integer MinOwnerPriority();
protected:
private:
friend class SelectBasics_EntityOwner;
friend class SelectBasics_SensitiveEntity;
};
#endif // _SelectBasics_HeaderFile

View File

@@ -18,10 +18,8 @@
#define _SelectBasics_EntityOwner_HeaderFile
#include <Standard.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Transient.hxx>
#include <Standard_Type.hxx>
#include <Standard_Boolean.hxx>
#include <TopLoc_Location.hxx>
//! defines an abstract owner of sensitive primitives.

View File

@@ -1,21 +0,0 @@
// Created on: 1995-02-23
// Created by: Mister rmi
// Copyright (c) 1995-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 SelectBasics_EntityOwner::Set (const Standard_Integer aPriority)
{mypriority = aPriority;}
inline Standard_Integer SelectBasics_EntityOwner::Priority() const
{return mypriority;}

View File

@@ -14,13 +14,12 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <SelectBasics_SensitiveEntity.hxx>
#include <SelectBasics_EntityOwner.hxx>
#include <SelectBasics_SensitiveEntity.hxx>
#include <Standard_Type.hxx>
#include <TColStd_HArray1OfBoolean.hxx>
IMPLEMENT_STANDARD_RTTIEXT(SelectBasics_SensitiveEntity,MMgt_TShared)
IMPLEMENT_STANDARD_RTTIEXT(SelectBasics_SensitiveEntity, Standard_Transient)
//=======================================================================
// function : SelectBasics_SensitiveEntity
@@ -39,15 +38,6 @@ void SelectBasics_SensitiveEntity::Set (const Handle(SelectBasics_EntityOwner)&
myOwnerId = theOwnerId;
}
//=======================================================================
// function : OwnerId
// purpose : Returns pointer to owner of the entity
//=======================================================================
const Handle(SelectBasics_EntityOwner)& SelectBasics_SensitiveEntity::OwnerId() const
{
return myOwnerId;
}
//=======================================================================
// function : SetSensitivityFactor
// purpose : Allows to manage sensitivity of a particular entity

View File

@@ -19,63 +19,51 @@
#include <gp_GTrsf.hxx>
#include <gp_Trsf.hxx>
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <Standard_Real.hxx>
#include <MMgt_TShared.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_Transient.hxx>
#include <SelectBasics_SelectingVolumeManager.hxx>
#include <SelectBasics_PickResult.hxx>
#include <Standard_Integer.hxx>
#include <Select3D_BndBox3d.hxx>
class SelectBasics_EntityOwner;
class SelectBasics_SensitiveEntity;
DEFINE_STANDARD_HANDLE(SelectBasics_SensitiveEntity, MMgt_TShared)
//! root class; the inheriting classes will be able to give
//! sensitive Areas for the dynamic selection algorithms
class SelectBasics_SensitiveEntity : public MMgt_TShared
class SelectBasics_SensitiveEntity : public Standard_Transient
{
DEFINE_STANDARD_RTTIEXT(SelectBasics_SensitiveEntity, Standard_Transient)
public:
//! Sets owner of the entity
Standard_EXPORT virtual void Set (const Handle(SelectBasics_EntityOwner)& theOwnerId);
//! Returns pointer to owner of the entity
Standard_EXPORT const Handle(SelectBasics_EntityOwner)& OwnerId() const;
const Handle(SelectBasics_EntityOwner)& OwnerId() const { return myOwnerId; }
//! Checks whether the sensitive entity is overlapped by
//! current selecting volume
virtual Standard_Boolean Matches (SelectBasics_SelectingVolumeManager& theMgr, SelectBasics_PickResult& thePickResult) = 0;
//! allows a better sensitivity for
//! a specific entity in selection algorithms
//! useful for small sized entities.
Standard_Integer SensitivityFactor() const;
Standard_Integer SensitivityFactor() const { return mySFactor; }
//! Allows to manage sensitivity of a particular sensitive entity
Standard_EXPORT void SetSensitivityFactor (const Standard_Integer theNewSens);
//! Returns the number of sub-entities or elements in
//! sensitive entity. Is used to determine if entity is
//! complex and needs to pre-build BVH at the creation of
//! sensitive entity step or is light-weighted so the tree
//! can be build on demand with unnoticeable delay
virtual Standard_Integer NbSubElements() = 0;
//! Returns bounding box of sensitive entity
virtual Select3D_BndBox3d BoundingBox() = 0;
//! Builds BVH tree for sensitive if it is needed
virtual void BVH() = 0;
//! Clears up all the resources and memory allocated
virtual void Clear() = 0;
@@ -86,25 +74,17 @@ public:
//! to this entity has init location set. Otherwise, returns identity matrix.
virtual gp_GTrsf InvInitLocation() const = 0;
DEFINE_STANDARD_RTTIEXT(SelectBasics_SensitiveEntity,MMgt_TShared)
protected:
Standard_EXPORT SelectBasics_SensitiveEntity (const Handle(SelectBasics_EntityOwner)& theOwnerId);
protected:
Handle(SelectBasics_EntityOwner) myOwnerId;
private:
Standard_Integer mySFactor;
};
#include <SelectBasics_SensitiveEntity.lxx>
DEFINE_STANDARD_HANDLE(SelectBasics_SensitiveEntity, Standard_Transient)
#endif // _SelectBasics_SensitiveEntity_HeaderFile

View File

@@ -1,22 +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.
//=======================================================================
// function : SensitivityFactor
// purpose : Gets sensitivity factor for the entity
//=======================================================================
inline Standard_Integer SelectBasics_SensitiveEntity::SensitivityFactor() const
{
return mySFactor;
}