myDumpMode( NoDump ),
myColorMode( Auto ),
myLabelMode( Auto ),
+ myScalingMode( Linear ),
myFlags( AtBorder | WrapTitle ),
myLabelPos( Right ),
myTitlePos( Center )
myDumpMode( NoDump ),
myColorMode( Auto ),
myLabelMode( Auto ),
+ myScalingMode( Linear ),
myFlags( AtBorder | WrapTitle ),
myLabelPos( Right ),
myTitlePos( Center )
return myColorMode;
}
+/*!
+ \brief Get scaling mode.
+ \return current scaling mode (QtxColorScale::ScalingMode)
+*/
+int QtxColorScale::scalingMode() const
+{
+ return myScalingMode;
+}
+
/*!
\brief Get number of color scale intervals.
\return number of intervals
updateScale();
}
+/*!
+ \brief Set color scale scaling mode.
+ \param mode new scaling mode (QtxColorScale::ScalingMode)
+*/
+void QtxColorScale::setScalingMode( const int mode )
+{
+ if ( myScalingMode == mode )
+ return;
+
+ myScalingMode = mode;
+ updateScale();
+}
+
/*!
\brief Set color scale dump mode.
\param mode new dump mode (QtxColorScale::DumpMode)
labels.prepend( getLabel( idx ) );
}
}
-
+
if ( testFlags( AtBorder ) )
{
if ( reverse )
{
double val = 0;
if ( intervalsNumber() > 0 )
- val = minimum() + idx * ( qAbs( maximum() - minimum() ) / intervalsNumber() );
+ {
+ if ( scalingMode() == Linear )
+ val = minimum() + idx * ( qAbs( maximum() - minimum() ) / intervalsNumber() );
+ else if ( scalingMode() == Logarithmic )
+ {
+ if ( minimum() > 0 && maximum() > 0 )
+ {
+ double logMin = log10( minimum() );
+ double logMax = log10( maximum() );
+ double logVal = logMin + idx * ( qAbs( logMax - logMin ) / intervalsNumber() );
+ val = pow( 10, logVal );
+ }
+ }
+ }
return val;
}
Auto, //!< auto
User //!< user defined
} Mode;
+ //! Color scale scaling mode.
+ typedef enum {
+ Linear, //!< linear
+ Logarithmic //!< logarithmic
+ } ScalingMode;
//! Color scale title, label position.
typedef enum {
None, //!< do not draw
int dumpMode() const;
int labelMode() const;
int colorMode() const;
+ int scalingMode() const;
int intervalsNumber() const;
QString title() const;
void setDumpMode( const int );
void setColorMode( const int );
void setLabelMode( const int );
+ void setScalingMode( const int );
void setIntervalsNumber( const int );
void setTitle( const QString& );
int myDumpMode; //!< dump mode (QtxColorScale::DumpMode)
int myColorMode; //!< color mode (QtxColorScale::Mode)
int myLabelMode; //!< label mode (QtxColorScale::Mode)
+ int myScalingMode; //!< scaling mode (QtxColorScale::ScalingMode)
QList<QColor> myColors; //!< list of colors
QList<QString> myLabels; //!< list of labels