// 2DBathyDisplay.h: interface for the C2DBathyDisplay class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_2DBATHYDISPLAY_H__57DC3698_98E0_4CAF_AECF_9C59299F7CB0__INCLUDED_)
#define AFX_2DBATHYDISPLAY_H__57DC3698_98E0_4CAF_AECF_9C59299F7CB0__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#define MAX_HIST_POINTS		40

#include "OpenGLBase.h"

#pragma pack(1)
typedef struct tagBATHY_POINTS
{
	double		numPoints; //-1 == none
	double		minDepth;
	double		maxDepth;
	double		minDist;
	double		maxDist;
	double		distOff;
	double		Depths[1024];
    double		Distances[1024];
}
BATHY_POINTS;

typedef struct tagBATHY_PALETTE
{
	COLORREF	colorValue;
}
BATHY_PALETTE;

typedef enum tagPALETTE_STYLE
{
	DEFAULT = 0,
	SEABAT,
	JET,
	QUALITY
}
PALETTE_STYLE;

#pragma pack()

#define PALSIZE	256


class C2DBathyDisplay : public COpenGLBase  
{
public:
	
 



	                                C2DBathyDisplay			();
	virtual                         ~C2DBathyDisplay		();

					DWORD           ForceRender				();	//renders without history update
					DWORD			ForceFullRender			(); //renders nd increments history

					DWORD           DrawMeasureLine			();
  
					void			SetPointColor			(	DWORD			rgb );
					void			SetPointSpace			(	float			spacing );
					void			SetPointSize			(	float			size );
					void			SetPalette				(	PALETTE_STYLE	pal );
					void			SetFlip					(	BOOL			bFlip );

					void			ClearAll				(	void );	//clear all the data/history

					double			m_pDepths[1024];
					double			m_pDistances[1024];
                  
				  
					BATHY_POINTS	*m_pBathyHistory;
				  
					DWORD			m_dwValues;
					double			m_dMinDistance;
					double			m_dMaxDistance;
					double			m_dMinDepth;
					double			m_dMaxDepth;
					double			m_dDistanceOffset;
				  
					double			m_dRealMaxDepth,  m_dRealMinDepth;


	afx_msg			void			OnPaint					(	);
	afx_msg         BOOL            OnEraseBkgnd			(	CDC* pDC);
	afx_msg         void            OnSize					(	UINT nType, int cx, int cy);
	afx_msg         void            OnLButtonDown			(	UINT nFlags, CPoint point);
	afx_msg         void            OnLButtonUp				(	UINT nFlags, CPoint point);
	afx_msg         void            OnMouseMove				(	UINT nFlags, CPoint point);
	DECLARE_MESSAGE_MAP()


protected:
				  int			  m_dwPointsColor;
				  float			  m_fPointSpacing;
				  float			  m_fPointSize;
				  float           m_fMouseCoordX;
                  float           m_fMouseCoordY;
                  float           m_fMouseCoordBDX;
                  float           m_fMouseCoordBDY;

                  BOOL            m_bLeftDown;
				  BOOL			  m_bResizing;
				  BOOL			  m_bFlip;

				  //this stores the color for each value range
				  //the REAL min/max depths are used to recompute this
				  //on a ping to ping basis(?)/
				  BATHY_PALETTE	  m_rgbPalette[PALSIZE];


                  DWORD           Render(BOOL flag);

                  DWORD           DraxAxis					();
                  DWORD           DrawMouseCoord			();
                  DWORD           DrawCurve					(	BOOL skipMemMove);

				  void			  RampColor					(	int first, 
																int last, 
																int r1, int g1, int b1, 
																int r2, int g2, int b2 );

				  char			  m_labels[128];

				  
};

#endif // !defined(AFX_2DBATHYDISPLAY_H__57DC3698_98E0_4CAF_AECF_9C59299F7CB0__INCLUDED_)
