Commit 0816454c authored by Antoine Regimbeau's avatar Antoine Regimbeau

MRG: Merge branch 'bug_ExtractROI' into develop

parents 1eb35e74 fac94bdc
......@@ -87,7 +87,7 @@ otb_test_application(NAME apTvRaOpticalCalibration_UnknownSensor
-acqui.sun.elev 62.7
-acqui.sun.azim 152.7
-acqui.view.elev 87.5
-acqui.view.azim -77.0
-acqui.view.azim 283
-acqui.solarilluminations ${INPUTDATA}/apTvRaOpticalCalibrationUnknownSensorSolarIllumations2.txt
-atmo.rsr ${INPUTDATA}/apTvRaOpticalCalibrationUnknownSensorRSR.txt
-atmo.pressure 1013.0
......
......@@ -307,7 +307,7 @@ public:
*/
bool IsParameterMissing(const std::string &key) const;
/* Set an default integer value, must used in the
/* Set a default integer value, must be used in the
* DoInit when setting a value by default
* for the parameter
*
......@@ -319,7 +319,17 @@ public:
*/
void SetDefaultParameterInt(std::string parameter, int value);
/* Set a default floating value, must used in the
/* Get the default integer value of a parameter
*
* Can be called for types :
* \li ParameterType_Int
* \li ParameterType_Float
* \li ParameterType_Radius
* \li ParameterType_Choice
*/
int GetDefaultParameterInt(std::string parameter);
/* Set a default floating value, must be used in the
* DoInit when setting a value by default
* for the parameter
*
......@@ -328,6 +338,13 @@ public:
*/
void SetDefaultParameterFloat(std::string parameter, float value);
/* Get the default floating value of a parameter
*
* Can be called for types :
* \li ParameterType_Float
*/
float GetDefaultParameterFloat(std::string parameter);
/** Set a default pixel type for an output image parameter
*
* \param[in] parameter Name of the output image parameter
......
......@@ -62,8 +62,8 @@ public:
/** Set the value */
void SetValue( ScalarType value)
{
// TODO check minimum/maximum
m_Value = value;
m_Value = ( value < m_MinimumValue ) ? m_MinimumValue :
( value < m_MaximumValue ) ? value : m_MaximumValue ;
// Set Active only if the parameter is not automatically set
if (!GetAutomaticValue())
......
......@@ -1042,6 +1042,37 @@ void Application::SetDefaultParameterInt(std::string parameter, int value)
}
}
int Application::GetDefaultParameterInt(std::string parameter)
{
Parameter* param = GetParameterByKey(parameter);
int ret = 0 ;
if (dynamic_cast<RadiusParameter*>(param))
{
RadiusParameter* paramRadius = dynamic_cast<RadiusParameter*>(param);
ret = paramRadius->GetDefaultValue();
}
else if (dynamic_cast<IntParameter*>(param))
{
IntParameter* paramInt = dynamic_cast<IntParameter*>(param);
ret = paramInt->GetDefaultValue();
}
else if (dynamic_cast<FloatParameter*>(param))
{
FloatParameter* paramFloat = dynamic_cast<FloatParameter*>(param);
ret = paramFloat->GetDefaultValue();
}
else if (dynamic_cast<RAMParameter*>(param))
{
RAMParameter* paramRAM = dynamic_cast<RAMParameter*>(param);
ret = paramRAM->GetDefaultValue();
}
else
{
// log
}
return ret;
}
void Application::SetDefaultParameterFloat(std::string parameter, float value)
{
Parameter* param = GetParameterByKey(parameter);
......@@ -1054,6 +1085,18 @@ void Application::SetDefaultParameterFloat(std::string parameter, float value)
}
}
float Application::GetDefaultParameterFloat(std::string parameter)
{
Parameter* param = GetParameterByKey(parameter);
if (dynamic_cast<FloatParameter*>(param))
{
FloatParameter* paramFloat = dynamic_cast<FloatParameter*>(param);
return paramFloat->GetDefaultValue();
}
return 0;
}
void Application::SetDefaultOutputPixelType(std::string parameter, ImagePixelType type)
{
Parameter* param = GetParameterByKey(parameter);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment