1 | /*
|
---|
2 | * Project: MoleCuilder
|
---|
3 | * Description: creates and alters molecular systems
|
---|
4 | * Copyright (C) 2010-2012 University of Bonn. All rights reserved.
|
---|
5 | * Copyright (C) 2013 Frederik Heber. All rights reserved.
|
---|
6 | *
|
---|
7 | *
|
---|
8 | * This file is part of MoleCuilder.
|
---|
9 | *
|
---|
10 | * MoleCuilder is free software: you can redistribute it and/or modify
|
---|
11 | * it under the terms of the GNU General Public License as published by
|
---|
12 | * the Free Software Foundation, either version 2 of the License, or
|
---|
13 | * (at your option) any later version.
|
---|
14 | *
|
---|
15 | * MoleCuilder is distributed in the hope that it will be useful,
|
---|
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
18 | * GNU General Public License for more details.
|
---|
19 | *
|
---|
20 | * You should have received a copy of the GNU General Public License
|
---|
21 | * along with MoleCuilder. If not, see <http://www.gnu.org/licenses/>.
|
---|
22 | */
|
---|
23 |
|
---|
24 | /*
|
---|
25 | * GLWorldScene.cpp
|
---|
26 | *
|
---|
27 | * This is based on the Qt3D example "teaservice", specifically parts of teaservice.cpp.
|
---|
28 | *
|
---|
29 | * Created on: Aug 17, 2011
|
---|
30 | * Author: heber
|
---|
31 | */
|
---|
32 |
|
---|
33 | // include config.h
|
---|
34 | #ifdef HAVE_CONFIG_H
|
---|
35 | #include <config.h>
|
---|
36 | #endif
|
---|
37 |
|
---|
38 | #include "GLWorldScene.hpp"
|
---|
39 | #include <Qt3D/qglview.h>
|
---|
40 | #include <Qt3D/qglbuilder.h>
|
---|
41 | #include <Qt3D/qglscenenode.h>
|
---|
42 | #include <Qt3D/qglsphere.h>
|
---|
43 | #include <Qt3D/qglcylinder.h>
|
---|
44 |
|
---|
45 | #include "UIElements/Views/Qt4/Qt3D/GLMoleculeObject.hpp"
|
---|
46 | #include "UIElements/Views/Qt4/Qt3D/GLMoleculeObject_atom.hpp"
|
---|
47 | #include "UIElements/Views/Qt4/Qt3D/GLMoleculeObject_bond.hpp"
|
---|
48 | #include "UIElements/Views/Qt4/Qt3D/GLMoleculeObject_molecule.hpp"
|
---|
49 | #include "UIElements/Views/Qt4/Qt3D/GLMoleculeObject_shape.hpp"
|
---|
50 |
|
---|
51 | #include "UIElements/Qt4/InstanceBoard/QtObservedInstanceBoard.hpp"
|
---|
52 |
|
---|
53 | #include "CodePatterns/MemDebug.hpp"
|
---|
54 |
|
---|
55 | #include "CodePatterns/Log.hpp"
|
---|
56 |
|
---|
57 | #include <boost/assign.hpp>
|
---|
58 |
|
---|
59 | #include "Actions/SelectionAction/Atoms/AtomByIdAction.hpp"
|
---|
60 | #include "Actions/SelectionAction/Atoms/NotAtomByIdAction.hpp"
|
---|
61 | #include "Actions/SelectionAction/Molecules/MoleculeByIdAction.hpp"
|
---|
62 | #include "Actions/SelectionAction/Molecules/NotMoleculeByIdAction.hpp"
|
---|
63 | #include "Atom/atom.hpp"
|
---|
64 | #include "Bond/bond.hpp"
|
---|
65 | #include "Descriptors/AtomIdDescriptor.hpp"
|
---|
66 | #include "Descriptors/MoleculeIdDescriptor.hpp"
|
---|
67 | #include "Helpers/helpers.hpp"
|
---|
68 | #include "Shapes/ShapeRegistry.hpp"
|
---|
69 | #include "molecule.hpp"
|
---|
70 | #include "World.hpp"
|
---|
71 |
|
---|
72 | #include <iostream>
|
---|
73 |
|
---|
74 | using namespace MoleCuilder;
|
---|
75 |
|
---|
76 | GLWorldScene::GLWorldScene(
|
---|
77 | QtObservedInstanceBoard * _board,
|
---|
78 | QObject *parent) :
|
---|
79 | QObject(parent),
|
---|
80 | selectionMode(SelectAtom),
|
---|
81 | board(_board)
|
---|
82 | {
|
---|
83 | qRegisterMetaType<atomId_t>("atomId_t");
|
---|
84 | qRegisterMetaType<GLMoleculeObject_bond::SideOfBond>("GLMoleculeObject_bond::SideOfBond");
|
---|
85 |
|
---|
86 | int sphereDetails[] = {5, 3, 2, 0};
|
---|
87 | int cylinderDetails[] = {16, 8, 6, 3};
|
---|
88 | for (int i=0;i<GLMoleculeObject::DETAILTYPES_MAX;i++){
|
---|
89 | QGLBuilder emptyBuilder;
|
---|
90 | GLMoleculeObject::meshEmpty[i] = emptyBuilder.finalizedSceneNode();
|
---|
91 | QGLBuilder sphereBuilder;
|
---|
92 | sphereBuilder << QGLSphere(2.0, sphereDetails[i]);
|
---|
93 | GLMoleculeObject::meshSphere[i] = sphereBuilder.finalizedSceneNode();
|
---|
94 | GLMoleculeObject::meshSphere[i]->setOption(QGLSceneNode::CullBoundingBox, true);
|
---|
95 | QGLBuilder cylinderBuilder;
|
---|
96 | cylinderBuilder << QGLCylinder(.25,.25,1.0,cylinderDetails[i]);
|
---|
97 | GLMoleculeObject::meshCylinder[i] = cylinderBuilder.finalizedSceneNode();
|
---|
98 | GLMoleculeObject::meshCylinder[i]->setOption(QGLSceneNode::CullBoundingBox, true);
|
---|
99 | }
|
---|
100 | connect(board, SIGNAL(moleculeInserted(QtObservedMolecule::ptr)),
|
---|
101 | this, SLOT(moleculeInserted(QtObservedMolecule::ptr)));
|
---|
102 | connect(board, SIGNAL(moleculeRemoved(ObservedValue_Index_t)),
|
---|
103 | this, SLOT(moleculeRemoved(ObservedValue_Index_t)));
|
---|
104 | connect(board, SIGNAL(atomInserted(QtObservedAtom::ptr)),
|
---|
105 | this, SLOT(atomInserted(QtObservedAtom::ptr)));
|
---|
106 | connect(board, SIGNAL(atomRemoved(ObservedValue_Index_t)),
|
---|
107 | this, SLOT(atomRemoved(ObservedValue_Index_t)));
|
---|
108 | connect(board, SIGNAL(bondInserted(QtObservedBond::ptr)),
|
---|
109 | this, SLOT(bondInserted(QtObservedBond::ptr)));
|
---|
110 | connect(board, SIGNAL(bondRemoved(ObservedValue_Index_t)),
|
---|
111 | this, SLOT(bondRemoved(ObservedValue_Index_t)));
|
---|
112 |
|
---|
113 | // connect(this, SIGNAL(updated()), this, SLOT(update()));
|
---|
114 | }
|
---|
115 |
|
---|
116 | GLWorldScene::~GLWorldScene()
|
---|
117 | {
|
---|
118 | // remove all elements
|
---|
119 | GLMoleculeObject::cleanMaterialMap();
|
---|
120 | }
|
---|
121 |
|
---|
122 | void GLWorldScene::atomClicked(atomId_t no)
|
---|
123 | {
|
---|
124 | LOG(3, "INFO: GLMoleculeObject_molecule - atom " << no << " has been clicked.");
|
---|
125 | const atom * const Walker = const_cast<const World &>(World::getInstance()).
|
---|
126 | getAtom(AtomById(no));
|
---|
127 | ASSERT( Walker != NULL,
|
---|
128 | "GLWorldScene::atomClicked() - clicked atom has disappeared.");
|
---|
129 | if (selectionMode == SelectAtom){
|
---|
130 | if (!World::getInstance().isSelected(Walker))
|
---|
131 | SelectionAtomById(std::vector<atomId_t>(1,no));
|
---|
132 | else
|
---|
133 | SelectionNotAtomById(std::vector<atomId_t>(1,no));
|
---|
134 | }else if (selectionMode == SelectMolecule){
|
---|
135 | const molecule *mol = Walker->getMolecule();
|
---|
136 | ASSERT(mol, "Atom without molecule has been clicked.");
|
---|
137 | molids_t ids(1, mol->getId());
|
---|
138 | if (!World::getInstance().isSelected(mol))
|
---|
139 | SelectionMoleculeById(ids);
|
---|
140 | else
|
---|
141 | SelectionNotMoleculeById(ids);
|
---|
142 | }
|
---|
143 | emit clicked(no);
|
---|
144 | }
|
---|
145 |
|
---|
146 | /** Adds an atom to the scene.
|
---|
147 | *
|
---|
148 | * @param _atom atom to add
|
---|
149 | */
|
---|
150 | void GLWorldScene::atomInserted(QtObservedAtom::ptr _atom)
|
---|
151 | {
|
---|
152 | LOG(3, "INFO: GLWorldScene: Received signal atomInserted for atom "
|
---|
153 | << _atom->getAtomIndex());
|
---|
154 |
|
---|
155 | GLMoleculeObject_atom *atomObject =
|
---|
156 | new GLMoleculeObject_atom(
|
---|
157 | GLMoleculeObject::meshSphere,
|
---|
158 | this, /* parent is GLWorldScene */
|
---|
159 | _atom);
|
---|
160 | ASSERT( atomObject != NULL,
|
---|
161 | "GLWorldScene::atomInserted - could not create atom object for "
|
---|
162 | +toString(_atom->getAtomIndex()));
|
---|
163 | const ObservedValue_Index_t atomid = _atom->getIndex();
|
---|
164 | AtomNodeMap::iterator iter = AtomsinSceneMap.find(atomid);
|
---|
165 | ASSERT(iter == AtomsinSceneMap.end(),
|
---|
166 | "GLWorldScene::atomInserted - same atom with id "
|
---|
167 | +toString(_atom->getAtomIndex())+" added again.");
|
---|
168 | AtomsinSceneMap.insert( make_pair(atomid, atomObject) );
|
---|
169 |
|
---|
170 | connect (atomObject, SIGNAL(clicked(atomId_t)), this, SLOT(atomClicked(atomId_t)));
|
---|
171 | connect (atomObject, SIGNAL(changed()), this, SIGNAL(changed()));
|
---|
172 | connect (atomObject, SIGNAL(hoverChanged(GLMoleculeObject *)), this, SIGNAL(changed()));
|
---|
173 | connect (atomObject, SIGNAL(hoverChanged(GLMoleculeObject *)), this, SLOT(hoverChangedSignalled(GLMoleculeObject *)));
|
---|
174 |
|
---|
175 | emit changed();
|
---|
176 | emit changeOccured();
|
---|
177 | }
|
---|
178 |
|
---|
179 | /** Removes an atom.
|
---|
180 | *
|
---|
181 | * @param _atomid index of the atom that is removed
|
---|
182 | */
|
---|
183 | void GLWorldScene::atomRemoved(ObservedValue_Index_t _atomid)
|
---|
184 | {
|
---|
185 | LOG(3, "INFO: GLWorldScene: Received signal atomRemoved for atom "+toString(_atomid)+".");
|
---|
186 | // bonds are removed by signal coming from ~bond
|
---|
187 |
|
---|
188 | // remove atoms
|
---|
189 | AtomNodeMap::iterator iter = AtomsinSceneMap.find(_atomid);
|
---|
190 | ASSERT(iter != AtomsinSceneMap.end(),
|
---|
191 | "GLWorldScene::atomRemoved() - atom "+toString(_atomid)+" not on display.");
|
---|
192 | GLMoleculeObject_atom *atomObject = iter->second;
|
---|
193 | AtomsinSceneMap.erase(iter);
|
---|
194 | delete atomObject;
|
---|
195 |
|
---|
196 | emit changed();
|
---|
197 | emit changeOccured();
|
---|
198 | }
|
---|
199 |
|
---|
200 | /** Adds a bond to the scene.
|
---|
201 | *
|
---|
202 | * @param _bond bond to add
|
---|
203 | */
|
---|
204 | void GLWorldScene::bondInserted(QtObservedBond::ptr _bond)
|
---|
205 | {
|
---|
206 | static const std::vector< GLMoleculeObject_bond::SideOfBond > bondsides =
|
---|
207 | boost::assign::list_of<GLMoleculeObject_bond::SideOfBond>
|
---|
208 | (GLMoleculeObject_bond::left)
|
---|
209 | (GLMoleculeObject_bond::right);
|
---|
210 | LOG(3, "INFO: GLWorldScene::bondInserted() - Adding bonds " << _bond->getBondIndex());
|
---|
211 | //LOG(4, "INFO: Currently present bonds " << BondsinSceneMap << ".");
|
---|
212 |
|
---|
213 | const ObservedValue_Index_t bondid = _bond->getIndex();
|
---|
214 | BondNodeMap::iterator iter = BondsinSceneMap.find(bondid);
|
---|
215 | ASSERT( iter == BondsinSceneMap.end(),
|
---|
216 | "GLWorldScene::bondInserted() - bond "+toString(bondid)+" is already known.");
|
---|
217 | for (size_t i=0;i<2;++i) {
|
---|
218 | GLMoleculeObject_bond * bondObject =
|
---|
219 | new GLMoleculeObject_bond(GLMoleculeObject::meshCylinder, this, _bond, bondsides[i]);
|
---|
220 | connect (bondObject, SIGNAL(changed()), this, SIGNAL(changed()));
|
---|
221 | BondsinSceneMap.insert( std::make_pair(bondid, bondObject) );
|
---|
222 | }
|
---|
223 |
|
---|
224 | emit changed();
|
---|
225 | emit changeOccured();
|
---|
226 | }
|
---|
227 |
|
---|
228 | /** Removes a bond.
|
---|
229 | *
|
---|
230 | * @param _bondid id of bond to remove
|
---|
231 | */
|
---|
232 | void GLWorldScene::bondRemoved(ObservedValue_Index_t _bondid)
|
---|
233 | {
|
---|
234 | LOG(3, "INFO: GLWorldScene::bondRemoved() - Removing bond to id " << _bondid);
|
---|
235 |
|
---|
236 | // left bond
|
---|
237 | BondNodeMap::iterator iter = BondsinSceneMap.find(_bondid);
|
---|
238 | ASSERT( iter != BondsinSceneMap.end(),
|
---|
239 | "GLWorldScene::bondRemoved() - could not find bond to id "+toString(_bondid));
|
---|
240 | GLMoleculeObject_bond *bondObject = iter->second;
|
---|
241 | delete bondObject; // is done by signal from bond itself
|
---|
242 | //LOG(4, "INFO: Still present bonds " << BondsinSceneMap << ".");
|
---|
243 | BondsinSceneMap.erase(iter);
|
---|
244 |
|
---|
245 | emit changed();
|
---|
246 | emit changeOccured();
|
---|
247 | }
|
---|
248 |
|
---|
249 | void GLWorldScene::hoverChangedSignalled(GLMoleculeObject *ob)
|
---|
250 | {
|
---|
251 | // Find the atom, ob corresponds to.
|
---|
252 | hoverAtomId = -1;
|
---|
253 | GLMoleculeObject_atom *atomObject = dynamic_cast<GLMoleculeObject_atom *>(ob);
|
---|
254 | if (atomObject){
|
---|
255 | for (AtomNodeMap::iterator iter = AtomsinSceneMap.begin();iter != AtomsinSceneMap.end(); ++ iter){
|
---|
256 | if (iter->second == atomObject)
|
---|
257 | hoverAtomId = iter->second->objectId();
|
---|
258 | }
|
---|
259 |
|
---|
260 | // Propagate signal.
|
---|
261 | emit hoverChanged(hoverAtomId);
|
---|
262 | } else {
|
---|
263 | // Find the atom, ob corresponds to.
|
---|
264 | GLMoleculeObject_molecule *moleculeObject = dynamic_cast<GLMoleculeObject_molecule *>(ob);
|
---|
265 | if (moleculeObject){
|
---|
266 | // Propagate signal.
|
---|
267 | emit hoverChanged(moleculeObject->objectId(), 0);
|
---|
268 | }
|
---|
269 | }
|
---|
270 | }
|
---|
271 |
|
---|
272 | void GLWorldScene::moleculeClicked(moleculeId_t no)
|
---|
273 | {
|
---|
274 | LOG(3, "INFO: GLMoleculeObject_molecule - mol " << no << " has been clicked.");
|
---|
275 | const molecule * const mol= const_cast<const World &>(World::getInstance()).
|
---|
276 | getMolecule(MoleculeById(no));
|
---|
277 | ASSERT(mol, "Atom without molecule has been clicked.");
|
---|
278 | molids_t ids(1, mol->getId());
|
---|
279 | if (!World::getInstance().isSelected(mol))
|
---|
280 | SelectionMoleculeById(ids);
|
---|
281 | else
|
---|
282 | SelectionNotMoleculeById(ids);
|
---|
283 | emit clicked(no);
|
---|
284 | }
|
---|
285 |
|
---|
286 | /** Inserts a molecule into the scene.
|
---|
287 | *
|
---|
288 | * @param _mol molecule to insert
|
---|
289 | */
|
---|
290 | void GLWorldScene::moleculeInserted(QtObservedMolecule::ptr _mol)
|
---|
291 | {
|
---|
292 | const ObservedValue_Index_t molid = _mol->getIndex();
|
---|
293 | LOG(3, "INFO: GLWorldScene: Received signal moleculeInserted for molecule "
|
---|
294 | << _mol->getMolIndex());
|
---|
295 |
|
---|
296 | MoleculeNodeMap::const_iterator iter = MoleculesinSceneMap.find(molid);
|
---|
297 | ASSERT( iter == MoleculesinSceneMap.end(),
|
---|
298 | "GLWorldScene::moleculeInserted() - molecule's id "+toString(_mol->getMolIndex())
|
---|
299 | +" already present.");
|
---|
300 |
|
---|
301 | // add new object
|
---|
302 | LOG(1, "DEBUG: Adding GLMoleculeObject_molecule to id " << _mol->getMolIndex());
|
---|
303 | GLMoleculeObject_molecule *molObject =
|
---|
304 | new GLMoleculeObject_molecule(
|
---|
305 | GLMoleculeObject::meshEmpty,
|
---|
306 | this,
|
---|
307 | _mol);
|
---|
308 | ASSERT( molObject != NULL,
|
---|
309 | "GLWorldScene::moleculeInserted - could not create molecule object for "
|
---|
310 | +toString(_mol->getMolIndex()));
|
---|
311 | #ifndef NDEBUG
|
---|
312 | std::pair<MoleculeNodeMap::iterator, bool> inserter =
|
---|
313 | #endif
|
---|
314 | MoleculesinSceneMap.insert( make_pair(molid, molObject) );
|
---|
315 | ASSERT(inserter.second,
|
---|
316 | "GLWorldScene::moleculeInserted() - molecule "+toString(_mol->getMolIndex())
|
---|
317 | +" already present in scene.");
|
---|
318 |
|
---|
319 | connect (molObject, SIGNAL(changed()), this, SIGNAL(changed()));
|
---|
320 | connect (molObject, SIGNAL(changeOccured()), this, SIGNAL(changeOccured()));
|
---|
321 |
|
---|
322 | emit changed();
|
---|
323 | emit changeOccured();
|
---|
324 | }
|
---|
325 |
|
---|
326 | /** Removes a molecule from the scene.
|
---|
327 | *
|
---|
328 | * @param _molid index of the molecule to remove
|
---|
329 | */
|
---|
330 | void GLWorldScene::moleculeRemoved(ObservedValue_Index_t _molid)
|
---|
331 | {
|
---|
332 | LOG(3, "INFO: GLWorldScene: Received signal moleculeRemoved for molecule "+toString(_molid)+".");
|
---|
333 |
|
---|
334 | MoleculeNodeMap::iterator iter = MoleculesinSceneMap.find(_molid);
|
---|
335 | ASSERT ( iter != MoleculesinSceneMap.end(),
|
---|
336 | "GLWorldScene::moleculeRemoved() - to be removed molecule "+toString(_molid)
|
---|
337 | +" is already gone.");
|
---|
338 | // check if it's already empty
|
---|
339 | GLMoleculeObject_molecule *molObject = iter->second;
|
---|
340 | delete molObject;
|
---|
341 | MoleculesinSceneMap.erase(iter);
|
---|
342 |
|
---|
343 | emit changed();
|
---|
344 | emit changeOccured();
|
---|
345 | }
|
---|
346 |
|
---|
347 | void GLWorldScene::moleculesVisibilityChanged(ObservedValue_Index_t _id, bool _visible)
|
---|
348 | {
|
---|
349 | MoleculeNodeMap::iterator iter = MoleculesinSceneMap.find(_id);
|
---|
350 | ASSERT( iter != MoleculesinSceneMap.end(),
|
---|
351 | "GLWorldScene::moleculeInserted() - molecule's id "
|
---|
352 | +toString(board->getMoleculeIdToIndex(_id))+" is unknown.");
|
---|
353 |
|
---|
354 | GLMoleculeObject_molecule *molObject = iter->second;
|
---|
355 | molObject->setVisible(_visible);
|
---|
356 |
|
---|
357 | emit changed();
|
---|
358 | emit changeOccured();
|
---|
359 | }
|
---|
360 |
|
---|
361 | /** Adds a shape to the scene.
|
---|
362 | *
|
---|
363 | */
|
---|
364 | void GLWorldScene::addShape(const std::string &_name)
|
---|
365 | {
|
---|
366 | Shape * const shape = ShapeRegistry::getInstance().getByName(_name);
|
---|
367 | if (shape != NULL) {
|
---|
368 | GLMoleculeObject_shape *shapeObject = new GLMoleculeObject_shape(*shape, this);
|
---|
369 | ShapeNodeMap::iterator iter = ShapesinSceneMap.find(_name);
|
---|
370 | ASSERT(iter == ShapesinSceneMap.end(),
|
---|
371 | "GLWorldScene::addShape() - same shape "+_name+" added again.");
|
---|
372 | ShapesinSceneMap.insert( make_pair(_name, shapeObject) );
|
---|
373 | } else
|
---|
374 | ELOG(2, "GLWorldScene::addShape() - shape disappeared before we could draw it.");
|
---|
375 |
|
---|
376 | emit changed();
|
---|
377 | }
|
---|
378 |
|
---|
379 | void GLWorldScene::removeShape(const std::string &_name)
|
---|
380 | {
|
---|
381 | ShapeNodeMap::iterator iter = ShapesinSceneMap.find(_name);
|
---|
382 | ASSERT(iter != ShapesinSceneMap.end(),
|
---|
383 | "GLWorldScene::removeShape() - shape "+_name+" not in scene.");
|
---|
384 | ShapesinSceneMap.erase(iter);
|
---|
385 | delete(iter->second);
|
---|
386 |
|
---|
387 | emit changed();
|
---|
388 | }
|
---|
389 |
|
---|
390 | void GLWorldScene::updateSelectedShapes()
|
---|
391 | {
|
---|
392 | foreach (QObject *obj, children()) {
|
---|
393 | GLMoleculeObject_shape *shapeobj = qobject_cast<GLMoleculeObject_shape *>(obj);
|
---|
394 | if (shapeobj){
|
---|
395 | shapeobj->enable(ShapeRegistry::getInstance().isSelected(shapeobj->getShape()));
|
---|
396 | }
|
---|
397 | }
|
---|
398 |
|
---|
399 | emit changed();
|
---|
400 | }
|
---|
401 |
|
---|
402 | void GLWorldScene::initialize(QGLView *view, QGLPainter *painter) const
|
---|
403 | {
|
---|
404 | // Initialize all of the mesh objects that we have as children.
|
---|
405 | foreach (QObject *obj, children()) {
|
---|
406 | GLMoleculeObject *meshobj = qobject_cast<GLMoleculeObject *>(obj);
|
---|
407 | if (meshobj)
|
---|
408 | meshobj->initialize(view, painter);
|
---|
409 | }
|
---|
410 | }
|
---|
411 |
|
---|
412 | void GLWorldScene::draw(QGLPainter *painter, const QVector4D &cameraPlane) const
|
---|
413 | {
|
---|
414 | // Draw all of the mesh objects that we have as children.
|
---|
415 | foreach (QObject *obj, children()) {
|
---|
416 | GLMoleculeObject *meshobj = qobject_cast<GLMoleculeObject *>(obj);
|
---|
417 | if (meshobj)
|
---|
418 | meshobj->draw(painter, cameraPlane);
|
---|
419 | }
|
---|
420 | }
|
---|
421 |
|
---|
422 | void GLWorldScene::setSelectionMode(SelectionModeType mode)
|
---|
423 | {
|
---|
424 | selectionMode = mode;
|
---|
425 | // TODO send update to toolbar
|
---|
426 | }
|
---|
427 |
|
---|
428 | void GLWorldScene::setSelectionModeAtom()
|
---|
429 | {
|
---|
430 | setSelectionMode(SelectAtom);
|
---|
431 | }
|
---|
432 |
|
---|
433 | void GLWorldScene::setSelectionModeMolecule()
|
---|
434 | {
|
---|
435 | setSelectionMode(SelectMolecule);
|
---|
436 | }
|
---|
437 |
|
---|