1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-21 10:13:43 +03:00

0024971: Incomplete interface of NCollection classes

NCollection classes amended to be compatible with TCollection equivalents:

- List and Maps: copy constructor is used for placement of new items in collection instead of assignment operator, thus default constructor is not necessary any more for the item class
- Constructors with additional argument of element type added in array classes operated by Handle, defined by NCollection_DefineHArray*.hxx, allowing to initialize array immediately by specified value
- Non-const methods First() and Last() are added in List class, and method Value() in TListIterator class
- Method Append() accepting Handle(HSequence) provided in NCollection_DefineHSequence.hxx
- Default implementation of global function IsEqual() is provided as template (using operator ==)

Code using lists and maps of sequences is refactored to operate sequence by Handle (since Sequence does not to have public copy constructor).

In addition, error checking code is simplified to use macros _Raise_if instead of custom #ifdefs with the same meaning.
Comments within declaration of instances of generic classes in CDL removed.

Fixed bug in copy constructor of NCollection_BaseVector leading to corrupt data if original vector is empty; simplistic test command for vectors is added.
This commit is contained in:
abv 2014-06-11 10:43:27 +04:00 committed by apn
parent 655fddc854
commit e3a6386d18
31 changed files with 322 additions and 494 deletions

View File

@ -84,12 +84,14 @@
#include <Select3D_SensitiveTriangulation.hxx> #include <Select3D_SensitiveTriangulation.hxx>
#include <SelectBasics_SensitiveEntity.hxx> #include <SelectBasics_SensitiveEntity.hxx>
#include <TCollection_AsciiString.hxx> #include <TCollection_AsciiString.hxx>
#include <NCollection_Map.hxx>
#ifdef OCC9026 #ifdef OCC9026
#include <SelectMgr_DataMapIteratorOfDataMapOfIntegerSensitive.hxx> #include <SelectMgr_DataMapIteratorOfDataMapOfIntegerSensitive.hxx>
#endif #endif
#include <SelectMgr_Selection.hxx> #include <SelectMgr_Selection.hxx>
#include <SelectMgr_SequenceOfOwner.hxx>
#include <OSD_Environment.hxx> #include <OSD_Environment.hxx>
#include <SelectMgr_DataMapOfObjectOwners.hxx>
#include <Geom_Transformation.hxx> #include <Geom_Transformation.hxx>
#include <AIS_Selection.hxx> #include <AIS_Selection.hxx>
@ -565,9 +567,11 @@ void AIS_LocalContext::HilightPicked(const Standard_Boolean updateviewer)
if( Sel.IsNull() ) return; if( Sel.IsNull() ) return;
#endif #endif
Handle (PrsMgr_PresentationManager3d) PM = myMainPM; typedef NCollection_DataMap <Handle(SelectMgr_SelectableObject), NCollection_Handle<SelectMgr_SequenceOfOwner> > SelectMgr_DataMapOfObjectOwners;
SelectMgr_DataMapOfObjectOwners aMap; SelectMgr_DataMapOfObjectOwners aMap;
Handle (PrsMgr_PresentationManager3d) PM = myMainPM;
// to avoid problems when there is a loop searching for selected objects... // to avoid problems when there is a loop searching for selected objects...
#if !defined OCC189 && !defined USE_MAP #if !defined OCC189 && !defined USE_MAP
const TColStd_Array1OfTransient& Obj = Sel->Objects()->Array1(); const TColStd_Array1OfTransient& Obj = Sel->Objects()->Array1();
@ -602,18 +606,20 @@ void AIS_LocalContext::HilightPicked(const Standard_Boolean updateviewer)
if ( Ownr->IsAutoHilight() ) if ( Ownr->IsAutoHilight() )
Ownr->HilightWithColor(PM,myCTX->SelectionColor(),HM); Ownr->HilightWithColor(PM,myCTX->SelectionColor(),HM);
else if ( aMap.IsBound (SO) ) else if ( aMap.IsBound (SO) )
aMap.ChangeFind(SO).Append ( Ownr ); aMap(SO)->Append ( Ownr );
else { else {
SelectMgr_SequenceOfOwner aSeq; NCollection_Handle<SelectMgr_SequenceOfOwner> aSeq = new SelectMgr_SequenceOfOwner;
aSeq.Append ( Ownr ); aSeq->Append ( Ownr );
aMap.Bind ( SO, aSeq ); aMap.Bind ( SO, aSeq );
} }
} }
} }
for ( SelectMgr_DataMapIteratorOfMapOfObjectOwners aMapIter(aMap); for ( SelectMgr_DataMapOfObjectOwners::Iterator aMapIter(aMap);
aMapIter.More(); aMapIter.Next() ) aMapIter.More(); aMapIter.Next() )
aMapIter.Key()->HilightSelected ( myMainPM, aMapIter.Value() ); {
aMapIter.Key()->HilightSelected (myMainPM, *aMapIter.Value());
}
if (updateviewer) if (updateviewer)
{ {
@ -636,8 +642,7 @@ void AIS_LocalContext::UnhilightPicked (const Standard_Boolean updateviewer)
if( Sel.IsNull() ) return; if( Sel.IsNull() ) return;
#endif #endif
Handle (PrsMgr_PresentationManager3d) PM = myMainPM; Handle (PrsMgr_PresentationManager3d) PM = myMainPM;
SelectMgr_DataMapOfObjectOwners anObjMap; NCollection_Map<Handle(SelectMgr_SelectableObject)> anObjMap;
SelectMgr_SequenceOfOwner anOwnSeq;
#if !defined OCC189 && !defined USE_MAP #if !defined OCC189 && !defined USE_MAP
const TColStd_Array1OfTransient& Obj = Sel->Objects()->Array1(); const TColStd_Array1OfTransient& Obj = Sel->Objects()->Array1();
@ -657,9 +662,9 @@ void AIS_LocalContext::UnhilightPicked (const Standard_Boolean updateviewer)
#ifdef BUC60876 #ifdef BUC60876
Handle(SelectMgr_SelectableObject) SO = Ownr->Selectable(); Handle(SelectMgr_SelectableObject) SO = Ownr->Selectable();
Handle(AIS_InteractiveObject) IO = *((Handle(AIS_InteractiveObject)*)&SO); Handle(AIS_InteractiveObject) IO = *((Handle(AIS_InteractiveObject)*)&SO);
anObjMap.Bind ( IO, anOwnSeq ); anObjMap.Add (IO);
HM = GetHiMod(IO); HM = GetHiMod(IO);
#endif #endif
Handle(StdSelect_BRepOwner) BROwnr = Handle(StdSelect_BRepOwner)::DownCast(Ownr); Handle(StdSelect_BRepOwner) BROwnr = Handle(StdSelect_BRepOwner)::DownCast(Ownr);
if(BROwnr.IsNull() || !BROwnr->ComesFromDecomposition()){ if(BROwnr.IsNull() || !BROwnr->ComesFromDecomposition()){
@ -677,10 +682,12 @@ void AIS_LocalContext::UnhilightPicked (const Standard_Boolean updateviewer)
} }
} }
for ( SelectMgr_DataMapIteratorOfMapOfObjectOwners anIter1 ( anObjMap ); for (NCollection_Map<Handle(SelectMgr_SelectableObject)>::Iterator anIter1 ( anObjMap );
anIter1.More(); anIter1.Next() ) anIter1.More(); anIter1.Next() )
{
if ( !anIter1.Key()->IsAutoHilight() ) if ( !anIter1.Key()->IsAutoHilight() )
anIter1.Key()->ClearSelected(); anIter1.Key()->ClearSelected();
}
if(updateviewer){ if(updateviewer){
#ifdef BUC60774 #ifdef BUC60774

View File

@ -44,10 +44,10 @@ is
---Purpose: this map will allows to get a directory object from a name. ---Purpose: this map will allows to get a directory object from a name.
private class PresentationDirectory instantiates DataMap from TCollection private class PresentationDirectory instantiates DataMap from TCollection
---Purpose: this map will allows to get a directory object from a name.
(ExtendedString from TCollection, (ExtendedString from TCollection,
Document from CDM, Document from CDM,
ExtendedString from TCollection); ExtendedString from TCollection);
---Purpose: this map will allows to get a directory object from a name.
private pointer DocumentPointer to Document from CDM; private pointer DocumentPointer to Document from CDM;
private class Reference; private class Reference;

View File

@ -92,40 +92,30 @@ is
-- The class instantiations : -- The class instantiations :
-- class Array1OfHArray1OfInteger instantiates
-- Array1 from TCollection (HArray1OfInteger from TColStd);
-- class Array1OfHArray1OfReal instantiates
-- Array1 from TCollection (HArray1OfReal from TColStd);
-- class Array1OfHArray1OfXY instantiates
-- Array1 from TCollection (HArray1OfXY from TColgp);
-- class Array1OfHArray1OfXYZ instantiates
-- Array1 from TCollection (HArray1OfXYZ from TColgp);
class Array2OfHArray1OfReal instantiates class Array2OfHArray1OfReal instantiates
Array2 from TCollection (HArray1OfReal from TColStd); Array2 from TCollection (HArray1OfReal from TColStd);
-- class Array1OfHArray1OfIGESEntity instantiates
-- Array1 from TCollection (HArray1OfIGESEntity from IGESData);
class Array1OfLineFontEntity instantiates class Array1OfLineFontEntity instantiates
Array1 from TCollection (LineFontEntity from IGESData); Array1 from TCollection (LineFontEntity from IGESData);
class HArray1OfHArray1OfInteger instantiates class HArray1OfHArray1OfInteger instantiates
-- HArray1 from TCollection (HArray1OfInteger from TColStd,Array1OfHArray1OfInteger);
JaggedArray from Interface (HArray1OfInteger from TColStd); JaggedArray from Interface (HArray1OfInteger from TColStd);
-- HArray1 from TCollection (HArray1OfInteger from TColStd,Array1OfHArray1OfInteger);
class HArray1OfHArray1OfReal instantiates class HArray1OfHArray1OfReal instantiates
-- HArray1 from TCollection (HArray1OfReal from TColStd,Array1OfHArray1OfReal);
JaggedArray from Interface (HArray1OfReal from TColStd); JaggedArray from Interface (HArray1OfReal from TColStd);
-- HArray1 from TCollection (HArray1OfReal from TColStd,Array1OfHArray1OfReal);
class HArray1OfHArray1OfXY instantiates class HArray1OfHArray1OfXY instantiates
-- HArray1 from TCollection (HArray1OfXY from TColgp, Array1OfHArray1OfXY);
JaggedArray from Interface (HArray1OfXY from TColgp); JaggedArray from Interface (HArray1OfXY from TColgp);
-- HArray1 from TCollection (HArray1OfXY from TColgp, Array1OfHArray1OfXY);
class HArray1OfHArray1OfXYZ instantiates class HArray1OfHArray1OfXYZ instantiates
-- HArray1 from TCollection (HArray1OfXYZ from TColgp, Array1OfHArray1OfXYZ);
JaggedArray from Interface (HArray1OfXYZ from TColgp); JaggedArray from Interface (HArray1OfXYZ from TColgp);
-- HArray1 from TCollection (HArray1OfXYZ from TColgp, Array1OfHArray1OfXYZ);
class HArray2OfHArray1OfReal instantiates HArray2 from TCollection class HArray2OfHArray1OfReal instantiates HArray2 from TCollection
(HArray1OfReal from TColStd,Array2OfHArray1OfReal); (HArray1OfReal from TColStd,Array2OfHArray1OfReal);
class HArray1OfHArray1OfIGESEntity instantiates class HArray1OfHArray1OfIGESEntity instantiates
-- HArray1 from TCollection (HArray1OfIGESEntity from IGESData,Array1OfHArray1OfIGESEntity);
JaggedArray from Interface (HArray1OfIGESEntity from IGESData); JaggedArray from Interface (HArray1OfIGESEntity from IGESData);
-- HArray1 from TCollection (HArray1OfIGESEntity from IGESData,Array1OfHArray1OfIGESEntity);
class HArray1OfLineFontEntity instantiates HArray1 from TCollection class HArray1OfLineFontEntity instantiates HArray1 from TCollection
(LineFontEntity from IGESData,Array1OfLineFontEntity); (LineFontEntity from IGESData,Array1OfLineFontEntity);

View File

@ -128,15 +128,13 @@ is
-- -- Instantiations -- -- -- -- Instantiations -- --
private class SequenceOfCheck instantiates -- for HSequence private class SequenceOfCheck instantiates
Sequence from TCollection (Check); Sequence from TCollection (Check);
private class HSequenceOfCheck instantiates -- Transient private class HSequenceOfCheck instantiates
HSequence from TCollection (Check,SequenceOfCheck); HSequence from TCollection (Check,SequenceOfCheck);
class Array1OfFileParameter instantiates -- for ParamList : class Array1OfFileParameter instantiates
Array1 from TCollection (FileParameter); Array1 from TCollection (FileParameter);
-- class HArray1OfFileParameter instantiates -- Array, Transient
-- HArray1 from TCollection (FileParameter,Array1OfFileParameter);
-- Useful Instantiations to define Data -- Useful Instantiations to define Data

View File

@ -160,13 +160,12 @@ void MeshTest_CheckTopology::Perform (Draw_Interpretor& di)
if (aMapBndNodes.Contains(n1) && aMapBndNodes.Contains(n2)) if (aMapBndNodes.Contains(n1) && aMapBndNodes.Contains(n2))
continue; continue;
if (!myMapFaceLinks.Contains(iF)) { if (!myMapFaceLinks.Contains(iF)) {
//myMapFaceLinks.Add(iF, TColStd_SequenceOfInteger()); Handle(TColStd_HSequenceOfInteger) tmpSeq = new TColStd_HSequenceOfInteger;
TColStd_SequenceOfInteger tmpSeq;
myMapFaceLinks.Add(iF, tmpSeq); myMapFaceLinks.Add(iF, tmpSeq);
} }
TColStd_SequenceOfInteger& aSeq = myMapFaceLinks.ChangeFromKey(iF); Handle(TColStd_HSequenceOfInteger)& aSeq = myMapFaceLinks.ChangeFromKey(iF);
aSeq.Append(n1); aSeq->Append(n1);
aSeq.Append(n2); aSeq->Append(n2);
} }
} }
} }
@ -193,10 +192,10 @@ void MeshTest_CheckTopology::GetFreeLink(const Standard_Integer theFaceIndex,
Standard_Integer& theNode1, Standard_Integer& theNode1,
Standard_Integer& theNode2) const Standard_Integer& theNode2) const
{ {
const TColStd_SequenceOfInteger& aSeq = myMapFaceLinks(theFaceIndex); const Handle(TColStd_HSequenceOfInteger)& aSeq = myMapFaceLinks(theFaceIndex);
Standard_Integer aInd = (theLinkIndex-1)*2 + 1; Standard_Integer aInd = (theLinkIndex-1)*2 + 1;
theNode1 = aSeq(aInd); theNode1 = aSeq->Value(aInd);
theNode2 = aSeq(aInd+1); theNode2 = aSeq->Value(aInd+1);
} }
//======================================================================= //=======================================================================

View File

@ -18,7 +18,7 @@
#include <TopoDS_Shape.hxx> #include <TopoDS_Shape.hxx>
#include <NCollection_IndexedDataMap.hxx> #include <NCollection_IndexedDataMap.hxx>
#include <TColStd_SequenceOfInteger.hxx> #include <TColStd_HSequenceOfInteger.hxx>
#include <TColStd_SequenceOfReal.hxx> #include <TColStd_SequenceOfReal.hxx>
#include <Draw_Interpretor.hxx> #include <Draw_Interpretor.hxx>
@ -58,7 +58,7 @@ public:
//! returns the number free links on a face with the given index //! returns the number free links on a face with the given index
Standard_Integer NbFreeLinks(const Standard_Integer theIndex) const Standard_Integer NbFreeLinks(const Standard_Integer theIndex) const
{ return myMapFaceLinks(theIndex).Length() / 2; } { return myMapFaceLinks(theIndex)->Length() / 2; }
//! gets the numbers of nodes of a free link with the given index //! gets the numbers of nodes of a free link with the given index
//! in the face with the given index //! in the face with the given index
@ -103,7 +103,7 @@ public:
private: private:
TopoDS_Shape myShape; TopoDS_Shape myShape;
NCollection_IndexedDataMap<Standard_Integer,TColStd_SequenceOfInteger> NCollection_IndexedDataMap<Standard_Integer,Handle(TColStd_HSequenceOfInteger)>
myMapFaceLinks; myMapFaceLinks;
TColStd_SequenceOfInteger myErrors; TColStd_SequenceOfInteger myErrors;

View File

