Go to the documentation of this file.
20 #include <QTextStream>
21 #include <QXmlStreamWriter>
51 m_colorFilterMode (colorFilterMode),
52 m_intensityLow (intensityLow),
53 m_intensityHigh (intensityHigh),
54 m_foregroundLow (foregroundLow),
55 m_foregroundHigh (foregroundHigh),
58 m_saturationLow (saturationLow),
59 m_saturationHigh (saturationHigh),
60 m_valueLow (valueLow),
61 m_valueHigh (valueHigh)
67 m_colorFilterMode (other.colorFilterMode()),
68 m_intensityLow (other.intensityLow()),
69 m_intensityHigh (other.intensityHigh()),
70 m_foregroundLow (other.foregroundLow()),
71 m_foregroundHigh (other.foregroundHigh()),
72 m_hueLow (other.hueLow()),
73 m_hueHigh (other.hueHigh()),
74 m_saturationLow (other.saturationLow()),
75 m_saturationHigh (other.saturationHigh()),
76 m_valueLow (other.valueLow()),
77 m_valueHigh (other.valueHigh())
109 qDeleteAll (m_strategies);
114 return m_colorFilterMode;
117 void 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);
168 return m_intensityHigh;
173 return m_intensityLow;
182 QXmlStreamAttributes attributes = reader.attributes();
209 while ((reader.tokenType() != QXmlStreamReader::EndElement) ||
213 if (reader.atEnd()) {
221 reader.raiseError (QObject::tr (
"Cannot read curve filter data"));
227 if (m_strategies.contains (m_colorFilterMode)) {
229 return strategy->
low (*
this);
237 QTextStream &str)
const
239 str << indentation <<
"ColorFilterSettings\n";
243 if (m_strategies.contains (m_colorFilterMode)) {
253 return m_saturationHigh;
258 return m_saturationLow;
262 const QString &curveName)
const
280 writer.writeEndElement();
302 if (m_strategies.contains (m_colorFilterMode)) {
304 return strategy->
setHigh (*
this,
337 if (m_strategies.contains (m_colorFilterMode)) {
339 return strategy->
setLow (*
this,
const QString DOCUMENT_SERIALIZE_COLOR_FILTER_FOREGROUND_LOW
int saturationHigh() const
Get method for saturation higher bound.
Leaf class for intensity strategy for ColorFilterSettings.
void setValueLow(int valueLow)
Set method for value low.
int intensityLow() const
Get method for intensity lower bound.
Leaf class for saturation strategy for ColorFilterSettings.
const QString DOCUMENT_SERIALIZE_COLOR_FILTER_FOREGROUND_HIGH
int hueHigh() const
Get method for hue higher bound.
const QString DOCUMENT_SERIALIZE_COLOR_FILTER_MODE_STRING
int hueLow() const
Get method for hue lower bound.
const QString DOCUMENT_SERIALIZE_COLOR_FILTER_VALUE_HIGH
const QString DOCUMENT_SERIALIZE_COLOR_FILTER_MODE
const int INTENSITY_LOW_DEFAULT
const int INTENSITY_MIN
Constants for use by CurveFilter and other curve-related classes.
int saturationLow() const
Get method for saturation lower bound.
const int INTENSITY_HIGH_DEFAULT
const QString DOCUMENT_SERIALIZE_COLOR_FILTER_SATURATION_HIGH
int valueHigh() const
Get method for value high.
const int FOREGROUND_LOW_DEFAULT
void saveXml(QXmlStreamWriter &writer, const QString &curveName) const
Save curve filter to stream.
const int HUE_HIGH_DEFAULT
const QString DOCUMENT_SERIALIZE_CURVE_NAME
int intensityHigh() const
Get method for intensity higher bound.
virtual double high(const ColorFilterSettings &colorFilterSettings) const =0
Return the high value normalized to 0 to 1.
Leaf class for foreground strategy for ColorFilterSettings.
void setLow(double s0To1)
Set the low value for the current filter mode.
void setColorFilterMode(ColorFilterMode colorFilterMode)
Set method for filter mode.
Color filter parameters for one curve. For a class, this is handled the same as LineStyle and PointSt...
ColorFilterSettings & operator=(const ColorFilterSettings &other)
Assignment operator.
void setForegroundLow(int foregroundLow)
Set method for foreground lower bound.
ColorFilterMode colorFilterMode() const
Get method for filter mode.
void setIntensityLow(int intensityLow)
Set method for intensity lower bound.
void setHueHigh(int hueHigh)
Set method for hue higher bound.
const int SATURATION_HIGH_DEFAULT
const QString DOCUMENT_SERIALIZE_COLOR_FILTER_HUE_LOW
virtual void setHigh(ColorFilterSettings &colorFilterSettings, double s0To1)=0
Set the high value given the normalized value.
Base class for strategy pattern whose subclasses process the different color filter settings modes (o...
ColorFilterSettings()
Default constructor only for use when this class is being stored by a container that requires the def...
const int FOREGROUND_HIGH_DEFAULT
const QString DOCUMENT_SERIALIZE_COLOR_FILTER_VALUE_LOW
const QString DOCUMENT_SERIALIZE_COLOR_FILTER
static ColorFilterSettings defaultFilter()
Initial default for any Curve.
int valueLow() const
Get method for value low.
#define LOG4CPP_INFO_S(logger)
void setForegroundHigh(int foregroundHigh)
Set method for foreground higher bound.
QString colorFilterModeToString(ColorFilterMode colorFilterMode)
const int HUE_LOW_DEFAULT
Leaf class for value strategy for ColorFilterSettings.
const QString DOCUMENT_SERIALIZE_COLOR_FILTER_INTENSITY_LOW
log4cpp::Category * mainCat
void printStream(QString indentation, QTextStream &str) const
Debugging method that supports print method of this class and printStream method of some other class(...
void setValueHigh(int valueHigh)
Set method for value high.
void setIntensityHigh(int intensityHigh)
Set method for intensity higher bound.
Leaf class for hue strategy for ColorFilterSettings.
const int VALUE_LOW_DEFAULT
const int VALUE_HIGH_DEFAULT
const QString INDENTATION_DELTA
void setSaturationLow(int saturationLow)
Set method for saturation low.
double high() const
High value of foreground, hue, intensity, saturation or value according to current filter mode,...
const QString DOCUMENT_SERIALIZE_COLOR_FILTER_SATURATION_LOW
double low() const
Low value of foreground, hue, intensity, saturation or value according to current filter mode,...
void setSaturationHigh(int saturationHigh)
Set method for saturation high.
void setHigh(double s0To1)
Set the high value for the current filter mode.
void loadXml(QXmlStreamReader &reader)
Load curve filter to stream.
const QString DOCUMENT_SERIALIZE_COLOR_FILTER_HUE_HIGH
virtual void printStream(const ColorFilterSettings &colorFilterSettings, QString indentation, QTextStream &str) const =0
Print the low and high values.
const QString DOCUMENT_SERIALIZE_COLOR_FILTER_INTENSITY_HIGH
QXmlStreamReader::TokenType loadNextFromReader(QXmlStreamReader &reader)
Load next token from xml reader.
virtual void setLow(ColorFilterSettings &colorFilterSettings, double s0To1)=0
Set the low value given the normalized value.
#define ENGAUGE_ASSERT(cond)
Drop in replacement for Q_ASSERT if defined(QT_NO_DEBUG) && !defined(QT_FORCE_ASSERTS) define ENGAUGE...
int foregroundLow() const
Get method for foreground lower bound.
void setHueLow(int hueLow)
Set method for hue lower bound.
virtual double low(const ColorFilterSettings &colorFilterSettings) const =0
Return the low value normalized to 0 to 1.
int foregroundHigh() const
Get method for foreground higher bound.
const int SATURATION_LOW_DEFAULT
~ColorFilterSettings()
Destructor deallocates memory.