SciFigs/LayerPainterRequest.h
Go to the documentation of this file.
00001 /***************************************************************************
00002 **
00003 **  This file is part of SciFigs.
00004 **
00005 **  This library is free software; you can redistribute it and/or
00006 **  modify it under the terms of the GNU Lesser General Public
00007 **  License as published by the Free Software Foundation; either
00008 **  version 2.1 of the License, or (at your option) any later version.
00009 **
00010 **  This file is distributed in the hope that it will be useful, but WITHOUT
00011 **  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 **  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
00013 **  License for more details.
00014 **
00015 **  You should have received a copy of the GNU Lesser General Public
00016 **  License along with this library; if not, write to the Free Software
00017 **  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00018 **
00019 **  See http://www.geopsy.org for more information.
00020 **
00021 **  Created : 2008-02-14
00022 **  Authors :
00023 **    Marc Wathelet
00024 **    Marc Wathelet (LGIT, Grenoble, France)
00025 **
00026 ***************************************************************************/
00027 
00028 #ifndef LAYERPAINTERREQUEST_H
00029 #define LAYERPAINTERREQUEST_H
00030 
00031 #include <QtGui>
00032 
00033 #include "GraphContent.h"
00034 
00035 namespace SciFigs {
00036 
00037 class LayerPainterRequest: public QObject
00038 {
00039   Q_OBJECT
00040 public:
00041   LayerPainterRequest();
00042 
00043   void setGraphContent(GraphContent * gc) {_gc=gc;}
00044   GraphContent * graphContent() const {return _gc;}
00045   void setLayers(const QList<GraphContentLayer *>& layers) {_layers=layers;}
00046 
00047   void setSize(int w, int h) {_size=QSize(w, h);}
00048   void setSize(const QSize& s) {_size=s;}
00049   QSize size() const {return _size;}
00050 
00051   void setOptions(const QSharedDataPointer<GraphContentOptions> & o) {_options=o;}
00052   const GraphContentOptions& options() const {return *_options;}
00053 
00054   void setLayerImages(const LayerImages& li) {_layerImages=li;}
00055   const LayerImages& layerImages() const {return _layerImages;}
00056 
00057   void setDepth(int depth);
00058   int depth() const {return _depth;}
00059 
00060   void paint();
00061   void paintText();
00062   void terminate() {_terminate.fetchAndStoreOrdered(true);}
00063   bool terminated() const {return _terminate.testAndSetOrdered(true, true);}
00064 signals:
00065   void finished(QImage im, LayerImages li);
00066 private:
00067   inline void paintLayers(QPainter& p);
00068   inline void paintLayers(int fromIndex, QPainter& p);
00069 
00070   mutable QAtomicInt _terminate;
00071   QImage _image;
00072   QSize _size;
00073   GraphContent * _gc;
00074   QList<GraphContentLayer *> _layers;
00075   QSharedDataPointer<GraphContentOptions> _options;
00076   LayerImages _layerImages;
00077   int _depth;
00078 };
00079 
00080 } // namespace SciFigs
00081 
00082 #endif // LAYERPAINTERREQUEST_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines