plotmaplabel.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                         plotmaplabel.h  -  description
00003                              -------------------
00004     begin                : Tue Mar 29 2005
00005     copyright            : (C) 2005-2006 by Ben Swerts
00006     email                : bswerts@users.sourceforge.net
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00020 
00021 #ifndef PLOTMAPLABEL_H
00022 #define PLOTMAPLABEL_H
00023 
00025 
00026 // STL header files
00027 #include <vector>
00028 using std::vector;
00029 
00030 // Qt forward class declarations
00031 #include <qcolor.h>
00032 class QPixmap;
00033 #include <qpointarray.h>
00034 
00035 // Xbrabo header files
00036 #include "point3d.h"
00037 
00038 // Base class header file
00039 #include <qlabel.h>
00040 
00042 class PlotMapLabel : public QLabel
00043 {
00044   public:
00046     PlotMapLabel(QWidget* parent, const char* name = 0, WFlags fl = 0);         // constructor
00047     ~PlotMapLabel();                    // destructor
00048 
00050     void setDrawStyle(const unsigned int style, const bool cubic);  // sets the drawing style
00051     void setDensityPixmap(const QPixmap& pixmap); // sets the pixmap containing density values
00052     void setCrosses(const vector<Point3D<double> >& centers);        // sets the positions of the atoms to be shown and their color
00053     void setGrid(const Point3D<unsigned int>& pointDimension, const Point3D<double>& pointDelta);         // sets the parameters defining the grid
00054     void setIsoCurves(const vector< vector<Point3D<double> >* >& curves, const vector<QColor>& lineColors); // ordered points making up isocurves
00055     void setPolygons(const vector< vector<Point3D<double> > >& polygons, const vector<QColor>& colors); // sets the data for the drawing of polygons
00056     void setColors(const QColor& zero, const QColor& atom); // sets the primary colors use for drawing 
00057     void startDrag(const QPoint& pos);  // indicates a drag is started at pos (labelcoordinates)
00058     void moveDrag(const QPoint& pos);   // indicates actual dragging
00059     void endDrag();                     // indicates dragging has ended
00060 
00061   protected:
00063     virtual void drawContents(QPainter* p);       // does the actual drawing
00064 
00065   private:
00067     QPointArray pointCurve(const vector<Point3D<double> >& curve, const bool cubicInterpolation, const double scaleX, const double scaleY, const unsigned int numInterpolated = 0);  // Returns the polygon with the specified curve and linearly or cubically interpolated
00068     QPointArray cardinalSpline(const Point3D<double>& controlPoint1, const Point3D<double>& startPoint, const Point3D<double>& endPoint, const Point3D<double>& controlPoint2, const unsigned int numInterpolated); // calculate the point for a cardinal spline defined by the 4 given points
00069 
00071     QPixmap* densityPixmap;             
00072     vector<Point3D<double> > crosses;   
00073     Point3D<unsigned int> numPoints;    
00074     Point3D<double> delta;              
00075     QPoint startPosition;               
00076     QPoint endPosition;                 
00077     bool drawDrag;                      
00078     vector< vector<Point3D<double> >* > isoCurves; 
00079     //vector<QColor> isoCurveColors;      
00080     vector<QColor> isoLineColors;       
00081     QColor crossColor;                  
00082     QColor zeroColor;                   
00083     unsigned int drawStyle;             
00084     bool cubicInterpolation;            
00085     vector< vector<Point3D<double> > > isoPolygons;         
00086     vector<QColor> isoPolygonColors;    
00087 };
00088 
00089 #endif
00090 

Generated on Fri May 19 14:31:55 2006 for Brabosphere by  doxygen 1.4.6-NO