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


#ifndef HEADER_INCLUDED__SOIL_SALINITY_MAP_H__
#define HEADER_INCLUDED__SOIL_SALINITY_MAP_H__

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

#include "saga_api/saga_api.h"

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

class CParmWeights
{
public:
	// These are the default settings for
	// parameter weights.
	// The weights or importance, respectively,
	// were defined during a workshop in Urgensh (Uzbekistan)
	// in the year 2008.
	// The values can range between 1 and 10,
	// where 1 = low importance and 10 = high importance.
	static const int SoilColourLocal	= 1;
	static const int nLeaching			= 1;
	static const int WQ_Leaching		= 1;
	static const int WQ_Irrigation		= 1;
	static const int WVolumeIrrigation	= 1;
	static const int Evenness			= 1;
	static const int Morphology			= 1;
	static const int SoilColourExpert	= 1;
	static const int PlantGrowth		= 1;
	static const int nChannels			= 1;
	static const int Distance			= 1;
	static const int Maintanance		= 1;
};
//---------------------------------------------------------------------

class CSoilSalinityMap : public CSG_SimpleFeature
{
public:
	CSoilSalinityMap();

	// use this constructor to load a soil salinity map
	CSoilSalinityMap(PGconn *conn, CSG_String TableName, CSG_String geom_name);
	
	// use this constructor to create a soil salinity map
	// on the basis of a shapefile
	CSoilSalinityMap(CSG_Shapes* pShapes);

	~CSoilSalinityMap();

private:

	CSG_String			m_MapName;
	CSG_String			m_AttributeTableName;
	CSG_String			m_SettingsTableName;
	CSG_String			m_WeightsTableName;

	CSG_String			m_PK_colname;

	//---------------------------------------------------------------------
	//	CREATE SALINITY MAP (SimpleFeature) FUNCTIONS
	//---------------------------------------------------------------------
	bool				Export_Shape_As_SoilSalinityMap(CSG_Shapes* pShapes);

	void				Create_External_Attributes();

	void				_Assign_TableNames(CSG_String m_MapName);

	void				Add_Specific_Attributes(CSG_Shapes* pShapesOut);

	void				Add_IDs_To_PK_Field(CSG_Shapes* pShapesOut);

	void				_Create_AttributeTable();

	void				_Create_SettingsTable();

	void				_Create_WeightsTable();

	void				_Insert_DefaultWeights();
	//---------------------------------------------------------------------

};

#endif /* HEADER_INCLUDED__SOIL_SALINITY_MAP_H__ */