b311480e |
1 | // Created on: 2008-04-17 |
2 | // Created by: Customer Support |
973c2be1 |
3 | // Copyright (c) 2008-2014 OPEN CASCADE SAS |
b311480e |
4 | // |
973c2be1 |
5 | // This file is part of Open CASCADE Technology software library. |
b311480e |
6 | // |
d5f74e42 |
7 | // This library is free software; you can redistribute it and/or modify it under |
8 | // the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
9 | // by the Free Software Foundation, with special exception defined in the file |
10 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
11 | // distribution for complete text of the license and disclaimer of any warranty. |
b311480e |
12 | // |
973c2be1 |
13 | // Alternatively, this file may be used under the terms of Open CASCADE |
14 | // commercial license or contractual agreement. |
7fd59977 |
15 | |
7fd59977 |
16 | |
17 | #include <Aspect_Window.hxx> |
aff395a3 |
18 | #include <Font_NameOfFont.hxx> |
42cf5bc1 |
19 | #include <Standard_Type.hxx> |
42cf5bc1 |
20 | #include <V3d_LayerMgr.hxx> |
21 | #include <V3d_View.hxx> |
22 | #include <Visual3d_Layer.hxx> |
23 | #include <Visual3d_View.hxx> |
7fd59977 |
24 | |
25 | V3d_LayerMgr::V3d_LayerMgr( const Handle(V3d_View)& AView ) |
26 | : myView(AView.operator->()) |
27 | { |
28 | Handle(Visual3d_View) theView = View()->View(); |
29 | if ( !theView.IsNull() ) { |
30 | Handle(Visual3d_ViewManager) theViewMgr = theView->ViewManager(); |
31 | if ( !theViewMgr.IsNull() ) { |
32 | V3d_LayerMgr* that = (V3d_LayerMgr*)this; |
33 | that->myOverlay = new Visual3d_Layer( theViewMgr, Aspect_TOL_OVERLAY, Standard_False ); |
34 | } |
35 | } |
36 | } |
37 | |
38 | void V3d_LayerMgr::Compute() |
39 | { |
40 | if (Begin()) |
41 | { |
42 | Redraw(); |
43 | End(); |
44 | } |
45 | } |
46 | |
47 | void V3d_LayerMgr::Resized() |
48 | { |
49 | Compute(); |
50 | } |
51 | |
7fd59977 |
52 | Standard_Boolean V3d_LayerMgr::Begin() |
53 | { |
54 | if ( myOverlay.IsNull() ) |
55 | return Standard_False; |
56 | |
57 | const Handle(Aspect_Window) &theWin = View()->Window(); |
58 | if ( theWin.IsNull() ) |
59 | return Standard_False; |
60 | |
61 | Standard_Integer aW( 0 ), aH( 0 ); |
62 | theWin->Size( aW, aH ); |
63 | |
64 | myOverlay->Clear(); |
65 | myOverlay->SetViewport( aW, aH ); //szv:!!! |
66 | myOverlay->Begin(); |
aff395a3 |
67 | myOverlay->SetTextAttributes( Font_NOF_ASCII_MONO, Aspect_TODT_NORMAL, Quantity_Color() ); |
7fd59977 |
68 | myOverlay->SetOrtho( 0, Max( aW, aH ), Max( aW, aH ), 0, Aspect_TOC_TOP_LEFT ); |
69 | |
70 | return Standard_True; |
71 | } |
72 | |
73 | void V3d_LayerMgr::Redraw() |
74 | { |
75 | |
76 | } |
77 | |
78 | void V3d_LayerMgr::End() |
79 | { |
80 | if ( !myOverlay.IsNull() ) |
81 | myOverlay->End(); |
82 | } |