///////////////////////////////////////////////////////////
// Author:			Stefan Liersch
// Contact:			stefan.liersch@googlemail.com,
//					stefan.liersch@ufz.de
//
// Date:			2008-04-09
// last modified:	2008-04-09
//
//---------------------------------------------------------
// DESCRIPTION
//---------------------------------------------------------
//
//---------------------------------------------------------
// ToDo
//---------------------------------------------------------
//
///////////////////////////////////////////////////////////

//---------------------------------------------------------------------

#ifndef __PG_SOIL_SALINITY_RISK_DLG_H_
#define __PG_SOIL_SALINITY_RISK_DLG_H_

#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
    #pragma interface "pg_soil_salinity_risk_dlg.h"
#endif

#include "pg_soil_salinity_dlg_base.h"
#include "soil_salinity/soil_salinity_risk.h"

//---------------------------------------------------------------------
enum ESG_SoilSalinityRiskDlg
{
	ID_SSR_TEXT = 10000,
	ID_SSR_COMBO_GW_LEVEL,
	ID_SSR_COMBO_GW_SALINITY,
	ID_SSR_COMBO_SOIL_TEXTURE,
	ID_SSR_SLIDER_SOIL_TEXTURE,
	ID_SSR_SLIDER_PLANENESS,
	ID_SSR_COMBO_MORPHOLOGY,
	ID_SSR_COMBO_N_CHANNELS,
	ID_SSR_COMBO_DISTANCE,
	ID_SSR_COMBO_MAINTANANCE,
	ID_SSR_BUTTON_CALC_RISK,
	ID_SSR_TEXTCTRL_RISK,
	ID_SSR_TEXTCTRL_MSLOW,
	ID_SSR_TEXTCTRL_MSMDEDIUM,
	ID_SSR_TEXTCTRL_MSHIGH,
	ID_SSR_BUTTON_SAVE,
	ID_SSR_CHOICE_ID_COLUMN,
	ID_SSR_CHOICE_FEATURE,
	ID_SSR_COMBO_YEAR,
	ID_SSR_COMBO_SEASON,
	ID_SSR_TEXTCTRL_RISK_V
};
//---------------------------------------------------------------------


class CSoilSalinityRiskDlg : public wxDialog, public CSoilSalinityDlgBase
{
public:
	CSoilSalinityRiskDlg();
	CSoilSalinityRiskDlg(wxWindow *parent, wxWindowID id, const wxString &title);
	CSoilSalinityRiskDlg(CSG_SimpleFeature* pSimpleFeature, wxWindow *parent, wxWindowID id, const wxString &title);

	~CSoilSalinityRiskDlg();

private:

	vector_d					m_parameters;
	vector_d					m_weights;

	void						_CreateDialog(CSG_SimpleFeature* pSimpleFeature);
	void						_Delete_Controls();

	void						_Resize_Vectors(int size);

	void						_Assign_Parms();
	void						_Assign_Weights();

	double						_Evaluate_Selection(int selection, int nPossibilities, bool bGoodFirst);


	//-----------------------------------------------------------------
	// SAVE RECORD
	//-----------------------------------------------------------------
	bool						_Record_Exists();
	CSG_String					_Get_Message_Exist();
	CSG_String					_Get_SQL_Update_Record();
	CSG_String					_Get_InsertString();

	//-----------------------------------------------------------------
	// EVENT HANDLER FUNCTIONS
	//-----------------------------------------------------------------
	void						_On_Change_ID_Column(wxCommandEvent &event);
	void						_On_Change_Feature(wxCommandEvent& event);
	void						_On_Calculate_Risk(wxCommandEvent& event);
	void						_On_Save(wxCommandEvent& event);

	//-----------------------------------------------------------------
	//
	//	DIALOG CONTROLS
	//
	//-----------------------------------------------------------------
	wxChoice*					m_pChoice_IDColumn;
	wxChoice*					m_pChoice_Feature;

	wxComboBox*					m_pComboYear;
	wxComboBox*					m_pComboSeason;

	wxComboBox*					m_pCombo_GWLevel;
	wxComboBox*					m_pCombo_GWSalinity;

	//wxComboBox*					m_pCombo_SoilTexture;
	wxSlider*					m_pSlider_SoilTexture;

	wxSlider*					m_pSlider_Planeness;
	wxComboBox*					m_pCombo_Morphology;

	wxComboBox*					m_pCombo_nChannels;
	wxComboBox*					m_pCombo_Distance;
	wxComboBox*					m_pCombo_Maintenance;

	wxButton*					m_pButton_CalcRisk;
	//wxTextCtrl*					m_pTXTCtrlResultStr;
	//wxTextCtrl*					m_pTXTCtrlResult;
	//wxTextCtrl*					m_pTXTCtrl_MSLOW;
	//wxTextCtrl*					m_pTXTCtrl_MSMEDIUM;
	//wxTextCtrl*					m_pTXTCtrl_MSHIGH;

	//wxButton*					m_pButtonSave;
	//-----------------------------------------------------------------

	DECLARE_EVENT_TABLE()
};




///////////////////////////////////////////////////////////
//														 //
//														 //
//														 //
///////////////////////////////////////////////////////////



#endif /* __PG_SOIL_SALINITY_RISK_DLG_H_ */

