My favorites | Sign in
Project Home Downloads Source
Checkout   Browse   Changes    
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#include "CascadeDocument.h"

/////////////////////////////////////////////////////////////////////////////////////////
// Static members initialization
#ifdef WIN32
Handle(Graphic3d_WNTGraphicDevice) CascadeDocument::GraphicDevice = 0;
#else
Handle(Graphic3d_GraphicDevice) CascadeDocument::GraphicDevice = 0;
#endif
int CascadeDocument::Instances = 0;


/////////////////////////////////////////////////////////////////////////////////////////
// Constructor
CascadeDocument::CascadeDocument()
{
// CREATES THE GRAPHIC DEVICE
if( GraphicDevice.IsNull() )
#ifdef WIN32
GraphicDevice = new Graphic3d_WNTGraphicDevice();
#else
// GraphicDevice = new Graphic3d_GraphicDevice(getenv("DISPLAY"));
GraphicDevice = new Graphic3d_GraphicDevice(getenv(""));
#endif

// CREATES THE VIEWER
TCollection_ExtendedString a3DName("Visu3D");
Viewer = new V3d_Viewer(
GraphicDevice, // the graphic device
a3DName.ToExtString(), // view name
"", // domain (?)
1000.0, // view size
V3d_XposYnegZpos, // View projection
Quantity_NOC_GRAY30,
V3d_ZBUFFER,
V3d_GOURAUD,
V3d_WAIT,
Standard_True, // Computed mode (?)
Standard_True, // Default Computed mode (?)
V3d_TEX_NONE // (?)
);

// INITIALIZES THE VIEWER
Viewer->Init();
Viewer->SetDefaultLights();
Viewer->SetLightOn();

// CREATES THE INTERACTIVE CONTEXT
Context = new AIS_InteractiveContext(Viewer);
// onCreateNewView();

// COUNTS THE INSTANCES OF CascadeCtrl
// THAT'S USED TO FREE GraphicDevice ON LAST CascadeCtrl DELETION
Instances++;


} // END Constructor class CascadeDocument

/////////////////////////////////////////////////////////////////////////////////////////
// Destructor
CascadeDocument::~CascadeDocument()
{
// FREES THE CONTEXT
Context.Nullify();

// FREES THE VIEWER
Viewer.Nullify();

// DECREMENT INSTANCE COUNTER, IF NULL FREES GraphicDevice
//ASSERT(Instances > 0);
if(!--Instances)
{
GraphicDevice.Nullify();
}

} // END Destructor class CascadeDocument

Change log

r4424 by micio on Jan 15, 2012   Diff
Bazaar/OCE : OpenCascade Community Edition
3d modeling kernel added
Go to: 
Project members, sign in to write a code review

Older revisions

All revisions of this file

File info

Size: 2038 bytes, 76 lines

File properties

svn:executable
*
Powered by Google Project Hosting