KDChartLineAttributes.cpp

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

Klarälvdalens Datakonsult AB (KDAB)
Qt-related services and products
http://www.kdab.com/
http://www.kdab.com/products/kd-chart/