//================================================================
// Geological library
//
// AUTHOR:  Gabor Nagy
// DATE:    2014-Feb-26 17:31:57
//
// Copyright (C) 1996-2026 by Gabor Nagy. All rights reserved.
//================================================================
#ifndef _EGeo_h
#define _EGeo_h

#ifndef _ETypes_h
#include <ETypes.h>
#endif

#if defined (__cplusplus) && (!(defined (__CPLUSLIBS)))
extern "C" {
#endif


typedef double  ECoordinate;


typedef struct
{
	ECoordinate  Lon, Lat;
} ELonLat;

typedef struct
{
	ECoordinate  X, Y;
} E2DPosition;


typedef struct
{
	E2DPosition  UpperLeft, LowerLeft, UpperRight, LowerRight,  // In meters
	             Center,
	             FalseEastNorth,
	             PlanetRadii;  // X and Y radius
	ELonLat      Origin;       // Projection origin (longitude / latitude)

// From the GeoTIFF header
//
	double*      PixelScale;int  PixelScale_count;  // In meters
	double*      TiePoints;int   TiePoints_count;
	double*      Transform;int   Transform_count;

	void*        Proj4Handle;
} EGeoMapping;


#define EM_Set2Ds(mV, mX, mY)          (mV).X = mX, (mV).Y = mY
#define EM_SetLonLats(mV, mLon, mLat)  (mV).Lon = mLon, (mV).Lat = mLat


//----------------------------------------
// Image/Image.c
//----------------------------------------
extern void  EGeoMapping_Init(EGeoMapping* PMapping);
extern void  EGeoMapping_FreeContents(EGeoMapping* PMapping);

#if defined (__cplusplus) && (!(defined (__CPLUSLIBS)))
}	// Close scope of 'extern "C"' declaration
#endif

#endif // _EGeo_h
