mirror of
https://github.com/Open-Cascade-SAS/OCCT.git
synced 2026-06-12 09:59:03 +08:00
0024023: Revamp the OCCT Handle -- general
Missing headers added; includes of headers "Handle_...hxx" removed. Misuses of macro Handle() and its use in typedefs corrected. Alias classes Profile and Option are removed from IFSelect; ones defined in MoniTool are used directly. Removed header files defining only Handle classes (except Image_PixMap_Handle.hxx) Classes SelectMgr_BaseFrustum and now inherit Standard_Transient and can be manipulated by Handle (not NCollection_Handle) Fixed reference-type local variable pointing to temporary object Use of handle in conditional expressions and comparisons to NULL are replaced by call to method IsNull()
This commit is contained in:
@@ -38,7 +38,7 @@
|
||||
//! selection. It contains signatures of functions for detection of
|
||||
//! overlap by sensitive entity and initializes some data for building
|
||||
//! the selecting frustum
|
||||
class SelectMgr_BaseFrustum
|
||||
class SelectMgr_BaseFrustum : public Standard_Transient
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -137,6 +137,8 @@ public:
|
||||
virtual Standard_Boolean IsClipped (const Graphic3d_SequenceOfHClipPlane& thePlanes,
|
||||
const Standard_Real theDepth);
|
||||
|
||||
DEFINE_STANDARD_RTTI(SelectMgr_BaseFrustum, Standard_Transient)
|
||||
|
||||
protected:
|
||||
Standard_Real myPixelTolerance; //!< Pixel tolerance
|
||||
Standard_Boolean myIsOrthographic; //!< Defines if current camera is orthographic
|
||||
|
||||
@@ -16,12 +16,11 @@
|
||||
#ifndef _SelectMgr_IndexedMapOfOwner_HeaderFile
|
||||
#define _SelectMgr_IndexedMapOfOwner_HeaderFile
|
||||
|
||||
#include <NCollection_Handle.hxx>
|
||||
#include <NCollection_IndexedMap.hxx>
|
||||
#include <NCollection_Shared.hxx>
|
||||
|
||||
class SelectMgr_EntityOwner;
|
||||
|
||||
typedef NCollection_IndexedMap<Handle(SelectMgr_EntityOwner)> SelectMgr_IndexedMapOfOwner;
|
||||
typedef NCollection_Handle<NCollection_IndexedMap<Handle(SelectMgr_EntityOwner)> > Handle(SelectMgr_IndexedMapOfOwner);
|
||||
typedef NCollection_Shared< NCollection_IndexedMap<Handle(SelectMgr_EntityOwner)> > SelectMgr_IndexedMapOfOwner;
|
||||
|
||||
#endif // _SelectMgr_IndexedMapOfOwner_HeaderFile
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include <Graphic3d_AspectLine3d.hxx>
|
||||
#include <Graphic3d_AspectMarker3d.hxx>
|
||||
#include <PrsMgr_PresentableObjectPointer.hxx>
|
||||
#include <SelectMgr_IndexedMapOfOwner.hxx>
|
||||
|
||||
#include <TopLoc_Location.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
|
||||
@@ -16,9 +16,9 @@
|
||||
|
||||
#include <Standard_NullObject.hxx>
|
||||
|
||||
#include <SelectBasics_EntityOwner.hxx>
|
||||
#include <SelectMgr_Selection.hxx>
|
||||
|
||||
|
||||
//==================================================
|
||||
// Function: SelectMgr_Selection
|
||||
// Purpose :
|
||||
|
||||
@@ -522,7 +522,7 @@ void SelectMgr_SelectionManager::ClearSelectionStructures (const Handle(SelectMg
|
||||
if (!theObj->HasOwnPresentations())
|
||||
return;
|
||||
|
||||
if (theSelector == NULL)
|
||||
if (theSelector.IsNull())
|
||||
{
|
||||
if (!(myGlobal.Contains (theObj) || myLocal.IsBound(theObj)))
|
||||
return;
|
||||
@@ -582,7 +582,7 @@ void SelectMgr_SelectionManager::RestoreSelectionStructures (const Handle(Select
|
||||
if (!theObj->HasOwnPresentations())
|
||||
return;
|
||||
|
||||
if (theSelector == NULL)
|
||||
if (theSelector.IsNull())
|
||||
{
|
||||
if (!(myGlobal.Contains (theObj) || myLocal.IsBound(theObj)))
|
||||
return;
|
||||
@@ -632,7 +632,7 @@ void SelectMgr_SelectionManager::RestoreSelectionStructures (const Handle(Select
|
||||
//=======================================================================
|
||||
void SelectMgr_SelectionManager::rebuildSelectionStructures (const Handle(SelectMgr_ViewerSelector)& theSelector)
|
||||
{
|
||||
if (theSelector == NULL)
|
||||
if (theSelector.IsNull())
|
||||
{
|
||||
Handle(SelectMgr_ViewerSelector) aSelector;
|
||||
for(TColStd_MapIteratorOfMapOfTransient aSelectorsIter (mySelectors); aSelectorsIter.More(); aSelectorsIter.Next())
|
||||
@@ -840,7 +840,7 @@ void SelectMgr_SelectionManager::loadMode (const Handle(SelectMgr_SelectableObje
|
||||
{
|
||||
Handle(SelectMgr_Selection) aNewSel = new SelectMgr_Selection (theMode);
|
||||
theObject->AddSelection (aNewSel, theMode);
|
||||
if (theSelector == NULL)
|
||||
if (theSelector.IsNull())
|
||||
{
|
||||
if (myGlobal.Contains (theObject))
|
||||
{
|
||||
|
||||
@@ -81,6 +81,8 @@ public:
|
||||
|
||||
//! Nullifies the handle to corresponding builder instance to prevent memory leaks
|
||||
void Clear();
|
||||
|
||||
DEFINE_STANDARD_RTTI(SelectMgr_TriangularFrustum,Standard_Transient)
|
||||
};
|
||||
|
||||
#endif // _SelectMgr_TriangularFrustum_HeaderFile
|
||||
|
||||
@@ -30,11 +30,6 @@
|
||||
// =======================================================================
|
||||
void SelectMgr_TriangularFrustumSet::Build (const TColgp_Array1OfPnt2d& thePoints)
|
||||
{
|
||||
for (SelectMgr_TriangFrustumsIter anIter (myFrustums); anIter.More(); anIter.Next())
|
||||
{
|
||||
SelectMgr_HTriangularFrustum& aFrust = anIter.ChangeValue();
|
||||
aFrust.Nullify();
|
||||
}
|
||||
myFrustums.Clear();
|
||||
|
||||
Handle(NCollection_IncAllocator) anAllocator = new NCollection_IncAllocator (MEMORY_BLOCK_SIZE);
|
||||
@@ -91,7 +86,7 @@ void SelectMgr_TriangularFrustumSet::Build (const TColgp_Array1OfPnt2d& thePoint
|
||||
aPts[aVertIdx] = aVertex.Coord();
|
||||
}
|
||||
|
||||
SelectMgr_HTriangularFrustum aTrFrustum = new SelectMgr_TriangularFrustum();
|
||||
Handle(SelectMgr_TriangularFrustum) aTrFrustum = new SelectMgr_TriangularFrustum();
|
||||
aTrFrustum->SetBuilder (myBuilder);
|
||||
aTrFrustum->Build (aPts[0], aPts[1], aPts[2]);
|
||||
myFrustums.Append (aTrFrustum);
|
||||
@@ -112,7 +107,7 @@ NCollection_Handle<SelectMgr_BaseFrustum> SelectMgr_TriangularFrustumSet::Transf
|
||||
|
||||
for (SelectMgr_TriangFrustumsIter anIter (myFrustums); anIter.More(); anIter.Next())
|
||||
{
|
||||
aRes->myFrustums.Append (NCollection_Handle<SelectMgr_TriangularFrustum>::DownCast (anIter.Value()->Transform (theTrsf)));
|
||||
aRes->myFrustums.Append (Handle(SelectMgr_TriangularFrustum)::DownCast (anIter.Value()->Transform (theTrsf)));
|
||||
}
|
||||
|
||||
return NCollection_Handle<SelectMgr_BaseFrustum> (aRes);
|
||||
|
||||
@@ -22,9 +22,8 @@
|
||||
#include <SelectMgr_BaseFrustum.hxx>
|
||||
#include <SelectMgr_TriangularFrustum.hxx>
|
||||
|
||||
typedef NCollection_Handle<SelectMgr_TriangularFrustum> SelectMgr_HTriangularFrustum;
|
||||
typedef NCollection_List<SelectMgr_HTriangularFrustum> SelectMgr_TriangFrustums;
|
||||
typedef NCollection_List<SelectMgr_HTriangularFrustum>::Iterator SelectMgr_TriangFrustumsIter;
|
||||
typedef NCollection_List<Handle(SelectMgr_TriangularFrustum)> SelectMgr_TriangFrustums;
|
||||
typedef NCollection_List<Handle(SelectMgr_TriangularFrustum)>::Iterator SelectMgr_TriangFrustumsIter;
|
||||
|
||||
//! This class is used to handle polyline selection. The main principle of polyline selection
|
||||
//! algorithm is to split the polygon defined by polyline onto triangles. Than each of
|
||||
|
||||
Reference in New Issue
Block a user