21#include <QXmlStreamWriter>
109 qDeleteAll (m_strategies);
114 return m_colorFilterMode;
117void ColorFilterSettings::createStrategies ()
119 qDeleteAll (m_strategies);
135 return m_foregroundHigh;
140 return m_foregroundLow;
145 if (m_strategies.contains (m_colorFilterMode)) {
149 return strategy->
high (*
this);
169 return m_intensityHigh;
174 return m_intensityLow;
183 QXmlStreamAttributes attributes = reader.attributes();
210 while ((reader.tokenType() != QXmlStreamReader::EndElement) ||
214 if (reader.atEnd()) {
222 reader.raiseError (QObject::tr (
"Cannot read curve filter data"));
228 if (m_strategies.contains (m_colorFilterMode)) {
230 return strategy->
low (*
this);
239 QTextStream &str)
const
241 str << indentation <<
"ColorFilterSettings\n";
245 if (m_strategies.contains (m_colorFilterMode)) {
255 return m_saturationHigh;
260 return m_saturationLow;
264 const QString &curveName)
const
282 writer.writeEndElement();
304 if (m_strategies.contains (m_colorFilterMode)) {
306 return strategy->
setHigh (*
this,
340 if (m_strategies.contains (m_colorFilterMode)) {
342 return strategy->
setLow (*
this,
const int HUE_HIGH_DEFAULT
const int FOREGROUND_LOW_DEFAULT
const int SATURATION_HIGH_DEFAULT
const int VALUE_HIGH_DEFAULT
const int SATURATION_LOW_DEFAULT
const int INTENSITY_LOW_DEFAULT
const int HUE_LOW_DEFAULT
const int FOREGROUND_HIGH_DEFAULT
const int INTENSITY_HIGH_DEFAULT
const int VALUE_LOW_DEFAULT
const int INTENSITY_MIN
Constants for use by CurveFilter and other curve-related classes.
QString colorFilterModeToString(ColorFilterMode colorFilterMode)
@ COLOR_FILTER_MODE_FOREGROUND
@ COLOR_FILTER_MODE_VALUE
@ COLOR_FILTER_MODE_INTENSITY
@ COLOR_FILTER_MODE_SATURATION
const QString DOCUMENT_SERIALIZE_COLOR_FILTER
const QString DOCUMENT_SERIALIZE_COLOR_FILTER_VALUE_LOW
const QString DOCUMENT_SERIALIZE_COLOR_FILTER_HUE_HIGH
const QString DOCUMENT_SERIALIZE_COLOR_FILTER_VALUE_HIGH
const QString DOCUMENT_SERIALIZE_COLOR_FILTER_INTENSITY_LOW
const QString DOCUMENT_SERIALIZE_CURVE_NAME
const QString DOCUMENT_SERIALIZE_COLOR_FILTER_FOREGROUND_HIGH
const QString DOCUMENT_SERIALIZE_COLOR_FILTER_MODE_STRING
const QString DOCUMENT_SERIALIZE_COLOR_FILTER_INTENSITY_HIGH
const QString DOCUMENT_SERIALIZE_COLOR_FILTER_FOREGROUND_LOW
const QString DOCUMENT_SERIALIZE_COLOR_FILTER_SATURATION_HIGH
const QString DOCUMENT_SERIALIZE_COLOR_FILTER_MODE
const QString DOCUMENT_SERIALIZE_COLOR_FILTER_HUE_LOW
const QString DOCUMENT_SERIALIZE_COLOR_FILTER_SATURATION_LOW
#define ENGAUGE_ASSERT(cond)
Drop in replacement for Q_ASSERT.
log4cpp::Category * mainCat
const QString INDENTATION_DELTA
QXmlStreamReader::TokenType loadNextFromReader(QXmlStreamReader &reader)
Load next token from xml reader.
Base class for strategy pattern whose subclasses process the different color filter settings modes (o...
virtual double low(const ColorFilterSettings &colorFilterSettings) const =0
Return the low value normalized to 0 to 1.
virtual void setHigh(ColorFilterSettings &colorFilterSettings, double s0To1)=0
Set the high value given the normalized value.
virtual double high(const ColorFilterSettings &colorFilterSettings) const =0
Return the high value normalized to 0 to 1.
virtual void setLow(ColorFilterSettings &colorFilterSettings, double s0To1)=0
Set the low value given the normalized value.
virtual void printStream(const ColorFilterSettings &colorFilterSettings, QString indentation, QTextStream &str) const =0
Print the low and high values.
Leaf class for foreground strategy for ColorFilterSettings.
Leaf class for hue strategy for ColorFilterSettings.
Leaf class for intensity strategy for ColorFilterSettings.
Leaf class for saturation strategy for ColorFilterSettings.
Leaf class for value strategy for ColorFilterSettings.
int foregroundLow() const
Get method for foreground lower bound.
~ColorFilterSettings()
Destructor deallocates memory.
void setIntensityLow(int intensityLow)
Set method for intensity lower bound.
void setForegroundLow(int foregroundLow)
Set method for foreground lower bound.
int saturationLow() const
Get method for saturation lower bound.
ColorFilterSettings()
Default constructor only for use when this class is being stored by a container that requires the def...
void setValueLow(int valueLow)
Set method for value low.
void setValueHigh(int valueHigh)
Set method for value high.
void setSaturationLow(int saturationLow)
Set method for saturation low.
double low() const
Low value of foreground, hue, intensity, saturation or value according to current filter mode,...
void setHueLow(int hueLow)
Set method for hue lower bound.
int intensityHigh() const
Get method for intensity higher bound.
void setHigh(double s0To1)
Set the high value for the current filter mode.
ColorFilterSettings & operator=(const ColorFilterSettings &other)
Assignment operator.
int saturationHigh() const
Get method for saturation higher bound.
static ColorFilterSettings defaultFilter()
Initial default for any Curve.
void setColorFilterMode(ColorFilterMode colorFilterMode)
Set method for filter mode.
void printStream(QString indentation, QTextStream &str) const
Debugging method that supports print method of this class and printStream method of some other class(...
ColorFilterMode colorFilterMode() const
Get method for filter mode.
void saveXml(QXmlStreamWriter &writer, const QString &curveName) const
Save curve filter to stream.
int valueLow() const
Get method for value low.
void setForegroundHigh(int foregroundHigh)
Set method for foreground higher bound.
void loadXml(QXmlStreamReader &reader)
Load curve filter to stream.
int hueHigh() const
Get method for hue higher bound.
double high() const
High value of foreground, hue, intensity, saturation or value according to current filter mode,...
int foregroundHigh() const
Get method for foreground higher bound.
void setLow(double s0To1)
Set the low value for the current filter mode.
void setIntensityHigh(int intensityHigh)
Set method for intensity higher bound.
int intensityLow() const
Get method for intensity lower bound.
void setSaturationHigh(int saturationHigh)
Set method for saturation high.
void setHueHigh(int hueHigh)
Set method for hue higher bound.
int hueLow() const
Get method for hue lower bound.
int valueHigh() const
Get method for value high.
#define LOG4CPP_INFO_S(logger)
#define LOG4CPP_ERROR_S(logger)