mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-05-16 10:54:53 +03:00
0024610: Visualization, Visual3d_View::MinMaxValues() - skip erased objects while computing bounding box for Fit All operations
"vfit" takes into account erased objects Visual3d_View::MinMaxValues() corrected to ignore hidden Graphic3d_Structure instances, unused Graphic3d_StructureManager::MinMaxValues() removed. Correction of test-case
This commit is contained in:
parent
53b15292f1
commit
aeb722e31a
@ -231,15 +231,6 @@ is
|
||||
---Purpose: Returns the values of the current default attributes.
|
||||
---Category: Inquire methods
|
||||
|
||||
MinMaxValues ( me;
|
||||
XMin, YMin, ZMin : out Real from Standard;
|
||||
XMax, YMax, ZMax : out Real from Standard )
|
||||
is static;
|
||||
---Level: Public
|
||||
---Purpose: Returns the coordinates of the boundary box of all
|
||||
-- structures displayed in the manager <me>.
|
||||
---Category: Inquire methods
|
||||
|
||||
PrimitivesAspect ( me;
|
||||
CTXL : out AspectLine3d from Graphic3d;
|
||||
CTXT : out AspectText3d from Graphic3d;
|
||||
|
@ -271,40 +271,6 @@ void Graphic3d_StructureManager::PickStructures (Graphic3d_MapOfStructure& SG) c
|
||||
|
||||
}
|
||||
|
||||
void Graphic3d_StructureManager::MinMaxValues (Standard_Real& XMin, Standard_Real& YMin, Standard_Real& ZMin, Standard_Real& XMax, Standard_Real& YMax, Standard_Real& ZMax) const {
|
||||
|
||||
Standard_Boolean Flag = Standard_True;
|
||||
Standard_Real Xm, Ym, Zm, XM, YM, ZM, RL, RF;
|
||||
|
||||
RL = RealLast ();
|
||||
RF = RealFirst ();
|
||||
|
||||
XMin = YMin = ZMin = RL;
|
||||
XMax = YMax = ZMax = RF;
|
||||
|
||||
Graphic3d_MapIteratorOfMapOfStructure it(MyDisplayedStructure);
|
||||
for (; it.More(); it.Next()) {
|
||||
Handle(Graphic3d_Structure) SG = it.Key();
|
||||
if (! (SG->IsEmpty() || SG->IsInfinite ())) {
|
||||
SG->MinMaxValues (Xm, Ym, Zm, XM, YM, ZM);
|
||||
if (Xm < XMin) XMin = Xm;
|
||||
if (Ym < YMin) YMin = Ym;
|
||||
if (Zm < ZMin) ZMin = Zm;
|
||||
if (XM > XMax) XMax = XM;
|
||||
if (YM > YMax) YMax = YM;
|
||||
if (ZM > ZMax) ZMax = ZM;
|
||||
Flag = Standard_False;
|
||||
}
|
||||
}
|
||||
|
||||
// If all structures are empty or infinite
|
||||
if (Flag) {
|
||||
XMin = YMin = ZMin = RF;
|
||||
XMax = YMax = ZMax = RL;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Standard_Integer Graphic3d_StructureManager::NewIdentification () {
|
||||
|
||||
Standard_Integer Id = MyStructGenId.Next ();
|
||||
|
@ -1766,6 +1766,9 @@ void Visual3d_View::MinMaxValues (const Graphic3d_MapOfStructure& theSet,
|
||||
{
|
||||
const Handle(Graphic3d_Structure)& aStructure = anIterator.Key();
|
||||
|
||||
if (!aStructure->IsVisible())
|
||||
continue;
|
||||
|
||||
if (aStructure->IsInfinite() && !theToIgnoreInfiniteFlag)
|
||||
{
|
||||
//XMin, YMin .... ZMax are initialized by means of infinite line data
|
||||
|
24
tests/bugs/vis/bug24610
Normal file
24
tests/bugs/vis/bug24610
Normal file
@ -0,0 +1,24 @@
|
||||
puts "============"
|
||||
puts "OCC24610"
|
||||
puts "============"
|
||||
puts ""
|
||||
#######################################################################
|
||||
# Erased AIS object should not be taken into account by FitAll operation
|
||||
#######################################################################
|
||||
|
||||
pload VISUALIZATION
|
||||
vinit
|
||||
box b1 200 200 200
|
||||
vdisplay b1
|
||||
vfit
|
||||
box b2 2 2 2
|
||||
vdisplay b2
|
||||
set color_1 [vreadpixel 32 305]
|
||||
verase b1
|
||||
vfit
|
||||
set color_2 [vreadpixel 32 305]
|
||||
if {$color_1 == $color_2} {
|
||||
puts "ERROR: OCC24610 is reproduced"
|
||||
}
|
||||
|
||||
set only_screen 1
|
Loading…
x
Reference in New Issue
Block a user