// GlobalMapperInterface_3D.h - interface for Global Mapper DLL 3D-related exports
//
// Developed by: Mike Childs
//      Started: 2/26/06

#ifndef _GLOBALMAPPERINTERFACE_3D_H_
#define _GLOBALMAPPERINTERFACE_3D_H_

/*--------------------------------------------------------------------
                            GENERAL INCLUDES
--------------------------------------------------------------------*/

#include "GlobalMapperInterface.h"

// Make sure the whole thing is packed to 8 byte structure alignment
// like the SDK expects
#pragma pack( push, 8 )

/*--------------------------------------------------------------------
                            LITERAL CONSTANTS
--------------------------------------------------------------------*/

/*--------------------------------------------------------------------
                                 TYPES
--------------------------------------------------------------------*/

#ifdef __cplusplus
extern "C" {
#endif

// Callback for when a new view is requested from the 3D view window
typedef void (_stdcall *GM_3DChangeViewCallbackFunc)
    ( 
    const GM_Rectangle_t*   aNewViewBounds,
    void*                   aUserData           // user data passed into GM_3DSetChangeViewCallback function
    );

/*--------------------------------------------------------------------
                        3D RENDERING FUNCTIONS
--------------------------------------------------------------------*/

// Closes the 3D view window if it is open
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_3DCloseViewWindow
    (
    void
    );

// Retrieves the position of the camera in the current 3D view
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_3DGetCameraPosition
	(
	double* aX,         // OUT: X coordinate for camera in current view projection
	double* aY,	        // OUT: Y coordinate for camera in current view projection
	float*  aElev,		// OUT: Elevation in meters for camera
	double* aHeading,	// OUT: Heading in degrees from North (0)
	double* aPitch,		// OUT: Pitch in degrees (+ is up, - is down)
	double* aBank		// OUT: not currently used
	);

// Returns true if the 3D view window is open
GM_DLL_EXPORTED BOOL __stdcall GM_3DIsWindowOpen
    (
    void
    );

// Position the camera in an open 3D view window
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_3DPositionCamera
	(
	double	aX,         // IN: X coordinate for camera in current view projection
	double	aY,         // IN: Y coordinate for camera in current view projection
	float	aElev,		// IN: Elevation in meters for camera
	double	aHeading,	// IN: Heading in degrees from North (0)
	double	aPitch,		// IN: Pitch in degrees (+ is up, - is down)
	double	aBank		// IN: not currently used
	);

// Saves the current 3D view to a file
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_3DSaveViewToFile
	(
    const char*                 aFilename,  // IN: filename to save to
    GM_RasterExportFormat_t32   aFormat,    // IN: format to use (only BMP, JPG, and PNG supported)
    sint32                      aPixWidth,  // IN: pixel width to save (use 0 for current view size)
    sint32                      aPixHeight  // IN: pixel height to save (use 0 for current view size)
	);

// Sets the function to call to when a button is pressed in the 3D view window
// to request a new view.
GM_DLL_EXPORTED void __stdcall GM_3DSetChangeViewCallback
    (
    GM_3DChangeViewCallbackFunc aCallbackFunc,
    void*                       aUserData
    );

// Sets what to display in the currently open 3D view window (opens view if needed)
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_3DSetView
    (
    GM_LayerHandle_t32*     aLayerList,     // IN: List of layers to drape on top of terrain or NULL for all
    uint32                  aLayerCount,    // IN: Number of layers in list (0 for all)
    GM_DrawFlags_t32        aDrawFlags,     // IN: Flags controlling how the draw is performed
    const GM_Rectangle_t*   aWorldBounds,   // IN: World bounds to convert from or NULL for last drawn
    const GM_PixelRect_t*   aPixelRect,     // IN: Pixel bounds to convert from or NULL for last drawn 
    uint32                  aReserved       // IN: Reserved (set to 0)
    );

// Restore structure alignment to its old value
#pragma pack( pop )

#ifdef __cplusplus
}
#endif

#endif // end of file GlobalMapperInterface_3D.h
