Foundation, Modeling - NCollection modernization and BRepGraph overhaul (#1212)

- Migrate NCollection map/sequence/array size APIs from int to size_t; Size() returns size_t, Length() remains the int accessor; int overloads delegate through NbBucketsFromInt() with a negative-input guard.
- Add NCollection_LinearVector: contiguous flat-buffer dynamic array with Standard::Reallocate-based growth for trivial types and move-construction for non-trivial types.
- Rewrite NCollection_DynamicArray on top of LinearVector<T*>; switch to power-of-two block sizing with precomputed shift/mask.
- Rework NCollection_BaseMap iterator with a forward findFirst() helper (no negative-bucket arithmetic); unify ReSize/BeginResize/EndResize on size_t.
- Enable thread-safe fast path in NCollection_IncAllocator via std::shared_mutex + CAS bump allocation on atomic AvailableSize; exclusive lock is taken only for new-block allocation and list reordering.
- Remove NCollection_BasePointerVector (superseded by NCollection_LinearVector).
- Remove NCollection_BaseMap::Statistics (unused).
- Add <cstddef> include in NCollection_Primes.hxx so size_t resolves on clean builds.
- Document iterator invalidation contract on NCollection_LinearVector.
- Unify BRepGraph programmatic mutation behind EditorView: delete BuilderView (2648+552 lines); EditorView (3186+930 lines) and EditorView_Mut.cxx own both structural creation (Add*/Remove*) and field-level RAII-scoped mutation (Mut*()) with automatic OwnGen and SubtreeGen propagation.
- Add BRepGraph_MeshCache and BRepGraph_MeshView: two-tier mesh storage separating algorithm-derived caches from persistent (definition) triangulations; freshness is keyed on FaceDef.OwnGen; cache writes do not mutate the model.
- Document the MeshCache invalidation contract in BRepGraph_MeshCache.hxx (which mutations bump Face.OwnGen and how markRepModified closes the loop for Surface/Triangulation reps).
- Add BRepGraph_RefsIterator (generic flat ref scan with RefTraits dispatch) and BRepGraph_ReverseIterator (typed parent-traversal wrappers over reverse-index vectors).
- Rework RefId entity model: replace inline refs with typed RefId vectors; add OccurrenceRef and Kind::Occurrence=7; BRepGraphInc_WireExplorer now requires a VertexRefLookup.
- Rename layers for consistency: BRepGraph_ParamLayer to BRepGraph_LayerParam, BRepGraph_RegularityLayer to BRepGraph_LayerRegularity; rename BRepGraphInc_Usage to BRepGraphInc_Instance.
- Replace RootNodeIds() with RootProductIds() returning product roots only.
- Update BRepGraph and BRepGraphInc READMEs; fix stale RootNodeIds reference.
- Sweep Size() to Length() renames across ~200 callers in TKG2d, TKG3d, TKMath, TKMesh, TKBO, TKOffset, TKShHealing, TKTopAlgo, TKBRep, TKService, TKV3d, TKOpenGl, TKMeshVS, TKDE*, TKXCAF, TKXSBase, TKLCAF, TKStd, and Draw harness.
- Add GTest coverage for new containers and the BRepGraph overhaul: NCollection_DynamicArray_Test, NCollection_LinearVector_Test, BRepGraph_Fuzz_Test, BRepGraph_Iterator_Test, BRepGraph_LayerIterator_Test, BRepGraph_MeshCache_Test, BRepGraph_MutGuard_Test, BRepGraph_ReplaceVertex_Test, BRepGraph_ReverseIterator_Test, BRepGraph_ScenarioMatrix_Test, BRepGraph_TypedIdDispatch_Test, BRepGraph_WireExplorer_Test.
This commit is contained in:
Pasukhin Dmitry
2026-04-19 18:47:54 +01:00
committed by GitHub
parent b3ccf20b1c
commit 0755b6f31d
312 changed files with 23723 additions and 10569 deletions
@@ -115,14 +115,14 @@ MeshVS_CommonSensitiveEntity::~MeshVS_CommonSensitiveEntity()
int MeshVS_CommonSensitiveEntity::NbSubElements() const
{
return myItemIndexes.Size();
return myItemIndexes.Length();
}
//=================================================================================================
int MeshVS_CommonSensitiveEntity::Size() const
{
return myItemIndexes.Size();
return myItemIndexes.Length();
}
//=================================================================================================
@@ -822,7 +822,7 @@ void MeshVS_MeshPrsBuilder::AddFaceSolidPrs(
}
}
if (!theIsSmoothShading || aVertexNormals.Size() != theNbNodes)
if (!theIsSmoothShading || aVertexNormals.Length() != theNbNodes)
{
aDataSource->GetNormal(theID, theMaxNodes, aNormalX, aNormalY, aNormalZ);
}
@@ -853,7 +853,7 @@ void MeshVS_MeshPrsBuilder::AddFaceSolidPrs(
{
if (theIsShaded)
{
if (theIsSmoothShading && aVertexNormals.Size() == theNbNodes)
if (theIsSmoothShading && aVertexNormals.Length() == theNbNodes)
{
aNormalX = aVertexNormals.Value(aSubIdx == 0 ? 0 : (aNodeIdx + aSubIdx)).X();
aNormalY = aVertexNormals.Value(aSubIdx == 0 ? 0 : (aNodeIdx + aSubIdx)).Y();
@@ -244,7 +244,7 @@ void MeshVS_TextPrsBuilder::Build(const occ::handle<Prs3d_Presentation>& Prs,
{
occ::handle<Graphic3d_Group> aMarkerGroup = Prs->NewGroup();
occ::handle<Graphic3d_ArrayOfPoints> anArrayOfPoints =
new Graphic3d_ArrayOfPoints(aPnts.Size());
new Graphic3d_ArrayOfPoints(aPnts.Length());
for (NCollection_Sequence<NCollection_Vec3<float>>::Iterator aPntIter(aPnts); aPntIter.More();
aPntIter.Next())
{
@@ -135,7 +135,7 @@ bool OpenGl_Font::createTexture(const occ::handle<OpenGl_Context>& theCtx)
aParams->SetFilter(Graphic3d_TOTF_BILINEAR);
aParams->SetAnisoFilter(Graphic3d_LOTA_OFF);
myTextures.Append(new OpenGl_Texture(myKey + "_texture" + myTextures.Size(), aParams));
myTextures.Append(new OpenGl_Texture(myKey + "_texture" + myTextures.Length(), aParams));
occ::handle<OpenGl_Texture>& aTexture = myTextures.ChangeLast();
Image_PixMap aBlackImg;
@@ -137,7 +137,7 @@ void OpenGl_FrameStatsPrs::updateChart(const occ::handle<OpenGl_Workspace>& theW
const occ::handle<OpenGl_FrameStats>& aStats = aCtx->FrameStats();
const Graphic3d_RenderingParams& aRendParams = theWorkspace->View()->RenderingParams();
const int aNbBins = aStats->DataFrames().Size();
const int aNbBins = aStats->DataFrames().Length();
if (aNbBins <= 1)
{
myChartIndices->Release(aCtx.get());
@@ -224,7 +224,7 @@ void OpenGl_LayerList::InsertLayerBefore(const Graphic3d_ZLayerId theNewL
}
myLayerIds.Bind(theNewLayerId, aNewLayer);
myTransparentToProcess.Allocate(myLayers.Size());
myTransparentToProcess.Allocate(myLayers.Length());
}
//=================================================================================================
@@ -261,7 +261,7 @@ void OpenGl_LayerList::InsertLayerAfter(const Graphic3d_ZLayerId theNewLa
}
myLayerIds.Bind(theNewLayerId, aNewLayer);
myTransparentToProcess.Allocate(myLayers.Size());
myTransparentToProcess.Allocate(myLayers.Length());
}
//=================================================================================================
@@ -281,7 +281,7 @@ void OpenGl_LayerList::RemoveLayer(const Graphic3d_ZLayerId theLayerId)
myLayers.Remove(aLayerToRemove);
myLayerIds.UnBind(theLayerId);
myTransparentToProcess.Allocate(myLayers.Size());
myTransparentToProcess.Allocate(myLayers.Length());
}
//=================================================================================================
@@ -36,7 +36,7 @@ public:
//! Pushes current matrix into stack.
void Push()
{
if (++myStackHead >= myStack.Size())
if (++myStackHead >= myStack.Length())
{
myStack.Append(myCurrent);
}
@@ -101,7 +101,7 @@ public:
myCurrent.GetValue(3, 2),
myCurrent.GetValue(3, 3))
OCCT_DUMP_FIELD_VALUE_NUMERICAL(theOStream, myStack.Size())
OCCT_DUMP_FIELD_VALUE_NUMERICAL(theOStream, myStack.Length())
OCCT_DUMP_FIELD_VALUE_NUMERICAL(theOStream, myStackHead)
}
@@ -264,7 +264,7 @@ bool OpenGl_RaytraceGeometry::ProcessAcceleration()
const int anObjectIdx = aBVH->BegPrimitive(aNodeIdx);
Standard_ASSERT_RETURN(
anObjectIdx < myObjects.Size(),
anObjectIdx < myObjects.Length(),
"Error! Invalid leaf node in high-level BVH (contains out-of-range object)",
false);
@@ -362,7 +362,7 @@ OpenGl_TriangleSet* OpenGl_RaytraceGeometry::TriangleSet(int theNodeIdx)
if (theNodeIdx >= aBVH->Length() || !aBVH->IsOuter(theNodeIdx))
return nullptr;
if (aBVH->NodeInfoBuffer().at(theNodeIdx).x() > myObjects.Size())
if (aBVH->NodeInfoBuffer().at(theNodeIdx).x() > myObjects.Length())
return nullptr;
return dynamic_cast<OpenGl_TriangleSet*>(
@@ -430,7 +430,7 @@ void OpenGl_ShaderManager::pushLightSourceState(
return;
}
if (myLightTypeArray.Size() < aNbLightsMax)
if (myLightTypeArray.Length() < aNbLightsMax)
{
myLightTypeArray.Resize(0, aNbLightsMax - 1, false);
myLightParamsArray.Resize(0, aNbLightsMax - 1, false);
@@ -581,7 +581,7 @@ void OpenGl_ShaderManager::pushLightSourceState(
if (const OpenGl_ShaderUniformLocation aShadowMatLoc =
theProgram->GetStateLocation(OpenGl_OCC_LIGHT_SHADOWMAP_MATRICES))
{
if (myShadowMatArray.Size() < theProgram->NbShadowMaps())
if (myShadowMatArray.Length() < theProgram->NbShadowMaps())
{
myShadowMatArray.Resize(0, theProgram->NbShadowMaps() - 1, false);
}
@@ -593,7 +593,7 @@ void OpenGl_ShaderManager::pushLightSourceState(
/ (float)myLightSourceState.ShadowMaps()->First()->Texture()->SizeX(),
myLightSourceState.ShadowMaps()->First()->ShadowMapBias());
const int aNbShadows =
std::min(theProgram->NbShadowMaps(), myLightSourceState.ShadowMaps()->Size());
std::min(theProgram->NbShadowMaps(), myLightSourceState.ShadowMaps()->Length());
for (int aShadowIter = 0; aShadowIter < aNbShadows; ++aShadowIter)
{
const occ::handle<OpenGl_ShadowMap>& aShadow =
@@ -769,7 +769,7 @@ void OpenGl_ShaderManager::pushClippingState(
}
const int aNbMaxPlanes = myContext->MaxClipPlanes();
if (myClipPlaneArrayFfp.Size() < aNbMaxPlanes)
if (myClipPlaneArrayFfp.Length() < aNbMaxPlanes)
{
myClipPlaneArrayFfp.Resize(0, aNbMaxPlanes - 1, false);
}
@@ -852,7 +852,7 @@ void OpenGl_ShaderManager::pushClippingState(
return;
}
if (myClipPlaneArray.Size() < aNbClipPlanesMax)
if (myClipPlaneArray.Length() < aNbClipPlanesMax)
{
myClipPlaneArray.Resize(0, aNbClipPlanesMax - 1, false);
myClipChainArray.Resize(0, aNbClipPlanesMax - 1, false);
@@ -842,7 +842,7 @@ bool OpenGl_Texture::InitCompressed(const occ::handle<OpenGl_Context>& theCtx,
mySizedFormat = aFormat.Internal();
myIsTopDown = theImage.IsTopDown();
mySize.SetValues(theImage.SizeX(), theImage.SizeY(), 1);
myMaxMipLevel = std::max(theImage.MipMaps().Size() - 1, 0);
myMaxMipLevel = std::max(theImage.MipMaps().Length() - 1, 0);
if (myMaxMipLevel > 0 && !theImage.IsCompleteMipMapSet())
{
const NCollection_Vec2<int> aMipSize = computeSmallestMipMapSize(mySize.xy(), myMaxMipLevel);
@@ -1233,7 +1233,7 @@ bool OpenGl_Texture::InitCubeMap(const occ::handle<OpenGl_Context>& theCtx,
theToGenMipmap = false;
theSize = aCompImage->SizeX();
theFormat = aCompImage->BaseFormat();
myMaxMipLevel = std::max(aCompImage->MipMaps().Size() - 1, 0);
myMaxMipLevel = std::max(aCompImage->MipMaps().Length() - 1, 0);
if (myMaxMipLevel > 0 && !aCompImage->IsCompleteMipMapSet())
{
const NCollection_Vec2<int> aMipSize = computeSmallestMipMapSize(
@@ -107,7 +107,7 @@ public:
bool IsEmpty() const { return myTextures.IsEmpty(); }
//! Return number of textures.
int Size() const { return myTextures.Size(); }
int Size() const { return myTextures.Length(); }
//! Return the lower index in texture set.
int Lower() const { return myTextures.Lower(); }
@@ -563,7 +563,7 @@ bool OpenGl_View::ShadowMapDump(Image_PixMap& theImage, const TCollection_AsciiS
}
const occ::handle<OpenGl_Context>& aGlCtx = myWorkspace->GetGlContext();
for (int aShadowIter = 0; aShadowIter < myShadowMaps->Size(); ++aShadowIter)
for (int aShadowIter = 0; aShadowIter < myShadowMaps->Length(); ++aShadowIter)
{
occ::handle<OpenGl_ShadowMap>& aShadow = myShadowMaps->ChangeValue(aShadowIter);
if (!aShadow.IsNull() && aShadow->LightSource()->Name() == theLightName)
@@ -1649,14 +1649,14 @@ bool OpenGl_View::prepareFrameBuffers(Graphic3d_Camera::Projection& theProj)
&& myRenderParams.Method != Graphic3d_RM_RAYTRACING;
if (toUseShadowMap)
{
if (myShadowMaps->Size() != myLights->NbCastShadows())
if (myShadowMaps->Length() != myLights->NbCastShadows())
{
myShadowMaps->Release(aCtx.get());
myShadowMaps->Resize(0, myLights->NbCastShadows() - 1, true);
}
const GLint aSamplFrom = GLint(aCtx->ShadowMapTexUnit()) - myLights->NbCastShadows() + 1;
for (int aShadowIter = 0; aShadowIter < myShadowMaps->Size(); ++aShadowIter)
for (int aShadowIter = 0; aShadowIter < myShadowMaps->Length(); ++aShadowIter)
{
occ::handle<OpenGl_ShadowMap>& aShadow = myShadowMaps->ChangeValue(aShadowIter);
if (aShadow.IsNull())
@@ -230,12 +230,12 @@ void Font_TextFormatter::Format()
}
else
{
for (int aLineIt = 0; aLineIt < myNewLines.Size(); aLineIt++)
for (int aLineIt = 0; aLineIt < myNewLines.Length(); aLineIt++)
{
aMaxLineWidth = std::max(aMaxLineWidth, LineWidth(aLineIt));
}
// clang-format off
aMaxLineWidth = std::max(aMaxLineWidth, LineWidth (myNewLines.Size())); // processing the last line also
aMaxLineWidth = std::max(aMaxLineWidth, LineWidth (myNewLines.Length())); // processing the last line also
// clang-format on
}
}
@@ -316,7 +316,7 @@ void Font_TextFormatter::Format()
bool Font_TextFormatter::GlyphBoundingBox(const int theIndex, Font_Rect& theBndBox) const
{
if (theIndex < 0 || theIndex >= Corners().Size())
if (theIndex < 0 || theIndex >= Corners().Length())
{
return false;
}
@@ -34,7 +34,7 @@ public:
//! Allocates new empty array
bool Init(const int theNbElems, const NCollection_Array1<Graphic3d_Attribute>& theAttribs)
{
return Init(theNbElems, &theAttribs.First(), theAttribs.Size());
return Init(theNbElems, &theAttribs.First(), theAttribs.Length());
}
//! Return TRUE if data can be invalidated; FALSE by default.
@@ -291,7 +291,7 @@ public:
//! Allocates new empty array
bool Init(const int theNbElems, const NCollection_Array1<Graphic3d_Attribute>& theAttribs)
{
return Init(theNbElems, &theAttribs.First(), theAttribs.Size());
return Init(theNbElems, &theAttribs.First(), theAttribs.Length());
}
public:
@@ -32,7 +32,7 @@ Graphic3d_BvhCStructureSet::Graphic3d_BvhCStructureSet()
int Graphic3d_BvhCStructureSet::Size() const
{
return myStructs.Size();
return myStructs.Length();
}
//=================================================================================================
@@ -65,7 +65,7 @@ void Graphic3d_BvhCStructureSet::Swap(const int theIdx1, const int theIdx2)
bool Graphic3d_BvhCStructureSet::Add(const Graphic3d_CStructure* theStruct)
{
const int aSize = myStructs.Size();
const int aSize = myStructs.Length();
if (myStructs.Add(theStruct) > aSize) // new structure?
{
@@ -31,7 +31,7 @@ Graphic3d_BvhCStructureSetTrsfPers::Graphic3d_BvhCStructureSetTrsfPers(
int Graphic3d_BvhCStructureSetTrsfPers::Size() const
{
return myStructs.Size();
return myStructs.Length();
}
//=================================================================================================
@@ -64,7 +64,7 @@ void Graphic3d_BvhCStructureSetTrsfPers::Swap(const int theIdx1, const int theId
bool Graphic3d_BvhCStructureSetTrsfPers::Add(const Graphic3d_CStructure* theStruct)
{
const int aSize = myStructs.Size();
const int aSize = myStructs.Length();
if (myStructs.Add(theStruct) > aSize) // new structure?
{
@@ -124,9 +124,9 @@ const opencascade::handle<BVH_Tree<double, 3>>& Graphic3d_BvhCStructureSetTrsfPe
return myBVH;
}
myStructBoxes.ReSize(myStructs.Size());
myStructBoxes.ReSize(myStructs.Length());
for (int aStructIdx = 1; aStructIdx <= myStructs.Size(); ++aStructIdx)
for (int aStructIdx = 1; aStructIdx <= myStructs.Length(); ++aStructIdx)
{
const Graphic3d_CStructure* aStructure = myStructs(aStructIdx);
@@ -687,7 +687,7 @@ void Graphic3d_FrameStats::FrameStart(const occ::handle<Graphic3d_CView>& theVie
const int aNbFrames =
std::max(!theView.IsNull() ? theView->RenderingParams().StatsNbFrames : 1, 1);
if (myCounters.Size() != aNbFrames)
if (myCounters.Length() != aNbFrames)
{
myCounters.Resize(0, aNbFrames - 1, false);
myCounters.Init(Graphic3d_FrameStatsData());
@@ -95,7 +95,7 @@ bool Graphic3d_Layer::Remove(const Graphic3d_CStructure* theStruct,
continue;
}
aStructures.Swap(anIndex, aStructures.Size());
aStructures.Swap(anIndex, aStructures.Length());
aStructures.RemoveLast();
if (!isForChangePriority)
@@ -116,7 +116,7 @@ bool Graphic3d_Layer::Remove(const Graphic3d_CStructure* theStruct,
const int anIndex2 = myAlwaysRenderedMap.FindIndex(theStruct);
if (anIndex2 != 0)
{
myAlwaysRenderedMap.Swap(myAlwaysRenderedMap.Size(), anIndex2);
myAlwaysRenderedMap.Swap(myAlwaysRenderedMap.Length(), anIndex2);
myAlwaysRenderedMap.RemoveLast();
}
}
@@ -81,7 +81,7 @@ public:
bool IsEmpty() const { return myItems.IsEmpty(); }
//! Return the number of items in sequence.
int Size() const { return myItems.Size(); }
int Size() const { return myItems.Length(); }
//! Append a plane.
//! @return TRUE if new item has been added (FALSE if item already existed)
@@ -116,12 +116,12 @@ void Graphic3d_Structure::Remove()
// It is necessary to remove the eventual pointer on the structure that can be destroyed, in the
// list of descendants of ancestors of this structure and in the list of ancestors of descendants
// of the same structure.
for (int aStructIdx = 1, aNbDesc = myDescendants.Size(); aStructIdx <= aNbDesc; ++aStructIdx)
for (int aStructIdx = 1, aNbDesc = myDescendants.Length(); aStructIdx <= aNbDesc; ++aStructIdx)
{
myDescendants.FindKey(aStructIdx)->Remove(this, Graphic3d_TOC_ANCESTOR);
}
for (int aStructIdx = 1, aNbAnces = myAncestors.Size(); aStructIdx <= aNbAnces; ++aStructIdx)
for (int aStructIdx = 1, aNbAnces = myAncestors.Length(); aStructIdx <= aNbAnces; ++aStructIdx)
{
myAncestors.FindKey(aStructIdx)->Remove(this, Graphic3d_TOC_DESCENDANT);
}
@@ -428,7 +428,7 @@ void Graphic3d_Structure::Descendants(
bool Graphic3d_Structure::AppendAncestor(Graphic3d_Structure* theAncestor)
{
const int aSize = myAncestors.Size();
const int aSize = myAncestors.Length();
return myAncestors.Add(theAncestor) > aSize; // new object
}
@@ -437,7 +437,7 @@ bool Graphic3d_Structure::AppendAncestor(Graphic3d_Structure* theAncestor)
bool Graphic3d_Structure::AppendDescendant(Graphic3d_Structure* theDescendant)
{
const int aSize = myDescendants.Size();
const int aSize = myDescendants.Length();
return myDescendants.Add(theDescendant) > aSize; // new object
}
@@ -450,7 +450,7 @@ bool Graphic3d_Structure::RemoveAncestor(Graphic3d_Structure* theAncestor)
if (anIndex != 0)
{
myAncestors.Swap(anIndex, myAncestors.Size());
myAncestors.Swap(anIndex, myAncestors.Length());
myAncestors.RemoveLast();
}
@@ -465,7 +465,7 @@ bool Graphic3d_Structure::RemoveDescendant(Graphic3d_Structure* theDescendant)
if (anIndex != 0)
{
myDescendants.Swap(anIndex, myDescendants.Size());
myDescendants.Swap(anIndex, myDescendants.Length());
myDescendants.RemoveLast();
}
@@ -556,7 +556,7 @@ void Graphic3d_Structure::DisconnectAll(const Graphic3d_TypeOfConnection theType
switch (theType)
{
case Graphic3d_TOC_DESCENDANT: {
for (int anIdx = 1, aLength = myDescendants.Size(); anIdx <= aLength; ++anIdx)
for (int anIdx = 1, aLength = myDescendants.Length(); anIdx <= aLength; ++anIdx)
{
// Value (1) instead of Value (i) as myDescendants
// is modified by :
@@ -567,7 +567,7 @@ void Graphic3d_Structure::DisconnectAll(const Graphic3d_TypeOfConnection theType
break;
}
case Graphic3d_TOC_ANCESTOR: {
for (int anIdx = 1, aLength = myAncestors.Size(); anIdx <= aLength; ++anIdx)
for (int anIdx = 1, aLength = myAncestors.Length(); anIdx <= aLength; ++anIdx)
{
// Value (1) instead of Value (i) as myAncestors
// is modified by :
@@ -244,7 +244,7 @@ void Graphic3d_StructureManager::UnIdentification(Graphic3d_CView* theView)
{
if (myDefinedViews.Contains(theView))
{
myDefinedViews.Swap(myDefinedViews.FindIndex(theView), myDefinedViews.Size());
myDefinedViews.Swap(myDefinedViews.FindIndex(theView), myDefinedViews.Length());
myDefinedViews.RemoveLast();
myViewGenId.Free(theView->Identification());
}
@@ -61,7 +61,7 @@ public:
bool IsEmpty() const { return myTextures.IsEmpty(); }
//! Return number of textures.
int Size() const { return myTextures.Size(); }
int Size() const { return myTextures.Length(); }
//! Return the lower index in texture set.
int Lower() const { return myTextures.Lower(); }
@@ -724,7 +724,7 @@ void AIS_ColorScale::drawLabels(const occ::handle<Graphic3d_Group>&
return;
}
const int aNbLabels = theLabels.Size();
const int aNbLabels = theLabels.Length();
const int aNbIntervals = myIsLabelAtBorder ? aNbLabels - 1 : aNbLabels;
const double aStepY = double(theBarHeight) / double(aNbIntervals);
if (aStepY <= 0.0)
@@ -2933,7 +2933,7 @@ AIS_StatusOfPick AIS_InteractiveContext::Select(
const AIS_SelectionScheme theSelScheme)
{
NCollection_IndexedMap<occ::handle<SelectMgr_EntityOwner>> aSelOwnerMap(
myAutoHilight ? mySelection->Objects().Size() : 0);
myAutoHilight ? mySelection->Objects().Length() : 0);
if (myAutoHilight)
{
clearDynamicHighlight();
@@ -91,7 +91,7 @@ occ::handle<AIS_InteractiveObject> AIS_MultipleConnectedInteractive::connect(
bool AIS_MultipleConnectedInteractive::HasConnection() const
{
return (Children().Size() != 0);
return (Children().Length() != 0);
}
//=================================================================================================
@@ -106,7 +106,7 @@ void AIS_MultipleConnectedInteractive::Disconnect(
void AIS_MultipleConnectedInteractive::DisconnectAll()
{
int aNbItemsToRemove = Children().Size();
int aNbItemsToRemove = Children().Length();
for (int anIter = 0; anIter < aNbItemsToRemove; ++anIter)
{
RemoveChild(Children().First());
@@ -78,7 +78,7 @@ public:
const NCollection_List<occ::handle<SelectMgr_EntityOwner>>& Objects() const { return myresult; }
//! Return the number of selected objects.
int Extent() const { return myresult.Size(); }
int Extent() const { return myresult.Length(); }
//! Return true if list of selected objects is empty.
bool IsEmpty() const { return myresult.IsEmpty(); }
+1 -1
View File
@@ -133,7 +133,7 @@ occ::handle<Graphic3d_ArrayOfPrimitives> Prs3d::PrimitivesFromPolylines(
{
aNbVertices += anIt.Value()->Length();
}
const int aSegmentEdgeNb = (aNbVertices - thePoints.Size()) * 2;
const int aSegmentEdgeNb = (aNbVertices - thePoints.Length()) * 2;
occ::handle<Graphic3d_ArrayOfSegments> aSegments =
new Graphic3d_ArrayOfSegments(aNbVertices, aSegmentEdgeNb);
for (NCollection_List<occ::handle<NCollection_HSequence<gp_Pnt>>>::Iterator anIt(thePoints);
@@ -37,7 +37,7 @@ Select3D_SensitiveGroup::Select3D_SensitiveGroup(
NCollection_Sequence<occ::handle<Select3D_SensitiveEntity>>& theEntities,
const bool theIsMustMatchAll)
: Select3D_SensitiveSet(theOwnerId),
myEntities(std::max(1, theEntities.Size())),
myEntities(std::max(1, theEntities.Length())),
myMustMatchAll(theIsMustMatchAll),
myToCheckOverlapAll(false),
myCenter(0.0, 0.0, 0.0)
@@ -74,7 +74,7 @@ void Select3D_SensitiveGroup::Add(
}
gp_Pnt aCent(0.0, 0.0, 0.0);
myEntities.ReSize(myEntities.Extent() + theEntities.Size());
myEntities.ReSize(myEntities.Extent() + theEntities.Length());
for (NCollection_Sequence<occ::handle<Select3D_SensitiveEntity>>::Iterator anIter(theEntities);
anIter.More();
anIter.Next())
@@ -125,7 +125,7 @@ void Select3D_SensitiveGroup::Remove(const occ::handle<Select3D_SensitiveEntity>
myBndBox.Clear();
myCenter = gp_Pnt(0.0, 0.0, 0.0);
myBVHPrimIndexes.Clear();
for (int anIdx = 1; anIdx <= myEntities.Size(); ++anIdx)
for (int anIdx = 1; anIdx <= myEntities.Length(); ++anIdx)
{
const occ::handle<Select3D_SensitiveEntity>& anEntity = myEntities.FindKey(anIdx);
myBndBox.Combine(anEntity->BoundingBox());
@@ -158,7 +158,7 @@ void Select3D_SensitiveGroup::Clear()
//=======================================================================
int Select3D_SensitiveGroup::NbSubElements() const
{
return myEntities.Size();
return myEntities.Length();
}
//=================================================================================================
@@ -314,7 +314,7 @@ void Select3D_SensitiveGroup::Swap(const int theIdx1, const int theIdx2)
//=======================================================================
int Select3D_SensitiveGroup::Size() const
{
return myBVHPrimIndexes.Size();
return myBVHPrimIndexes.Length();
}
// =======================================================================
@@ -330,7 +330,7 @@ bool Select3D_SensitivePrimitiveArray::InitTriangulation(
myBvhIndices.SetIndex(aGroupIter, aGroupIter);
myCDG3D.ChangeCoord() += anEntity->CenterOfGeometry().XYZ();
}
myCDG3D.ChangeCoord().Divide(static_cast<double>(myGroups->Size()));
myCDG3D.ChangeCoord().Divide(static_cast<double>(myGroups->Length()));
if (theToEvalMinMax)
{
computeBoundingBox();
@@ -493,7 +493,7 @@ bool Select3D_SensitivePrimitiveArray::InitPoints(
myBvhIndices.SetIndex(aGroupIter, aGroupIter);
myCDG3D.ChangeCoord() += anEntity->CenterOfGeometry().XYZ();
}
myCDG3D.ChangeCoord().Divide(static_cast<double>(myGroups->Size()));
myCDG3D.ChangeCoord().Divide(static_cast<double>(myGroups->Length()));
if (theToEvalMinMax)
{
computeBoundingBox();
@@ -592,7 +592,7 @@ occ::handle<Select3D_SensitiveEntity> Select3D_SensitivePrimitiveArray::GetConne
myIndexLower,
myIndexUpper,
true,
!myGroups.IsNull() ? myGroups->Size() : 1);
!myGroups.IsNull() ? myGroups->Length() : 1);
break;
}
case Graphic3d_TOPA_TRIANGLES: {
@@ -602,7 +602,7 @@ occ::handle<Select3D_SensitiveEntity> Select3D_SensitivePrimitiveArray::GetConne
myIndexLower,
myIndexUpper,
true,
!myGroups.IsNull() ? myGroups->Size() : 1);
!myGroups.IsNull() ? myGroups->Length() : 1);
break;
}
default:
@@ -247,7 +247,7 @@ public:
//! Returns the amount of nodes in triangulation
int NbSubElements() const override
{
return !myGroups.IsNull() ? myGroups->Size() : myBvhIndices.NbElements;
return !myGroups.IsNull() ? myGroups->Length() : myBvhIndices.NbElements;
}
//! Returns bounding box of triangle/edge with index theIdx
@@ -306,7 +306,7 @@ void SelectMgr::ComputeSensitivePrs(const occ::handle<Graphic3d_Structure>&
if (!aSeqPoints.IsEmpty())
{
occ::handle<Graphic3d_ArrayOfPoints> anArrayOfPoints =
new Graphic3d_ArrayOfPoints(aSeqPoints.Size());
new Graphic3d_ArrayOfPoints(aSeqPoints.Length());
for (NCollection_Sequence<gp_Pnt>::Iterator aPntIter(aSeqPoints); aPntIter.More();
aPntIter.Next())
{
@@ -512,11 +512,11 @@ bool SelectMgr_Frustum<N>::isDotInside(const gp_Pnt& thePnt,
const NCollection_Array1<gp_Pnt>& theVertices) const
{
double anAngle = 0.0;
for (int aVertIdx = 0; aVertIdx < theVertices.Size(); aVertIdx++)
for (int aVertIdx = 0; aVertIdx < theVertices.Length(); aVertIdx++)
{
const gp_Pnt aVert1 = theVertices[aVertIdx];
const gp_Pnt aVert2 =
(aVertIdx == (theVertices.Size() - 1) ? theVertices[0] : theVertices[aVertIdx + 1]);
(aVertIdx == theVertices.Length() - 1 ? theVertices[0] : theVertices[aVertIdx + 1]);
const gp_Vec aVec1(thePnt, aVert1);
const gp_Vec aVec2(thePnt, aVert2);
anAngle += aVec1.Angle(aVec2);
@@ -76,7 +76,7 @@ public:
}
//! Returns size of objects set.
int Size() const override { return myObjects.Size(); }
int Size() const override { return myObjects.Length(); }
//! Swaps items with indexes theIndex1 and theIndex2 in the set
void Swap(const int theIndex1, const int theIndex2) override
@@ -111,8 +111,8 @@ public:
const NCollection_Vec2<int>& theWinSize)
: myObjects(theObjects)
{
myBoundings.ReSize(myObjects.Size());
for (int anI = 1; anI <= myObjects.Size(); ++anI)
myBoundings.ReSize(myObjects.Length());
for (int anI = 1; anI <= myObjects.Length(); ++anI)
{
const occ::handle<SelectMgr_SelectableObject>& anObject = myObjects(anI);
@@ -210,7 +210,7 @@ public:
}
//! Returns size of objects set.
int Size() const override { return myObjects.Size(); }
int Size() const override { return myObjects.Length(); }
//! Swaps items with indexes theIndex1 and theIndex2 in the set
void Swap(const int theIndex1, const int theIndex2) override
@@ -278,7 +278,7 @@ bool SelectMgr_SelectableObjectSet::Append(const occ::handle<SelectMgr_Selectabl
}
// try adding it into the appropriate object subset
const int aSize = myObjects[aSubsetIdx].Size();
const int aSize = myObjects[aSubsetIdx].Length();
if (aSize < myObjects[aSubsetIdx].Add(theObject))
{
@@ -301,7 +301,7 @@ bool SelectMgr_SelectableObjectSet::Remove(const occ::handle<SelectMgr_Selectabl
if (anIndex != 0)
{
const int aSize = myObjects[aSubsetIdx].Size();
const int aSize = myObjects[aSubsetIdx].Length();
if (anIndex != aSize)
{
@@ -104,9 +104,9 @@ void SelectMgr_SensitiveEntitySet::Remove(const occ::handle<SelectMgr_Selection>
continue;
}
if (anEntIdx != mySensitives.Size())
if (anEntIdx != mySensitives.Length())
{
Swap(anEntIdx - 1, mySensitives.Size() - 1);
Swap(anEntIdx - 1, mySensitives.Length() - 1);
}
if (!aSensEnt->BaseSensitive()->TransformPersistence().IsNull())
{
@@ -167,7 +167,7 @@ void SelectMgr_SensitiveEntitySet::Swap(const int theIndex1, const int theIndex2
//=======================================================================
int SelectMgr_SensitiveEntitySet::Size() const
{
return mySensitives.Size();
return mySensitives.Length();
}
//=======================================================================
@@ -75,8 +75,8 @@ void SelectMgr_TriangularFrustumSet::Build()
new BRepMesh_DataStructureOfDelaun(anAllocator);
int aPtsLower = mySelPolyline.Points->Lower();
int aPtsUpper = mySelPolyline.Points->Upper();
IMeshData::VectorOfInteger anIndexes(mySelPolyline.Points->Size(), anAllocator);
myBoundaryPoints.Resize(aPtsLower, aPtsLower + 2 * (mySelPolyline.Points->Size()) - 1, false);
IMeshData::VectorOfInteger anIndexes(mySelPolyline.Points->Length(), anAllocator);
myBoundaryPoints.Resize(aPtsLower, aPtsLower + 2 * (mySelPolyline.Points->Length()) - 1, false);
for (int aPtIdx = aPtsLower; aPtIdx <= aPtsUpper; ++aPtIdx)
{
@@ -87,7 +87,7 @@ void SelectMgr_TriangularFrustumSet::Build()
const gp_Pnt aFarPnt =
myBuilder->ProjectPntOnViewPlane(aVertex.Coord().X(), aVertex.Coord().Y(), 1.0);
myBoundaryPoints.SetValue(aPtIdx, aNearPnt);
myBoundaryPoints.SetValue(aPtIdx + mySelPolyline.Points->Size(), aFarPnt);
myBoundaryPoints.SetValue(aPtIdx + mySelPolyline.Points->Length(), aFarPnt);
}
double aPtSum = 0;
@@ -457,7 +457,7 @@ bool SelectMgr_TriangularFrustumSet::OverlapsSphere(const gp_Pnt& theCenter,
int anIdx2 = myBoundaryPoints.Lower();
int anIdx3 = myBoundaryPoints.Lower();
for (int anIdx = myBoundaryPoints.Lower();
anIdx < myBoundaryPoints.Size() / 2 + myBoundaryPoints.Lower();
anIdx < myBoundaryPoints.Length() / 2 + myBoundaryPoints.Lower();
anIdx++)
{
if (myBoundaryPoints[anIdx1].Distance(myBoundaryPoints[anIdx]) < Precision::Confusion())
@@ -493,11 +493,11 @@ bool SelectMgr_TriangularFrustumSet::OverlapsSphere(const gp_Pnt& theCenter,
// equal 2*M_PI
double anAngleSum = 0.0;
NCollection_Array1<gp_Pnt> aBoundaries(myBoundaryPoints.Lower(),
myBoundaryPoints.Size() / 2
myBoundaryPoints.Length() / 2
+ myBoundaryPoints.Lower());
for (int anIdx = myBoundaryPoints.Lower();
anIdx < myBoundaryPoints.Size() / 2 + myBoundaryPoints.Lower();
anIdx < myBoundaryPoints.Length() / 2 + myBoundaryPoints.Lower();
anIdx++)
{
aBoundaries.SetValue(anIdx, myBoundaryPoints[anIdx]);
@@ -861,7 +861,7 @@ bool SelectMgr_TriangularFrustumSet::isIntersectBoundary(const double theRadiu
const gp_Trsf& theTrsf,
const bool theIsFilled) const
{
int aFacesNb = myBoundaryPoints.Size() / 2;
int aFacesNb = myBoundaryPoints.Length() / 2;
const gp_Pnt& aCircCenter = theTrsf.TranslationPart();
gp_Ax2 anAxis;
@@ -928,7 +928,7 @@ bool SelectMgr_TriangularFrustumSet::isIntersectBoundary(const double theRadiu
bool SelectMgr_TriangularFrustumSet::isIntersectBoundary(const gp_Pnt& thePnt1,
const gp_Pnt& thePnt2) const
{
int aFacesNb = myBoundaryPoints.Size() / 2;
int aFacesNb = myBoundaryPoints.Length() / 2;
gp_Vec aDir = thePnt2.XYZ() - thePnt1.XYZ();
gp_Pnt anOrig = thePnt1;
@@ -317,7 +317,7 @@ void StdPrs_Isolines::addOnTriangulation(
if (anIsoPnts.IsNull())
{
aPolylines.Append(new VecOfSegments());
anIsoIndexes.SetValue(anIsoIdx, aPolylines.Size());
anIsoIndexes.SetValue(anIsoIdx, aPolylines.Length());
anIsoPnts = aPolylines.ChangeValue(anIsoIndexes.Value(anIsoIdx));
}
@@ -360,7 +360,7 @@ static occ::handle<Graphic3d_ArrayOfSegments> fillFaceBoundaries(const TopoDS_Sh
++aNbPolylines;
}
}
const int aNbExtra = !aSeqPntsExtra.IsNull() ? aSeqPntsExtra->Size() : 0;
const int aNbExtra = !aSeqPntsExtra.IsNull() ? aSeqPntsExtra->Length() : 0;
if (aNodeNumber == 0)
{
if (aNbExtra < 2)
@@ -406,12 +406,12 @@ occ::handle<Graphic3d_ArrayOfPrimitives> StdPrs_WFShape::AddEdgesOnTriangulation
{
NCollection_Sequence<gp_Pnt> aSeqPnts;
AddEdgesOnTriangulation(aSeqPnts, theShape, theToExcludeGeometric);
if (aSeqPnts.Size() < 2)
if (aSeqPnts.Length() < 2)
{
return occ::handle<Graphic3d_ArrayOfSegments>();
}
int aNbVertices = aSeqPnts.Size();
int aNbVertices = aSeqPnts.Length();
occ::handle<Graphic3d_ArrayOfSegments> aSurfArray = new Graphic3d_ArrayOfSegments(aNbVertices);
for (int anI = 1; anI <= aNbVertices; anI += 2)
{
@@ -221,9 +221,9 @@ void StdPrs_WFSurface::Add(const occ::handle<Prs3d_Presentation>& aPresentation,
int nbVertices = 0, nbBounds = 0;
// Draw surface via primitive array
if (UIsoCurves.Size() > 0)
if (UIsoCurves.Length() > 0)
{
nbBounds = UIsoCurves.Size();
nbBounds = UIsoCurves.Length();
NCollection_List<occ::handle<NCollection_HSequence<gp_Pnt>>>::Iterator It;
for (It.Init(UIsoCurves); It.More(); It.Next())
nbVertices += It.Value()->Length();
@@ -241,9 +241,9 @@ void StdPrs_WFSurface::Add(const occ::handle<Prs3d_Presentation>& aPresentation,
TheGroup->AddPrimitiveArray(UIsoArray);
}
if (VIsoCurves.Size() > 0)
if (VIsoCurves.Length() > 0)
{
nbBounds = VIsoCurves.Size();
nbBounds = VIsoCurves.Length();
NCollection_List<occ::handle<NCollection_HSequence<gp_Pnt>>>::Iterator It;
for (It.Init(VIsoCurves); It.More(); It.Next())
nbVertices += It.Value()->Length();
@@ -260,9 +260,9 @@ void StdPrs_WFSurface::Add(const occ::handle<Prs3d_Presentation>& aPresentation,
TheGroup->SetPrimitivesAspect(aDrawer->VIsoAspect()->Aspect());
TheGroup->AddPrimitiveArray(VIsoArray);
}
if (freeCurves.Size() > 0)
if (freeCurves.Length() > 0)
{
nbBounds = freeCurves.Size();
nbBounds = freeCurves.Length();
NCollection_List<occ::handle<NCollection_HSequence<gp_Pnt>>>::Iterator It;
for (It.Init(freeCurves); It.More(); It.Next())
nbVertices += It.Value()->Length();
+1 -1
View File
@@ -216,7 +216,7 @@ void V3d_Viewer::SetDefaultViewSize(const double theSize)
bool V3d_Viewer::IfMoreViews() const
{
return myDefinedViews.Size() < myStructureManager->MaxNumOfViews();
return myDefinedViews.Length() < myStructureManager->MaxNumOfViews();
}
//=================================================================================================