MantisBT - Community
View Issue Details
0024509Community[OCCT] OCCT:Application Frameworkpublic2014-01-02 01:492014-11-11 12:59
barbier 
apn 
normalminor 
closedfixed 
 
[OCCT] 6.8.0[OCCT] 6.8.0 
Not needed
0024509: Suspect unused variable in TPrsStd_ConstraintTools.cxx
Hello,

Lines 295--306 of this file are:

    if (is_directed) {
      GetGoodShape(shape3);
      const TopoDS_Edge& E = TopoDS::Edge(shape3);
      BRepAdaptor_Curve CURVE(E);
      Handle_Geom_Geometry aGeomGeometry = CURVE.Curve().Curve()->Transformed(CURVE.Trsf()) ;
      gp_Dir Dir = ((Handle(Geom_Line)&) aGeomGeometry)->Lin().Direction();
      gp_Dir xdir(aplane->Pln().Position().XDirection());
      if (Dir.IsParallel(xdir,Precision::Confusion()))
        typedist = AIS_TOD_Horizontal;
      else
        typedist = AIS_TOD_Vertical;
    }
  }

But since typedist is not used afterwards, this whole block looks pretty useless.
TPrsStdConstaraintTool::ComuteDistance() that builds length dimensions, was revised and redesigned to remove unused variables and to update method behavior after AIS_LengthDimension redesign (#24133).

1) AIS_TypeOfDist in TPrsStdConstaraintTool::ComuteDistance() method became unused.
In old dimension implementation it defined what type (vertical or horizontal relatively to screen ) dimension would be.
In the current implementation dimension line is parallel to attachment points line, so there is no need in AIS_TypeOfDist object.

2) TPrsStd length constraint now can build dimension not only:
    - on two vertices
    - on two faces
    - on edge and face,

but also:
    - on two edges
    - on one edge

3) Dimension in TPrsStd_ConstraintTool is build on one or two shapes, but not on three. Third shape was used earlier to determine direction of dimension (vertical or horizontal), but now dimension direction is computed as perpendicular to the attachment points line.
No tags attached.
Issue History
2014-01-02 01:49barbierNew Issue
2014-01-02 01:49barbierAssigned To => szy
2014-03-20 18:34szyNote Added: 0028409
2014-03-20 18:34szyAssigned Toszy => aba
2014-03-20 18:34szyStatusnew => assigned
2014-04-28 12:13sanNote Added: 0029093
2014-04-28 12:13sanStatusassigned => feedback
2014-04-28 12:18sanTarget Version => 6.8.0
2014-04-29 13:05abaStatusfeedback => assigned
2014-04-29 13:11abaNote Added: 0029128
2014-04-29 13:13abaNote Added: 0029130
2014-04-29 13:13abaAssigned Toaba => san
2014-04-29 13:13abaStatusassigned => resolved
2014-05-13 15:40sanNote Added: 0029298
2014-05-13 15:40sanAssigned Tosan => bugmaster
2014-05-13 15:40sanStatusresolved => reviewed
2014-05-14 16:36apnAssigned Tobugmaster => apn
2014-05-16 14:37apnNote Added: 0029372
2014-05-16 14:38apnTest case number => Not needed
2014-05-16 14:38apnAssigned Toapn => aba
2014-05-16 14:38apnStatusreviewed => assigned
2014-05-19 11:35abaStatusassigned => resolved
2014-05-19 11:36abaNote Added: 0029384
2014-05-19 11:36abaAssigned Toaba => bugmaster
2014-05-19 11:36abaStatusresolved => reviewed
2014-05-19 11:36abaNote Edited: 0029384bug_revision_view_page.php?bugnote_id=29384#r7484
2014-05-20 15:40apvNote Added: 0029412
2014-05-20 15:42apvStatusreviewed => tested
2014-05-23 14:25apnChangeset attached => occt master 011b361d
2014-05-23 14:25apnAssigned Tobugmaster => apn
2014-05-23 14:25apnStatustested => verified
2014-05-23 14:25apnResolutionopen => fixed
2014-10-06 12:30abaAdditional Information Updatedbug_revision_view_page.php?rev_id=8260#r8260
2014-11-11 12:44aivFixed in Version => 6.8.0
2014-11-11 12:59aivStatusverified => closed

