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

qsgraphicaldata.h

00001 /***************************************************************************
00002                                    qgraphicaldata.h
00003                              -------------------
00004     version              : 0.2
00005     begin                : 01-January-2001
00006     copyright            : (C) 2000 by Kamil Dobkowski
00007     email                : kamildobk@poczta.onet.pl
00008  ***************************************************************************/
00009 
00010 /***************************************************************************
00011  *                                                                         *
00012  *   This program is free software; you can redistribute it and/or modify  *
00013  *   it under the terms of the GNU General Public License as published by  *
00014  *   the Free Software Foundation; either version 2 of the License, or     *
00015  *   (at your option) any later version.                                   *
00016  *                                                                         *
00017  ***************************************************************************/
00018 
00019 
00020 #ifndef QSGRAPHICALDATA_H
00021 #define QSGRAPHICALDATA_H
00022 
00023 #ifdef HAVE_CONFIG_H
00024 #include <config.h>
00025 #endif
00026 
00027 #include"qsdata.h"
00028 
00029 #define SET_PROPERTY( property, new_value )  if ((property)!=(new_value)) { parametersChanging(); (property)=(new_value); parametersChanged(); }
00030 
00038 class QSGraphicalData : public QSData
00039    {
00040     Q_OBJECT
00041     Q_PROPERTY( QString title READ title WRITE setTitle )
00042 
00043     public:
00047      QSGraphicalData( QObject *parent=0, QSGraphicalData *parentObject=0, const char *name=0 );
00051      virtual ~QSGraphicalData();
00055      void setTitle( const QString& title );
00059      QString title() const { return m_title_str; }
00063       virtual bool setMatrix( int channel, QSMatrix *m );
00069       virtual QSMatrix *matrix( int channel ) const;
00073       virtual void deleteMatrix( int channel );
00077       virtual QSMatrix *takeMatrix( int channel, QSMatrix *newMatrix );
00081       int channelCount() const { return m_channels_count; }
00087       inline double value( int row, int col, int channel ) { return m_channels[channel]->value(row,col); }
00091       int matrixRows( int channel ) const { return channel<m_channels_count?(m_channels[channel]?m_channels[channel]->rows():0):0; }
00095       int matrixCols( int channel ) const { return channel<m_channels_count?(m_channels[channel]?m_channels[channel]->cols():0):0; }
00099       bool isChannel( int channel ) const;
00103       void setFont( int e, const QSGFont &font );
00107       void setFill( int e, const QSGFill &fill );
00111       void setLine( int e, const QSGLine &line );
00115       void setPoint( int e, const QSGPoint &point );
00119       QSGFont font( int e ) const { return e<m_settings.fonts_count?m_settings.fonts[e]:QSGFont();  }
00123       QSGFill fill( int e ) const { return e<m_settings.fills_count?m_settings.fills[e]:QSGFill(); }
00127       QSGLine line( int e ) const { return e<m_settings.lines_count?m_settings.lines[e]:QSGLine(); }
00131       QSGPoint point( int e ) const { return e<m_settings.points_count?m_settings.points[e]:QSGPoint(); }
00135       int fontCount() const { return m_settings.fonts_count; }
00139      int fillCount() const { return m_settings.fills_count; }
00143      int lineCount() const { return m_settings.lines_count; }
00147      int pointCount() const { return m_settings.points_count; }
00151      virtual void loadStateFromStream( QDataStream& stream, QSObjectFactory *factory );
00155      virtual void saveStateToStream( QDataStream& stream, QSObjectFactory *factory );
00156 
00157    signals:                                                 
00161     void sigTitleChanged( const QString& newTitle );
00162 
00163    protected:
00167      static QSGFont fontFromData( QSMatrix *source, int row, int start_col, const QSGFont& default_value );
00171      static QSGFill fillFromData( QSMatrix *source, int row, int start_col, const QSGFill& default_value );
00175      static QSGLine lineFromData( QSMatrix *source, int row, int start_col, const QSGLine& default_value );
00179      static QSGPoint pointFromData( QSMatrix *source, int row, int start_col, const QSGPoint& default_value );
00183      static QSGArrow arrowFromData( QSMatrix *source, int row, int start_col, const QSGArrow& default_value );
00187      static QSGColor colorFromData( QSMatrix *source, int row, int start_col, const QSGColor& default_value );
00191      static ColumnType fontColumnFormat( int column );
00195      static ColumnType fillColumnFormat( int column );
00199      static ColumnType lineColumnFormat( int column );
00203      static ColumnType pointColumnFormat( int column );
00207      static ColumnType arrowColumnFormat( int column );
00211      static ColumnType colorColumnFormat( int column );
00212 
00216     void initChannelTable( int channels_num );
00220      void initAttributeTables( int fonts_num, int fills_num,  int lines_num, int points_num );
00228       virtual void parametersChanging();
00236       virtual void parametersChanged();
00241       double _log(  double value, double logBase = 10.0 ) { return log10(value)/log10(logBase); }
00245      struct settings_t {
00246         QSGFont  *fonts;
00247         QSGFill  *fills;
00248         QSGLine  *lines;
00249         QSGPoint *points;
00250     int fonts_count;
00251     int fills_count;
00252     int lines_count;
00253         int points_count;
00254        } m_settings;
00255 
00259      QSMatrix **m_channels;
00260      int m_channels_count;
00261 
00262      QString m_title_str;
00263      QSGraphicalData *m_parent_base_object;
00264    };
00265 
00266 #endif
00267 
00268 

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