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