GeopsyGui/ChronogramLayer.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 : 2009-06-09
00022 **  Authors :
00023 **    Marc Wathelet
00024 **    Marc Wathelet (LGIT, Grenoble, France)
00025 **
00026 ***************************************************************************/
00027 
00028 #ifndef CHRONOGRAMLAYER_H
00029 #define CHRONOGRAMLAYER_H
00030 
00031 #include <GeopsyCore.h>
00032 #include <SciFigs.h>
00033 
00034 #include "GeopsyGuiDLLExport.h"
00035 
00036 #define CHRONOGRAMLAYER_TRACKING_ID 347
00037 
00038 namespace GeopsyGui {
00039 
00040 class GEOPSYGUI_EXPORT ChronogramLayer : public GraphContentLayer
00041 {
00042   Q_OBJECT
00043 public:
00044   ChronogramLayer(AxisWindow * parent=0);
00045   ~ChronogramLayer();
00046 
00047   virtual const QString& xml_tagName() const {return xmlChronogramLayerTag;}
00048   static const QString xmlChronogramLayerTag;
00049 
00050   void subPoolUpdate(SubSignalPool * subPool=0);
00051   void rangeUpdate();
00052 
00053   const SubSignalPool * subPool() const {return _subPool;}
00054 
00055   virtual Rect boundingRect() const;
00056 
00057   int hitCount() const {return _stations.count()*_stations.nComponents();}
00058   QString name(int index) const;
00059 
00060   virtual bool hasProperties() {return true;}
00061   virtual void addProperties(PropertyProxy * pp);
00062   virtual void removeProperties(PropertyProxy * pp);
00063   virtual void properties(PropertyWidget * w) const;
00064   virtual void setProperty(uint wid, int pid, QVariant val);
00065 
00066   void exportGaps(const QString& fileName);
00067 
00068   virtual bool trackRectangle(int id, double rx1, double ry1, double rx2, double ry2, Qt::KeyboardModifiers m);
00069   SubSignalPool selection() const;
00070 protected:
00071   virtual void paintData(const LayerPainterRequest& lp, QPainter& p, double dotpercm) const;
00072   void xml_writeChildren(XML_WRITECHILDREN_ARGS) const;
00073   XMLMember xml_member(XML_MEMBER_ARGS);
00074   void xml_polishChild(XML_POLISHCHILD_ARGS);
00075 private:
00076   void drawRanges(const GraphContentOptions& gc, QPainter& p,
00077                   const SparseTimeRange& r,
00078                   double yBase, double minY, double maxY,
00079                   const QColor& fill, const QColor& border) const;
00080 
00081   SubSignalPool * _subPool;
00082   bool _subPoolOwner;
00083   StationList _stations;
00084   double _minimumGap;
00085 
00086   static uint _tab;
00087   struct StationRange {
00088     SparseTimeRange _selected, _available, _overlap;
00089   };
00090   QVector<StationRange> _ranges;
00091 };
00092 
00093 } // namespace GeopsyGui
00094 
00095 #endif // CHRONOGRAMLAYER_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines