papyrus logo

affinecontroller.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2007 by Rick L. Vinyard, Jr.                            *
00003  *   rvinyard@cs.nmsu.edu                                                  *
00004  *                                                                         *
00005  *   This file is part of the papyrus library.                             *
00006  *                                                                         *
00007  *   papyrus is free software; you can redistribute it and/or modify       *
00008  *   it under the terms of the GNU Lesser General Public License           *
00009  *   version 3.0 as published by the Free Software Foundation.             *
00010  *                                                                         *
00011  *   papyrus is distributed in the hope that it will be useful,            *
00012  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00014  *   GNU Lesser General Public License version 3.0 for more details.       *
00015  *                                                                         *
00016  *   You should have received a copy of the GNU Lesser General Public      *
00017  *   License along with the papyrus library. If not, see                   *
00018  *   <http://www.gnu.org/licenses/>.                                       *
00019  ***************************************************************************/
00020 #ifndef PAPYRUSAFFINECONTROLLER_H
00021 #define PAPYRUSAFFINECONTROLLER_H
00022 
00023 #include <cairomm/cairomm.h>
00024 #include <papyrus/drawablecontroller.h>
00025 
00026 namespace Papyrus
00027 {
00028 
00032   class AffineController : public DrawableController
00033   {
00034     protected:
00035 
00044       AffineController ( const Glib::ustring& id, DrawableSet::pointer drawables, double tx = 0.0, double ty = 0.0, double sx = 1.0, double sy = 1.0, double r = 0.0 );
00045 
00046     public:
00047 
00048       typedef PapyrusPointer<AffineController> pointer;
00049 
00050       static pointer create ( const Glib::ustring& id, double tx = 0.0, double ty = 0.0, double sx = 1.0, double sy = 1.0, double r = 0.0 );
00051 
00052       static pointer create ( const Glib::ustring& id, DrawableSet::pointer drawables, double tx = 0.0, double ty = 0.0, double sx = 1.0, double sy = 1.0, double r = 0.0 );
00053 
00054       static pointer create ( double tx = 0.0, double ty = 0.0, double sx = 1.0, double sy = 1.0, double r = 0.0 );
00055 
00056       static pointer create ( DrawableSet::pointer drawables, double tx = 0.0, double ty = 0.0, double sx = 1.0, double sy = 1.0, double r = 0.0 );
00057 
00058       ~AffineController();
00059 
00061       double get_translate_x();
00062 
00064       double get_translate_y();
00065 
00067       void get_translate ( double& tx, double& ty );
00068 
00074       void set_translate_x ( double tx );
00075 
00081       void set_translate_y ( double ty );
00082 
00088       void set_translate ( double tx, double ty );
00089 
00090       void translate ( double x, double y );
00091 
00093       void get_scale ( double& sx, double& sy );
00094 
00100       void set_scale_x ( double scale_x );
00101 
00107       void set_scale_y ( double scale_y );
00108 
00115       void set_scale ( double scale_x, double scale_y );
00116 
00122       void set_scale ( double s );
00123 
00124       void scale ( double x, double y );
00125 
00126       void scale ( double s );
00127 
00129       double get_rotation ( DegRad unit=RADIANS );
00130 
00132       void set_rotation ( double r, DegRad unit=RADIANS );
00133 
00139       void rotate ( double r, DegRad unit=RADIANS );
00140 
00142       void get_skew ( double& skewx, double& skewy, DegRad unit=RADIANS );
00143 
00145       void set_skew_x ( double skewx, DegRad unit=RADIANS );
00146 
00148       void set_skew_y ( double skewy, DegRad unit=RADIANS );
00149 
00151       void set_skew ( double skewx, double skewy, DegRad unit=RADIANS );
00152 
00154       void set_skew ( double s, DegRad unit=RADIANS );
00155 
00157       void skew ( double x, double y, DegRad unit=RADIANS );
00158 
00160       void skew ( double s, DegRad unit=RADIANS );
00161 
00163       double centroid_x();
00164 
00166       void set_centroid_x ( double centroid_x );
00167 
00169       double centroid_y();
00170 
00172       void set_centroid_y ( double centroid_y );
00173 
00175       void get_centroid ( double& centroid_x, double& centroid_y );
00176 
00178       void set_centroid ( double centroid_x, double centroid_y );
00179 
00181       Matrix& matrix();
00182 
00184       const Matrix& matrix() const;
00185 
00186       int matrix_level() const;
00187 
00188       void set_matrix_level ( int level );
00189 
00194       void reset_position();
00195 
00197       sigc::signal<void> signal_xy();
00198 
00200       sigc::signal<void> signal_scale();
00201 
00203       sigc::signal<void> signal_rotation();
00204 
00206       sigc::signal<void> signal_skew();
00207 
00209       sigc::signal<void> signal_centroid();
00210 
00211     protected:
00213       double m_tx;
00214 
00216       double m_ty;
00217 
00219       double m_sx;
00220 
00222       double m_sy;
00223 
00225       double m_r;
00226 
00228       double m_skewx;
00229 
00231       double m_skewy;
00232 
00234       double m_centroid_x;
00235 
00237       double m_centroid_y;
00238 
00240       Matrix::pointer m_matrix;
00241 
00242       int m_matrix_level;
00243 
00249       void recalculate_matrix();
00250 
00252       sigc::signal<void> m_signal_xy;
00253 
00255       sigc::signal<void> m_signal_scale;
00256 
00258       sigc::signal<void> m_signal_rotation;
00259 
00261       sigc::signal<void> m_signal_skew;
00262 
00264       sigc::signal<void> m_signal_centroid;
00265 
00266       virtual void on_drawable_added ( Drawable::pointer d );
00267 
00268       virtual void on_drawable_removed ( Drawable::pointer d );
00269 
00270   };
00271 
00272 }
00273 
00274 #endif

Generated on Fri Apr 16 12:40:10 2010 for papyrus by doxygen 1.6.1