//--------------------------------------------------------------------------- #include #include #include "ITSDbF.h" #pragma hdrstop #include "FrmUtilMainF.h" #include #include //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma link "cxButtons" #pragma link "cxCheckBox" #pragma link "cxContainer" #pragma link "cxControls" #pragma link "cxEdit" #pragma link "cxGraphics" #pragma link "cxGroupBox" #pragma link "cxLabel" #pragma link "cxLookAndFeelPainters" #pragma link "cxLookAndFeels" #pragma link "cxProgressBar" #pragma link "cxTextEdit" #pragma link "dxSkinsCore" #pragma link "dxSkinBlack" #pragma link "dxSkinMcSkin" #pragma link "dxmdaset" #pragma resource "*.dfm" TFrmUtilMain *FrmUtilMain; //--------------------------------------------------------------------------- #define XML_DIR "\\MAPDATA\\layers\\" APP_CONFIG g_AppCfg; //Provider=tbprov.Tbprov.5;Cache Authentication=False;Encrypt Password=False;Integrated Security="";Mask Password=False;Persist Encrypted=False;Persist Security Info=False;User ID="";Bind Flags=0;Initial Catalog="";Data Source=GMUTIS;Impersonation Level=Anonymous;Location="";Lock Owner="";Mode=ReadWrite;Protection Level=None;Extended Properties="";Updatable Cursor=False;Enlist=None //Provider=tbprov.Tbprov.5;Cache Authentication=False;Encrypt Password=False;Integrated Security="";Mask Password=False;Persist Encrypted=False;Persist Security Info=False;User ID=itsdev;Bind Flags=0;Initial Catalog="";Data Source=GMUTIS;Impersonation Level=Anonymous;Location="";Lock Owner="";Mode=ReadWrite;Protection Level=None;Updatable Cursor=False;Enlist=None; bool LoadDefaultConfigInfo(String ACfgFile/*=""*/) { String sCfgFile; TIniFile *pIniFile = NULL; g_AppCfg.bAppClose = false; String sAppDir = ExtractFilePath(Application->ExeName); String sCfgDir = sAppDir + "Cfg\\"; String sIniFile = ChangeFileExt(ExtractFileName(Application->ExeName), ".ini"); if (!ACfgFile.IsEmpty()) sIniFile = ACfgFile + ".ini"; sCfgFile = sCfgDir + sIniFile; String sMapDir = sAppDir + XML_DIR; ForceDirectories(sMapDir.c_str()); try { String sTmp; pIniFile = new TIniFile(sCfgFile); String sSqlLog; g_AppCfg.itsdb.bSqlLog = false; g_AppCfg.itsdb.sProvider = pIniFile->ReadString("ITSDB", "PROVIDER", "OraOLEDB.Oracle.1"); g_AppCfg.itsdb.sServerName = pIniFile->ReadString("ITSDB", "SERVERNAME", "HANTE"); g_AppCfg.itsdb.sUserName = pIniFile->ReadString("ITSDB", "USERNAME", "hnits"); g_AppCfg.itsdb.sPassword = pIniFile->ReadString("ITSDB", "PASSWORD", "hnits"); g_AppCfg.link.bSqlLog = false; g_AppCfg.link.sProvider = pIniFile->ReadString("ITSDB_LINK", "PROVIDER", "OraOLEDB.Oracle.1"); g_AppCfg.link.sServerName = pIniFile->ReadString("ITSDB_LINK", "SERVERNAME", "HANTE"); g_AppCfg.link.sUserName = pIniFile->ReadString("ITSDB_LINK", "USERNAME", "hnits"); g_AppCfg.link.sPassword = pIniFile->ReadString("ITSDB_LINK", "PASSWORD", "hnits"); g_AppCfg.ifsc.bSqlLog = false; g_AppCfg.ifsc.sProvider = pIniFile->ReadString("ITSDB_IFSC", "PROVIDER", "OraOLEDB.Oracle.1"); g_AppCfg.ifsc.sServerName = pIniFile->ReadString("ITSDB_IFSC", "SERVERNAME", "HANTE"); g_AppCfg.ifsc.sUserName = pIniFile->ReadString("ITSDB_IFSC", "USERNAME", "hnits"); g_AppCfg.ifsc.sPassword = pIniFile->ReadString("ITSDB_IFSC", "PASSWORD", "hnits"); g_AppCfg.road.bSqlLog = false; g_AppCfg.road.sProvider = pIniFile->ReadString("ITSDB_ROAD", "PROVIDER", "OraOLEDB.Oracle.1"); g_AppCfg.road.sServerName = pIniFile->ReadString("ITSDB_ROAD", "SERVERNAME", "HANTE"); g_AppCfg.road.sUserName = pIniFile->ReadString("ITSDB_ROAD", "USERNAME", "hnits"); g_AppCfg.road.sPassword = pIniFile->ReadString("ITSDB_ROAD", "PASSWORD", "hnits"); String sTemp = g_AppCfg.itsdb.sProvider.UpperCase(); if (sTemp.Pos("TIBERO")) { //g_AppCfg.itsdb.sProvider = "bprov.MSDTB.5"; } g_AppCfg.flashmap.sMainMap = pIniFile->ReadString("FLASHMAP", "MAINMAP", ""); g_AppCfg.flashmap.sLinkMap = pIniFile->ReadString("FLASHMAP", "LINKMAP", ""); #if 0 if (g_AppCfg.flashmap.sMainMap == "" || g_AppCfg.flashmap.sLinkMap == "") { Application->MessageBox(L"Áöµµ ¼³Á¤ Á¤º¸¸¦ Àоî¿À´Âµ¥ ½ÇÆÐÇÏ¿´½À´Ï´Ù.!!!!!!!!!!", L"ȯ°æ¼³Á¤ Á¤º¸ ·Îµù ¿À·ù!!!", MB_OK|MB_ICONERROR); } #endif g_AppCfg.flashmap.sMainMap = sAppDir + g_AppCfg.flashmap.sMainMap; g_AppCfg.flashmap.sLinkMap = sAppDir + g_AppCfg.flashmap.sLinkMap; } __finally { if (pIniFile) delete pIniFile; pIniFile = NULL; } return true; } //--------------------------------------------------------------------------- void DB_CLOSE() { ITSDb_Close(); } //--------------------------------------------------------------------------- bool DB_OPEN(DB_INFO *ADbInfo) { DB_CLOSE(); ITSDb_SetInfo(ADbInfo->sProvider, ADbInfo->sServerName, ADbInfo->sUserName, ADbInfo->sPassword); if (!ITSDb_Open()) { Application->MessageBox(L"µ¥ÀÌÅͺ£À̽º ¿¬°á¿¡ ½ÇÆÐÇÏ¿´½À´Ï´Ù.\r\nȯ°æÆÄÀÏ¿¡¼­ µ¥ÀÌÅͺ£À̽º ¿¬°á Á¤º¸¸¦ È®ÀÎÇϼ¼¿ä.", L"µ¥ÀÌÅͺ£À̽º Á¢¼Ó ¿À·ù!!!", MB_OK|MB_ICONERROR); return false; } return true; } __fastcall TFrmUtilMain::TFrmUtilMain(TComponent* Owner) : TForm(Owner) { Application->OnException = OnAppException; } //--------------------------------------------------------------------------- void __fastcall TFrmUtilMain::OnAppException(TObject *Sender, Exception *exception) { String sClassName = (NULL != Sender) ? Sender->ClassName() : String("Unknown_Class"); String sErrMsg = (NULL != exception) ? exception->Message : String("Unknown_Error"); String sError = sClassName + " : " + sErrMsg; //Application->ShowException(&exception); //WriteLog(logError, "OnAppException: [%s]", AnsiString(sError).c_str()); } //--------------------------------------------------------------------------- void __fastcall TFrmUtilMain::CommClose() { } //--------------------------------------------------------------------------- void __fastcall TFrmUtilMain::FormClose(TObject *Sender, TCloseAction &Action) { CommClose(); //Action = caFree; } //--------------------------------------------------------------------------- void __fastcall TFrmUtilMain::FormCreate(TObject *Sender) { FOnMessage = Application->OnMessage; } //--------------------------------------------------------------------------- void __fastcall TFrmUtilMain::FormDestroy(TObject *Sender) { try { //::OleUninitialize(); //::CoUninitialize(); } catch(Exception &exception) { //WriteLog(logError, "FormDestroy: [%s]", AnsiString(exception.ClassName()+exception.Message).c_str()); } } //--------------------------------------------------------------------------- void __fastcall TFrmUtilMain::FormShow(TObject *Sender) { Application->ProcessMessages(); edPath->Text = ExtractFilePath(Application->ExeName) + XML_DIR; Refresh(); Application->ProcessMessages(); TmrOnShow->Enabled = true; } //--------------------------------------------------------------------------- void __fastcall TFrmUtilMain::FormCloseQuery(TObject *Sender, bool &CanClose) { // ÆûÀÌ ´ÝÈ÷±â Àü¿¡ ¼öÇàÇØ¾ß ÇÒ ¸ð¹Ä ±â¼ú // ÇÁ·Î±×·¥ Á¾·á¸¦ »ç¿ëÀÚ°¡ È®ÀÎÇÒ ¼ö ÀÖµµ·Ï... if (!g_AppCfg.bAppClose) { String strMsg; strMsg = ""; strMsg = "[ " + Caption + " ]\r\n\n"; strMsg+= "ÇÁ·Î±×·¥À» Á¾·á ÇϽðڽÀ´Ï±î?"; //if(Application->MessageBox(strMsg.c_str(), String("ÇÁ·Î±×·¥ Á¾·á È®ÀÎ").c_str(), MB_YESNO|MB_ICONQUESTION) == IDYES) { /* * È­¸é°ü·Ã ÀÛ¾÷À» ¸øÇϵµ·Ï ¿©±â¿¡ Äڵ带 ÀûÀÚ... */ ITSDb_ApplicationTerm(); g_AppCfg.bAppClose = true; } CanClose = false; } } //--------------------------------------------------------------------------- void __fastcall TFrmUtilMain::BtnCloseClick(TObject *Sender) { g_AppCfg.bAppClose = true; Close(); } //--------------------------------------------------------------------------- void __fastcall TFrmUtilMain::TmrOnShowTimer(TObject *Sender) { TmrOnShow->Enabled = false; #if 0 if (!ITSDb_Open()) { Application->MessageBox(L"µ¥ÀÌÅͺ£À̽º ¿¬°á¿¡ ½ÇÆÐÇÏ¿´½À´Ï´Ù.\r\nȯ°æÆÄÀÏ¿¡¼­ µ¥ÀÌÅͺ£À̽º ¿¬°á Á¤º¸¸¦ È®ÀÎÇϼ¼¿ä.\r\n\r\nÇÁ·Î±×·¥À» Á¾·áÇÕ´Ï´Ù.", L"µ¥ÀÌÅͺ£À̽º Á¢¼Ó ¿À·ù!!!", MB_OK|MB_ICONERROR); g_AppCfg.bAppClose = true; Close(); return; } #endif TmrAppState->Enabled = true; } //--------------------------------------------------------------------------- void __fastcall TFrmUtilMain::TmrAppStateTimer(TObject *Sender) { TmrAppState->Enabled = false; if (g_AppCfg.bAppClose) { ITSDb_Close(); Close(); try { Application->Terminate(); } catch(Exception &exception) {} } else { TmrAppState->Enabled = true; } } //--------------------------------------------------------------------------- void __fastcall TFrmUtilMain::UpdateProgress(int AProg, String AMsg/*=""*/) { try { cxProgressBar1->Position = AProg; if (AMsg != "") LblStatus->Caption = AMsg; Application->ProcessMessages(); } catch(Exception &exception) {} } //--------------------------------------------------------------------------- void __fastcall TFrmUtilMain::cxButton1Click(TObject *Sender) { #if 0 // µ¥ÀÌÅͺ£À̽º ¹öÅØ½º Á¤º¸ ¼³Á¤ int nStep; String sQry; TADOQuery *pADO = NULL; if (Application->MessageBox(L"µ¥ÀÌÅͺ£À̽º Vertex Á¤º¸¸¦ »ý¼ºÇϽðڽÀ´Ï±î?\r\n±âÁ¸ÀÇ Á¤º¸°¡ »èÁ¦µÇ°í »õ·Î¿î Á¤º¸°¡ ÀԷµ˴ϴÙ.", L"µ¥ÀÌÅͺ£À̽º Vertex Á¤º¸»ý¼º", MB_YESNO|MB_ICONQUESTION|MB_APPLMODAL) != IDYES) { return; } cxProgressBar1->Properties->Max = 9; PnlProg->Left = 16; PnlProg->Top = 304; PnlProg->Visible = true; cxButton1->Enabled = false; cxButton2->Enabled = false; try { pADO = new TADOQuery(NULL); ITSDb_GetConnection()->BeginTrans(); pADO->Connection = ITSDb_GetConnection(); try { nStep = 1; UpdateProgress(nStep, cxLabel3->Caption); sQry = "DELETE TB_ROAD_VRTX_ARR"; pADO->Close(); pADO->SQL->Text = sQry; pADO->ExecSQL(); LblDb01->Caption = "¼º°ø"; sQry = "INSERT INTO TB_ROAD_VRTX_ARR \r\n" "SELECT X.ROAD_ID, X.LEVL, Y.CRDN_CNT, X.X_CRDN_ARR, X.Y_CRDN_ARR, \r\n" " Y.X_CRDN_MIN, Y.X_CRDN_MAX, Y.Y_CRDN_MIN, Y.Y_CRDN_MAX \r\n" " FROM (SELECT ROAD_ID, :p01 AS LEVL, \r\n" " SUBSTR(MAX(SYS_CONNECT_BY_PATH (X_CRDN, ',')), 2) X_CRDN_ARR, \r\n" " SUBSTR(MAX(SYS_CONNECT_BY_PATH (Y_CRDN, ',')), 2) Y_CRDN_ARR \r\n" " FROM (SELECT ROAD_ID, X_CRDN, Y_CRDN, \r\n" " ROW_NUMBER () OVER (PARTITION BY ROAD_ID ORDER BY ORD) RNUM \r\n" " FROM (SELECT ROAD_ID, ORD, X_CRDN, Y_CRDN \r\n" " FROM TB_ROAD_VRTX \r\n" " WHERE LEVL = :p02 \r\n" " ) \r\n" " ) \r\n" " START WITH RNUM = 1 \r\n" " CONNECT BY PRIOR RNUM = RNUM - 1 AND PRIOR ROAD_ID = ROAD_ID \r\n" " GROUP BY ROAD_ID) X, \r\n" " (SELECT ROAD_ID, LEVL, COUNT(1) AS CRDN_CNT, \r\n" " MIN(X_CRDN) AS X_CRDN_MIN, MAX(X_CRDN) AS X_CRDN_MAX, \r\n" " MIN(Y_CRDN) AS Y_CRDN_MIN, MAX(Y_CRDN) AS Y_CRDN_MAX \r\n" " FROM TB_ROAD_VRTX \r\n" " GROUP BY ROAD_ID, LEVL) Y \r\n" " WHERE X.ROAD_ID = Y.ROAD_ID \r\n" " AND X.LEVL = Y.LEVL \r\n" " AND X.ROAD_ID IN (SELECT ROAD_ID FROM TB_ROAD WHERE DEL_YN = 'N') \r\n"; nStep = 2; UpdateProgress(nStep, cxLabel4->Caption); pADO->Close(); pADO->SQL->Text = sQry; pADO->Parameters->ParamByName("p01")->Value = "1000"; pADO->Parameters->ParamByName("p02")->Value = "1000"; pADO->ExecSQL(); LblDb02->Caption = "¼º°ø"; nStep = 3; UpdateProgress(nStep, cxLabel5->Caption); //pADO->Close(); //pADO->SQL->Text = sQry; pADO->Parameters->ParamByName("p01")->Value = "2000"; pADO->Parameters->ParamByName("p02")->Value = "2000"; pADO->ExecSQL(); LblDb03->Caption = "¼º°ø"; nStep = 4; UpdateProgress(nStep, cxLabel6->Caption); //pADO->Close(); //pADO->SQL->Text = sQry; pADO->Parameters->ParamByName("p01")->Value = "4000"; pADO->Parameters->ParamByName("p02")->Value = "4000"; pADO->ExecSQL(); LblDb04->Caption = "¼º°ø"; nStep = 5; UpdateProgress(nStep, cxLabel7->Caption); sQry = "DELETE TB_IFSC_VRTX_ARR"; pADO->Close(); pADO->SQL->Text = sQry; pADO->ExecSQL(); LblDb05->Caption = "¼º°ø"; sQry = "INSERT INTO TB_IFSC_VRTX_ARR \r\n" "SELECT X.IFSC_ID, X.LEVL, Y.CRDN_CNT, X.X_CRDN_ARR, X.Y_CRDN_ARR, \r\n" " Y.X_CRDN_MIN, Y.X_CRDN_MAX, Y.Y_CRDN_MIN, Y.Y_CRDN_MAX \r\n" " FROM (SELECT IFSC_ID, :p01 AS LEVL, \r\n" " SUBSTR(MAX(SYS_CONNECT_BY_PATH (X_CRDN, ',')), 2) X_CRDN_ARR, \r\n" " SUBSTR(MAX(SYS_CONNECT_BY_PATH (Y_CRDN, ',')), 2) Y_CRDN_ARR \r\n" " FROM (SELECT IFSC_ID, X_CRDN, Y_CRDN, \r\n" " ROW_NUMBER () OVER (PARTITION BY IFSC_ID ORDER BY ORD) RNUM \r\n" " FROM (SELECT IFSC_ID, ORD, X_CRDN, Y_CRDN \r\n" " FROM TB_IFSC_VRTX \r\n" " WHERE LEVL = :p02 \r\n" " ) \r\n" " ) \r\n" " START WITH RNUM = 1 \r\n" " CONNECT BY PRIOR RNUM = RNUM - 1 AND PRIOR IFSC_ID = IFSC_ID \r\n" " GROUP BY IFSC_ID) X, \r\n" " (SELECT IFSC_ID, LEVL, COUNT(1) AS CRDN_CNT, \r\n" " MIN(X_CRDN) AS X_CRDN_MIN, MAX(X_CRDN) AS X_CRDN_MAX, \r\n" " MIN(Y_CRDN) AS Y_CRDN_MIN, MAX(Y_CRDN) AS Y_CRDN_MAX \r\n" " FROM TB_IFSC_VRTX \r\n" " GROUP BY IFSC_ID, LEVL) Y \r\n" " WHERE X.IFSC_ID = Y.IFSC_ID \r\n" " AND X.LEVL = Y.LEVL \r\n" " AND X.IFSC_ID IN (SELECT IFSC_ID FROM TB_IFSC WHERE DEL_YN = 'N') \r\n"; nStep = 6; UpdateProgress(nStep, cxLabel8->Caption); pADO->Close(); pADO->SQL->Text = sQry; pADO->Parameters->ParamByName("p01")->Value = "50"; pADO->Parameters->ParamByName("p02")->Value = "50"; pADO->ExecSQL(); LblDb06->Caption = "¼º°ø"; nStep = 7; UpdateProgress(nStep, cxLabel9->Caption); //pADO->Close(); //pADO->SQL->Text = sQry; pADO->Parameters->ParamByName("p01")->Value = "100"; pADO->Parameters->ParamByName("p02")->Value = "100"; pADO->ExecSQL(); LblDb07->Caption = "¼º°ø"; nStep = 8; UpdateProgress(nStep, cxLabel10->Caption); //pADO->Close(); //pADO->SQL->Text = sQry; pADO->Parameters->ParamByName("p01")->Value = "250"; pADO->Parameters->ParamByName("p02")->Value = "250"; pADO->ExecSQL(); LblDb08->Caption = "¼º°ø"; nStep = 9; UpdateProgress(nStep, cxLabel11->Caption); //pADO->Close(); //pADO->SQL->Text = sQry; pADO->Parameters->ParamByName("p01")->Value = "500"; pADO->Parameters->ParamByName("p02")->Value = "500"; pADO->ExecSQL(); LblDb09->Caption = "¼º°ø"; ITSDb_GetConnection()->CommitTrans(); Application->MessageBox(L"µ¥ÀÌÅͺ£À̽º Vertex Á¤º¸¸¦ »ý¼ºÇÏ¿´½À´Ï´Ù.", L"µ¥ÀÌÅͺ£À̽º Vertex Á¤º¸»ý¼º", MB_OK|MB_ICONINFORMATION|MB_APPLMODAL); } catch(Exception &exception) { ITSDb_GetConnection()->RollbackTrans(); switch(nStep) { case 1: LblDb01->Caption = "½ÇÆÐ"; break; case 2: LblDb02->Caption = "½ÇÆÐ"; break; case 3: LblDb03->Caption = "½ÇÆÐ"; break; case 4: LblDb04->Caption = "½ÇÆÐ"; break; case 5: LblDb05->Caption = "½ÇÆÐ"; break; case 6: LblDb06->Caption = "½ÇÆÐ"; break; case 7: LblDb07->Caption = "½ÇÆÐ"; break; case 8: LblDb08->Caption = "½ÇÆÐ"; break; case 9: LblDb09->Caption = "½ÇÆÐ"; break; } String sErrMsg; sErrMsg = "µ¥ÀÌÅͺ£À̽º ÀÛ¾÷Áß¿¡ ¿À·ù°¡ ¹ß»ý ÇÏ¿´½À´Ï´Ù.\r\n"; sErrMsg+= String(exception.ClassName()) + exception.Message; Application->MessageBox(sErrMsg.c_str(), L"µ¥ÀÌÅͺ£À̽º Vertex Á¤º¸ »ý¼º ¿À·ù", MB_OK|MB_ICONERROR|MB_APPLMODAL); return; } } __finally { PnlProg->Visible = false; cxButton1->Enabled = true; cxButton2->Enabled = true; if (pADO) { pADO->Close(); delete pADO; } } #endif } //--------------------------------------------------------------------------- void __fastcall TFrmUtilMain::cxButton2Click(TObject *Sender) { int nStep; String sQry; TADOQuery *pADO = NULL; if ((!ChkLinkVertex->Checked) && (!ChkIfscVertex->Checked) && (!ChkRoadVertex->Checked) ) { Application->MessageBox(L"ÀÛ¾÷ ´ë»ó Á¤º¸¸¦ ¼±ÅÃÇϽʽÿä.", L"XML ÆÄÀÏ »ý¼º", MB_OK|MB_ICONERROR|MB_APPLMODAL); return; } if (Application->MessageBox(L"¼±ÅÃÇÑ Á¤º¸ÀÇ ÁÂÇ¥ÆÄÀÏÀ» ½Å±Ô·Î »ý¼ºÇϽðڽÀ´Ï±î?\r\n±âÁ¸ÀÇ ÆÄÀÏÀº »èÁ¦µÇ°í »õ·Î¿î ÆÄÀÏÀÌ »ý¼ºµË´Ï´Ù.", L"Áöµµ ÁÂÇ¥ ÆÄÀÏ »ý¼º", MB_YESNO|MB_ICONQUESTION|MB_APPLMODAL) != IDYES) { return; } try { //_wsetlocale(LC_ALL, L"kor"); cxProgressBar1->Properties->Max = 2; PnlProg->Left = 16; PnlProg->Top = 124; PnlProg->Visible = true; pADO = new TADOQuery(NULL); pADO->Connection = ITSDb_GetConnection(); pADO->CursorLocation = clUseClient; pADO->CursorType = ctStatic;//ctOpenForwardOnly; pADO->LockType = ltReadOnly;//ltBatchOptimistic; pADO->DisableControls(); if (ChkLinkVertex->Checked) MakeLinkVertexXml(pADO); if (ChkIfscVertex->Checked) MakeIfscVertexXml(pADO); if (ChkRoadVertex->Checked) MakeRoadVertexXml(pADO); Application->MessageBox(L"¼±ÅÃÇÑ Á¤º¸ÀÇ ÁÂÇ¥ÆÄÀÏ »ý¼ºÀ» ¿Ï·áÇÏ¿´½À´Ï´Ù.", L"Áöµµ ÁÂÇ¥ ÆÄÀÏ »ý¼º", MB_OK|MB_ICONINFORMATION|MB_APPLMODAL); } __finally { PnlProg->Visible = false; cxButton2->Enabled = true; if (pADO) { pADO->Close(); delete pADO; } } } //--------------------------------------------------------------------------- bool __fastcall TFrmUtilMain::MakeLinkVertexXml(TADOQuery *pADO) { if (DB_OPEN(&g_AppCfg.link) == false) { return false; } AnsiString sFile = ExtractFilePath(Application->ExeName) + XML_DIR+ "LINK.dat"; AnsiString sFileBackup = ExtractFilePath(Application->ExeName) + XML_DIR+ "LINK_"+Now().FormatString("yyyymmddhhnnss")+".dat"; try { CopyFile(String(sFile).c_str(), String(sFileBackup).c_str(), true); //Á¸ÀçÇÏ¸é ¾÷¾î¾´´Ù } catch(Exception &e) { } FILE *fd = NULL; UpdateProgress(1, "¸µÅ© ±¸°£ÁÂÇ¥ Á¤º¸ ÆÄÀÏ»ý¼º"); if ((fd = fopen(sFile.c_str(), "w")) == NULL) { Application->MessageBox(L"¸µÅ© ±¸°£ÁÂÇ¥ Á¤º¸ ÆÄÀÏ ÆÄÀÏÀ» »ý¼ºÇÏÁö ¸øÇÏ¿´½À´Ï´Ù.", L"¸µÅ© ±¸°£ÁÂÇ¥ Á¤º¸ ÆÄÀÏ ÆÄÀÏ»ý¼º", MB_OK|MB_ICONERROR|MB_APPLMODAL); return false; } int nRows= 0; int nCnt = 0; String sQry; try { try { //sQry = "SELECT A.LINK_ID AS ID, A.X_CRDN_ARR, A.Y_CRDN_ARR \r\n" sQry = "SELECT A.LINK_ID AS ID, \r\n" " SUBSTR(A.X_CRDN_ARR, 1, 200) AS XMSG01, \r\n" " SUBSTR(A.X_CRDN_ARR, 201, 200) AS XMSG02, \r\n" " SUBSTR(A.X_CRDN_ARR, 401, 200) AS XMSG03, \r\n" " SUBSTR(A.X_CRDN_ARR, 601, 200) AS XMSG04, \r\n" " SUBSTR(A.X_CRDN_ARR, 801, 200) AS XMSG05, \r\n" " SUBSTR(A.X_CRDN_ARR, 1001, 200) AS XMSG06, \r\n" " SUBSTR(A.X_CRDN_ARR, 1201, 200) AS XMSG07, \r\n" " SUBSTR(A.X_CRDN_ARR, 1401, 200) AS XMSG08, \r\n" " SUBSTR(A.X_CRDN_ARR, 1601, 200) AS XMSG09, \r\n" " SUBSTR(A.X_CRDN_ARR, 1801, 200) AS XMSG10, \r\n" " SUBSTR(A.X_CRDN_ARR, 2001, 200) AS XMSG11, \r\n" " SUBSTR(A.X_CRDN_ARR, 2201, 200) AS XMSG12, \r\n" " SUBSTR(A.X_CRDN_ARR, 2401, 200) AS XMSG13, \r\n" " SUBSTR(A.X_CRDN_ARR, 2601, 200) AS XMSG14, \r\n" " SUBSTR(A.X_CRDN_ARR, 2801, 200) AS XMSG15, \r\n" " SUBSTR(A.X_CRDN_ARR, 3001, 200) AS XMSG16, \r\n" " SUBSTR(A.X_CRDN_ARR, 3201, 200) AS XMSG17, \r\n" " SUBSTR(A.X_CRDN_ARR, 3401, 200) AS XMSG18, \r\n" " SUBSTR(A.X_CRDN_ARR, 3601, 200) AS XMSG19, \r\n" " SUBSTR(A.X_CRDN_ARR, 3801, 200) AS XMSG20, \r\n" " SUBSTR(A.X_CRDN_ARR, 4001, 200) AS XMSG21, \r\n" " SUBSTR(A.X_CRDN_ARR, 4201, 200) AS XMSG22, \r\n" " SUBSTR(A.X_CRDN_ARR, 4401, 200) AS XMSG23, \r\n" " SUBSTR(A.Y_CRDN_ARR, 1, 200) AS YMSG01, \r\n" " SUBSTR(A.Y_CRDN_ARR, 201, 200) AS YMSG02, \r\n" " SUBSTR(A.Y_CRDN_ARR, 401, 200) AS YMSG03, \r\n" " SUBSTR(A.Y_CRDN_ARR, 601, 200) AS YMSG04, \r\n" " SUBSTR(A.Y_CRDN_ARR, 801, 200) AS YMSG05, \r\n" " SUBSTR(A.Y_CRDN_ARR, 1001, 200) AS YMSG06, \r\n" " SUBSTR(A.Y_CRDN_ARR, 1201, 200) AS YMSG07, \r\n" " SUBSTR(A.Y_CRDN_ARR, 1401, 200) AS YMSG08, \r\n" " SUBSTR(A.Y_CRDN_ARR, 1601, 200) AS YMSG09, \r\n" " SUBSTR(A.Y_CRDN_ARR, 1801, 200) AS YMSG10, \r\n" " SUBSTR(A.Y_CRDN_ARR, 2001, 200) AS YMSG11, \r\n" " SUBSTR(A.Y_CRDN_ARR, 2201, 200) AS YMSG12, \r\n" " SUBSTR(A.Y_CRDN_ARR, 2401, 200) AS YMSG13, \r\n" " SUBSTR(A.Y_CRDN_ARR, 2601, 200) AS YMSG14, \r\n" " SUBSTR(A.Y_CRDN_ARR, 2801, 200) AS YMSG15, \r\n" " SUBSTR(A.Y_CRDN_ARR, 3001, 200) AS YMSG16, \r\n" " SUBSTR(A.Y_CRDN_ARR, 3201, 200) AS YMSG17, \r\n" " SUBSTR(A.Y_CRDN_ARR, 3401, 200) AS YMSG18, \r\n" " SUBSTR(A.Y_CRDN_ARR, 3601, 200) AS YMSG19, \r\n" " SUBSTR(A.Y_CRDN_ARR, 3801, 200) AS YMSG20, \r\n" " SUBSTR(A.Y_CRDN_ARR, 4001, 200) AS YMSG21, \r\n" " SUBSTR(A.Y_CRDN_ARR, 4201, 200) AS YMSG22, \r\n" " SUBSTR(A.Y_CRDN_ARR, 4401, 200) AS YMSG23 \r\n" " FROM TB_LINK_VRTX_ARR A, \r\n" " TB_LINK B \r\n" " WHERE B.DEL_YN = 'N' \r\n" " AND B.LINK_ID = A.LINK_ID \r\n" " AND A.LEVL = 1 \r\n"; pADO->Close(); pADO->SQL->Text = sQry; pADO->Open(); nRows = pADO->RecordCount; cxProgressBar1->Properties->Max = nRows; String ID; String XAddr; String YAddr; for( ; !pADO->Eof; pADO->Next(), nCnt++) { ID = pADO->FieldByName("ID")->AsString; //XAddr = pADO->FieldByName("X_CRDN_ARR")->AsWideString; //YAddr = pADO->FieldByName("Y_CRDN_ARR")->AsWideString; XAddr = ""; YAddr = ""; String sColNm; for (int ii = 1; ii < 24; ii++) { sColNm.printf(L"XMSG%02d", ii); XAddr += pADO->FieldByName(sColNm)->AsWideString; sColNm.printf(L"YMSG%02d", ii); YAddr += pADO->FieldByName(sColNm)->AsWideString; } fwprintf(fd, L"%s;%s;%s\n", ID.c_str(), XAddr.c_str(), YAddr.c_str()); if ((nCnt % 50) == 0) UpdateProgress(nCnt); } } catch(Exception &exception) { throw Exception(String(exception.ClassName()) + exception.Message); return false; } } __finally { UpdateProgress(nRows); if (fd) { fclose(fd); } pADO->Close(); DB_CLOSE(); } return true; } //--------------------------------------------------------------------------- bool __fastcall TFrmUtilMain::MakeIfscVertexXml2(TADOQuery *pADO) { AnsiString sFile = ExtractFilePath(Application->ExeName) + XML_DIR+ "IFSC.dat"; AnsiString sFileBackup = ExtractFilePath(Application->ExeName) + XML_DIR+ "IFSC_"+Now().FormatString("yyyymmddhhnnss")+".dat"; try { CopyFile(String(sFile).c_str(), String(sFileBackup).c_str(), true); //Á¸ÀçÇÏ¸é ¾÷¾î¾´´Ù } catch(Exception &e) { } FILE *fd = NULL; UpdateProgress(1, "Á¤º¸Á¦°ø±¸°£ ±¸°£ÁÂÇ¥ Á¤º¸ ÆÄÀÏ»ý¼º"); if ((fd = fopen(sFile.c_str(), "w")) == NULL) { Application->MessageBox(L"Á¤º¸Á¦°ø±¸°£ ±¸°£ÁÂÇ¥ Á¤º¸ ÆÄÀÏÀ» »ý¼ºÇÏÁö ¸øÇÏ¿´½À´Ï´Ù.", L"Á¤º¸Á¦°ø±¸°£ ±¸°£ÁÂÇ¥ Á¤º¸ ÆÄÀÏ»ý¼º", MB_OK|MB_ICONERROR|MB_APPLMODAL); return false; } int nRows= 0; int nCnt = 0; String sQry; int nTotal = 0; #if 0 sQry = "SELECT A.IFSC_ID AS ID, \r\n" " SUBSTR(A.X_CRDN_ARR, 1, 400) AS XMSG01, \r\n" " SUBSTR(A.X_CRDN_ARR, 401, 400) AS XMSG02, \r\n" " SUBSTR(A.X_CRDN_ARR, 801, 400) AS XMSG03, \r\n" " SUBSTR(A.X_CRDN_ARR, 1201, 400) AS XMSG04, \r\n" " SUBSTR(A.X_CRDN_ARR, 1601, 400) AS XMSG05, \r\n" " SUBSTR(A.X_CRDN_ARR, 2001, 400) AS XMSG06, \r\n" " SUBSTR(A.X_CRDN_ARR, 2401, 400) AS XMSG07, \r\n" " SUBSTR(A.X_CRDN_ARR, 2801, 400) AS XMSG08, \r\n" " SUBSTR(A.X_CRDN_ARR, 3201, 400) AS XMSG09, \r\n" " SUBSTR(A.X_CRDN_ARR, 3601, 400) AS XMSG10, \r\n" " SUBSTR(A.X_CRDN_ARR, 4001, 400) AS XMSG11, \r\n" " SUBSTR(A.X_CRDN_ARR, 4401, 400) AS XMSG12, \r\n" " SUBSTR(A.Y_CRDN_ARR, 1, 400) AS YMSG01, \r\n" " SUBSTR(A.Y_CRDN_ARR, 401, 400) AS YMSG02, \r\n" " SUBSTR(A.Y_CRDN_ARR, 801, 400) AS YMSG03, \r\n" " SUBSTR(A.Y_CRDN_ARR, 1201, 400) AS YMSG04, \r\n" " SUBSTR(A.Y_CRDN_ARR, 1601, 400) AS YMSG05, \r\n" " SUBSTR(A.Y_CRDN_ARR, 2001, 400) AS YMSG06, \r\n" " SUBSTR(A.Y_CRDN_ARR, 2401, 400) AS YMSG07, \r\n" " SUBSTR(A.Y_CRDN_ARR, 2801, 400) AS YMSG08, \r\n" " SUBSTR(A.Y_CRDN_ARR, 3201, 400) AS YMSG09, \r\n" " SUBSTR(A.Y_CRDN_ARR, 3601, 400) AS YMSG10, \r\n" " SUBSTR(A.Y_CRDN_ARR, 4001, 400) AS YMSG11, \r\n" " SUBSTR(A.Y_CRDN_ARR, 4401, 400) AS YMSG12 \r\n" " FROM TB_IFSC_VRTX_ARR A, \r\n" " TB_IFSC B \r\n" " WHERE B.DEL_YN = 'N' \r\n" " AND B.IFSC_ID = A.IFSC_ID \r\n" " AND A.LEVL = 5 \r\n"; #if 1 sQry = "SELECT A.IFSC_ID AS ID, A.X_CRDN_ARR, A.Y_CRDN_ARR \r\n" " FROM TB_IFSC_VRTX_ARR A, \r\n" " TB_IFSC B \r\n" " WHERE B.DEL_YN = 'N' \r\n" " AND B.IFSC_ID = A.IFSC_ID \r\n" " AND A.LEVL = 5 \r\n"; #endif #endif try { try { sQry = "SELECT COUNT(1) AS TOTAL_CNT \r\n" " FROM TB_IFSC_VRTX_ARR A, \r\n" " TB_IFSC B \r\n" " WHERE B.DEL_YN = 'N' \r\n" " AND B.IFSC_ID = A.IFSC_ID \r\n" " AND A.LEVL = 5 \r\n"; pADO->Close(); pADO->SQL->Text = sQry; pADO->Open(); for( ; !pADO->Eof; pADO->Next(), nCnt++) { nTotal = pADO->FieldByName("TOTAL_CNT")->AsInteger; } } catch(Exception &exception) { throw Exception(String(exception.ClassName()) + exception.Message); return false; } } __finally { pADO->Close(); } int nFetchRows = 500; int nFetchCnts = nTotal / nFetchRows; nFetchCnts = nFetchCnts + ((nTotal % nFetchRows) ? 1 : 0); for (int seq = 0; seq < nFetchCnts; seq++) { try { try { sQry = "SELECT ID, X_CRDN_ARR, Y_CRDN_ARR \r\n" " FROM ( \r\n" "SELECT A.IFSC_ID AS ID, A.X_CRDN_ARR, A.Y_CRDN_ARR, ROWNUM AS DATA_SEQ \r\n" " FROM TB_IFSC_VRTX_ARR A, \r\n" " TB_IFSC B \r\n" " WHERE B.DEL_YN = 'N' \r\n" " AND B.IFSC_ID = A.IFSC_ID \r\n" " AND A.LEVL = 5 \r\n" " ORDER BY A.IFSC_ID \r\n" " ) \r\n" " WHERE DATA_SEQ >= :p01 AND DATA_SEQ < :p02 \r\n"; pADO->Close(); pADO->SQL->Text = sQry; pADO->Parameters->ParamByName("p01")->Value = seq*nFetchRows; pADO->Parameters->ParamByName("p02")->Value = (seq+1)*nFetchRows; pADO->Open(); //nRows = pADO->RecordCount; //cxProgressBar1->Properties->Max = nRows; String ID; String XAddr; String YAddr; nCnt = 0; for( ; !pADO->Eof; pADO->Next(), nCnt++) { ID = pADO->FieldByName("ID")->AsString; XAddr = pADO->FieldByName("X_CRDN_ARR")->AsString; YAddr = pADO->FieldByName("Y_CRDN_ARR")->AsString; fwprintf(fd, L"%s;%s;%s\n", ID.c_str(), XAddr.c_str(), YAddr.c_str()); //if ((nCnt % 50) == 0) UpdateProgress(nCnt); Application->ProcessMessages(); } } catch(Exception &exception) { throw Exception(String(exception.ClassName()) + exception.Message); return false; } } __finally { //UpdateProgress(nRows); if (fd) { fclose(fd); } pADO->Close(); } } return true; } //--------------------------------------------------------------------------- bool __fastcall TFrmUtilMain::MakeIfscVertexXml(TADOQuery *pADO) { if (DB_OPEN(&g_AppCfg.ifsc) == false) { return false; } AnsiString sFile = ExtractFilePath(Application->ExeName) + XML_DIR+ "IFSC.dat"; AnsiString sFileBackup = ExtractFilePath(Application->ExeName) + XML_DIR+ "IFSC_"+Now().FormatString("yyyymmddhhnnss")+".dat"; try { CopyFile(String(sFile).c_str(), String(sFileBackup).c_str(), true); //Á¸ÀçÇÏ¸é ¾÷¾î¾´´Ù } catch(Exception &e) { } FILE *fd = NULL; UpdateProgress(1, "Á¤º¸Á¦°ø±¸°£ ±¸°£ÁÂÇ¥ Á¤º¸ ÆÄÀÏ»ý¼º"); if ((fd = fopen(sFile.c_str(), "w")) == NULL) { Application->MessageBox(L"Á¤º¸Á¦°ø±¸°£ ±¸°£ÁÂÇ¥ Á¤º¸ ÆÄÀÏÀ» »ý¼ºÇÏÁö ¸øÇÏ¿´½À´Ï´Ù.", L"Á¤º¸Á¦°ø±¸°£ ±¸°£ÁÂÇ¥ Á¤º¸ ÆÄÀÏ»ý¼º", MB_OK|MB_ICONERROR|MB_APPLMODAL); return false; } int nRows= 0; int nCnt = 0; String sQry; try { try { //sQry = "SELECT A.IFSC_ID AS ID, A.X_CRDN_ARR, A.Y_CRDN_ARR \r\n" sQry = "SELECT A.IFSC_ID AS ID, \r\n" " SUBSTR(A.X_CRDN_ARR, 1, 200) AS XMSG01, \r\n" " SUBSTR(A.X_CRDN_ARR, 201, 200) AS XMSG02, \r\n" " SUBSTR(A.X_CRDN_ARR, 401, 200) AS XMSG03, \r\n" " SUBSTR(A.X_CRDN_ARR, 601, 200) AS XMSG04, \r\n" " SUBSTR(A.X_CRDN_ARR, 801, 200) AS XMSG05, \r\n" " SUBSTR(A.X_CRDN_ARR, 1001, 200) AS XMSG06, \r\n" " SUBSTR(A.X_CRDN_ARR, 1201, 200) AS XMSG07, \r\n" " SUBSTR(A.X_CRDN_ARR, 1401, 200) AS XMSG08, \r\n" " SUBSTR(A.X_CRDN_ARR, 1601, 200) AS XMSG09, \r\n" " SUBSTR(A.X_CRDN_ARR, 1801, 200) AS XMSG10, \r\n" " SUBSTR(A.X_CRDN_ARR, 2001, 200) AS XMSG11, \r\n" " SUBSTR(A.X_CRDN_ARR, 2201, 200) AS XMSG12, \r\n" " SUBSTR(A.X_CRDN_ARR, 2401, 200) AS XMSG13, \r\n" " SUBSTR(A.X_CRDN_ARR, 2601, 200) AS XMSG14, \r\n" " SUBSTR(A.X_CRDN_ARR, 2801, 200) AS XMSG15, \r\n" " SUBSTR(A.X_CRDN_ARR, 3001, 200) AS XMSG16, \r\n" " SUBSTR(A.X_CRDN_ARR, 3201, 200) AS XMSG17, \r\n" " SUBSTR(A.X_CRDN_ARR, 3401, 200) AS XMSG18, \r\n" " SUBSTR(A.X_CRDN_ARR, 3601, 200) AS XMSG19, \r\n" " SUBSTR(A.X_CRDN_ARR, 3801, 200) AS XMSG20, \r\n" " SUBSTR(A.X_CRDN_ARR, 4001, 200) AS XMSG21, \r\n" " SUBSTR(A.X_CRDN_ARR, 4201, 200) AS XMSG22, \r\n" " SUBSTR(A.X_CRDN_ARR, 4401, 200) AS XMSG23, \r\n" " SUBSTR(A.Y_CRDN_ARR, 1, 200) AS YMSG01, \r\n" " SUBSTR(A.Y_CRDN_ARR, 201, 200) AS YMSG02, \r\n" " SUBSTR(A.Y_CRDN_ARR, 401, 200) AS YMSG03, \r\n" " SUBSTR(A.Y_CRDN_ARR, 601, 200) AS YMSG04, \r\n" " SUBSTR(A.Y_CRDN_ARR, 801, 200) AS YMSG05, \r\n" " SUBSTR(A.Y_CRDN_ARR, 1001, 200) AS YMSG06, \r\n" " SUBSTR(A.Y_CRDN_ARR, 1201, 200) AS YMSG07, \r\n" " SUBSTR(A.Y_CRDN_ARR, 1401, 200) AS YMSG08, \r\n" " SUBSTR(A.Y_CRDN_ARR, 1601, 200) AS YMSG09, \r\n" " SUBSTR(A.Y_CRDN_ARR, 1801, 200) AS YMSG10, \r\n" " SUBSTR(A.Y_CRDN_ARR, 2001, 200) AS YMSG11, \r\n" " SUBSTR(A.Y_CRDN_ARR, 2201, 200) AS YMSG12, \r\n" " SUBSTR(A.Y_CRDN_ARR, 2401, 200) AS YMSG13, \r\n" " SUBSTR(A.Y_CRDN_ARR, 2601, 200) AS YMSG14, \r\n" " SUBSTR(A.Y_CRDN_ARR, 2801, 200) AS YMSG15, \r\n" " SUBSTR(A.Y_CRDN_ARR, 3001, 200) AS YMSG16, \r\n" " SUBSTR(A.Y_CRDN_ARR, 3201, 200) AS YMSG17, \r\n" " SUBSTR(A.Y_CRDN_ARR, 3401, 200) AS YMSG18, \r\n" " SUBSTR(A.Y_CRDN_ARR, 3601, 200) AS YMSG19, \r\n" " SUBSTR(A.Y_CRDN_ARR, 3801, 200) AS YMSG20, \r\n" " SUBSTR(A.Y_CRDN_ARR, 4001, 200) AS YMSG21, \r\n" " SUBSTR(A.Y_CRDN_ARR, 4201, 200) AS YMSG22, \r\n" " SUBSTR(A.Y_CRDN_ARR, 4401, 200) AS YMSG23 \r\n" " FROM TB_IFSC_VRTX_ARR A, \r\n" " TB_IFSC B \r\n" " WHERE B.DEL_YN = 'N' \r\n" " AND B.IFSC_ID = A.IFSC_ID \r\n" " AND A.LEVL = 5 \r\n"; pADO->Close(); pADO->SQL->Text = sQry; pADO->Open(); nRows = pADO->RecordCount; cxProgressBar1->Properties->Max = nRows; String ID; String XAddr; String YAddr; for( ; !pADO->Eof; pADO->Next(), nCnt++) { ID = pADO->FieldByName("ID")->AsString; //XAddr = pADO->FieldByName("X_CRDN_ARR")->AsWideString; //YAddr = pADO->FieldByName("Y_CRDN_ARR")->AsWideString; XAddr = ""; YAddr = ""; String sColNm; for (int ii = 1; ii < 24; ii++) { sColNm.printf(L"XMSG%02d", ii); XAddr += pADO->FieldByName(sColNm)->AsWideString; sColNm.printf(L"YMSG%02d", ii); YAddr += pADO->FieldByName(sColNm)->AsWideString; } fwprintf(fd, L"%s;%s;%s\n", ID.c_str(), XAddr.c_str(), YAddr.c_str()); if ((nCnt % 50) == 0) UpdateProgress(nCnt); } } catch(Exception &exception) { throw Exception(String(exception.ClassName()) + exception.Message); return false; } } __finally { UpdateProgress(nRows); if (fd) { fclose(fd); } pADO->Close(); DB_CLOSE(); } return true; } //--------------------------------------------------------------------------- bool __fastcall TFrmUtilMain::MakeRoadVertexXml(TADOQuery *pADO) { if (DB_OPEN(&g_AppCfg.road) == false) { return false; } AnsiString sFile = ExtractFilePath(Application->ExeName) + XML_DIR+ "ROAD.dat"; AnsiString sFileBackup = ExtractFilePath(Application->ExeName) + XML_DIR+ "ROAD_"+Now().FormatString("yyyymmddhhnnss")+".dat"; try { CopyFile(String(sFile).c_str(), String(sFileBackup).c_str(), true); //Á¸ÀçÇÏ¸é ¾÷¾î¾´´Ù } catch(Exception &e) { } FILE *fd = NULL; UpdateProgress(1, "µµ·Î ±¸°£ÁÂÇ¥ Á¤º¸ ÆÄÀÏ»ý¼º"); if ((fd = fopen(sFile.c_str(), "w")) == NULL) { Application->MessageBox(L"µµ·Î ±¸°£ÁÂÇ¥ Á¤º¸ ÆÄÀÏÀ» »ý¼ºÇÏÁö ¸øÇÏ¿´½À´Ï´Ù.", L"µµ·Î ±¸°£ÁÂÇ¥ Á¤º¸ ÆÄÀÏ»ý¼º", MB_OK|MB_ICONERROR|MB_APPLMODAL); return false; } int nRows= 0; int nCnt = 0; String sQry; try { try { //sQry = "SELECT A.ROAD_ID AS ID, A.X_CRDN_ARR, A.Y_CRDN_ARR \r\n" sQry = "SELECT A.ROAD_ID AS ID, \r\n" " SUBSTR(A.X_CRDN_ARR, 1, 200) AS XMSG01, \r\n" " SUBSTR(A.X_CRDN_ARR, 201, 200) AS XMSG02, \r\n" " SUBSTR(A.X_CRDN_ARR, 401, 200) AS XMSG03, \r\n" " SUBSTR(A.X_CRDN_ARR, 601, 200) AS XMSG04, \r\n" " SUBSTR(A.X_CRDN_ARR, 801, 200) AS XMSG05, \r\n" " SUBSTR(A.X_CRDN_ARR, 1001, 200) AS XMSG06, \r\n" " SUBSTR(A.X_CRDN_ARR, 1201, 200) AS XMSG07, \r\n" " SUBSTR(A.X_CRDN_ARR, 1401, 200) AS XMSG08, \r\n" " SUBSTR(A.X_CRDN_ARR, 1601, 200) AS XMSG09, \r\n" " SUBSTR(A.X_CRDN_ARR, 1801, 200) AS XMSG10, \r\n" " SUBSTR(A.X_CRDN_ARR, 2001, 200) AS XMSG11, \r\n" " SUBSTR(A.X_CRDN_ARR, 2201, 200) AS XMSG12, \r\n" " SUBSTR(A.X_CRDN_ARR, 2401, 200) AS XMSG13, \r\n" " SUBSTR(A.X_CRDN_ARR, 2601, 200) AS XMSG14, \r\n" " SUBSTR(A.X_CRDN_ARR, 2801, 200) AS XMSG15, \r\n" " SUBSTR(A.X_CRDN_ARR, 3001, 200) AS XMSG16, \r\n" " SUBSTR(A.X_CRDN_ARR, 3201, 200) AS XMSG17, \r\n" " SUBSTR(A.X_CRDN_ARR, 3401, 200) AS XMSG18, \r\n" " SUBSTR(A.X_CRDN_ARR, 3601, 200) AS XMSG19, \r\n" " SUBSTR(A.X_CRDN_ARR, 3801, 200) AS XMSG20, \r\n" " SUBSTR(A.X_CRDN_ARR, 4001, 200) AS XMSG21, \r\n" " SUBSTR(A.X_CRDN_ARR, 4201, 200) AS XMSG22, \r\n" " SUBSTR(A.X_CRDN_ARR, 4401, 200) AS XMSG23, \r\n" " SUBSTR(A.Y_CRDN_ARR, 1, 200) AS YMSG01, \r\n" " SUBSTR(A.Y_CRDN_ARR, 201, 200) AS YMSG02, \r\n" " SUBSTR(A.Y_CRDN_ARR, 401, 200) AS YMSG03, \r\n" " SUBSTR(A.Y_CRDN_ARR, 601, 200) AS YMSG04, \r\n" " SUBSTR(A.Y_CRDN_ARR, 801, 200) AS YMSG05, \r\n" " SUBSTR(A.Y_CRDN_ARR, 1001, 200) AS YMSG06, \r\n" " SUBSTR(A.Y_CRDN_ARR, 1201, 200) AS YMSG07, \r\n" " SUBSTR(A.Y_CRDN_ARR, 1401, 200) AS YMSG08, \r\n" " SUBSTR(A.Y_CRDN_ARR, 1601, 200) AS YMSG09, \r\n" " SUBSTR(A.Y_CRDN_ARR, 1801, 200) AS YMSG10, \r\n" " SUBSTR(A.Y_CRDN_ARR, 2001, 200) AS YMSG11, \r\n" " SUBSTR(A.Y_CRDN_ARR, 2201, 200) AS YMSG12, \r\n" " SUBSTR(A.Y_CRDN_ARR, 2401, 200) AS YMSG13, \r\n" " SUBSTR(A.Y_CRDN_ARR, 2601, 200) AS YMSG14, \r\n" " SUBSTR(A.Y_CRDN_ARR, 2801, 200) AS YMSG15, \r\n" " SUBSTR(A.Y_CRDN_ARR, 3001, 200) AS YMSG16, \r\n" " SUBSTR(A.Y_CRDN_ARR, 3201, 200) AS YMSG17, \r\n" " SUBSTR(A.Y_CRDN_ARR, 3401, 200) AS YMSG18, \r\n" " SUBSTR(A.Y_CRDN_ARR, 3601, 200) AS YMSG19, \r\n" " SUBSTR(A.Y_CRDN_ARR, 3801, 200) AS YMSG20, \r\n" " SUBSTR(A.Y_CRDN_ARR, 4001, 200) AS YMSG21, \r\n" " SUBSTR(A.Y_CRDN_ARR, 4201, 200) AS YMSG22, \r\n" " SUBSTR(A.Y_CRDN_ARR, 4401, 200) AS YMSG23 \r\n" " FROM TB_ROAD_VRTX_ARR A, \r\n" " TB_ROAD B \r\n" " WHERE B.DEL_YN = 'N' \r\n" " AND B.ROAD_ID = A.ROAD_ID \r\n" " AND A.LEVL = 7 \r\n"; pADO->Close(); pADO->SQL->Text = sQry; pADO->Open(); nRows = pADO->RecordCount; cxProgressBar1->Properties->Max = nRows; String ID; String XAddr; String YAddr; for( ; !pADO->Eof; pADO->Next(), nCnt++) { ID = pADO->FieldByName("ID")->AsString; //XAddr = pADO->FieldByName("X_CRDN_ARR")->AsWideString; //YAddr = pADO->FieldByName("Y_CRDN_ARR")->AsWideString; XAddr = ""; YAddr = ""; String sColNm; for (int ii = 1; ii < 24; ii++) { sColNm.printf(L"XMSG%02d", ii); XAddr += pADO->FieldByName(sColNm)->AsWideString; sColNm.printf(L"YMSG%02d", ii); YAddr += pADO->FieldByName(sColNm)->AsWideString; } fwprintf(fd, L"%s;%s;%s\n", ID.c_str(), XAddr.c_str(), YAddr.c_str()); if ((nCnt % 50) == 0) UpdateProgress(nCnt); } } catch(Exception &exception) { throw Exception(String(exception.ClassName()) + exception.Message); return false; } } __finally { UpdateProgress(nRows); if (fd) { fclose(fd); } pADO->Close(); DB_CLOSE(); } return true; } //--------------------------------------------------------------------------- bool __fastcall TFrmUtilMain::WriteXmlHead(FILE *AFd, bool AHead/*=true*/) { try { if (AFd == NULL) return false; if (AHead) { fprintf(AFd, "\n"); fprintf(AFd, "\n"); } else { fprintf(AFd, "\n"); } } catch(Exception &exception) { throw Exception(String(exception.ClassName()) + exception.Message); return false; } return true; } //--------------------------------------------------------------------------- bool __fastcall TFrmUtilMain::WriteXmlObject(FILE *AFd, String AObject) { try { if (AFd == NULL) return false; fwprintf(AFd, L"%s\n", AObject.c_str()); } catch(Exception &exception) { throw Exception(String(exception.ClassName()) + exception.Message); return false; } return true; } //--------------------------------------------------------------------------- bool __fastcall TFrmUtilMain::WriteXmlRecordCount(FILE *AFd, int ARows) { try { if (AFd == NULL) return false; fprintf(AFd, "%d\n", ARows); } catch(Exception &exception) { throw Exception(String(exception.ClassName()) + exception.Message); return false; } return true; } //--------------------------------------------------------------------------- bool __fastcall TFrmUtilMain::MakeNodeXml(TADOQuery *pADO) { AnsiString sFile = ExtractFilePath(Application->ExeName) + XML_DIR+ "Node.xml"; FILE *fd = NULL; UpdateProgress(1, "³ëµåÁ¤º¸ XML ÆÄÀÏ»ý¼º"); if ((fd = fopen(sFile.c_str(), "w")) == NULL) { Application->MessageBox(L"³ëµåÁ¤º¸ XML ÆÄÀÏÀ» »ý¼ºÇÏÁö ¸øÇÏ¿´½À´Ï´Ù.", L"³ëµåÁ¤º¸ XML ÆÄÀÏ»ý¼º", MB_OK|MB_ICONERROR|MB_APPLMODAL); return false; } WriteXmlHead(fd, true); WriteXmlObject(fd, "node"); int nRows= 0; int nCnt = 0; String sQry; try { try { sQry = "SELECT A.NODE_ID, A.NODE_TYPE, A.NODE_NAME, \r\n" " A.TURN_P, A.RMRK, A.X_CRDN, A.Y_CRDN \r\n" " FROM TB_NODE A \r\n" " ORDER BY A.NODE_ID \r\n"; pADO->Close(); pADO->SQL->Text = sQry; pADO->Open(); nRows = pADO->RecordCount; cxProgressBar1->Properties->Max = nRows; WriteXmlRecordCount(fd, nRows); for( ; !pADO->Eof; pADO->Next(), nCnt++) { String NODE_ID = pADO->FieldByName("NODE_ID")->AsString; //³ëµåID //String NODE_TYPE = pADO->FieldByName("NODE_TYPE")->AsString; //³ëµåÀ¯Çü String NODE_NAME = pADO->FieldByName("NODE_NAME")->AsString.Trim(); //±³Â÷·Î¸íĪ //String TURN_P = pADO->FieldByName("TURN_P")->AsString; //ȸÀüÁ¦ÇÑÀ¯¹« //String RMRK = pADO->FieldByName("RMRK")->AsString.Trim(); //ºñ°í String X_CRDN = pADO->FieldByName("X_CRDN")->AsString; //X ÁÂÇ¥ String Y_CRDN = pADO->FieldByName("Y_CRDN")->AsString; //Y ÁÂÇ¥ fwprintf(fd, L" "); fwprintf(fd, L"%s%s%s", NODE_ID.c_str(), X_CRDN.c_str(), Y_CRDN.c_str()); fprintf(fd, "%s", UTF8Encode(NODE_NAME).c_str()); fwprintf(fd, L"\n"); if ((nCnt % 50) == 0) UpdateProgress(nCnt); } } catch(Exception &exception) { throw Exception(String(exception.ClassName()) + exception.Message); return false; } } __finally { UpdateProgress(nRows); if (fd) { WriteXmlHead(fd, false); fclose(fd); } pADO->Close(); } return true; } //--------------------------------------------------------------------------- bool __fastcall TFrmUtilMain::MakeLinkXml(TADOQuery *pADO) { AnsiString sFile = ExtractFilePath(Application->ExeName) + XML_DIR+ "Link.xml"; FILE *fd = NULL; UpdateProgress(1, "¸µÅ©Á¤º¸ XML ÆÄÀÏ»ý¼º"); if ((fd = fopen(sFile.c_str(), "w")) == NULL) { Application->MessageBox(L"¸µÅ©Á¤º¸ XML ÆÄÀÏÀ» »ý¼ºÇÏÁö ¸øÇÏ¿´½À´Ï´Ù.", L"¸µÅ©Á¤º¸ XML ÆÄÀÏ»ý¼º", MB_OK|MB_ICONERROR|MB_APPLMODAL); return false; } WriteXmlHead(fd); WriteXmlObject(fd, "link"); int nRows= 0; int nCnt = 0; String sQry; try { try { sQry = "SELECT A.LINK_ID, A.F_NODE, A.T_NODE, TRIM(A.ROAD_NAME) ROAD_NAME, \r\n" " NVL(B.NODE_NAME, '') F_NAME, NVL(C.NODE_NAME, '') T_NAME, \r\n" " A.ROAD_USE, A.LANES, A.ROAD_RANK, TRIM(A.ROAD_TYPE) AS ROAD_TYPE, A.ROAD_NO, \r\n" " A.MAX_SPD, A.LINK_LENG, A.DEL_YN, DECODE(A.AREA_CD, 'LAT001', 'Y', 'N') REGN_YN \r\n" " FROM TB_LINK A, TB_NODE B, TB_NODE C \r\n" " WHERE A.F_NODE = B.NODE_ID(+) \r\n" " AND A.T_NODE = C.NODE_ID(+) \r\n" " ORDER BY LINK_ID \r\n"; pADO->Close(); pADO->SQL->Text = sQry; pADO->Open(); nRows = pADO->RecordCount; cxProgressBar1->Properties->Max = nRows; WriteXmlRecordCount(fd, nRows); for( ; !pADO->Eof; pADO->Next(), nCnt++) { String LINK_ID = pADO->FieldByName("LINK_ID")->AsString; //'¸µÅ©ID';; String F_NODEID = pADO->FieldByName("F_NODE")->AsString; //'½ÃÀÛ³ëµåID';; String T_NODEID = pADO->FieldByName("T_NODE")->AsString; //'Á¾·á³ëµåID';; String ROAD_NAME = pADO->FieldByName("ROAD_NAME")->AsString.Trim(); //'µµ·Î¸í';; String F_NAME = pADO->FieldByName("F_NAME")->AsString; //'½ÃÀÛ³ëµå';; String T_NAME = pADO->FieldByName("T_NAME")->AsString; //'Á¾·á³ëµå';; String ROAD_USE = pADO->FieldByName("ROAD_USE")->AsString; //'µµ·Î»ç¿ë¿©ºÎ';; String LANES = pADO->FieldByName("LANES")->AsString; //'Â÷·Î¼ö';; String ROAD_RANK = pADO->FieldByName("ROAD_RANK")->AsString; //'µµ·Îµî±Þ';; String ROAD_TYPE = pADO->FieldByName("ROAD_TYPE")->AsString; //'µµ·ÎÀ¯Çü';; String ROAD_NO = pADO->FieldByName("ROAD_NO")->AsString; //'µµ·Î¹øÈ£';; String MAX_SPD = pADO->FieldByName("MAX_SPD")->AsString; //'ÃÖ°íÁ¦ÇѼӵµ';; String LINK_LENG = pADO->FieldByName("LINK_LENG")->AsString; //'¿¬Àå';; String DEL_YN = pADO->FieldByName("DEL_YN")->AsString; //'»èÁ¦ ¿©ºÎ';; String REGN_YN = pADO->FieldByName("REGN_YN")->AsString; //'·ÎÄÃÁö¿ª¿©ºÎ'; fwprintf(fd, L" "); fwprintf(fd, L"%s%s%s%s%s\n", LINK_ID.c_str(), F_NODEID.c_str(), T_NODEID.c_str(), ROAD_RANK.c_str(), LINK_LENG.c_str()); fprintf(fd, " %s%s%s", UTF8Encode(ROAD_NAME).c_str(), UTF8Encode(F_NAME).c_str(), UTF8Encode(T_NAME).c_str()); fwprintf(fd, L"\n"); if ((nCnt % 50) == 0) UpdateProgress(nCnt); } } catch(Exception &exception) { throw Exception(String(exception.ClassName()) + exception.Message); return false; } } __finally { UpdateProgress(nRows); if (fd) { WriteXmlHead(fd, false); fclose(fd); } pADO->Close(); } return true; } //--------------------------------------------------------------------------- bool __fastcall TFrmUtilMain::MakeIfscXml(TADOQuery *pADO) { AnsiString sFile = ExtractFilePath(Application->ExeName) + XML_DIR+ "Ifsc.xml"; FILE *fd = NULL; UpdateProgress(1, "Á¤º¸Á¦°ø±¸°£ XML ÆÄÀÏ»ý¼º"); if ((fd = fopen(sFile.c_str(), "w")) == NULL) { Application->MessageBox(L"Á¤º¸Á¦°ø±¸°£ XML ÆÄÀÏÀ» »ý¼ºÇÏÁö ¸øÇÏ¿´½À´Ï´Ù.", L"Á¤º¸Á¦°ø±¸°£ XML ÆÄÀÏ»ý¼º", MB_OK|MB_ICONERROR|MB_APPLMODAL); return false; } WriteXmlHead(fd); WriteXmlObject(fd, "ifsc"); int nRows= 0; int nCnt = 0; String sQry; try { try { sQry = "SELECT IFSC_ID, IFSC_NM, DRCT_CD, STRT_NM, END_NM, SECT_LNGT, \r\n" " EXTR_CNCT_SECT_YN, DEL_YN, RMRK, F_NODE_ID, T_NODE_ID, \r\n" " SECT_GRAD_CD, AREA_CD, DECODE(AREA_CD, 'LAT001', 'Y', 'N') REGN_YN \r\n" " FROM TB_IFSC \r\n" " ORDER BY IFSC_ID \r\n"; pADO->Close(); pADO->SQL->Text = sQry; pADO->Open(); nRows = pADO->RecordCount; cxProgressBar1->Properties->Max = nRows; WriteXmlRecordCount(fd, nRows); for( ; !pADO->Eof; pADO->Next(), nCnt++) { String IFSC_ID = pADO->FieldByName("IFSC_ID")->AsString; String IFSC_NM = pADO->FieldByName("IFSC_NM")->AsString.Trim(); String DRCT_CD = pADO->FieldByName("DRCT_CD")->AsString; //String RMRK = pADO->FieldByName("RMRK")->AsString.Trim(); //String EXTR_CNCT_SECT_YN = pADO->FieldByName("EXTR_CNCT_SECT_YN")->AsString; //String DEL_YN = pADO->FieldByName("DEL_YN")->AsString; String SECT_LNGT = pADO->FieldByName("SECT_LNGT")->AsString; //String SECT_GRAD_CD = pADO->FieldByName("SECT_GRAD_CD")->AsString; String F_NODE_ID = pADO->FieldByName("F_NODE_ID")->AsString; String T_NODE_ID = pADO->FieldByName("T_NODE_ID")->AsString; String STRT_NM = pADO->FieldByName("STRT_NM")->AsString.Trim(); String END_NM = pADO->FieldByName("END_NM")->AsString.Trim(); //String REGN_YN = pADO->FieldByName("REGN_YN")->AsString; //String AREA_CD = pADO->FieldByName("AREA_CD")->AsString; fwprintf(fd, L" "); fwprintf(fd, L"%s%s%s%s%s\n", IFSC_ID.c_str(), F_NODE_ID.c_str(), T_NODE_ID.c_str(), DRCT_CD.c_str(), SECT_LNGT.c_str()); fprintf(fd, " %s%s%s", UTF8Encode(IFSC_NM).c_str(), UTF8Encode(STRT_NM).c_str(), UTF8Encode(END_NM).c_str()); fwprintf(fd, L"\n"); if ((nCnt % 50) == 0) UpdateProgress(nCnt); } } catch(Exception &exception) { throw Exception(String(exception.ClassName()) + exception.Message); return false; } } __finally { UpdateProgress(nRows); if (fd) { WriteXmlHead(fd, false); fclose(fd); } pADO->Close(); } return true; } //--------------------------------------------------------------------------- bool __fastcall TFrmUtilMain::MakeRoadXml(TADOQuery *pADO) { AnsiString sFile = ExtractFilePath(Application->ExeName) + XML_DIR+ "Road.xml"; FILE *fd = NULL; UpdateProgress(1, "µµ·ÎÁ¤º¸ XML ÆÄÀÏ»ý¼º"); if ((fd = fopen(sFile.c_str(), "w")) == NULL) { Application->MessageBox(L"µµ·ÎÁ¤º¸ XML ÆÄÀÏÀ» »ý¼ºÇÏÁö ¸øÇÏ¿´½À´Ï´Ù.", L"µµ·ÎÁ¤º¸ XML ÆÄÀÏ»ý¼º", MB_OK|MB_ICONERROR|MB_APPLMODAL); return false; } WriteXmlHead(fd); WriteXmlObject(fd, "road"); int nRows= 0; int nCnt = 0; String sQry; try { try { sQry = "SELECT ROAD_ID, ROAD_NAME, DRCT_CD, STRT_NM, END_NM, \r\n" " DEL_YN, SECT_LNGT, F_NODE_ID, T_NODE_ID, \r\n" " SECT_GRAD_CD, AREA_CD, \r\n" " DECODE(AREA_CD, 'LAT001', 'Y', 'N') REGN_YN \r\n" " FROM TB_ROAD \r\n" //" WHERE DEL_YN = 'N' \r\n" " ORDER BY ROAD_ID \r\n"; pADO->Close(); pADO->SQL->Text = sQry; pADO->Open(); nRows = pADO->RecordCount; cxProgressBar1->Properties->Max = nRows; WriteXmlRecordCount(fd, nRows); for( ; !pADO->Eof; pADO->Next(), nCnt++) { String ROAD_ID = pADO->FieldByName("ROAD_ID")->AsString; String ROAD_NAME = pADO->FieldByName("ROAD_NAME")->AsString.Trim(); String DRCT_CD = pADO->FieldByName("DRCT_CD")->AsString; String STRT_NM = pADO->FieldByName("STRT_NM")->AsString.Trim(); String END_NM = pADO->FieldByName("END_NM")->AsString.Trim(); //String DEL_YN = pADO->FieldByName("DEL_YN")->AsString; String SECT_LNGT = pADO->FieldByName("SECT_LNGT")->AsString; String F_NODE_ID = pADO->FieldByName("F_NODE_ID")->AsString; String T_NODE_ID = pADO->FieldByName("T_NODE_ID")->AsString; //String SECT_GRAD_CD = pADO->FieldByName("SECT_GRAD_CD")->AsString; //String AREA_CD = pADO->FieldByName("AREA_CD")->AsString; //String REGN_YN = pADO->FieldByName("REGN_YN")->AsString; fwprintf(fd, L" "); fwprintf(fd, L"%s%s%s%s%s\n", ROAD_ID.c_str(), F_NODE_ID.c_str(), T_NODE_ID.c_str(), DRCT_CD.c_str(), SECT_LNGT.c_str()); fprintf(fd, " %s%s%s", UTF8Encode(ROAD_NAME).c_str(), UTF8Encode(STRT_NM).c_str(), UTF8Encode(END_NM).c_str()); fwprintf(fd, L"\n"); if ((nCnt % 50) == 0) UpdateProgress(nCnt); } } catch(Exception &exception) { throw Exception(String(exception.ClassName()) + exception.Message); return false; } } __finally { UpdateProgress(nRows); if (fd) { WriteXmlHead(fd, false); fclose(fd); } pADO->Close(); } return true; } //--------------------------------------------------------------------------- bool __fastcall TFrmUtilMain::MakeRegionVertexXml(TADOQuery *pADO) { AnsiString sFile = ExtractFilePath(Application->ExeName) + XML_DIR+ "RegionVertex.xml"; FILE *fd = NULL; UpdateProgress(1, "ÇàÁ¤±¸¿ª Vertex XML ÆÄÀÏ»ý¼º"); if ((fd = fopen(sFile.c_str(), "w")) == NULL) { Application->MessageBox(L"ÇàÁ¤±¸¿ª Vertex Á¤º¸ ÆÄÀÏÀ» »ý¼ºÇÏÁö ¸øÇÏ¿´½À´Ï´Ù.", L"ÇàÁ¤±¸¿ª Vertex Á¤º¸ XML ÆÄÀÏ»ý¼º", MB_OK|MB_ICONERROR|MB_APPLMODAL); return false; } WriteXmlHead(fd); WriteXmlObject(fd, "region_vertex"); int nRows= 0; int nCnt = 0; String sQry; try { try { sQry = "SELECT CONFIGSEQ AS ORD, COORDX AS X_CRDN, COORDY AS Y_CRDN \r\n" " FROM LINK_SUBSECTION \r\n" " WHERE SUBSECTIONKIND = 'B' \r\n" " AND DISPLAYLEVEL = 1 \r\n" " ORDER BY CONFIGSEQ \r\n"; pADO->Close(); pADO->SQL->Text = sQry; pADO->Open(); nRows = pADO->RecordCount; cxProgressBar1->Properties->Max = nRows; WriteXmlRecordCount(fd, nRows); String sPosX = ""; String sPosY = ""; String sMinXY = ""; String sMaxXY = ""; int nOrd, nOrdCnt; nOrd = 1; for( ; !pADO->Eof; pADO->Next(), nCnt++) { sPosX += pADO->FieldByName("X_CRDN")->AsString; sPosY += pADO->FieldByName("Y_CRDN")->AsString; sPosX = sPosX.SubString(1, sPosX.Length()-1); sPosY = sPosY.SubString(1, sPosY.Length()-1); fwprintf(fd, L" %d%s%s\n", nOrd++, sPosX.c_str(), sPosY.c_str()); sPosX = ""; sPosY = ""; if ((nCnt % 20) == 0) UpdateProgress(nCnt); } } catch(Exception &exception) { throw Exception(String(exception.ClassName()) + exception.Message); return false; } } __finally { UpdateProgress(nRows); if (fd) { WriteXmlHead(fd, false); fclose(fd); } pADO->Close(); } return true; } //---------------------------------------------------------------------------