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 | * GLMoleculeObject_molecule.cpp
|
---|
26 | *
|
---|
27 | * Created on: Mar 30, 2012
|
---|
28 | * Author: ankele
|
---|
29 | */
|
---|
30 |
|
---|
31 |
|
---|
32 | // include config.h
|
---|
33 | #ifdef HAVE_CONFIG_H
|
---|
34 | #include <config.h>
|
---|
35 | #endif
|
---|
36 |
|
---|
37 | #include "GLMoleculeObject_molecule.hpp"
|
---|
38 |
|
---|
39 | #include <Qt3D/qglscenenode.h>
|
---|
40 | #include <Qt3D/qglbuilder.h>
|
---|
41 |
|
---|
42 | #include "CodePatterns/MemDebug.hpp"
|
---|
43 |
|
---|
44 | #include <boost/assign.hpp>
|
---|
45 |
|
---|
46 | #include "CodePatterns/Assert.hpp"
|
---|
47 | #include "CodePatterns/IteratorAdaptors.hpp"
|
---|
48 | #include "CodePatterns/Log.hpp"
|
---|
49 | #include "CodePatterns/Observer/Notification.hpp"
|
---|
50 | #include "CodePatterns/Observer/ObserverLog.hpp"
|
---|
51 |
|
---|
52 | #include "Atom/atom.hpp"
|
---|
53 | #include "molecule.hpp"
|
---|
54 | #include "Descriptors/AtomIdDescriptor.hpp"
|
---|
55 | #include "Descriptors/MoleculeIdDescriptor.hpp"
|
---|
56 | #include "Element/element.hpp"
|
---|
57 | #include "LinearAlgebra/Vector.hpp"
|
---|
58 | #include "LinkedCell/PointCloudAdaptor.hpp"
|
---|
59 | #include "LinkedCell/linkedcell.hpp"
|
---|
60 | #include "Tesselation/tesselation.hpp"
|
---|
61 | #include "Tesselation/BoundaryLineSet.hpp"
|
---|
62 | #include "Tesselation/BoundaryTriangleSet.hpp"
|
---|
63 | #include "Tesselation/CandidateForTesselation.hpp"
|
---|
64 | #include "UIElements/Views/Qt4/QtInstanceInformationBoard.hpp"
|
---|
65 | #include "Atom/TesselPoint.hpp"
|
---|
66 | #include "World.hpp"
|
---|
67 |
|
---|
68 | #include "ObservedValue_wCallback.hpp"
|
---|
69 | #include "ObservedValue_UpdateAtoms.hpp"
|
---|
70 |
|
---|
71 | using namespace boost::assign;
|
---|
72 |
|
---|
73 | #include "GLMoleculeObject_atom.hpp"
|
---|
74 |
|
---|
75 | static Observable::channels_t getAllAtomicChangesChannels()
|
---|
76 | {
|
---|
77 | Observable::channels_t channels;
|
---|
78 | channels += molecule::AtomInserted, molecule::AtomRemoved, molecule::AtomMoved;
|
---|
79 | return channels;
|
---|
80 | }
|
---|
81 |
|
---|
82 | static Observable::channels_t getAllAtomicObservedChannels()
|
---|
83 | {
|
---|
84 | Observable::channels_t channels;
|
---|
85 | channels += molecule::AtomInserted, molecule::AtomRemoved, molecule::AtomMoved;
|
---|
86 | return channels;
|
---|
87 | }
|
---|
88 |
|
---|
89 | // static instances
|
---|
90 | const Observable::channels_t GLMoleculeObject_molecule::HullChannels(getAllAtomicChangesChannels());
|
---|
91 | const Observable::channels_t GLMoleculeObject_molecule::BoundingBoxChannels(1, molecule::BoundingBoxChanged);
|
---|
92 | const Observable::channels_t GLMoleculeObject_molecule::IndexChannels(1, molecule::IndexChanged);
|
---|
93 | const Observable::channels_t GLMoleculeObject_molecule::NameChannels(1, molecule::MoleculeNameChanged);
|
---|
94 |
|
---|
95 | static QGLSceneNode *createMoleculeMesh(const QGeometryData &_geo)
|
---|
96 | {
|
---|
97 | // Build a mesh from the geometry.
|
---|
98 | QGLBuilder builder;
|
---|
99 | builder.addTriangles(_geo);
|
---|
100 | QGLSceneNode *mesh = builder.finalizedSceneNode();
|
---|
101 | return mesh;
|
---|
102 | }
|
---|
103 |
|
---|
104 | GLMoleculeObject_molecule::GLMoleculeObject_molecule(
|
---|
105 | QObject *parent,
|
---|
106 | const moleculeId_t _molid,
|
---|
107 | QtInstanceInformationBoard * _board,
|
---|
108 | std::vector<boost::any> _ObservedValues) :
|
---|
109 | GLMoleculeObject((QGLSceneNode *)NULL, parent),
|
---|
110 | Observer(std::string("GLMoleculeObject_molecule")+toString(_molid)),
|
---|
111 | owner(NULL),
|
---|
112 | molref(getMolecule(_molid)),
|
---|
113 | /* We must not use boost::cref(this) as "this" has not been properly constructed and seemingly
|
---|
114 | * boost::cref tries to do some magic to grasp the inheritance hierarchy which fails because
|
---|
115 | * the class has not been fully constructed yet. "This" itself seems to be working fine.
|
---|
116 | */
|
---|
117 | ObservedValues(_ObservedValues),
|
---|
118 | subjectKilledCount(0),
|
---|
119 | TesselationHullUpdater(
|
---|
120 | boost::bind(&GLMoleculeObject_molecule::updateTesselationHull, this)
|
---|
121 | ),
|
---|
122 | TesselationHull(
|
---|
123 | molref,
|
---|
124 | TesselationHullUpdater,
|
---|
125 | "MoleculeTesselationHull_"+toString(_molid),
|
---|
126 | HullChannels),
|
---|
127 | hoverAtomId(-1),
|
---|
128 | AllsignedOnChannels(getAllAtomicObservedChannels().size()),
|
---|
129 | signedOnChannels(0),
|
---|
130 | board(_board)
|
---|
131 | {
|
---|
132 | init(_molid);
|
---|
133 | }
|
---|
134 |
|
---|
135 | GLMoleculeObject_molecule::GLMoleculeObject_molecule(
|
---|
136 | QGLSceneNode *mesh[],
|
---|
137 | QObject *parent,
|
---|
138 | const moleculeId_t _molid,
|
---|
139 | QtInstanceInformationBoard * _board,
|
---|
140 | std::vector<boost::any> _ObservedValues) :
|
---|
141 | GLMoleculeObject(mesh, parent),
|
---|
142 | Observer(std::string("GLMoleculeObject_molecule")+toString(_molid)),
|
---|
143 | owner(NULL),
|
---|
144 | molref(getMolecule(_molid)),
|
---|
145 | /* We must not use boost::cref(this) as "this" has not been properly constructed and seemingly
|
---|
146 | * boost::cref tries to do some magic to grasp the inheritance hierarchy which fails because
|
---|
147 | * the class has not been fully constructed yet. "This" itself seems to be working fine.
|
---|
148 | */
|
---|
149 | ObservedValues(_ObservedValues),
|
---|
150 | subjectKilledCount(0),
|
---|
151 | TesselationHullUpdater(
|
---|
152 | boost::bind(&GLMoleculeObject_molecule::updateTesselationHull, this)
|
---|
153 | ),
|
---|
154 | TesselationHull(
|
---|
155 | molref,
|
---|
156 | TesselationHullUpdater,
|
---|
157 | "MoleculeTesselationHull_"+toString(_molid),
|
---|
158 | HullChannels),
|
---|
159 | hoverAtomId(-1),
|
---|
160 | AllsignedOnChannels(getAllAtomicObservedChannels().size()),
|
---|
161 | signedOnChannels(0),
|
---|
162 | board(_board)
|
---|
163 | {
|
---|
164 | init(_molid);
|
---|
165 | }
|
---|
166 |
|
---|
167 | void GLMoleculeObject_molecule::init(const moleculeId_t _molid)
|
---|
168 | {
|
---|
169 | setObjectId(_molid);
|
---|
170 | setMaterial(getMaterial(1));
|
---|
171 |
|
---|
172 | m_selected = const_cast<const World &>(World::getInstance()).isMoleculeSelected(_molid);
|
---|
173 |
|
---|
174 | // initially, atoms and bonds should be visible
|
---|
175 | m_visible = false;
|
---|
176 |
|
---|
177 | activateObserver();
|
---|
178 |
|
---|
179 | connect (this, SIGNAL(hoverChanged(GLMoleculeObject *)), this, SLOT(hoverChangedSignalled(GLMoleculeObject *)));
|
---|
180 | connect (this, SIGNAL(hoverChanged(GLMoleculeObject *)), this, SIGNAL(changed()));
|
---|
181 | connect (this, SIGNAL(TesselationHullChanged()), this, SLOT(resetTesselationHull()), Qt::QueuedConnection);
|
---|
182 | connect (this, SIGNAL(BoundingBoxChanged()), this, SLOT(resetBoundingBox()), Qt::QueuedConnection);
|
---|
183 | connect (this, SIGNAL(IdChanged()), this, SLOT(resetIndex()), Qt::QueuedConnection);
|
---|
184 | connect (this, SIGNAL(AtomInserted(const atomId_t)), this, SLOT(atomInserted(const atomId_t)), Qt::QueuedConnection);
|
---|
185 | connect (this, SIGNAL(AtomInserted(const atomId_t)), this, SLOT(resetAtoms()), Qt::QueuedConnection);
|
---|
186 | connect (this, SIGNAL(AtomRemoved(const atomId_t)), this, SLOT(resetAtoms()), Qt::QueuedConnection);
|
---|
187 | connect (this, SIGNAL(AtomRemoved(const atomId_t)), this, SLOT(atomRemoved(const atomId_t)), Qt::QueuedConnection);
|
---|
188 |
|
---|
189 | connect( this, SIGNAL(clicked()), this, SLOT(wasClicked()));
|
---|
190 | }
|
---|
191 |
|
---|
192 | GLMoleculeObject_molecule::~GLMoleculeObject_molecule()
|
---|
193 | {
|
---|
194 | deactivateObserver();
|
---|
195 | board->returnMoleculeObservedValues(getMolIndex(), ObservedValues);
|
---|
196 | }
|
---|
197 |
|
---|
198 | void GLMoleculeObject_molecule::deactivateObserver()
|
---|
199 | {
|
---|
200 | if (owner != NULL) {
|
---|
201 | Observable::channels_t channels = getAllAtomicObservedChannels();
|
---|
202 | for (Observable::channels_t::const_iterator iter = channels.begin();
|
---|
203 | iter != channels.end(); ++iter)
|
---|
204 | owner->signOff(this, *iter);
|
---|
205 | owner = NULL;
|
---|
206 | signedOnChannels = 0;
|
---|
207 | }
|
---|
208 | }
|
---|
209 |
|
---|
210 | void GLMoleculeObject_molecule::activateObserver()
|
---|
211 | {
|
---|
212 | // sign on as observer (obtain non-const instance before)
|
---|
213 | const molecule * const _molecule = getMolecule(getMolIndex());
|
---|
214 | if (_molecule != NULL) {
|
---|
215 | Observable::channels_t channels = getAllAtomicObservedChannels();
|
---|
216 | owner = static_cast<const Observable *>(_molecule);
|
---|
217 | for (Observable::channels_t::const_iterator iter = channels.begin();
|
---|
218 | iter != channels.end(); ++iter)
|
---|
219 | owner->signOn(this, *iter);
|
---|
220 | } else {
|
---|
221 | ELOG(1, "GLMoleculeObject_molecule() - added null object for not present mol id " << getMolIndex());
|
---|
222 | }
|
---|
223 |
|
---|
224 | }
|
---|
225 |
|
---|
226 | void GLMoleculeObject_molecule::addAtomBonds(
|
---|
227 | const bond::ptr &_bond,
|
---|
228 | const GLMoleculeObject_bond::SideOfBond _side
|
---|
229 | )
|
---|
230 | {
|
---|
231 | bool bond_present = false;
|
---|
232 | const BondIds ids = getBondIds(_bond, _side);
|
---|
233 | // check whether bond is not present already
|
---|
234 | bond_present = BondsinSceneMap.count(ids);
|
---|
235 | if (!bond_present)
|
---|
236 | bondInserted(ids.first, ids.second, _side);
|
---|
237 | else {
|
---|
238 | BondsinSceneMap[ids]->resetPosition();
|
---|
239 | BondsinSceneMap[ids]->resetWidth();
|
---|
240 | }
|
---|
241 | }
|
---|
242 |
|
---|
243 | QGeometryData GLMoleculeObject_molecule::updateTesselationHull() const
|
---|
244 | {
|
---|
245 | QGeometryData geo;
|
---|
246 |
|
---|
247 | const molecule * const molref = getMolecule(getMolIndex());
|
---|
248 | if (molref == NULL) {
|
---|
249 | ELOG(1, "Could not createMoleculeMesh, molecule with id " << getMolIndex() << " already gone.");
|
---|
250 | return geo;
|
---|
251 | }
|
---|
252 | double minradius = 2.; // TODO: set to maximum bond length value
|
---|
253 | LOG(3, "DEBUG: Molecule fits into sphere of radius " << minradius);
|
---|
254 | // check minimum bond radius in molecule
|
---|
255 | double minlength = std::numeric_limits<double>::max();
|
---|
256 | for (molecule::const_iterator iter = molref->begin();
|
---|
257 | iter != molref->end(); ++iter) {
|
---|
258 | const BondList &ListOfBonds = (*iter)->getListOfBonds();
|
---|
259 | for (BondList::const_iterator bonditer = ListOfBonds.begin();
|
---|
260 | bonditer != ListOfBonds.end(); ++bonditer) {
|
---|
261 | const double bond_distance = (*bonditer)->GetDistance();
|
---|
262 | minlength = std::min(bond_distance, minlength);
|
---|
263 | }
|
---|
264 | }
|
---|
265 | minradius = std::max( std::max(minradius, minlength), 1.);
|
---|
266 |
|
---|
267 | // we need at least three points for tesselation
|
---|
268 | if (getPresentAtoms().size() >= 3) {
|
---|
269 | // Tesselate the points.
|
---|
270 | Tesselation T;
|
---|
271 | PointCloudAdaptor<molecule> cloud(const_cast<molecule *>(molref), getMolName());
|
---|
272 | T(cloud, minradius);
|
---|
273 |
|
---|
274 | // Fill the points into a Qt geometry.
|
---|
275 | LinkedCell_deprecated LinkedList(cloud, minradius);
|
---|
276 | std::map<int, int> indices;
|
---|
277 | std::map<int, Vector> normals;
|
---|
278 | int index = 0;
|
---|
279 | for (PointMap::const_iterator piter = T.PointsOnBoundary.begin();
|
---|
280 | piter != T.PointsOnBoundary.end(); ++piter) {
|
---|
281 | const Vector &point = piter->second->getPosition();
|
---|
282 | // add data to the primitive
|
---|
283 | geo.appendVertex(QVector3D(point[0], point[1], point[2]));
|
---|
284 | Vector normalvector;
|
---|
285 | for (LineMap::const_iterator lineiter = piter->second->lines.begin();
|
---|
286 | lineiter != piter->second->lines.end(); ++lineiter)
|
---|
287 | for (TriangleMap::const_iterator triangleiter = lineiter->second->triangles.begin();
|
---|
288 | triangleiter != lineiter->second->triangles.end(); ++triangleiter)
|
---|
289 | normalvector +=
|
---|
290 | triangleiter->second->NormalVector;
|
---|
291 | normalvector.Normalize();
|
---|
292 | geo.appendNormal(QVector3D(normalvector[0], normalvector[1], normalvector[2]));
|
---|
293 | geo.appendColor(QColor(1, 1, 1, 1));
|
---|
294 | geo.appendTexCoord(QVector2D(0, 0));
|
---|
295 | indices.insert( std::make_pair( piter->second->getNr(), index++));
|
---|
296 | }
|
---|
297 |
|
---|
298 | // Fill the tesselated triangles into the geometry.
|
---|
299 | for (TriangleMap::const_iterator runner = T.TrianglesOnBoundary.begin();
|
---|
300 | runner != T.TrianglesOnBoundary.end(); runner++) {
|
---|
301 | int v[3];
|
---|
302 | for (size_t i=0; i<3; ++i)
|
---|
303 | v[i] = runner->second->endpoints[i]->getNr();
|
---|
304 |
|
---|
305 | // Sort the vertices so the triangle is clockwise (relative to the normal vector).
|
---|
306 | Vector cross = T.PointsOnBoundary[v[1]]->getPosition() - T.PointsOnBoundary[v[0]]->getPosition();
|
---|
307 | cross.VectorProduct(T.PointsOnBoundary[v[2]]->getPosition() - T.PointsOnBoundary[v[0]]->getPosition());
|
---|
308 | if (cross.ScalarProduct(runner->second->NormalVector) > 0)
|
---|
309 | geo.appendIndices(indices[v[0]], indices[v[1]], indices[v[2]]);
|
---|
310 | else
|
---|
311 | geo.appendIndices(indices[v[0]], indices[v[2]], indices[v[1]]);
|
---|
312 | }
|
---|
313 | }
|
---|
314 |
|
---|
315 | return geo;
|
---|
316 | }
|
---|
317 |
|
---|
318 | molecule::BoundingBoxInfo GLMoleculeObject_molecule::initBoundingBox()
|
---|
319 | {
|
---|
320 | molecule::BoundingBoxInfo info;
|
---|
321 | info.position = zeroVec;
|
---|
322 | info.radius = 0.;
|
---|
323 | return info;
|
---|
324 | }
|
---|
325 |
|
---|
326 | molecule::BoundingBoxInfo GLMoleculeObject_molecule::updateBoundingBox(
|
---|
327 | const boost::function<const moleculeId_t ()> &_getMolIndex)
|
---|
328 | {
|
---|
329 | const molecule * const mol = getMolecule(_getMolIndex());
|
---|
330 | return mol->getBoundingBox();
|
---|
331 | }
|
---|
332 |
|
---|
333 | moleculeId_t GLMoleculeObject_molecule::updateIndex()
|
---|
334 | {
|
---|
335 | return const_cast<const World &>(World::getInstance()).lastChangedMolId();
|
---|
336 | }
|
---|
337 |
|
---|
338 | std::string GLMoleculeObject_molecule::updateName(
|
---|
339 | const boost::function<const moleculeId_t ()> &_getMolIndex)
|
---|
340 | {
|
---|
341 | const molecule * const mol = getMolecule(_getMolIndex());
|
---|
342 | return mol->getName();
|
---|
343 | }
|
---|
344 |
|
---|
345 | void GLMoleculeObject_molecule::resetTesselationHull()
|
---|
346 | {
|
---|
347 | if (!TesselationHull.isValid())
|
---|
348 | updateMesh(createMoleculeMesh(*TesselationHull));
|
---|
349 | }
|
---|
350 |
|
---|
351 | void GLMoleculeObject_molecule::resetBoundingBox()
|
---|
352 | {
|
---|
353 | molecule::BoundingBoxInfo info = getBoundingBox();
|
---|
354 | setPosition(QVector3D(info.position[0], info.position[1], info.position[2]));
|
---|
355 | setScale(info.radius + 0.3); // getBoundingSphere() only sees atoms as points, so make the box a bit bigger
|
---|
356 | }
|
---|
357 |
|
---|
358 | void GLMoleculeObject_molecule::resetIndex()
|
---|
359 | {
|
---|
360 | const atomId_t newId = getMolIndex();
|
---|
361 | const size_t oldId = objectId();
|
---|
362 | ASSERT( newId != oldId,
|
---|
363 | "GLMoleculeObject_molecule::resetIndex() - index "+toString(newId)+" did not change.");
|
---|
364 | LOG(4, "INFO: GLMoleculeObject_molecule: new index is "+toString(newId)+".");
|
---|
365 | setObjectId(newId);
|
---|
366 |
|
---|
367 | emit indexChanged(this, oldId, newId);
|
---|
368 | }
|
---|
369 |
|
---|
370 | void GLMoleculeObject_molecule::resetName()
|
---|
371 | {
|
---|
372 | }
|
---|
373 |
|
---|
374 | void GLMoleculeObject_molecule::AtomSelected(const atomId_t _id)
|
---|
375 | {
|
---|
376 | AtomNodeMap::iterator iter = AtomsinSceneMap.find(_id);
|
---|
377 | if (iter != AtomsinSceneMap.end())
|
---|
378 | QMetaObject::invokeMethod(iter->second, // pointer to a QObject
|
---|
379 | "Selected", // member name (no parameters here)
|
---|
380 | Qt::QueuedConnection); // connection type
|
---|
381 | else
|
---|
382 | ELOG(2, "GLMoleculeObject_molecule::AtomSelected() - atom "
|
---|
383 | << _id << " unknown to GLMoleculeObject_molecule.");
|
---|
384 | }
|
---|
385 |
|
---|
386 | void GLMoleculeObject_molecule::AtomUnselected(const atomId_t _id)
|
---|
387 | {
|
---|
388 | AtomNodeMap::iterator iter = AtomsinSceneMap.find(_id);
|
---|
389 | if (iter != AtomsinSceneMap.end())
|
---|
390 | QMetaObject::invokeMethod(iter->second, // pointer to a QObject
|
---|
391 | "Unselected", // member name (no parameters here)
|
---|
392 | Qt::QueuedConnection); // connection type
|
---|
393 | else ELOG(2, "GLMoleculeObject_molecule::AtomUnselected() - atom "
|
---|
394 | << _id << " unknown to GLMoleculeObject_molecule.");
|
---|
395 | }
|
---|
396 |
|
---|
397 | void GLMoleculeObject_molecule::Selected()
|
---|
398 | {
|
---|
399 | ASSERT( !m_selected,
|
---|
400 | "GLMoleculeObject_molecule::Selected() - 3D rep of molecule is already selected.");
|
---|
401 | m_selected = true;
|
---|
402 |
|
---|
403 | emit changed();
|
---|
404 | }
|
---|
405 |
|
---|
406 | void GLMoleculeObject_molecule::Unselected()
|
---|
407 | {
|
---|
408 | ASSERT( m_selected,
|
---|
409 | "GLMoleculeObject_molecule::Unselected() - 3D rep of molecule is already unselected.");
|
---|
410 | m_selected = false;
|
---|
411 |
|
---|
412 | emit changed();
|
---|
413 | }
|
---|
414 |
|
---|
415 | void GLMoleculeObject_molecule::update(Observable *publisher)
|
---|
416 | {
|
---|
417 | ASSERT(0,
|
---|
418 | "GLMoleculeObject_molecule::update() - general update from unexpected source.");
|
---|
419 | }
|
---|
420 |
|
---|
421 | void GLMoleculeObject_molecule::subjectKilled(Observable *publisher)
|
---|
422 | {
|
---|
423 | ++signedOnChannels;
|
---|
424 |
|
---|
425 | if (signedOnChannels == AllsignedOnChannels) {
|
---|
426 | // remove owner: no more signOff needed
|
---|
427 | owner = NULL;
|
---|
428 |
|
---|
429 | board->moleculecountsubjectKilled(getMolIndex());
|
---|
430 | }
|
---|
431 | }
|
---|
432 |
|
---|
433 | void GLMoleculeObject_molecule::recieveNotification(Observable *publisher, Notification_ptr notification)
|
---|
434 | {
|
---|
435 | const molecule * const _molecule = getMolecule(getMolIndex());
|
---|
436 | // when molecule is NULL we will soon get destroyed anyway
|
---|
437 | if (_molecule == NULL)
|
---|
438 | return;
|
---|
439 | if (publisher == dynamic_cast<const Observable*>(_molecule)){
|
---|
440 | // notification from atom
|
---|
441 | #ifdef LOG_OBSERVER
|
---|
442 | observerLog().addMessage() << "++ Update of Observer "<< observerLog().getName(static_cast<Observer *>(this))
|
---|
443 | << " received notification from molecule " << getMolIndex() << " for channel "
|
---|
444 | << notification->getChannelNo() << ".";
|
---|
445 | #endif
|
---|
446 | switch (notification->getChannelNo()) {
|
---|
447 | case molecule::AtomInserted:
|
---|
448 | case molecule::AtomRemoved:
|
---|
449 | case molecule::AtomMoved:
|
---|
450 | {
|
---|
451 | #ifdef LOG_OBSERVER
|
---|
452 | observerLog().addMessage() << "++ Observer " << observerLog().getName(static_cast<Observer *>(this)) << " received notification that atom "+toString(_id)+" has been inserted.";
|
---|
453 | #endif
|
---|
454 | emit TesselationHullChanged();
|
---|
455 | emit BoundingBoxChanged();
|
---|
456 | break;
|
---|
457 | }
|
---|
458 | case molecule::IndexChanged:
|
---|
459 | {
|
---|
460 | #ifdef LOG_OBSERVER
|
---|
461 | const atomId_t _id = _molecule->lastChangedAtomId();
|
---|
462 | observerLog().addMessage() << "++ Observer " << observerLog().getName(static_cast<Observer *>(this)) << " received notification that atom "+toString(_id)+"'s index has changed.";
|
---|
463 | #endif
|
---|
464 | emit IdChanged();
|
---|
465 | break;
|
---|
466 | }
|
---|
467 | default:
|
---|
468 | break;
|
---|
469 | }
|
---|
470 | }
|
---|
471 | }
|
---|
472 |
|
---|
473 | void GLMoleculeObject_molecule::initialize(QGLView *view, QGLPainter *painter)
|
---|
474 | {
|
---|
475 | // Initialize all of the mesh objects that we have as children.
|
---|
476 | if (m_visible) {
|
---|
477 | GLMoleculeObject::initialize(view, painter);
|
---|
478 | } else {
|
---|
479 | foreach (QObject *obj, children()) {
|
---|
480 | GLMoleculeObject *meshobj = qobject_cast<GLMoleculeObject *>(obj);
|
---|
481 | if (meshobj)
|
---|
482 | meshobj->initialize(view, painter);
|
---|
483 | }
|
---|
484 | }
|
---|
485 | }
|
---|
486 |
|
---|
487 | void GLMoleculeObject_molecule::draw(QGLPainter *painter, const QVector4D &cameraPlane)
|
---|
488 | {
|
---|
489 | // draw either molecule's mesh or all atoms and bonds
|
---|
490 | if (m_visible) {
|
---|
491 | resetTesselationHull();
|
---|
492 |
|
---|
493 | painter->modelViewMatrix().push();
|
---|
494 |
|
---|
495 | // Apply the material and effect to the painter.
|
---|
496 | QGLMaterial *material;
|
---|
497 | if (m_hovering)
|
---|
498 | material = m_hoverMaterial;
|
---|
499 | else if (m_selected)
|
---|
500 | material = m_selectionMaterial;
|
---|
501 | else
|
---|
502 | material = m_material;
|
---|
503 |
|
---|
504 | ASSERT(material, "GLMoleculeObject::draw: chosen material is NULL");
|
---|
505 |
|
---|
506 | painter->setColor(material->diffuseColor());
|
---|
507 | painter->setFaceMaterial(QGL::AllFaces, material);
|
---|
508 | if (m_effect)
|
---|
509 | painter->setUserEffect(m_effect);
|
---|
510 | else
|
---|
511 | painter->setStandardEffect(QGL::LitMaterial);
|
---|
512 |
|
---|
513 | // Mark the object for object picking purposes.
|
---|
514 | int prevObjectId = painter->objectPickId();
|
---|
515 | if (m_objectId != -1)
|
---|
516 | painter->setObjectPickId(m_objectId);
|
---|
517 |
|
---|
518 | m_mesh[0]->draw(painter);
|
---|
519 |
|
---|
520 | // Turn off the user effect, if present.
|
---|
521 | if (m_effect)
|
---|
522 | painter->setStandardEffect(QGL::LitMaterial);
|
---|
523 |
|
---|
524 | // Revert to the previous object identifier.
|
---|
525 | painter->setObjectPickId(prevObjectId);
|
---|
526 |
|
---|
527 | // Restore the modelview matrix.
|
---|
528 | painter->modelViewMatrix().pop();
|
---|
529 |
|
---|
530 | // GLMoleculeObject::draw(painter, cameraPlane);
|
---|
531 | } else {
|
---|
532 | // Draw all of the mesh objects that we have as children.
|
---|
533 | foreach (QObject *obj, children()) {
|
---|
534 | GLMoleculeObject *meshobj = qobject_cast<GLMoleculeObject *>(obj);
|
---|
535 | if (meshobj)
|
---|
536 | meshobj->draw(painter, cameraPlane);
|
---|
537 | }
|
---|
538 |
|
---|
539 | // update bounding box prior to selection
|
---|
540 | resetBoundingBox();
|
---|
541 |
|
---|
542 | painter->modelViewMatrix().push();
|
---|
543 | painter->modelViewMatrix().translate(m_position);
|
---|
544 | if (m_rotationAngle != 0.0f)
|
---|
545 | painter->modelViewMatrix().rotate(m_rotationAngle, m_rotationVector);
|
---|
546 | if ((m_scaleX != 1.0f) || (m_scaleY != 1.0f) || (m_scaleZ != 1.0f))
|
---|
547 | painter->modelViewMatrix().scale(m_scaleX, m_scaleY, m_scaleZ);
|
---|
548 |
|
---|
549 | // Draw a box around the mesh, if selected.
|
---|
550 | if (m_selected)
|
---|
551 | drawSelectionBox(painter);
|
---|
552 |
|
---|
553 | // Restore the modelview matrix.
|
---|
554 | painter->modelViewMatrix().pop();
|
---|
555 | }
|
---|
556 | }
|
---|
557 |
|
---|
558 | /** Adds an atom of this molecule to the scene.
|
---|
559 | *
|
---|
560 | * @param _atom atom to add
|
---|
561 | */
|
---|
562 | void GLMoleculeObject_molecule::atomInserted(const atomId_t _id)
|
---|
563 | {
|
---|
564 | LOG(3, "INFO: GLMoleculeObject_molecule: Received signal atomInserted for atom "+toString(_id)+".");
|
---|
565 |
|
---|
566 | GLMoleculeObject_atom *atomObject =
|
---|
567 | new GLMoleculeObject_atom(
|
---|
568 | GLMoleculeObject::meshSphere,
|
---|
569 | this,
|
---|
570 | _id,
|
---|
571 | board,
|
---|
572 | board->getAtomObservedValues(_id));
|
---|
573 | ASSERT( atomObject != NULL,
|
---|
574 | "GLMoleculeObject_molecule::atomInserted - could not create atom object for "+toString(_id));
|
---|
575 | AtomNodeMap::iterator iter = AtomsinSceneMap.find(_id);
|
---|
576 | ASSERT(iter == AtomsinSceneMap.end(),
|
---|
577 | "GLMoleculeObject_molecule::atomInserted - same atom with id "+toString(_id)+" added again.");
|
---|
578 | AtomsinSceneMap.insert( make_pair(_id, atomObject) );
|
---|
579 |
|
---|
580 | qRegisterMetaType<atomId_t>("atomId_t");
|
---|
581 | qRegisterMetaType<bond::ptr>("bond::ptr");
|
---|
582 | qRegisterMetaType<GLMoleculeObject_bond::SideOfBond>("GLMoleculeObject_bond::SideOfBond");
|
---|
583 | connect (atomObject, SIGNAL(clicked(atomId_t)), this, SIGNAL(atomClicked(atomId_t)));
|
---|
584 | connect (atomObject, SIGNAL(changed()), this, SIGNAL(changed()));
|
---|
585 | connect (atomObject, SIGNAL(hoverChanged(GLMoleculeObject *)), this, SIGNAL(changed()));
|
---|
586 | connect (atomObject, SIGNAL(hoverChanged(GLMoleculeObject *)), this, SLOT(hoverChangedSignalled(GLMoleculeObject *)));
|
---|
587 | // connect (atomObject, SIGNAL(bondsChanged()), this, SLOT(bondInserted(const atomId_t, const atomId_t, const GLMoleculeObject_bond::SideOfBond)));
|
---|
588 | connect (atomObject, SIGNAL(BondsAdded(const atomId_t, const atomId_t, const GLMoleculeObject_bond::SideOfBond)), this, SLOT(bondInserted(const atomId_t, const atomId_t, const GLMoleculeObject_bond::SideOfBond)));
|
---|
589 | connect (atomObject, SIGNAL(BondsRemoved(const atomId_t, const atomId_t)), this, SLOT(bondRemoved(const atomId_t, const atomId_t)));
|
---|
590 | connect (atomObject, SIGNAL(indexChanged(GLMoleculeObject_atom*, const atomId_t, const atomId_t)), this, SLOT(changeAtomId(GLMoleculeObject_atom*, const atomId_t, const atomId_t)));
|
---|
591 |
|
---|
592 | if (m_objectId == -1)
|
---|
593 | setObjectId(_id);
|
---|
594 |
|
---|
595 | emit changed();
|
---|
596 | emit changeOccured();
|
---|
597 | }
|
---|
598 |
|
---|
599 | /** Removes an atom of this molecule from the scene.
|
---|
600 | *
|
---|
601 | * We just the id as the atom might have already been destroyed.
|
---|
602 | *
|
---|
603 | * @param _id id of atom to remove
|
---|
604 | */
|
---|
605 | void GLMoleculeObject_molecule::atomRemoved(const atomId_t _id)
|
---|
606 | {
|
---|
607 | LOG(3, "INFO: GLMoleculeObject_molecule: Received signal atomRemoved for atom "+toString(_id)+".");
|
---|
608 | // bonds are removed by signal coming from ~bond
|
---|
609 |
|
---|
610 | if ((unsigned int)m_objectId == _id)
|
---|
611 | setObjectId(-1);
|
---|
612 |
|
---|
613 | // remove atoms
|
---|
614 | AtomNodeMap::iterator iter = AtomsinSceneMap.find(_id);
|
---|
615 | ASSERT(iter != AtomsinSceneMap.end(),
|
---|
616 | "GLMoleculeObject_molecule::atomRemoved() - atom "+toString(_id)+" not on display.");
|
---|
617 | GLMoleculeObject_atom *atomObject = iter->second;
|
---|
618 | AtomsinSceneMap.erase(iter);
|
---|
619 | atomObject->disconnect();
|
---|
620 | delete atomObject;
|
---|
621 |
|
---|
622 | emit changed();
|
---|
623 | emit changeOccured();
|
---|
624 | }
|
---|
625 |
|
---|
626 | void GLMoleculeObject_molecule::hoverChangedSignalled(GLMoleculeObject *ob)
|
---|
627 | {
|
---|
628 | // Find the atom, ob corresponds to.
|
---|
629 | hoverAtomId = -1;
|
---|
630 | GLMoleculeObject_atom *atomObject = dynamic_cast<GLMoleculeObject_atom *>(ob);
|
---|
631 | if (atomObject){
|
---|
632 | for (AtomNodeMap::iterator iter = AtomsinSceneMap.begin();iter != AtomsinSceneMap.end(); ++ iter){
|
---|
633 | if (iter->second == atomObject)
|
---|
634 | hoverAtomId = iter->first;
|
---|
635 | }
|
---|
636 |
|
---|
637 | // Propagate signal.
|
---|
638 | emit hoverChanged(hoverAtomId);
|
---|
639 | } else {
|
---|
640 | // Find the atom, ob corresponds to.
|
---|
641 | GLMoleculeObject_molecule *moleculeObject = dynamic_cast<GLMoleculeObject_molecule *>(ob);
|
---|
642 | if (moleculeObject == this){
|
---|
643 | // Propagate signal.
|
---|
644 | emit hoverChanged(getMolIndex(), 0);
|
---|
645 | }
|
---|
646 | }
|
---|
647 | }
|
---|
648 |
|
---|
649 |
|
---|
650 | /** Helper function to get bond ids in the correct order for BondNodeMap.
|
---|
651 | *
|
---|
652 | * \return pair of ids in correct order.
|
---|
653 | */
|
---|
654 | GLMoleculeObject_molecule::BondIds GLMoleculeObject_molecule::getBondIds(
|
---|
655 | const bond::ptr _bond,
|
---|
656 | const enum GLMoleculeObject_bond::SideOfBond _side)
|
---|
657 | {
|
---|
658 | BondIds ids;
|
---|
659 | switch (_side) {
|
---|
660 | case GLMoleculeObject_bond::left:
|
---|
661 | ids = std::make_pair(_bond->leftatom->getId(), _bond->rightatom->getId());
|
---|
662 | break;
|
---|
663 | case GLMoleculeObject_bond::right:
|
---|
664 | ids = std::make_pair(_bond->rightatom->getId(), _bond->leftatom->getId());
|
---|
665 | break;
|
---|
666 | }
|
---|
667 | return ids;
|
---|
668 | }
|
---|
669 |
|
---|
670 | /** Adds a bond to the scene.
|
---|
671 | *
|
---|
672 | * @param _bond bond to add
|
---|
673 | * @param side which side of the bond (left or right)
|
---|
674 | */
|
---|
675 | void GLMoleculeObject_molecule::bondInserted(
|
---|
676 | const atomId_t _left, const atomId_t _right,
|
---|
677 | const enum GLMoleculeObject_bond::SideOfBond _side)
|
---|
678 | {
|
---|
679 | LOG(3, "INFO: GLWorldScene::bondInserted() - Adding bond "+toString(_left)
|
---|
680 | +toString(_right)+".");
|
---|
681 | //LOG(4, "INFO: Currently present bonds " << BondsinSceneMap << ".");
|
---|
682 |
|
---|
683 | const BondIds ids( std::make_pair(_left, _right) );
|
---|
684 | BondNodeMap::iterator iter = BondsinSceneMap.find(ids);
|
---|
685 | if (iter == BondsinSceneMap.end()) {
|
---|
686 | GLMoleculeObject_bond * bondObject =
|
---|
687 | new GLMoleculeObject_bond(GLMoleculeObject::meshCylinder, this, ids, _side);
|
---|
688 | connect (
|
---|
689 | bondObject, SIGNAL(BondRemoved(const atomId_t, const atomId_t)),
|
---|
690 | this, SLOT(bondRemoved(const atomId_t, const atomId_t)));
|
---|
691 | connect (bondObject, SIGNAL(changed()), this, SIGNAL(changed()));
|
---|
692 | BondsinSceneMap.insert( make_pair(ids, bondObject) );
|
---|
693 | // BondIdsinSceneMap.insert( Leftids );
|
---|
694 | } else {
|
---|
695 | iter->second->resetPosition();
|
---|
696 | iter->second->resetWidth();
|
---|
697 | }
|
---|
698 | emit changed();
|
---|
699 | emit changeOccured();
|
---|
700 | }
|
---|
701 |
|
---|
702 | /** Removes a bond from the scene.
|
---|
703 | *
|
---|
704 | * @param _bond bond to remove
|
---|
705 | */
|
---|
706 | void GLMoleculeObject_molecule::bondRemoved(const atomId_t leftnr, const atomId_t rightnr)
|
---|
707 | {
|
---|
708 | LOG(3, "INFO: GLWorldScene::bondRemoved() - Removing bond between "+toString(leftnr)+" and "+toString(rightnr)+".");
|
---|
709 | {
|
---|
710 | // left bond
|
---|
711 | const BondIds Leftids( make_pair(leftnr, rightnr) );
|
---|
712 | BondNodeMap::iterator leftiter = BondsinSceneMap.find( Leftids );
|
---|
713 | ASSERT(leftiter != BondsinSceneMap.end(),
|
---|
714 | "GLWorldScene::bondRemoved() - bond "+toString(leftnr)+"-"
|
---|
715 | +toString(rightnr)+" not on display.");
|
---|
716 | GLMoleculeObject_bond *bondObject = leftiter->second;
|
---|
717 | bondObject->disconnect();
|
---|
718 | BondsinSceneMap.erase(leftiter);
|
---|
719 | delete bondObject; // is done by signal from bond itself
|
---|
720 | //LOG(4, "INFO: Still present bonds " << BondsinSceneMap << ".");
|
---|
721 | }
|
---|
722 |
|
---|
723 | emit changed();
|
---|
724 | emit changeOccured();
|
---|
725 | }
|
---|
726 |
|
---|
727 | void GLMoleculeObject_molecule::setVisible(bool value)
|
---|
728 | {
|
---|
729 | // first update the mesh if we are going to be visible now
|
---|
730 | if (value)
|
---|
731 | updateTesselationHull();
|
---|
732 | // then emit onward
|
---|
733 | GLMoleculeObject::setVisible(value);
|
---|
734 |
|
---|
735 | emit changed();
|
---|
736 | emit changeOccured();
|
---|
737 | }
|
---|
738 |
|
---|
739 | std::ostream &operator<<(std::ostream &ost, const GLMoleculeObject_molecule::BondIds &t)
|
---|
740 | {
|
---|
741 | ost << t.first << "," << t.second;
|
---|
742 | return ost;
|
---|
743 | }
|
---|
744 |
|
---|
745 | void GLMoleculeObject_molecule::wasClicked()
|
---|
746 | {
|
---|
747 | LOG(4, "INFO: GLMoleculeObject_molecule: atom " << getMolIndex() << " has been clicked");
|
---|
748 | emit moleculeClicked(getMolIndex());
|
---|
749 | }
|
---|
750 |
|
---|
751 | void GLMoleculeObject_molecule::changeAtomId(
|
---|
752 | GLMoleculeObject_atom *ob,
|
---|
753 | const atomId_t oldId,
|
---|
754 | const atomId_t newId)
|
---|
755 | {
|
---|
756 | LOG(3, "INFO: GLMoleculeObject_molecule - change atom id " << oldId << " to " << newId << ".");
|
---|
757 |
|
---|
758 | // Remove from map.
|
---|
759 | AtomNodeMap::iterator iter = AtomsinSceneMap.find(oldId);
|
---|
760 | ASSERT(iter != AtomsinSceneMap.end(),
|
---|
761 | "GLMoleculeObject_molecule::changeAtomId() - atom with old id "+toString(oldId)+" not on display.");
|
---|
762 | ASSERT(iter->second == ob,
|
---|
763 | "GLMoleculeObject_molecule::changeAtomId() - atom with id "
|
---|
764 | +toString(oldId)+" does not match with object in AtomsinSceneMap.");
|
---|
765 | AtomsinSceneMap.erase(iter);
|
---|
766 |
|
---|
767 | // Reinsert with new id.
|
---|
768 | {
|
---|
769 | AtomNodeMap::iterator iter = AtomsinSceneMap.find(newId);
|
---|
770 | ASSERT(iter == AtomsinSceneMap.end(),
|
---|
771 | "GLMoleculeObject_molecule::changeAtomId() - atom with new id "+toString(newId)+" already known.");
|
---|
772 | }
|
---|
773 | AtomsinSceneMap.insert( make_pair(newId, ob) );
|
---|
774 | }
|
---|
775 |
|
---|
776 | const molecule * const GLMoleculeObject_molecule::getMolecule(const moleculeId_t _id)
|
---|
777 | {
|
---|
778 | const molecule * const mol = const_cast<const World &>(World::getInstance()).
|
---|
779 | getMolecule(MoleculeById(_id));
|
---|
780 | return mol;
|
---|
781 | }
|
---|
782 |
|
---|
783 | void GLMoleculeObject_molecule::initObservedValues(
|
---|
784 | std::vector<boost::any> &_ObservedValues,
|
---|
785 | const moleculeId_t _molid,
|
---|
786 | const molecule * const _molref,
|
---|
787 | const boost::function<void(const moleculeId_t)> &_subjectKilled)
|
---|
788 | {
|
---|
789 | /* This is an old note from when the code was still part of cstor's initializer body.
|
---|
790 | * TODO: Probably does not apply anymore but has not yet been tested.
|
---|
791 | *
|
---|
792 | * We must not use boost::cref(this) as "this" has not been properly constructed and seemingly
|
---|
793 | * boost::cref tries to do some magic to grasp the inheritance hierarchy which fails because
|
---|
794 | * the class has not been fully constructed yet. "This" itself seems to be working fine.
|
---|
795 | */
|
---|
796 |
|
---|
797 | ASSERT( _ObservedValues.size() == MAX_ObservedTypes,
|
---|
798 | "GLMoleculeObject_molecule::initObservedValues() - given ObservedValues has not correct size.");
|
---|
799 |
|
---|
800 | // fill ObservedValues: index first
|
---|
801 | const boost::function<moleculeId_t ()> MolIndexUpdater(
|
---|
802 | boost::bind(&GLMoleculeObject_molecule::updateIndex));
|
---|
803 |
|
---|
804 | ObservedValue_wCallback<moleculeId_t> * const IndexObservable =
|
---|
805 | new ObservedValue_wCallback<moleculeId_t>(
|
---|
806 | _molref,
|
---|
807 | MolIndexUpdater,
|
---|
808 | "MoleculeIndex_"+toString(_molid),
|
---|
809 | _molid,
|
---|
810 | IndexChannels,
|
---|
811 | _subjectKilled);
|
---|
812 | _ObservedValues[MolIndex] = IndexObservable;
|
---|
813 |
|
---|
814 | const boost::function<const moleculeId_t ()> MolIndexGetter =
|
---|
815 | boost::bind(&ObservedValue_wCallback<moleculeId_t>::get,
|
---|
816 | IndexObservable);
|
---|
817 |
|
---|
818 | // fill ObservedValues: then all the other that need index
|
---|
819 | const boost::function<std::string ()> MolNameUpdater(
|
---|
820 | boost::bind(&GLMoleculeObject_molecule::updateName, MolIndexGetter));
|
---|
821 | const boost::function<molecule::BoundingBoxInfo ()> BoundingBoxUpdater(
|
---|
822 | boost::bind(&GLMoleculeObject_molecule::updateBoundingBox, MolIndexGetter));
|
---|
823 |
|
---|
824 | _ObservedValues[MolName] = new ObservedValue_wCallback<std::string, moleculeId_t>(
|
---|
825 | _molref,
|
---|
826 | MolNameUpdater,
|
---|
827 | "MoleculeName_"+toString(_molid),
|
---|
828 | MolNameUpdater(),
|
---|
829 | NameChannels,
|
---|
830 | _subjectKilled,
|
---|
831 | MolIndexGetter);
|
---|
832 | _ObservedValues[BoundingBox] = new ObservedValue_wCallback<molecule::BoundingBoxInfo, moleculeId_t>(
|
---|
833 | _molref,
|
---|
834 | BoundingBoxUpdater,
|
---|
835 | "MoleculeBoundingBox_"+toString(_molid),
|
---|
836 | initBoundingBox(),
|
---|
837 | BoundingBoxChannels,
|
---|
838 | _subjectKilled,
|
---|
839 | MolIndexGetter);
|
---|
840 | }
|
---|
841 |
|
---|
842 | void GLMoleculeObject_molecule::destroyObservedValues(
|
---|
843 | std::vector<boost::any> &_ObservedValues)
|
---|
844 | {
|
---|
845 | delete boost::any_cast<ObservedValue_wCallback<moleculeId_t> *>(_ObservedValues[MolIndex]);
|
---|
846 | delete boost::any_cast<ObservedValue_wCallback<std::string, moleculeId_t> *>(_ObservedValues[MolName]);
|
---|
847 | delete boost::any_cast<ObservedValue_wCallback<molecule::BoundingBoxInfo, moleculeId_t> *>(_ObservedValues[BoundingBox]);
|
---|
848 | _ObservedValues.clear();
|
---|
849 | }
|
---|
850 |
|
---|
851 | moleculeId_t GLMoleculeObject_molecule::getMolIndex() const
|
---|
852 | {
|
---|
853 | return boost::any_cast<ObservedValue_wCallback<moleculeId_t> *>(ObservedValues[MolIndex])->get();
|
---|
854 | }
|
---|
855 |
|
---|
856 | std::string GLMoleculeObject_molecule::getMolName() const
|
---|
857 | {
|
---|
858 | return boost::any_cast<ObservedValue_wCallback<std::string, moleculeId_t> *>(ObservedValues[MolName])->get();
|
---|
859 | }
|
---|
860 |
|
---|
861 | molecule::BoundingBoxInfo GLMoleculeObject_molecule::getBoundingBox() const
|
---|
862 | {
|
---|
863 | return boost::any_cast<ObservedValue_wCallback<molecule::BoundingBoxInfo, moleculeId_t> *>(ObservedValues[BoundingBox])->get();
|
---|
864 | }
|
---|
865 |
|
---|
866 | GLMoleculeObject_molecule::atoms_t GLMoleculeObject_molecule::getPresentAtoms() const
|
---|
867 | {
|
---|
868 | atoms_t returnAtomIds;
|
---|
869 | returnAtomIds.insert(
|
---|
870 | MapKeyConstIterator<AtomNodeMap::const_iterator>(const_cast<const AtomNodeMap &>(AtomsinSceneMap).begin()),
|
---|
871 | MapKeyConstIterator<AtomNodeMap::const_iterator>(const_cast<const AtomNodeMap &>(AtomsinSceneMap).end()));
|
---|
872 | return returnAtomIds;
|
---|
873 | }
|
---|