View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0024461 | Community | OCCT:Visualization | public | 2013-12-12 18:59 | 2016-12-15 17:14 |
Reporter | Jerome Monaco | Assigned To | bugmaster | ||
Priority | normal | Severity | integration request | ||
Status | closed | Resolution | no change required | ||
Platform | A | OS | L | ||
Product Version | 6.5.4 | ||||
Target Version | 7.2.0 | ||||
Summary | 0024461: Restore the possibility for the zBuffer trto move automatically to a predefined postion when going outside the view | ||||
Description | This possibility was present in a old version and is very usefull for me, so I have to restore it by hand and rebuild OCC. It would be nice to add an option in zBuffer trihedron display to enable or not this possibility : V3d_View->TriedronDisplay( Aspect_TOTP_LEFT_LOWER, Quantity_NOC_GRAY50, 0.06, V3d_ZBUFFER, const Standard_Boolean bAlwaysDisplay ); or add maybe new options to Aspect_TypeOfTriedronPosition enum. Here is the code that I modify to allow that: /******************************************************* * Draws ZBUFFER trihedron mode *******************************************************/ //call_zbuffer_triedron_redraw void OpenGl_Trihedron::redrawZBuffer (const Handle(OpenGl_Workspace)& theWorkspace) const { const Standard_Real U = theWorkspace->ActiveView()->Height(); const Standard_Real V = theWorkspace->ActiveView()->Width(); GLdouble modelMatrix[4][4]; glGetDoublev( GL_MODELVIEW_MATRIX, (GLdouble *) modelMatrix ); GLdouble projMatrix[4][4]; glGetDoublev( GL_PROJECTION_MATRIX, (GLdouble *) projMatrix ); /* Check position in the ViewPort */ /* PCD 29/09/2008 */ /* Simple code modification recommended by Fotis Sioutis and Peter Dolbey */ /* to remove the irritating default behaviour of triedrons using V3d_ZBUFFER */ /* which causes the glyph to jump around the screen when the origin moves offscreen. */ GLboolean isWithinView = GL_FALSE; /// CHANGES BEGIN HERE : this change allow the trihedron to move to the predefined position when going outside of the view GLint aViewPort[4]; GLdouble aWinCoord[3]; glGetIntegerv(GL_VIEWPORT, aViewPort ); gluProject( 0.0, 0.0, 0.0, (GLdouble *) modelMatrix, (GLdouble *) projMatrix, aViewPort, &aWinCoord[0], &aWinCoord[1], &aWinCoord[2]); isWithinView = ! ( ( aWinCoord[0]<aViewPort[0]) || (aWinCoord[0]>aViewPort[2]) || (aWinCoord[1] < aViewPort[1]) || (aWinCoord[1]>aViewPort[3]) ); /// CHANGE ENDS HERE /// /// The following part of the function is not modified /// ..... }; | ||||
Tags | No tags attached. | ||||
Test case number | Not needed | ||||
|
Update of code for OCC 6.8.1 in attachement. I understand this cannot be added as is but this is what I did. |
|
OpenGl_Trihedron_patched.cxx (9,733 bytes) |
|
Dear Jerome, could you please specify if this issues is still present with current version of OCCT? There are no screenshots attached to the bug, so it is difficult to understand what kind of problem occurred and how it was fixed by specified workaround. |
|
Hi kgv, it is not a bug. It comes because changes have been made to the trihedron display. The problem is still here for 6.9.1 version because I had to patch the code. I did not installed the lastest OCC version but I suppose I will have to patch it again. Please find the attached screen copies: OCC_trihedron_1.png: the trihedron is displayed at the space origin OCC_trihedron_2.png: the view has been translated with the mouse on the right, the trihedron is still displayed at the space origin OCC_trihedron_3.png: the view has been translated more on the right and the trihedron goes outside of the view, in this case it becomes displayed at the bottom left I attached the patched code version for OCC 6.9.1. Let me know if it is not clear. Best regards. Jerome. |
|
OCC_trihedron_1.png (30,579 bytes) |
|
OCC_trihedron_2.png (31,451 bytes) |
|
OCC_trihedron_3.png (24,790 bytes) |
|
OpenGl_Trihedron_patched_6.9.1.cxx (3,688 bytes) |
|
As far as I understand you are referring to the trihedron behavior of very old OCCT releases (like 5.2.2) which has been changed since at least since OCCT 6.3.0, but disabled code has been kept till 6.5.4. Since current trihedron implementation does not provides possibility to remain at world origin - there is no bug with going outside the viewport (as described in bug description). But you find this old trihedron useful. |
|
Yes you are right. I use the following functions from my view: V3d_View->ZBufferTriedronSetup( ... ), V3d_View->TrihedronDisplay( ... ), V3d_View->TrihedronEcho( .. ) I do not know what you mean about disabled code ? |
|
> I do not know what you mean about disabled code ? The code quotation in description > isWithinView = ! ( ( aWinCoord[0]<aViewPort[0]) || (aWinCoord[0]>aViewPort[2]) || (aWinCoord[1] < aViewPort[1]) || (aWinCoord[1]>aViewPort[3]) ); defines isWithinView variable depending on the fact if origin (0,0,0) in world space is within viewport or outside. This code was *commented* (disabled) a long time ago (at least since OCCT 6.3.0) and completely removed since OCCT 6.5.4. Therefore, the trihedron is expected to be always displayed at view corner since OCCT 6.3.0, because this option was inactive (but can be activated by patching/uncommenting relative lines in OCCT source code). |
|
ok, clear. Thanks. |
|
Required functionality can be implementation on application level using existing tools - dedicated interactive object displaying trihedron, transformation persistence modes Graphic3d_TMF_ZoomPers (for trihedron bound to world origin) and Graphic3d_TMF_TriedronPers (trihedron displayed at view corner) and Projection routines to detect when world origin is within the viewport. So I don't think it is reasonable adding this feature into OCCT itself. |
|
Hi kgv, I am surprised because the change you propose is far complex to do than the one I proposed. I am not sure to be able to do it by myself. You only have some flags to add to the enum Aspect_TypeOfTriedronPosition and to adjust the OpenGl_Trihedron::redrawZBuffer() function accordingly and it is done ! Jerome. |
|
> the change you propose is far complex to do than the one I proposed This does not matter how simple to apply solution that have been in commented state, because related functionality and implementation (OpenGl_Trihedron) will not be available in OCCT 7.1.0 anyway. The proper implementation (to provide it within OCCT itself) should extend method Graphic3d_TransformPers::Apply() for handling new transformation persistence mode, which is quite possible, but has no priority. |
|
OK, I understand. Do you have any idea on how I will have to do that in 7.1.0? |
|
Something like this:class MyTrihedron : public V3d_Trihedron { public: MyTrihedron() {} void UpdatePosition (const Handle(V3d_View)& theView) { const gp_Pnt anOrigin = gp::Origin(); SetScale (0.1); Display (*theView); Graphic3d_Vec2i aPosOnScreen, aWinSize; theView->Convert (anOrigin.X(), anOrigin.Y(), anOrigin.Z(), aPosOnScreen.x(), aPosOnScreen.y()); theView->Window()->Size (aWinSize.x(), aWinSize.y()); const bool isOriginOnScreen = aPosOnScreen.x() >= 0 && aPosOnScreen.x() <= aWinSize.x() && aPosOnScreen.y() >= 0 && aPosOnScreen.y() <= aWinSize.y(); if (isOriginOnScreen) { myTransformPers = new Graphic3d_TransformPers (Graphic3d_TMF_ZoomPers, anOrigin); } else { myTransformPers = new Graphic3d_TransformPers (Graphic3d_TMF_TriedronPers, Aspect_TOTP_LEFT_LOWER); SetPosition (Aspect_TOTP_LEFT_LOWER); } if (!myStructure.IsNull()) { myStructure->SetTransformPersistence (myTransformPers); } } }; void appOnViewRedraw (const Handle(V3d_View)& theView) { static Handle(MyTrihedron) myTrihedron = new MyTrihedron(); myTrihedron->UpdatePosition (theView); theView->Redraw(); } |
|
ok, thanks. I will try that when I will move to OCC 7.1.0. You can close the ticket. Best regards. Jerome. |
|
Dear bugmaster, please close the issue. |
Date Modified | Username | Field | Change |
---|---|---|---|
2013-12-12 18:59 | Jerome Monaco | New Issue | |
2013-12-12 18:59 | Jerome Monaco | Assigned To | => san |
2013-12-13 09:36 |
|
Assigned To | san => duv |
2013-12-13 09:36 |
|
Status | new => assigned |
2013-12-13 09:37 |
|
Relationship added | related to 0024291 |
2013-12-13 09:41 |
|
Target Version | => 6.7.1 |
2014-04-04 18:32 |
|
Target Version | 6.7.1 => 6.8.0 |
2014-10-17 08:46 | kgv | Target Version | 6.8.0 => 7.1.0 |
2015-01-28 16:55 | Jerome Monaco | Note Added: 0036773 | |
2015-01-28 16:56 | Jerome Monaco | File Added: OpenGl_Trihedron_patched.cxx | |
2016-10-13 15:51 | kgv | Assigned To | duv => kgv |
2016-10-13 15:51 | kgv | Resolution | open => no change required |
2016-10-13 15:51 | kgv | Target Version | 7.1.0 => |
2016-10-13 15:56 | kgv | Note Added: 0058669 | |
2016-10-13 15:56 | kgv | Assigned To | kgv => Jerome Monaco |
2016-10-13 15:56 | kgv | Status | assigned => feedback |
2016-10-13 15:56 | kgv | Target Version | => 7.1.0 |
2016-10-13 15:56 | kgv | Note Edited: 0058669 | |
2016-10-13 15:57 | kgv | Resolution | no change required => unable to reproduce |
2016-10-13 16:36 | Jerome Monaco | Note Added: 0058676 | |
2016-10-13 16:36 | Jerome Monaco | File Added: OCC_trihedron_1.png | |
2016-10-13 16:36 | Jerome Monaco | File Added: OCC_trihedron_2.png | |
2016-10-13 16:36 | Jerome Monaco | File Added: OCC_trihedron_3.png | |
2016-10-13 16:41 | Jerome Monaco | File Added: OpenGl_Trihedron_patched_6.9.1.cxx | |
2016-10-13 16:42 | Jerome Monaco | Note Edited: 0058676 | |
2016-10-13 17:14 | kgv | Product Version | 6.6.0 => 6.5.4 |
2016-10-13 17:21 | kgv | Note Added: 0058684 | |
2016-10-13 17:23 | kgv | Note Edited: 0058684 | |
2016-10-13 18:49 | Jerome Monaco | Note Added: 0058687 | |
2016-10-13 18:49 | Jerome Monaco | Note Edited: 0058687 | |
2016-10-14 10:59 | kgv | Note Added: 0058713 | |
2016-10-14 11:00 | kgv | Note Edited: 0058713 | |
2016-10-14 11:00 | kgv | Note Edited: 0058713 | |
2016-10-14 11:00 | kgv | Note Edited: 0058713 | |
2016-10-14 13:01 | Jerome Monaco | Note Added: 0058715 | |
2016-10-14 18:46 | kgv | Note Added: 0058744 | |
2016-10-17 13:23 | Jerome Monaco | Note Added: 0058789 | |
2016-10-17 13:39 | kgv | Note Added: 0058790 | |
2016-10-17 14:55 | Jerome Monaco | Note Added: 0058797 | |
2016-11-09 10:50 | kgv | Target Version | 7.1.0 => Unscheduled |
2016-11-19 10:18 | kgv | Note Added: 0060570 | |
2016-12-12 16:52 | Jerome Monaco | Note Added: 0061584 | |
2016-12-12 16:56 | kgv | Note Added: 0061585 | |
2016-12-12 16:56 | kgv | Assigned To | Jerome Monaco => bugmaster |
2016-12-12 16:56 | kgv | Resolution | unable to reproduce => no change required |
2016-12-12 16:56 | kgv | Target Version | Unscheduled => 7.2.0 |
2016-12-15 17:14 | apn | Test case number | => Not needed |
2016-12-15 17:14 | apn | Status | feedback => closed |