KDChartLineAttributes.cpp

Go to the documentation of this file.
00001 /****************************************************************************
00002  ** Copyright (C) 2007 Klarälvdalens Datakonsult AB.  All rights reserved.
00003  **
00004  ** This file is part of the KD Chart library.
00005  **
00006  ** This file may be distributed and/or modified under the terms of the
00007  ** GNU General Public License version 2 as published by the Free Software
00008  ** Foundation and appearing in the file LICENSE.GPL included in the
00009  ** packaging of this file.
00010  **
00011  ** Licensees holding valid commercial KD Chart licenses may use this file in
00012  ** accordance with the KD Chart Commercial License Agreement provided with
00013  ** the Software.
00014  **
00015  ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00016  ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00017  **
00018  ** See http://www.kdab.net/kdchart for
00019  **   information about KDChart Commercial License Agreements.
00020  **
00021  ** Contact info@kdab.net if any conditions of this
00022  ** licensing are not clear to you.
00023  **
00024  **********************************************************************/
00025 
00026 #include "KDChartLineAttributes.h"
00027 #include <QDebug>
00028 
00029 #include <KDABLibFakes>
00030 
00031 #define d d_func()
00032 
00033 using namespace KDChart;
00034 
00035 class LineAttributes::Private
00036 {
00037     friend class LineAttributes;
00038 public:
00039     Private();
00040 
00041 private:
00042     //Areas
00043     MissingValuesPolicy missingValuesPolicy;
00044     bool displayArea;
00045     uint transparency;
00046     int areaBoundingDataset;
00047 };
00048 
00049 
00050 LineAttributes::Private::Private()
00051     : missingValuesPolicy( MissingValuesAreBridged )
00052     , displayArea( false )
00053     , transparency( 255 )
00054     , areaBoundingDataset( -1 )
00055 {
00056 }
00057 
00058 
00059 LineAttributes::LineAttributes()
00060     : _d( new Private() )
00061 {
00062 }
00063 
00064 LineAttributes::LineAttributes( const LineAttributes& r )
00065     : _d( new Private( *r.d ) )
00066 {
00067 }
00068 
00069 LineAttributes& LineAttributes::operator= ( const LineAttributes& r )
00070 {
00071     if( this == &r )
00072         return *this;
00073 
00074     *d = *r.d;
00075 
00076     return *this;
00077 }
00078 
00079 LineAttributes::~LineAttributes()
00080 {
00081     delete _d; _d = 0;
00082 }
00083 
00084 bool LineAttributes::operator==( const LineAttributes& r ) const
00085 {
00086     return
00087         missingValuesPolicy() == r.missingValuesPolicy() &&
00088         displayArea() == r.displayArea() &&
00089         transparency() == r.transparency() &&
00090         areaBoundingDataset() == r.areaBoundingDataset();
00091 }
00092 
00093 void LineAttributes::setMissingValuesPolicy( MissingValuesPolicy policy )
00094 {
00095     d->missingValuesPolicy = policy;
00096 }
00097 
00098 LineAttributes::MissingValuesPolicy LineAttributes::missingValuesPolicy() const
00099 {
00100     return d->missingValuesPolicy;
00101 }
00102 
00103 void LineAttributes::setDisplayArea( bool display )
00104 {
00105     d->displayArea = display;
00106 }
00107 
00108 bool LineAttributes::displayArea() const
00109 {
00110    return d->displayArea;
00111 }
00112 
00113 void LineAttributes::setTransparency( uint alpha )
00114 {
00115      if ( alpha > 255 )
00116         alpha = 255;
00117     d->transparency = alpha;
00118 }
00119 
00120 uint LineAttributes::transparency() const
00121 {
00122      return d->transparency;
00123 }
00124 
00125 void LineAttributes::setAreaBoundingDataset( int dataset )
00126 {
00127    d->areaBoundingDataset = dataset;
00128 }
00129 
00130 int LineAttributes::areaBoundingDataset() const
00131 {
00132     return d->areaBoundingDataset;
00133 }
00134 
00135 #if !defined(QT_NO_DEBUG_STREAM)
00136 QDebug operator<<(QDebug dbg, const KDChart::LineAttributes& a)
00137 {
00138     dbg << "KDChart::LineAttributes("
00139             //     MissingValuesPolicy missingValuesPolicy;
00140             << "bool="<<a.displayArea()
00141             << "transparency="<<a.transparency()
00142             << "areaBoundingDataset="<<a.areaBoundingDataset()
00143             << ")";
00144     return dbg;
00145 
00146 }
00147 #endif /* QT_NO_DEBUG_STREAM */

Generated on Thu Mar 4 23:19:11 2010 for KD Chart 2 by  doxygen 1.5.4