SciFigs/XUniqueYColorLines.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 : 2007-08-23
00022 **  Authors :
00023 **    Marc Wathelet
00024 **    Marc Wathelet (LGIT, Grenoble, France)
00025 **
00026 ***************************************************************************/
00027 
00028 #ifndef XUNIQUEYCOLORLINES_H
00029 #define XUNIQUEYCOLORLINES_H
00030 
00031 #include "GraphContentLayer.h"
00032 #include "SciFigsDLLExport.h"
00033 
00034 namespace SciFigs {
00035 
00036 class XYColorLinesProperties;
00037 
00038 class SCIFIGS_EXPORT XUniqueYColorLines : public GraphContentLayer
00039 {
00040   Q_OBJECT
00041   Q_PROPERTY(double lineWeight READ lineWeight WRITE setLineWeight SCRIPTABLE true)
00042 public:
00043   XUniqueYColorLines(AxisWindow * parent=0);
00044   ~XUniqueYColorLines();
00045 
00046   virtual const QString& xml_tagName() const {return xmlXUniqueYColorLinesTag;}
00047   static const QString xmlXUniqueYColorLinesTag;
00048 
00049   void clear();
00050   void setPointCount(int nCurve, int nX);
00051 
00052   const double * x() const {return _x;}
00053   const double * y() const {return _y;}
00054   double * x() {return _x;}
00055   double * y() {return _y;}
00056 
00057   const QColor * colors() const {return _colors;}
00058   void setColors(QColor * col);
00059   void setColor(int index, const QColor& col);
00060 
00061   // Calculate the rectangle that includes all the curves
00062   Rect boundingRect() const;
00063 
00064   virtual bool trackRectangle(int, double rx1, double ry1, double rx2, double ry2, Qt::KeyboardModifiers);
00065   int curveCount() {return _curveCount;}
00066   inline void setLineWeight(double lw) {_lineWeight=lw;}
00067   double lineWeight() const {return _lineWeight;}
00068   double lineWeightMM() const {return _lineWeight*10.0;}
00069   void mulYbyX(double constant);
00070   void divYbyX(double constant);
00071 
00072   virtual bool hasProperties() {return true;}
00073   virtual void addProperties(PropertyProxy * pp);
00074   virtual void removeProperties(PropertyProxy * pp);
00075   virtual void properties(PropertyWidget * w) const;
00076   virtual void setProperty(uint wid, int pid, QVariant val);
00077 public slots:
00078   void setColor(int curveIndex, int red, int green, int blue);
00079 signals:
00080   void dataSelected(int id, const QVector<int> * indexList);
00081 protected:
00082   virtual void paintData(const LayerPainterRequest& lp, QPainter& p, double dotpercm) const;
00083 
00084   int _curveCount;
00085   int _xCount;
00086   double * _x;
00087   double * _y;
00088   QColor * _colors;
00089   // Line weight in cm
00090   double _lineWeight;
00091   // Storage for pointer to tab widget
00092   XYColorLinesProperties * _propertiesTab;
00093 protected:
00094   virtual void xml_writeProperties(XML_WRITEPROPERTIES_ARGS) const;
00095   virtual void xml_writeBinaryData(XML_WRITEBINARYDATA_ARGS) const;
00096   virtual bool xml_setBinaryData(XML_SETBINARYDATA_ARGS);
00097 };
00098 
00099 } // namespace SciFigs
00100 
00101 #endif // XUNIQUEYCOLORLINES_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines