Archived issue #0031547
Visualization - V3d_View creates V3d_Trihedron instance
Description
In 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.
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 reproduce
Not required
Public activity
18 archived notes
Participants are labeled by their role within this record.
Branch [archived branch] has been created by Participant.
0031547: Visualization - V3d_View creates V3d_Trihedron instance
- moved creating of V3d_Trihedron from constructor to first attempt of displaying or calling it.
0031547: Visualization - V3d_View creates V3d_Trihedron instance
- moved creating of V3d_Trihedron from constructor to first attempt of displaying or calling it.
Wouldn't V3d_View::TriedronErase() crash with your patch?
Please also try extending the patch to V3d_Viewer::myRGrid and V3d_Viewer::myCGrid, which could be also created on demand (see command vgrid).
Branch [archived branch] has been updated by Participant
# kgv remarks
- added a check in V3d_View::TriedronErase()
- extended to V3d_Viewer::myRGrid and V3d_Viewer::myCGrid
# kgv remarks
- added a check in V3d_View::TriedronErase()
- extended to V3d_Viewer::myRGrid and V3d_Viewer::myCGrid
Branch [archived branch] has been created by Participant.
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
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
The patch makes grid practically always created, see AIS_ViewController:
Please consider correcting AIS_ViewController.
if (theView->Viewer()->Grid()->IsActive() && theView->Viewer()->GridEcho())
Please consider correcting AIS_ViewController.
-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.
Branch [archived branch] has been updated by Participant
# kgv remarks:
- returned const stub in IsActive and DrawMode
- corrected AIS_ViewController and V3d_View to not make grid
# kgv remarks:
- returned const stub in IsActive and DrawMode
- corrected AIS_ViewController and V3d_View to not make grid
Branch [archived branch] has been created by Participant.
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
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
Could you please rename V3d_Viewer::IsActive() to V3d_Viewer::IsGridActive() in scope of the patch (with keeping V3d_Viewer::IsActive() as deprecated alias)?
Branch [archived branch] has been updated by Participant
# kgv remarks:
- renamed V3d_Viewer::IsActive() to V3d_Viewer::IsGridActive()
- kept V3d_Viewer::IsActive() as deprecated alias
# kgv remarks:
- renamed V3d_Viewer::IsActive() to V3d_Viewer::IsGridActive()
- kept V3d_Viewer::IsActive() as deprecated alias
Branch [archived branch] has been created by Participant.
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()
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()
+ 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.
The same for V3d_View::Trihedron(bool theToCreate)
Branch [archived branch] has been updated by Participant
# 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
# 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
Branch [archived branch] has been created by Participant.
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
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
Please raise the patch
- OCCT branch: [archived branch]
- OCCT branch: [archived branch]
Combination -
OCCT branch : [archived branch]
master SHA - [revision removed]
[revision removed]
Products branch : [archived branch] SHA - [revision removed]
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
OCCT branch : [archived branch]
master SHA - [revision removed]
[revision removed]
Products branch : [archived branch] SHA - [revision removed]
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 records