23 #ifndef PALETTEORGANIZER_H
24 #define PALETTEORGANIZER_H
26 #include "../../common/sharedStructures.h"
27 #include "../../common/sharedStructuresQt.h"
28 #include "../../common/sharedStructuresGraphics.h"
31 #include <qsharedpointer.h>
33 #include <qsettings.h>
43 m_paletteData.name =
"";
44 m_paletteData.type = 0;
45 m_paletteData.inverseColorOne = QColor();
46 m_paletteData.inverseColorTwo = QColor();
47 m_paletteData.invalidColor = QColor();
51 m_paletteData.name = name;
52 m_paletteData.type = type;
53 m_paletteData.inverseColorOne = QColor();
54 m_paletteData.inverseColorTwo = QColor();
55 m_paletteData.invalidColor = QColor();
57 ItomPaletteBase(
const QString &name,
const char type,
const QColor &invCol1,
const QColor &invCol2,
const QColor &invalCol,
const QVector<QGradientStop> &colStops)
59 m_paletteData.name = name;
60 m_paletteData.type = type;
61 m_paletteData.inverseColorOne = invCol1;
62 m_paletteData.inverseColorTwo = invCol2;
63 m_paletteData.invalidColor = invalCol;
64 m_paletteData.colorStops = colStops;
66 ItomPaletteBase(
const QString &name,
const char type,
const QColor &start,
const QColor &stop)
68 m_paletteData.name = name;
69 m_paletteData.type = type;
70 m_paletteData.colorStops.append(QPair<double, QColor>(0.0, start));
71 m_paletteData.colorStops.append(QPair<double, QColor>(1.0, stop));
78 m_paletteData.colorStops.clear();
81 QString getName()
const {
return m_paletteData.name; }
82 bool setName(
const QString &name);
83 inline int getNumColorStops()
const {
return m_paletteData.colorStops.size(); }
84 inline int getType()
const {
return m_paletteData.type; }
86 double getPosFirst()
const {
return m_paletteData.colorStops[0].first; }
87 double getPosLast()
const {
return m_paletteData.colorStops[m_paletteData.colorStops.size()-1].first; }
88 double getPos(
unsigned int color)
const;
91 QColor getInverseColorOne()
const {
return m_paletteData.inverseColorOne; }
93 QColor getInverseColorTwo()
const {
return m_paletteData.inverseColorTwo; }
99 inline QVector<QPair<double, QColor> > getColorStops(
void)
const {
return m_paletteData.colorStops; }
100 bool setColorStops(
const QVector<QPair<double, QColor> > &colorStops);
101 QColor
getColor(
unsigned int index)
const;
105 bool isWriteProtected()
const {
return m_paletteData.type & ito::tPaletteReadOnly; }
106 inline void setWriteProtection() { m_paletteData.type = m_paletteData.type | ito::tPaletteReadOnly; }
107 void removeWriteProtection() { m_paletteData.type = m_paletteData.type & (~
ito::tPaletteReadOnly); }
110 QVector<ito::uint32>
get256Colors(
bool includeAlpha =
false)
const;
138 QList<QString> getBuiltInPaletteNames()
const {
return m_builtInPalettes; }
139 int numberOfColorPalettes()
const {
return m_colorPalettes.length(); }
140 bool removeColorPalette(
const int index);
143 void calcColorPaletteLut();
145 QList<QString> m_restrictedKeyWords;
146 QList<ItomPaletteBase> m_colorPalettes;
147 QList<QString> m_builtInPalettes;
148 QHash<QString,int> m_colorPaletteLUT;
Definition: paletteOrganizer.h:38
int findUpper(double pos) const
Find the next color stop and its values within this palette.
Definition: paletteOrganizer.cpp:48
bool setInverseColorOne(const QColor &color)
Set the first inverse color for this color bar.
Definition: paletteOrganizer.cpp:83
Definition: paletteOrganizer.h:117
Class for managing status values (like errors or warning)
Definition: retVal.h:54
double getPos(unsigned int color) const
Get the position of the n-th color-stop in the palette.
Definition: paletteOrganizer.cpp:224
PaletteOrganizer()
shortdesc
Definition: paletteOrganizer.cpp:354
ItomPalette getPalette() const
This function returns the internal structur of the palette.
Definition: paletteOrganizer.cpp:249
QColor getColor(unsigned int index) const
Get the RGBA-Color of the n-th color-stop in the palette.
Definition: paletteOrganizer.cpp:238
QVector< ito::uint32 > get256Colors(bool includeAlpha=false) const
Transform the color stops to a 256 color vector.
Definition: paletteOrganizer.cpp:262
Definition: apiFunctionsGraph.cpp:39
semaphore which can be used for asychronous thread communication. By using this class it is possible ...
Definition: sharedStructuresQt.h:57
bool setInvalidColor(const QColor &color)
Set the invalid color for this color bar.
Definition: paletteOrganizer.cpp:134
int getColorBarIndex(const QString &name, bool *found=NULL) const
shortdesc
Definition: paletteOrganizer.cpp:626
ItomPaletteBase getColorPalette(const int index) const
shortdesc
Definition: paletteOrganizer.cpp:587
QList< QString > getColorPaletteList(const int type=ito::tPaletteNoType) const
shortdesc
Definition: paletteOrganizer.cpp:644
bool insertColorStop(double pos, const QColor &color)
Insert a new color stop into the palette defined by color and position.
Definition: paletteOrganizer.cpp:168
bool setInverseColorTwo(const QColor &color)
Set the second inverse color for this color bar.
Definition: paletteOrganizer.cpp:102
Definition: sharedStructuresGraphics.h:113
QColor getInvalidColor() const
Get the invalid color for this color bar.
Definition: paletteOrganizer.cpp:153