blob: 92cf21ce4efa78de3a6180c7668bfc7b51346c1d (
plain)
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
|
// Copyright 2008 Nanorex, Inc. See LICENSE file for details.
#include "StructureGraphicsWindow.h"
/* CONSTRUCTOR */
StructureGraphicsWindow::
StructureGraphicsWindow(QWidget *parent,
NXGraphicsManager *theGraphicsManager,
int width, int height)
: DataWindow(parent),
graphicsManager(theGraphicsManager),
molSetPtr(NULL),
renderingEngine(NULL)
{
renderingEngine = graphicsManager->newGraphicsInstance(this);
QWidget *renderingEngineWidget = renderingEngine->asQWidget();
QLayout *thisWidgetLayout = layout();
if(thisWidgetLayout == (QLayout*) 0) {
thisWidgetLayout = new QHBoxLayout(this);
thisWidgetLayout->setSpacing(0);
}
thisWidgetLayout->addWidget(renderingEngineWidget);
resize(width, height);
update();
}
/* DESTRUCTOR */
StructureGraphicsWindow::~StructureGraphicsWindow()
{
if(renderingEngine != (NXRenderingEngine*) NULL)
delete renderingEngine;
renderingEngine = NULL;
}
NXCommandResult const *const
StructureGraphicsWindow::setMoleculeSet(NXMoleculeSet *theMolSetPtr)
{
assert(renderingEngine->getFrameCount() == 0);
NXCommandResult const *const result =
renderingEngine->addFrame(theMolSetPtr);
if(result->getResult() == (int) NX_CMD_SUCCESS) {
molSetPtr = theMolSetPtr;
renderingEngine->setCurrentFrame(0);
// renderingEngine->resetView();
}
return result;
}
|