- Timestamp:
- Jun 21, 2018, 8:31:25 AM (7 years ago)
- Branches:
- Candidate_v1.6.1, ChemicalSpaceEvaluator
- Children:
- d83d64, f5ea10
- Parents:
- 3e334e (diff), 4fc0ea (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- src
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/Action.hpp
r3e334e r8d56a6 14 14 #endif 15 15 16 #include <algorithm> 16 17 #include <iosfwd> 17 18 #include <string> … … 24 25 */ 25 26 #define NOPARAM_DEFAULT BOOST_PP_NIL 27 28 namespace MoleCuilder { 29 //!> helps normalizing Action's tokens for use as Python parameter names 30 #ifdef HAVE_INLINE 31 inline 32 #endif 33 std::string normalizeToken(std::string _token) { 34 std::replace(_token.begin(), _token.end(), '-', '_'); 35 return _token; 36 } 37 } /* namespace MoleCuilder */ 26 38 27 39 /** Nicely visible short-hand for push a status message -
src/Actions/Action_impl_pre.hpp
r3e334e r8d56a6 173 173 output << \ 174 174 BOOST_PP_IF(n, ", ", "") \ 175 << normalizeToken( BOOST_PP_SEQ_ELEM(n, paramtokens) ) \ 176 << "=" \ 175 177 << "\"" << params. \ 176 178 BOOST_PP_SEQ_ELEM(n, paramreferences) \ 177 .getAsStringUnvalidated() \178 << "\""; 179 .getAsStringUnvalidated() \ 180 << "\""; \ 179 181 180 182 // print an initialiser list, i.e. "var( token, valid (,default) )(,)" -
src/Actions/Action_impl_python.hpp
r3e334e r8d56a6 77 77 BOOST_PP_COMMA_IF(n) \ 78 78 boost::python::arg( \ 79 BOOST_PP_SEQ_ELEM(n, STRINGLIST) \79 MoleCuilder::normalizeToken( BOOST_PP_SEQ_ELEM(n, STRINGLIST) ).c_str() \ 80 80 ) \ 81 81 = \ … … 92 92 BOOST_PP_COMMA_IF(n) \ 93 93 boost::python::arg( \ 94 BOOST_PP_SEQ_ELEM(n, STRINGLIST) \94 MoleCuilder::normalizeToken( BOOST_PP_SEQ_ELEM(n, STRINGLIST) ).c_str() \ 95 95 ) 96 96 -
src/Actions/MakroAction_impl_pre.hpp
r3e334e r8d56a6 165 165 output << \ 166 166 BOOST_PP_IF(n, ", ", "") \ 167 << normalizeToken( BOOST_PP_SEQ_ELEM(n, paramtokens) ) \ 168 << "=" \ 167 169 << "\"" << params. \ 168 170 BOOST_PP_SEQ_ELEM(n, paramreferences) \ -
src/Atom/atom_atominfo.cpp
r3e334e r8d56a6 191 191 { 192 192 OBSERVE; 193 NOTIFY(AtomObservable::PositionChanged);194 193 VectorTrajectory_t::iterator iter = AtomicPosition.find(_step); 195 194 if (iter != AtomicPosition.end()) { 196 195 iter->second[i] = value; 197 196 } else { 197 NOTIFY(TrajectoryChanged); 198 198 Vector newPos; 199 199 newPos[i] = value; … … 206 206 +" present after all?"); 207 207 } 208 if (WorldTime::getTime() == _step) 209 NOTIFY(AtomObservable::PositionChanged); 208 210 } 209 211 … … 278 280 iter->second = _newvelocity; 279 281 } else { 282 NOTIFY(TrajectoryChanged); 280 283 #ifndef NDEBUG 281 284 std::pair<VectorTrajectory_t::iterator, bool> inserter = … … 320 323 iter->second = _newforce; 321 324 } else { 325 NOTIFY(TrajectoryChanged); 322 326 #ifndef NDEBUG 323 327 std::pair<VectorTrajectory_t::iterator, bool> inserter = -
src/Parser/TremoloParser.cpp
r3e334e r8d56a6 510 510 << currentAtom->GetTrueFather()->getId() << " at time step " << _timestep); 511 511 512 // note down default precision 513 std::streamsize defaultprecision=file->precision(); 514 std::streamsize highprecision=10; 515 512 516 for (usedFields_t::iterator it = usedFields_save.begin(); it != usedFields_save.end(); it++) { 513 517 currentField = knownKeys[it->substr(0, it->find("="))]; … … 516 520 // for the moment, assume there are always three dimensions 517 521 LOG(3, "Writing for type " << knownKeyNames[currentField] << ": " << currentAtom->getPositionAtStep(_timestep)); 522 file->precision(highprecision); 518 523 *file << currentAtom->atStep(0, _timestep) << "\t"; 519 524 *file << currentAtom->atStep(1, _timestep) << "\t"; 520 525 *file << currentAtom->atStep(2, _timestep) << "\t"; 526 file->precision(defaultprecision); 521 527 break; 522 528 case TremoloKey::u : 523 529 // for the moment, assume there are always three dimensions 524 530 LOG(3, "Writing for type " << knownKeyNames[currentField] << ": " << currentAtom->getAtomicVelocityAtStep(_timestep)); 531 file->precision(highprecision); 525 532 *file << currentAtom->getAtomicVelocityAtStep(_timestep)[0] << "\t"; 526 533 *file << currentAtom->getAtomicVelocityAtStep(_timestep)[1] << "\t"; 527 534 *file << currentAtom->getAtomicVelocityAtStep(_timestep)[2] << "\t"; 535 file->precision(defaultprecision); 528 536 break; 529 537 case TremoloKey::F : 530 538 // for the moment, assume there are always three dimensions 531 539 LOG(3, "Writing for type " << knownKeyNames[currentField] << ": " << currentAtom->getAtomicForceAtStep(_timestep)); 540 file->precision(highprecision); 532 541 *file << currentAtom->getAtomicForceAtStep(_timestep)[0] << "\t"; 533 542 *file << currentAtom->getAtomicForceAtStep(_timestep)[1] << "\t"; 534 543 *file << currentAtom->getAtomicForceAtStep(_timestep)[2] << "\t"; 544 file->precision(defaultprecision); 535 545 break; 536 546 case TremoloKey::type : -
src/UIElements/Qt4/InstanceBoard/QtObservedAtom.cpp
r3e334e r8d56a6 89 89 QtObservedAtom::AtomPositionChannels(1, AtomObservable::PositionChanged); 90 90 const Observable::channels_t 91 QtObservedAtom::AtomVelocityChannels(1, AtomObservable::VelocityChanged); 92 const Observable::channels_t 93 QtObservedAtom::AtomForceChannels(1, AtomObservable::ForceChanged); 94 const Observable::channels_t 91 95 QtObservedAtom::AtomSelectedChannels(1, AtomObservable::SelectionChanged); 92 96 … … 124 128 boost::any_cast<ObservedValue_wCallback<std::string, ObservedValue_Index_t> *>(ObservedValues[AtomName])->noteCallBackIsGone(); 125 129 boost::any_cast<ObservedValue_wCallback<Vector, ObservedValue_Index_t> *>(ObservedValues[AtomPosition])->noteCallBackIsGone(); 130 boost::any_cast<ObservedValue_wCallback<Vector, ObservedValue_Index_t> *>(ObservedValues[AtomVelocity])->noteCallBackIsGone(); 131 boost::any_cast<ObservedValue_wCallback<Vector, ObservedValue_Index_t> *>(ObservedValues[AtomForce])->noteCallBackIsGone(); 126 132 boost::any_cast<ObservedValue_wCallback<bool, ObservedValue_Index_t> *>(ObservedValues[AtomSelected])->noteCallBackIsGone(); 127 133 … … 215 221 inline 216 222 #endif 223 Vector QtObservedAtom::updateVelocity( 224 const atom &_atom) 225 { 226 return _atom.getAtomicVelocity(); 227 } 228 229 #ifdef HAVE_INLINE 230 inline 231 #endif 232 Vector QtObservedAtom::updateForce( 233 const atom &_atom) 234 { 235 return _atom.getAtomicForce(); 236 } 237 238 #ifdef HAVE_INLINE 239 inline 240 #endif 217 241 bool QtObservedAtom::updateSelected( 218 242 const atom &_atom) … … 269 293 boost::any_cast<ObservedValue_wCallback<Vector, ObservedValue_Index_t> *>( 270 294 ObservedValues[AtomPosition])->forceUpdate(); 295 boost::any_cast<ObservedValue_wCallback<Vector, ObservedValue_Index_t> *>( 296 ObservedValues[AtomVelocity])->forceUpdate(); 297 boost::any_cast<ObservedValue_wCallback<Vector, ObservedValue_Index_t> *>( 298 ObservedValues[AtomForce])->forceUpdate(); 271 299 boost::any_cast<ObservedValue_wCallback<QtObservedMolecule*, ObservedValue_Index_t> *>( 272 300 ObservedValues[MoleculeRef])->forceUpdate(); 273 301 // then tell Qt part about updates 274 302 emit positionChanged(); 303 emit velocityChanged(); 304 emit forceChanged(); 275 305 emit moleculeChanged(); 276 306 } else { … … 296 326 case AtomObservable::PositionChanged: 297 327 emit positionChanged(); 328 break; 329 case AtomObservable::VelocityChanged: 330 emit velocityChanged(); 331 break; 332 case AtomObservable::ForceChanged: 333 emit forceChanged(); 298 334 break; 299 335 case AtomObservable::SelectionChanged: … … 362 398 const boost::function<Vector ()> AtomPositionUpdater( 363 399 boost::bind(&QtObservedAtom::updatePosition, boost::cref(*_atomref))); 400 const boost::function<Vector ()> AtomVelocityUpdater( 401 boost::bind(&QtObservedAtom::updateVelocity, boost::cref(*_atomref))); 402 const boost::function<Vector ()> AtomForceUpdater( 403 boost::bind(&QtObservedAtom::updateForce, boost::cref(*_atomref))); 364 404 const boost::function<bool ()> AtomSelectedUpdater( 365 405 boost::bind(&QtObservedAtom::updateSelected, boost::cref(*_atomref))); … … 401 441 AtomPositionUpdater(), 402 442 AtomPositionChannels, 443 _subjectKilled); 444 _ObservedValues[AtomVelocity] = new ObservedValue_wCallback<Vector, ObservedValue_Index_t>( 445 _atomref, 446 AtomVelocityUpdater, 447 "AtomVelocity_"+toString(_id), 448 AtomVelocityUpdater(), 449 AtomVelocityChannels, 450 _subjectKilled); 451 _ObservedValues[AtomForce] = new ObservedValue_wCallback<Vector, ObservedValue_Index_t>( 452 _atomref, 453 AtomForceUpdater, 454 "AtomForce_"+toString(_id), 455 AtomForceUpdater(), 456 AtomForceChannels, 403 457 _subjectKilled); 404 458 _ObservedValues[AtomSelected] = new ObservedValue_wCallback<bool, ObservedValue_Index_t>( … … 426 480 delete boost::any_cast<ObservedValue_wCallback<std::string, ObservedValue_Index_t> *>(_ObservedValues[AtomName]); 427 481 delete boost::any_cast<ObservedValue_wCallback<Vector, ObservedValue_Index_t> *>(_ObservedValues[AtomPosition]); 482 delete boost::any_cast<ObservedValue_wCallback<Vector, ObservedValue_Index_t> *>(_ObservedValues[AtomVelocity]); 483 delete boost::any_cast<ObservedValue_wCallback<Vector, ObservedValue_Index_t> *>(_ObservedValues[AtomForce]); 428 484 delete boost::any_cast<ObservedValue_wCallback<bool, ObservedValue_Index_t> *>(_ObservedValues[AtomSelected]); 429 485 delete boost::any_cast<ObservedValue_wCallback<QtObservedMolecule*, ObservedValue_Index_t> *>(_ObservedValues[MoleculeRef]); … … 463 519 } 464 520 521 const Vector& QtObservedAtom::getAtomVelocity() const 522 { 523 return boost::any_cast<ObservedValue_wCallback<Vector, ObservedValue_Index_t> *>(ObservedValues[AtomVelocity])->get(); 524 } 525 526 const Vector& QtObservedAtom::getAtomForce() const 527 { 528 return boost::any_cast<ObservedValue_wCallback<Vector, ObservedValue_Index_t> *>(ObservedValues[AtomForce])->get(); 529 } 530 465 531 const bool QtObservedAtom::getAtomSelected() const 466 532 { -
src/UIElements/Qt4/InstanceBoard/QtObservedAtom.hpp
r3e334e r8d56a6 136 136 const Vector& getAtomPosition() const; 137 137 138 /** Getter to atom velocity contained in \a ObservedValues. 139 * 140 * \return atom's velocity 141 */ 142 const Vector& getAtomVelocity() const; 143 144 /** Getter to atom force contained in \a ObservedValues. 145 * 146 * \return atom's force 147 */ 148 const Vector& getAtomForce() const; 149 138 150 /** Getter to the observed state of the associated molecule. 139 151 * … … 155 167 void nameChanged(); 156 168 void positionChanged(); 169 void velocityChanged(); 170 void forceChanged(); 157 171 void atomRemoved(); 158 172 void selectedChanged(); … … 174 188 static std::string updateName(const atom &_atom); 175 189 static Vector updatePosition(const atom &_atom); 190 static Vector updateVelocity(const atom &_atom); 191 static Vector updateForce(const atom &_atom); 176 192 static bool updateSelected(const atom &_atom); 177 193 … … 188 204 //!> contains the current atom position 189 205 AtomPosition, 206 //!> contains the current atom velocity 207 AtomVelocity, 208 //!> contains the current atom force 209 AtomForce, 190 210 //!> contains the current atom's selection status 191 211 AtomSelected, … … 253 273 //!> list of channels when position needs to update 254 274 static const Observable::channels_t AtomPositionChannels; 275 //!> list of channels when velocity needs to update 276 static const Observable::channels_t AtomVelocityChannels; 277 //!> list of channels when force needs to update 278 static const Observable::channels_t AtomForceChannels; 255 279 //!> list of channels when selection needs to update 256 280 static const Observable::channels_t AtomSelectedChannels; -
src/UIElements/Qt4/QtMainWindow.hpp
r3e334e r8d56a6 32 32 class QtMoleculeList; 33 33 class QtShapeController; 34 class QtTimeLine; 34 35 class StringView; 35 36 class GLWorldView; … … 38 39 class QtToolBar; 39 40 class QCloseEvent; 40 class QSlider;41 41 42 42 class QtObservedInstanceBoard; … … 70 70 QtMenu<QMenuBar> *MainMenu; 71 71 QtToolBar *toolbar; 72 Q Slider*timeline;72 QtTimeLine *timeline; 73 73 QtLogBox *logBox; 74 74 QtLogBox *errorlogBox; -
src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject.cpp
r3e334e r8d56a6 61 61 QGLMaterial *GLMoleculeObject::m_selectionMaterial = NULL; 62 62 QGLMaterial *GLMoleculeObject::m_selectionBoxMaterial = NULL; 63 QGLMaterial *GLMoleculeObject::m_velocityMaterial = NULL; 64 QGLMaterial *GLMoleculeObject::m_forceMaterial = NULL; 63 65 64 66 QGLSceneNode *GLMoleculeObject::meshEmpty[GLMoleculeObject::DETAILTYPES_MAX]; 65 67 QGLSceneNode *GLMoleculeObject::meshSphere[GLMoleculeObject::DETAILTYPES_MAX]; 66 68 QGLSceneNode *GLMoleculeObject::meshCylinder[GLMoleculeObject::DETAILTYPES_MAX]; 69 QGLSceneNode *GLMoleculeObject::meshArrow[GLMoleculeObject::DETAILTYPES_MAX]; 67 70 68 71 double GLMoleculeObject::detailMinDistance[GLMoleculeObject::DETAILTYPES_MAX] = {0, 15, 30, 42}; … … 309 312 m_selectionBoxMaterial->setEmittedLight( QColor(155, 50, 50) ); 310 313 } 314 if (!m_velocityMaterial){ 315 m_velocityMaterial = new QGLMaterial(NULL); 316 QColor colorvelocity(50,50,255,255); 317 m_velocityMaterial->setColor(colorvelocity); 318 } 319 if (!m_forceMaterial){ 320 m_forceMaterial = new QGLMaterial(NULL); 321 QColor colorforce(50,255,50,255); 322 m_forceMaterial->setColor(colorforce); 323 } 311 324 } 312 325 -
src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject.hpp
r3e334e r8d56a6 108 108 static QGLSceneNode *meshSphere[DETAILTYPES_MAX]; 109 109 static QGLSceneNode *meshCylinder[DETAILTYPES_MAX]; 110 static QGLSceneNode *meshArrow[DETAILTYPES_MAX]; 110 111 111 112 protected: … … 130 131 static QGLMaterial *m_selectionMaterial; 131 132 static QGLMaterial *m_selectionBoxMaterial; 133 static QGLMaterial *m_velocityMaterial; 134 static QGLMaterial *m_forceMaterial; 132 135 QGLAbstractEffect *m_effect; 133 136 int m_objectId; -
src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_atom.cpp
r3e334e r8d56a6 50 50 #include "Element/element.hpp" 51 51 #include "Element/periodentafel.hpp" 52 #include "LinearAlgebra/Line.hpp" 52 53 #include "LinearAlgebra/Vector.hpp" 53 54 #include "UIElements/Views/Qt4/Qt3D/GLMoleculeObject_bond.hpp" … … 57 58 GLMoleculeObject_atom::GLMoleculeObject_atom( 58 59 QGLSceneNode *mesh[], 60 QGLSceneNode *mesharrow[], 59 61 QObject *parent, 60 62 QtObservedAtom::ptr &_ObservedAtom) : 61 63 GLMoleculeObject(mesh, parent), 64 GLMoleculeObjectVelocity(mesharrow, this), 65 GLMoleculeObjectForce(mesharrow, this), 62 66 ObservedAtom(_ObservedAtom) 63 67 { … … 69 73 setObjectId(_id); 70 74 resetPosition(); 75 resetVelocity(); 76 resetForce(); 71 77 resetElement(); 78 79 GLMoleculeObjectVelocity.setMaterial(GLMoleculeObject::m_velocityMaterial); 80 GLMoleculeObjectForce.setMaterial(GLMoleculeObject::m_forceMaterial); 72 81 73 82 m_selected = ObservedAtom->getAtomSelected(); … … 77 86 connect( ObservedAtom.get(), SIGNAL(elementChanged()), this, SLOT(resetElement())); 78 87 connect( ObservedAtom.get(), SIGNAL(positionChanged()), this, SLOT(resetPosition())); 88 connect( ObservedAtom.get(), SIGNAL(velocityChanged()), this, SLOT(resetVelocity())); 89 connect( ObservedAtom.get(), SIGNAL(forceChanged()), this, SLOT(resetForce())); 79 90 connect( ObservedAtom.get(), SIGNAL(selectedChanged()), this, SLOT(resetSelected())); 80 91 } … … 95 106 } 96 107 108 static void setArrow( 109 const Vector &_position, 110 const Vector &_arrow, 111 const double _offset, 112 GLMoleculeObject &_obj) 113 { 114 // set position (cylinder offset is in its barymetric center) 115 Vector OneFourth(_position + (_offset/_arrow.Norm()+.75) * _arrow); 116 _obj.setPosition(QVector3D(OneFourth[0], OneFourth[1], OneFourth[2])); 117 } 118 97 119 void GLMoleculeObject_atom::resetPosition() 98 120 { … … 100 122 LOG(4, "INFO: GLMoleculeObject_atom::resetPosition() - new position is "+toString(Position)+"."); 101 123 setPosition(QVector3D(Position[0], Position[1], Position[2])); 124 setArrow(Position, 10.*ObservedAtom->getAtomVelocity(), scaleX(), GLMoleculeObjectVelocity); 125 setArrow(Position, 10.*ObservedAtom->getAtomForce(), scaleX(), GLMoleculeObjectForce); 126 } 127 128 static void alignArrow( 129 const Vector &_arrow, 130 GLMoleculeObject &_obj) 131 { 132 if (_arrow.IsZero()) { 133 _obj.setScaleZ(0.); 134 return; 135 } 136 // calculate position 137 Vector Z(unitVec[2]); // cylinder are initially aligned along the Z axis 138 Vector b; 139 Vector OtherAxis; 140 double alpha; 141 // construct rotation axis 142 b = -1.*_arrow; 143 b.VectorProduct(Z); 144 Line axis(zeroVec, b); 145 // calculate rotation angle 146 alpha = _arrow.Angle(Z); 147 // construct other axis to check right-hand rule 148 OtherAxis = b; 149 OtherAxis.VectorProduct(Z); 150 // assure right-hand rule for the rotation 151 if (_arrow.ScalarProduct(OtherAxis) < MYEPSILON) 152 alpha = M_PI-alpha; 153 // check 154 Vector a_rotated = axis.rotateVector(_arrow, alpha); 155 LOG(5, "DEBUG: Aligning arrow " << _arrow << " to " << a_rotated 156 << " around " << b << " by " << alpha/M_PI*180. << "."); 157 158 _obj.setScaleZ(10.*_arrow.Norm()); 159 _obj.setRotationVector(QVector3D(b[0], b[1], b[2])); 160 _obj.setRotationAngle(alpha/M_PI*180.); 161 } 162 163 void GLMoleculeObject_atom::resetVelocity() 164 { 165 const Vector Velocity = ObservedAtom->getAtomVelocity(); 166 LOG(4, "INFO: GLMoleculeObject_atom::resetVelocity() - new velocity is "+toString(Velocity)+"."); 167 alignArrow(Velocity, GLMoleculeObjectVelocity); 168 // GLMoleculeObjectForce.setScaleZ(Velocity.Norm()); 169 } 170 171 void GLMoleculeObject_atom::resetForce() 172 { 173 const Vector Force = ObservedAtom->getAtomForce(); 174 LOG(4, "INFO: GLMoleculeObject_atom::resetForce() - new force is "+toString(Force)+"."); 175 alignArrow(Force, GLMoleculeObjectForce); 176 // GLMoleculeObjectForce.setScaleZ(Force.Norm()); 102 177 } 103 178 … … 144 219 // call old hook to do the actual paining 145 220 GLMoleculeObject::draw(painter, cameraPlane); 221 GLMoleculeObjectVelocity.draw(painter, cameraPlane); 222 GLMoleculeObjectForce.draw(painter, cameraPlane); 146 223 } 147 224 -
src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_atom.hpp
r3e334e r8d56a6 34 34 GLMoleculeObject_atom( 35 35 QGLSceneNode *mesh[], 36 QGLSceneNode *mesharrow[], 36 37 QObject *parent, 37 38 QtObservedAtom::ptr &_ObservedAtom … … 46 47 void resetElement(); 47 48 void resetPosition(); 49 void resetVelocity(); 50 void resetForce(); 48 51 void resetSelected(); 49 52 … … 58 61 59 62 private: 63 //!> internal GLMoleculeObject to represent the atom's velocity as an arrow 64 GLMoleculeObject GLMoleculeObjectVelocity; 65 //!> internal GLMoleculeObject to represent the atom's force as an arrow 66 GLMoleculeObject GLMoleculeObjectForce; 67 60 68 //!> current list of bonds to compare new onw against for changes 61 69 QtObservedAtom::ListOfBonds_t ListOfBonds; -
src/UIElements/Views/Qt4/Qt3D/GLWorldScene.cpp
r3e334e r8d56a6 154 154 int sphereDetails[] = {5, 3, 2, 0}; 155 155 int cylinderDetails[] = {16, 8, 6, 3}; 156 int arrowDetails[] = {8, 5, 3, 0}; 156 157 for (int i=0;i<GLMoleculeObject::DETAILTYPES_MAX;i++){ 157 158 QGLBuilder emptyBuilder; … … 165 166 GLMoleculeObject::meshCylinder[i] = cylinderBuilder.finalizedSceneNode(); 166 167 GLMoleculeObject::meshCylinder[i]->setOption(QGLSceneNode::CullBoundingBox, true); 168 { 169 QGLBuilder builderCyl; 170 builderCyl << QGLCylinder(.15,.15,1.6,arrowDetails[i]); 171 QGLSceneNode *cyl = builderCyl.finalizedSceneNode(); 172 QGLBuilder builderCone; 173 builderCone << QGLCylinder(0,.4,0.4,arrowDetails[i]); 174 QGLSceneNode *cone = builderCone.finalizedSceneNode(); 175 { 176 QMatrix4x4 mat; 177 mat.translate(0.0f, 0.0f, 1.0f); 178 cone->setLocalTransform(mat); 179 } 180 GLMoleculeObject::meshArrow[i] = new QGLSceneNode(this); 181 GLMoleculeObject::meshArrow[i]->addNode(cyl); 182 GLMoleculeObject::meshArrow[i]->addNode(cone); 183 } 184 GLMoleculeObject::meshArrow[i]->setOption(QGLSceneNode::CullBoundingBox, true); 167 185 } 168 186 connect(board, SIGNAL(moleculeInserted(QtObservedMolecule::ptr)), … … 279 297 atomObject = new GLMoleculeObject_atom( 280 298 GLMoleculeObject::meshSphere, 299 GLMoleculeObject::meshArrow, 281 300 parent, 282 301 _atom); -
src/UIElements/Views/Qt4/Qt3D/GLWorldView.cpp
r3e334e r8d56a6 93 93 // connect(this, SIGNAL(TimeChanged()), worldscene, SIGNAL(updated())); 94 94 connect(worldscene, SIGNAL(changeOccured()), this, SLOT(changeSignalled())); 95 connect( worldscene, SIGNAL(changed()), this, SIGNAL(changed()));95 connect(this, SIGNAL(changed()), this, SLOT(changeSignalled())); 96 96 connect(worldscene, SIGNAL(hoverChanged(const atomId_t)), this, SLOT(sceneHoverSignalled(const atomId_t))); 97 97 connect(worldscene, SIGNAL(hoverChanged(const moleculeId_t, int)), this, SLOT(sceneHoverSignalled(const moleculeId_t, int))); 98 98 //connect(this, SIGNAL(changed()), this, SLOT(updateGL())); 99 connect( this, SIGNAL(changed()), this, SLOT(sceneChangeSignalled()));99 connect(worldscene, SIGNAL(changed()), this, SLOT(sceneChangeSignalled())); 100 100 connect(this, SIGNAL(moleculesVisibilityChanged(ObservedValue_Index_t,bool)), 101 101 worldscene, SLOT(moleculesVisibilityChanged(ObservedValue_Index_t,bool))); … … 104 104 WorldTime::getInstance().signOn(this, WorldTime::TimeChanged); 105 105 AtomObserver::getInstance().signOn(this, AtomObservable::PositionChanged); 106 AtomObserver::getInstance().signOn(this, AtomObservable::VelocityChanged); 107 AtomObserver::getInstance().signOn(this, AtomObservable::ForceChanged); 106 108 107 109 ShapeRegistry::getInstance().signOn(this); … … 124 126 WorldTime::getInstance().signOff(this, WorldTime::TimeChanged); 125 127 AtomObserver::getInstance().signOff(this, AtomObservable::PositionChanged); 128 AtomObserver::getInstance().signOff(this, AtomObservable::VelocityChanged); 129 AtomObserver::getInstance().signOff(this, AtomObservable::ForceChanged); 126 130 ShapeRegistry::getInstance().signOff(this); 127 131 ShapeRegistry::getInstance().signOff(this, ShapeRegistry::ShapeInserted); … … 341 345 observerLog().addMessage() << "++ Observer " << observerLog().getName(static_cast<Observer *>(this)) << " received notification that WorldTime's time has changed."; 342 346 #endif 347 needsRedraw = false; 343 348 emit changed(); 344 349 emit TimeChanged(); … … 353 358 case ShapeRegistry::ShapeInserted: 354 359 { 360 needsRedraw = false; 355 361 emit ShapeAdded(ShapeRegistry::getInstance().lastChanged()->getName()); 356 362 break; … … 358 364 case ShapeRegistry::ShapeRemoved: 359 365 { 366 needsRedraw = false; 360 367 emit ShapeRemoved(ShapeRegistry::getInstance().lastChanged()->getName()); 361 368 break; … … 363 370 case ShapeRegistry::SelectionChanged: 364 371 { 372 needsRedraw = false; 365 373 worldscene->updateSelectedShapes(); 366 374 break; … … 375 383 void GLWorldView::checkChanges() 376 384 { 385 needsRedraw = false; 377 386 updateGL(); 378 needsRedraw = false;379 387 } 380 388 … … 385 393 setdreiBeinStatus(!status); 386 394 // realize 387 updateGL();388 395 needsRedraw = true; 396 emit changed(); 389 397 } 390 398 … … 403 411 setDomainStatus(!status); 404 412 // realize 405 updateGL();406 413 needsRedraw = true; 414 emit changed(); 407 415 } 408 416 … … 417 425 void GLWorldView::sceneChangeSignalled() 418 426 { 419 if ( !needsRedraw){427 if (needsRedraw){ 420 428 redrawTimer->singleShot(0, this, SLOT(checkChanges())); 421 429 needsRedraw = true; … … 432 440 void GLWorldView::paintGL(QGLPainter *painter) 433 441 { 434 if (changesPresent) {442 if (changesPresent) 435 443 initializeGL(painter); 436 changesPresent = false;437 }438 444 439 445 QVector3D cameraDir = camera()->center() - camera()->eye(); … … 492 498 { 493 499 changesPresent = true; 500 updateGL(); 494 501 } 495 502 … … 548 555 setStereoType(QGLView::Hardware); 549 556 camera()->setEyeSeparation(0.0); 550 updateGL();557 emit changed(); 551 558 } 552 559 … … 555 562 setStereoType(QGLView::Hardware); 556 563 camera()->setEyeSeparation(defaultEyeSeparation); 557 updateGL();564 emit changed(); 558 565 } 559 566 … … 562 569 setStereoType(QGLView::LeftRight); 563 570 camera()->setEyeSeparation(defaultEyeSeparation); 564 updateGL();571 emit changed(); 565 572 } 566 573 … … 569 576 setStereoType(QGLView::RightLeft); 570 577 camera()->setEyeSeparation(defaultEyeSeparation); 571 updateGL();578 emit changed(); 572 579 } 573 580 … … 576 583 setStereoType(QGLView::TopBottom); 577 584 camera()->setEyeSeparation(defaultEyeSeparation); 578 updateGL();585 emit changed(); 579 586 } 580 587 … … 583 590 setStereoType(QGLView::BottomTop); 584 591 camera()->setEyeSeparation(defaultEyeSeparation); 585 updateGL();592 emit changed(); 586 593 } 587 594 … … 590 597 setStereoType(QGLView::RedCyanAnaglyph); 591 598 camera()->setEyeSeparation(defaultEyeSeparation); 592 updateGL();599 emit changed(); 593 600 } 594 601 … … 714 721 void GLWorldView::sceneHoverSignalled(const atomId_t _id) 715 722 { 723 needsRedraw = true; 724 emit changed(); 716 725 emit hoverChanged(_id); 717 726 } … … 719 728 void GLWorldView::sceneHoverSignalled(const moleculeId_t _id, int _i) 720 729 { 730 needsRedraw = true; 731 emit changed(); 721 732 emit hoverChanged(_id, _i); 722 733 } -
src/UIElements/Views/Qt4/QtInfoBox.cpp
r3e334e r8d56a6 65 65 66 66 setMinimumWidth(200); 67 setMinimumHeight( 220);67 setMinimumHeight(350); 68 68 69 69 connect(timer, SIGNAL(timeout()), this, SLOT(timerTimeout())); … … 220 220 addInfo(this, "Position y", QString(toString(atomRef->getAtomPosition()[1]).c_str())); 221 221 addInfo(this, "Position z", QString(toString(atomRef->getAtomPosition()[2]).c_str())); 222 addInfo(this, "Velocity x", QString(toString(atomRef->getAtomVelocity()[0]).c_str())); 223 addInfo(this, "Velocity y", QString(toString(atomRef->getAtomVelocity()[1]).c_str())); 224 addInfo(this, "Velocity z", QString(toString(atomRef->getAtomVelocity()[2]).c_str())); 225 addInfo(this, "Force x", QString(toString(atomRef->getAtomForce()[0]).c_str())); 226 addInfo(this, "Force y", QString(toString(atomRef->getAtomForce()[1]).c_str())); 227 addInfo(this, "Force z", QString(toString(atomRef->getAtomForce()[2]).c_str())); 222 228 } 223 229 -
src/UIElements/Views/Qt4/QtTimeLine.cpp
r3e334e r8d56a6 47 47 48 48 QtTimeLine::QtTimeLine(QWidget * _parent) : 49 Q Slider (Qt::Horizontal,_parent),49 QWidget(_parent), 50 50 Observer("QtTimeLine"), 51 51 atomobserver_enlisted(false), 52 52 worldtime_enlisted(false), 53 WorldTime_change(false)53 SetWorldTime_called(false) 54 54 { 55 slider = new QSlider(Qt::Horizontal, this); 55 56 // set initial values 56 QSlider::setMinimum(0); 57 QSlider::setMaximum(0); 58 WorldTime_change = true; 59 QSlider::setValue(0); 60 QSlider::setTickInterval(1); 61 QSlider::setSingleStep(1); 62 QSlider::setTracking(true); 57 slider->setMinimum(0); 58 slider->setMaximum(0); 59 slider->setValue(0); 60 slider->setTickInterval(1); 61 slider->setSingleStep(1); 62 slider->setTracking(true); 63 64 spinbox = new QSpinBox(this); 65 spinbox->setMinimum(0); 66 spinbox->setMaximum(0); 67 spinbox->setValue(0); 68 69 layout = new QHBoxLayout(this); 70 layout->addWidget(slider); 71 layout->addWidget(spinbox); 63 72 64 73 // sign on to observable … … 69 78 70 79 // connect to QSlider's valueChanged() signal 71 bool result = connect(this,SIGNAL(valueChanged(int)),this,SLOT(StepUpdate(int)), Qt::DirectConnection); 80 bool result = connect(slider,SIGNAL(valueChanged(int)),this,SLOT(StepUpdate(int))); 81 result = result && connect(spinbox,SIGNAL(valueChanged(int)),this,SLOT(StepUpdate(int))); 72 82 if (!result) 73 83 ELOG(0, "Could not connect to QSlider::valueChanged."); … … 86 96 boost::recursive_mutex::scoped_lock lock(refill_mutex); 87 97 88 QSlider::paintEvent(event);98 // layout->paintEvent(event); 89 99 } 90 100 … … 111 121 112 122 if (static_cast<WorldTime *>(publisher) == WorldTime::getPointer()) { 123 SetWorldTime_called = false; 113 124 const int timestep = WorldTime::getTime(); 114 125 // check whether we are beyond maximum 115 if (timestep > QSlider::maximum()) 116 QSlider::setMaximum(timestep); 126 if (timestep > slider->maximum()) { 127 slider->setMaximum(timestep); 128 spinbox->setMaximum(timestep); 129 } 117 130 // set slider position to new time step 118 WorldTime_change = true;119 QSlider::setValue( timestep );131 slider->setValue( timestep ); 132 spinbox->setValue( timestep ); 120 133 } else 121 134 //if (static_cast<AtomObserver *>(publisher) == AtomObserver::getPointer()) … … 124 137 const atom *_atom = dynamic_cast<const atom *>(publisher); 125 138 const int MaxTrajectory = _atom->getTrajectorySize()-1; 126 if (MaxTrajectory > QSlider::maximum()) 127 QSlider::setMaximum(MaxTrajectory); 139 if (MaxTrajectory > slider->maximum()) { 140 slider->setMaximum(MaxTrajectory); 141 spinbox->setMaximum(MaxTrajectory); 142 } 128 143 } 129 144 } … … 133 148 boost::recursive_mutex::scoped_lock lock(refill_mutex); 134 149 135 if (WorldTime_change) 136 WorldTime_change = false; 137 else 138 MoleCuilder::WorldSetWorldTime(position); 150 if (!SetWorldTime_called) { 151 if (WorldTime::getTime() != (unsigned int)position) { 152 SetWorldTime_called = true; 153 MoleCuilder::WorldSetWorldTime(position); 154 } 155 } 139 156 } -
src/UIElements/Views/Qt4/QtTimeLine.hpp
r3e334e r8d56a6 14 14 #endif 15 15 16 #include <QtGui/QHBoxLayout> 16 17 #include <QtGui/QSlider> 18 #include <QtGui/QSpinBox> 17 19 18 20 #include <boost/thread/recursive_mutex.hpp> … … 20 22 #include "CodePatterns/Observer/Observer.hpp" 21 23 22 class QtTimeLine : public Q Slider, public Observer24 class QtTimeLine : public QWidget, public Observer 23 25 { 24 26 Q_OBJECT … … 42 44 //!> whether WorldTime knows about us or not 43 45 bool worldtime_enlisted; 44 //!> states whether value was set by observing WorldTime (and not by slider) 45 bool WorldTime_change; 46 47 QSlider *slider; 48 QSpinBox *spinbox; 49 QHBoxLayout *layout; 50 51 //!> states whether we are expecting a notification from the worldtime 52 bool SetWorldTime_called; 46 53 47 54 mutable boost::recursive_mutex refill_mutex;
Note:
See TracChangeset
for help on using the changeset viewer.