Changeset 4b62d3


Ignore:
Timestamp:
Apr 17, 2013, 6:56:54 PM (12 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:
378fc6b
Parents:
2d5137
git-author:
Frederik Heber <heber@…> (03/19/13 11:04:06)
git-committer:
Frederik Heber <heber@…> (04/17/13 18:56:54)
Message:

GLMoleculeObject_bond sets width of cylinder according to BondDegree.

Location:
src/UIElements/Views/Qt4/Qt3D
Files:
2 edited

Legend:

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

    r2d5137 r4b62d3  
    6969  // sign on as observer (obtain non-const instance before)
    7070  _bond.signOn(this, BondObservable::BondRemoved);
     71  _bond.signOn(this, BondObservable::DegreeChanged);
    7172  leftatom->signOn(this, AtomObservable::PositionChanged);
    7273  leftatom->signOn(this, AtomObservable::ElementChanged);
     
    101102
    102103  resetPosition();
     104  resetWidth();
    103105}
    104106
     
    120122  }
    121123  _bond.signOff(this, BondObservable::BondRemoved);
     124  _bond.signOff(this, BondObservable::DegreeChanged);
    122125  leftatom->signOff(this, AtomObservable::PositionChanged);
    123126  leftatom->signOff(this, AtomObservable::ElementChanged);
     
    176179        << " received notification from unknown source.";
    177180#endif
     181  bool DoResetPosition = false;
     182  bool DoResetWidth = false;
    178183  if (publisher == static_cast<const Observable *>(&_bond)){
    179184    switch (notification->getChannelNo()) {
     
    181186      delete this;
    182187      break;
     188    case BondObservable::DegreeChanged:
     189      DoResetWidth = true;
     190      break;
     191    default:
     192      ASSERT(0, "GLMoleculeObject_bond::recieveNotification() - unknown signal.");
     193      break;
    183194    }
    184195  } else {
    185     bool DoResetPosition = false;
    186196    // from an atom
    187197    switch (notification->getChannelNo()) {
     
    197207      break;
    198208    }
    199     if (DoResetPosition) {
    200         resetPosition();
    201         emit changed();
    202     }
    203   }
     209  }
     210  if (DoResetPosition) {
     211    resetPosition();
     212    emit changed();
     213  }
     214  if (DoResetWidth) {
     215    resetWidth();
     216    emit changed();
     217  }
     218}
     219
     220void GLMoleculeObject_bond::resetWidth()
     221{
     222  const double factor = 1.0f+.5f*(_bond.getDegree()-1);
     223  LOG(2, "DEBUG: GLMoleculeObject_bond::resetWidth() - setting bond's width to " << factor << ".");
     224  setScaleX(factor);
     225  setScaleY(factor);
    204226}
    205227
  • src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_bond.hpp

    r2d5137 r4b62d3  
    4141
    4242private:
     43  /** Recalculates the position of the cylinder representing the bond.
     44   *
     45   */
    4346  void resetPosition();
     47
     48  /** Recalculates the width of the cylinder representing the bond's degree.
     49   *
     50   */
     51  void resetWidth();
     52
    4453  const bond& _bond;
    4554  /** Observable instance inside atom_observable for left bond partner.
Note: See TracChangeset for help on using the changeset viewer.