Notes
(0028409)
szy   
2014-03-20 18:34   
The corresponding part of code was removed by you by integration from branch 24133 at 31.10.2013. After that the mentioned variable 'typedist/ became unused.
Could you check it once again and explain your idea. This class is not used during dimension calculation and designed for another purpose.
szy
(0029093)
san   
2014-04-28 12:13   
dear aba,

Can you please process the issue, as it looks quite simple?
(0029128)
aba   
2014-04-29 13:11   
In the old AIS_LengthDimension implementation the variable of AIS_TypeOfDist type is used to compute direction of dimension flyouts.
Dimension flyout direction was fully determined by plane local coordinate system (plane's X and Y axes).

Changes:
1) In the current dimension implementation direction of flyout is computed from attachment points line and given working plane without need of additional parameters, so there is no need in AIS_TypeOfDist object.
2) Now AIS_TypeOfDist is used only in relation classes.
3) Dimension in TPrsStd_ConstraintTool is build on one or two shapes,
but not on three. Third shape was used earlier to determine direction
of dimension (vertical or horizontal), but now dimension direction is computed as perpendicular to the attachment points line.
(0029130)
aba   
2014-04-29 13:13   
The git branch CR24509 is ready to be reviewed.

Dear san,

please review.
(0029298)
san   
2014-05-13 15:40   
Branch CR24509 reviewed without remarks, ready for testing.
(0029372)
apn   
2014-05-16 14:37   
Dear BugMaster,

Branch CR24509 (and products from GIT master) was compiled on Linux, Windows and MacOS platforms and tested.
SHA-1: 6e20d78bfca479a504be64c7166b6e91ff331522

Number of compiler warnings:

occt component :
Linux: 18 (17 on master)
TPrsStd_ConstraintTools.cxx:346, GNU C Compiler 4 (gcc), Priority: Normal
suggest parentheses around ‘&&’ within ‘||’

Windows: 0 (0 on master)

MacOS: 207 (212 on master)
TPrsStd_ConstraintTools.cxx:345, Clang (LLVM based), Priority: Normal
'&&' within '||'
TPrsStd_ConstraintTools.cxx:346, Clang (LLVM based), Priority: Normal
'&&' within '||'

products component :
Linux: 11 (11 on master)
Windows: 2 (2 on master)

Regressions/Differences:
No regressions

Testing cases:
Not needed

Testing on Linux:
Total MEMORY difference: 355755200 / 355968116
Total CPU difference: 50096.739999999765 / 51289.87999999977

Testing on Windows:
Total MEMORY difference: 380262364 / 380248128
Total CPU difference: 38512.625 / 35796.140625

There are no differences in images found by testdiff.
(0029384)
aba   
2014-05-19 11:36   
Warnings were corrected.

Dear Bugmaster,

please test.

(0029412)
apv   
2014-05-20 15:40   
Dear BugMaster,

Branch CR24509 (and products from GIT master) was compiled on Linux, MacOS and Windows platforms and tested.
SHA-1: f1dcecd437f1a1bf88f506262a7dcdd1c47d47f0

Number of compiler warnings:

occt component :
Linux: 17 (17 on master)
Windows: 0 (0 on master)
MacOS: 202 (205 on master)

products component :
Linux: 11 (11 on master)
Windows: 2 (2 on master)

Regressions/Differences:
No regressions

Testing cases:
Not needed

Testing on Linux:
Total MEMORY difference: 356334564 / 357316044
Total CPU difference: 57274.68000000003 / 56363.22999999993

Testing on Windows:
Total MEMORY difference: 379138220 / 379627876
Total CPU difference: 40654.53125 / 35503.40625