source: src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject.hpp@ 2b596f

Action_Thermostats Add_AtomRandomPerturbation Add_FitFragmentPartialChargesAction Add_RotateAroundBondAction Add_SelectAtomByNameAction Added_ParseSaveFragmentResults AddingActions_SaveParseParticleParameters Adding_Graph_to_ChangeBondActions Adding_MD_integration_tests Adding_ParticleName_to_Atom Adding_StructOpt_integration_tests AtomFragments Automaking_mpqc_open AutomationFragmentation_failures Candidate_v1.5.4 Candidate_v1.6.0 Candidate_v1.6.1 ChangeBugEmailaddress ChangingTestPorts ChemicalSpaceEvaluator CombiningParticlePotentialParsing Combining_Subpackages Debian_Package_split Debian_package_split_molecuildergui_only Disabling_MemDebug Docu_Python_wait EmpiricalPotential_contain_HomologyGraph EmpiricalPotential_contain_HomologyGraph_documentation Enable_parallel_make_install Enhance_userguide Enhanced_StructuralOptimization Enhanced_StructuralOptimization_continued Example_ManyWaysToTranslateAtom Exclude_Hydrogens_annealWithBondGraph FitPartialCharges_GlobalError Fix_BoundInBox_CenterInBox_MoleculeActions Fix_ChargeSampling_PBC Fix_ChronosMutex Fix_FitPartialCharges Fix_FitPotential_needs_atomicnumbers Fix_ForceAnnealing Fix_IndependentFragmentGrids Fix_ParseParticles Fix_ParseParticles_split_forward_backward_Actions Fix_PopActions Fix_QtFragmentList_sorted_selection Fix_Restrictedkeyset_FragmentMolecule Fix_StatusMsg Fix_StepWorldTime_single_argument Fix_Verbose_Codepatterns Fix_fitting_potentials Fixes ForceAnnealing_goodresults ForceAnnealing_oldresults ForceAnnealing_tocheck ForceAnnealing_with_BondGraph ForceAnnealing_with_BondGraph_continued ForceAnnealing_with_BondGraph_continued_betteresults ForceAnnealing_with_BondGraph_contraction-expansion FragmentAction_writes_AtomFragments FragmentMolecule_checks_bonddegrees GeometryObjects Gui_Fixes Gui_displays_atomic_force_velocity ImplicitCharges IndependentFragmentGrids IndependentFragmentGrids_IndividualZeroInstances IndependentFragmentGrids_IntegrationTest IndependentFragmentGrids_Sole_NN_Calculation JobMarket_RobustOnKillsSegFaults JobMarket_StableWorkerPool JobMarket_unresolvable_hostname_fix MoreRobust_FragmentAutomation ODR_violation_mpqc_open PartialCharges_OrthogonalSummation PdbParser_setsAtomName PythonUI_with_named_parameters QtGui_reactivate_TimeChanged_changes Recreated_GuiChecks Rewrite_FitPartialCharges RotateToPrincipalAxisSystem_UndoRedo SaturateAtoms_findBestMatching SaturateAtoms_singleDegree StoppableMakroAction Subpackage_CodePatterns Subpackage_JobMarket Subpackage_LinearAlgebra Subpackage_levmar Subpackage_mpqc_open Subpackage_vmg Switchable_LogView ThirdParty_MPQC_rebuilt_buildsystem TrajectoryDependenant_MaxOrder TremoloParser_IncreasedPrecision TremoloParser_MultipleTimesteps TremoloParser_setsAtomName Ubuntu_1604_changes stable
Last change on this file since 2b596f was 34e7fdb, checked in by Frederik Heber <heber@…>, 10 years ago

GLMoleculeObject_molecule display tesselated surface in m_visible case.

  • set TesselationHull radius to 2., independent of mol's bounding sphere.
  • added bool to indicate when subjectKilled() had been called.
  • Property mode set to 100644
File size: 3.7 KB
Line 
1/*
2 * GLMoleculeObject.hpp
3 *
4 * This is based on the Qt3D example "teaservice", specifically meshobject.h.
5 *
6 * Created on: Aug 17, 2011
7 * Author: heber
8 */
9
10#ifndef GLMOLECULEOBJECT_HPP_
11#define GLMOLECULEOBJECT_HPP_
12
13// include config.h
14#ifdef HAVE_CONFIG_H
15#include <config.h>
16#endif
17
18
19#include <QtCore/qobject.h>
20#include <QtGui/qevent.h>
21
22#include <Qt3D/qglpainter.h>
23#include <Qt3D/qglabstractscene.h>
24
25class QGLView;
26class QGLSceneNode;
27class GLMoleculeScene;
28
29/** This class represents a single object within a molecule, e.g. atom or bond.
30 *
31 */
32class GLMoleculeObject : public QObject
33{
34 Q_OBJECT
35
36 //!> Allow it to call cleanMaterialMap()
37 friend class GLWorldScene;
38public:
39 explicit GLMoleculeObject(QGLSceneNode *mesh[], QObject *parent=0);
40 explicit GLMoleculeObject(QGLSceneNode *mesh, QObject *parent=0);
41 explicit GLMoleculeObject(QGLAbstractScene *scene, QObject *parent=0);
42 virtual ~GLMoleculeObject();
43
44 QVector3D position() const { return m_position; }
45 void setPosition(const QVector3D& value) { m_position = value; }
46
47 void setScale(qreal value) { m_scaleX = m_scaleY = m_scaleZ = value; }
48
49 qreal scaleX() const { return m_scaleX; }
50 void setScaleX(qreal value) { m_scaleX = value; }
51
52 qreal scaleY() const { return m_scaleY; }
53 void setScaleY(qreal value) { m_scaleY = value; }
54
55 qreal scaleZ() const { return m_scaleZ; }
56 void setScaleZ(qreal value) { m_scaleZ = value; }
57
58 qreal rotationAngle() const { return m_rotationAngle; }
59 void setRotationAngle(qreal value) { m_rotationAngle = value; }
60
61 QVector3D rotationVector() const { return m_rotationVector; }
62 void setRotationVector(const QVector3D& value) { m_rotationVector = value; }
63
64 QGLMaterial *material() const { return m_material; }
65 void setMaterial(QGLMaterial *value) { m_material = value; }
66
67 QGLAbstractEffect *effect() const { return m_effect; }
68 void setEffect(QGLAbstractEffect *value) { m_effect = value; }
69
70 int objectId() const { return m_objectId; }
71 void setObjectId(int id) { m_objectId = id; }
72
73 bool selected() const { return m_selected; }
74 void setSelected(bool value);
75
76 bool visible() const { return m_visible; }
77 virtual void setVisible(bool value);
78
79 void initStaticMaterials();
80 virtual void initialize(QGLView *view, QGLPainter *painter);
81 virtual void draw(QGLPainter *painter, const QVector4D &cameraPlane);
82 void drawSelectionBox(QGLPainter *painter);
83
84signals:
85 void pressed();
86 void released();
87 void clicked();
88 void doubleClicked();
89 void hoverChanged(GLMoleculeObject *ob);
90 void selectionChanged();
91 void changed();
92
93protected:
94 bool event(QEvent *e);
95
96 static QGLMaterial* getMaterial(size_t);
97 static void cleanMaterialMap();
98
99 void updateMesh(QGLSceneNode *scene);
100
101 typedef std::map< size_t, QGLMaterial *> ElementMaterialMap;
102 static ElementMaterialMap ElementNoMaterialMap;
103
104public:
105 enum{DETAIL_HIGHEST, DETAIL_HIGH, DETAIL_MEDIUM, DETAIL_LOW, DETAILTYPES_MAX} DetailType;
106
107 static QGLSceneNode *meshEmpty[DETAILTYPES_MAX];
108 static QGLSceneNode *meshSphere[DETAILTYPES_MAX];
109 static QGLSceneNode *meshCylinder[DETAILTYPES_MAX];
110
111protected:
112
113 static double detailMinDistance[DETAILTYPES_MAX];
114
115 QGLSceneNode *m_mesh[DETAILTYPES_MAX];
116 QGLAbstractScene *m_scene;
117 QVector3D m_position;
118 qreal m_scaleX;
119 qreal m_scaleY;
120 qreal m_scaleZ;
121 qreal m_rotationAngle;
122 QVector3D m_rotationVector;
123 QGLMaterial *m_material;
124 static QGLMaterial *m_hoverMaterial;
125 static QGLMaterial *m_selectionMaterial;
126 static QGLMaterial *m_selectionBoxMaterial;
127 QGLAbstractEffect *m_effect;
128 int m_objectId;
129 bool m_hovering;
130 bool m_selected;
131 bool m_visible;
132};
133
134
135#endif /* GLMOLECULEOBJECT_HPP_ */
Note: See TracBrowser for help on using the repository browser.