/* 
* 
* Copyright (C) 2013 UMPC
* 
* This file is part of CLaRiNet.
*  
* CLaRiNet is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* 
* CLaRiNet is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
* 
* You should have received a copy of the GNU General Public License
* along with CLaRiNet.  If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef FLOATRASTER_H
#define FLOATRASTER_H

#include "GeoMorph.h"

#ifdef __cplusplus
extern "C" {
#endif
	int CreateFloatRaster (    char Nom[120],
                                   int ncols,
                                   int nrows,
                                   double cellsize,
                                   double xll,
                                   double yll,
                                   float NODATA_value,
                                   int LL
                                );
#ifdef __cplusplus
}
#endif


#ifdef __cplusplus
extern "C" {
#endif
	int DestroyFloatRaster (const int HandleRaster);
#ifdef __cplusplus
}
#endif

FloatRaster * GetFloatRaster (const int HandleRaster);

int AllocateFloatRaster (  FloatRaster * Grid );

void FreeFloatRaster (  FloatRaster * Grid );

#ifdef __cplusplus
extern "C" {
#endif
    int CreateFloatRasterFromBinaryFile (   char Nom[120] ,
                                        char _binfile[200] ,
                                        char _hdrfile[200] ,
                                        int TYPE_SRC
                                     );
#ifdef __cplusplus
}
#endif

#ifdef __cplusplus
extern "C" {
#endif
    int CreateFloatRasterFromAsciiFile (    const char Nom[120] ,
                                            const char ascfile[200] ,
                                            int LL
                                        );
#ifdef __cplusplus
}
#endif

#ifdef __cplusplus
extern "C" {
#endif
    int CreateFloatRasterFromPointer (  const char Nom[120] ,
                                        const float * Data ,
                                        const int ncols,
                                        const int nrows,
                                        const double cellsize,
                                        const double xll,
                                        const double yll,
                                        const float NODATA_value,
                                        int LL
                                      );
#ifdef __cplusplus
}
#endif

#ifdef __cplusplus
extern "C" {
#endif
    int GetFloatRasterHeader (  int HandleRaster ,
                            int * _ncows ,
                            int * _nrows ,
                            double * _cellsize ,
                            double * _xll ,
                            double * _yll ,
                            float * _NODATA_value ,
                            int * _LL
                          );
#ifdef __cplusplus
}
#endif


#ifdef __cplusplus
extern "C" {
#endif
    int GetFloatRasterData ( int HandleRaster , float ** _Data );
#ifdef __cplusplus
}
#endif


#ifdef __cplusplus
extern "C" {
#endif
    int CropRaster ( int HandleRaster, int startrow , int startcol , int endrow , int endcol, char Nom[120] );
#ifdef __cplusplus
}
#endif

#ifdef __cplusplus
extern "C" {
#endif
    int SetRasterToNODATA ( const int HandleRaster );
#ifdef __cplusplus
}
#endif


#ifdef __cplusplus
extern "C" {
#endif
    int SetRasterToConstant ( const int HandleRaster , const float constant );
#ifdef __cplusplus
}
#endif


#ifdef __cplusplus
extern "C" {
#endif
    int WriteFloatRasterToFile (    const int HandleRaster ,
                                const char _binfile[200] ,
                                const int TYPE_DST,
                                const int SWITCH_ENDIANNESS
                            );
#ifdef __cplusplus
}
#endif

#endif
