Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   Examples  

qscurve.h

00001 /***************************************************************************
00002                                 qscurve.h
00003                              -------------------                                         
00004     begin                : 01-January-2000
00005     copyright            : (C) 2000 by Kamil Dobkowski                         
00006     email                : kamildobk@poczta.onet.pl                                     
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   * 
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 
00019 #ifndef QSCURVE_H
00020 #define QSCURVE_H
00021 
00022 #ifdef HAVE_CONFIG_H
00023 #include <config.h>
00024 #endif
00025 
00026 #include"qsaxes.h"
00027 #include"qsplot.h"
00028 #include"qscoord.h"
00029 #include"qssegment.h"
00030 
00031 //-------------------------------------------------------------------//
00032 
00033 
00034 
00042 class QSCurve : public QSPlot2D
00043  {
00044   Q_OBJECT
00045     Q_PROPERTY( int type READ type WRITE setType )
00046     Q_PROPERTY( double fixedDX READ fixedDX WRITE setFixedDX )
00047     Q_PROPERTY( double fixedDY READ fixedDY WRITE setFixedDY )
00048     Q_PROPERTY( double percentDX READ percentDX WRITE setPercentDX )
00049     Q_PROPERTY( double percentDY READ percentDY WRITE setPercentDY )
00050     Q_PROPERTY( double zeroLevelX READ zeroLevelX WRITE setZeroLevelX )
00051     Q_PROPERTY( double zeroLevelY READ zeroLevelY WRITE setZeroLevelY )
00052     Q_PROPERTY( QString arrow1 READ arrow1Property WRITE setArrow1Property )
00053     Q_PROPERTY( QString arrow2 READ arrow2Property WRITE setArrow2Property )
00054     
00055   public:
00056 
00065         enum Channels   {
00066                           XVector  = 0,
00067                           YVector  = 1,
00068                           DXVector = 2,
00069                           DYVector = 3,
00070                           LineStyles = 4,
00071                           FillStyles = 5,
00072               PointStyles = 6,
00073               ArrowStyles = 7,
00074               ErrorLineStyles = 8,
00075               XLineStyles = 9,
00076               YLineStyles = 10
00077                         };
00078 
00079 
00084     enum SeriesType {
00085              Lines = 0,
00086              Area,
00087              Ribbon,
00088              Bars,
00089              Vectors,
00090              Flux,
00091              Rectangles,
00092              Ellipses,
00093              LeftStairs,
00094              MiddleStairs,
00095              RightStairs,
00096              User
00097             };
00098     
00102     QSCurve( QSAxes* parent, const char * name=0 );
00106        ~QSCurve();
00110         void setType( int type );
00114         int type() const { return m_type; }
00122     void setFixedDelta( const QSPt2f& delta );
00126     void setFixedDX( double value );
00130     void setFixedDY( double value );
00136     void setPercentDelta( const QSPt2f& delta );
00140     void setPercentDX( double value );
00144     void setPercentDY( double value );
00148     QSPt2f fixedDelta() const { return m_fdelta; }
00152     double fixedDX() const { return m_fdelta.x; }
00156     double fixedDY() const { return m_fdelta.y; }
00160     QSPt2f percentDelta() const { return m_pdelta; }
00164     double percentDX() const { return m_pdelta.x; }
00168     double percentDY() const { return m_pdelta.y; }
00173         void setZeroPoint( const QSPt2f& p );
00177         void setZeroLevelX( double x );
00181         void setZeroLevelY( double y ); 
00185         QSPt2f zeroPoint() const { return m_zero; }
00189     double zeroLevelX() const { return m_zero.x; }
00193     double zeroLevelY() const { return m_zero.y; }
00199         void setPObject( QSSegment *po );
00203         QSSegment *pObject() const { return m_po; }
00207     void setArrow1( const QSGArrow& astyle );
00211     void setArrow2( const QSGArrow& astyle );
00215     void setArrow1Property( const QString& value ) { setArrow1(toQSGArrow(value)); }
00219     void setArrow2Property( const QString& value ) { setArrow2(toQSGArrow(value)); }
00223     QSGArrow arrow1() const { return m_arrow1; }
00227     QSGArrow arrow2() const { return m_arrow2; }
00231     QString arrow1Property() const { return toQString(arrow1()); }
00235     QString arrow2Property() const { return toQString(arrow2()); }
00236 
00237 
00238     virtual QString posInfo( QSPt2f& pos );
00239         virtual QSPt2f legendItemSize( QSDrv *drv );
00240         virtual void drawLegendItem( const QSPt2f& pos, QSDrv *drv );
00241     virtual void loadStateFromStream( QDataStream& stream, QSObjectFactory *factory );
00242     virtual void saveStateToStream( QDataStream& stream, QSObjectFactory *factory );
00243     virtual QString channelVariable( int channel ) const;   
00244         virtual ColumnType columnType( int channel, int column ) const;
00248      enum FillElement {
00249         BaseFill    = 0
00250         };
00251         
00255      enum LineElement {
00256         BaseLine    = 0,
00257         ErrorLine   = 1,
00258         XLine       = 2,
00259         YLine       = 3
00260         };
00261         
00265      enum PointElement {
00266         PointMark   = 0
00267         };
00268 
00269       protected:
00270 
00271         virtual void dataChanged( int channel = -1 );
00272     virtual void allocRuntimeData();
00273         virtual void freeRuntimeData();
00274         virtual bool getAxisRange( QSAxis *axis, double& min, double& max );
00275         virtual bool start();
00276         virtual bool step();
00277         virtual void end();
00278 
00279      private:
00280         SeriesType   m_type;
00281         QSPt2f       m_zero;
00282         QSPt2f       m_fdelta;
00283         QSPt2f       m_pdelta;
00284         QSGArrow     m_arrow1;
00285     QSGArrow     m_arrow2;
00286         QSSegment   *m_po;
00287         double       m_xmin, m_xmax;
00288         double       m_ymin, m_ymax;
00289         bool         m_evalid;   // extremes valid
00290     struct       curve_runtime_data *d;
00291     
00292     enum Stage {
00293                  StartDrawLines  = 0,
00294                  DrawLines       = 1,
00295                  StartDrawSeries     = 2,
00296                  DrawSeries          = 3,
00297                  StartDrawErrorbars  = 4,
00298                  DrawErrorbars   = 5,
00299                  StartDrawPointMarks = 6,
00300                  DrawPointMarks  = 7,
00301                  Stop        = 8 };
00302             
00303         void create_po();   
00304     void get_values( int index );
00305     void get_attributes( int index );
00306     void start_draw_errorbars();
00307     void draw_errorbars();
00308     void start_draw_series();
00309     void draw_series();
00310     void start_draw_lines();
00311     void draw_lines();
00312     void start_draw_pointmarks();
00313     void draw_pointmarks();
00314  };
00315 
00316 
00317 
00318 #endif
00319 
00320 
00321 
00322 
00323 
00324 
00325 
00326 
00327 
00328 
00329 
00330 
00331 
00332 
00333 
00334 
00335 
00336 
00337 
00338 
00339 
00340 
00341 
00342 
00343 
00344 
00345 
00346 
00347 
00348 
00349 
00350 
00351 
00352 
00353 
00354 
00355 
00356 
00357 
00358 
00359 
00360 
00361 
00362 
00363 
00364 
00365 
00366 
00367 
00368 
00369 
00370 
00371 
00372 
00373 
00374 
00375 
00376 
00377 
00378 
00379 
00380 

Generated on Mon Mar 18 19:16:32 2002 for KMatplot library by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002