1 /**********************************************************************
2 SphereEngine - Engine for "spheres" display
4 Copyright (C) 2006-2007 Geoffrey R. Hutchison
5 Copyright (C) 2007 Benoit Jacob
6 Copyright (C) 2007 Marcus D. Hanwell
8 This file is part of the Avogadro molecular editor project.
9 For more information, see <http://avogadro.sourceforge.net/>
11 Avogadro is free software; you can redistribute it and/or modify
12 it under the terms of the GNU General Public License as published by
13 the Free Software Foundation; either version 2 of the License, or
14 (at your option) any later version.
16 Avogadro is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with this program; if not, write to the Free Software
23 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
25 **********************************************************************/
27 #ifndef __SPHEREENGINE_H
28 #define __SPHEREENGINE_H
30 #include <avogadro/global.h>
31 #include <avogadro/engine.h>
34 #include "ui_spheresettingswidget.h"
38 //! Sphere Engine class.
39 class SphereSettingsWidget
;
40 class SphereEngine
: public Engine
43 AVOGADRO_ENGINE(tr("Van der Waals Spheres"))
47 SphereEngine(QObject
*parent
=0);
52 Engine
*clone() const;
54 //! \name Render Methods
56 bool renderOpaque(PainterDevice
*pd
);
57 bool renderTransparent(PainterDevice
*pd
);
59 bool render(PainterDevice
*pd
, const Atom
*a
);
62 double transparencyDepth() const;
63 EngineFlags
flags() const;
65 double radius(const PainterDevice
*pd
, const Primitive
*p
= 0) const;
67 QWidget
* settingsWidget();
69 * Write the engine settings so that they can be saved between sessions.
71 void writeSettings(QSettings
&settings
) const;
74 * Read in the settings that have been saved for the engine instance.
76 void readSettings(QSettings
&settings
);
79 inline double radius(const Atom
*a
) const;
81 SphereSettingsWidget
*m_settingsWidget
;
83 double m_alpha
; // transparency of the VdW spheres
86 void settingsWidgetDestroyed();
90 * @param value opacity of the VdW spheres / 20
92 void setOpacity(int value
);
96 class SphereSettingsWidget
: public QWidget
, public Ui::SphereSettingsWidget
99 SphereSettingsWidget(QWidget
*parent
=0) : QWidget(parent
) {
104 //! Generates instances of our SphereEngine class
105 class SphereEngineFactory
: public QObject
, public EngineFactory
108 Q_INTERFACES(Avogadro::EngineFactory
)
109 AVOGADRO_ENGINE_FACTORY(SphereEngine
)
112 } // end namespace Avogadro