GeopsyGui/TimeWindowLayer.h
Go to the documentation of this file.
00001 /***************************************************************************
00002 **
00003 **  This file is part of GeopsyGui.
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 : 2006-04-21
00022 **  Authors :
00023 **    Marc Wathelet
00024 **    Marc Wathelet (LGIT, Grenoble, France)
00025 **
00026 ***************************************************************************/
00027 
00028 #ifndef TIMEWINDOWLAYER_H
00029 #define TIMEWINDOWLAYER_H
00030 
00031 #include <SciFigs.h>
00032 #include <GeopsyCore.h>
00033 
00034 #include "TimeWindowList.h"
00035 #include "GeopsyGuiDLLExport.h"
00036 
00037 namespace GeopsyGui {
00038 
00039 class SignalLayer;
00040 
00041 class GEOPSYGUI_EXPORT TimeWindowLayer : public GraphContentLayer
00042 {
00043   Q_OBJECT
00044   Q_PROPERTY(double size READ size WRITE setSize SCRIPTABLE true)
00045   Q_PROPERTY(bool showColors READ showColors WRITE setShowColors SCRIPTABLE true)
00046 public:
00047   TimeWindowLayer(AxisWindow * parent=0);
00048   TimeWindowLayer(SignalLayer * sig);
00049   virtual ~TimeWindowLayer();
00050 
00051   virtual const QString& xml_tagName() const {return xmlTimeWindowLayerTag;}
00052   static const QString xmlTimeWindowLayerTag;
00053 
00054   void addTimeWindows(const SubSignalPool& subPool, TimeWindowList * l);
00055   void addTimeWindows(Signal * sig, TimeWindowList * l);
00056   void clearTimeWindows();
00057 
00058   virtual Rect boundingRect() const;
00059 
00060   double size() const {return _size;}
00061   void setSize(double s);
00062 
00063   bool showColors() const {return _showColors;}
00064   void setShowColors(bool b);
00065 protected:
00066   virtual void xml_writeProperties(XML_WRITEPROPERTIES_ARGS) const;
00067   virtual void xml_writeChildren(XML_WRITECHILDREN_ARGS) const;
00068   virtual XMLMember xml_member(XML_MEMBER_ARGS);
00069   virtual bool xml_setProperty(XML_SETPROPERTY_ARGS);
00070   virtual void xml_layerPolish(XML_POLISH_ARGS);
00071 private:
00072   virtual void paintData(const LayerPainterRequest& lp, QPainter& p, double dotpercm) const;
00073 
00074   inline void paintTimeWindows(const GraphContentOptions& gc, QPainter& p,
00075                                const TimeWindowList& windows, Signal * sig, int iSig) const;
00076 
00077   SignalLayer * _sig;
00078   QMap<Signal *, TimeWindowList *> _windows;
00079 
00080   double _size;
00081   bool _showColors;
00082   bool _windowOwner;
00083 
00084   struct XMLTimeWindowList
00085   {
00086     QMap<int, TimeWindowList *> _windows;
00087     QString _signalLayerName;
00088   };
00089   XMLTimeWindowList * _xmlWindows;
00090 };
00091 
00092 } // namespace GeopsyGui
00093 
00094 #endif // TIMEWINDOWLAYER_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines