libavogadro/src/point.h

00001 /**********************************************************************
00002   Point - Point class derived from the base Primitive class
00003 
00004   Copyright (C) 2008 Tim Vandermeersch
00005 
00006   This file is part of the Avogadro molecular editor project.
00007   For more information, see <http://avogadro.openmolecules.net/>
00008 
00009   Avogadro is free software; you can redistribute it and/or modify
00010   it under the terms of the GNU General Public License as published by
00011   the Free Software Foundation; either version 2 of the License, or
00012   (at your option) any later version.
00013 
00014   Avogadro is distributed in the hope that it will be useful,
00015   but WITHOUT ANY WARRANTY; without even the implied warranty of
00016   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017   GNU General Public License for more details.
00018 
00019   You should have received a copy of the GNU General Public License
00020   along with this program; if not, write to the Free Software
00021   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00022   02110-1301, USA.
00023  **********************************************************************/
00024 
00025 #ifndef POINT_H
00026 #define POINT_H
00027 
00028 #include <avogadro/primitive.h>
00029 #include <avogadro/color.h>
00030 
00031 #include <QList>
00032 #include <QMouseEvent>
00033 
00034 namespace Avogadro {
00035 
00044   class PointPrivate;
00045   class A_EXPORT Point : public Primitive
00046   {
00047     Q_OBJECT
00048 
00049     public:
00055       Point(QObject *parent=0);
00056 
00057       ~Point();
00058 
00063       inline const Eigen::Vector3d &pos () const
00064       {
00065         return m_pos;
00066       }
00067 
00072       inline void setPos(const Eigen::Vector3d &vec)
00073       {
00074         m_pos = vec;
00075       }
00076 
00080       double radius() const 
00081       {
00082         return m_radius;
00083       }
00087       void setRadius(double value)
00088       {
00089         m_radius = value;
00090       }
00091 
00095       const Color* color()
00096       {
00097         return &m_color;
00098       }
00102       void setColor(const Color &color)
00103       {
00104         float red = color.red();
00105         float green = color.green();
00106         float blue = color.blue();
00107         float alpha = color.alpha();
00108         m_color.set(red, green, blue, alpha);
00109       }
00110 
00111       void mousePressed(QMouseEvent *event) { emit mousePressEvent(this, event); }
00112       void mouseMoved(QMouseEvent *event) { emit mouseMoveEvent(this, event); }
00113       void mouseReleased(QMouseEvent *event) { emit mouseReleaseEvent(this, event); }
00114     signals:
00115       void mousePressEvent(Point *point, QMouseEvent * event);
00116       void mouseMoveEvent(Point *point, QMouseEvent * event);
00117       void mouseReleaseEvent(Point *point, QMouseEvent * event);
00118 
00119     private:
00120       Eigen::Vector3d m_pos;
00121       double          m_radius;
00122       Color           m_color;
00123       Q_DECLARE_PRIVATE(Point)
00124   };
00125 
00126 } // End namespace Avoagdro
00127 
00128 #endif

Generated on Sat May 30 02:00:38 2009 for Avogadro by  doxygen 1.5.4