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> 39 ItomPaletteBase():m_name(
""), m_type(0), m_inverseColorOne(), m_inverseColorTwo(), m_invalidColor() {m_colorStops.clear();};
40 ItomPaletteBase(
const QString name,
const char type): m_name(name), m_type(type), m_inverseColorOne(), m_inverseColorTwo(), m_invalidColor() {m_colorStops.clear();};
41 ItomPaletteBase(
const QString name,
const char type, QColor start, QColor stop): m_name(name), m_type(type), m_inverseColorOne(), m_inverseColorTwo() , m_invalidColor()
44 m_colorStops.append(QPair<double, QColor>(0.0, start));
45 m_colorStops.append(QPair<double, QColor>(1.0, stop));
50 m_invalidColor = scr.m_invalidColor;
51 m_inverseColorOne = scr.m_inverseColorOne;
52 m_inverseColorTwo = scr.m_inverseColorTwo;
56 m_colorStops = scr.m_colorStops;
57 m_paletteData = scr.m_paletteData;
60 ~
ItomPaletteBase() {m_colorStops.clear(); m_paletteData.colorStops.clear(); m_paletteData.colorVector256.clear();};
72 QString getName()
const {
return m_name;};
73 inline int getSize()
const {
return m_colorStops.size();};
74 inline int getType()
const {
return m_type;};
76 double getPosFirst()
const {
return m_colorStops[0].first;};
77 double getPosLast()
const {
return m_colorStops[m_colorStops.size()-1].first;};
78 double getPos(
unsigned int color)
const;
81 QColor getInverseColorOne()
const {
return m_inverseColorOne;};
83 QColor getInverseColorTwo()
const {
return m_inverseColorTwo;};
88 QColor getColorFirst()
const {
return m_colorStops[0].second;};
89 QColor getColorLast()
const {
return m_colorStops[m_colorStops.size()-1].second;};
90 QColor
getColor(
unsigned int color)
const;
92 void update(
const bool updateInverseColors);
95 inline void setWriteProtection() { m_type = m_type | ito::tPaletteReadOnly;
return;};
100 QVector<ito::uint32>
get256Colors(
bool includeAlpha =
false)
const;
103 inline void removeWriteProtection() { m_type = m_type & !ito::tPaletteReadOnly;
return;};
111 QColor m_inverseColorTwo;
112 QColor m_inverseColorOne;
113 QColor m_invalidColor;
114 QVector<QPair<double, QColor> > m_colorStops;
140 QList<QString> restrictedKeyWords;
141 QList<ItomPaletteBase> m_colorBars;
142 QHash<QString,int> m_colorBarLookUp;
148 ItomPaletteBase getNextColorBar(
const int curindex,
const int type = ito::tPaletteNoType)
const;
149 int getColorBarIndex(
const QString name,
bool *found = NULL)
const;
150 ItomPaletteBase getColorBar(
const QString name,
bool *found = NULL)
const;
151 QList<QString> getColorBarList(
const int type = ito::tPaletteNoType)
const;
152 int numberOfColorBars()
const {
return m_colorBars.length();};
Definition: paletteOrganizer.h:35
int findUpper(double pos) const
Find the next color stop and its values within this palette.
Definition: paletteOrganizer.cpp:46
QColor getColor(unsigned int color) const
Get the RGBA-Color of the n-th color-stop in the palette.
Definition: paletteOrganizer.cpp:219
bool insertColorStop(double pos, const QColor color)
Insert a new color stop into the palette defined by color and position.
Definition: paletteOrganizer.cpp:155
Definition: paletteOrganizer.h:126
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:206
bool setInversColorTwo(const QColor color)
Set the second inverse color for this color bar.
Definition: paletteOrganizer.cpp:102
QVector< ito::uint32 > get256Colors(bool includeAlpha=false) const
Transform the color stops to a 256 color vector.
Definition: paletteOrganizer.cpp:290
Definition: apiFunctionsGraph.cpp:39
void update(const bool updateInverseColors)
This function updates the internal structur of the palette after modifications.
Definition: paletteOrganizer.cpp:245
semaphore which can be used for asychronous thread communication. By using this class it is possible ...
Definition: sharedStructuresQt.h:57
void calculateInverseColors(QColor &inv1, QColor &inv2)
Function which shall calculate the ideal inverse colors.
Definition: paletteOrganizer.cpp:232
ItomPalette getPalette()
This function returns the internal structur of the palett.
Definition: paletteOrganizer.cpp:275
bool setInverseColorOne(const QColor color)
Set the first inverse color for this color bar.
Definition: paletteOrganizer.cpp:81
Definition: sharedStructuresGraphics.h:117
bool setInvalidColor(const QColor color)
Set the invalid color for this color bar.
Definition: paletteOrganizer.cpp:122
QColor getInvalidColor() const
Get the invalid color for this color bar.
Definition: paletteOrganizer.cpp:141