@ -1024,12 +1024,6 @@ void MeshVS_Mesh::HilightOwnerWithColor ( const Handle(PrsMgr_PresentationManage
if ( myHilighter.IsNull() ) if ( myHilighter.IsNull() )
return; return;
SelectMgr_SequenceOfOwner theOwners;
//new functionality
//if ( myHilightPrs.IsNull() )
// myHilightPrs = new Prs3d_Presentation ( PM->StructureManager() );
Handle( Prs3d_Presentation ) aHilightPrs; Handle( Prs3d_Presentation ) aHilightPrs;
aHilightPrs = GetHilightPresentation( PM ); aHilightPrs = GetHilightPresentation( PM );

View File

@ -16,11 +16,9 @@
#ifndef NCollection_Array1_HeaderFile #ifndef NCollection_Array1_HeaderFile
#define NCollection_Array1_HeaderFile #define NCollection_Array1_HeaderFile
#ifndef No_Exception
#include <Standard_DimensionMismatch.hxx> #include <Standard_DimensionMismatch.hxx>
#include <Standard_OutOfMemory.hxx> #include <Standard_OutOfMemory.hxx>
#include <Standard_OutOfRange.hxx> #include <Standard_OutOfRange.hxx>
#endif
#include <NCollection_DefineAlloc.hxx> #include <NCollection_DefineAlloc.hxx>
#include <NCollection_StlIterator.hxx> #include <NCollection_StlIterator.hxx>
@ -163,15 +161,9 @@ public:
myUpperBound (theUpper), myUpperBound (theUpper),
myDeletable (Standard_True) myDeletable (Standard_True)
{ {
#if !defined No_Exception && !defined No_Standard_RangeError Standard_RangeError_Raise_if (theUpper < theLower, "NCollection_Array1::Create");
if (theUpper < theLower)
Standard_RangeError::Raise ("NCollection_Array1::Create");
#endif
TheItemType* pBegin = new TheItemType[Length()]; TheItemType* pBegin = new TheItemType[Length()];
#if !defined No_Exception && !defined No_Standard_OutOfMemory Standard_OutOfMemory_Raise_if (!pBegin, "NCollection_Array1 : Allocation failed");
if (!pBegin)
Standard_OutOfMemory::Raise ("NCollection_Array1 : Allocation failed");
#endif
myData = pBegin - theLower; myData = pBegin - theLower;
} }
@ -183,10 +175,7 @@ public:
myDeletable (Standard_True) myDeletable (Standard_True)
{ {
TheItemType* pBegin = new TheItemType[Length()]; TheItemType* pBegin = new TheItemType[Length()];
#if !defined No_Exception && !defined No_Standard_OutOfMemory Standard_OutOfMemory_Raise_if (!pBegin, "NCollection_Array1 : Allocation failed");
if (!pBegin)
Standard_OutOfMemory::Raise ("NCollection_Array1 : Allocation failed");
#endif
myData = pBegin - myLowerBound; myData = pBegin - myLowerBound;
*this = theOther; *this = theOther;
@ -200,10 +189,7 @@ public:
myUpperBound (theUpper), myUpperBound (theUpper),
myDeletable (Standard_False) myDeletable (Standard_False)
{ {
#if !defined No_Exception && !defined No_Standard_RangeError Standard_RangeError_Raise_if (theUpper < theLower, "NCollection_Array1::Create");
if (theUpper < theLower)
Standard_RangeError::Raise ("NCollection_Array1::Array1");
#endif
myData = (TheItemType *) &theBegin - theLower; myData = (TheItemType *) &theBegin - theLower;
} }
@ -242,10 +228,7 @@ public:
{ {
if (&theOther == this) if (&theOther == this)
return *this; return *this;
#if !defined No_Exception && !defined No_Standard_DimensionMismatch Standard_DimensionMismatch_Raise_if (Length() != theOther.Length(), "NCollection_Array1::operator=");
if (Length() != theOther.Length())
Standard_DimensionMismatch::Raise ("NCollection_Array1::operator=");
#endif
TheItemType * pMyItem = &myData[myLowerBound]; TheItemType * pMyItem = &myData[myLowerBound];
TheItemType * const pEndItem = &(theOther.myData)[theOther.myUpperBound]; TheItemType * const pEndItem = &(theOther.myData)[theOther.myUpperBound];
TheItemType * pItem = &(theOther.myData)[theOther.myLowerBound]; TheItemType * pItem = &(theOther.myData)[theOther.myLowerBound];
@ -286,10 +269,7 @@ public:
//! Constant value access //! Constant value access
const TheItemType& Value (const Standard_Integer theIndex) const const TheItemType& Value (const Standard_Integer theIndex) const
{ {
#if !defined No_Exception && !defined No_Standard_OutOfRange Standard_OutOfRange_Raise_if (theIndex < myLowerBound || theIndex > myUpperBound, "NCollection_Array1::Value");
if (theIndex < myLowerBound || theIndex > myUpperBound)
Standard_OutOfRange::Raise ("NCollection_Array1::Value");
#endif
return myData[theIndex]; return myData[theIndex];
} }
@ -300,10 +280,7 @@ public:
//! Variable value access //! Variable value access
TheItemType& ChangeValue (const Standard_Integer theIndex) TheItemType& ChangeValue (const Standard_Integer theIndex)
{ {
#if !defined No_Exception && !defined No_Standard_OutOfRange Standard_OutOfRange_Raise_if (theIndex < myLowerBound || theIndex > myUpperBound, "NCollection_Array1::ChangeValue");
if (theIndex < myLowerBound || theIndex > myUpperBound)
Standard_OutOfRange::Raise ("NCollection_Array1::ChangeValue");
#endif
return myData[theIndex]; return myData[theIndex];
} }
@ -315,10 +292,7 @@ public:
void SetValue (const Standard_Integer theIndex, void SetValue (const Standard_Integer theIndex,
const TheItemType& theItem) const TheItemType& theItem)
{ {
#if !defined No_Exception && !defined No_Standard_OutOfRange Standard_OutOfRange_Raise_if (theIndex < myLowerBound || theIndex > myUpperBound, "NCollection_Array1::SetValue");
if (theIndex < myLowerBound || theIndex > myUpperBound)
Standard_OutOfRange::Raise ("NCollection_Array1::SetValue");
#endif
myData[theIndex] = theItem; myData[theIndex] = theItem;
} }

View File

@ -16,11 +16,9 @@
#ifndef NCollection_Array2_HeaderFile #ifndef NCollection_Array2_HeaderFile
#define NCollection_Array2_HeaderFile #define NCollection_Array2_HeaderFile
#ifndef No_Exception
#include <Standard_DimensionMismatch.hxx> #include <Standard_DimensionMismatch.hxx>
#include <Standard_OutOfMemory.hxx> #include <Standard_OutOfMemory.hxx>
#include <Standard_OutOfRange.hxx> #include <Standard_OutOfRange.hxx>
#endif
#include <NCollection_DefineAlloc.hxx> #include <NCollection_DefineAlloc.hxx>
@ -171,10 +169,7 @@ public:
{ {
if (&theOther == this) if (&theOther == this)
return *this; return *this;
#if !defined No_Exception && !defined No_Standard_DimensionMismatch Standard_DimensionMismatch_Raise_if (Length() != theOther.Length(), "NCollection_Array2::operator=");
if (Length() != theOther.Length())
Standard_DimensionMismatch::Raise ("NCollection_Array2::operator=");
#endif
TheItemType * pMyItem = myStart; TheItemType * pMyItem = myStart;
TheItemType * pItem = theOther.myStart; TheItemType * pItem = theOther.myStart;
const Standard_Integer iSize = Length(); const Standard_Integer iSize = Length();
@ -193,11 +188,8 @@ public:
const TheItemType& Value (const Standard_Integer theRow, const TheItemType& Value (const Standard_Integer theRow,
const Standard_Integer theCol) const const Standard_Integer theCol) const
{ {
#if !defined No_Exception && !defined No_Standard_OutOfRange Standard_OutOfRange_Raise_if (theRow < myLowerRow || theRow > myUpperRow ||
if (theRow < myLowerRow || theRow > myUpperRow || theCol < myLowerCol || theCol > myUpperCol, "NCollection_Array2::Value");
theCol < myLowerCol || theCol > myUpperCol)
Standard_OutOfRange::Raise ("NCollection_Array2::Value");
#endif
return myData[theRow][theCol]; return myData[theRow][theCol];
} }
@ -210,11 +202,8 @@ public:
TheItemType& ChangeValue (const Standard_Integer theRow, TheItemType& ChangeValue (const Standard_Integer theRow,
const Standard_Integer theCol) const Standard_Integer theCol)
{ {
#if !defined No_Exception && !defined No_Standard_OutOfRange Standard_OutOfRange_Raise_if (theRow < myLowerRow || theRow > myUpperRow ||
if (theRow < myLowerRow || theRow > myUpperRow || theCol < myLowerCol || theCol > myUpperCol, "NCollection_Array2::ChangeValue");
theCol < myLowerCol || theCol > myUpperCol)
Standard_OutOfRange::Raise ("NCollection_Array2::ChangeValue");
#endif
return myData[theRow][theCol]; return myData[theRow][theCol];
} }
@ -228,11 +217,8 @@ public:
const Standard_Integer theCol, const Standard_Integer theCol,
const TheItemType& theItem) const TheItemType& theItem)
{ {
#if !defined No_Exception && !defined No_Standard_OutOfRange Standard_OutOfRange_Raise_if (theRow < myLowerRow || theRow > myUpperRow ||
if (theRow < myLowerRow || theRow > myUpperRow || theCol < myLowerCol || theCol > myUpperCol, "NCollection_Array2::SetValue");
theCol < myLowerCol || theCol > myUpperCol)
Standard_OutOfRange::Raise ("NCollection_Array2::SetValue");
#endif
myData[theRow][theCol] = theItem; myData[theRow][theCol] = theItem;
} }
@ -251,24 +237,15 @@ public:
{ {
const Standard_Integer iRowSize = myUpperCol - myLowerCol + 1; const Standard_Integer iRowSize = myUpperCol - myLowerCol + 1;
const Standard_Integer iColSize = myUpperRow - myLowerRow + 1; const Standard_Integer iColSize = myUpperRow - myLowerRow + 1;
#if !defined No_Exception && !defined No_Standard_RangeError Standard_RangeError_Raise_if (iRowSize <= 0 || iColSize <= 0, "NCollection_Array2::Allocate");
if (iRowSize <= 0 || iColSize <= 0)
Standard_RangeError::Raise ("NCollection_Array2::Allocate");
#endif
if (myDeletable) { if (myDeletable) {
// allocation of the data in the array // allocation of the data in the array
myStart = new TheItemType[iRowSize * iColSize]; myStart = new TheItemType[iRowSize * iColSize];
#if !defined No_Exception && !defined No_Standard_OutOfMemory Standard_OutOfMemory_Raise_if (!myStart, "NCollection_Array2 : Allocation failed");
if (!myStart)
Standard_OutOfMemory::Raise ("NCollection_Array2 : Allocation failed");
#endif
} }
// else myStart is set to the beginning of the given array // else myStart is set to the beginning of the given array
TheItemType** pTable = new TheItemType* [iColSize]; TheItemType** pTable = new TheItemType* [iColSize];
#if !defined No_Exception && !defined No_Standard_OutOfMemory Standard_OutOfMemory_Raise_if (!pTable, "NCollection_Array2 : Allocation failed");
if (!pTable)
Standard_OutOfMemory::Raise ("NCollection_Array2 : Allocation failed");
#endif
// Items of pTable point to the '0'th items in the rows of the array // Items of pTable point to the '0'th items in the rows of the array
TheItemType* pRow = myStart - myLowerCol; TheItemType* pRow = myStart - myLowerCol;

View File

@ -177,7 +177,7 @@ protected: //! @name protected methods
myIncrement (theOther.myIncrement), myIncrement (theOther.myIncrement),
myLength (theOther.myLength), myLength (theOther.myLength),
myCapacity (GetCapacity(myIncrement) + theOther.myLength / theOther.myIncrement), myCapacity (GetCapacity(myIncrement) + theOther.myLength / theOther.myIncrement),
myNBlocks (1 + (theOther.myLength - 1)/theOther.myIncrement), myNBlocks (theOther.myLength == 0 ? 0 : 1 + (theOther.myLength - 1)/theOther.myIncrement),
myInitBlocks (theInitBlocks) myInitBlocks (theInitBlocks)
{ {
myAllocator = (theAllocator.IsNull() ? NCollection_BaseAllocator::CommonBaseAllocator() : theAllocator); myAllocator = (theAllocator.IsNull() ? NCollection_BaseAllocator::CommonBaseAllocator() : theAllocator);

View File

@ -56,8 +56,10 @@ class NCollection_DataMap : public NCollection_BaseMap
DataMapNode (const TheKeyType& theKey, DataMapNode (const TheKeyType& theKey,
const TheItemType& theItem, const TheItemType& theItem,
NCollection_ListNode* theNext) : NCollection_ListNode* theNext) :
NCollection_TListNode<TheItemType> (theItem, theNext) NCollection_TListNode<TheItemType> (theItem, theNext),
{ myKey = theKey; } myKey(theKey)
{}
//! Key //! Key
const TheKeyType& Key (void) const const TheKeyType& Key (void) const
{ return myKey; } { return myKey; }
@ -94,28 +96,19 @@ class NCollection_DataMap : public NCollection_BaseMap
//! Value inquiry //! Value inquiry
const TheItemType& Value(void) const const TheItemType& Value(void) const
{ {
#if !defined No_Exception && !defined No_Standard_NoSuchObject Standard_NoSuchObject_Raise_if(!More(), "NCollection_DataMap::Iterator::Value");
if (!More())
Standard_NoSuchObject::Raise("NCollection_DataMap::Iterator::Value");
#endif
return ((DataMapNode *) myNode)->Value(); return ((DataMapNode *) myNode)->Value();
} }
//! Value change access //! Value change access
TheItemType& ChangeValue(void) const TheItemType& ChangeValue(void) const
{ {
#if !defined No_Exception && !defined No_Standard_NoSuchObject Standard_NoSuchObject_Raise_if(!More(), "NCollection_DataMap::Iterator::ChangeValue");
if (!More())
Standard_NoSuchObject::Raise("NCollection_DataMap::Iterator::ChangeValue");
#endif
return ((DataMapNode *) myNode)->ChangeValue(); return ((DataMapNode *) myNode)->ChangeValue();
} }
//! Key //! Key
const TheKeyType& Key (void) const const TheKeyType& Key (void) const
{ {
#if !defined No_Exception && !defined No_Standard_NoSuchObject Standard_NoSuchObject_Raise_if(!More(), "NCollection_DataMap::Iterator::Key");
if (!More())
Standard_NoSuchObject::Raise("NCollection_DataMap::Iterator::Key");
#endif
return ((DataMapNode *) myNode)->Key(); return ((DataMapNode *) myNode)->Key();
} }
}; };
@ -280,10 +273,7 @@ class NCollection_DataMap : public NCollection_BaseMap
//! Find //! Find
const TheItemType& Find(const TheKeyType& theKey) const const TheItemType& Find(const TheKeyType& theKey) const
{ {
#if !defined No_Exception && !defined No_Standard_NoSuchObject Standard_NoSuchObject_Raise_if (IsEmpty(), "NCollection_DataMap::Find");
if (IsEmpty())
Standard_NoSuchObject::Raise ("NCollection_DataMap::Find");
#endif
DataMapNode* p = (DataMapNode*) myData1[Hasher::HashCode(theKey,NbBuckets())]; DataMapNode* p = (DataMapNode*) myData1[Hasher::HashCode(theKey,NbBuckets())];
while (p) while (p)
{ {
@ -325,10 +315,7 @@ class NCollection_DataMap : public NCollection_BaseMap
//! ChangeFind //! ChangeFind
TheItemType& ChangeFind (const TheKeyType& theKey) TheItemType& ChangeFind (const TheKeyType& theKey)
{ {
#if !defined No_Exception && !defined No_Standard_NoSuchObject Standard_NoSuchObject_Raise_if (IsEmpty(), "NCollection_DataMap::Find");
if (IsEmpty())
Standard_NoSuchObject::Raise ("NCollection_DataMap::Find");
#endif
DataMapNode* p = (DataMapNode*) myData1[Hasher::HashCode(theKey,NbBuckets())]; DataMapNode* p = (DataMapNode*) myData1[Hasher::HashCode(theKey,NbBuckets())];
while (p) while (p)
{ {

View File

@ -22,20 +22,36 @@
//function : HashCode_Proxy //function : HashCode_Proxy
//purpose : Function is required to call the global function HashCode. //purpose : Function is required to call the global function HashCode.
//======================================================================= //=======================================================================
template <class TheKeyType> template <class TheKeyType>
static Standard_Integer HashCode_Proxy(const TheKeyType& theKey, inline Standard_Integer HashCode_Proxy (const TheKeyType& theKey,
const Standard_Integer Upper) { const Standard_Integer Upper)
return HashCode(theKey, Upper); {
return HashCode (theKey, Upper);
}
//=======================================================================
//function : IsEqual
//purpose : Default implementation of IsEqual via operator ==
//=======================================================================
template <class TheKeyType>
inline Standard_Boolean IsEqual (const TheKeyType& theKey1,
const TheKeyType& theKey2)
{
return theKey1 == theKey2;
} }
//======================================================================= //=======================================================================
//function : IsEqual_Proxy //function : IsEqual_Proxy
//purpose : Function is required to call the global function IsEqual. //purpose : Function is required to call the global function IsEqual.
//======================================================================= //=======================================================================
template <class TheKeyType> template <class TheKeyType>
static Standard_Boolean IsEqual_Proxy(const TheKeyType& theKey1, inline Standard_Boolean IsEqual_Proxy (const TheKeyType& theKey1,
const TheKeyType& theKey2) { const TheKeyType& theKey2)
return IsEqual(theKey1, theKey2); {
return IsEqual (theKey1, theKey2);
} }

View File

@ -25,36 +25,23 @@
// Declaration of Array1 class managed by Handle // Declaration of Array1 class managed by Handle
#define DEFINE_HARRAY1(HClassName, _Array1Type_) \ #define DEFINE_HARRAY1(HClassName, _Array1Type_) \
\ class HClassName : public _Array1Type_, public MMgt_TShared { \
class HClassName : public _Array1Type_, \
public MMgt_TShared { \
public: \ public: \
DEFINE_STANDARD_ALLOC \ DEFINE_STANDARD_ALLOC \
DEFINE_NCOLLECTION_ALLOC \ DEFINE_NCOLLECTION_ALLOC \
inline HClassName (const Standard_Integer theLower, \ HClassName (const Standard_Integer theLower, \
const Standard_Integer theUpper); \ const Standard_Integer theUpper) : \
inline HClassName (const _Array1Type_&); \ _Array1Type_ (theLower,theUpper) {} \
inline const _Array1Type_& Array1 () const; \ HClassName (const Standard_Integer theLower, \
inline _Array1Type_& ChangeArray1 (); \ const Standard_Integer theUpper, \
DEFINE_STANDARD_RTTI (HClassName) \ const _Array1Type_::value_type& theValue) : \
_Array1Type_ (theLower,theUpper) { Init (theValue); } \
HClassName (const _Array1Type_& theOther) : _Array1Type_(theOther) {} \
const _Array1Type_& Array1 () const { return *this; } \
_Array1Type_& ChangeArray1 () { return *this; } \
DEFINE_STANDARD_RTTI (HClassName) \
}; \ }; \
\ DEFINE_STANDARD_HANDLE (HClassName, MMgt_TShared)
DEFINE_STANDARD_HANDLE (HClassName, MMgt_TShared) \
\
inline HClassName::HClassName (const Standard_Integer theLower, \
const Standard_Integer theUpper) : \
_Array1Type_ (theLower,theUpper), \
MMgt_TShared() {} \
\
inline HClassName::HClassName (const _Array1Type_& theOther) : \
_Array1Type_(theOther), \
MMgt_TShared() {} \
\
inline const _Array1Type_& HClassName::Array1 () const \
{ return * (const _Array1Type_ *) this; } \
\
inline _Array1Type_& HClassName::ChangeArray1 () \
{ return * (_Array1Type_ *) this; } \
#define IMPLEMENT_HARRAY1(HClassName) \ #define IMPLEMENT_HARRAY1(HClassName) \
IMPLEMENT_STANDARD_HANDLE (HClassName, MMgt_TShared) \ IMPLEMENT_STANDARD_HANDLE (HClassName, MMgt_TShared) \

View File

@ -25,40 +25,28 @@
// Declaration of Array2 class managed by Handle // Declaration of Array2 class managed by Handle
#define DEFINE_HARRAY2(HClassName, _Array2Type_) \ #define DEFINE_HARRAY2(HClassName, _Array2Type_) \
\ class HClassName : public _Array2Type_, public MMgt_TShared { \
class HClassName : public _Array2Type_, \
public MMgt_TShared { \
public: \ public: \
DEFINE_STANDARD_ALLOC \ DEFINE_STANDARD_ALLOC \
DEFINE_NCOLLECTION_ALLOC \ DEFINE_NCOLLECTION_ALLOC \
inline HClassName (const Standard_Integer theRowLower, \ HClassName (const Standard_Integer theRowLow, \
const Standard_Integer theRowUpper, \ const Standard_Integer theRowUpp, \
const Standard_Integer theColLower, \ const Standard_Integer theColLow, \
const Standard_Integer theColUpper);\ const Standard_Integer theColUpp) : \
inline HClassName (const _Array2Type_&); \ _Array2Type_ (theRowLow, theRowUpp, theColLow, theColUpp) {} \
inline const _Array2Type_& Array2 () const; \ HClassName (const Standard_Integer theRowLow, \
inline _Array2Type_& ChangeArray2(); \ const Standard_Integer theRowUpp, \
DEFINE_STANDARD_RTTI (HClassName) \ const Standard_Integer theColLow, \
const Standard_Integer theColUpp, \
const _Array2Type_::value_type& theValue) : \
_Array2Type_ (theRowLow, theRowUpp, theColLow, theColUpp) \
{ Init (theValue); } \
HClassName (const _Array2Type_& theOther) : _Array2Type_(theOther) {} \
const _Array2Type_& Array2 () const { return *this; } \
_Array2Type_& ChangeArray2 () { return *this; } \
DEFINE_STANDARD_RTTI (HClassName) \
}; \ }; \
\ DEFINE_STANDARD_HANDLE (HClassName, MMgt_TShared)
DEFINE_STANDARD_HANDLE (HClassName, MMgt_TShared) \
\
inline HClassName::HClassName (const Standard_Integer theRowLow, \
const Standard_Integer theRowUpp, \
const Standard_Integer theColLow, \
const Standard_Integer theColUpp) : \
_Array2Type_ (theRowLow, theRowUpp, theColLow, theColUpp), \
MMgt_TShared() {} \
\
inline HClassName::HClassName (const _Array2Type_& theOther) : \
_Array2Type_(theOther), \
MMgt_TShared() {} \
\
inline const _Array2Type_& HClassName::Array2 () const \
{ return * (const _Array2Type_ *) this; } \
\
inline _Array2Type_& HClassName::ChangeArray2 () \
{ return * (_Array2Type_ *) this; } \
#define IMPLEMENT_HARRAY2(HClassName) \ #define IMPLEMENT_HARRAY2(HClassName) \
IMPLEMENT_STANDARD_HANDLE (HClassName, MMgt_TShared) \ IMPLEMENT_STANDARD_HANDLE (HClassName, MMgt_TShared) \

View File

@ -25,34 +25,26 @@
// Declaration of Sequence class managed by Handle // Declaration of Sequence class managed by Handle
#define DEFINE_HSEQUENCE(HClassName, _SequenceType_) \ #define DEFINE_HSEQUENCE(HClassName, _SequenceType_) \
\ DEFINE_STANDARD_HANDLE (HClassName, MMgt_TShared) \
class HClassName : public _SequenceType_, \ class HClassName : public _SequenceType_, public MMgt_TShared { \
public MMgt_TShared { \
public: \ public: \
DEFINE_STANDARD_ALLOC \ DEFINE_STANDARD_ALLOC \
DEFINE_NCOLLECTION_ALLOC \ DEFINE_NCOLLECTION_ALLOC \
inline HClassName (); \ HClassName () {} \
inline HClassName (const _SequenceType_&); \ HClassName (const _SequenceType_& theOther) : _SequenceType_(theOther) {} \
inline const _SequenceType_& Sequence () const; \ const _SequenceType_& Sequence () const { return *this; } \
inline _SequenceType_& ChangeSequence (); \ void Append (const _SequenceType_::value_type& theItem) { \
DEFINE_STANDARD_RTTI (HClassName) \ _SequenceType_::Append (theItem); \
}; \ } \
\ void Append (_SequenceType_& theSequence) { \
DEFINE_STANDARD_HANDLE (HClassName, MMgt_TShared) \ _SequenceType_::Append (theSequence); \
\ } \
inline HClassName::HClassName () : \ _SequenceType_& ChangeSequence () { return *this; } \
_SequenceType_(), \ void Append (const Handle(HClassName)& theOther) { \
MMgt_TShared() {} \ _SequenceType_::Append (theOther->ChangeSequence()); \
\ } \
inline HClassName::HClassName (const _SequenceType_& anOther) : \ DEFINE_STANDARD_RTTI (HClassName) \
_SequenceType_(anOther), \ };
MMgt_TShared() {} \
\
inline const _SequenceType_& HClassName::Sequence () const \
{ return * (const _SequenceType_ *) this; } \
\
inline _SequenceType_& HClassName::ChangeSequence () \
{ return * (_SequenceType_ *) this; } \
#define IMPLEMENT_HSEQUENCE(HClassName) \ #define IMPLEMENT_HSEQUENCE(HClassName) \
IMPLEMENT_STANDARD_HANDLE (HClassName, MMgt_TShared) \ IMPLEMENT_STANDARD_HANDLE (HClassName, MMgt_TShared) \

View File

@ -50,10 +50,10 @@ class NCollection_DoubleMap : public NCollection_BaseMap
const TheKey2Type& theKey2, const TheKey2Type& theKey2,
NCollection_ListNode* theNext1, NCollection_ListNode* theNext1,
NCollection_ListNode* theNext2) : NCollection_ListNode* theNext2) :
NCollection_TListNode<TheKey2Type> (theKey2, theNext1) NCollection_TListNode<TheKey2Type> (theKey2, theNext1),
myKey1(theKey1),
myNext2((DoubleMapNode*)theNext2)
{ {
myKey1 = theKey1;
myNext2 = (DoubleMapNode *) theNext2;
} }
//! Key1 //! Key1
const TheKey1Type& Key1 (void) const TheKey1Type& Key1 (void)
@ -97,28 +97,19 @@ class NCollection_DoubleMap : public NCollection_BaseMap
//! Key1 inquiry //! Key1 inquiry
const TheKey1Type& Key1(void) const const TheKey1Type& Key1(void) const
{ {
#if !defined No_Exception && !defined No_Standard_NoSuchObject Standard_NoSuchObject_Raise_if (!More(), "NCollection_DoubleMap::Iterator::Key1");
if (!More())
Standard_NoSuchObject::Raise ("NCollection_DoubleMap::Iterator::Key1");
#endif
return ((DoubleMapNode *) myNode)->Key1(); return ((DoubleMapNode *) myNode)->Key1();
} }
//! Key2 inquiry //! Key2 inquiry
const TheKey2Type& Key2(void) const const TheKey2Type& Key2(void) const
{ {
#if !defined No_Exception && !defined No_Standard_NoSuchObject Standard_NoSuchObject_Raise_if (!More(), "NCollection_DoubleMap::Iterator::Key2");
if (!More())
Standard_NoSuchObject::Raise ("NCollection_DoubleMap::Iterator::Key2");
#endif
return ((DoubleMapNode *) myNode)->Key2(); return ((DoubleMapNode *) myNode)->Key2();
} }
//! Value access //! Value access
const TheKey2Type& Value(void) const const TheKey2Type& Value(void) const
{ {
#if !defined No_Exception && !defined No_Standard_NoSuchObject Standard_NoSuchObject_Raise_if (!More(), "NCollection_DoubleMap::Iterator::Value");
if (!More())
Standard_NoSuchObject::Raise ("NCollection_DoubleMap::Iterator::Value");
#endif
return ((DoubleMapNode *) myNode)->Value(); return ((DoubleMapNode *) myNode)->Value();
} }
//! Value change access - denied //! Value change access - denied
@ -402,10 +393,7 @@ class NCollection_DoubleMap : public NCollection_BaseMap
//! Find1 //! Find1
const TheKey2Type& Find1(const TheKey1Type& theKey1) const const TheKey2Type& Find1(const TheKey1Type& theKey1) const
{ {
#if !defined No_Exception && !defined No_Standard_NoSuchObject Standard_NoSuchObject_Raise_if (IsEmpty(), "NCollection_DoubleMap::Find1");
if (IsEmpty())
Standard_NoSuchObject::Raise ("NCollection_DoubleMap::Find1");
#endif
DoubleMapNode * pNode1 = DoubleMapNode * pNode1 =
(DoubleMapNode *) myData1[Hasher1::HashCode(theKey1,NbBuckets())]; (DoubleMapNode *) myData1[Hasher1::HashCode(theKey1,NbBuckets())];
while (pNode1) while (pNode1)
@ -421,10 +409,7 @@ class NCollection_DoubleMap : public NCollection_BaseMap
//! Find2 //! Find2
const TheKey1Type& Find2(const TheKey2Type& theKey2) const const TheKey1Type& Find2(const TheKey2Type& theKey2) const
{ {
#if !defined No_Exception && !defined No_Standard_NoSuchObject Standard_NoSuchObject_Raise_if (IsEmpty(), "NCollection_DoubleMap::Find2");
if (IsEmpty())
Standard_NoSuchObject::Raise ("NCollection_DoubleMap::Find2");
#endif
DoubleMapNode * pNode2 = DoubleMapNode * pNode2 =
(DoubleMapNode *) myData2[Hasher2::HashCode(theKey2,NbBuckets())]; (DoubleMapNode *) myData2[Hasher2::HashCode(theKey2,NbBuckets())];
while (pNode2) while (pNode2)

View File

@ -23,9 +23,7 @@
#include <NCollection_StlIterator.hxx> #include <NCollection_StlIterator.hxx>
#include <NCollection_DefaultHasher.hxx> #include <NCollection_DefaultHasher.hxx>
#if !defined No_Exception && !defined No_Standard_OutOfRange
#include <Standard_OutOfRange.hxx> #include <Standard_OutOfRange.hxx>
#endif
/** /**
* Purpose: An indexed map is used to store keys and to bind * Purpose: An indexed map is used to store keys and to bind
@ -62,11 +60,11 @@ class NCollection_IndexedDataMap : public NCollection_BaseMap
const TheItemType& theItem, const TheItemType& theItem,
NCollection_ListNode* theNext1, NCollection_ListNode* theNext1,
NCollection_ListNode* theNext2) : NCollection_ListNode* theNext2) :
NCollection_TListNode<TheItemType>(theItem,theNext1) NCollection_TListNode<TheItemType>(theItem,theNext1),
myKey1(theKey1),
myKey2(theKey2),
myNext2((IndexedDataMapNode*)theNext2)
{ {
myKey1 = theKey1;
myKey2 = theKey2;
myNext2 = (IndexedDataMapNode *) theNext2;
} }
//! Key1 //! Key1
TheKeyType& Key1 (void) TheKeyType& Key1 (void)
@ -116,28 +114,19 @@ class NCollection_IndexedDataMap : public NCollection_BaseMap
//! Value access //! Value access
const TheItemType& Value(void) const const TheItemType& Value(void) const
{ {
#if !defined No_Exception && !defined No_Standard_NoSuchObject Standard_NoSuchObject_Raise_if(!More(), "NCollection_IndexedDataMap::Iterator::Value");
if (!More())
Standard_NoSuchObject::Raise("NCollection_IndexedDataMap::Iterator::Value");
#endif
return myNode->Value(); return myNode->Value();
} }
//! ChangeValue access //! ChangeValue access
TheItemType& ChangeValue(void) const TheItemType& ChangeValue(void) const
{ {
#if !defined No_Exception && !defined No_Standard_NoSuchObject Standard_NoSuchObject_Raise_if(!More(), "NCollection_IndexedDataMap::Iterator::ChangeValue");
if (!More())
Standard_NoSuchObject::Raise("NCollection_IndexedDataMap::Iterator::ChangeValue");
#endif
return myNode->ChangeValue(); return myNode->ChangeValue();
} }
//! Key //! Key
const TheKeyType& Key() const const TheKeyType& Key() const
{ {
#if !defined No_Exception && !defined No_Standard_NoSuchObject Standard_NoSuchObject_Raise_if(!More(), "NCollection_IndexedDataMap::Iterator::Key");
if (!More())
Standard_NoSuchObject::Raise("NCollection_DataMap::Iterator::Key");
#endif
return myNode->Key1(); return myNode->Key1();
} }
//! Performs comparison of two iterators. //! Performs comparison of two iterators.
@ -302,10 +291,8 @@ class NCollection_IndexedDataMap : public NCollection_BaseMap
const TheKeyType& theKey1, const TheKeyType& theKey1,
const TheItemType& theItem) const TheItemType& theItem)
{ {
#if !defined No_Exception && !defined No_Standard_OutOfRange Standard_OutOfRange_Raise_if (theIndex < 1 || theIndex > Extent(), "NCollection_IndexedDataMap::Substitute");
if (theIndex < 1 || theIndex > Extent())
Standard_OutOfRange::Raise ("NCollection_IndexedDataMap::Substitute");
#endif
IndexedDataMapNode * p; IndexedDataMapNode * p;
// check if theKey1 is not already in the map // check if theKey1 is not already in the map
Standard_Integer iK1 = Hasher::HashCode (theKey1, NbBuckets()); Standard_Integer iK1 = Hasher::HashCode (theKey1, NbBuckets());
@ -349,10 +336,8 @@ class NCollection_IndexedDataMap : public NCollection_BaseMap
//! RemoveLast //! RemoveLast
void RemoveLast (void) void RemoveLast (void)
{ {
#if !defined No_Exception && !defined No_Standard_OutOfRange Standard_OutOfRange_Raise_if (Extent() == 0, "NCollection_IndexedDataMap::RemoveLast");
if (Extent() == 0)
Standard_OutOfRange::Raise ("NCollection_IndexedDataMap::RemoveLast");
#endif
IndexedDataMapNode * p, * q; IndexedDataMapNode * p, * q;
// Find the node for the last index and remove it // Find the node for the last index and remove it
Standard_Integer iK2 = ::HashCode (Extent(), NbBuckets()); Standard_Integer iK2 = ::HashCode (Extent(), NbBuckets());
@ -389,10 +374,8 @@ class NCollection_IndexedDataMap : public NCollection_BaseMap
//! FindKey //! FindKey
const TheKeyType& FindKey (const Standard_Integer theKey2) const const TheKeyType& FindKey (const Standard_Integer theKey2) const
{ {
#if !defined No_Exception && !defined No_Standard_OutOfRange Standard_OutOfRange_Raise_if (theKey2 < 1 || theKey2 > Extent(), "NCollection_IndexedDataMap::FindKey");
if (theKey2 < 1 || theKey2 > Extent())
Standard_OutOfRange::Raise ("NCollection_IndexedDataMap::FindKey");
#endif
IndexedDataMapNode* aNode = nodeFromIndex (theKey2); IndexedDataMapNode* aNode = nodeFromIndex (theKey2);
if (aNode == NULL) if (aNode == NULL)
{ {
@ -404,10 +387,8 @@ class NCollection_IndexedDataMap : public NCollection_BaseMap
//! FindFromIndex //! FindFromIndex
const TheItemType& FindFromIndex (const Standard_Integer theKey2) const const TheItemType& FindFromIndex (const Standard_Integer theKey2) const
{ {
#if !defined No_Exception && !defined No_Standard_OutOfRange Standard_OutOfRange_Raise_if (theKey2 < 1 || theKey2 > Extent(), "NCollection_IndexedDataMap::FindFromIndex");
if (theKey2 < 1 || theKey2 > Extent())
Standard_OutOfRange::Raise ("NCollection_IndexedDataMap::FindFromIndex");
#endif
IndexedDataMapNode* aNode = nodeFromIndex (theKey2); IndexedDataMapNode* aNode = nodeFromIndex (theKey2);
if (aNode == NULL) if (aNode == NULL)
{ {
@ -423,10 +404,8 @@ class NCollection_IndexedDataMap : public NCollection_BaseMap
//! ChangeFromIndex //! ChangeFromIndex
TheItemType& ChangeFromIndex (const Standard_Integer theKey2) TheItemType& ChangeFromIndex (const Standard_Integer theKey2)
{ {
#if !defined No_Exception && !defined No_Standard_OutOfRange Standard_OutOfRange_Raise_if (theKey2 < 1 || theKey2 > Extent(), "NCollection_IndexedDataMap::ChangeFromIndex");
if (theKey2 < 1 || theKey2 > Extent())
Standard_OutOfRange::Raise("NCollection_IndexedDataMap::ChangeFromIndex");
#endif
IndexedDataMapNode* aNode = nodeFromIndex (theKey2); IndexedDataMapNode* aNode = nodeFromIndex (theKey2);
if (aNode == NULL) if (aNode == NULL)
{ {
@ -457,10 +436,8 @@ class NCollection_IndexedDataMap : public NCollection_BaseMap
//! FindFromKey //! FindFromKey
const TheItemType& FindFromKey(const TheKeyType& theKey1) const const TheItemType& FindFromKey(const TheKeyType& theKey1) const
{ {
#if !defined No_Exception && !defined No_Standard_NoSuchObject Standard_NoSuchObject_Raise_if (IsEmpty(), "NCollection_IndexedDataMap::FindFromKey");
if (IsEmpty())
Standard_NoSuchObject::Raise ("NCollection_IndexedDataMap::FindFromKey");
#endif
IndexedDataMapNode * pNode1 = IndexedDataMapNode * pNode1 =
(IndexedDataMapNode *) myData1[Hasher::HashCode(theKey1,NbBuckets())]; (IndexedDataMapNode *) myData1[Hasher::HashCode(theKey1,NbBuckets())];
while (pNode1) while (pNode1)
@ -476,10 +453,8 @@ class NCollection_IndexedDataMap : public NCollection_BaseMap
//! ChangeFromKey //! ChangeFromKey
TheItemType& ChangeFromKey (const TheKeyType& theKey1) TheItemType& ChangeFromKey (const TheKeyType& theKey1)
{ {
#if !defined No_Exception && !defined No_Standard_NoSuchObject Standard_NoSuchObject_Raise_if (IsEmpty(), "NCollection_IndexedDataMap::ChangeFromKey");
if (IsEmpty())
Standard_NoSuchObject::Raise("NCollection_IndexedDataMap::ChangeFromKey");
#endif
IndexedDataMapNode * pNode1 = IndexedDataMapNode * pNode1 =
(IndexedDataMapNode *) myData1[Hasher::HashCode(theKey1,NbBuckets())]; (IndexedDataMapNode *) myData1[Hasher::HashCode(theKey1,NbBuckets())];
while (pNode1) while (pNode1)

View File

@ -24,9 +24,7 @@
#include <NCollection_DefaultHasher.hxx> #include <NCollection_DefaultHasher.hxx>
#if !defined No_Exception && !defined No_Standard_OutOfRange
#include <Standard_OutOfRange.hxx> #include <Standard_OutOfRange.hxx>
#endif
/** /**
* Purpose: An indexed map is used to store keys and to bind * Purpose: An indexed map is used to store keys and to bind
@ -53,10 +51,10 @@ class NCollection_IndexedMap : public NCollection_BaseMap
const Standard_Integer theKey2, const Standard_Integer theKey2,
NCollection_ListNode* theNext1, NCollection_ListNode* theNext1,
NCollection_ListNode* theNext2) : NCollection_ListNode* theNext2) :
NCollection_TListNode<TheKeyType> (theKey1, theNext1) NCollection_TListNode<TheKeyType> (theKey1, theNext1),
myKey2(theKey2),
myNext2((IndexedMapNode*)theNext2)
{ {
myKey2 = theKey2;
myNext2 = (IndexedMapNode *) theNext2;
} }
//! Key1 //! Key1
TheKeyType& Key1 (void) TheKeyType& Key1 (void)
@ -103,10 +101,7 @@ class NCollection_IndexedMap : public NCollection_BaseMap
//! Value access //! Value access
const TheKeyType& Value(void) const const TheKeyType& Value(void) const
{ {
#if !defined No_Exception && !defined No_Standard_NoSuchObject Standard_NoSuchObject_Raise_if(!More(), "NCollection_IndexedMap::Iterator::Value");
if (!More())
Standard_NoSuchObject::Raise("NCollection_IndexedMap::Iterator::Value");
#endif
return myMap->FindKey(myIndex); return myMap->FindKey(myIndex);
} }
//! Value change access denied - use Substitute //! Value change access denied - use Substitute
@ -267,10 +262,8 @@ class NCollection_IndexedMap : public NCollection_BaseMap
void Substitute (const Standard_Integer theIndex, void Substitute (const Standard_Integer theIndex,
const TheKeyType& theKey1) const TheKeyType& theKey1)
{ {
#if !defined No_Exception && !defined No_Standard_OutOfRange Standard_OutOfRange_Raise_if (theIndex < 1 || theIndex > Extent(), "NCollection_IndexedMap::Substitute");
if (theIndex < 1 || theIndex > Extent())
Standard_OutOfRange::Raise ("NCollection_IndexedMap::Substitute");
#endif
IndexedMapNode * p; IndexedMapNode * p;
// check if theKey1 is not already in the map // check if theKey1 is not already in the map
Standard_Integer iK1 = Hasher::HashCode (theKey1, NbBuckets()); Standard_Integer iK1 = Hasher::HashCode (theKey1, NbBuckets());
@ -313,10 +306,8 @@ class NCollection_IndexedMap : public NCollection_BaseMap
//! RemoveLast //! RemoveLast
void RemoveLast (void) void RemoveLast (void)
{ {
#if !defined No_Exception && !defined No_Standard_OutOfRange Standard_OutOfRange_Raise_if (Extent() == 0, "NCollection_IndexedMap::RemoveLast");
if (Extent() == 0)
Standard_OutOfRange::Raise ("NCollection_IndexedMap::RemoveLast");
#endif
IndexedMapNode * p, * q; IndexedMapNode * p, * q;
// Find the node for the last index and remove it // Find the node for the last index and remove it
Standard_Integer iK2 = ::HashCode (Extent(), NbBuckets()); Standard_Integer iK2 = ::HashCode (Extent(), NbBuckets());
@ -353,10 +344,8 @@ class NCollection_IndexedMap : public NCollection_BaseMap
//! FindKey //! FindKey
const TheKeyType& FindKey (const Standard_Integer theKey2) const const TheKeyType& FindKey (const Standard_Integer theKey2) const
{ {
#if !defined No_Exception && !defined No_Standard_OutOfRange Standard_OutOfRange_Raise_if (theKey2 < 1 || theKey2 > Extent(), "NCollection_IndexedMap::FindKey");
if (theKey2 < 1 || theKey2 > Extent())
Standard_OutOfRange::Raise ("NCollection_IndexedMap::FindKey");
#endif
IndexedMapNode * pNode2 = IndexedMapNode * pNode2 =
(IndexedMapNode *) myData2[::HashCode(theKey2,NbBuckets())]; (IndexedMapNode *) myData2[::HashCode(theKey2,NbBuckets())];
while (pNode2) while (pNode2)

View File

@ -19,9 +19,7 @@
#include <NCollection_TListIterator.hxx> #include <NCollection_TListIterator.hxx>
#include <NCollection_StlIterator.hxx> #include <NCollection_StlIterator.hxx>
#if !defined No_Exception && !defined No_Standard_NoSuchObject
#include <Standard_NoSuchObject.hxx> #include <Standard_NoSuchObject.hxx>
#endif
/** /**
* Purpose: Simple list to link items together keeping the first * Purpose: Simple list to link items together keeping the first
@ -102,23 +100,31 @@ public:
//! First item //! First item
const TheItemType& First (void) const const TheItemType& First (void) const
{ {
#if !defined No_Exception && !defined No_Standard_NoSuchObject Standard_NoSuchObject_Raise_if (IsEmpty(), "NCollection_List::First");
if (IsEmpty())
Standard_NoSuchObject::Raise ("NCollection_List::First");
#endif
return ((const ListNode *) PFirst())->Value(); return ((const ListNode *) PFirst())->Value();
} }
//! First item (non-const)
TheItemType& First (void)
{
Standard_NoSuchObject_Raise_if (IsEmpty(), "NCollection_List::First");
return ((ListNode *) PFirst())->ChangeValue();
}
//! Last item //! Last item
const TheItemType& Last (void) const const TheItemType& Last (void) const
{ {
#if !defined No_Exception && !defined No_Standard_NoSuchObject Standard_NoSuchObject_Raise_if (IsEmpty(), "NCollection_List::Last");
if (IsEmpty())
Standard_NoSuchObject::Raise ("NCollection_List::Last");
#endif
return ((const ListNode *) PLast())->Value(); return ((const ListNode *) PLast())->Value();
} }
//! Last item (non-const)
TheItemType& Last (void)
{
Standard_NoSuchObject_Raise_if (IsEmpty(), "NCollection_List::Last");
return ((ListNode *) PLast())->ChangeValue();
}
//! Append one item at the end //! Append one item at the end
TheItemType& Append (const TheItemType& theItem) TheItemType& Append (const TheItemType& theItem)
{ {
@ -249,10 +255,8 @@ public:
else else
{ {
// No - this list has different memory scope // No - this list has different memory scope
#if !defined No_Exception && !defined No_Standard_NoSuchObject Standard_NoSuchObject_Raise_if (!theIter.More(), "NCollection_List::InsertAfter");
if (!theIter.More())
Standard_NoSuchObject::Raise ("NCollection_List::InsertAfter");
#endif
Iterator anIter; Iterator anIter;
anIter.myPrevious = theIter.myCurrent; anIter.myPrevious = theIter.myCurrent;
anIter.myCurrent = theIter.myCurrent->Next(); anIter.myCurrent = theIter.myCurrent->Next();

View File

@ -23,10 +23,7 @@
#include <NCollection_DefaultHasher.hxx> #include <NCollection_DefaultHasher.hxx>
#include <Standard_ImmutableObject.hxx> #include <Standard_ImmutableObject.hxx>
#if !defined No_Exception && !defined No_Standard_NoSuchObject
#include <Standard_NoSuchObject.hxx> #include <Standard_NoSuchObject.hxx>
#endif
/** /**
* Purpose: Single hashed Map. This Map is used to store and * Purpose: Single hashed Map. This Map is used to store and
@ -96,10 +93,7 @@ class NCollection_Map : public NCollection_BaseMap
//! Value inquiry //! Value inquiry
const TheKeyType& Value(void) const const TheKeyType& Value(void) const
{ {
#if !defined No_Exception && !defined No_Standard_NoSuchObject Standard_NoSuchObject_Raise_if (!More(), "NCollection_Map::Iterator::Value");
if (!More())
Standard_NoSuchObject::Raise ("NCollection_Map::Iterator::Value");
#endif
return ((MapNode *) myNode)->Value(); return ((MapNode *) myNode)->Value();
} }
//! Value change access - denied //! Value change access - denied
@ -109,12 +103,9 @@ class NCollection_Map : public NCollection_BaseMap
return * (TheKeyType *) NULL; // For compiler return * (TheKeyType *) NULL; // For compiler
} }
//! Key //! Key
const TheKeyType& Key (void) const TheKeyType& Key (void) const
{ {
#if !defined No_Exception && !defined No_Standard_NoSuchObject Standard_NoSuchObject_Raise_if (!More(), "NCollection_Map::Iterator::Key");
if (!More())
Standard_NoSuchObject::Raise ("NCollection_Map::Iterator::Key");
#endif
return ((MapNode *) myNode)->Value(); return ((MapNode *) myNode)->Value();
} }
}; };

View File

@ -19,10 +19,8 @@
#include <NCollection_BaseSequence.hxx> #include <NCollection_BaseSequence.hxx>
#include <NCollection_StlIterator.hxx> #include <NCollection_StlIterator.hxx>
#ifndef No_Exception
#include <Standard_OutOfRange.hxx> #include <Standard_OutOfRange.hxx>
#include <Standard_NoSuchObject.hxx> #include <Standard_NoSuchObject.hxx>
#endif
/** /**
* Purpose: Definition of a sequence of elements indexed by * Purpose: Definition of a sequence of elements indexed by
@ -252,10 +250,7 @@ public:
void InsertAfter (const Standard_Integer theIndex, void InsertAfter (const Standard_Integer theIndex,
const TheItemType& theItem) const TheItemType& theItem)
{ {
#if !defined No_Exception && !defined No_Standard_OutOfRange Standard_OutOfRange_Raise_if (theIndex < 0 || theIndex > mySize, "NCollection_Sequence::InsertAfter");
if (theIndex < 0 || theIndex > mySize)
Standard_OutOfRange::Raise ("NCollection_Sequence::InsertAfter");
#endif
PInsertAfter (theIndex, new (this->myAllocator) Node (theItem)); PInsertAfter (theIndex, new (this->myAllocator) Node (theItem));
} }
@ -269,50 +264,36 @@ public:
//! First item access //! First item access
const TheItemType& First () const const TheItemType& First () const
{ {
#if !defined No_Exception && !defined No_Standard_NoSuchObject Standard_NoSuchObject_Raise_if (mySize == 0, "NCollection_Sequence::First");
if (mySize == 0)
Standard_NoSuchObject::Raise ("NCollection_Sequence::First");
#endif
return ((const Node *) myFirstItem) -> Value(); return ((const Node *) myFirstItem) -> Value();
} }
//! First item access //! First item access
TheItemType& ChangeFirst() TheItemType& ChangeFirst()
{ {
#if !defined No_Exception && !defined No_Standard_NoSuchObject Standard_NoSuchObject_Raise_if (mySize == 0, "NCollection_Sequence::ChangeFirst");
if (mySize == 0)
Standard_NoSuchObject::Raise ("NCollection_Sequence::ChangeFirst");
#endif
return ((Node* )myFirstItem)->ChangeValue(); return ((Node* )myFirstItem)->ChangeValue();
} }
//! Last item access //! Last item access
const TheItemType& Last () const const TheItemType& Last () const
{ {
#if !defined No_Exception && !defined No_Standard_NoSuchObject Standard_NoSuchObject_Raise_if (mySize == 0, "NCollection_Sequence::Last");
if (mySize == 0)
Standard_NoSuchObject::Raise ("NCollection_Sequence::Last");
#endif
return ((const Node *) myLastItem) -> Value(); return ((const Node *) myLastItem) -> Value();
} }
//! Last item access //! Last item access
TheItemType& ChangeLast() TheItemType& ChangeLast()
{ {
#if !defined No_Exception && !defined No_Standard_NoSuchObject Standard_NoSuchObject_Raise_if (mySize == 0, "NCollection_Sequence::ChangeLast");
if (mySize == 0)
Standard_NoSuchObject::Raise ("NCollection_Sequence::ChangeLast");
#endif
return ((Node* )myLastItem)->ChangeValue(); return ((Node* )myLastItem)->ChangeValue();
} }
//! Constant item access by theIndex //! Constant item access by theIndex
const TheItemType& Value (const Standard_Integer theIndex) const const TheItemType& Value (const Standard_Integer theIndex) const
{ {
#if !defined No_Exception && !defined No_Standard_OutOfRange Standard_OutOfRange_Raise_if (theIndex <= 0 || theIndex > mySize, "NCollection_Sequence::Value");
if (theIndex <= 0 || theIndex > mySize)
Standard_OutOfRange::Raise ("NCollection_Sequence::Value");
#endif
NCollection_Sequence * const aLocalTHIS = (NCollection_Sequence *) this; NCollection_Sequence * const aLocalTHIS = (NCollection_Sequence *) this;
aLocalTHIS -> myCurrentItem = Find (theIndex); aLocalTHIS -> myCurrentItem = Find (theIndex);
aLocalTHIS -> myCurrentIndex = theIndex; aLocalTHIS -> myCurrentIndex = theIndex;
@ -326,10 +307,8 @@ public:
//! Variable item access by theIndex //! Variable item access by theIndex
TheItemType& ChangeValue (const Standard_Integer theIndex) TheItemType& ChangeValue (const Standard_Integer theIndex)
{ {
#if !defined No_Exception && !defined No_Standard_OutOfRange Standard_OutOfRange_Raise_if (theIndex <= 0 || theIndex > mySize, "NCollection_Sequence::ChangeValue");
if (theIndex <= 0 || theIndex > mySize)
Standard_OutOfRange::Raise ("NCollection_Sequence::ChangeValue");
#endif
myCurrentItem = Find (theIndex); myCurrentItem = Find (theIndex);
myCurrentIndex = theIndex; myCurrentIndex = theIndex;
return ((Node *) myCurrentItem) -> ChangeValue(); return ((Node *) myCurrentItem) -> ChangeValue();

View File

@ -43,10 +43,16 @@ template <class TheItemType> class NCollection_TListIterator
myPrevious = myCurrent; myPrevious = myCurrent;
myCurrent = myCurrent->Next(); myCurrent = myCurrent->Next();
} }
//! Constant Value access //! Constant Value access
const TheItemType& Value (void) const const TheItemType& Value (void) const
{ return ((const NCollection_TListNode<TheItemType>*) myCurrent)->Value(); } { return ((const NCollection_TListNode<TheItemType>*) myCurrent)->Value(); }
//! Variable Value access
//! Non-const Value access
TheItemType& Value (void)
{ return ((NCollection_TListNode<TheItemType>*) myCurrent)->ChangeValue(); }
//! Non-const Value access
TheItemType& ChangeValue (void) const TheItemType& ChangeValue (void) const
{ return ((NCollection_TListNode<TheItemType> *)myCurrent)->ChangeValue(); } { return ((NCollection_TListNode<TheItemType> *)myCurrent)->ChangeValue(); }
}; };

View File

@ -29,7 +29,7 @@ template <class TheItemType> class NCollection_TListNode
//! Constructor //! Constructor
NCollection_TListNode (const TheItemType& theItem, NCollection_TListNode (const TheItemType& theItem,
NCollection_ListNode* theNext=NULL) : NCollection_ListNode* theNext=NULL) :
NCollection_ListNode (theNext) { myValue = theItem; } NCollection_ListNode (theNext), myValue(theItem) { }
//! Constant value access //! Constant value access
const TheItemType& Value () const { return myValue; } const TheItemType& Value () const { return myValue; }
//! Variable value access //! Variable value access

View File

@ -16,9 +16,9 @@
#ifndef Prs3d_NListOfSequenceOfPnt_HeaderFile #ifndef Prs3d_NListOfSequenceOfPnt_HeaderFile
#define Prs3d_NListOfSequenceOfPnt_HeaderFile #define Prs3d_NListOfSequenceOfPnt_HeaderFile
#include <TColgp_SequenceOfPnt.hxx> #include <TColgp_HSequenceOfPnt.hxx>
#include <NCollection_List.hxx> #include <NCollection_List.hxx>
typedef NCollection_List<TColgp_SequenceOfPnt> Prs3d_NListOfSequenceOfPnt; typedef NCollection_List<Handle(TColgp_HSequenceOfPnt)> Prs3d_NListOfSequenceOfPnt;
#endif #endif

View File

@ -176,7 +176,6 @@ void Prs3d_WFShape::Add (const Handle (Prs3d_Presentation)& thePresentation,
Prs3d_NListOfSequenceOfPnt aWireCurves; Prs3d_NListOfSequenceOfPnt aWireCurves;
Prs3d_NListOfSequenceOfPnt aFreeCurves; Prs3d_NListOfSequenceOfPnt aFreeCurves;
Prs3d_NListOfSequenceOfPnt anUnFreeCurves; Prs3d_NListOfSequenceOfPnt anUnFreeCurves;
TColgp_SequenceOfPnt aShapePoints;
const Standard_Integer anIsoU = theDrawer->UIsoAspect()->Number(); const Standard_Integer anIsoU = theDrawer->UIsoAspect()->Number();
const Standard_Integer anIsoV = theDrawer->VIsoAspect()->Number(); const Standard_Integer anIsoV = theDrawer->VIsoAspect()->Number();
@ -299,17 +298,16 @@ void Prs3d_WFShape::Add (const Handle (Prs3d_Presentation)& thePresentation,
Prs3d_NListIteratorOfListOfSequenceOfPnt anIt; Prs3d_NListIteratorOfListOfSequenceOfPnt anIt;
for (anIt.Init (anUIsoCurves); anIt.More(); anIt.Next()) for (anIt.Init (anUIsoCurves); anIt.More(); anIt.Next())
{ {
aNbVertices += anIt.Value().Length(); aNbVertices += anIt.Value()->Length();
} }
Handle(Graphic3d_ArrayOfPolylines) anUIsoArray = new Graphic3d_ArrayOfPolylines (aNbVertices, aNbBounds); Handle(Graphic3d_ArrayOfPolylines) anUIsoArray = new Graphic3d_ArrayOfPolylines (aNbVertices, aNbBounds);
for (anIt.Init (anUIsoCurves); anIt.More(); anIt.Next()) for (anIt.Init (anUIsoCurves); anIt.More(); anIt.Next())
{ {
TColgp_SequenceOfPnt aPoints; const Handle(TColgp_HSequenceOfPnt)& aPoints = anIt.Value();
aPoints.Assign (anIt.Value()); anUIsoArray->AddBound (aPoints->Length());
anUIsoArray->AddBound (aPoints.Length()); for (Standard_Integer anI = 1; anI <= aPoints->Length(); ++anI)
for (Standard_Integer anI = 1; anI <= aPoints.Length(); ++anI)
{ {
anUIsoArray->AddVertex (aPoints.Value (anI)); anUIsoArray->AddVertex (aPoints->Value (anI));
} }
} }
Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup (thePresentation); Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup (thePresentation);
@ -317,23 +315,23 @@ void Prs3d_WFShape::Add (const Handle (Prs3d_Presentation)& thePresentation,
aGroup->AddPrimitiveArray (anUIsoArray); aGroup->AddPrimitiveArray (anUIsoArray);
} }
// NOTE: THIS BLOCK WILL NEVER EXECUTE AS aVIsoCurves IS NOT FILLED!!
if (aVIsoCurves.Size() > 0) if (aVIsoCurves.Size() > 0)
{ {
aNbBounds = aVIsoCurves.Size(); aNbBounds = aVIsoCurves.Size();
Prs3d_NListIteratorOfListOfSequenceOfPnt anIt; Prs3d_NListIteratorOfListOfSequenceOfPnt anIt;
for (anIt.Init (aVIsoCurves); anIt.More(); anIt.Next()) for (anIt.Init (aVIsoCurves); anIt.More(); anIt.Next())
{ {
aNbVertices += anIt.Value().Length(); aNbVertices += anIt.Value()->Length();
} }
Handle(Graphic3d_ArrayOfPolylines) VIsoArray = new Graphic3d_ArrayOfPolylines (aNbVertices, aNbBounds); Handle(Graphic3d_ArrayOfPolylines) VIsoArray = new Graphic3d_ArrayOfPolylines (aNbVertices, aNbBounds);
for (anIt.Init (aVIsoCurves); anIt.More(); anIt.Next()) for (anIt.Init (aVIsoCurves); anIt.More(); anIt.Next())
{ {
TColgp_SequenceOfPnt aPoints; const Handle(TColgp_HSequenceOfPnt)& aPoints = anIt.Value();
aPoints.Assign (anIt.Value()); VIsoArray->AddBound (aPoints->Length());
VIsoArray->AddBound (aPoints.Length()); for (int anI = 1; anI <= aPoints->Length(); anI++)
for (int anI = 1; anI <= aPoints.Length(); anI++)
{ {
VIsoArray->AddVertex (aPoints.Value (anI)); VIsoArray->AddVertex (aPoints->Value (anI));
} }
} }
Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup (thePresentation); Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup (thePresentation);
@ -445,14 +443,14 @@ void Prs3d_WFShape::Add (const Handle (Prs3d_Presentation)& thePresentation,
try try
{ {
OCC_CATCH_SIGNALS OCC_CATCH_SIGNALS
TColgp_SequenceOfPnt aPoints; const Handle(TColgp_HSequenceOfPnt)& aPoints = new TColgp_HSequenceOfPnt;
if (!AddPolygon (anEdge, aDeflection, aPoints)) if (!AddPolygon (anEdge, aDeflection, aPoints->ChangeSequence()))
{ {
if (BRep_Tool::IsGeometric (anEdge)) if (BRep_Tool::IsGeometric (anEdge))
{ {
BRepAdaptor_Curve aCurve (anEdge); BRepAdaptor_Curve aCurve (anEdge);
myCurveAlgo.Add (thePresentation, aCurve, aDeflection, theDrawer, myCurveAlgo.Add (thePresentation, aCurve, aDeflection, theDrawer,
aPoints, Standard_False); aPoints->ChangeSequence(), Standard_False);
aWireCurves.Append (aPoints); aWireCurves.Append (aPoints);
} }
} }
@ -481,14 +479,14 @@ void Prs3d_WFShape::Add (const Handle (Prs3d_Presentation)& thePresentation,
try try
{ {
OCC_CATCH_SIGNALS OCC_CATCH_SIGNALS
TColgp_SequenceOfPnt aPoints; const Handle(TColgp_HSequenceOfPnt)& aPoints = new TColgp_HSequenceOfPnt;
if (!AddPolygon (anEdge, aDeflection, aPoints)) if (!AddPolygon (anEdge, aDeflection, aPoints->ChangeSequence()))
{ {
if (BRep_Tool::IsGeometric (anEdge)) if (BRep_Tool::IsGeometric (anEdge))
{ {
BRepAdaptor_Curve aCurve (anEdge); BRepAdaptor_Curve aCurve (anEdge);
myCurveAlgo.Add (thePresentation, aCurve, aDeflection, theDrawer, myCurveAlgo.Add (thePresentation, aCurve, aDeflection, theDrawer,
aPoints, Standard_False); aPoints->ChangeSequence(), Standard_False);
aFreeCurves.Append (aPoints); aFreeCurves.Append (aPoints);
} }
} }
@ -516,13 +514,13 @@ void Prs3d_WFShape::Add (const Handle (Prs3d_Presentation)& thePresentation,
try try
{ {
OCC_CATCH_SIGNALS OCC_CATCH_SIGNALS
TColgp_SequenceOfPnt aPoints; const Handle(TColgp_HSequenceOfPnt)& aPoints = new TColgp_HSequenceOfPnt;
if (!AddPolygon (anEdge, aDeflection, aPoints)) if (!AddPolygon (anEdge, aDeflection, aPoints->ChangeSequence()))
{ {
if (BRep_Tool::IsGeometric (anEdge)) if (BRep_Tool::IsGeometric (anEdge))
{ {
BRepAdaptor_Curve aCurve (anEdge); BRepAdaptor_Curve aCurve (anEdge);
myCurveAlgo.Add (thePresentation, aCurve, aDeflection, theDrawer, aPoints, Standard_False); myCurveAlgo.Add (thePresentation, aCurve, aDeflection, theDrawer, aPoints->ChangeSequence(), Standard_False);
anUnFreeCurves.Append (aPoints); anUnFreeCurves.Append (aPoints);
} }
} }
@ -546,17 +544,16 @@ void Prs3d_WFShape::Add (const Handle (Prs3d_Presentation)& thePresentation,
Prs3d_NListIteratorOfListOfSequenceOfPnt anIt; Prs3d_NListIteratorOfListOfSequenceOfPnt anIt;
for (anIt.Init (aWireCurves); anIt.More(); anIt.Next()) for (anIt.Init (aWireCurves); anIt.More(); anIt.Next())
{ {
aNbVertices += anIt.Value().Length(); aNbVertices += anIt.Value()->Length();
} }
Handle(Graphic3d_ArrayOfPolylines) WireArray = new Graphic3d_ArrayOfPolylines (aNbVertices, aNbBounds); Handle(Graphic3d_ArrayOfPolylines) WireArray = new Graphic3d_ArrayOfPolylines (aNbVertices, aNbBounds);
for (anIt.Init (aWireCurves); anIt.More(); anIt.Next()) for (anIt.Init (aWireCurves); anIt.More(); anIt.Next())
{ {
TColgp_SequenceOfPnt aPoints; const Handle(TColgp_HSequenceOfPnt)& aPoints = anIt.Value();
aPoints.Assign (anIt.Value()); WireArray->AddBound (aPoints->Length());
WireArray->AddBound (aPoints.Length()); for (anI = 1; anI <= aPoints->Length(); ++anI)
for (anI = 1; anI <= aPoints.Length(); ++anI)
{ {
WireArray->AddVertex (aPoints.Value (anI)); WireArray->AddVertex (aPoints->Value (anI));
} }
} }
Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup (thePresentation); Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup (thePresentation);
@ -570,17 +567,16 @@ void Prs3d_WFShape::Add (const Handle (Prs3d_Presentation)& thePresentation,
Prs3d_NListIteratorOfListOfSequenceOfPnt anIt; Prs3d_NListIteratorOfListOfSequenceOfPnt anIt;
for (anIt.Init (aFreeCurves); anIt.More(); anIt.Next()) for (anIt.Init (aFreeCurves); anIt.More(); anIt.Next())
{ {
aNbVertices += anIt.Value().Length(); aNbVertices += anIt.Value()->Length();
} }
Handle(Graphic3d_ArrayOfPolylines) aFreeArray = new Graphic3d_ArrayOfPolylines (aNbVertices, aNbBounds); Handle(Graphic3d_ArrayOfPolylines) aFreeArray = new Graphic3d_ArrayOfPolylines (aNbVertices, aNbBounds);
for (anIt.Init(aFreeCurves); anIt.More(); anIt.Next()) for (anIt.Init(aFreeCurves); anIt.More(); anIt.Next())
{ {
TColgp_SequenceOfPnt aPoints; const Handle(TColgp_HSequenceOfPnt)& aPoints = anIt.Value();
aPoints.Assign (anIt.Value()); aFreeArray->AddBound (aPoints->Length());
aFreeArray->AddBound (aPoints.Length()); for (anI = 1; anI <= aPoints->Length(); ++anI)
for (anI = 1; anI <= aPoints.Length(); ++anI)
{ {
aFreeArray->AddVertex (aPoints.Value (anI)); aFreeArray->AddVertex (aPoints->Value (anI));
} }
} }
Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup (thePresentation); Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup (thePresentation);
@ -594,17 +590,16 @@ void Prs3d_WFShape::Add (const Handle (Prs3d_Presentation)& thePresentation,
Prs3d_NListIteratorOfListOfSequenceOfPnt anIt; Prs3d_NListIteratorOfListOfSequenceOfPnt anIt;
for (anIt.Init (anUnFreeCurves); anIt.More(); anIt.Next()) for (anIt.Init (anUnFreeCurves); anIt.More(); anIt.Next())
{ {
aNbVertices += anIt.Value().Length(); aNbVertices += anIt.Value()->Length();
} }
Handle(Graphic3d_ArrayOfPolylines) anUnFreeArray = new Graphic3d_ArrayOfPolylines (aNbVertices, aNbBounds); Handle(Graphic3d_ArrayOfPolylines) anUnFreeArray = new Graphic3d_ArrayOfPolylines (aNbVertices, aNbBounds);
for (anIt.Init (anUnFreeCurves); anIt.More(); anIt.Next()) for (anIt.Init (anUnFreeCurves); anIt.More(); anIt.Next())
{ {
TColgp_SequenceOfPnt aPoints; const Handle(TColgp_HSequenceOfPnt)& aPoints = anIt.Value();
aPoints.Assign (anIt.Value()); anUnFreeArray->AddBound (aPoints->Length());
anUnFreeArray->AddBound (aPoints.Length()); for (anI = 1; anI <= aPoints->Length(); ++anI)
for (anI = 1; anI <= aPoints.Length(); ++anI)
{ {
anUnFreeArray->AddVertex (aPoints.Value (anI)); anUnFreeArray->AddVertex (aPoints->Value (anI));
} }
} }
Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup (thePresentation); Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup (thePresentation);
@ -613,6 +608,7 @@ void Prs3d_WFShape::Add (const Handle (Prs3d_Presentation)& thePresentation,
} }
// Points // Points
TColgp_SequenceOfPnt aShapePoints;
for (aTool.InitVertex(); aTool.MoreVertex(); aTool.NextVertex()) for (aTool.InitVertex(); aTool.MoreVertex(); aTool.NextVertex())
{ {
aShapePoints.Append (BRep_Tool::Pnt (aTool.GetVertex())); aShapePoints.Append (BRep_Tool::Pnt (aTool.GetVertex()));

View File

@ -21,6 +21,8 @@
#include <gp_Pnt.hxx> #include <gp_Pnt.hxx>
#include <NCollection_Vector.hxx>
#define ItemType gp_Pnt #define ItemType gp_Pnt
#define Key1Type Standard_Real #define Key1Type Standard_Real
#define Key2Type Standard_Integer #define Key2Type Standard_Integer
@ -728,6 +730,32 @@ static Standard_Integer QANColTestList(Draw_Interpretor& di, Standard_Integer ar
return 0; return 0;
} }
//=======================================================================
//function : QANColTestVector
//purpose :
//=======================================================================
static Standard_Integer QANColTestVector (Draw_Interpretor&, Standard_Integer, const char**)
{
// test method Append and copying of empty vector
NCollection_Vector<int> aVec;
NCollection_Vector<int> aVec2 (aVec);
NCollection_Vector<int> aVec3;
aVec3 = aVec;
aVec.Append(5);
if (aVec(0) != 5)
std::cout << "Error: wrong value in original vector!" << endl;
aVec2.Append(5);
if (aVec2(0) != 5)
std::cout << "Error: wrong value in copy-constructed vector!" << endl;
aVec3.Append(5);
if (aVec3(0) != 5)
std::cout << "Error: wrong value in copied vector!" << endl;
std::cout << "Test OK" << endl;
return 0;
}
//======================================================================= //=======================================================================
//function : QANColTestSequence //function : QANColTestSequence
//purpose : //purpose :
@ -756,6 +784,5 @@ void QANCollection::CommandsTest(Draw_Interpretor& theCommands) {
theCommands.Add("QANColTestIndexedDataMap", "QANColTestIndexedDataMap", __FILE__, QANColTestIndexedDataMap, group); theCommands.Add("QANColTestIndexedDataMap", "QANColTestIndexedDataMap", __FILE__, QANColTestIndexedDataMap, group);
theCommands.Add("QANColTestList", "QANColTestList", __FILE__, QANColTestList, group); theCommands.Add("QANColTestList", "QANColTestList", __FILE__, QANColTestList, group);
theCommands.Add("QANColTestSequence", "QANColTestSequence", __FILE__, QANColTestSequence, group); theCommands.Add("QANColTestSequence", "QANColTestSequence", __FILE__, QANColTestSequence, group);
theCommands.Add("QANColTestVector", "QANColTestVector", __FILE__, QANColTestVector, group);
return;
} }

View File

@ -1,2 +1 @@
SelectMgr_DataMapOfObjectOwners.hxx
SelectMgr_CompareResults.hxx SelectMgr_CompareResults.hxx

View File

@ -1,32 +0,0 @@
// Created on: 2003-10-16
// Created by: Alexander Solovyov
// Copyright (c) 2003-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 _SelectMgr_DataMapOfObjectOwners_HeaderFile
#define _SelectMgr_DataMapOfObjectOwners_HeaderFile
#include <NCollection_DataMap.hxx>
#include <SelectMgr_SelectableObject.hxx>
#include <SelectMgr_SequenceOfOwner.hxx>
inline Standard_Boolean IsEqual (const Handle(SelectMgr_SelectableObject)& theH1,
const Handle(SelectMgr_SelectableObject)& theH2)
{
return (theH1 == theH2);
}
typedef NCollection_DataMap<Handle(SelectMgr_SelectableObject), SelectMgr_SequenceOfOwner> SelectMgr_DataMapOfObjectOwners;
typedef SelectMgr_DataMapOfObjectOwners::Iterator SelectMgr_DataMapIteratorOfMapOfObjectOwners;
#endif

View File

@ -324,8 +324,9 @@ void StdPrs_WFDeflectionRestrictedFace::Add
GeomAdaptor_Curve GC(BC); GeomAdaptor_Curve GC(BC);
FindLimits(GC, aLimit,b1, b2); FindLimits(GC, aLimit,b1, b2);
if (b2-b1>Precision::Confusion()) { if (b2-b1>Precision::Confusion()) {
TColgp_SequenceOfPnt Points; Handle(TColgp_HSequenceOfPnt) Points = new TColgp_HSequenceOfPnt;
StdPrs_DeflectionCurve::Add(aPresentation, GC, b1, b2, Deflection, Points, anAngle, Standard_False); StdPrs_DeflectionCurve::Add (aPresentation, GC, b1, b2, Deflection,
Points->ChangeSequence(), anAngle, Standard_False);
Curves.Append(Points); Curves.Append(Points);
} }
} }
@ -336,8 +337,9 @@ void StdPrs_WFDeflectionRestrictedFace::Add
anIso.Load(GeomAbs_IsoV,Coord,b1,b2); anIso.Load(GeomAbs_IsoV,Coord,b1,b2);
FindLimits(anIso, aLimit,b1, b2); FindLimits(anIso, aLimit,b1, b2);
if (b2-b1>Precision::Confusion()) { if (b2-b1>Precision::Confusion()) {
TColgp_SequenceOfPnt Points; Handle(TColgp_HSequenceOfPnt) Points = new TColgp_HSequenceOfPnt;
StdPrs_DeflectionCurve::Add(aPresentation, anIso, b1, b2, Deflection, Points, anAngle, Standard_False); StdPrs_DeflectionCurve::Add (aPresentation, anIso, b1, b2, Deflection,
Points->ChangeSequence(), anAngle, Standard_False);
Curves.Append(Points); Curves.Append(Points);
} }
} }

View File

@ -176,7 +176,7 @@ void StdPrs_WFRestrictedFace::Add
if(b1 == RealFirst() || b2 == RealLast()) if(b1 == RealFirst() || b2 == RealLast())
continue; continue;
TColgp_SequenceOfPnt aPoints; Handle(TColgp_HSequenceOfPnt) aPoints = new TColgp_HSequenceOfPnt;
if (!aGeomBSurface.IsNull()) if (!aGeomBSurface.IsNull())
{ {
if (anIsoBuild.IsXLine(anI)) if (anIsoBuild.IsXLine(anI))
@ -186,7 +186,8 @@ void StdPrs_WFRestrictedFace::Add
//Note that the isos are the part of the shape, it will be displayed after a computation the whole shape //Note that the isos are the part of the shape, it will be displayed after a computation the whole shape
//NbPoints = 30 - default parameter for computation of such curves //NbPoints = 30 - default parameter for computation of such curves
StdPrs_Curve::Add(thePresentation,GeomAdaptor_Curve(aBCurve), b1, b2, theDeflection, aPoints, 30, Standard_False); StdPrs_Curve::Add (thePresentation, GeomAdaptor_Curve(aBCurve), b1, b2, theDeflection,
aPoints->ChangeSequence(), 30, Standard_False);
theCurves.Append(aPoints); theCurves.Append(aPoints);
} }
else else
@ -195,7 +196,8 @@ void StdPrs_WFRestrictedFace::Add
anIsoCurve.Load(GeomAbs_IsoU,anIsoCoord,b1,b2); anIsoCurve.Load(GeomAbs_IsoU,anIsoCoord,b1,b2);
else else
anIsoCurve.Load(GeomAbs_IsoV,anIsoCoord,b1,b2); anIsoCurve.Load(GeomAbs_IsoV,anIsoCoord,b1,b2);
StdPrs_Curve::Add(thePresentation,anIsoCurve, theDeflection, theDrawer, aPoints, Standard_False); StdPrs_Curve::Add (thePresentation, anIsoCurve, theDeflection, theDrawer,
aPoints->ChangeSequence(), Standard_False);
theCurves.Append(aPoints); theCurves.Append(aPoints);
} }
} }

View File

@ -143,7 +143,6 @@ void StdPrs_WFSurface::Add (const Handle(Prs3d_Presentation)& aPresentation,
Prs3d_NListOfSequenceOfPnt freeCurves; Prs3d_NListOfSequenceOfPnt freeCurves;
Prs3d_NListOfSequenceOfPnt UIsoCurves; Prs3d_NListOfSequenceOfPnt UIsoCurves;
Prs3d_NListOfSequenceOfPnt VIsoCurves; Prs3d_NListOfSequenceOfPnt VIsoCurves;
TColgp_SequenceOfPnt Pnts;
Standard_Boolean UClosed = aSurface->IsUClosed(); Standard_Boolean UClosed = aSurface->IsUClosed();
Standard_Boolean VClosed = aSurface->IsVClosed(); Standard_Boolean VClosed = aSurface->IsVClosed();
@ -183,24 +182,24 @@ void StdPrs_WFSurface::Add (const Handle(Prs3d_Presentation)& aPresentation,
if ( !UClosed ) if ( !UClosed )
{ {
anIso.Load(GeomAbs_IsoU,U1,V1,V2); anIso.Load(GeomAbs_IsoU,U1,V1,V2);
StdPrs_Curve::Add(aPresentation,anIso,TheDeflection, aDrawer, Pnts, Standard_False); Handle(TColgp_HSequenceOfPnt) aPntsU1 = new TColgp_HSequenceOfPnt;
freeCurves.Append(Pnts); StdPrs_Curve::Add(aPresentation,anIso,TheDeflection, aDrawer, aPntsU1->ChangeSequence(), Standard_False);
Pnts.Clear(); freeCurves.Append(aPntsU1);
anIso.Load(GeomAbs_IsoU,U2,V1,V2); anIso.Load(GeomAbs_IsoU,U2,V1,V2);
StdPrs_Curve::Add(aPresentation,anIso,TheDeflection, aDrawer, Pnts, Standard_False); Handle(TColgp_HSequenceOfPnt) aPntsU2 = new TColgp_HSequenceOfPnt;
freeCurves.Append(Pnts); StdPrs_Curve::Add(aPresentation,anIso,TheDeflection, aDrawer, aPntsU2->ChangeSequence(), Standard_False);
Pnts.Clear(); freeCurves.Append(aPntsU2);
} }
if ( !VClosed ) if ( !VClosed )
{ {
anIso.Load(GeomAbs_IsoV,V1,U1,U2); anIso.Load(GeomAbs_IsoV,V1,U1,U2);
StdPrs_Curve::Add(aPresentation,anIso,TheDeflection, aDrawer, Pnts, Standard_False); Handle(TColgp_HSequenceOfPnt) aPntsV1 = new TColgp_HSequenceOfPnt;
freeCurves.Append(Pnts); StdPrs_Curve::Add(aPresentation,anIso,TheDeflection, aDrawer, aPntsV1->ChangeSequence(), Standard_False);
Pnts.Clear(); freeCurves.Append(aPntsV1);
anIso.Load(GeomAbs_IsoV,V2,U1,U2); anIso.Load(GeomAbs_IsoV,V2,U1,U2);
StdPrs_Curve::Add(aPresentation,anIso,TheDeflection, aDrawer, Pnts, Standard_False); Handle(TColgp_HSequenceOfPnt) aPntsV2 = new TColgp_HSequenceOfPnt;
freeCurves.Append(Pnts); StdPrs_Curve::Add(aPresentation,anIso,TheDeflection, aDrawer, aPntsV2->ChangeSequence(), Standard_False);
Pnts.Clear(); freeCurves.Append(aPntsV2);
} }
} }
// //
@ -216,9 +215,9 @@ void StdPrs_WFSurface::Add (const Handle(Prs3d_Presentation)& aPresentation,
Standard_Real du= UClosed ? (U2-U1)/fin : (U2-U1)/(1+fin); Standard_Real du= UClosed ? (U2-U1)/fin : (U2-U1)/(1+fin);
for (Standard_Integer i=1; i<=fin;i++){ for (Standard_Integer i=1; i<=fin;i++){
anIso.Load(GeomAbs_IsoU,U1+du*i,V1,V2); anIso.Load(GeomAbs_IsoU,U1+du*i,V1,V2);
StdPrs_Curve::Add(aPresentation,anIso,TheDeflection, aDrawer, Pnts, Standard_False); Handle(TColgp_HSequenceOfPnt) Pnts = new TColgp_HSequenceOfPnt;
StdPrs_Curve::Add(aPresentation,anIso,TheDeflection, aDrawer, Pnts->ChangeSequence(), Standard_False);
UIsoCurves.Append(Pnts); UIsoCurves.Append(Pnts);
Pnts.Clear();
} }
} }
fin = aDrawer->VIsoAspect()->Number(); fin = aDrawer->VIsoAspect()->Number();
@ -230,9 +229,9 @@ void StdPrs_WFSurface::Add (const Handle(Prs3d_Presentation)& aPresentation,
Standard_Real dv= VClosed ?(V2-V1)/fin : (V2-V1)/(1+fin); Standard_Real dv= VClosed ?(V2-V1)/fin : (V2-V1)/(1+fin);
for (Standard_Integer i=1; i<=fin;i++){ for (Standard_Integer i=1; i<=fin;i++){
anIso.Load(GeomAbs_IsoV,V1+dv*i,U1,U2); anIso.Load(GeomAbs_IsoV,V1+dv*i,U1,U2);
StdPrs_Curve::Add(aPresentation,anIso,TheDeflection, aDrawer, Pnts, Standard_False); Handle(TColgp_HSequenceOfPnt) Pnts = new TColgp_HSequenceOfPnt;
StdPrs_Curve::Add(aPresentation,anIso,TheDeflection, aDrawer, Pnts->ChangeSequence(), Standard_False);
VIsoCurves.Append(Pnts); VIsoCurves.Append(Pnts);
Pnts.Clear();
} }
} }
@ -242,15 +241,14 @@ void StdPrs_WFSurface::Add (const Handle(Prs3d_Presentation)& aPresentation,
nbBounds = UIsoCurves.Size(); nbBounds = UIsoCurves.Size();
Prs3d_NListIteratorOfListOfSequenceOfPnt It; Prs3d_NListIteratorOfListOfSequenceOfPnt It;
for( It.Init(UIsoCurves); It.More(); It.Next()) for( It.Init(UIsoCurves); It.More(); It.Next())
nbVertices += It.Value().Length(); nbVertices += It.Value()->Length();
Handle(Graphic3d_ArrayOfPolylines) UIsoArray = Handle(Graphic3d_ArrayOfPolylines) UIsoArray =
new Graphic3d_ArrayOfPolylines(nbVertices,nbBounds); new Graphic3d_ArrayOfPolylines(nbVertices,nbBounds);
for( It.Init(UIsoCurves); It.More(); It.Next()) { for( It.Init(UIsoCurves); It.More(); It.Next()) {
TColgp_SequenceOfPnt Pnts; const Handle(TColgp_HSequenceOfPnt)& Pnts = It.Value();
Pnts.Assign(It.Value()); UIsoArray->AddBound(Pnts->Length());
UIsoArray->AddBound(Pnts.Length()); for(int i=1; i<=Pnts->Length(); i++)
for(int i=1; i<=Pnts.Length(); i++) UIsoArray->AddVertex(Pnts->Value(i));
UIsoArray->AddVertex(Pnts.Value(i));
} }
Handle(Graphic3d_Group) TheGroup = Prs3d_Root::NewGroup(aPresentation); Handle(Graphic3d_Group) TheGroup = Prs3d_Root::NewGroup(aPresentation);
TheGroup->SetPrimitivesAspect(aDrawer->UIsoAspect()->Aspect()); TheGroup->SetPrimitivesAspect(aDrawer->UIsoAspect()->Aspect());
@ -261,15 +259,14 @@ void StdPrs_WFSurface::Add (const Handle(Prs3d_Presentation)& aPresentation,
nbBounds = VIsoCurves.Size(); nbBounds = VIsoCurves.Size();
Prs3d_NListIteratorOfListOfSequenceOfPnt It; Prs3d_NListIteratorOfListOfSequenceOfPnt It;
for( It.Init(VIsoCurves); It.More(); It.Next()) for( It.Init(VIsoCurves); It.More(); It.Next())
nbVertices += It.Value().Length(); nbVertices += It.Value()->Length();
Handle(Graphic3d_ArrayOfPolylines) VIsoArray = Handle(Graphic3d_ArrayOfPolylines) VIsoArray =
new Graphic3d_ArrayOfPolylines(nbVertices,nbBounds); new Graphic3d_ArrayOfPolylines(nbVertices,nbBounds);
for( It.Init(VIsoCurves); It.More(); It.Next()) { for( It.Init(VIsoCurves); It.More(); It.Next()) {
TColgp_SequenceOfPnt Pnts; const Handle(TColgp_HSequenceOfPnt)& Pnts = It.Value();
Pnts.Assign(It.Value()); VIsoArray->AddBound(Pnts->Length());
VIsoArray->AddBound(Pnts.Length()); for(int i=1; i<=Pnts->Length(); i++)
for(int i=1; i<=Pnts.Length(); i++) VIsoArray->AddVertex(Pnts->Value(i));
VIsoArray->AddVertex(Pnts.Value(i));
} }
Handle(Graphic3d_Group) TheGroup = Prs3d_Root::NewGroup(aPresentation); Handle(Graphic3d_Group) TheGroup = Prs3d_Root::NewGroup(aPresentation);
TheGroup->SetPrimitivesAspect(aDrawer->VIsoAspect()->Aspect()); TheGroup->SetPrimitivesAspect(aDrawer->VIsoAspect()->Aspect());
@ -279,15 +276,14 @@ void StdPrs_WFSurface::Add (const Handle(Prs3d_Presentation)& aPresentation,
nbBounds = freeCurves.Size(); nbBounds = freeCurves.Size();
Prs3d_NListIteratorOfListOfSequenceOfPnt It; Prs3d_NListIteratorOfListOfSequenceOfPnt It;
for( It.Init(freeCurves); It.More(); It.Next()) for( It.Init(freeCurves); It.More(); It.Next())
nbVertices += It.Value().Length(); nbVertices += It.Value()->Length();
Handle(Graphic3d_ArrayOfPolylines) freeArray = Handle(Graphic3d_ArrayOfPolylines) freeArray =
new Graphic3d_ArrayOfPolylines(nbVertices,nbBounds); new Graphic3d_ArrayOfPolylines(nbVertices,nbBounds);
for( It.Init(freeCurves); It.More(); It.Next()) { for( It.Init(freeCurves); It.More(); It.Next()) {
TColgp_SequenceOfPnt Pnts; const Handle(TColgp_HSequenceOfPnt)& Pnts = It.Value();
Pnts.Assign(It.Value()); freeArray->AddBound(Pnts->Length());
freeArray->AddBound(Pnts.Length()); for(int i=1; i<=Pnts->Length(); i++)
for(int i=1; i<=Pnts.Length(); i++) freeArray->AddVertex(Pnts->Value(i));
freeArray->AddVertex(Pnts.Value(i));
} }
Handle(Graphic3d_Group) TheGroup = Prs3d_Root::NewGroup(aPresentation); Handle(Graphic3d_Group) TheGroup = Prs3d_Root::NewGroup(aPresentation);
TheGroup->SetPrimitivesAspect(aDrawer->FreeBoundaryAspect()->Aspect()); TheGroup->SetPrimitivesAspect(aDrawer->FreeBoundaryAspect()->Aspect());