Changeset f115cc


Ignore:
Timestamp:
Jan 11, 2015, 4:42:43 PM (10 years ago)
Author:
Frederik Heber <heber@…>
Branches:
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
Children:
b6d92e
Parents:
a7aebd
git-author:
Frederik Heber <heber@…> (12/03/14 22:15:42)
git-committer:
Frederik Heber <heber@…> (01/11/15 16:42:43)
Message:

For GLMoleculeObject_atom element and position are only reset..() on hook'ed in draw().

  • similarly as with GLMoleculeObject_molecule, we check in draw() when need to reset..() and do it before the actual drawing. This speeds up a lot.
Location:
src/UIElements/Views/Qt4/Qt3D
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_atom.cpp

    ra7aebd rf115cc  
    5656  GLMoleculeObject(mesh, parent),
    5757  Observer(std::string("GLMoleculeObject_atom")+toString(_id)),
    58   atomicid(_id)
     58  atomicid(_id),
     59  uptodatePosition(false),
     60  uptodateElement(false)
    5961{
    6062  // sign on as observer (obtain non-const instance before)
     
    108110    ELOG(2, "Atom with id "+toString(atomicid)+" is already gone.");
    109111  }
     112  uptodatePosition = true;
    110113}
    111114
     
    141144  }
    142145  setScale( radius / 4. );
     146
     147  uptodateElement = true;
    143148}
    144149
     
    165170  // selected?
    166171  setSelected(World::getInstance().isAtomSelected(atomicid));
     172}
     173
     174void GLMoleculeObject_atom::draw(QGLPainter *painter, const QVector4D &cameraPlane)
     175{
     176  // hook to update prior to painting
     177  if (!uptodatePosition)
     178    resetPosition();
     179  if (!uptodateElement)
     180    resetElement();
     181
     182  // call old hook to do the actual paining
     183  GLMoleculeObject::draw(painter, cameraPlane);
    167184}
    168185
     
    185202    switch (notification->getChannelNo()) {
    186203      case AtomObservable::ElementChanged:
    187         resetElement();
    188         emit changed();
     204        uptodateElement = false;
    189205        break;
    190206      case AtomObservable::IndexChanged:
     
    192208        break;
    193209      case AtomObservable::PositionChanged:
    194         resetPosition();
    195         emit changed();
     210        uptodatePosition = false;
    196211        break;
    197212      case AtomObservable::BondsAdded:
     
    199214        const atom *_atom = World::getInstance().getAtom(AtomById(atomicid));
    200215        if (_atom != NULL) {
     216          // make sure position is up-to-date
     217          if (!uptodatePosition)
     218            resetPosition();
    201219          ASSERT(!_atom->getListOfBonds().empty(),
    202220              "GLMoleculeObject_atom::recieveNotification() - received BondsAdded but ListOfBonds is empty.");
  • src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_atom.hpp

    ra7aebd rf115cc  
    3131  virtual ~GLMoleculeObject_atom();
    3232
     33  void draw(QGLPainter *painter, const QVector4D &cameraPlane);
     34
    3335  // Observer functions
    3436  void update(Observable *publisher);
     
    5658
    5759  const atomId_t atomicid;
     60
     61  bool uptodatePosition;
     62  bool uptodateElement;
    5863};
    5964
Note: See TracChangeset for help on using the changeset viewer.