00001 /**************************************************************************** 00002 ** Copyright (C) 2006 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 }; 00047 00048 00049 LineAttributes::Private::Private() 00050 : missingValuesPolicy( MissingValuesAreBridged ) 00051 , displayArea( false ) 00052 , transparency( 255 ) 00053 { 00054 } 00055 00056 00057 LineAttributes::LineAttributes() 00058 : _d( new Private() ) 00059 { 00060 } 00061 00062 LineAttributes::LineAttributes( const LineAttributes& r ) 00063 : _d( new Private( *r.d ) ) 00064 { 00065 } 00066 00067 LineAttributes& LineAttributes::operator= ( const LineAttributes& r ) 00068 { 00069 if( this == &r ) 00070 return *this; 00071 00072 *d = *r.d; 00073 00074 return *this; 00075 } 00076 00077 LineAttributes::~LineAttributes() 00078 { 00079 delete _d; _d = 0; 00080 } 00081 00082 bool LineAttributes::operator==( const LineAttributes& r ) const 00083 { 00084 return 00085 missingValuesPolicy() == r.missingValuesPolicy() && 00086 displayArea() == r.displayArea() && 00087 transparency() == r.transparency(); 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 #if !defined(QT_NO_DEBUG_STREAM) 00123 QDebug operator<<(QDebug dbg, const KDChart::LineAttributes& a) 00124 { 00125 dbg << "KDChart::LineAttributes(" 00126 // MissingValuesPolicy missingValuesPolicy; 00127 << "bool="<<a.displayArea() 00128 << "transparency="<<a.transparency() 00129 << ")"; 00130 return dbg; 00131 00132 } 00133 #endif /* QT_NO_DEBUG_STREAM */