poolimage.h

Go to the documentation of this file.
00001 /*!@file Qt/poolimage.h */
00002 
00003 // //////////////////////////////////////////////////////////////////// //
00004 // The iLab Neuromorphic Vision C++ Toolkit - Copyright (C) 2001 by the //
00005 // University of Southern California (USC) and the iLab at USC.         //
00006 // See http://iLab.usc.edu for information about this project.          //
00007 // //////////////////////////////////////////////////////////////////// //
00008 // Major portions of the iLab Neuromorphic Vision Toolkit are protected //
00009 // under the U.S. patent ``Computation of Intrinsic Perceptual Saliency //
00010 // in Visual Environments, and Applications'' by Christof Koch and      //
00011 // Laurent Itti, California Institute of Technology, 2001 (patent       //
00012 // pending; application number 09/912,225 filed July 23, 2001; see      //
00013 // http://pair.uspto.gov/cgi-bin/final/home.pl for current status).     //
00014 // //////////////////////////////////////////////////////////////////// //
00015 // This file is part of the iLab Neuromorphic Vision C++ Toolkit.       //
00016 //                                                                      //
00017 // The iLab Neuromorphic Vision C++ Toolkit is free software; you can   //
00018 // redistribute it and/or modify it under the terms of the GNU General  //
00019 // Public License as published by the Free Software Foundation; either  //
00020 // version 2 of the License, or (at your option) any later version.     //
00021 //                                                                      //
00022 // The iLab Neuromorphic Vision C++ Toolkit is distributed in the hope  //
00023 // that it will be useful, but WITHOUT ANY WARRANTY; without even the   //
00024 // implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      //
00025 // PURPOSE.  See the GNU General Public License for more details.       //
00026 //                                                                      //
00027 // You should have received a copy of the GNU General Public License    //
00028 // along with the iLab Neuromorphic Vision C++ Toolkit; if not, write   //
00029 // to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,   //
00030 // Boston, MA 02111-1307 USA.                                           //
00031 // //////////////////////////////////////////////////////////////////// //
00032 //
00033 // Primary maintainer for this file:
00034 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/Qt/poolimage.h $
00035 // $Id: poolimage.h 12269 2009-12-17 01:23:34Z itti $
00036 //
00037 
00038 #ifndef QT_POOL_IMAGE_H_DEFINED
00039 #define QT_POOL_IMAGE_H_DEFINED
00040 
00041 #ifdef INVT_HAVE_QT3
00042 
00043 #include <qgl.h>
00044 
00045 class iconImage
00046 {
00047         public:
00048                 iconImage(){};
00049                 iconImage(int ax, int ay,int size)
00050                 {
00051                         x = ax; y = ay;
00052                         edgeSize = size;
00053                         selected = false;
00054                         glx = (x - 300) * 0.01137; gly = (y - 220) * 0.01137;
00055                 };
00056                 void setPosition(int ax, int ay)
00057                 {
00058                         x = x + ax; y = y + ay;
00059                         glx = glx + GLfloat(ax) * 0.01137;
00060                         gly = gly - GLfloat(ay) * 0.01137;
00061                 };
00062                 iconImage operator=(const iconImage other)
00063                 {
00064                         iconImage temp;
00065                         temp.x = other.x;
00066                         temp.y = other.y;
00067                         temp.glx = other.glx;
00068                         temp.gly = other.gly;
00069                         temp.selected = other.selected;
00070                         temp.edgeSize = other.edgeSize;
00071                         return temp;
00072                 };
00073                 int x, y;
00074                 GLfloat glx, gly;
00075 
00076                 int selected;
00077                 int edgeSize;
00078 };
00079 class PoolImage : public QGLWidget
00080 {
00081         public:
00082                 PoolImage(QWidget * parent = 0, const char *name = 0);
00083                 void createIcon(int num);
00084                 void currentItem(int item);
00085                 float getAngle();
00086                 void getCoord(int i, int &x, int &y);
00087                 //void setAngle(float a);
00088                 void setCoordByPix(int i, int x, int y);
00089                 void setCoordByGL(int i, float glx, float gly);
00090                 //void setScale(float a);
00091                 void getRealPosition(int i, float &rx, float &ry);
00092                 void getGLPosition(float rx, float ry, float &gx, float &gy);
00093 
00094                 inline void reset(){free(iconlist); sizeOfList = 0;};
00095                 inline iconImage *getList(){return iconlist;};
00096 
00097                 float angle;
00098                 float scale;
00099         protected:
00100                 void initializeGL();
00101                 void resizeGL(int w, int h);
00102                 void paintGL();
00103 
00104                 void mousePressEvent(QMouseEvent *event);
00105                 void mouseMoveEvent(QMouseEvent *event);
00106                 void mouseDoubleClickEvent(QMouseEvent *event);
00107                 void mouseReleaseEvent(QMouseEvent *event);
00108         private:
00109                 void draw();
00110                 bool right;
00111                 QColor colors[7];
00112                 QPoint lastPos;
00113                 QPoint dragPos;
00114                 int sizeOfList;
00115                 int maxX, minX, maxY, minY;
00116                 iconImage *iconlist;
00117 };
00118 
00119 #endif // INVT_HAVE_QT3
00120 
00121 #endif // QT_POOL_IMAGE_H_DEFINED
00122 
00123 // ######################################################################
00124 /* So things look consistent in everyone's emacs... */
00125 /* Local Variables: */
00126 /* mode: c++ */
00127 /* indent-tabs-mode: nil */
00128 /* End: */
00129 
Generated on Sun May 8 08:41:15 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3