KDChartBarAttributes.cpp

Go to the documentation of this file.
00001 /****************************************************************************
00002 ** Copyright (C) 2001-2010 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 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 "KDChartBarAttributes.h"
00024 #include <qglobal.h>
00025 
00026 #include <KDABLibFakes>
00027 
00028 #define d d_func()
00029 
00030 
00031 using namespace KDChart;
00032 
00033 class BarAttributes::Private
00034 {
00035     friend class BarAttributes;
00036 public:
00037     Private();
00038 
00039 private:
00040     qreal datasetGap;
00041     bool useFixedDatasetGap;
00042     qreal valueBlockGap;
00043     bool useFixedValueBlockGap;
00044     qreal barWidth;
00045     bool useFixedBarWidth;
00046     bool drawSolidExcessArrows;
00047     qreal groupGapFactor;
00048     qreal barGapFactor;
00049 };
00050 
00051 
00052 BarAttributes::Private::Private()
00053     :datasetGap( 6 ),
00054     useFixedDatasetGap( false ),
00055     valueBlockGap( 24 ),
00056     useFixedValueBlockGap( false ),
00057     barWidth( -1 ),
00058     useFixedBarWidth( false ),
00059     drawSolidExcessArrows( false ),
00060     groupGapFactor( 1.0 ),
00061     barGapFactor( 0.5 )
00062 {
00063 }
00064 
00065 
00066 BarAttributes::BarAttributes()
00067     : _d( new Private() )
00068 {
00069 }
00070 
00071 BarAttributes::BarAttributes( const BarAttributes& r )
00072     : _d( new Private( *r.d ) )
00073 {
00074 }
00075 
00076 BarAttributes& BarAttributes::operator= ( const BarAttributes& r )
00077 {
00078     if( this == &r )
00079         return *this;
00080 
00081     *d = *r.d;
00082 
00083     return *this;
00084 }
00085 
00086 BarAttributes::~BarAttributes()
00087 {
00088     delete _d; _d = 0;
00089 }
00090 
00091 
00092 bool BarAttributes::operator==( const BarAttributes& r ) const
00093 {
00094     if( fixedDataValueGap() == r.fixedDataValueGap() &&
00095         useFixedDataValueGap() == r.useFixedDataValueGap() &&
00096         fixedValueBlockGap() == r.fixedValueBlockGap() &&
00097         useFixedValueBlockGap() == r.useFixedValueBlockGap() &&
00098         fixedBarWidth() == r.fixedBarWidth() &&
00099         useFixedBarWidth() == r.useFixedBarWidth() &&
00100         groupGapFactor() == r.groupGapFactor() &&
00101         barGapFactor() == r.barGapFactor() &&
00102         drawSolidExcessArrows() == r.drawSolidExcessArrows() )
00103         return true;
00104     else
00105         return false;
00106 }
00107 
00108 
00109 void BarAttributes::setFixedDataValueGap( qreal gap )
00110 {
00111     d->datasetGap = gap;
00112 }
00113 
00114 qreal BarAttributes::fixedDataValueGap() const
00115 {
00116     return d->datasetGap;
00117 }
00118 
00119 void BarAttributes::setUseFixedDataValueGap( bool gapIsFixed )
00120 {
00121     d->useFixedDatasetGap = gapIsFixed;
00122 }
00123 
00124 bool BarAttributes::useFixedDataValueGap() const
00125 {
00126     return d->useFixedDatasetGap;
00127 }
00128 
00129 void BarAttributes::setFixedValueBlockGap( qreal gap )
00130 {
00131     d->valueBlockGap = gap;
00132 }
00133 
00134 qreal BarAttributes::fixedValueBlockGap() const
00135 {
00136     return d->valueBlockGap;
00137 }
00138 
00139 void BarAttributes::setUseFixedValueBlockGap( bool gapIsFixed )
00140 {
00141     d->useFixedValueBlockGap = gapIsFixed;
00142 }
00143 
00144 bool BarAttributes::useFixedValueBlockGap() const
00145 {
00146     return d->useFixedValueBlockGap;
00147 }
00148 
00149 void BarAttributes::setFixedBarWidth( qreal width )
00150 {
00151     d->barWidth = width;
00152 }
00153 
00154 qreal BarAttributes::fixedBarWidth() const
00155 {
00156 
00157     return d->barWidth;
00158 }
00159 
00160 void BarAttributes::setUseFixedBarWidth( bool useFixedBarWidth )
00161 {
00162     d->useFixedBarWidth = useFixedBarWidth;
00163 }
00164 
00165 bool BarAttributes::useFixedBarWidth() const
00166 {
00167     return d->useFixedBarWidth;
00168 }
00169 
00170 void BarAttributes::setGroupGapFactor( qreal gapFactor )
00171 {
00172     d->groupGapFactor = gapFactor;
00173 }
00174 
00175 qreal BarAttributes::groupGapFactor() const
00176 {
00177     return d->groupGapFactor;
00178 }
00179 
00180 void BarAttributes::setBarGapFactor( qreal gapFactor )
00181 {
00182     d->barGapFactor = gapFactor;
00183 }
00184 
00185 qreal BarAttributes::barGapFactor() const
00186 {
00187     return d->barGapFactor;
00188 }
00189 
00190 void BarAttributes::setDrawSolidExcessArrows( bool solidArrows )
00191 {
00192     d->drawSolidExcessArrows = solidArrows;
00193 }
00194 
00195 bool BarAttributes::drawSolidExcessArrows() const
00196 {
00197     return d->drawSolidExcessArrows;
00198 }
00199