#include "stdafx.h"
#include "StationDataBase.h"
#include "CalJXAndGD.h"
#include "GTZX.h"
#include "GlobalData.h"
#include "Cshejicanshumdb.h"
#include "GlobalData.h"
#include "StationDataBase.h"

extern CString FilePathName;
extern CString Cworkdir;
extern CString Pro;
extern vector<CBaseLine*> pJXGTZXArray;//全局变量
extern  YXCTAB YXCB;

void CalJXAndGD::GetBaseLineArrayFromMdb(vector<CBaseLine*>& pBaseLineArray)
{
	double arrayd[MAXJDNUM][7];
	int NJDTmp = 0;

	int nJX = 0;
	StationDataBase DBS;
	CString m_MdbName = FilePathName;

	CBaseLine* PGDObject = NULL;
	pBaseLineArray.clear();
	//DBS.isNeedConnect=1;
	if (DBS.Read_StationDbs(m_MdbName, ENC("基线汇总表")))//读基线
	{
		int size = (int)DBS.pBaseTrackManage.size();
		if (size > 0)
		{
			for (int i = 0; i < size; i++)
			{
				CString BIANHAO, InquireString, GZTYPE;
				BIANHAO = DBS.pBaseTrackManage[i].BianHao;
				InquireString = L"[" + ENC("对象ID") + L"]=\"" + BIANHAO + L"\"";

				double detN, detE, detA, NInsert, EInsert;
				if (DBS.Read_StationDbs(m_MdbName, ENC("转换参数表")))//读断链表
				{
					detN = DBS.StaCoorInfo.NOffset;
					detE = DBS.StaCoorInfo.EOffset;
					detA = DBS.StaCoorInfo.Rotate;
					NInsert = DBS.StaCoorInfo.NInsert;
					EInsert = DBS.StaCoorInfo.EInsert;
				}
				else
				{
					detN = 0;
					detE = 0;
					detA = 0;
					NInsert = 0;
					EInsert = 0;
				}

				if (DBS.Read_StationDbs(m_MdbName, ENC("基线曲线表"), InquireString))
				{
					NJDTmp = DBS.NJD;
					for (int j = 0; j < DBS.NJD; j++)
					{
						for (int k = 0; k < 7; k++)
							arrayd[j][k] = DBS.JDarray[j][k];
					}
				}
				else
				{
					continue;
				}

				if (NJDTmp < 2)
					continue;

				CBaseLine* pjx = NULL;
				pjx = new CBaseLine(NJDTmp, arrayd, L"AK", L"JD");

				//pjx->detN=detN;
				//pjx->detE=detE;
				//pjx->detA=detA;
				//pjx->NInsert=NInsert;
				//pjx->EInsert=EInsert;

				pjx->setINIT(3, 3, 1, 5);
				pjx->SetGDSX(DBS.pBaseTrackManage[i]);
				if (DBS.Read_StationDbs(m_MdbName, ENC("基线断链表"), InquireString))//读断链表
				{
					pjx->NDL = DBS.NDL;
					for (int j = 0; j < pjx->NDL; j++)
						pjx->setDLM(j, DBS.DLB[j].BLC, DBS.DLB[j].DL, DBS.DLB[j].BGH, DBS.DLB[j].EGH);
				}
				else
				{
					continue;;
				}


				if (DBS.Read_StationDbs(m_MdbName, ENC("基线控制点范围表"), InquireString))//读断链表
				{
					pjx->V_JDARRAY.resize(DBS.NFWPT);
					for (int j = 0; j < DBS.NFWPT; j++)
					{
						pjx->V_JDARRAY[j].x = DBS.FWPTB[j].cml;
						pjx->V_JDARRAY[j].y = DBS.FWPTB[j].dist;
						pjx->V_JDARRAY[j].z = 0.0;
					}
				}
				pjx->getpxy_DATA();
				DPoint3d Pt2;
				pjx->PolygonPtArrayScreen.clear();
				if (pjx->V_JDARRAY.size() > 0)//绘制控制多边形
				{
					for (int j = 0; j < (int)pjx->V_JDARRAY.size(); j++)
					{
						pjx->TrsProjPtToNE(pjx->V_JDARRAY[j].x, pjx->V_JDARRAY[j].y, Pt2.y, Pt2.x);
						Pt2.z = 0.0;
						pjx->PolygonPtArrayScreen.push_back(Pt2);
					}
				}
				
				if (pjx != NULL)
					pBaseLineArray.push_back(pjx);
			}
		}
	}
}

//只包含平面线元和断链的股道数组
void CalJXAndGD::GetGTZXArrayFromMdb_PM(vector<CBaseLine*>& In_pBaseLineArray, vector<ZCGTZX*>& pGTZXArray, bool IncludeYuLiu)//获取股道数组
{
	int NJD;
	double arrayd[MAXJDNUM][7];
	ACHAR JDGH[STR_MIN];
	int res = 0;
	int num = 0;
	CBaseLine* pBaseLine = NULL;
	pGTZXArray.clear();
	//1.读数据库得到基线
	StationDataBase DBS;
	int size = 0;
	CString mdbName = Cworkdir + "\\data\\" + Pro + DBEXT;
	DBS.isNeedDisConnect = 0;
	DBS.isNeedConnect = 1;
	DBS.Read_StationDbs(mdbName, L"");
	DBS.isNeedConnect = 0;

	CString ConditionStr;
	if (IncludeYuLiu)
		ConditionStr.Empty();
	else
		ConditionStr = ENC("设计时态") + "<>'预留' AND " + ENC("股道编号") + L"<>''";
	if (DBS.Read_StationDbs(mdbName, ENC("股道汇总表"), ConditionStr))//读基线
	{
		size = (int)DBS.pTrackManage.size();
		for (int i = 0; i < size; i++)
		{
			CString BIANHAO, InquireString, GZTYPE;
			BIANHAO = DBS.pTrackManage[i].BianHao;
			InquireString = L"[" + ENC("对象ID") + L"]=\"" + BIANHAO + L"\"";

			if (DBS.Read_StationDbs(mdbName, ENC("股道曲线表"), InquireString))
			{
				NJD = DBS.NJD;

				for (int j = 0; j < DBS.NJD; j++)
				{
					pBaseLine = GetBaseLineFromBianhao(DBS.CZJXStrArray[j], In_pBaseLineArray);
					if (pBaseLine == NULL)
						pBaseLine = GetBaseLineFromCkml(DBS.QXJDB[j].JDCKml, In_pBaseLineArray);
					if (pBaseLine == NULL)
						return;

					pBaseLine->TrsCkmlPtToNE(DBS.QXJDB[j].JDCKml, DBS.QXJDB[j].DistToJX,
						DBS.JDarray[j][1], DBS.JDarray[j][2]);
					for (int k = 0; k < 7; k++)
					{
						arrayd[j][k] = DBS.JDarray[j][k];
					}
				}
			}
			else
			{
				continue;
			}

			if (_tcscmp(DBS.JDGH, L"") == 0)
				_tcscpy(JDGH, DBS.JDGH);
			else
				_tcscpy(JDGH, L"JD");
			
			ZCGTZX* pjx = NULL;
			if (NJD < 2) return;
			pjx = new ZCGTZX(NJD, arrayd, L"AK", L"JD");


			pjx->setINIT(3, 3, 1, 5);
			pjx->SetGDSX(DBS.pTrackManage[i]);
			pjx->SetJDQXBHstr(DBS.JDStrArray, DBS.QXBHStrArray);

			_tcscpy(pjx->GTZXQDID, DBS.pTrackManage[i].GTZXQDID);
			pjx->GTZXQDType = DBS.pTrackManage[i].GTZXQDType;
			_tcscpy(pjx->GTZXZDID, DBS.pTrackManage[i].GTZXZDID);
			pjx->GTZXZDType = DBS.pTrackManage[i].GTZXZDType;
			pjx->JYDC.clear();
			pjx->JYDC = DBS.pTrackManage[i].JYDC;
			pjx->isuserQZD = DBS.pTrackManage[i].isuserQZD;
			pjx->mdbname = mdbName;
			if (DBS.Read_StationDbs(mdbName, ENC("股道断链表"), InquireString))//读断链表
			{
				pjx->NDL = int(DBS.NDL + 0.1);
				for (int i1 = 0; i1 < pjx->NDL; i1++)
					pjx->setDLM(i1, DBS.DLB[i1].BLC, DBS.DLB[i1].DL, DBS.DLB[i1].BGH, DBS.DLB[i1].EGH);
			}

			CString CSInquireString = L"[" + ENC("对象ID") + L"]=\"" + BIANHAO + L"\"";
			if (DBS.Read_StationDbs(mdbName, ENC("钢轨类型数据"), CSInquireString))
				pjx->SetGGLXArray(DBS.m_GGLXArray, false);
			else
				pjx->SetDefaultGGLXArray();

			if (DBS.Read_StationDbs(mdbName, ENC("轨枕类型数据"), CSInquireString))
				pjx->SetDZLXArray(DBS.m_GZLCArray, false);
			else
				pjx->SetDefaultDZLXArray();

			if (DBS.Read_StationDbs(mdbName, ENC("护轮轨类型数据"), CSInquireString))
				pjx->SetHLGLXArray(DBS.m_HLGLXArray, false);
			else
				pjx->SetDefaultHLGLXArray();

			if (DBS.Read_StationDbs(mdbName, ENC("坡度表"), InquireString))//后加
			{
				if (DBS.NPD > 0)
				{
					pjx->SetBPDArray(DBS.NPD, DBS.PDB, false);
					if (_tcscmp(DBS.PDB[DBS.NPD - 1].Notes, L"路肩坡") == 0)
					{
						pjx->m_LJorGM = 0;
					}
					else
					{
						pjx->m_LJorGM = 1;
					}
					CString strtmp;
					strtmp = DBS.PDB[0].Notes;
					pjx->m_Xsw = _ttoi(strtmp);
					pjx->m_DesHXSW = int(DBS.PDB[0].Rshu + 0.1);
				}

			}

			pGTZXArray.push_back(pjx);
		}
	}
	DBS.Disconnect_StationDbs();
}
void CalJXAndGD::GetBaseLineArrayFromLayerOrMdb(vector<CBaseLine*>& pBaseLineArray)
{
	pBaseLineArray.clear();
	//GetBaseLineArrayFromLayer(pBaseLineArray);
	//if (pBaseLineArray.size() == 0)
    GetBaseLineArrayFromMdb(pBaseLineArray);
}

CBaseLine* CalJXAndGD::GetBaseLineFromCkml(ACHAR Ckml[STR_SHORT], vector<CBaseLine*>pBaseLineArray)
{
	ACHAR GH[STR_SHORT];
	double xlsml = 0.0;
	_tcscpy(GH, L"");
	split_ckml(Ckml, &xlsml, GH);
	//CString Str;
	for (int i = 0; i < (int)pBaseLineArray.size(); i++)
	{
		//Str = pBaseLineArray[i]->LCGH;
		//Str.MakeUpper();
		if (_tcscmp(pBaseLineArray[i]->LCGH, GH) == 0)
			return pBaseLineArray[i];
	}
	return NULL;

}

CBaseLine* CalJXAndGD::GetBaseLineFromBianhao(ACHAR Bianhao[STR_SHORT], vector<CBaseLine*>pBaseLineArray)
{
	for (int i = 0; i < (int)pBaseLineArray.size(); i++)
	{
		if (_tcscmp(pBaseLineArray[i]->BianHao, Bianhao) == 0)
			return pBaseLineArray[i];
	}
	return NULL;
}

//不包含道砟信息的股道数组
void CalJXAndGD::GetGTZXArrayFromMdb(vector<ZCGTZX*>& pGTZXArray)//获取股道数组
{
	int nGD = 0;

	CString m_MdbName = Cworkdir + "\\data\\" + Pro + DBEXT;
	int isSNZC = 0;
	CString SNZC_mdbname;
	if (isSNZC == 1)
		m_MdbName = SNZC_mdbname;

	ACHAR JDGH[STR_MIN];


	ZCGTZX* pjx = NULL;
	double arrayd[MAXJDNUM][7];
	CBaseLine* pBaseLine = NULL;
	pGTZXArray.clear();
	CString InquireString, BIANHAO;
	int NJDTmp = 0;
	int NJD;
	CalJXAndGD pCalJXAndGD;
	if (pJXGTZXArray.size() == 0)
		pCalJXAndGD.GetBaseLineArrayFromLayerOrMdb(pJXGTZXArray);
	if (pJXGTZXArray.size() == 0)
		return;
	//1.读数据库得到基线	
	int size = 0;
	xlpoint GDBZPZ;

	StationDataBase DBS;
	DBS.isNeedDisConnect = 0;
	DBS.isNeedConnect = 1;
	DBS.Read_StationDbs(m_MdbName, L"");
	DBS.isNeedConnect = 0;

	if (DBS.Read_StationDbs(m_MdbName, ENC("股道汇总表")))//读基线
	{
		size = (int)DBS.pTrackManage.size();
		if (size > 0)
		{
			for (int i = 0; i < size; i++)
			{
				CString BIANHAO1, InquireString1, GZTYPE;
				BIANHAO1 = DBS.pTrackManage[i].BianHao;
				InquireString1 = L"[" + ENC("对象ID") + L"]=\"" + BIANHAO1 + L"\"";
				CString InquireStringQXB = L"[" + ENC("对象ID") + L"]=\"" + BIANHAO1 + L"\"" + L"ORDER BY " + ENC("ID");
				if (DBS.Read_StationDbs(m_MdbName, ENC("股道曲线表"), InquireStringQXB))
				{
					NJD = DBS.NJD;
					for (int j = 0; j < DBS.NJD; j++)
					{
						pBaseLine = pCalJXAndGD.GetBaseLineFromBianhao(DBS.CZJXStrArray[j], pJXGTZXArray);//李伟添加						
						if (pBaseLine == NULL)//李伟添加 
							pBaseLine = pCalJXAndGD.GetBaseLineFromCkml(DBS.QXJDB[j].JDCKml, pJXGTZXArray);
						if (pBaseLine == NULL)
							continue;
						pBaseLine->TrsCkmlPtToNE(DBS.QXJDB[j].JDCKml, DBS.QXJDB[j].DistToJX,
							DBS.JDarray[j][1], DBS.JDarray[j][2]);

						for (int k = 0; k < 7; k++)
						{
							arrayd[j][k] = DBS.JDarray[j][k];
						}
					}
				}
				else
				{
					continue;
				}


				if (_tcscmp(DBS.JDGH, L"") == 0)
					_tcscpy(JDGH, DBS.JDGH);
				else
					_tcscpy(JDGH, L"JD");

				if (NJD < 2) return;

				ZCGTZX* pjx1 = NULL;
				pjx1 = new ZCGTZX(NJD, arrayd, L"AK", L"JD");
				pjx1->setINIT(3, 3, 1, 5);
				pjx1->SetGDSX(DBS.pTrackManage[i]);
				pjx1->SetJDQXBHstr(DBS.JDStrArray, DBS.QXBHStrArray);

				_tcscpy(pjx1->GTZXQDID, DBS.pTrackManage[i].GTZXQDID);
				pjx1->GTZXQDType = DBS.pTrackManage[i].GTZXQDType;
				_tcscpy(pjx1->GTZXZDID, DBS.pTrackManage[i].GTZXZDID);
				pjx1->GTZXZDType = DBS.pTrackManage[i].GTZXZDType;
				pjx1->JYDC.clear();
				pjx1->JYDC = DBS.pTrackManage[i].JYDC;
				pjx1->LengthBeforeBZ = DBS.pTrackManage[i].LengthBeforeBZ;
				pjx1->LengthAfterBZ = DBS.pTrackManage[i].LengthAfterBZ;
				pjx1->isYanShen = DBS.pTrackManage[i].isYanShen;
				pjx1->YanShenLength = DBS.pTrackManage[i].YanShenLength;
				pjx1->LCcanzhao = DBS.pTrackManage[i].LCcanzhao;
				pjx1->isYLDoHDM = DBS.pTrackManage[i].isYLDoHdm;
				pjx1->isDXGD = DBS.pTrackManage[i].isDXGD;
				pjx1->IsJiSuanJiZhunXian = DBS.pTrackManage[i].IsJiSuanJiZhunXian;
				pjx1->mdbname = m_MdbName;
				if (DBS.Read_StationDbs(m_MdbName, ENC("股道标注表"), InquireString))
				{
					//for (int j=0;j<DBS.NBZ;j++)
					{
						pjx->ISDrawJLF = DBS.BZB.ISDrawJLF;
						pjx->ISDrawYXC = DBS.BZB.ISDrawYXC;
						pjx->ISDrawGDBH = DBS.BZB.ISDrawGDBH;
						pjx->ISDrawJYBH = DBS.BZB.ISDrawJYBH;
						pjx->ISDrawQXBH = DBS.BZB.ISDrawQXBH;
						pjx->ISDrawDH = DBS.BZB.ISDrawDH;
						pjx->ISDrawLCB = DBS.BZB.ISDrawLCB;
						pjx->IsDrawPDB = DBS.BZB.ISDrawPDB;
						pjx->ISDrawJDBZ = DBS.BZB.ISDrawJDBZ;
						pjx->ISDrawPeiGui = DBS.BZB.ISDrawPeiGui;
						pjx->isShowGM_LM = DBS.BZB.ISDrawPDBGM;
						pjx->isShowPDBML = DBS.BZB.ISDrawPDBML;

						pjx->BZ_StartCml = DBS.BZB.BZSml;
						pjx->BZ_EndCml = DBS.BZB.BZEml;

						if (DBS.BZB.BZBHCml > 0)
						{
							pjx->TrsCmltoNE(DBS.BZB.BZBHCml, GDBZPZ);
							pjx->m_BZBHPt.x = GDBZPZ.x;
							pjx->m_BZBHPt.y = GDBZPZ.y;
						}
						if (DBS.BZB.BZYXCCml > 0)
						{
							pjx->TrsCmltoNE(DBS.BZB.BZYXCCml, GDBZPZ);
							pjx->m_BZYXCPt.x = GDBZPZ.x;
							pjx->m_BZYXCPt.y = GDBZPZ.y;
						}
						if (DBS.BZB.BZDHCml > 0)
						{
							pjx->TrsCmltoNE(DBS.BZB.BZDHCml, GDBZPZ);
							pjx->m_BZDHPt.x = GDBZPZ.x;
							pjx->m_BZDHPt.y = GDBZPZ.y;
						}
						if (DBS.BZB.BZJLCml > 0)
						{
							pjx->TrsCmltoNE(DBS.BZB.BZJLCml, GDBZPZ);
							pjx->m_BZJLFPt.x = GDBZPZ.x;
							pjx->m_BZJLFPt.y = GDBZPZ.y;
						}

						pjx->m_BZQXBHPt.resize(pjx->NJD);
						if (DBS.BZB.QXBZPt.size() == 0)
						{
							DBS.BZB.QXBZPt.resize(pjx->NJD);
							for (int j = 0; j < pjx->NJD; j++)
								pjx->m_BZQXBHPt[j].Init(-99999.0, -99999.0);
						}
						else
						{
							for (int j = 0; j < pjx->NJD; j++)
								pjx->m_BZQXBHPt[j].Init(DBS.BZB.QXBZPt[j].x, DBS.BZB.QXBZPt[j].y);
						}

						pjx->m_BZQXYSPt.resize(pjx->NJD);
						if (DBS.BZB.YSBZPt.size() == 0)
						{
							DBS.BZB.YSBZPt.resize(pjx->NJD);
							for (int j = 0; j < pjx->NJD; j++)
								pjx->m_BZQXYSPt[j].Init(-99999.0, -99999.0);
						}
						else
						{
							for (int j = 0; j < pjx->NJD; j++)
								pjx->m_BZQXYSPt[j].Init(DBS.BZB.YSBZPt[j].x, DBS.BZB.YSBZPt[j].y);
						}
					}
				}
				else
				{
					//continue;
				}
		
				xlpoint PZtmp;
				if (DBS.Read_StationDbs(m_MdbName, ENC("股道有效长表"), InquireString))
				{
					//for (int j=0;j<DBS.NYXC;j++)
					{
						pjx->UpValidL = DBS.YXCB.UpValidL;
						pjx->SXYXCQDType = DBS.YXCB.SXYXCQDType;
						_tcscpy(pjx->SXYXCQDID, DBS.YXCB.SXYXCQDID);
						pjx->SXYXCZDType = DBS.YXCB.SXYXCZDType;
						_tcscpy(pjx->SXYXCZDID, DBS.YXCB.SXYXCZDID);
						if (DBS.YXCB.SXYXCQDType == 5)
						{
							pjx->TrsCmltoNE(DBS.YXCB.SX_QDcml, PZtmp);
							pjx->SX_Spt.x = PZtmp.x;
							pjx->SX_Spt.y = PZtmp.y;
						}
						if (DBS.YXCB.SXYXCZDType == 5)
						{
							pjx->TrsCmltoNE(DBS.YXCB.SX_ZDcml, PZtmp);
							pjx->SX_Ept.x = PZtmp.x;
							pjx->SX_Ept.y = PZtmp.y;
						}
						if (DBS.YXCB.XXYXCQDType == 5)
						{
							pjx->TrsCmltoNE(DBS.YXCB.XX_QDcml, PZtmp);
							pjx->XX_Spt.x = PZtmp.x;
							pjx->XX_Spt.y = PZtmp.y;
						}
						if (DBS.YXCB.XXYXCQDType == 5)
						{
							pjx->TrsCmltoNE(DBS.YXCB.XX_ZDcml, PZtmp);
							pjx->XX_Ept.x = PZtmp.x;
							pjx->XX_Ept.y = PZtmp.y;
						}
						pjx->SX_QDcml = DBS.YXCB.SX_QDcml;
						pjx->SX_ZDcml = DBS.YXCB.SX_ZDcml;
						pjx->DownValidL = DBS.YXCB.DownValidL;
						pjx->XXYXCQDType = DBS.YXCB.XXYXCQDType;
						_tcscpy(pjx->XXYXCQDID, DBS.YXCB.XXYXCQDID);
						pjx->XXYXCZDType = DBS.YXCB.XXYXCZDType;
						_tcscpy(pjx->XXYXCZDID, DBS.YXCB.XXYXCZDID);
						pjx->XX_QDcml = DBS.YXCB.XX_QDcml;
						pjx->XX_ZDcml = DBS.YXCB.XX_ZDcml;
						pjx->UpValidL_YL = DBS.YXCB.UpValidL_YL;
						pjx->SXYXCQDType_YL = DBS.YXCB.SXYXCQDType_YL;
						_tcscpy(pjx->SXYXCQDID_YL, DBS.YXCB.SXYXCQDID_YL);
						pjx->SXYXCZDType_YL = DBS.YXCB.SXYXCZDType_YL;
						_tcscpy(pjx->SXYXCZDID_YL, DBS.YXCB.SXYXCZDID_YL);
						pjx->SX_QDcml_YL = DBS.YXCB.SX_QDcml_YL;
						pjx->SX_ZDcml_YL = DBS.YXCB.SX_ZDcml_YL;
						pjx->DownValidL_YL = DBS.YXCB.DownValidL_YL;
						pjx->XXYXCQDType_YL = DBS.YXCB.XXYXCQDType_YL;
						_tcscpy(pjx->XXYXCQDID_YL, DBS.YXCB.XXYXCQDID_YL);
						pjx->XXYXCZDType_YL = DBS.YXCB.XXYXCZDType_YL;
						_tcscpy(pjx->XXYXCZDID, DBS.YXCB.XXYXCZDID);
						pjx->XX_QDcml_YL = DBS.YXCB.XX_QDcml_YL;
						pjx->XX_ZDcml_YL = DBS.YXCB.XX_ZDcml_YL;
					}
				}
				else
				{
					//continue;
				}

				pjx->PeiGuiArray.clear();
				if (DBS.Read_StationDbs(m_MdbName, ENC("股道配轨表"), InquireString))//读断链表
				{
					for (int i2 = 0; i2 < (int)DBS.GDPGBArray.size(); i2++)
						pjx->PeiGuiArray.push_back(DBS.GDPGBArray[i2].PeiGuiLength);
				}

				if (DBS.Read_StationDbs(m_MdbName, ENC("股道断链表"), InquireString))//读断链表
				{
					pjx->NDL = int(DBS.NDL + 0.1);
					for (int i3 = 0; i3 < pjx->NDL; i3++)
						pjx->setDLM(i3, DBS.DLB[i3].BLC, DBS.DLB[i3].DL, DBS.DLB[i3].BGH, DBS.DLB[i3].EGH);
					_tcscpy(pjx->LCGH, DBS.DLB[0].BGH);
				}

				CString CSInquireString = L"[" + ENC("对象ID") + L"]=\"" + BIANHAO + L"\"";
				if (DBS.Read_StationDbs(m_MdbName, ENC("钢轨类型数据"), CSInquireString))
					pjx->SetGGLXArray(DBS.m_GGLXArray, false);
				else
					pjx->SetDefaultGGLXArray();

				if (DBS.Read_StationDbs(m_MdbName, ENC("轨枕类型数据"), CSInquireString))
					pjx->SetDZLXArray(DBS.m_GZLCArray, false);
				else
					pjx->SetDefaultDZLXArray();

				if (DBS.Read_StationDbs(m_MdbName, ENC("道砟里程分段数据"), CSInquireString))
					pjx->SetDZLCArray(DBS.m_DZLCArray, false);
				else
					pjx->SetDefaultDZLCArray();

				if (DBS.Read_StationDbs(m_MdbName, ENC("电化里程分段数据"), CSInquireString))
					pjx->m_DHArray = DBS.m_DHArray;
				else
					pjx->SetDefaultDHArray();

				if (DBS.Read_StationDbs(m_MdbName, ENC("护轮轨类型数据"), CSInquireString))
					pjx->SetHLGLXArray(DBS.m_HLGLXArray, false);
				else
					pjx->SetDefaultHLGLXArray();

				if (DBS.Read_StationDbs(m_MdbName, ENC("股道利用段数据"), CSInquireString))
					pjx->SetLYDArray(DBS.m_LYDArray, false);

				if (DBS.Read_StationDbs(m_MdbName, ENC("股道拆除段数据"), CSInquireString))
					pjx->SetChaiChuArray(DBS.m_ChaiChuArray, false);

				if (DBS.Read_StationDbs(m_MdbName, ENC("道床顶宽数据"), CSInquireString))
					pjx->SetDCDKArray(DBS.m_DCDKArray, false);
				else
					pjx->SetDefaultDCDKArray();

				if (DBS.Read_StationDbs(m_MdbName, ENC("坡度表"), InquireString))
				{
					if (DBS.NPD > 0)
					{
						pjx->SetBPDArray(DBS.NPD, DBS.PDB, false);
						if (_tcscmp(DBS.PDB[DBS.NPD - 1].Notes, L"路面坡") == 0)
							pjx->m_LJorGM = 0;
						else
							pjx->m_LJorGM = 1;

						CString strtmp;
						strtmp = DBS.PDB[0].Notes;
						pjx->m_Xsw = _ttoi(strtmp);
						pjx->m_DesHXSW = int(DBS.PDB[0].Rshu + 0.1);
					}
				}
				//pjx->getpxy_DATA();
				pGTZXArray.push_back(pjx);
			}
		}
	}

	DBS.Disconnect_StationDbs();
}