VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkQtChartSeriesOptions.h 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00015 /*------------------------------------------------------------------------- 00016 Copyright 2008 Sandia Corporation. 00017 Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 00018 the U.S. Government retains certain rights in this software. 00019 -------------------------------------------------------------------------*/ 00020 00023 00024 #ifndef _vtkQtChartSeriesOptions_h 00025 #define _vtkQtChartSeriesOptions_h 00026 00027 #include "vtkQtChartExport.h" 00028 #include "vtkQtChartLayer.h" // needed for enum 00029 #include "vtkQtPointMarker.h" // needed for enum 00030 00031 #include <QObject> 00032 #include <QVariant> 00033 #include <QMap> 00034 #include <QBrush> 00035 #include <QPen> 00036 #include <QSizeF> 00037 00038 class vtkQtChartSeriesColors; 00039 00044 class VTKQTCHART_EXPORT vtkQtChartSeriesOptions : public QObject 00045 { 00046 Q_OBJECT 00047 00048 public: 00049 enum OptionType 00050 { 00051 VISIBLE, 00052 PEN, 00053 BRUSH, 00054 COLORS, 00055 AXES_CORNER, 00056 MARKER_STYLE, 00057 MARKER_SIZE, 00058 LABEL, 00059 NUMBER_OF_OPTION_TYPES 00060 }; 00061 00062 public: 00066 vtkQtChartSeriesOptions(QObject *parent=0); 00067 vtkQtChartSeriesOptions(const vtkQtChartSeriesOptions &other); 00068 virtual ~vtkQtChartSeriesOptions(); 00069 00070 vtkQtChartSeriesOptions &operator=(const vtkQtChartSeriesOptions &other); 00071 00076 bool isVisible() const 00077 { return this->getGenericOption(VISIBLE).toBool(); } 00078 00082 void setVisible(bool visible) 00083 { this->setGenericOption(VISIBLE, visible); } 00084 00089 QPen getPen() const 00090 { return this->getGenericOption(PEN).value<QPen>(); } 00091 00095 void setPen(const QPen &pen) 00096 { return this->setGenericOption(PEN, pen); } 00097 00102 QBrush getBrush() const 00103 { return this->getGenericOption(BRUSH).value<QBrush>(); } 00104 00108 void setBrush(const QBrush &brush) 00109 { this->setGenericOption(BRUSH, brush); } 00110 00115 vtkQtChartSeriesColors *getSeriesColors() const; 00116 00124 void setSeriesColors(vtkQtChartSeriesColors *colors); 00125 00130 vtkQtChartLayer::AxesCorner getAxesCorner() const 00131 { 00132 return static_cast<vtkQtChartLayer::AxesCorner>( 00133 this->getGenericOption(AXES_CORNER).value<int>()); 00134 } 00135 00139 void setAxesCorner(vtkQtChartLayer::AxesCorner axes) 00140 { this->setGenericOption(AXES_CORNER, axes); } 00141 00146 vtkQtPointMarker::MarkerStyle getMarkerStyle() const 00147 { 00148 return 00149 static_cast<vtkQtPointMarker::MarkerStyle>( 00150 this->getGenericOption(MARKER_STYLE).value<int>()); 00151 } 00152 00156 void setMarkerStyle(vtkQtPointMarker::MarkerStyle style) 00157 { 00158 this->setGenericOption(MARKER_STYLE, style); 00159 } 00160 00165 QSizeF getMarkerSize() const 00166 { return this->getGenericOption(MARKER_SIZE).value<QSizeF>(); } 00167 00171 void setMarkerSize(const QSizeF &size) 00172 { this->setGenericOption(MARKER_SIZE, size); } 00173 00177 QString getLabel() const 00178 { return this->getGenericOption(LABEL).toString(); } 00179 00180 void setLabel(const QString& label) 00181 { this->setGenericOption(LABEL, label); } 00182 00185 void setGenericOption(OptionType type, const QVariant& value); 00186 00189 QVariant getGenericOption(OptionType type) const; 00190 00193 void setDefaultOption(OptionType type, const QVariant& value); 00194 00195 signals: 00201 void dataChanged(int type, 00202 const QVariant& newValue, const QVariant& oldValue); 00203 00204 private: 00205 QMap<OptionType, QVariant> Data; 00206 QMap<OptionType, QVariant> Defaults; 00207 00208 void InitializeDefaults(); 00209 }; 00210 00211 #endif 00212