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 : 2006-05-11 00022 ** Authors : 00023 ** Marc Wathelet 00024 ** Marc Wathelet (LGIT, Grenoble, France) 00025 ** 00026 ***************************************************************************/ 00027 00028 #ifndef LIVEGRIDLAYER_H 00029 #define LIVEGRIDLAYER_H 00030 00031 #include <QGpCoreTools.h> 00032 00033 #include "SciFigsDLLExport.h" 00034 #include "IrregularGrid2DPlot.h" 00035 #include "GridPlot.h" 00036 00037 namespace SciFigs { 00038 00039 class LiveGridLayerProperties; 00040 00041 class SCIFIGS_EXPORT LiveGridLayer : public GridPlot 00042 { 00043 Q_OBJECT 00044 public: 00045 LiveGridLayer(AxisWindow * parent); 00046 ~LiveGridLayer(); 00047 00048 virtual const QString& xml_tagName() const {return IrregularGrid2DPlot::xmlIrregularGrid2DPlotTag;} 00049 00050 void setFunction(AbstractFunction2 * f); 00051 AbstractFunction2 * takeFunction(); 00052 const AbstractFunction2 * function() const {return _function;} 00053 00054 bool autoAdjustPalette() const {return _autoAdjustPalette;} 00055 void setAutoAdjustPalette(bool a) {_autoAdjustPalette=a;} 00056 00057 bool forceMinimumValue() const {return _forceMinimumValue;} 00058 void setForceMinimumValue(bool f) {_forceMinimumValue=f;} 00059 00060 double minimumValue() const {return _minimumValue;} 00061 void setMinimumValue(double m) {_minimumValue=m;} 00062 00063 bool forceMaximumValue() const {return _forceMaximumValue;} 00064 void setForceMaximumValue(bool f) {_forceMaximumValue=f;} 00065 00066 double maximumValue() const {return _maximumValue;} 00067 void setMaximumValue(double m) {_maximumValue=m;} 00068 00069 SamplingParameters::Type scale() const {return _scale;} 00070 void setScale(SamplingParameters::Type s) {_scale=s;} 00071 00072 void setSampling(int s) {_sampling=s;} 00073 int sampling() const {return _sampling;} 00074 00075 void setSmallestDetail(double d) {_smallestDetail=d;} 00076 int smallestDetail() const {return _smallestDetail;} 00077 00078 virtual bool hasProperties() {return true;} 00079 virtual void addProperties(PropertyProxy * pp); 00080 virtual void removeProperties(PropertyProxy * pp); 00081 virtual void properties(PropertyWidget * w) const; 00082 virtual void setProperty(uint wid, int pid, QVariant val); 00083 00084 virtual Rect boundingRect() const; 00085 private slots: 00086 void showAdjustedPalette(const ColorPalette& pal); 00087 signals: 00088 void paletteAdjusted(const ColorPalette& pal) const; 00089 protected: 00090 virtual void paintData(const LayerPainterRequest& lp, QPainter& p, double dotpercm) const; 00091 virtual void xml_writeChildren(XML_WRITECHILDREN_ARGS) const; 00092 00093 AbstractFunction2 * _function; 00094 int _sampling; 00095 double _smallestDetail; 00096 private: 00097 IrregularGrid2D calculateGrid(const QSize& s, const GraphContentOptions& gc, 00098 const LayerPainterRequest * lp=0) const; 00099 void adjustPalette(const IrregularGrid2D& grid, ColorPalette& pal) const; 00100 //inline void fillRow(GraphContent * gc, uint *& imPtr, double y, int w, int w1) const; 00101 //inline void fillRowSup1(GraphContent * gc, uint *& imPtr, double y, int w, int w1) const; 00102 //inline void fillRowSup2(GraphContent * gc, uint *& imPtr, double y, int w, int w1) const; 00103 00104 uint _autoAdjustPalette:1; 00105 uint _forceMinimumValue:1; 00106 uint _forceMaximumValue:1; 00107 SamplingParameters::Type _scale:2; 00108 double _minimumValue, _maximumValue; 00109 static uint _tab; 00110 }; 00111 00112 } // namespace SciFigs 00113 00114 #endif // LIVEGRIDLAYER_H