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