/* 
* 
* 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 ESRIHEADER_H
#define ESRIHEADER_H

#include<complex>
#include "GeoMorph.h"

using namespace std;

void xy2rec ( esriheader * Header , double x , double y , int * irec );

void c2rec ( esriheader * Header , complex<double> & Z , int * irec );

void xy2RC ( esriheader * Header , double x , double y , int * nr, int * nc );

void RC2xy ( esriheader * Header , int nr , int nc , double * x , double * y );

void rec2xy ( esriheader * Header , int irec , double * x , double * y );

void rec2c ( esriheader * Header , int irec , complex<double> & Z );

void rec2RC ( esriheader * Header , int * irec , int * nr, int * nc );

int ReadHeaderFromFile (    char hdrfile[200] ,
                            int * _ncols ,
                            int * _nrows ,
                            double * _xll ,
                            double * _yll ,
                            double * _cellsize ,
                            float * _NODATA_value ,
                            int * _LL ,
                            char * _LSBFIRST
                        );

void GetNeighborhood ( esriheader * Header , int * _nr , int * _nc ,
                                    int * _Drmin ,
                                    int * _Drmax ,
                                    int * _Dcmin ,
                                    int * _Dcmax );

int CheckSameHeader( esriheader * Header1 , esriheader * Header2 );

void d2rec ( esriheader * Header , int * irec1 , int * irec2 , int * _d2);

#endif
