// ExportInfo.cpp: implementation of the ExportInfo class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "TCTb.h"
#include "ExportInfo.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

ExportInfo::ExportInfo()
{
	dx=5.0f;
	dy=1.0f;
	dz=5.0f;
	xs=10.0f;
	zs=10.0f;
	voff=0.0f;
	BType=BT_GSIZE;
	Display=true;
	Xpix=DEFAULTBMPSIZE;
	Zpix=DEFAULTBMPSIZE;
}

void	ExportInfo::SetScale_Offset(double x, double y, double z, double offset)
{
	if(BType==BT_SETCON) return;
	dx = (float)x;
	dy = (float)y;
	dz = (float)z;

	voff = (float)offset;
	
	xs=dx*Xpix;
	zs=dz*Zpix;
	
}

void	ExportInfo::GetScale_Offset(double *x, double *y, double *z, double *offset)
{
	*x=dx; *y=dy; *z=dz; *offset=voff;
}

void	ExportInfo::GetScale_Offset(float *x, float *y, float *z, float *offset)
{
	*x=(float)dx; *y=(float)dy; *z=(float)dz; *offset=(float)voff;
}

void	ExportInfo::SetSizeKM(double x,double z)
{
	if(BType==BT_GSIZE) return;
	xs=(float)(x*1000);
	zs=(float)(z*1000);
	
	dx=xs/(Xpix-1);
	dz=zs/(Zpix-1);
}

void	ExportInfo::GetSizeKM(double *x,double *z)
{
	*x=xs/1000;
	*z=zs/1000;
}

void	ExportInfo::GetSizeKM(float *x,float *z)
{
	*x=(float)xs/1000;
	*z=(float)zs/1000;
}

void	ExportInfo::GetSizeM(double *x,double *z)
{
	*x=xs;
	*z=zs;
}

void	ExportInfo::GetSizeM(float *x,float *z)
{
	*x=(float)xs;
	*z=(float)zs;
}



void	ExportInfo::SetPixels(int x,int z)
{
	Xpix=x;
	Zpix=z;
	
	if(BType==BT_GSIZE) 
	{
		xs=(Xpix-1)*dx;
		zs=(Zpix-1)*dz;
	}
	
	if(BType==BT_SETCON) 
	{
		dx=xs/(Xpix-1);
		dz=zs/(Zpix-1);
	}
	
}


ExportInfo::~ExportInfo()
{
	
}

