KD Chart 2: KDChartEnums.h Source File

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

# KDChartEnums.h

Go to the documentation of this file.

    00001 /* -*- Mode: C++ -*-
    00002    KDChart - a multi-platform charting engine
    00003    */
    00004
    00005 /****************************************************************************
    00006  ** Copyright (C) 2001-2006 Klarälvdalens Datakonsult AB.  All rights reserved.
    00007  **
    00008  ** This file is part of the KD Chart library.
    00009  **
    00010  ** This file may be distributed and/or modified under the terms of the
    00011  ** GNU General Public License version 2 as published by the Free Software
    00012  ** Foundation and appearing in the file LICENSE.GPL included in the
    00013  ** packaging of this file.
    00014  **
    00015  ** Licensees holding valid commercial KD Chart licenses may use this file in
    00016  ** accordance with the KD Chart Commercial License Agreement provided with
    00017  ** the Software.
    00018  **
    00019  ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
    00020  ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
    00021  **
    00022  ** See http://www.kdab.net/kdchart for
    00023  **   information about KD Chart Commercial License Agreements.
    00024  **
    00025  ** Contact info@kdab.net if any conditions of this
    00026  ** licensing are not clear to you.
    00027  **
    00028  **********************************************************************/
    00029 #ifndef __KDCHARTENUMS_H__
    00030 #define __KDCHARTENUMS_H__
    00031
    00032 #include "KDChartGlobal.h"
    00033
    00034 #include <QRectF>
    00035 #include <QObject>
    00036 #include <QVector>
    00037
    00046 class KDCHART_EXPORT KDChartEnums :public QObject
    00047 {
    00048     Q_OBJECT
    00049     Q_ENUMS( TextLayoutPolicy )
    00050     Q_ENUMS( AreaName )
    00051     Q_ENUMS( PositionFlag )
    00052
    00053 public:
    00101     enum GranularitySequence {
    00102         GranularitySequence_10_20,
    00103         GranularitySequence_10_50,
    00104         GranularitySequence_25_50,
    00105         GranularitySequence_125_25,
    00106         GranularitySequenceIrregular };
    00107
    00115     static QString granularitySequenceToString( GranularitySequence sequence ) {
    00116         switch( sequence ) {
    00117             case GranularitySequence_10_20:
    00118                 return QString::fromLatin1("GranularitySequence_10_20");
    00119             case GranularitySequence_10_50:
    00120                 return QString::fromLatin1("GranularitySequence_10_50");
    00121             case GranularitySequence_25_50:
    00122                 return QString::fromLatin1("GranularitySequence_25_50");
    00123             case GranularitySequence_125_25:
    00124                 return QString::fromLatin1("GranularitySequence_125_25");
    00125             case GranularitySequenceIrregular:
    00126                 return QString::fromLatin1("GranularitySequenceIrregular");
    00127             default: // should not happen
    00128         qDebug( "Unknown granularity sequence" );
    00129         return QString::fromLatin1("GranularitySequence_10_20");
    00130         }
    00131     }
    00132
    00133
    00140     static GranularitySequence stringToGranularitySequence( const QString& string ) {
    00141       if( string == QString::fromLatin1("GranularitySequence_10_20") )
    00142           return GranularitySequence_10_20;
    00143       if( string == QString::fromLatin1("GranularitySequence_10_50") )
    00144           return GranularitySequence_10_50;
    00145       if( string == QString::fromLatin1("GranularitySequence_25_50") )
    00146           return GranularitySequence_25_50;
    00147       if( string == QString::fromLatin1("GranularitySequence_125") )
    00148           return GranularitySequence_125_25;
    00149       if( string == QString::fromLatin1("GranularitySequenceIrregular") )
    00150           return GranularitySequenceIrregular;
    00151       // default, should not happen
    00152       return GranularitySequence_10_20;
    00153     }
    00154
    00155
    00168     enum TextLayoutPolicy { LayoutJustOverwrite,
    00169         LayoutPolicyRotate,
    00170         LayoutPolicyShiftVertically,
    00171         LayoutPolicyShiftHorizontally,
    00172         LayoutPolicyShrinkFontSize };
    00173
    00181     static QString layoutPolicyToString( TextLayoutPolicy type );
    00182
    00183
    00190     static TextLayoutPolicy stringToLayoutPolicy( const QString& string );
    00191
    00192
    00199     enum PositionValue {
    00200         PositionUnknown   = 0,
    00201         PositionCenter    = 1,
    00202         PositionNorthWest = 2,
    00203         PositionNorth     = 3,
    00204         PositionNorthEast = 4,
    00205         PositionEast      = 5,
    00206         PositionSouthEast = 6,
    00207         PositionSouth     = 7,
    00208         PositionSouthWest = 8,
    00209         PositionWest      = 9,
    00210         PositionFloating  =10
    00211     };
    00212
    00213
    00229     enum MeasureCalculationMode { MeasureCalculationModeAbsolute,
    00230         MeasureCalculationModeRelative,
    00231         MeasureCalculationModeAuto,
    00232         MeasureCalculationModeAutoArea,
    00233         MeasureCalculationModeAutoOrientation };
    00234
    00242     static QString measureCalculationModeToString( MeasureCalculationMode mode ) {
    00243         switch( mode ) {
    00244             case MeasureCalculationModeAbsolute:
    00245                 return QString::fromLatin1("MeasureCalculationModeAbsolute");
    00246             case MeasureCalculationModeAuto:
    00247                 return QString::fromLatin1("MeasureCalculationModeAuto");
    00248             case MeasureCalculationModeAutoArea:
    00249                 return QString::fromLatin1("MeasureCalculationModeAutoArea");
    00250             case MeasureCalculationModeAutoOrientation:
    00251                 return QString::fromLatin1("MeasureCalculationModeAutoOrientation");
    00252             case MeasureCalculationModeRelative:
    00253                 return QString::fromLatin1("MeasureCalculationModeRelative");
    00254             default: // should not happen
    00255         qDebug( "Unknown measure calculation mode" );
    00256         return QString::fromLatin1("MeasureCalculationModeAuto");
    00257         }
    00258     }
    00259
    00260
    00267     static MeasureCalculationMode stringToMeasureCalculationMode( const QString& string ) {
    00268       if( string == QString::fromLatin1("MeasureCalculationModeAbsolute") )
    00269           return MeasureCalculationModeAbsolute;
    00270       if( string == QString::fromLatin1("MeasureCalculationModeAuto") )
    00271           return MeasureCalculationModeAuto;
    00272       if( string == QString::fromLatin1("MeasureCalculationModeAutoArea") )
    00273           return MeasureCalculationModeAutoArea;
    00274       if( string == QString::fromLatin1("MeasureCalculationModeAutoOrientation") )
    00275           return MeasureCalculationModeAutoOrientation;
    00276       if( string == QString::fromLatin1("MeasureCalculationModeRelative") )
    00277           return MeasureCalculationModeRelative;
    00278       // default, should not happen
    00279       return MeasureCalculationModeAuto;
    00280     }
    00281
    00298     enum MeasureOrientation { MeasureOrientationAuto,
    00299         MeasureOrientationHorizontal,
    00300         MeasureOrientationVertical,
    00301         MeasureOrientationMinimum,
    00302         MeasureOrientationMaximum };
    00303
    00311     static QString measureOrientationToString( MeasureOrientation mode ) {
    00312         switch( mode ) {
    00313             case MeasureOrientationAuto:
    00314                 return QString::fromLatin1("MeasureOrientationAuto");
    00315             case MeasureOrientationHorizontal:
    00316                 return QString::fromLatin1("MeasureOrientationHorizontal");
    00317             case MeasureOrientationVertical:
    00318                 return QString::fromLatin1("MeasureOrientationVertical");
    00319             case MeasureOrientationMinimum:
    00320                 return QString::fromLatin1("MeasureOrientationMinimum");
    00321             case MeasureOrientationMaximum:
    00322                 return QString::fromLatin1("MeasureOrientationMaximum");
    00323             default: // should not happen
    00324         qDebug( "Unknown measure orientation mode" );
    00325         return QString::fromLatin1("MeasureOrientationAuto");
    00326         }
    00327     }
    00328
    00329
    00336     static MeasureOrientation stringToMeasureOrientation( const QString& string ) {
    00337       if( string == QString::fromLatin1("MeasureOrientationAuto") )
    00338           return MeasureOrientationAuto;
    00339       if( string == QString::fromLatin1("MeasureOrientationHorizontal") )
    00340           return MeasureOrientationHorizontal;
    00341       if( string == QString::fromLatin1("MeasureOrientationVertical") )
    00342           return MeasureOrientationVertical;
    00343       if( string == QString::fromLatin1("MeasureOrientationMinimum") )
    00344           return MeasureOrientationMinimum;
    00345       if( string == QString::fromLatin1("MeasureOrientationMaximum") )
    00346           return MeasureOrientationMaximum;
    00347       // default, should not happen
    00348       return MeasureOrientationAuto;
    00349     }
    00350
    00351
    00352 };
    00353
    00354
    00355 #endif