1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-09-08 14:17:06 +03:00

Compare commits

..

1 Commits

Author SHA1 Message Date
vpa
9e5394288d 0026870: Visualization - deactivated selections are not updated after object's re-computation
- update status in SelectMgr_SelectionManager::RecomputeSelection:
  1) is set to full for all selections;
  2) is switched to none only if selection was actually recomputed;
- test case for issue #26870
2015-11-16 16:42:58 +03:00
16 changed files with 76 additions and 252 deletions

View File

@@ -54,7 +54,6 @@
#include <BOPTest_DrawableShape.hxx>
#include <BOPTest_Objects.hxx>
#include <IntSurf_PntOn2S.hxx>
//
static BOPAlgo_PaveFiller* pPF=NULL;
@@ -116,7 +115,7 @@ static Standard_Integer mkvolume (Draw_Interpretor&, Standard_Integer, const c
theCommands.Add("bsection", "use bsection r s1 s2 [-n2d/-n2d1/-n2d2] [-na]",
__FILE__, bsection, g);
//
theCommands.Add("bopcurves", "use bopcurves F1 F2 [-2d/-2d1/-2d2] [-p u1 v1 u2 v2]",
theCommands.Add("bopcurves", "use bopcurves F1 F2 [-2d/-2d1/-2d2]",
__FILE__, bopcurves, g);
theCommands.Add("bopnews" , "use bopnews -v[e,f]" , __FILE__, bopnews, g);
theCommands.Add("mkvolume", "make solids from set of shapes.\nmkvolume r b1 b2 ... [-c] [-ni]",
@@ -646,43 +645,29 @@ Standard_Integer bopcurves (Draw_Interpretor& di,
Standard_Boolean aToApproxC3d, aToApproxC2dOnS1, aToApproxC2dOnS2, anIsDone;
Standard_Integer i, aNbCurves, aNbPoints;
Standard_Real anAppTol, aTolR;
IntSurf_ListOfPntOn2S aListOfPnts;
TCollection_AsciiString aNm("c_"), aNp("p_");
//
anAppTol = 0.0000001;
aToApproxC3d = Standard_True;
aToApproxC2dOnS1 = Standard_False;
aToApproxC2dOnS2 = Standard_False;
//
for(Standard_Integer i = 3; i < n; i++)
{
if (!strcasecmp(a[i],"-2d")) {
if (n > 3) {
if (!strcasecmp(a[3],"-2d")) {
aToApproxC2dOnS1 = Standard_True;
aToApproxC2dOnS2 = Standard_True;
}
else if (!strcasecmp(a[i],"-2d1")) {
else if (!strcasecmp(a[3],"-2d1")) {
aToApproxC2dOnS1 = Standard_True;
}
else if (!strcasecmp(a[i],"-2d2")) {
else if (!strcasecmp(a[3],"-2d2")) {
aToApproxC2dOnS2 = Standard_True;
}
else if (!strcasecmp(a[i],"-p")) {
IntSurf_PntOn2S aPt;
const Standard_Real aU1 = Draw::Atof(a[++i]);
const Standard_Real aV1 = Draw::Atof(a[++i]);
const Standard_Real aU2 = Draw::Atof(a[++i]);
const Standard_Real aV2 = Draw::Atof(a[++i]);
aPt.SetValue(aU1, aV1, aU2, aV2);
aListOfPnts.Append(aPt);
}
else {
di << "Wrong key. To build 2d curves use: bopcurves F1 F2 [-2d/-2d1/-2d2] [-p u1 v1 u2 v2]\n";
di << "Wrong key. To build 2d curves use: bopcurves F1 F2 -2d/-2d1/-2d2 \n";
return 1;
}
}
//
IntTools_FaceFace aFF;
//
@@ -690,7 +675,6 @@ Standard_Integer bopcurves (Draw_Interpretor& di,
aToApproxC2dOnS1,
aToApproxC2dOnS2,
anAppTol);
aFF.SetList(aListOfPnts);
//
aFF.Perform (aF1, aF2);
//

View File

@@ -187,10 +187,7 @@ void Extrema_ExtCS::Perform(const Adaptor3d_Curve& C,
}
if (myS->IsUPeriodic())
NbU = 13;
if (myS->IsVPeriodic())
NbV = 13;
Extrema_GenExtCS Ext(C, *myS, NbT, NbU, NbV, cfirst, clast, ufirst, ulast,
vfirst, vlast, mytolC, mytolS);
@@ -246,9 +243,7 @@ void Extrema_ExtCS::Perform(const Adaptor3d_Curve& C,
Ext.Perform(C, NbT, tmin, tmax, mytolC); // to avoid overflow
}
else {
if((myCtype == GeomAbs_Circle && NbT < 13) ||
(myCtype == GeomAbs_BSplineCurve && NbT < 13))
{
if(myCtype == GeomAbs_Circle && NbT < 13) {
NbT = 13;
}
Ext.Perform(C, NbT, mytolC);

View File

@@ -205,7 +205,7 @@ void Extrema_GenExtCS::Perform (const Adaptor3d_Curve& C,
TUVsup(3) = trimvsup;
// Number of particles used in PSO algorithm (particle swarm optimization).
const Standard_Integer aNbParticles = 48;
const Standard_Integer aNbParticles = 32;
math_PSOParticlesPool aParticles(aNbParticles, 3);

View File

@@ -153,7 +153,7 @@ static
Standard_Real& thevmin,
Standard_Real& thevmax);
static
static
Standard_Boolean NotUseSurfacesForApprox
(const TopoDS_Face& aF1,
const TopoDS_Face& aF2,
@@ -195,7 +195,7 @@ static
static
Standard_Boolean IsCurveValid(Handle(Geom2d_Curve)& thePCurve);
static
static
Standard_Boolean IsPointOnBoundary(const Standard_Real theParameter,
const Standard_Real theFirstBoundary,
const Standard_Real theSecondBoundary,
@@ -852,12 +852,12 @@ Standard_Real IntTools_FaceFace::ComputeTolerance()
}
//
const TopoDS_Face& aF = !i ? myFace1 : myFace2;
aD = FindMaxDistance(aC3D, aFirst, aLast, aF, myContext);
aD = FindMaxDistance(aC3D, aFirst, aLast, aF, myContext);
if (aD > aDMax) {
aDMax = aD;
}
aDMax = aD;
}
}
}
//
return aDMax;
}
@@ -1033,8 +1033,6 @@ Standard_Real IntTools_FaceFace::ComputeTolerance()
(aType2==GeomAbs_Plane && aType1==GeomAbs_SurfaceOfExtrusion) ||
(aType1==GeomAbs_Plane && aType2==GeomAbs_BSplineSurface) ||
(aType2==GeomAbs_Plane && aType1==GeomAbs_BSplineSurface) ||
(aType1==GeomAbs_Cylinder && aType2==GeomAbs_BSplineSurface) ||
(aType2==GeomAbs_Cylinder && aType1==GeomAbs_BSplineSurface)||
!myApprox) {
//
Standard_Real aDMax;
@@ -1050,8 +1048,8 @@ Standard_Real IntTools_FaceFace::ComputeTolerance()
//function : MakeCurve
//purpose :
//=======================================================================
void IntTools_FaceFace::MakeCurve(const Standard_Integer Index,
const Handle(Adaptor3d_TopolTool)& dom1,
void IntTools_FaceFace::MakeCurve(const Standard_Integer Index,
const Handle(Adaptor3d_TopolTool)& dom1,
const Handle(Adaptor3d_TopolTool)& dom2)
{
Standard_Boolean bDone, rejectSurface, reApprox, bAvoidLineConstructor;
@@ -1090,31 +1088,13 @@ void IntTools_FaceFace::MakeCurve(const Standard_Integer Index,
return;
}
L = anewL;
//const Handle(IntPatch_WLine)& aWLineX = Handle(IntPatch_WLine)::DownCast(L);
//DumpWLine(aWLineX);
//
if(!myListOfPnts.IsEmpty()) {
//char aBuff[10000];
//const IntSurf_PntOn2S& aPt = myListOfPnts.First();
//Standard_Real u1, v1, u2, v2;
//aPt.Parameters(u1, v1, u2, v2);
//Sprintf(aBuff,"bopcurves f1 f2 -2d");
//IntSurf_ListIteratorOfListOfPntOn2S IterLOP1(myListOfPnts);
//for(;IterLOP1.More(); IterLOP1.Next())
//{
// const IntSurf_PntOn2S& aPt = IterLOP1.Value();
// Standard_Real u1, v1, u2, v2;
// aPt.Parameters(u1, v1, u2, v2);
// Sprintf(aBuff, "%s -p %+10.20f %+10.20f %+10.20f %+10.20f", aBuff, u1, v1, u2, v2);
//}
//cout << aBuff << endl;
//bAvoidLineConstructor = Standard_True;
bAvoidLineConstructor = Standard_True;
}
Standard_Integer nbp = aWLine->NbPnts();
@@ -1823,15 +1803,15 @@ void IntTools_FaceFace::MakeCurve(const Standard_Integer Index,
//
Standard_Real aReachedTol = Precision::Confusion();
bIsDecomposited=DecompositionOfWLine(WL,
myHS1,
myHS2,
myFace1,
myFace2,
myLConstruct,
bAvoidLineConstructor,
aSeqOfL,
aReachedTol,
myContext);
myHS1,
myHS2,
myFace1,
myFace2,
myLConstruct,
bAvoidLineConstructor,
aSeqOfL,
aReachedTol,
myContext);
if ( bIsDecomposited && ( myTolReached3d < aReachedTol ) ) {
myTolReached3d = aReachedTol;
}
@@ -2759,7 +2739,7 @@ Handle(Geom2d_BSplineCurve) MakeBSpline2d(const Handle(IntPatch_WLine)& theWLine
// because inside degenerated zone of the surface the approx. algo.
// uses wrong values of normal, etc., and resulting curve will have
// oscillations that we would not like to have.
static
@@ -3087,7 +3067,7 @@ Standard_Boolean FindPoint(const gp_Pnt2d& theFirstPoint,
const Standard_Real theVmin,
const Standard_Real theVmax,
gp_Pnt2d& theNewPoint) {
gp_Vec2d aVec(theFirstPoint, theLastPoint);
Standard_Integer i = 0, j = 0;

View File

@@ -687,6 +687,7 @@ void SelectMgr_SelectionManager::RecomputeSelection (const Handle(SelectMgr_Sele
for(theObject->Init(); theObject->More(); theObject->Next())
{
const Handle(SelectMgr_Selection)& aSelection = theObject->CurrentSelection();
aSelection->UpdateStatus (SelectMgr_TOU_Full);
Standard_Integer aSelMode = aSelection->Mode();
for (TColStd_MapIteratorOfMapOfTransient aSelectorIter (mySelectors); aSelectorIter.More(); aSelectorIter.Next())
@@ -697,10 +698,10 @@ void SelectMgr_SelectionManager::RecomputeSelection (const Handle(SelectMgr_Sele
ClearSelectionStructures (theObject, aSelMode, aCurSelector);
theObject->RecomputePrimitives(aSelMode);
RestoreSelectionStructures (theObject, aSelMode, aCurSelector);
aSelection->UpdateStatus (SelectMgr_TOU_None);
aSelection->UpdateBVHStatus (SelectMgr_TBU_None);
}
}
aSelection->UpdateStatus (SelectMgr_TOU_None);
aSelection->UpdateBVHStatus (SelectMgr_TBU_None);
}
}

View File

@@ -1,47 +1,5 @@
restore [locate_data_file GEN758_nofog.rle] a
explode a f
# see issue #26777
set GoodNbCurv 1
set log [bopcurves a_1 a_2 -2d -p 0.20639206339545224 0.69260832843385300 0.0 0.017002507022347624]
regexp {Tolerance Reached=+([-0-9.+eE]+)\n+([-0-9.+eE]+)} ${log} full Tolerance_Reached NbCurv
set expected_Tolerance_Reached 0.00011474465750371152
set tol_abs_Tolerance_Reached 0.0
set tol_rel_Tolerance_Reached 1.0e-2
checkreal "Tolerance Reached" ${Tolerance_Reached} ${expected_Tolerance_Reached} ${tol_abs_Tolerance_Reached} ${tol_rel_Tolerance_Reached}
if {${NbCurv} != ${GoodNbCurv}} {
puts "Error: ${GoodNbCurv} curves are expected but ${NbCurv} are found!"
}
smallview
clear
if {${NbCurv} == 1} {
display c_1
fit
} else {
for { set i 1 } { ${i} <= ${NbCurv} } {incr i} {
bounds c_$i u1 u2
cvalue c_$i u2 xx yy zz
point p$i xx yy zz
}
fit
for { set i 1 } { ${i} <= ${NbCurv} } {incr i} {
erase p$i
display c_$i
}
}
xwd ${imagedir}/${casename}_curv.png
donly a_1 a_2
explode a
bsection result a_1 a_2
set length 22.2575
checksection result

View File

@@ -1,26 +0,0 @@
puts "========"
puts "OCC27114"
puts "========"
puts ""
##############################################
# DistShapeShape gives not all solutions
# Correct result is 2 solutions
##############################################
restore [locate_data_file bug27114.brep] aShape
explode aShape
set anInfo [distmini d aShape_1 aShape_2]
# Check number of solutions
if { [llength $anInfo] != 9 } {
puts "ERROR: Incorrect number of solutions"
} else {
puts "OK: Two solutions is found"
}
# Check extrema distance
set absTol 1.0e-10
set relTol 0.001
set aDist_Exp 0.0
set aDist [dval d_val]
checkreal "Distance value check" $aDist $aDist_Exp $absTol $relTol

View File

@@ -6,7 +6,7 @@ puts ""
# ShapeUpgrade_UnifySameDomain introduces extremely high vertex tolerances
############################################################################
restore [locate_data_file bug26656_unify.input.brep] i
restore [locate_data_file OCC26656_unify.input.brep] i
set bug_info [tolerance i]
set value_1 [lindex $bug_info 1]

View File

@@ -1,5 +1,3 @@
puts "TODO OCC26717 ALL: Faulty shapes in variables faulty_1 to faulty_"
puts "=========="
puts "BUC60462"
puts "=========="
@@ -15,5 +13,4 @@ puts "Fuse end"
checkshape result r
set square 94371.7
checkshape result
set 2dviewer 0

View File

@@ -1,4 +1,3 @@
puts "TODO OCC25917 ALL: Faulty shapes in variables faulty_1 to faulty_"
if { [regexp {Debug mode} [dversion]] } {
puts "TODO OCC25917 ALL: TEST INCOMPLETE"
puts "TODO OCC25917 ALL: Tcl Exception"

View File

@@ -1,5 +1,5 @@
puts "TODO OCC12345 ALL: Faulty : TEST FAILED"
puts "TODO OCC12345 ALL: Error : The length of result shape is"
#puts "TODO OCC12345 ALL: Error : The length of result shape is"
puts "============"
puts "PRO19653"

View File

@@ -26,14 +26,14 @@ mkvolume result fcon3 fp
set square 1706.51
set nb_v_good 5
set nb_e_good 6
set nb_v_good 4
set nb_e_good 5
set nb_w_good 2
set nb_f_good 2
set nb_sh_good 1
set nb_sol_good 1
set nb_compsol_good 0
set nb_compound_good 0
set nb_shape_good 17
set nb_shape_good 15
set 2dviewer 1

View File

@@ -1,50 +0,0 @@
puts "============"
puts "OCC26841"
puts "============"
puts ""
###############################
## Wrong result obtained by intersection algorithm.
###############################
restore [locate_data_file bug26841c1-prism.brep] p1
restore [locate_data_file bug26841c1-deck.brep] a1
bsection result a1 p1 -n2d2
smallview
donly result
fit
display a1 p1
set nbshapes_expected "
Number of shapes in shape
VERTEX : 5
EDGE : 5
WIRE : 0
FACE : 0
SHELL : 0
SOLID : 0
COMPSOLID : 0
COMPOUND : 1
SHAPE : 11
"
checknbshapes result -ref ${nbshapes_expected} -t -m "SECTION"
regexp {Tolerance +MAX=([-0-9.+eE]+)} [tolerance result] full MaxTolerance
puts "MaxTolerance=$MaxTolerance"
set expected_MaxTolerance 7.0623347214107758e-005
set tol_abs_MaxTolerance 0.0
set tol_rel_MaxTolerance 0.01
checkreal "MaxTolerance" ${MaxTolerance} ${expected_MaxTolerance} ${tol_abs_MaxTolerance} ${tol_rel_MaxTolerance}
set log [checksection result]
if { [string compare -nocase $log " nb alone Vertices : 0\n\n"] } {
puts "ERROR: the section is not closed"
} else {
puts "The section is OK"
}
set only_screen_axo 1

View File

@@ -1,51 +0,0 @@
puts "============"
puts "OCC26841"
puts "============"
puts ""
###############################
## Wrong result obtained by intersection algorithm.
###############################
restore [locate_data_file bug26841c3-prism.brep] p3
restore [locate_data_file bug26841c3-deck.brep] a3
bsection result a3 p3 -n2d2
smallview
donly result
fit
display a3 p3
set nbshapes_expected "
Number of shapes in shape
VERTEX : 10
EDGE : 10
WIRE : 0
FACE : 0
SHELL : 0
SOLID : 0
COMPSOLID : 0
COMPOUND : 1
SHAPE : 21
"
checknbshapes result -ref ${nbshapes_expected} -t -m "SECTION"
regexp {Tolerance +MAX=([-0-9.+eE]+)} [tolerance result] full MaxTolerance
puts "MaxTolerance=$MaxTolerance"
set expected_MaxTolerance 0.00010145423883977269
set tol_abs_MaxTolerance 0.0
set tol_rel_MaxTolerance 0.001
checkreal "MaxTolerance" ${MaxTolerance} ${expected_MaxTolerance} ${tol_abs_MaxTolerance} ${tol_rel_MaxTolerance}
set log [checksection result]
if { [string compare -nocase $log " nb alone Vertices : 0\n\n"] } {
puts "ERROR: the section is not closed"
} else {
puts "The section is OK"
}
set only_screen_axo 1

View File

@@ -18,7 +18,7 @@ foreach i ${Indices} {
if { [isdraw ext_1] } {
mkedge e ext_1
regexp {Mass +: +([-0-9.+eE]+)} [lprops e] full l
if {$l > 2.5e-12} {
if {$l > 1e-12} {
puts "Error: invalid result"
}
renamevar ext_1 r_$i

37
tests/bugs/vis/bug26870 Normal file
View File

@@ -0,0 +1,37 @@
puts "============"
puts "CR26870"
puts "============"
puts ""
##########################################################################################
puts "Visualization - deactivated selections are not updated after object's re-computation"
##########################################################################################
pload VISUALIZATION MODELING
vinit
box b 1 1 1
vdisplay b
vfit
vselmode b 2 1
vselmode b 4 1
vselmode b 4 0
box b 3 3 3
vdisplay b
vfit
vselmode 4 1
# pick a point onto previously computed face
vmoveto 80 265
if {[vreadpixel 90 206 name] == "CYAN1 1"} {
puts "ERROR: previously computed entities are highlighted! Selection mode 4 was not updated after redisplaying the box."
}
# pick a point onto box
if {[vreadpixel 29 216 name] == "YELLOW 1"} {
puts "ERROR: the box's face is not highlighted! Selection mode 4 was not updated after redisplaying the box."
}
set only_screen 1