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

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

#ifndef __HEADER_INCLUDED_pg_soil_salinity_report_h_
#define __HEADER_INCLUDED_pg_soil_salinity_report_h_

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

#include "soil_salinity/soil_salinity_map.h"
#include <fstream>

//---------------------------------------------------------------------
class CSoilSalinityReport
{
public:
	CSoilSalinityReport(CSoilSalinityMap* pSSMap);

	~CSoilSalinityReport();

	void				Write_Report();

private:
	std::ofstream		f;

	int					m_counter;

	CSoilSalinityMap*	m_pSSMap;

	CSG_Table*			m_pReportTable;
	CSG_Table*			m_pSalinityTable;

	void				_Get_Selected_FIDs(int nSelected, vector_i& v_FIDs);

	int					_Get_FID_FieldNumber();

	CSG_String			_Get_SQL_SelectAll(int fid);

	CSG_String			_Get_SQL_Year_FID(int year, int fid);

	double				_Get_Salinity(CSG_String sql);
	//----------------------------------------------------------
	//	REPORT TABLE FUNCTIONS
	//----------------------------------------------------------
	void				_Create_SAGA_ReportTable();
	void				_Create_SAGA_SalinityTable(int minYear, int maxYear);
	void				_Add_Column_SalinityTable(int field, int feature, vector_d& salinity, double min, double max, double mean, double trend);

	void				_Write_SAGA_ReportTable(Csqltable* pSQLTable);
	void				_Write_SAGA_FieldSummary(double sal_v, double sal_l, double sal_e, const char* tit);
};

#endif /*__HEADER_INCLUDED_pg_soil_salinity_report_h_ */
