Changeset 592d42 for src


Ignore:
Timestamp:
Oct 5, 2013, 9:31:54 AM (11 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:
76e224
Parents:
5e4bfd
git-author:
Frederik Heber <heber@…> (09/27/13 19:45:07)
git-committer:
Frederik Heber <heber@…> (10/05/13 09:31:54)
Message:

Added enable/disable for DreiBein and domain box.

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

Legend:

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

    r5e4bfd r592d42  
    113113GLWorldView::~GLWorldView()
    114114{
     115  QSettings settings;
     116  settings.beginGroup("WorldView");
     117  settings.setValue("domainBoxEnabled", (meshDomainBox->options() & QGLSceneNode::HideNode) == 0);
     118  settings.setValue("dreiBeinEnabled", (meshDreiBein->options() & QGLSceneNode::HideNode) == 0);
     119  settings.endGroup();
     120
     121
    115122  World::getInstance().signOff(this);
    116123  World::getInstance().signOff(this, World::AtomInserted);
     
    189196  connect(selMolAction, SIGNAL(triggered()), worldscene, SLOT(setSelectionModeMolecule()));
    190197  toolbar->addAction(selMolAction);
     198
     199  // dreiBein/domain enabler
     200  toolbar->addSeparator();
     201  QAction *seldreiBein = new QAction(QIcon(QPixmap(":/icon_dreiBein.png")), tr("enable/disable dreiBein"), this);
     202  connect(seldreiBein, SIGNAL(triggered()), this, SLOT(changeDreiBein()));
     203  toolbar->addAction(seldreiBein);
     204  QAction *seldomain = new QAction(QIcon(QPixmap(":/icon_domain.png")), tr("enable/disable domain box"), this);
     205  connect(seldomain, SIGNAL(triggered()), this, SLOT(changeDomain()));
     206  toolbar->addAction(seldomain);
    191207}
    192208
     
    201217  settings.setValue("domainBoxColorAmbient", colorAmbient);
    202218  settings.setValue("domainBoxColorDiffuse", colorDiffuse);
     219  const bool status = settings.value("domainBoxEnabled").toBool();
    203220  settings.endGroup();
    204221
     
    221238  meshDomainBox->setLocalTransform(mat);
    222239  meshDomainBox->setMaterial(material);
     240
     241  setDomainStatus( status );
    223242}
    224243
     
    233252  settings.setValue("dreiBeinColorY", colorY);
    234253  settings.setValue("dreiBeinColorZ", colorZ);
    235   settings.setValue("dreiBeinEnabled", true);
     254  const bool status = settings.value("dreiBeinEnabled").toBool();
    236255  settings.endGroup();
    237256
     
    291310  node->addNode(cone);
    292311  node->setPosition(QVector3D(0.f, 0.f, .8f));
     312
     313  setdreiBeinStatus( status );
    293314}
    294315
     
    424445}
    425446
     447void GLWorldView::changeDreiBein()
     448{
     449  // invert to new status
     450  const bool status = ((meshDreiBein->options() & QGLSceneNode::HideNode) == 0);
     451  setdreiBeinStatus(!status);
     452  // realize
     453  updateGL();
     454  needsRedraw = true;
     455}
     456
     457void GLWorldView::setdreiBeinStatus(const bool status)
     458{
     459  if (status)
     460    meshDreiBein->setOptions( meshDreiBein->options() & (255-QGLSceneNode::HideNode) );
     461  else
     462    meshDreiBein->setOptions( meshDreiBein->options() | QGLSceneNode::HideNode );
     463}
     464
     465void GLWorldView::changeDomain()
     466{
     467  // invert to new status
     468  const bool status = ((meshDomainBox->options() & QGLSceneNode::HideNode) == 0);
     469  setDomainStatus(!status);
     470  // realize
     471  updateGL();
     472  needsRedraw = true;
     473}
     474
     475void GLWorldView::setDomainStatus(const bool status)
     476{
     477  if (status)
     478    meshDomainBox->setOptions( meshDomainBox->options() & (255-QGLSceneNode::HideNode) );
     479  else
     480    meshDomainBox->setOptions( meshDomainBox->options() | QGLSceneNode::HideNode );
     481}
     482
    426483void GLWorldView::sceneChangeSignalled()
    427484{
     
    654711  glDisable(GL_CULL_FACE);
    655712
    656   // Draw the outlines.
    657   painter->setFaceMaterial(QGL::AllFaces, domainBoxMaterial);
    658   //glEnable(GL_LINE_SMOOTH);
    659   QVector3DArray array;
    660   array.append(0, 0, 0); array.append(1, 0, 0);
    661   array.append(1, 0, 0); array.append(1, 1, 0);
    662   array.append(1, 1, 0); array.append(0, 1, 0);
    663   array.append(0, 1, 0); array.append(0, 0, 0);
    664 
    665   array.append(0, 0, 1); array.append(1, 0, 1);
    666   array.append(1, 0, 1); array.append(1, 1, 1);
    667   array.append(1, 1, 1); array.append(0, 1, 1);
    668   array.append(0, 1, 1); array.append(0, 0, 1);
    669 
    670   array.append(0, 0, 0); array.append(0, 0, 1);
    671   array.append(1, 0, 0); array.append(1, 0, 1);
    672   array.append(0, 1, 0); array.append(0, 1, 1);
    673   array.append(1, 1, 0); array.append(1, 1, 1);
    674   painter->clearAttributes();
    675   painter->setVertexAttribute(QGL::Position, array);
    676   painter->draw(QGL::Lines, 24);
     713  // Draw the outlines (if we have drawn the box itself)
     714  if ((meshDomainBox->options() & QGLSceneNode::HideNode) == 0) {
     715    painter->setFaceMaterial(QGL::AllFaces, domainBoxMaterial);
     716    //glEnable(GL_LINE_SMOOTH);
     717    QVector3DArray array;
     718    array.append(0, 0, 0); array.append(1, 0, 0);
     719    array.append(1, 0, 0); array.append(1, 1, 0);
     720    array.append(1, 1, 0); array.append(0, 1, 0);
     721    array.append(0, 1, 0); array.append(0, 0, 0);
     722
     723    array.append(0, 0, 1); array.append(1, 0, 1);
     724    array.append(1, 0, 1); array.append(1, 1, 1);
     725    array.append(1, 1, 1); array.append(0, 1, 1);
     726    array.append(0, 1, 1); array.append(0, 0, 1);
     727
     728    array.append(0, 0, 0); array.append(0, 0, 1);
     729    array.append(1, 0, 0); array.append(1, 0, 1);
     730    array.append(0, 1, 0); array.append(0, 1, 1);
     731    array.append(1, 1, 0); array.append(1, 1, 1);
     732    painter->clearAttributes();
     733    painter->setVertexAttribute(QGL::Position, array);
     734    painter->draw(QGL::Lines, 24);
     735  }
    677736
    678737  painter->modelViewMatrix().pop();
  • src/UIElements/Views/Qt4/Qt3D/GLWorldView.hpp

    r5e4bfd r592d42  
    5252  void sceneChangeSignalled();
    5353  void sceneHoverSignalled(const atom *_atom);
     54  void changeDreiBein();
     55  void changeDomain();
    5456
    5557signals:
     
    100102
    101103private:
     104  void setdreiBeinStatus(const bool status);
     105  void setDomainStatus(const bool status);
     106
     107private:
    102108
    103109  GLWorldScene *worldscene;
Note: See TracChangeset for help on using the changeset viewer.