SciFigs/ParallelBands.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 : 2003-12-11
00022 **  Authors :
00023 **    Marc Wathelet
00024 **    Marc Wathelet (ULg, Liège, Belgium)
00025 **    Marc Wathelet (LGIT, Grenoble, France)
00026 **
00027 ***************************************************************************/
00028 
00029 #ifndef PARALLELBANDS_H
00030 #define PARALLELBANDS_H
00031 
00032 #include "ParallelBand.h"
00033 #include "GraphContentLayer.h"
00034 
00035 namespace SciFigs {
00036 
00037 class SCIFIGS_EXPORT ParallelBands :  public GraphContentLayer
00038 {
00039   Q_OBJECT
00040   Q_PROPERTY(QString axisType READ axisTypeString WRITE setAxisType SCRIPTABLE true)
00041 public:
00042   ParallelBands(AxisWindow * parent=0);
00043   ~ParallelBands();
00044 
00045   virtual const QString& xml_tagName() const {return xmlParallelBandsTag;}
00046   static const QString xmlParallelBandsTag;
00047 
00048   void operator=(ParallelBands& o);
00049   void clear();
00050 
00051   virtual Rect boundingRect() const;
00052 
00053   void setAxisType(AxisType a);
00054   AxisType axisType() const {return _axisType;}
00055   QString axisTypeString() const {return _axisType==XAxis ?"X":"Y";}
00056   void setAxisType(QString t) {if(t.contains("X")) setAxisType(XAxis); else setAxisType(YAxis);}
00057 
00058   virtual bool trackRectangle(int, double rx1, double ry1, double rx2, double ry2, Qt::KeyboardModifiers);
00059 
00060   void addBand(const Brush& b, const Pen& p=Qt::NoPen);
00061   void addBand(double value, const Pen& p=Qt::SolidLine);
00062   void addBand(double min, double max, const Brush& b=Qt::SolidPattern, const Pen& p=Qt::NoPen);
00063   void addBand(const ParallelBand& b) {_bands.append(b);}
00064   void removeBand(int index);
00065 
00066   int count() const {return _bands.count();}
00067   ParallelBand& band(int index) {return _bands[index];}
00068   const ParallelBand& band(int index) const {return _bands[index];}
00069 signals:
00070   void bandPicked(double min, double max);
00071 protected:
00072   virtual void paintData(const LayerPainterRequest& lp, QPainter& p, double dotpercm) const;
00073   virtual void xml_writeChildren(XML_WRITECHILDREN_ARGS) const;
00074   virtual XMLMember xml_member(XML_MEMBER_ARGS);
00075 protected:
00076   AxisType _axisType;
00077   QVector<ParallelBand> _bands;
00078 };
00079 
00080 } // namespace SciFigs
00081 
00082 #endif // PARALLELBANDS_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines