View Issue Details

IDProjectCategoryView StatusLast Update
0031547Open CASCADEOCCT:Visualizationpublic2021-01-23 14:14
Reporternds Assigned Tobugmaster  
PrioritynormalSeverityintegration request 
Status closedResolutionfixed 
Product Version7.1.0 
Target Version7.6.0Fixed in Version7.6.0 
Summary0031547: Visualization - V3d_View creates V3d_Trihedron instance
DescriptionIn V3d_View constructor, we create an instance of V3d_Trihedron.

Reasons for avoiding this:
1. Each view gets an application memory for this object, though it might not be used until TriedronDisplay() is called.
2. There is an alternative presentation: AIS_Trihedron (more parameters to handle).

The proposal is to create V3d_Trihedron in V3d_View just by the first attempt to display it.
Steps To ReproduceNot required
TagsNo tags attached.
Test case numberNot required

Relationships

child of 0024291 closedapn Visualization - move Z-buffer trihedron presentation from TKOpenGl to TKV3d 

Activities

mkrylova

2021-01-19 14:52

developer   ~0098205

Branch CR31547 has been created by mkrylova.
 
0031547: Visualization - V3d_View creates V3d_Trihedron instance

- moved creating of V3d_Trihedron from constructor to first attempt of displaying or calling it.

kgv

2021-01-19 15:01

developer   ~0098209

Wouldn't V3d_View::TriedronErase() crash with your patch?

kgv

2021-01-19 15:06

developer   ~0098219

Last edited: 2021-01-19 15:07

Please also try extending the patch to V3d_Viewer::myRGrid and V3d_Viewer::myCGrid, which could be also created on demand (see command vgrid).

mkrylova

2021-01-19 17:00

developer   ~0098221

Branch CR31547 has been updated by mkrylova
 # kgv remarks
- added a check in V3d_View::TriedronErase()
- extended to V3d_Viewer::myRGrid and V3d_Viewer::myCGrid

mkrylova

2021-01-19 17:01

developer   ~0098222

Branch CR31547_1 has been created by mkrylova.
 
0031547: Visualization - V3d_View creates V3d_Trihedron instance

- moved creating of V3d_View::myTrihedron from constructor to first attempt of displaying or calling it
- moved creating of V3d_Viewer::myRGrid and V3d_Viewer::myCGrid to first attempt of displaying or calling them

kgv

2021-01-19 17:09

developer   ~0098223

The patch makes grid practically always created, see AIS_ViewController:
  if (theView->Viewer()->Grid()->IsActive()
   && theView->Viewer()->GridEcho())


Please consider correcting AIS_ViewController.

kgv

2021-01-19 17:11

developer   ~0098224

-Standard_Boolean V3d_Viewer::IsActive() const
+Standard_Boolean V3d_Viewer::IsActive()
 {
   return Grid()->IsActive();
...
-Aspect_GridDrawMode V3d_Viewer::GridDrawMode() const
+Aspect_GridDrawMode V3d_Viewer::GridDrawMode()
 {
   return Grid()->DrawMode();

It will be better returning stub here (check default values from grid constructor) instead of creating a Grid object.

mkrylova

2021-01-20 18:11

developer   ~0098258

Branch CR31547_1 has been updated by mkrylova

 # kgv remarks:
- returned const stub in IsActive and DrawMode
- corrected AIS_ViewController and V3d_View to not make grid

mkrylova

2021-01-20 18:11

developer   ~0098259

Branch CR31547_2 has been created by mkrylova.
 
0031547: Visualization - V3d_View creates V3d_Trihedron instance

- moved creating of V3d_View::myTrihedron from constructor to first attempt of displaying or calling it
- moved creating of V3d_Viewer::myRGrid and V3d_Viewer::myCGrid to first attempt of displaying or calling them

kgv

2021-01-20 18:17

developer   ~0098260

Could you please rename V3d_Viewer::IsActive() to V3d_Viewer::IsGridActive() in scope of the patch (with keeping V3d_Viewer::IsActive() as deprecated alias)?

mkrylova

2021-01-21 12:14

developer   ~0098295

Branch CR31547_2 has been updated by mkrylova

 # kgv remarks:
- renamed V3d_Viewer::IsActive() to V3d_Viewer::IsGridActive()
- kept V3d_Viewer::IsActive() as deprecated alias

mkrylova

2021-01-21 12:15

developer   ~0098296

Branch CR31547_3 has been created by mkrylova.
 
0031547: Visualization - V3d_View creates V3d_Trihedron instance

- moved creating of V3d_View::myTrihedron from constructor to first attempt of displaying or calling it
- moved creating of V3d_Viewer::myRGrid and V3d_Viewer::myCGrid to first attempt of displaying or calling them
- renamed V3d_Viewer::IsActive() to V3d_Viewer::IsGridActive()

kgv

2021-01-21 17:43

developer   ~0098318

Last edited: 2021-01-21 17:43

+    if (!(myRGrid.IsNull() && myCGrid.IsNull()))
+    {
+      anActiveViewIter.Value()->SetGrid (myPrivilegedPlane, Grid());
+    }
...
+Handle(Aspect_Grid) V3d_Viewer::Grid()
+    case Aspect_GT_Circular:
+    {
+      if (myCGrid.IsNull())
+      {
+        myCGrid = new V3d_CircularGrid(this, Quantity_Color(Quantity_NOC_GRAY50), Quantity_Color(Quantity_NOC_GRAY70));
+      }
+      return Handle(Aspect_Grid) (myCGrid);
+    }
+    case Aspect_GT_Rectangular: 
+    {
+      if (myRGrid.IsNull())
+      {
+        myRGrid = new V3d_RectangularGrid(this, Quantity_Color(Quantity_NOC_GRAY50), Quantity_Color(Quantity_NOC_GRAY70));
+      }
+      return Handle(Aspect_Grid) (myRGrid);
+    }

The logic looks confusing.
I propose defining
> Handle(Aspect_Grid) V3d_Viewer::Grid (bool toCreate = true) {}
instead and call it with FALSE in places where it is desired to check for grid existance.

kgv

2021-01-22 08:18

developer   ~0098326

The same for V3d_View::Trihedron(bool theToCreate)

mkrylova

2021-01-22 12:34

developer   ~0098331

Branch CR31547_3 has been updated by mkrylova

 # kgv remarks:
- redefined V3d_View::Trihedron and V3d_Viewer::Grid by adding new argument toCreate for opportunity to check the existence of the objects without their recreating

mkrylova

2021-01-22 12:36

developer   ~0098332

Branch CR31547_4 has been created by mkrylova.
 
0031547: Visualization - V3d_View creates V3d_Trihedron instance

- moved creating of V3d_View::myTrihedron from constructor to first attempt of displaying or calling it
- moved creating of V3d_Viewer::myRGrid and V3d_Viewer::myCGrid to to first attempt of displaying or calling them
- renamed V3d_Viewer::IsActive() to V3d_Viewer::IsGridActive()
- redefined V3d_View::Trihedron and V3d_Viewer::Grid by adding new argument toCreate for opportunity to check the existence of the objects without their recreating

kgv

2021-01-22 16:09

developer   ~0098337

Please raise the patch
- OCCT branch: CR31547_5.

bugmaster

2021-01-23 12:51

administrator   ~0098377

Combination -
OCCT branch : IR-2021-01-22
master SHA - 8948e18df815e356c59a750bd2711cb4a7914cec
a206de37fbfa0bf71bd534ae47192bbec23b8522
Products branch : IR-2021-01-22 SHA - 7cb485e51cb439852e1e1e0726af89f51d6d6db0
was compiled on Linux, MacOS and Windows platforms and tested in optimize mode.

Number of compiler warnings:
No new/fixed warnings

Regressions/Differences/Improvements:
No regressions/differences

CPU differences:
Debian80-64:
OCCT
Total CPU difference: 17720.020000000055 / 17721.200000000135 [-0.01%]
Products
Total CPU difference: 12428.380000000123 / 12412.630000000105 [+0.13%]
Windows-64-VC14:
OCCT
Total CPU difference: 19367.234375 / 19300.265625 [+0.35%]
Products
Total CPU difference: 13821.875 / 13740.03125 [+0.60%]


Image differences :
No differences that require special attention

Memory differences :
No differences that require special attention

Related Changesets

occt: master 5634c81a

2020-12-31 06:37:51

mkrylova


Committer: bugmaster Details Diff
0031547: Visualization - V3d_View creates V3d_Trihedron instance

- moved creating of V3d_View::myTrihedron from constructor to first attempt of displaying or calling it;
- moved creating of V3d_Viewer::myRGrid and V3d_Viewer::myCGrid to to first attempt of displaying or calling them;
- renamed V3d_Viewer::IsActive() to V3d_Viewer::IsGridActive();
- redefined V3d_View::Trihedron() and V3d_Viewer::Grid() by adding new argument toCreate
for opportunity to check the existence of the objects without their recreating.
Affected Issues
0031547
mod - samples/mfc/standard/01_Geometry/src/GeometryDoc.cpp Diff File
mod - samples/mfc/standard/Common/OCC_2dView.cpp Diff File
mod - src/AIS/AIS_ViewController.cxx Diff File
mod - src/QABugs/QABugs_6.cxx Diff File
mod - src/V3d/V3d_View.cxx Diff File
mod - src/V3d/V3d_View.hxx Diff File
mod - src/V3d/V3d_Viewer.cxx Diff File
mod - src/V3d/V3d_Viewer.hxx Diff File
mod - src/V3d/V3d_Viewer_4.cxx Diff File
mod - src/V3d/V3d_View_4.cxx Diff File
mod - src/ViewerTest/ViewerTest_ViewerCommands.cxx Diff File

Issue History

Date Modified Username Field Change
2020-05-04 20:43 nds New Issue
2020-05-04 20:43 nds Assigned To => nds
2020-05-06 13:19 kgv Relationship added child of 0024291
2020-05-06 13:19 kgv Product Version => 7.1.0
2020-09-21 09:55 nds Target Version 7.5.0 => 7.6.0
2020-12-14 12:49 kgv Assigned To nds => mkrylova
2020-12-14 12:49 kgv Severity minor => integration request
2020-12-14 12:49 kgv Status new => assigned
2021-01-19 14:52 mkrylova Note Added: 0098205
2021-01-19 14:53 mkrylova Assigned To mkrylova => kgv
2021-01-19 14:53 mkrylova Status assigned => resolved
2021-01-19 14:53 mkrylova Steps to Reproduce Updated
2021-01-19 15:01 kgv Note Added: 0098209
2021-01-19 15:01 kgv Assigned To kgv => mkrylova
2021-01-19 15:01 kgv Status resolved => assigned
2021-01-19 15:06 kgv Note Added: 0098219
2021-01-19 15:07 kgv Note Edited: 0098219
2021-01-19 17:00 mkrylova Note Added: 0098221
2021-01-19 17:01 mkrylova Note Added: 0098222
2021-01-19 17:01 mkrylova Assigned To mkrylova => kgv
2021-01-19 17:01 mkrylova Status assigned => resolved
2021-01-19 17:09 kgv Note Added: 0098223
2021-01-19 17:09 kgv Assigned To kgv => mkrylova
2021-01-19 17:09 kgv Status resolved => assigned
2021-01-19 17:11 kgv Note Added: 0098224
2021-01-20 18:11 mkrylova Note Added: 0098258
2021-01-20 18:11 mkrylova Note Added: 0098259
2021-01-20 18:11 mkrylova Assigned To mkrylova => kgv
2021-01-20 18:11 mkrylova Status assigned => resolved
2021-01-20 18:17 kgv Note Added: 0098260
2021-01-20 20:39 kgv Assigned To kgv => mkrylova
2021-01-20 20:39 kgv Status resolved => assigned
2021-01-21 12:14 mkrylova Note Added: 0098295
2021-01-21 12:15 mkrylova Note Added: 0098296
2021-01-21 12:15 mkrylova Assigned To mkrylova => kgv
2021-01-21 12:15 mkrylova Status assigned => resolved
2021-01-21 17:43 kgv Note Added: 0098318
2021-01-21 17:43 kgv Assigned To kgv => mkrylova
2021-01-21 17:43 kgv Status resolved => assigned
2021-01-21 17:43 kgv Note Edited: 0098318
2021-01-22 08:18 kgv Note Added: 0098326
2021-01-22 12:34 mkrylova Note Added: 0098331
2021-01-22 12:36 mkrylova Note Added: 0098332
2021-01-22 12:36 mkrylova Assigned To mkrylova => kgv
2021-01-22 12:36 mkrylova Status assigned => resolved
2021-01-22 16:09 kgv Note Added: 0098337
2021-01-22 16:09 kgv Assigned To kgv => bugmaster
2021-01-22 16:09 kgv Status resolved => reviewed
2021-01-23 12:51 bugmaster Note Added: 0098377
2021-01-23 12:51 bugmaster Status reviewed => tested
2021-01-23 13:10 bugmaster Test case number => Not required
2021-01-23 14:14 bugmaster Changeset attached => occt master 5634c81a
2021-01-23 14:14 bugmaster Status tested => verified
2021-01-23 14:14 bugmaster Resolution open => fixed