source: src/UIElements/Views/Qt4/Qt3D/GLWorldView.cpp@ 3927ef

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 3927ef was 3927ef, checked in by Frederik Heber <heber@…>, 13 years ago

GL: molecule selection boxes

  • only instantiated for selected molecules
  • no size/position changes tracked yet!
  • Property mode set to 100644
File size: 40.6 KB
Line 
1/*
2 * Project: MoleCuilder
3 * Description: creates and alters molecular systems
4 * Copyright (C) 2010-2012 University of Bonn. All rights reserved.
5 * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
6 */
7
8/*
9 * GLWorldView.cpp
10 *
11 * Created on: Aug 1, 2010
12 * Author: heber
13 */
14
15// include config.h
16#ifdef HAVE_CONFIG_H
17#include <config.h>
18#endif
19
20#include "GLWorldView.hpp"
21
22#include <Qt/qevent.h>
23
24#include "GLWorldScene.hpp"
25
26#include "CodePatterns/MemDebug.hpp"
27
28#include "CodePatterns/Log.hpp"
29#include "CodePatterns/Observer/Notification.hpp"
30
31#include "World.hpp"
32
33GLWorldView::GLWorldView(QWidget *parent)
34 : QGLView(parent), Observer("GLWorldView"), worldscene(NULL), changesPresent(false)
35{
36 worldscene = new GLWorldScene(this);
37
38 setOption(QGLView::ObjectPicking, true);
39
40 connect(worldscene, SIGNAL(changeOccured()), this, SLOT(changeSignalled()));
41 connect(worldscene, SIGNAL(changed()), this, SIGNAL(changed()));
42 connect(this, SIGNAL(atomInserted(const atom *)), worldscene, SLOT(atomInserted(const atom *)));
43 connect(this, SIGNAL(atomRemoved(const atom *)), worldscene, SLOT(atomRemoved(const atom *)));
44 connect(this, SIGNAL(worldSelectionChanged()), worldscene, SLOT(worldSelectionChanged()));
45 connect(this, SIGNAL(moleculeRemoved(const molecule *)), worldscene, SLOT(moleculeRemoved(const molecule *)));
46 connect(this, SIGNAL(changed()), this, SLOT(updateGL()));
47
48 // sign on to changes in the world
49 World::getInstance().signOn(this);
50 World::getInstance().signOn(this, World::AtomInserted);
51 World::getInstance().signOn(this, World::AtomRemoved);
52 World::getInstance().signOn(this, World::AtomPositionChanged);
53 World::getInstance().signOn(this, World::MoleculeRemoved);
54 World::getInstance().signOn(this, World::SelectionChanged);
55}
56
57GLWorldView::~GLWorldView()
58{
59 World::getInstance().signOff(this);
60 World::getInstance().signOff(this, World::AtomInserted);
61 World::getInstance().signOff(this, World::AtomRemoved);
62 World::getInstance().signOff(this, World::AtomPositionChanged);
63 World::getInstance().signOff(this, World::MoleculeRemoved);
64 World::getInstance().signOff(this, World::SelectionChanged);
65 delete worldscene;
66}
67
68/**
69 * Update operation which can be invoked by the observable (which should be the
70 * change tracker here).
71 */
72void GLWorldView::update(Observable *publisher)
73{
74 emit changed();
75}
76
77/**
78 * The observable can tell when it dies.
79 */
80void GLWorldView::subjectKilled(Observable *publisher) {}
81
82/** Listen to specific changes to the world.
83 *
84 * @param publisher ref to observable.
85 * @param notification type of notification
86 */
87void GLWorldView::recieveNotification(Observable *publisher, Notification_ptr notification)
88{
89 switch (notification->getChannelNo()) {
90 case World::AtomInserted:
91 {
92 const atom *_atom = World::getInstance().lastChanged<atom>();
93#ifdef LOG_OBSERVER
94 observerLog().addMessage() << "++ Observer " << observerLog().getName(this) << " received notification that atom "+toString(_atom->getId())+" has been inserted.";
95#endif
96 emit atomInserted(_atom);
97 break;
98 }
99 case World::AtomRemoved:
100 {
101 const atom *_atom = World::getInstance().lastChanged<atom>();
102#ifdef LOG_OBSERVER
103 observerLog().addMessage() << "++ Observer " << observerLog().getName(this) << " received notification that atom "+toString(_atom->getId())+" has been removed.";
104#endif
105 emit atomRemoved(_atom);
106 break;
107 }
108 case World::AtomPositionChanged:
109 {
110 const atom *_atom = World::getInstance().lastChanged<atom>();
111#ifdef LOG_OBSERVER
112 observerLog().addMessage() << "++ Observer " << observerLog().getName(this) << " received notification that atom "+toString(_atom->getId())+" has changed its position.";
113#endif
114 emit changed();
115 break;
116 }
117 case World::SelectionChanged:
118 {
119#ifdef LOG_OBSERVER
120 observerLog().addMessage() << "++ Observer " << observerLog().getName(this) << " received notification that selection has changed.";
121#endif
122 emit worldSelectionChanged();
123 break;
124 }
125 case World::MoleculeRemoved:
126 {
127 const molecule *_molecule = World::getInstance().lastChanged<molecule>();
128#ifdef LOG_OBSERVER
129 observerLog().addMessage() << "++ Observer " << observerLog().getName(this) << " received notification that molecule "+toString(_molecule->getId())+" has been removed.";
130#endif
131 emit moleculeRemoved(_molecule);
132 break;
133 }
134 default:
135 ASSERT(0, "GLWorldView::recieveNotification() - we cannot get here.");
136 break;
137 }
138}
139
140void GLWorldView::initializeGL(QGLPainter *painter)
141{
142 worldscene->initialize(this, painter);
143 changesPresent = false;
144}
145
146void GLWorldView::paintGL(QGLPainter *painter)
147{
148 if (changesPresent) {
149 initializeGL(painter);
150 changesPresent = false;
151 }
152 worldscene->draw(painter);
153}
154
155void GLWorldView::keyPressEvent(QKeyEvent *e)
156{
157 if (e->key() == Qt::Key_Tab) {
158 // The Tab key turns the ShowPicking option on and off,
159 // which helps show what the pick buffer looks like.
160 setOption(QGLView::ShowPicking, ((options() & QGLView::ShowPicking) == 0));
161 updateGL();
162 }
163 QGLView::keyPressEvent(e);
164}
165
166void GLWorldView::changeSignalled()
167{
168 changesPresent = true;
169}
170
171
172//#include <GL/glu.h>
173//#include <QtGui/qslider.h>
174//#include <QtGui/qevent.h>
175//
176//#include "ui_dialoglight.h"
177//
178//#include "CodePatterns/MemDebug.hpp"
179//
180//#include <iostream>
181//#include <boost/shared_ptr.hpp>
182//
183//#include "LinearAlgebra/Line.hpp"
184//#include "Atom/atom.hpp"
185//#include "Bond/bond.hpp"
186//#include "Element/element.hpp"
187//#include "molecule.hpp"
188//#include "Element/periodentafel.hpp"
189//#include "World.hpp"
190//
191//#if defined(Q_CC_MSVC)
192//#pragma warning(disable:4305) // init: truncation from const double to float
193//#endif
194//
195//
196//GLMoleculeView::GLMoleculeView(QWidget *parent) :
197// QGLWidget(parent), Observer("GLMoleculeView"), X(Vector(1,0,0)), Y(Vector(0,1,0)), Z(Vector(0,0,1))
198//{
199// xRot = yRot = zRot = 0.0; // default object rotation
200// scale = 5.; // default object scale
201// object = 0;
202// LightPosition[0] = 0.0f;
203// LightPosition[1] = 2.0f;
204// LightPosition[2] = 2.0f;
205// LightPosition[3] = 0.0f;
206// LightDiffuse[0] = 0.5f;
207// LightDiffuse[1] = 0.5f;
208// LightDiffuse[2] = 0.5f;
209// LightDiffuse[3] = 0.0f;
210// LightAmbient[0] = 0.0f;
211// LightAmbient[1] = 0.0f;
212// LightAmbient[2] = 0.0f;
213// LightAmbient[3] = 0.0f;
214//
215// SelectionColor[0] = 0;
216// SelectionColor[1] = 128;
217// SelectionColor[2] = 128;
218//
219// MultiViewEnabled = true;
220//
221// isSignaller = false;
222//
223// World::getInstance().signOn(this);
224//}
225//
226///** Destructor of GLMoleculeView.
227// * Free's the CallList.
228// */
229//GLMoleculeView::~GLMoleculeView()
230//{
231// makeCurrent();
232// glDeleteLists( object, 1 );
233//
234// World::getInstance().signOff(this);
235//}
236//
237///** Paints the conents of the OpenGL window.
238// * Clears the GL buffers, enables lighting and depth.
239// * Window is either quartered (if GLMoleculeView::MultiViewEnabled) and xy, xz, yz planar views
240// * are added. Uses the CallList, constructed during InitializeGL().
241// */
242//void GLMoleculeView::paintGL()
243//{
244// Vector spot;
245//
246// glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
247// glShadeModel(GL_SMOOTH); // Enable Smooth Shading
248// glEnable(GL_LIGHTING); // Enable Light One
249// glEnable(GL_DEPTH_TEST); // Enables Depth Testing
250// glDepthFunc(GL_LEQUAL); // The Type Of Depth Testing To Do
251// glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); // Really Nice Perspective Calculations
252//
253// // 3d viewport
254// if (MultiViewEnabled)
255// glViewport( 0, 0, (GLint)width/2, (GLint)height/2 );
256// else
257// glViewport( 0, 0, (GLint)width, (GLint)height );
258// glMatrixMode( GL_PROJECTION );
259// glLoadIdentity();
260// glFrustum( -1.0, 1.0, -1.0, 1.0, 1.0, 50.0 );
261// glMatrixMode( GL_MODELVIEW );
262// glLoadIdentity();
263//
264// // calculate point of view and direction
265// glTranslated(position[0],position[1],position[2]);
266// glTranslated(0.0, 0.0, -scale);
267// glRotated(xRot, 1.0, 0.0, 0.0);
268// glRotated(yRot, 0.0, 1.0, 0.0);
269// glRotated(zRot, 0.0, 0.0, 1.0);
270//
271// // render scene
272// glCallList(object);
273//
274// // enable light
275// glLightfv(GL_LIGHT1, GL_AMBIENT, LightAmbient); // Setup The Ambient Light
276// glLightfv(GL_LIGHT1, GL_DIFFUSE, LightDiffuse); // Setup The Diffuse Light
277// glLightfv(GL_LIGHT1, GL_POSITION,LightPosition); // Position The Light
278// glEnable(GL_LIGHT1); // Enable Light One
279//
280// if (MultiViewEnabled) {
281// // xy view port
282// glViewport( (GLint)width/2, 0, (GLint)width/2, (GLint)height/2 );
283// glMatrixMode( GL_PROJECTION );
284// glLoadIdentity();
285// glScalef(1./scale, 1./scale,1./scale);
286// glOrtho(0, width/2, 0, height/2, 0,0);
287// glMatrixMode( GL_MODELVIEW );
288// glLoadIdentity();
289//
290// // calculate point of view and direction
291// view = position;
292// spot = Vector(0.,0.,scale);
293// top = Vector(0.,1.,0.);
294// gluLookAt(
295// spot[0], spot[1], spot[2],
296// view[0], view[1], view[2],
297// top[0], top[1], top[2]);
298//
299// // enable light
300// glLightfv(GL_LIGHT1, GL_AMBIENT, LightAmbient); // Setup The Ambient Light
301// glLightfv(GL_LIGHT1, GL_DIFFUSE, LightDiffuse); // Setup The Diffuse Light
302// glLightfv(GL_LIGHT1, GL_POSITION,LightPosition); // Position The Light
303// glEnable(GL_LIGHT1); // Enable Light One
304//
305// // render scene
306// glCallList(object);
307//
308// // xz viewport
309// glViewport( 0, (GLint)height/2, (GLint)width/2, (GLint)height/2 );
310// glMatrixMode( GL_PROJECTION );
311// glLoadIdentity();
312// glScalef(1./scale, 1./scale,1./scale);
313// glOrtho(0, width/2, 0, height/2, 0,0);
314// glMatrixMode( GL_MODELVIEW );
315// glLoadIdentity();
316//
317// // calculate point of view and direction
318// view = position;
319// spot = Vector(0.,scale,0.);
320// top = Vector(1.,0.,0.);
321// gluLookAt(
322// spot[0], spot[1], spot[2],
323// view[0], view[1], view[2],
324// top[0], top[1], top[2]);
325//
326// // enable light
327// glLightfv(GL_LIGHT1, GL_AMBIENT, LightAmbient); // Setup The Ambient Light
328// glLightfv(GL_LIGHT1, GL_DIFFUSE, LightDiffuse); // Setup The Diffuse Light
329// glLightfv(GL_LIGHT1, GL_POSITION,LightPosition); // Position The Light
330// glEnable(GL_LIGHT1); // Enable Light One
331//
332// // render scene
333// glCallList(object);
334//
335// //yz viewport
336// glViewport( (GLint)width/2, (GLint)height/2, (GLint)width/2, (GLint)height/2 );
337// glMatrixMode( GL_PROJECTION );
338// glLoadIdentity();
339// glScalef(1./scale, 1./scale,1./scale);
340// glOrtho(0, width/2, 0, height/2, 0,0);
341// glMatrixMode( GL_MODELVIEW );
342// glLoadIdentity();
343//
344// // calculate point of view and direction
345// view= position;
346// spot = Vector(scale,0.,0.);
347// top = Vector(0.,1.,0.);
348// gluLookAt(
349// spot[0], spot[1], spot[2],
350// view[0], view[1], view[2],
351// top[0], top[1], top[2]);
352//
353// // enable light
354// glLightfv(GL_LIGHT1, GL_AMBIENT, LightAmbient); // Setup The Ambient Light
355// glLightfv(GL_LIGHT1, GL_DIFFUSE, LightDiffuse); // Setup The Diffuse Light
356// glLightfv(GL_LIGHT1, GL_POSITION,LightPosition); // Position The Light
357// glEnable(GL_LIGHT1); // Enable Light One
358//
359// // render scene
360// glCallList(object);
361// }
362// //CoordinatesBar->setText( QString ("X: %1, Y: %2, Z: %3").arg(position[0]).arg(position[1]).arg(position[2]) );
363//}
364//
365////void polarView{GLdouble distance, GLdouble twist,
366//// GLdouble elevation, GLdouble azimuth)
367////{
368//// glTranslated(0.0, 0.0, -distance);
369//// glRotated(-twist, 0.0, 0.0, 1.0);
370//// glRotated(-elevation, 1.0, 0.0, 0.0);
371//// glRotated(azimuth, 0.0, 0.0, 1.0);
372////}
373//
374///** Make a sphere.
375// * \param x position
376// * \param radius radius
377// * \param color[3] color rgb values
378// */
379//void GLMoleculeView::makeSphere(const Vector &x, double radius, const unsigned char color[3])
380//{
381// float blueMaterial[] = { 255./(float)color[0], 255./(float)color[1], 255./(float)color[2], 1 }; // need to recast from [0,255] with integers into [0,1] with floats
382// GLUquadricObj* q = gluNewQuadric ();
383// gluQuadricOrientation(q, GLU_OUTSIDE);
384//
385// std::cout << "Setting sphere at " << x << " with color r"
386// << (int)color[0] << ",g" << (int)color[1] << ",b" << (int)color[2] << "." << endl;
387//
388// glPushMatrix();
389// glTranslatef( x[0], x[1], x[2]);
390//// glRotatef( xRot, 1.0, 0.0, 0.0);
391//// glRotatef( yRot, 0.0, 1.0, 0.0);
392//// glRotatef( zRot, 0.0, 0.0, 1.0);
393// glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, blueMaterial);
394// gluSphere (q, (GLdouble)radius, 10, 10);
395// glPopMatrix();
396//}
397//
398///** Make a cylinder.
399// * \param x origin
400// * \param y direction
401// * \param radius thickness
402// * \param height length
403// * \color[3] color rgb values
404// */
405//void GLMoleculeView::makeCylinder(const Vector &x, const Vector &y, double radius, double height, const unsigned char color[3])
406//{
407// float blueMaterial[] = { 255./(float)color[0], 255./(float)color[1], 255./(float)color[2], 1 };
408// GLUquadricObj* q = gluNewQuadric ();
409// gluQuadricOrientation(q, GLU_OUTSIDE);
410// Vector a,b;
411// Vector OtherAxis;
412// double alpha;
413// a = x - y;
414// // construct rotation axis
415// b = a;
416// b.VectorProduct(Z);
417// Line axis(zeroVec, b);
418// // calculate rotation angle
419// alpha = a.Angle(Z);
420// // construct other axis to check right-hand rule
421// OtherAxis = b;
422// OtherAxis.VectorProduct(Z);
423// // assure right-hand rule for the rotation
424// if (a.ScalarProduct(OtherAxis) < MYEPSILON)
425// alpha = M_PI-alpha;
426// // check
427// Vector a_rotated = axis.rotateVector(a, alpha);
428// std::cout << "Setting cylinder from "// << x << " to " << y
429// << a << " to " << a_rotated << " around " << b << " by " << alpha/M_PI*180. << ", respectively, "
430// << " with color r"
431// << (int)color[0] << ",g" << (int)color[1] << ",b" << (int)color[2] << "." << endl;
432//
433// glPushMatrix();
434// glTranslatef( x[0], x[1], x[2]);
435// glRotatef( alpha/M_PI*180., b[0], b[1], b[2]);
436// glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, blueMaterial);
437// gluCylinder (q, (GLdouble)radius, (GLdouble)radius, (GLdouble)height, 10, 10);
438// glPopMatrix();
439//}
440//
441///** Defines the display CallList.
442// * Goes through all molecules and their atoms and adds spheres for atoms and cylinders
443// * for bonds. Heeds GLMoleculeView::SelectedAtom and GLMoleculeView::SelectedMolecule.
444// */
445//void GLMoleculeView::initializeGL()
446//{
447// double x[3] = {-1, 0, -10};
448// unsigned char white[3] = {255,255,255};
449// Vector Position, OtherPosition;
450// QSize window = size();
451// width = window.width();
452// height = window.height();
453// std::cout << "Setting width to " << width << " and height to " << height << std::endl;
454// GLfloat shininess[] = { 0.0 };
455// GLfloat specular[] = { 0, 0, 0, 1 };
456// glClearColor(0.0f, 0.0f, 0.0f, 0.0f); // Let OpenGL clear to black
457// object = glGenLists(1);
458// glNewList( object, GL_COMPILE );
459// glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, specular);
460// glMaterialfv(GL_FRONT_AND_BACK, GL_SHININESS, shininess);
461//
462// const std::vector<molecule*> &molecules = World::getInstance().getAllMolecules();
463//
464// if (molecules.size() > 0) {
465// for (std::vector<molecule*>::const_iterator Runner = molecules.begin();
466// Runner != molecules.end();
467// Runner++) {
468// for (molecule::const_iterator atomiter = (*Runner)->begin();
469// atomiter != (*Runner)->end();
470// ++atomiter) {
471// // create atom
472// const element *ptr = (*atomiter)->getType();
473// boost::shared_ptr<Vector> MolCenter((*Runner)->DetermineCenterOfGravity());
474// Position = (*atomiter)->getPosition() - *MolCenter;
475// const unsigned char* color = NULL;
476// if ((World::getInstance().isSelected(*atomiter)) || (World::getInstance().isSelected((*Runner))))
477// color = SelectionColor;
478// else
479// color = ptr->getColor();
480// makeSphere(Position, ptr->getVanDerWaalsRadius()*0.25, color);
481//
482// // create bonds
483// const BondList &bonds = (*atomiter)->getListOfBonds();
484// for (BondList::const_iterator bonditer = bonds.begin();
485// bonditer != bonds.end();
486// ++bonditer) {
487// if ((*bonditer)->leftatom->getId() == (*atomiter)->getId()) {
488// Position = (*bonditer)->leftatom->getPosition() - *MolCenter;
489// OtherPosition = (*bonditer)->rightatom->getPosition() - *MolCenter;
490// const double distance = sqrt(Position.DistanceSquared(OtherPosition))/2.;
491// const unsigned char *color1 = (*bonditer)->leftatom->getType()->getColor();
492// const unsigned char *color2 = (*bonditer)->rightatom->getType()->getColor();
493// makeCylinder(Position, OtherPosition, 0.1, distance, color1);
494// makeCylinder(OtherPosition, Position, 0.1, distance, color2);
495// }
496// }
497// }
498// }
499// } else {
500// makeSphere( x,1, white);
501// }
502// glEndList();
503//}
504//
505//
506///* ================================== SLOTS ============================== */
507//
508///** Initializes some public variables.
509// * \param *ptr pointer to QLabel statusbar
510// */
511//void GLMoleculeView::init(QLabel *ptr)
512//{
513// StatusBar = ptr;
514//}
515//
516///** Initializes the viewport statusbar.
517// * \param *ptr pointer to QLabel for showing view pointcoordinates.
518// */
519//void GLMoleculeView::initCoordinates(QLabel *ptr)
520//{
521// CoordinatesBar = ptr;
522//}
523//
524///** Slot to be called when to initialize GLMoleculeView::MolData.
525// */
526//void GLMoleculeView::createView( )
527//{
528// initializeGL();
529// updateGL();
530//}
531//
532///** Slot of window is resized.
533// * Copies new width and height to GLMoleculeView::width and GLMoleculeView::height and calls updateGL().
534// * \param w new width of window
535// * \param h new height of window
536// */
537//void GLMoleculeView::resizeGL( int w, int h )
538//{
539// width = w;
540// height = h;
541// updateGL();
542//}
543//
544///** Sets x rotation angle.
545// * sets GLMoleculeView::xRot and calls updateGL().
546// * \param degrees new rotation angle in degrees
547// */
548//void GLMoleculeView::setXRotation( int degrees )
549//{
550// xRot = (GLfloat)(degrees % 360);
551// updateGL();
552//}
553//
554//
555///** Sets y rotation angle.
556// * sets GLMoleculeView::yRot and calls updateGL().
557// * \param degrees new rotation angle in degrees
558// */
559//void GLMoleculeView::setYRotation( int degrees )
560//{
561// yRot = (GLfloat)(degrees % 360);
562// updateGL();
563//}
564//
565//
566///** Sets z rotation angle.
567// * sets GLMoleculeView::zRot and calls updateGL().
568// * \param degrees new rotation angle in degrees
569// */
570//void GLMoleculeView::setZRotation( int degrees )
571//{
572// zRot = (GLfloat)(degrees % 360);
573// updateGL();
574//}
575//
576///** Sets the scale of the scene.
577// * sets GLMoleculeView::scale and calls updateGL().
578// * \param distance distance divided by 100 is the new scale
579// */
580//void GLMoleculeView::setScale( int distance )
581//{
582// scale = (GLfloat)(distance / 100.);
583// updateGL();
584//}
585//
586///** Update the ambient light.
587// * \param light[4] light strength per axis and position (w)
588// */
589//void GLMoleculeView::setLightAmbient( int *light )
590//{
591// for(int i=0;i<4;i++)
592// LightAmbient[i] = light[i];
593// updateGL();
594//}
595//
596///** Update the diffuse light.
597// * \param light[4] light strength per axis and position (w)
598// */
599//void GLMoleculeView::setLightDiffuse( int *light )
600//{
601// for(int i=0;i<4;i++)
602// LightDiffuse[i] = light[i];
603// updateGL();
604//}
605//
606///** Update the position of light.
607// * \param light[4] light strength per axis and position (w)
608// */
609//void GLMoleculeView::setLightPosition( int *light )
610//{
611// for(int i=0;i<4;i++)
612// LightPosition[i] = light[i];
613// updateGL();
614//}
615//
616///** Toggles the boolean GLMoleculeView::MultiViewEnabled.
617// * Flips the boolean and calls updateGL().
618// */
619//void GLMoleculeView::toggleMultiViewEnabled ( )
620//{
621// MultiViewEnabled = !MultiViewEnabled;
622// cout << "Setting MultiView to " << MultiViewEnabled << "." << endl;
623// updateGL();
624//}
625//
626///** Launch a dialog to configure the lights.
627// */
628//void GLMoleculeView::createDialogLight()
629//{
630//// Ui_DialogLight *Lights = new Ui_DialogLight();
631//// if (Lights == NULL)
632//// return;
633//// // Set up the dynamic dialog here
634//// QLineEdit *Field = NULL;
635//// Field = Lights->findChild<QLineEdit *>("LightPositionX");
636//// if (Field) Field->setText( QString("%1").arg(LightPosition[0]) );
637//// Field = Lights->findChild<QLineEdit *>("LightPositionY");
638//// if (Field) Field->setText( QString("%1").arg(LightPosition[1]) );
639//// Field = Lights->findChild<QLineEdit *>("LightPositionZ");
640//// if (Field) Field->setText( QString("%1").arg(LightPosition[2]) );
641//// Field = Lights->findChild<QLineEdit *>("LightPositionW");
642//// if (Field) Field->setText( QString("%1").arg(LightPosition[3]) );
643////
644//// Field = Lights->findChild<QLineEdit *>("LightDiffuseX");
645//// if (Field) Field->setText( QString("%1").arg(LightDiffuse[0]) );
646//// Field = Lights->findChild<QLineEdit *>("LightDiffuseY");
647//// if (Field) Field->setText( QString("%1").arg(LightDiffuse[1]) );
648//// Field = Lights->findChild<QLineEdit *>("LightDiffuseZ");
649//// if (Field) Field->setText( QString("%1").arg(LightDiffuse[2]) );
650//// Field = Lights->findChild<QLineEdit *>("LightDiffuseW");
651//// if (Field) Field->setText( QString("%1").arg(LightDiffuse[3]) );
652////
653//// Field = Lights->findChild<QLineEdit *>("LightAmbientX");
654//// if (Field) Field->setText( QString("%1").arg(LightAmbient[0]) );
655//// Field = Lights->findChild<QLineEdit *>("LightAmbientY");
656//// if (Field) Field->setText( QString("%1").arg(LightAmbient[1]) );
657//// Field = Lights->findChild<QLineEdit *>("LightAmbientZ");
658//// if (Field) Field->setText( QString("%1").arg(LightAmbient[2]) );
659//// Field = Lights->findChild<QLineEdit *>("LightAmbientW");
660//// if (Field) Field->setText( QString("%1").arg(LightAmbient[3]) );
661////
662//// if ( Lights->exec() ) {
663//// //cout << "User accepted.\n";
664//// // The user accepted, act accordingly
665//// Field = Lights->findChild<QLineEdit *>("LightPositionX");
666//// if (Field) LightPosition[0] = Field->text().toDouble();
667//// Field = Lights->findChild<QLineEdit *>("LightPositionY");
668//// if (Field) LightPosition[1] = Field->text().toDouble();
669//// Field = Lights->findChild<QLineEdit *>("LightPositionZ");
670//// if (Field) LightPosition[2] = Field->text().toDouble();
671//// Field = Lights->findChild<QLineEdit *>("LightPositionW");
672//// if (Field) LightPosition[3] = Field->text().toDouble();
673////
674//// Field = Lights->findChild<QLineEdit *>("LightDiffuseX");
675//// if (Field) LightDiffuse[0] = Field->text().toDouble();
676//// Field = Lights->findChild<QLineEdit *>("LightDiffuseY");
677//// if (Field) LightDiffuse[1] = Field->text().toDouble();
678//// Field = Lights->findChild<QLineEdit *>("LightDiffuseZ");
679//// if (Field) LightDiffuse[2] = Field->text().toDouble();
680//// Field = Lights->findChild<QLineEdit *>("LightDiffuseW");
681//// if (Field) LightDiffuse[3] = Field->text().toDouble();
682////
683//// Field = Lights->findChild<QLineEdit *>("LightAmbientX");
684//// if (Field) LightAmbient[0] = Field->text().toDouble();
685//// Field = Lights->findChild<QLineEdit *>("LightAmbientY");
686//// if (Field) LightAmbient[1] = Field->text().toDouble();
687//// Field = Lights->findChild<QLineEdit *>("LightAmbientZ");
688//// if (Field) LightAmbient[2] = Field->text().toDouble();
689//// Field = Lights->findChild<QLineEdit *>("LightAmbientW");
690//// if (Field) LightAmbient[3] = Field->text().toDouble();
691//// updateGL();
692//// } else {
693//// //cout << "User reclined.\n";
694//// }
695//// delete(Lights);
696//}
697//
698///** Slot for event of pressed mouse button.
699// * Switch discerns between buttons and stores position of event in GLMoleculeView::LeftButtonPos,
700// * GLMoleculeView::MiddleButtonPos or GLMoleculeView::RightButtonPos.
701// * \param *event structure containing information of the event
702// */
703//void GLMoleculeView::mousePressEvent(QMouseEvent *event)
704//{
705// std::cout << "MousePressEvent." << endl;
706// QPoint *pos = NULL;
707// switch (event->button()) { // get the right array
708// case Qt::LeftButton:
709// pos = &LeftButtonPos;
710// std::cout << "Left Button" << endl;
711// break;
712// case Qt::MidButton:
713// pos = &MiddleButtonPos;
714// std::cout << "Middle Button" << endl;
715// break;
716// case Qt::RightButton:
717// pos = &RightButtonPos;
718// std::cout << "Right Button" << endl;
719// break;
720// default:
721// break;
722// }
723// if (pos) { // store the position
724// pos->setX(event->pos().x());
725// pos->setY(event->pos().y());
726// std::cout << "Stored src position is (" << pos->x() << "," << pos->y() << ")." << endl;
727// } else {
728// std::cout << "pos is NULL." << endl;
729// }
730//}
731//
732///** Slot for event of pressed mouse button.
733// * Switch discerns between buttons:
734// * -# Left Button: Rotates the view of the GLMoleculeView, relative to GLMoleculeView::LeftButtonPos.
735// * -# Middle Button: nothing
736// * -# Right Button: Shifts the selected molecule or atom, relative to GLMoleculeView::RightButtonPos.
737// * \param *event structure containing information of the event
738// */
739//void GLMoleculeView::mouseReleaseEvent(QMouseEvent *event)
740//{
741// std::cout << "MouseReleaseEvent." << endl;
742// QPoint *srcpos = NULL;
743// QPoint destpos = event->pos();
744// int Width = (MultiViewEnabled) ? width/2 : width;
745// int Height = (MultiViewEnabled) ? height/2 : height;
746// std::cout << "Received dest position is (" << destpos.x() << "," << destpos.y() << ")." << endl;
747// switch (event->button()) { // get the right array
748// case Qt::LeftButton: // LeftButton rotates the view
749// srcpos = &LeftButtonPos;
750// std::cout << "Left Button" << endl;
751// if (srcpos) { // subtract the position and act
752// std::cout << "Stored src position is (" << srcpos->x() << "," << srcpos->y() << ")." << endl;
753// destpos -= *srcpos;
754// std::cout << "Resulting diff position is (" << destpos.x() << "," << destpos.y() << ")." << endl;
755// std::cout << "Width and Height are " << Width << "," << Height << "." << endl;
756//
757// int pos = (int)floor((double)srcpos->x()/(double)Width) + ((int)floor((double)srcpos->y()/(double)Height))*2;
758// if ((MultiViewEnabled) && (pos != 2)) { // means four regions, and we are in a shifting one
759// // switch between three regions
760// // decide into which of the four screens the initial click has been made
761// std::cout << "Position is " << pos << "." << endl;
762// switch(pos) {
763// case 0: // lower left = xz
764// position[0] += -destpos.y()/100.;
765// position[2] += destpos.x()/100.;
766// break;
767// case 1: // lower right = yz
768// position[1] += -destpos.y()/100.;
769// position[2] += -destpos.x()/100.;
770// break;
771// case 2: // upper left = projected
772// std::cout << "This is impossible: Shifting in the projected region, we should rotate!." << endl;
773// break;
774// case 3: // upper right = xy
775// position[0] += destpos.x()/100.;
776// position[1] += -destpos.y()/100.;
777// break;
778// default:
779// std::cout << "click was not in any of the four regions." << endl;
780// break;
781// }
782// updateGL();
783// } else { // we are in rotation region
784// QWidget *Parent = parentWidget();
785// QSlider *sliderX = Parent->findChild<QSlider *>("sliderX");
786// QSlider *sliderY = Parent->findChild<QSlider *>("sliderY");
787// std::cout << sliderX << " and " << sliderY << endl;
788// if (sliderX) {
789// int xrange = sliderX->maximum() - sliderX->minimum();
790// double xValue = ((destpos.x() + Width) % Width);
791// xValue *= (double)xrange/(double)Width;
792// xValue += sliderX->value();
793// int xvalue = (int) xValue % xrange;
794// std::cout << "Setting x to " << xvalue << " within range " << xrange << "." << endl;
795// setXRotation(xvalue);
796// sliderX->setValue(xvalue);
797// } else {
798// std::cout << "sliderX is NULL." << endl;
799// }
800// if (sliderY) {
801// int yrange = sliderY->maximum() - sliderY->minimum();
802// double yValue = ((destpos.y() + Height) % Height);
803// yValue *= (double)yrange/(double)Height;
804// yValue += sliderY->value();
805// int yvalue = (int) yValue % yrange;
806// std::cout << "Setting y to " << yvalue << " within range " << yrange << "." << endl;
807// setYRotation(yvalue);
808// sliderY->setValue(yvalue);
809// } else {
810// std::cout << "sliderY is NULL." << endl;
811// }
812// }
813// } else {
814// std::cout << "srcpos is NULL." << endl;
815// }
816// break;
817//
818// case Qt::MidButton: // MiddleButton has no function so far
819// srcpos = &MiddleButtonPos;
820// std::cout << "Middle Button" << endl;
821// if (srcpos) { // subtract the position and act
822// QWidget *Parent = parentWidget();
823// QSlider *sliderZ = Parent->findChild<QSlider *>("sliderZ");
824// QSlider *sliderScale = Parent->findChild<QSlider *>("sliderScale");
825// std::cout << sliderZ << " and " << sliderScale << endl;
826// std::cout << "Stored src position is (" << srcpos->x() << "," << srcpos->y() << ")." << endl;
827// destpos -= *srcpos;
828// std::cout << "Resulting diff position is (" << destpos.x() << "," << destpos.y() << ")." << endl;
829// std::cout << "Width and Height are " << Width << "," << Height << "." << endl;
830// if (sliderZ) {
831// int xrange = sliderZ->maximum() - sliderZ->minimum();
832// double xValue = ((destpos.x() + Width) % Width);
833// xValue *= (double)xrange/(double)Width;
834// xValue += sliderZ->value();
835// int xvalue = (int) xValue % xrange;
836// std::cout << "Setting x to " << xvalue << " within range " << xrange << "." << endl;
837// setZRotation(xvalue);
838// sliderZ->setValue(xvalue);
839// } else {
840// std::cout << "sliderZ is NULL." << endl;
841// }
842// if (sliderScale) {
843// int yrange = sliderScale->maximum() - sliderScale->minimum();
844// double yValue = ((destpos.y() + Height) % Height);
845// yValue *= (double)yrange/(double)Height;
846// yValue += sliderScale->value();
847// int yvalue = (int) yValue % yrange;
848// std::cout << "Setting y to " << yvalue << " within range " << yrange << "." << endl;
849// setScale(yvalue);
850// sliderScale->setValue(yvalue);
851// } else {
852// std::cout << "sliderScale is NULL." << endl;
853// }
854// } else {
855// std::cout << "srcpos is NULL." << endl;
856// }
857// break;
858// break;
859//
860// case Qt::RightButton: // RightButton moves eitstdher the selected molecule or atom
861// srcpos = &RightButtonPos;
862// std::cout << "Right Button" << endl;
863// if (srcpos) { // subtract the position and act
864// std::cout << "Stored src position is (" << srcpos->x() << "," << srcpos->y() << ")." << endl;
865// destpos -= *srcpos;
866// std::cout << "Resulting diff position is (" << destpos.x() << "," << destpos.y() << ")." << endl;
867// std::cout << "Width and Height are " << Width << "," << Height << "." << endl;
868// if (MultiViewEnabled) {
869// // which vector to change
870// Vector SelectedPosition;
871// const std::vector<atom*> &SelectedAtoms = World::getInstance().getSelectedAtoms();
872// const std::vector<molecule*> &SelectedMolecules = World::getInstance().getSelectedMolecules();
873// if (SelectedMolecules.size()) {
874// if (SelectedAtoms.size())
875// SelectedPosition = (*SelectedAtoms.begin())->getPosition();
876// else
877// SelectedPosition = (*(*SelectedMolecules.begin())->begin())->getPosition();
878// }
879// // decide into which of the four screens the initial click has been made
880// int pos = (int)floor((double)srcpos->x()/(double)Width) + ((int)floor((double)srcpos->y()/(double)Height))*2;
881// if (!SelectedPosition.IsZero()) {
882// std::cout << "Position is " << pos << "." << endl;
883// switch(pos) {
884// case 0: // lower left = xz
885// SelectedPosition[0] += -destpos.y()/100.;
886// SelectedPosition[2] += destpos.x()/100.;
887// break;
888// case 1: // lower right = yz
889// SelectedPosition[1] += -destpos.y()/100.;
890// SelectedPosition[2] += -destpos.x()/100.;
891// break;
892// case 2: // upper left = projected
893// SelectedPosition[0] += destpos.x()/100.;
894// SelectedPosition[1] += destpos.y()/100.;
895// SelectedPosition[2] += destpos.y()/100.;
896// break;
897// case 3: // upper right = xy
898// SelectedPosition[0] += destpos.x()/100.;
899// SelectedPosition[1] += -destpos.y()/100.;
900// break;
901// default:
902// std::cout << "click was not in any of the four regions." << endl;
903// break;
904// }
905// } else {
906// std::cout << "Nothing selected." << endl;
907// }
908// // update Tables
909// if (SelectedMolecules.size()) {
910// isSignaller = true;
911// if (SelectedAtoms.size())
912// emit notifyAtomChanged( (*SelectedMolecules.begin()), (*SelectedAtoms.begin()), AtomPosition);
913// else
914// emit notifyMoleculeChanged( (*SelectedMolecules.begin()), MoleculePosition );
915// }
916// // update graphic
917// initializeGL();
918// updateGL();
919// } else {
920// cout << "MultiView is not enabled." << endl;
921// }
922// } else {
923// cout << "srcpos is NULL." << endl;
924// }
925// break;
926//
927// default:
928// break;
929// }
930//}
931//
932///* ======================================== SLOTS ================================ */
933//
934///** Hear announcement of selected molecule.
935// * \param *mol pointer to selected molecule
936// */
937//void GLMoleculeView::hearMoleculeSelected(molecule *mol)
938//{
939// if (isSignaller) { // if we emitted the signal, return
940// isSignaller = false;
941// return;
942// }
943// initializeGL();
944// updateGL();
945//};
946//
947///** Hear announcement of selected atom.
948// * \param *mol pointer to molecule containing atom
949// * \param *Walker pointer to selected atom
950// */
951//void GLMoleculeView::hearAtomSelected(molecule *mol, atom *Walker)
952//{
953// if (isSignaller) { // if we emitted the signal, return
954// isSignaller = false;
955// return;
956// }
957// initializeGL();
958// updateGL();
959//};
960//
961///** Hear announcement of changed molecule.
962// * \param *mol pointer to changed molecule
963// * \param type of change
964// */
965//void GLMoleculeView::hearMoleculeChanged(molecule *mol, enum ChangesinMolecule type)
966//{
967// if (isSignaller) { // if we emitted the signal, return
968// isSignaller = false;
969// return;
970// }
971// initializeGL();
972// updateGL();
973//};
974//
975///** Hear announcement of changed atom.
976// * \param *mol pointer to molecule containing atom
977// * \param *Walker pointer to changed atom
978// * \param type type of change
979// */
980//void GLMoleculeView::hearAtomChanged(molecule *mol, atom *Walker, enum ChangesinAtom type)
981//{
982// if (isSignaller) { // if we emitted the signal, return
983// isSignaller = false;
984// return;
985// }
986// initializeGL();
987// updateGL();
988//};
989//
990///** Hear announcement of changed element.
991// * \param *Runner pointer to changed element
992// * \param type of change
993// */
994//void GLMoleculeView::hearElementChanged(element *Runner, enum ChangesinElement type)
995//{
996// if (isSignaller) { // if we emitted the signal, return
997// isSignaller = false;
998// return;
999// }
1000// switch(type) {
1001// default:
1002// case ElementName:
1003// case ElementSymbol:
1004// case ElementMass:
1005// case ElementValence:
1006// case ElementZ:
1007// break;
1008// case ElementCovalent:
1009// case ElementVanderWaals:
1010// initializeGL();
1011// updateGL();
1012// break;
1013// }
1014//};
1015//
1016///** Hear announcement of added molecule.
1017// * \param *mol pointer to added molecule
1018// */
1019//void GLMoleculeView::hearMoleculeAdded(molecule *mol)
1020//{
1021// if (isSignaller) { // if we emitted the signal, return
1022// isSignaller = false;
1023// return;
1024// }
1025// initializeGL();
1026// updateGL();
1027//};
1028//
1029///** Hear announcement of added atom.
1030// * \param *mol pointer to molecule containing atom
1031// * \param *Walker pointer to added atom
1032// */
1033//void GLMoleculeView::hearAtomAdded(molecule *mol, atom *Walker)
1034//{
1035// if (isSignaller) { // if we emitted the signal, return
1036// isSignaller = false;
1037// return;
1038// }
1039// initializeGL();
1040// updateGL();
1041//};
1042//
1043///** Hear announcement of removed molecule.
1044// * \param *mol pointer to removed molecule
1045// */
1046//void GLMoleculeView::hearMoleculeRemoved(molecule *mol)
1047//{
1048// if (isSignaller) { // if we emitted the signal, return
1049// isSignaller = false;
1050// return;
1051// }
1052// initializeGL();
1053// updateGL();
1054//};
1055//
1056///** Hear announcement of removed atom.
1057// * \param *mol pointer to molecule containing atom
1058// * \param *Walker pointer to removed atom
1059// */
1060//void GLMoleculeView::hearAtomRemoved(molecule *mol, atom *Walker)
1061//{
1062// if (isSignaller) { // if we emitted the signal, return
1063// isSignaller = false;
1064// return;
1065// }
1066// initializeGL();
1067// updateGL();
1068//};
1069//
1070//void GLMoleculeView::update(Observable *publisher)
1071//{
1072// initializeGL();
1073// updateGL();
1074//}
1075//
1076///**
1077// * This method is called when a special named change
1078// * of the Observable occured
1079// */
1080//void GLMoleculeView::recieveNotification(Observable *publisher, Notification_ptr notification)
1081//{
1082// initializeGL();
1083// updateGL();
1084//}
1085//
1086///**
1087// * This method is called when the observed object is destroyed.
1088// */
1089//void GLMoleculeView::subjectKilled(Observable *publisher)
1090//{
1091//
1092//}
1093//
1094//
1095//// new stuff
1096//
1097///** Returns the ref to the Material for element No \a from the map.
1098// *
1099// * \note We create a new one if the element is missing.
1100// *
1101// * @param no element no
1102// * @return ref to QGLMaterial
1103// */
1104//QGLMaterial* GLMoleculeView::getMaterial(size_t no)
1105//{
1106// if (ElementNoMaterialMap.find(no) != ElementNoMaterialMap.end()){
1107// // get present one
1108//
1109// } else {
1110// ASSERT( (no >= 0) && (no < MAX_ELEMENTS),
1111// "GLMoleculeView::getMaterial() - Element no "+toString(no)+" is invalid.");
1112// // create new one
1113// LOG(1, "Creating new material for element "+toString(no)+".");
1114// QGLMaterial *newmaterial = new QGLMaterial(this);
1115// periodentafel *periode = World::getInstance().getPeriode();
1116// element *desiredelement = periode->FindElement(no);
1117// ASSERT(desiredelement != NULL,
1118// "GLMoleculeView::getMaterial() - desired element "+toString(no)+" not present in periodentafel.");
1119// const unsigned char* color = desiredelement->getColor();
1120// newmaterial->setAmbientColor( QColor(color[0], color[1], color[2]) );
1121// newmaterial->setSpecularColor( QColor(60, 60, 60) );
1122// newmaterial->setShininess( QColor(128) );
1123// ElementNoMaterialMap.insert( no, newmaterial);
1124// }
1125//}
1126//
1127//QGLSceneNode* GLMoleculeView::getAtom(size_t no)
1128//{
1129// // first some sensibility checks
1130// ASSERT(World::getInstance().getAtom(AtomById(no)) != NULL,
1131// "GLMoleculeView::getAtom() - desired atom "
1132// +toString(no)+" not present in the World.");
1133// ASSERT(AtomsinSceneMap.find(no) != AtomsinSceneMap.end(),
1134// "GLMoleculeView::getAtom() - desired atom "
1135// +toString(no)+" not present in the AtomsinSceneMap.");
1136//
1137// return AtomsinSceneMap[no];
1138//}
1139//
1140//QGLSceneNode* GLMoleculeView::getBond(size_t leftno, size_t rightno)
1141//{
1142// // first some sensibility checks
1143// ASSERT(World::getInstance().getAtom(AtomById(leftno)) != NULL,
1144// "GLMoleculeView::getAtom() - desired atom "
1145// +toString(leftno)+" of bond not present in the World.");
1146// ASSERT(World::getInstance().getAtom(AtomById(rightno)) != NULL,
1147// "GLMoleculeView::getAtom() - desired atom "
1148// +toString(rightno)+" of bond not present in the World.");
1149// ASSERT(AtomsinSceneMap.find(leftno) != AtomsinSceneMap.end(),
1150// "GLMoleculeView::getAtom() - desired atom "
1151// +toString(leftno)+" of bond not present in the AtomsinSceneMap.");
1152// ASSERT(AtomsinSceneMap.find(rightno) != AtomsinSceneMap.end(),
1153// "GLMoleculeView::getAtom() - desired atom "
1154// +toString(rightno)+" of bond not present in the AtomsinSceneMap.");
1155// ASSERT(leftno == rightno,
1156// "GLMoleculeView::getAtom() - bond must not be between the same atom: "
1157// +toString(leftno)+" == "+toString(rightno)+".");
1158//
1159// // then return with smaller index first
1160// if (leftno > rightno)
1161// return AtomsinSceneMap[ make_pair(rightno, leftno) ];
1162// else
1163// return AtomsinSceneMap[ make_pair(leftno, rightno) ];
1164//}
1165//
Note: See TracBrowser for help on using the repository browser.