mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-21 10:13:43 +03:00
0025052: Visualization - activation of all Clipping Planes within driver limit leads to broken planes management
Aspect_GenId::Available(), include size of the queue with recently freed identifiers Aspect_GenId.cxx - remove tabulation symbols Test cases for issue CR25052
This commit is contained in:
parent
74618acf3d
commit
a9568545f1
@ -16,113 +16,64 @@
|
|||||||
|
|
||||||
class GenId from Aspect
|
class GenId from Aspect
|
||||||
|
|
||||||
---Version:
|
---Purpose: This class permits the creation and control of integer identifiers.
|
||||||
|
|
||||||
---Level: Internal
|
|
||||||
---Purpose: This class permits the creation and control of all
|
|
||||||
-- identifiers.
|
|
||||||
-- Warning: An identifier is an integer.
|
|
||||||
|
|
||||||
---References:
|
|
||||||
|
|
||||||
uses
|
uses
|
||||||
|
|
||||||
ListOfInteger from TColStd
|
ListOfInteger from TColStd
|
||||||
|
|
||||||
raises
|
raises
|
||||||
|
|
||||||
IdentDefinitionError from Aspect
|
IdentDefinitionError from Aspect
|
||||||
|
|
||||||
is
|
is
|
||||||
|
|
||||||
Create
|
Create
|
||||||
returns GenId from Aspect;
|
returns GenId from Aspect;
|
||||||
---Level: Internal
|
---Purpose: Creates an available set of identifiers with the lower bound 0 and the upper bound INT_MAX / 2.
|
||||||
---Purpose: Creates an available set of identifiers with the lower
|
|
||||||
-- bound 0 and the upper bound INT_MAX/2.
|
|
||||||
|
|
||||||
Create ( Low, Up : Integer from Standard )
|
Create (theLow, theUpper : Integer from Standard)
|
||||||
returns GenId from Aspect
|
returns GenId from Aspect
|
||||||
---Level: Internal
|
---Purpose: Creates an available set of identifiers with specified range.
|
||||||
---Purpose: Creates an available set of identifiers with the lower
|
-- Raises IdentDefinitionError if theUpper is less than theLow.
|
||||||
-- bound <Low> and the upper bound <Up>.
|
raises IdentDefinitionError from Aspect;
|
||||||
-- Warning: Raises IdentDefinitionError if <Up> is less than <Low>.
|
|
||||||
raises IdentDefinitionError from Aspect;
|
|
||||||
|
|
||||||
---------------------------------------------------
|
Free (me : in out);
|
||||||
-- Category: Methods to modify the class definition
|
---Level: Internal
|
||||||
---------------------------------------------------
|
---Purpose: Free all identifiers - make the whole range available again.
|
||||||
|
|
||||||
--Assign ( me : in out;
|
Free (me : in out;
|
||||||
--Other : GenId from Aspect );
|
theId : Integer from Standard);
|
||||||
---Level: Internal
|
---Purpose: Free specified identifier. Warning - method has no protection against double-freeing!
|
||||||
---Purpose: Copies the content of <Other> into <me>.
|
|
||||||
---Category: Methods to modify the class definition
|
|
||||||
-- C++: alias operator =
|
|
||||||
|
|
||||||
Free ( me : in out );
|
HasFree (me)
|
||||||
---Level: Internal
|
returns Boolean from Standard;
|
||||||
---Purpose: Frees all identifiers of <me>.
|
---Purpose: Returns true if there are available identifiers in range.
|
||||||
---Category: Methods to modify the class definition
|
|
||||||
|
|
||||||
Free ( me : in out;
|
Available (me)
|
||||||
Id : Integer from Standard );
|
returns Integer from Standard;
|
||||||
---Level: Internal
|
---Purpose: Returns the number of available identifiers.
|
||||||
---Purpose: Frees the identifier <Id> of <me>.
|
|
||||||
---Category: Methods to modify the class definition
|
|
||||||
|
|
||||||
----------------------------
|
Lower (me)
|
||||||
-- Category: Inquire methods
|
returns Integer from Standard;
|
||||||
----------------------------
|
---Purpose: Returns the lower identifier in range.
|
||||||
|
|
||||||
Available ( me )
|
Next (me : in out)
|
||||||
returns Integer from Standard;
|
returns Integer from Standard
|
||||||
---Level: Internal
|
---Purpose: Returns the next available identifier.
|
||||||
---Purpose: Returns the number of available identifiers of <me>.
|
-- Warning: Raises IdentDefinitionError if all identifiers are busy.
|
||||||
---Category: Inquire methods
|
raises IdentDefinitionError from Aspect;
|
||||||
|
|
||||||
Lower ( me )
|
Upper (me)
|
||||||
returns Integer from Standard;
|
returns Integer from Standard;
|
||||||
---Level: Internal
|
---Purpose: Returns the upper identifier in range.
|
||||||
---Purpose: Returns the lower bound of <me>.
|
|
||||||
---Category: Inquire methods
|
|
||||||
|
|
||||||
Next ( me : in out )
|
|
||||||
returns Integer from Standard
|
|
||||||
---Level: Internal
|
|
||||||
---Purpose: Returns an available identifier of <me>.
|
|
||||||
-- Warning: Raises IdentDefinitionError if all identifiers are busy.
|
|
||||||
raises IdentDefinitionError from Aspect;
|
|
||||||
|
|
||||||
Upper ( me )
|
|
||||||
returns Integer from Standard;
|
|
||||||
---Level: Internal
|
|
||||||
---Purpose: Returns the upper bound of <me>.
|
|
||||||
---Category: Inquire methods
|
|
||||||
|
|
||||||
--
|
|
||||||
|
|
||||||
fields
|
fields
|
||||||
|
|
||||||
--
|
myFreeCount : Integer from Standard; -- the current number of available identifiers in range, excluding freed numbers
|
||||||
-- Class : Aspect_GenId
|
myLength : Integer from Standard; -- the number of identifiers
|
||||||
--
|
myLowerBound : Integer from Standard; -- the lower limit for identifiers
|
||||||
-- Purpose : Declaration of variables specific to identifiers
|
myUpperBound : Integer from Standard; -- the upper limit for identifiers
|
||||||
--
|
myFreeIds : ListOfInteger from TColStd; -- to save free identifiers
|
||||||
-- Reminder : An identifier is an integer
|
|
||||||
--
|
|
||||||
|
|
||||||
-- the current number of available identifiers
|
|
||||||
MyCount : Integer from Standard;
|
|
||||||
|
|
||||||
-- the number of identifiers
|
|
||||||
MyLength : Integer from Standard;
|
|
||||||
|
|
||||||
-- the limits for identifiers
|
|
||||||
MyLowerBound : Integer from Standard;
|
|
||||||
MyUpperBound : Integer from Standard;
|
|
||||||
|
|
||||||
-- to save free identifiers
|
|
||||||
MyFreeIds : ListOfInteger from TColStd;
|
|
||||||
|
|
||||||
end GenId;
|
end GenId;
|
||||||
|
@ -14,111 +14,124 @@
|
|||||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||||
// commercial license or contractual agreement.
|
// commercial license or contractual agreement.
|
||||||
|
|
||||||
//-Version
|
|
||||||
|
|
||||||
//-Design Declaration des variables specifiques aux identificateurs
|
|
||||||
|
|
||||||
//-Warning Un identificateur est un entier.
|
|
||||||
|
|
||||||
//-References
|
|
||||||
|
|
||||||
//-Language C++ 2.0
|
|
||||||
|
|
||||||
//-Declarations
|
|
||||||
|
|
||||||
// for the class
|
|
||||||
#include <Aspect_GenId.ixx>
|
#include <Aspect_GenId.ixx>
|
||||||
|
|
||||||
//-Aliases
|
// =======================================================================
|
||||||
|
// function : Aspect_GenId
|
||||||
//-Global data definitions
|
// purpose :
|
||||||
|
// =======================================================================
|
||||||
//-Constructors
|
Aspect_GenId::Aspect_GenId()
|
||||||
|
: myFreeCount (INT_MAX / 2 + 1),
|
||||||
//-Destructors
|
myLength (INT_MAX / 2 + 1),
|
||||||
|
myLowerBound (0),
|
||||||
//-Methods, in order
|
myUpperBound (INT_MAX / 2)
|
||||||
|
{
|
||||||
Aspect_GenId::Aspect_GenId ():
|
//
|
||||||
|
|
||||||
MyCount (INT_MAX/2 + 1),
|
|
||||||
MyLength (INT_MAX/2 + 1),
|
|
||||||
MyLowerBound (0),
|
|
||||||
MyUpperBound (INT_MAX/2),
|
|
||||||
MyFreeIds () {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Aspect_GenId::Aspect_GenId (const Standard_Integer Low, const Standard_Integer Up):MyFreeIds () {
|
// =======================================================================
|
||||||
|
// function : Aspect_GenId
|
||||||
if (Low <= Up) {
|
// purpose :
|
||||||
MyLowerBound = Low;
|
// =======================================================================
|
||||||
MyUpperBound = Up;
|
Aspect_GenId::Aspect_GenId (const Standard_Integer theLow,
|
||||||
MyLength = MyUpperBound - MyLowerBound + 1;
|
const Standard_Integer theUpper)
|
||||||
MyCount = MyLength;
|
: myFreeCount (theUpper - theLow + 1),
|
||||||
}
|
myLength (theUpper - theLow + 1),
|
||||||
else
|
myLowerBound (theLow),
|
||||||
Aspect_IdentDefinitionError::Raise
|
myUpperBound (theUpper)
|
||||||
("GenId Create Error: Low > Up");
|
{
|
||||||
|
if (theLow > theUpper)
|
||||||
|
{
|
||||||
|
Aspect_IdentDefinitionError::Raise ("GenId Create Error: wrong interval");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Standard_Integer Aspect_GenId::Available () const {
|
// =======================================================================
|
||||||
|
// function : HasFree
|
||||||
return (MyCount);
|
// purpose :
|
||||||
|
// =======================================================================
|
||||||
|
Standard_Boolean Aspect_GenId::HasFree() const
|
||||||
|
{
|
||||||
|
return myFreeCount > 0
|
||||||
|
|| myFreeIds.Extent() > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Aspect_GenId::Free () {
|
// =======================================================================
|
||||||
|
// function : Available
|
||||||
MyCount = MyLength;
|
// purpose :
|
||||||
MyFreeIds.Clear ();
|
// =======================================================================
|
||||||
|
Standard_Integer Aspect_GenId::Available() const
|
||||||
|
{
|
||||||
|
return myFreeCount + myFreeIds.Extent();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Aspect_GenId::Free (const Standard_Integer Id) {
|
// =======================================================================
|
||||||
|
// function : Free
|
||||||
if ( (Id >= MyLowerBound) && (Id <= MyUpperBound) )
|
// purpose :
|
||||||
MyFreeIds.Prepend (Id);
|
// =======================================================================
|
||||||
|
void Aspect_GenId::Free()
|
||||||
|
{
|
||||||
|
myFreeCount = myLength;
|
||||||
|
myFreeIds.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
Standard_Integer Aspect_GenId::Lower () const {
|
// =======================================================================
|
||||||
|
// function : Free
|
||||||
return (MyLowerBound);
|
// purpose :
|
||||||
|
// =======================================================================
|
||||||
|
void Aspect_GenId::Free (const Standard_Integer theId)
|
||||||
|
{
|
||||||
|
if (theId >= myLowerBound
|
||||||
|
&& theId <= myUpperBound)
|
||||||
|
{
|
||||||
|
if (myFreeCount + myFreeIds.Extent() + 1 == myLength)
|
||||||
|
{
|
||||||
|
myFreeCount = myLength;
|
||||||
|
myFreeIds.Clear();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
myFreeIds.Prepend (theId);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Standard_Integer Aspect_GenId::Next () {
|
// =======================================================================
|
||||||
|
// function : Lower
|
||||||
if (MyCount == 0)
|
// purpose :
|
||||||
Aspect_IdentDefinitionError::Raise
|
// =======================================================================
|
||||||
("GenId Next Error: Available == 0");
|
Standard_Integer Aspect_GenId::Lower() const
|
||||||
|
{
|
||||||
Standard_Integer Id;
|
return myLowerBound;
|
||||||
|
|
||||||
if (! MyFreeIds.IsEmpty ()) {
|
|
||||||
Id = MyFreeIds.First ();
|
|
||||||
MyFreeIds.RemoveFirst ();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
MyCount --;
|
|
||||||
Id = MyLowerBound + MyLength - MyCount - 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Id;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Standard_Integer Aspect_GenId::Upper () const {
|
// =======================================================================
|
||||||
|
// function : Next
|
||||||
return (MyUpperBound);
|
// purpose :
|
||||||
|
// =======================================================================
|
||||||
|
Standard_Integer Aspect_GenId::Next()
|
||||||
|
{
|
||||||
|
if (!myFreeIds.IsEmpty())
|
||||||
|
{
|
||||||
|
const Standard_Integer anId = myFreeIds.First();
|
||||||
|
myFreeIds.RemoveFirst();
|
||||||
|
return anId;
|
||||||
|
}
|
||||||
|
else if (myFreeCount < 1)
|
||||||
|
{
|
||||||
|
Aspect_IdentDefinitionError::Raise ("GenId Next Error: Available == 0");
|
||||||
|
}
|
||||||
|
|
||||||
|
--myFreeCount;
|
||||||
|
const Standard_Integer anId = myLowerBound + myLength - myFreeCount - 1;
|
||||||
|
return anId;
|
||||||
}
|
}
|
||||||
|
|
||||||
//void Aspect_GenId::Assign (const Aspect_GenId& Other) {
|
// =======================================================================
|
||||||
//
|
// function : Upper
|
||||||
// MyLowerBound = Other.Lower ();
|
// purpose :
|
||||||
// MyUpperBound = Other.Upper ();
|
// =======================================================================
|
||||||
//
|
Standard_Integer Aspect_GenId::Upper() const
|
||||||
//}
|
{
|
||||||
|
return myUpperBound;
|
||||||
|
}
|
||||||
|
@ -86,7 +86,7 @@ void OpenGl_Clipping::Add (Graphic3d_SequenceOfHClipPlane& thePlanes,
|
|||||||
void OpenGl_Clipping::Add (Graphic3d_SequenceOfHClipPlane& thePlanes, const EquationCoords& theCoordSpace)
|
void OpenGl_Clipping::Add (Graphic3d_SequenceOfHClipPlane& thePlanes, const EquationCoords& theCoordSpace)
|
||||||
{
|
{
|
||||||
Graphic3d_SequenceOfHClipPlane::Iterator aPlaneIt (thePlanes);
|
Graphic3d_SequenceOfHClipPlane::Iterator aPlaneIt (thePlanes);
|
||||||
while (aPlaneIt.More() && myEmptyPlaneIds->Available() > 0)
|
while (aPlaneIt.More() && myEmptyPlaneIds->HasFree())
|
||||||
{
|
{
|
||||||
const Handle(Graphic3d_ClipPlane)& aPlane = aPlaneIt.Value();
|
const Handle(Graphic3d_ClipPlane)& aPlane = aPlaneIt.Value();
|
||||||
if (Contains (aPlane))
|
if (Contains (aPlane))
|
||||||
@ -113,9 +113,12 @@ void OpenGl_Clipping::Add (Graphic3d_SequenceOfHClipPlane& thePlanes, const Equa
|
|||||||
aPlaneIt.Next();
|
aPlaneIt.Next();
|
||||||
}
|
}
|
||||||
|
|
||||||
while (aPlaneIt.More() && myEmptyPlaneIds->Available() == 0)
|
if (!myEmptyPlaneIds->HasFree())
|
||||||
{
|
{
|
||||||
thePlanes.Remove (aPlaneIt);
|
while (aPlaneIt.More())
|
||||||
|
{
|
||||||
|
thePlanes.Remove (aPlaneIt);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
48
tests/bugs/vis/bug25052
Normal file
48
tests/bugs/vis/bug25052
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
puts "==========="
|
||||||
|
puts "OCC25052"
|
||||||
|
puts "==========="
|
||||||
|
puts ""
|
||||||
|
##########################################################################
|
||||||
|
# Visualization - activation of all Clipping Planes within driver limit leads to broken planes management
|
||||||
|
##########################################################################
|
||||||
|
|
||||||
|
set Image1 ${imagedir}/${casename}_1.png
|
||||||
|
set Image9 ${imagedir}/${casename}_9.png
|
||||||
|
|
||||||
|
box b -30 -30 -30 70 80 90
|
||||||
|
|
||||||
|
vinit
|
||||||
|
vsetdispmode 1
|
||||||
|
vdisplay b
|
||||||
|
vfit
|
||||||
|
|
||||||
|
vclipplane create p1
|
||||||
|
vclipplane change p1 equation 1 0 0 -0.1
|
||||||
|
vclipplane create p2
|
||||||
|
vclipplane change p2 equation 1 0 0 -0.1
|
||||||
|
vclipplane create p3
|
||||||
|
vclipplane change p3 equation 1 0 0 -0.1
|
||||||
|
vclipplane create p4
|
||||||
|
vclipplane change p4 equation 1 0 0 -0.1
|
||||||
|
vclipplane create p5
|
||||||
|
vclipplane change p5 equation 1 0 0 -0.1
|
||||||
|
vclipplane create p6
|
||||||
|
vclipplane change p6 equation 1 0 0 -0.1
|
||||||
|
vclipplane create p7
|
||||||
|
vclipplane change p7 equation 1 0 0 -0.1
|
||||||
|
vclipplane create p8
|
||||||
|
vclipplane change p8 equation 1 0 0 -0.1
|
||||||
|
vclipplane create p9
|
||||||
|
vclipplane change p9 equation 1 0 0 -0.1
|
||||||
|
|
||||||
|
vclipplane set p1 view Driver1/Viewer1/View1
|
||||||
|
vdump ${Image1}
|
||||||
|
vclipplane set p2 view Driver1/Viewer1/View1
|
||||||
|
vclipplane set p3 view Driver1/Viewer1/View1
|
||||||
|
vclipplane set p4 view Driver1/Viewer1/View1
|
||||||
|
vclipplane set p5 view Driver1/Viewer1/View1
|
||||||
|
vclipplane set p6 view Driver1/Viewer1/View1
|
||||||
|
vclipplane set p7 view Driver1/Viewer1/View1
|
||||||
|
vclipplane set p8 view Driver1/Viewer1/View1
|
||||||
|
vclipplane set p9 view Driver1/Viewer1/View1
|
||||||
|
vdump ${Image9}
|
Loading…
x
Reference in New Issue
Block a user