• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • kdeedu
  • Sitemap
  • Contact Us
 

kalzium

clickmeasuretool.h

Go to the documentation of this file.
00001 /**********************************************************************
00002   ClickMeasureTool - ClickMeasureTool Tool for Avogadro
00003 
00004   Copyright (C) 2007 Donald Ephraim Curtis
00005   Copyright (C) 2008 Marcus D. Hanwell
00006 
00007   This file is part of the Avogadro molecular editor project.
00008   For more information, see <http://avogadro.sourceforge.net/>
00009 
00010   Avogadro is free software; you can redistribute it and/or modify
00011   it under the terms of the GNU General Public License as published by
00012   the Free Software Foundation; either version 2 of the License, or
00013   (at your option) any later version.
00014 
00015   Avogadro is distributed in the hope that it will be useful,
00016   but WITHOUT ANY WARRANTY; without even the implied warranty of
00017   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018   GNU General Public License for more details.
00019 
00020   You should have received a copy of the GNU General Public License
00021   along with this program; if not, write to the Free Software
00022   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00023   02110-1301, USA.
00024  **********************************************************************/
00025 
00026 #ifndef CLICKMEASURETOOL_H
00027 #define CLICKMEASURETOOL_H
00028 
00029 #include <avogadro/glwidget.h>
00030 #include <avogadro/tool.h>
00031 
00032 #include <eigen/regression.h>
00033 #include <openbabel/mol.h>
00034 
00035 #include <QGLWidget>
00036 #include <QObject>
00037 #include <QStringList>
00038 #include <QComboBox>
00039 #include <QVBoxLayout>
00040 #include <QVarLengthArray>
00041 #include <QImage>
00042 #include <QAction>
00043 #include <QPointer>
00044 #include <QVector>
00045 
00046 namespace Avogadro {
00047 
00048  class ClickMeasureTool : public Tool
00049   {
00050     Q_OBJECT
00051 
00052     public:
00054       ClickMeasureTool(QObject *parent = 0);
00056       virtual ~ClickMeasureTool();
00057 
00059 
00060 
00061       virtual QString name() const { return(tr("Measure")); }
00063       virtual QString description() const { return(tr("Click to Measure Tool")); }
00065 
00067 
00068 
00069 
00071       virtual QUndoCommand* mousePress(GLWidget *widget, const QMouseEvent *event);
00072       virtual QUndoCommand* mouseRelease(GLWidget *widget, const QMouseEvent *event);
00073       virtual QUndoCommand* mouseMove(GLWidget *widget, const QMouseEvent *event);
00074       virtual QUndoCommand* wheel(GLWidget *widget, const QWheelEvent *event);
00075 
00076       virtual bool paint(GLWidget *widget);
00077 
00078     private:
00079 
00080       /*
00081        * Calculates the relevant distances and angles and places them in member
00082        * variables.
00083        */
00084       void calculateParameters();
00085 
00086       Qt::MouseButtons m_buttons;
00087 
00088       bool                m_movedSinceButtonPressed;
00089 
00090       QPoint              m_initialDraggingPosition;
00091       QPoint              m_lastDraggingPosition;
00092 
00093       QVarLengthArray<QPointer<Atom>, 4> m_selectedAtoms;
00094       int m_numSelectedAtoms;
00095       QList<GLHit> m_hits;
00096 
00097       QComboBox *m_comboElements;
00098       QComboBox *m_comboBondOrder;
00099       QVBoxLayout *m_layout;
00100 
00101       Eigen::Vector3d m_vector[3];
00102       double m_angle;
00103       double m_dihedral;
00104       // Need to store the previous values of all variables in order to only send
00105       // an event to the information pane once
00106       QVector<double> m_lastMeasurement;
00107 
00108   };
00109 
00110   class ClickMeasureToolFactory : public QObject, public ToolFactory
00111     {
00112       Q_OBJECT
00113       Q_INTERFACES(Avogadro::ToolFactory)
00114 
00115       public:
00116         Tool *createInstance(QObject *parent = 0) { return new ClickMeasureTool(parent); }
00117     };
00118 
00119 } // end namespace Avogadro
00120 
00121 #endif

kalzium

Skip menu "kalzium"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdeedu

Skip menu "kdeedu"
  • kalzium
  • kanagram
  • kig
  •   lib
  • klettres
  • kstars
  • libkdeedu
  •   keduvocdocument
  •   docs
  •   src
  • parley
  •   stepcore
Generated for kdeedu by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal