//---------------------------------------------------------------------------

#include <vcl.h>
#include <OleCtrls.hpp>
#include "ITSSkinF.h"
#include "ITSUtilF.h"
//#include "CDSVmsTrafficF.h"
#include "CDSIncidentF.h"
#include "CDSIfsc_VMSF.h"
#include "CDSVmsIfscF.h"
#include "VmsCommInfoF.h"
#include "FrmResourceF.h"
#include "ITSLangTransF.h"
#pragma hdrstop

//#define IPictureDisp    Axvlc_tlb::IPictureDisp

#include "VMS0000MF.h"
#include "FrmVmsOprMainF.h"
#include "FrmVmsMsgF.h"
#include "CommFlashF.h"
#include "VMS00MAPF.h"

#include "FrmVmsCamF.h"
#include "FrmIcsCamF.h"

//---------------------------------------------------------------------------
#pragma package(smart_init)
#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 "cxMaskEdit"
#pragma link "cxProgressBar"
#pragma link "cxSpinEdit"
#pragma link "cxTextEdit"
#pragma link "dxGDIPlusClasses"
#pragma link "dxSkinBlack"
#pragma link "dxSkinBlue"
#pragma link "dxSkinCaramel"
#pragma link "dxSkinCoffee"
#pragma link "dxSkinDarkRoom"
#pragma link "dxSkinDarkSide"
#pragma link "dxSkinFoggy"
#pragma link "dxSkinGlassOceans"
#pragma link "dxSkiniMaginary"
#pragma link "dxSkinLilian"
#pragma link "dxSkinLiquidSky"
#pragma link "dxSkinLondonLiquidSky"
#pragma link "dxSkinMcSkin"
#pragma link "dxSkinMoneyTwins"
#pragma link "dxSkinOffice2007Black"
#pragma link "dxSkinOffice2007Blue"
#pragma link "dxSkinOffice2007Green"
#pragma link "dxSkinOffice2007Pink"
#pragma link "dxSkinOffice2007Silver"
#pragma link "dxSkinOffice2010Black"
#pragma link "dxSkinOffice2010Blue"
#pragma link "dxSkinOffice2010Silver"
#pragma link "dxSkinsCore"
#pragma link "dxSkinSeven"
#pragma link "dxSkinSharp"
#pragma link "dxSkinSilver"
#pragma link "dxSkinStardust"
#pragma link "ShockwaveEx"
#pragma link "ShockwaveFlashObjects_TLB"
#pragma resource "*.dfm"

//---------------------------------------------------------------------------
TVMS00MAP *VMS00MAP = NULL;

//---------------------------------------------------------------------------
__fastcall TVMS00MAP::TVMS00MAP(TComponent* Owner, TForm *ParentForm)
    : TForm(Owner)
{
    ::CoInitialize(NULL);

    LangTrans->Translate(this, ITSDb_GetConnection());
    ITSSkin_Load(this);
    LoadLocalSkin();

    ShockwaveFlash1->Align = alClient;

    panRemark->Visible = false;
    
    m_nMapLevel = 1;
    
	//마우스 제어 플래그 초기화
    m_bMouseDown  = false;
    m_bMoveCenter = false;
    m_bCalcMode   = false;
    m_bCalcCont   = false;
	m_ptDown.x = m_ptDown.y = 0;

    MapInit    = false;
    MapStart   = false;
    ModeSelect = false;
}
//---------------------------------------------------------------------------

void __fastcall TVMS00MAP::LoadMap()
{
    try {
        ShockwaveFlash1->Stop();
        String sFileName = g_AppCfg.flashmap.sMainMap;
        ShockwaveFlash1->Movie = sFileName;
        ShockwaveFlash1->Play();

        MapInit = true;
    } catch(...) {}
}
//---------------------------------------------------------------------------

void __fastcall TVMS00MAP::FormDestroy(TObject *Sender)
{
    try
    {
    }
    catch (...)
    {
    }

    ::CoUninitialize();
}
//---------------------------------------------------------------------------

void __fastcall TVMS00MAP::FormShow(TObject *Sender)
{
    Refresh();
    FormInit();
    Application->ProcessMessages();
    TmrShow->Enabled = true;
}
//---------------------------------------------------------------------------

void __fastcall TVMS00MAP::CommClose()
{
    //VMS00MAP = NULL;
    //::CoUninitialize();
}
//---------------------------------------------------------------------------

bool __fastcall TVMS00MAP::FormInit()
{
    memset((char*)&m_PrevExt, 0x00, sizeof(m_PrevExt));
    memset((char*)&m_ExtQ,    0x00, sizeof(m_ExtQ));
    m_ExtQ.bExtent = true;
    m_ExtQ.userIdx = 0;
    m_ExtQ.currIdx = 0;

    return true;
}
//---------------------------------------------------------------------------

void __fastcall TVMS00MAP::LoadLocalSkin()
{
    //PnlMenu->ParentColor = false;
    //PnlMenu->Color = 0x00FF9D62;
    PnlTrf00->ParentColor = false;
    PnlTrf00->Color = clSilver;
    PnlTrf01->ParentColor = false;
    PnlTrf01->Color = clLime;
    PnlTrf02->ParentColor = false;
    PnlTrf02->Color = clYellow;
    PnlTrf03->ParentColor = false;
    PnlTrf03->Color = clRed;

    Pnl00->ParentColor = false;
    Pnl00->Color = clSilver;
    Pnl01->ParentColor = false;
    Pnl01->Color = clLime;
    Pnl02->ParentColor = false;
    Pnl02->Color = clYellow;
    Pnl03->ParentColor = false;
    Pnl03->Color = clRed;

    /*
    *  GIS Command button skin
    */
    TImage *pImgZoomIn_n;
    TImage *pImgZoomIn_c;
    TImage *pImgCenter_n;
    TImage *pImgCenter_c;
    TImage *pImgPrev_c;
    TImage *pImgPrev_n;
    TImage *pImgSel_n;
    TImage *pImgSel_c;
    TImage *pImgDist_n;
    TImage *pImgCircle_c;
    TImage *pImgCircle_n;
    TImage *pImgDist_c;
    TImage *pImgStnd_n;
    TImage *pImgSave_c;
    TImage *pImgSave_n;
    TImage *pImgStnd_c;
    TImage *pImgZoomOut_n;
    TImage *pImgZoomOut_c;
    TImage *pImgPan_c;
    TImage *pImgPan_n;
    TImage *pImgNext_n;
    TImage *pImgNext_c;
    TImage *pImgBoundary_c;
    TImage *pImgBoundary_n;
    TImage *pImgSquare_n;
    TImage *pImgSquare_c;
    TImage *pImgFull_c;
    TImage *pImgFull_n;
    TImage *pImgRefresh_n;
    TImage *pImgRefresh_c;
    TImage *pImgPrint_c;
    TImage *pImgPrint_n;

    int nSkin = 1;
	switch (nSkin)
	{
    case 10:
        pImgZoomIn_n = ImgZoomIn_c;
        pImgZoomIn_c = ImgZoomIn_n;
        pImgZoomOut_n = ImgZoomOut_c;
        pImgZoomOut_c = ImgZoomOut_n;
        pImgCenter_n = ImgCenter_c;
        pImgCenter_c = ImgCenter_n;
        pImgPan_c = ImgPan_n;
        pImgPan_n = ImgPan_c;
        pImgPrev_c = ImgPrev_n;
        pImgPrev_n = ImgPrev_c;
        pImgNext_n = ImgNext_c;
        pImgNext_c = ImgNext_n;
        pImgBoundary_c = ImgBoundary_n;
        pImgBoundary_n = ImgBoundary_c;
        pImgSel_n = ImgSel_c;
        pImgSel_c = ImgSel_n;
        pImgDist_n = ImgDist_c;
        pImgDist_c = ImgDist_n;
        pImgSquare_n = ImgSquare_c;
        pImgSquare_c = ImgSquare_n;
        pImgCircle_c = ImgCircle_n;
        pImgCircle_n = ImgCircle_c;
        pImgFull_c = ImgFull_n;
        pImgFull_n = ImgFull_c;
        pImgStnd_n = ImgStnd_c;
        pImgStnd_c = ImgStnd_n;
        pImgRefresh_n = ImgRefresh_c;
        pImgRefresh_c = ImgRefresh_n;
        pImgPrint_c = ImgPrint_n;
        pImgPrint_n = ImgPrint_c;
        pImgSave_c = ImgSave_n;
        pImgSave_n = ImgSave_c;
        break;
	case 1: case 2: case 3: case 0:
	case 4: case 5: default:
        pImgZoomIn_n = ImgZoomIn_n;
        pImgZoomIn_c = ImgZoomIn_c;
        pImgZoomOut_n = ImgZoomOut_n;
        pImgZoomOut_c = ImgZoomOut_c;
        pImgCenter_n = ImgCenter_n;
        pImgCenter_c = ImgCenter_c;
        pImgPan_c = ImgPan_c;
        pImgPan_n = ImgPan_n;
        pImgPrev_c = ImgPrev_c;
        pImgPrev_n = ImgPrev_n;
        pImgNext_n = ImgNext_n;
        pImgNext_c = ImgNext_c;
        pImgBoundary_c = ImgBoundary_c;
        pImgBoundary_n = ImgBoundary_n;
        pImgSel_n = ImgSel_n;
        pImgSel_c = ImgSel_c;
        pImgDist_n = ImgDist_n;
        pImgDist_c = ImgDist_c;
        pImgSquare_n = ImgSquare_n;
        pImgSquare_c = ImgSquare_c;
        pImgCircle_c = ImgCircle_c;
        pImgCircle_n = ImgCircle_n;
        pImgFull_c = ImgFull_c;
        pImgFull_n = ImgFull_n;
        pImgStnd_n = ImgStnd_n;
        pImgStnd_c = ImgStnd_c;
        pImgRefresh_n = ImgRefresh_n;
        pImgRefresh_c = ImgRefresh_c;
        pImgPrint_c = ImgPrint_c;
        pImgPrint_n = ImgPrint_n;
        pImgSave_c = ImgSave_c;
        pImgSave_n = ImgSave_n;
        break;
    }

    try
    {
        ImgZoomIn->NormalPicture->Assign(pImgZoomIn_n->Picture);
        ImgZoomIn->Picture->Assign(pImgZoomIn_n->Picture);
        ImgZoomIn->TogglePicture->Assign(pImgZoomIn_c->Picture);
        ImgZoomIn->ClickedPicture->Assign(pImgZoomIn_n->Picture);
        ImgZoomOut->NormalPicture->Assign(pImgZoomOut_n->Picture);
        ImgZoomOut->Picture->Assign(pImgZoomOut_n->Picture);
        ImgZoomOut->TogglePicture->Assign(pImgZoomOut_c->Picture);
        ImgZoomOut->ClickedPicture->Assign(pImgZoomOut_n->Picture);
        ImgCenter->NormalPicture->Assign(pImgCenter_n->Picture);
        ImgCenter->Picture->Assign(pImgCenter_n->Picture);
        ImgCenter->TogglePicture->Assign(pImgCenter_c->Picture);
        ImgCenter->ClickedPicture->Assign(pImgCenter_n->Picture);

#if 0
        ImgPan->NormalPicture->Assign(pImgPan_n->Picture);
        ImgPan->Picture->Assign(pImgPan_n->Picture);
        ImgPan->TogglePicture->Assign(pImgPan_c->Picture);
        ImgPan->ClickedPicture->Assign(pImgPan_n->Picture);
#else
        ImgPan->NormalPicture->Assign(pImgPan_c->Picture);
        ImgPan->Picture->Assign(pImgPan_c->Picture);
        ImgPan->TogglePicture->Assign(pImgPan_n->Picture);
        ImgPan->ClickedPicture->Assign(pImgPan_n->Picture);
#endif
        ImgPrev->NormalPicture->Assign(pImgPrev_n->Picture);
        ImgPrev->Picture->Assign(pImgPrev_n->Picture);
        ImgPrev->TogglePicture->Assign(pImgPrev_c->Picture);
        ImgPrev->ClickedPicture->Assign(pImgPrev_n->Picture);
        
        ImgNext->NormalPicture->Assign(pImgNext_n->Picture);
        ImgNext->Picture->Assign(pImgNext_n->Picture);
        ImgNext->TogglePicture->Assign(pImgNext_c->Picture);
        ImgNext->ClickedPicture->Assign(pImgNext_n->Picture);

        ImgPrev->Cursor = crHandPoint;
        ImgNext->Cursor = crHandPoint;

        ImgBoundary->NormalPicture->Assign(pImgBoundary_n->Picture);
        ImgBoundary->Picture->Assign(pImgBoundary_n->Picture);
        ImgBoundary->TogglePicture->Assign(pImgBoundary_c->Picture);
        ImgBoundary->ClickedPicture->Assign(pImgBoundary_n->Picture);
        ImgSel->NormalPicture->Assign(pImgSel_n->Picture);
        ImgSel->Picture->Assign(pImgSel_n->Picture);
        ImgSel->TogglePicture->Assign(pImgSel_c->Picture);
        ImgSel->ClickedPicture->Assign(ImgSel_c->Picture);
        ImgDist->NormalPicture->Assign(pImgDist_n->Picture);
        ImgDist->Picture->Assign(pImgDist_n->Picture);
        ImgDist->TogglePicture->Assign(pImgDist_c->Picture);
        ImgDist->ClickedPicture->Assign(pImgDist_n->Picture);
        ImgSquare->NormalPicture->Assign(pImgSquare_n->Picture);
        ImgSquare->Picture->Assign(pImgSquare_n->Picture);
        ImgSquare->TogglePicture->Assign(pImgSquare_c->Picture);
        ImgSquare->ClickedPicture->Assign(pImgSquare_n->Picture);
        ImgCircle->NormalPicture->Assign(pImgCircle_n->Picture);
        ImgCircle->Picture->Assign(pImgCircle_n->Picture);
        ImgCircle->TogglePicture->Assign(pImgCircle_c->Picture);
        ImgCircle->ClickedPicture->Assign(pImgCircle_n->Picture);
        ImgFull->NormalPicture->Assign(pImgFull_n->Picture);
        ImgFull->Picture->Assign(pImgFull_n->Picture);
        ImgFull->TogglePicture->Assign(pImgFull_c->Picture);
        ImgFull->ClickedPicture->Assign(pImgFull_n->Picture);
        ImgStnd->NormalPicture->Assign(pImgStnd_n->Picture);
        ImgStnd->Picture->Assign(pImgStnd_n->Picture);
        ImgStnd->TogglePicture->Assign(pImgStnd_c->Picture);
        ImgStnd->ClickedPicture->Assign(pImgStnd_n->Picture);
        ImgRefresh->NormalPicture->Assign(pImgRefresh_n->Picture);
        ImgRefresh->Picture->Assign(pImgRefresh_n->Picture);
        ImgRefresh->TogglePicture->Assign(pImgRefresh_c->Picture);
        ImgRefresh->ClickedPicture->Assign(pImgRefresh_n->Picture);
        ImgPrint->NormalPicture->Assign(pImgPrint_n->Picture);
        ImgPrint->Picture->Assign(pImgPrint_n->Picture);
        ImgPrint->TogglePicture->Assign(pImgPrint_c->Picture);
        ImgPrint->ClickedPicture->Assign(pImgPrint_n->Picture);
        ImgSave->NormalPicture->Assign(pImgSave_n->Picture);
        ImgSave->Picture->Assign(pImgSave_n->Picture);
        ImgSave->TogglePicture->Assign(pImgSave_c->Picture);
        ImgSave->ClickedPicture->Assign(pImgSave_n->Picture);
    }
    catch(...)
    {
    }
}
//---------------------------------------------------------------------------

void __fastcall TVMS00MAP::TmrShowTimer(TObject *Sender)
{
    TmrShow->Enabled = false;
    Application->ProcessMessages();
    LoadGisMap();
}
//---------------------------------------------------------------------------

/*
 * 지도데이터 로드 및 프로그램 초기화 작업 수행
 *  arguments
 *
 *  return
 *
 */
void __fastcall TVMS00MAP::LoadGisMap()
{
    try
    {
        try
        {
            // 지도로딩 상태바 표출
            PnlProgress->Left = (this->Width  - PnlProgress->Width)  / 2;
            PnlProgress->Top  = (this->Height - PnlProgress->Height) / 2;
            PnlProgress->Top -= 50;
            PnlProgress->Visible = true;

            PbLoadMap->Properties->Text = "지도 표출색상 정보 로딩 중...";
            Application->ProcessMessages();
            PbLoadMap->Position = 50;

            TUTISLinkGrade UtisLinkColor;
            PbLoadMap->Position = 100;
            PbLoadMap->Properties->Text = "지도 로딩 중...";
            Application->ProcessMessages();

            // start server
            LoadMap();

            pmuControlGisClick((TObject*)pmuMove);  // 전자지도 마우스이벤트를 이동으로 설정
        }
        catch (...)
        {
        }
    }
    __finally
    {
        //PnlProgress->Visible = false;
    }
}
//---------------------------------------------------------------------------

void __fastcall TVMS00MAP::GisMenuCheckClear()
{
	pmuZoomIn->Checked  = false;
	pmuZoomOut->Checked = false;
	pmuMove->Checked    = false;
	pmuIconSel->Checked = false;
	pmuCalLen->Checked = false;
	pmuCalArea->Checked = false;
	pmuRadius->Checked = false;
    pmuMoveCenter->Checked = false;
    pmuGisDefault->Checked = false;
}
//---------------------------------------------------------------------------

void __fastcall TVMS00MAP::pmuControlGisClick(TObject *Sender)
{
    TMenuItem *pMenu = (TMenuItem*)Sender;
    
    SetMapOperation((TXiMapOperation)pMenu->Tag);    
}
//---------------------------------------------------------------------------

/*
 * 지도제어 설정
 *  arguments
 *
 *  return
 *
 */
void __fastcall TVMS00MAP::SetMapOperation(TXiMapOperation nMapOper)
{
//enum TXiMapOperation { Nothing, OnZoomIn, OnZoomOut, OnPanSt, OnDistance, OnSelect, OnGeoQuery, OnEditting, OnCircle, OnShortPath, OnArea, OnInsert, OnFindEvent, OnNearFind, OnUserDefine };

    if (!MapStart) return;

	GisMenuCheckClear();

    m_bMoveCenter = false;
    m_bCalcMode   = false;
    m_bCalcCont   = false;

    if (OnSelect == nMapOper)
    {
        GrpPos->Visible = true;
    }
    else
    {
        GrpPos->Visible = false;
    }
    
    switch(nMapOper)
    {
    case OnPanSt: //pan
        TCommFlash::CallFunc(ShockwaveFlash1, "SelectMode", "0");
        ShockwaveFlash1->Cursor = crDefault;//Drag;
        ModeSelect = false;

        try
        {
            ImgPan->NormalPicture->Assign(ImgPan_c->Picture);
            ImgPan->Picture->Assign(ImgPan_c->Picture);
            ImgPan->TogglePicture->Assign(ImgPan_n->Picture);
            ImgPan->ClickedPicture->Assign(ImgPan_n->Picture);

            ImgSel->NormalPicture->Assign(ImgSel_n->Picture);
            ImgSel->Picture->Assign(ImgSel_n->Picture);
            ImgSel->TogglePicture->Assign(ImgSel_c->Picture);
            ImgSel->ClickedPicture->Assign(ImgSel_c->Picture);
        } catch(Exception &e) {}

        break;
    case OnZoomIn: //zoomin
        TCommFlash::CallFunc(ShockwaveFlash1, "ZoomIn", "");
        break;
    case OnZoomOut: //zoomout
        TCommFlash::CallFunc(ShockwaveFlash1, "ZoomOut", "");
        break;
    case OnSelect: //select
        TCommFlash::CallFunc(ShockwaveFlash1, "SelectMode", "1");
        ShockwaveFlash1->Cursor = crHelp;
        ModeSelect = true;

        try
        {
            ImgPan->NormalPicture->Assign(ImgPan_n->Picture);
            ImgPan->Picture->Assign(ImgPan_n->Picture);
            ImgPan->TogglePicture->Assign(ImgPan_c->Picture);
            ImgPan->ClickedPicture->Assign(ImgPan_n->Picture);

            ImgSel->NormalPicture->Assign(ImgSel_c->Picture);
            ImgSel->Picture->Assign(ImgSel_c->Picture);
            ImgSel->TogglePicture->Assign(ImgSel_n->Picture);
            ImgSel->ClickedPicture->Assign(ImgSel_n->Picture);
        } catch(Exception &e) {}

        break;
    }
}
//---------------------------------------------------------------------------

void __fastcall TVMS00MAP::SetExtent(TDDRect &curRc)
{
}
//---------------------------------------------------------------------------

/*
 * 지도 영역 이동 함수. 현재 영역을 영역이동 큐에 추가한다.
 * 다음 버튼을 비활성 시킨다.
 *  arguments
 *  return
 *      void
 */
bool __fastcall TVMS00MAP::AddExtentQ(TDDRect &curRc)
{
    TDDRect *pExt = &m_ExtQ.extent[m_ExtQ.userIdx];
    memcpy((char*)pExt, (char*)&curRc, sizeof(curRc));

    if (m_PrevExt.MinX == pExt->MinX &&
        m_PrevExt.MinY == pExt->MinY &&
        m_PrevExt.MaxX == pExt->MaxX &&
        m_PrevExt.MaxY == pExt->MaxY)
    {
        return false;
    }

    memcpy((char*)&m_PrevExt, pExt, sizeof(m_PrevExt));

    if (m_ExtQ.userIdx >= D_EXT_QUEUE_SIZE)
    {
        m_ExtQ.userIdx = D_EXT_QUEUE_SIZE;

        memcpy((char *)&m_ExtQ.extent[0], (char *)&m_ExtQ.extent[1], sizeof(TDDRect)*D_EXT_QUEUE_SIZE);
    }
    else
    {
        m_ExtQ.userIdx++;
    }

    m_ExtQ.currIdx = m_ExtQ.userIdx-1;

    return true;
}
//---------------------------------------------------------------------------

bool __fastcall TVMS00MAP::PrevExtentQ()
{
    m_ExtQ.bExtent = false;

    if (m_ExtQ.currIdx <= 0)
    {
        m_ExtQ.currIdx = 0;
        return false;
    }

    m_ExtQ.currIdx--;

    TDDRect *pExt = &m_ExtQ.extent[m_ExtQ.currIdx];

    SetExtent(*pExt);

    return true;
}
//---------------------------------------------------------------------------

bool __fastcall TVMS00MAP::NextExtentQ()
{
    m_ExtQ.bExtent = false;

    if (m_ExtQ.currIdx >= m_ExtQ.userIdx-1)
    {
        m_ExtQ.currIdx = m_ExtQ.userIdx-1;
        return false;
    }

    m_ExtQ.currIdx++;

    TDDRect *pExt = &m_ExtQ.extent[m_ExtQ.currIdx];

    SetExtent(*pExt);

    return true;
}
//---------------------------------------------------------------------------

void __fastcall TVMS00MAP::ImgPrevClick(TObject *Sender)
{
    PrevExtentQ();    
}
//---------------------------------------------------------------------------

void __fastcall TVMS00MAP::ImgNextClick(TObject *Sender)
{
    NextExtentQ();    
}
//---------------------------------------------------------------------------

void __fastcall TVMS00MAP::ImgStndClick(TObject *Sender)
{
    if (MapStart)
    {
        TCommFlash::CallFunc(ShockwaveFlash1, "StdExtent", "");
    }
}
//---------------------------------------------------------------------------

void __fastcall TVMS00MAP::ImgRefreshClick(TObject *Sender)
{
    if (MapStart)
    {
        FrmVmsOprMain->FPollTraffic.Reset();    // 정보제공구간소통정보
        FrmVmsOprMain->FPollVmsMsg.Reset();     // VMS Message

        FrmVmsOprMain->FPollPrcsState.Reset(); // 프로세스상태정보
        FrmVmsOprMain->FPollVmsState.Reset();  // VMS상태정보
        FrmVmsOprMain->FPollIncident.Reset();  // 돌발정보

        ImgRefresh->Enabled = false;
        TmrRefresh->Enabled = true;
    }
}
//---------------------------------------------------------------------------

void __fastcall TVMS00MAP::TmrRefreshTimer(TObject *Sender)
{
    TmrRefresh->Enabled = false;
    ImgRefresh->Enabled = true;
}
//---------------------------------------------------------------------------

void __fastcall TVMS00MAP::ChkTrafficLayerClick(TObject *Sender)
{
    if (!MapStart) return;

    String sTraffic = ChkTrafficLayer->Checked ? "1" : "0";
    String sTooltip = ChkToolTip->Checked ?      "1" : "0";

    TCommFlash::CallFunc(ShockwaveFlash1, "ShowTraffic", sTraffic + "|" + sTooltip);
    ShockwaveFlash1->SetFocus();
}
//---------------------------------------------------------------------------

void __fastcall TVMS00MAP::TmrSelectTimer(TObject *Sender)
{
    TmrSelect->Enabled = false;
    ImgSelect->Visible = false;
}
//---------------------------------------------------------------------------

void __fastcall TVMS00MAP::SelectObjectByPos(double dPosX, double dPosY, bool bArrow/*=false*/)
{
    m_ptSelect.X = dPosX;
    m_ptSelect.Y = dPosY;
    if (!MapStart) return;
    TCommFlash::CallFunc(ShockwaveFlash1, "SelectPoint", String(dPosX) + "," + String(dPosY) + "|3");
    ShockwaveFlash1->SetFocus();
}
//---------------------------------------------------------------------------

bool __fastcall TVMS00MAP::SelectLinkById(int ALinkLevel, String sId, bool bHide/*=false*/)
{
    try
    {
        if (!MapStart) return false;
        TCommFlash::CallFunc(ShockwaveFlash1, "FindLink", sId);
    }
    catch(...)
    {
    }

    return true;
}
//---------------------------------------------------------------------------

void __fastcall TVMS00MAP::TmrLinkSelectTimer(TObject *Sender)
{
    TmrLinkSelect->Enabled = false;
}
//---------------------------------------------------------------------------

void __fastcall TVMS00MAP::MnuMoveStdAreaClick(TObject *Sender)
{
    ImgStndClick((TObject*)ImgStnd);
}
//---------------------------------------------------------------------------

void __fastcall TVMS00MAP::RefreshMapTraffic()
{
    try {
        TmrRefresh->Enabled = false;
        ImgRefresh->Enabled = true;
    } catch(...) {}

    if (!MapStart) return;

    //LblTraffic->Visible = true;
    //TmrLblTraffic->Enabled = true;

    String sObjList = "";

    IfscManager->FLists.Lock();
    try
    {
        try
        {
            FOR_STL(TIfsc*, pTraffic, IfscManager->FLists)
            {
                if (pTraffic->CMTR_GRAD_CD == "0") continue;

                sObjList += "2," +
                            pTraffic->IFSC_ID         + "," +
                            pTraffic->CMTR_GRAD_CD    + "," +
                            String(pTraffic->SPED)    + "," +
                            String(pTraffic->TRVL_HH) + "|";
            }
        }
        catch(Exception &exception)
        {
            throw Exception(String(exception.ClassName()) + exception.Message);
        }
    }
    __finally
    {
        IfscManager->FLists.UnLock();
        if (sObjList != "")
        {
            sObjList = sObjList.SubString(1, sObjList.Length()-1);
            TCommFlash::CallFunc(ShockwaveFlash1, "UpdateTraffic", sObjList);
        }
    }

    TCommFlash::CallFunc(ShockwaveFlash1, "RefreshMap", "");

#if 0
    try
    {
        if (FrmLinkInfo)
        {
            FrmLinkInfo->RefreshLinkInfo();
        }
    }
    catch(...)
    {
    }
#endif
}
//---------------------------------------------------------------------------

void __fastcall TVMS00MAP::ChkDrawGisClick(TObject *Sender)
{
    ShowHideFacility();
    ShockwaveFlash1->SetFocus();
}
//---------------------------------------------------------------------------

void __fastcall TVMS00MAP::ShowLinkDetailInfo(String sLinkId, int nLinkLevel)
{
#if 0
    try
    {
        if (FrmLinkInfo == NULL)
        {
            FrmLinkInfo = new TFrmLinkInfo(Application);
        }
        FrmLinkInfo->Show();
        FrmLinkInfo->ShowLinkInfo(sLinkId, nLinkLevel);
    }
    catch(...)
    {
    }
#endif
}
//---------------------------------------------------------------------------

void __fastcall TVMS00MAP::ChkGisSearchClick(TObject *Sender)
{
#if 0
    try
    {
        if (ChkGisSearch->Checked)
        {
            if (FrmGisSearch == NULL)
            {
                FrmGisSearch = new TFrmGisSearch(this);
                //FrmGisSearch->Parent = this;
            }
            FrmGisSearch->Show();
        }
        else
        {
            if (FrmGisSearch)
            {
                if (FrmGisSearch->m_bClose == false)
                {
                    FrmGisSearch->Close();
                }
            }
        }
    }
    catch(...)
    {
    }
#endif
}
//---------------------------------------------------------------------------

void __fastcall TVMS00MAP::FormClose(TObject *Sender, TCloseAction &Action)
{
    CommClose();
    //VMS00MAP = NULL;
    Action = caFree;    
}
//---------------------------------------------------------------------------

void __fastcall TVMS00MAP::panRemarkMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y)
{
    TcxGroupBox *pGroup = (TcxGroupBox*)Sender;
	ReleaseCapture();
	pGroup->Perform(WM_SYSCOMMAND, 0xf012, 0);
}
//---------------------------------------------------------------------------

void __fastcall TVMS00MAP::ChkViewExamplePropertiesChange(TObject *Sender)
{
    panRemark->Visible = ChkViewExample->Checked;
}
//---------------------------------------------------------------------------

void __fastcall TVMS00MAP::UpdateFacilityStatus()
{
    String sFacility;
    String sShowIcon;
    String sShowInfo;
    String sObjList;

    sObjList = "";

    VmsCtlrManager->FLists.Lock();
    try
    {
        FOR_STL(TVmsCtlr*, pObj, VmsCtlrManager->FLists)
        {
            if (pObj->DEL_YN == "Y") continue;

            String sLoc = TCommFlash::ReplaceName(pObj->VMS_NM);
            String sSubType = "P";//pObj->VMS_USAG_TYPE_CD == "VUTN" ? "T" : "P";
            String sStatus  = pObj->RunState;//pObj->STATE.Comm;

            sObjList += (pObj->VMS_CTLR_ID + "," + sStatus + "," + sLoc + "," + pObj->X_CRDN + "," + pObj->Y_CRDN + "," + pObj->VMS_CTLR_ID + "," + sSubType +  "|");
        }
    }
    __finally
    {
        VmsCtlrManager->FLists.UnLock();

        sFacility = FAC_VMS;
        sShowIcon = ChkDrawVms->Checked ? "1" : "0";
        sShowInfo = "0";
        TCommFlash::CallFunc(ShockwaveFlash1, "RemoveFacility", sFacility);
        if (sObjList != "")
        {
            sObjList = sObjList.SubString(1, sObjList.Length()-1);
            TCommFlash::CallFunc(ShockwaveFlash1, "AddFacility", sFacility + "|" + sShowIcon + "|" + sShowInfo + "|" + sObjList);
        }
    }

    //시설물 재설정 후 시설물 정보만 다시 그리도록 한다.
    //TCommFlash::CallFunc(ShockwaveFlash1, "RefreshMap", "");
}
//---------------------------------------------------------------------------

void __fastcall TVMS00MAP::UpdateIncidentStatus()
{
static String sStatusMsg[6] = { "", "사고", "공사", "행사", "기상", "기타", };

    if (!MapStart) return;

    if (!ItsIncidentManager) return;

    String sFacility;
    String sShowIcon;
    String sShowInfo;
    String sObjList;

    int nStatus = 0;

    sObjList = "";

    ItsIncidentManager->FLists.Lock();
    try
    {
        FOR_STL(TItsIncident *, pObj, ItsIncidentManager->FLists)
        {
            if (pObj->DISP_INCD == "N") continue;
            if (pObj->INCD_PRGR_STEP_CD == "ISS2")
            {
                nStatus = pObj->INCD_TYPE_CLSF_CD.ToIntDef(1);
                if (nStatus > 4 || nStatus < 1) nStatus = 1;

                //돌발유형이 사고,기상인 경우는 돌발종료시각을 표출하지 않도록 함. 돌발유형이 공사,행사인 경우만 돌발종료시각 표출함

                //String sTitle = "▶▶돌발 정보◀◀|돌발 ID : " + pObj->INCD_OCRR_ID + "|제목 : " + pObj->INCD_TITL + "|유형 : " + sStatusMsg[nStatus];
                //sTitle += "|돌발등록시각: " + ITSUtil_StrToTime(pObj->RGST_DT) + "|돌발시작시각: " + ITSUtil_StrToTime(pObj->FINCD_STRT_DT);

                String sTitle = TCommFlash::ReplaceName(pObj->INCD_TITL);
                String sInfo = pObj->INCD_OCRR_ID + "$" + sTitle + "$" + sStatusMsg[nStatus];
                sInfo += "$" + ITSUtil_StrToTime(pObj->RGST_DT) + "$" + ITSUtil_StrToTime(pObj->INCD_STRT_DT);

                if (nStatus == 1 || nStatus == 2)
                {
                    sInfo += "$" + ITSUtil_StrToTime(pObj->INCD_END_PRAR_DT); //돌발종료시각
                }
                else sInfo+= "$-";

                sObjList += (pObj->INCD_OCRR_ID + "," + String(nStatus) + "," + sTitle + "," + pObj->X_CRDN + "," + pObj->Y_CRDN + "," + sInfo + "|");
            }
        }
    }
    __finally
    {
        ItsIncidentManager->FLists.UnLock();

        sFacility = FAC_INCD;
        sShowIcon = ChkDrawIncident->Checked ? "1" : "0";
        sShowInfo = "0";
        TCommFlash::CallFunc(ShockwaveFlash1, "RemoveFacility", sFacility);
        if (sObjList != "")
        {
            sObjList = sObjList.SubString(1, sObjList.Length()-1);
            TCommFlash::CallFunc(ShockwaveFlash1, "AddFacility", sFacility + "|" + sShowIcon + "|" + sShowInfo + "|" + sObjList);
        }
    }

    //TCommFlash::CallFunc(ShockwaveFlash1, "RefreshMap", "");
}
//---------------------------------------------------------------------------

void __fastcall TVMS00MAP::pmuFacilityPopup(TObject *Sender)
{
    String sLoc = " ";

    TPopupMenu *pMenu = (TPopupMenu*)Sender;
    if (pMenu->Tag == 1)
    {
        TVmsCtlr *pObj = FindVms(FSelId);
        if (pObj)
        {
            sLoc = TCommFlash::ReplaceName(pObj->VMS_NM);
        }
        else
        {
            sLoc = FSelId;
        }
        //MnuVmsId->Caption = "[VMS] " + FSelId + " " + sLoc;
        MnuVmsId->Caption = "[VMS] " + sLoc;
    }
}
//---------------------------------------------------------------------------

void __fastcall TVMS00MAP::mnuFacilityPingClick(TObject *Sender)
{
    TMenuItem *pMenu = (TMenuItem*)Sender;

    String sIp = "";
    Application->ProcessMessages();

    if (pMenu->Tag >= 21 && 22 >= pMenu->Tag)
    {
        TVmsCtlr *pObj = FindVms(FSelId);
        if (pObj)
        {
            switch(pMenu->Tag)
            {
            case 22: sIp = pObj->WEB_CMRA_IP.Trim(); break;
            case 21:
            default: sIp = pObj->VMS_CTLR_IP.Trim(); break;
            }
        }
    }
    if (sIp != "")
    {
        ITSUtil_NetworkPing(sIp);
    }
}
//---------------------------------------------------------------------------

void __fastcall TVMS00MAP::mnuVmsMsgClick(TObject *Sender)
{
    Application->ProcessMessages();
    TPoint pt;
    GetCursorPos(&pt);
    pt = VMS0000M->ScreenToClient(pt);
    ShowVmsMessage(FSelId, pt);
}
//---------------------------------------------------------------------------

void __fastcall TVMS00MAP::mnuVmsCamClick(TObject *Sender)
{
    Application->ProcessMessages();
    TPoint pt;
    GetCursorPos(&pt);
    pt = VMS0000M->ScreenToClient(pt);
    ShowVmsCamera(FSelId, pt);
}
//---------------------------------------------------------------------------

void __fastcall TVMS00MAP::ShowVmsMessage(String AId, TPoint pt)
{
    TVmsCtlr *pObj = FindVms(AId);
    if (!pObj) return;

    try {
        if (pObj->FData1)
        {
            TFrmVmsMsg *pForm = (TFrmVmsMsg *)pObj->FData1;
            pForm->SetFocus();
        }
        else
        {
            TFrmVmsMsg *pForm = new TFrmVmsMsg(VMS0000M, pObj);
            pForm->Parent = VMS0000M;

            int nHG = pForm->ClientHeight - pForm->PnlVmsMsgDisp->Height;
            int nWG = pForm->ClientWidth  - pForm->PnlVmsMsgDisp->Width;

#if 0
            pForm->ClientHeight = nHG + pObj->Height;
            pForm->ClientWidth  = nWG + pObj->Width;
#endif

            if ((pt.x + pForm->Width + 5) > this->Width)
            {
                pt.x = this->Width - pForm->Width - 5;
            }
            if ((pt.y + pForm->Height + 5) > this->Height)
            {
                pt.y = this->Height - pForm->Height - 5;
            }

            pForm->Left = Left + pt.x;
            pForm->Top  = Top  + pt.y;

            pObj->FData1 = (void*)pForm;
            pForm->Show();
        }
    } catch(...) {}
}
//---------------------------------------------------------------------------

void __fastcall TVMS00MAP::ShowVmsCamera(String AId, TPoint pt)
{
    TVmsCtlr *pObj = FindVms(FSelId);
    if (!pObj) return;

    try {
        if (pObj->FData2)
        {
            if (pObj->STRM_SESN_NM.Trim() == "icsview")
            {
                TFrmIcsCam *pForm = (TFrmIcsCam *)pObj->FData2;
                pForm->SetFocus();
                //pForm->RefreshVms();
            }
            else
            {
                TFrmVmsCam *pForm = (TFrmVmsCam *)pObj->FData2;
                pForm->SetFocus();
                //pForm->RefreshVms();
            }
        }
        else
        {
            if (pObj->STRM_SESN_NM.Trim() == "icsview")
            {
                TFrmIcsCam *pForm = new TFrmIcsCam(VMS0000M);
                pForm->Parent = VMS0000M;

                if ((pt.x + pForm->Width + 5) > this->Width)
                {
                    pt.x = this->Width - pForm->Width - 5;
                }
                if ((pt.y + pForm->Height + 5) > this->Height)
                {
                    pt.y = this->Height - pForm->Height - 5;
                }

                pForm->Left = Left + pt.x;
                pForm->Top  = Top  + pt.y;

                pForm->FObj = pObj;
                pObj->FData2 = (void*)pForm;
                pForm->Show();
            }
            else
            {
                TFrmVmsCam *pForm = new TFrmVmsCam(VMS0000M);
                pForm->Parent = VMS0000M;

                if ((pt.x + pForm->Width + 5) > this->Width)
                {
                    pt.x = this->Width - pForm->Width - 5;
                }
                if ((pt.y + pForm->Height + 5) > this->Height)
                {
                    pt.y = this->Height - pForm->Height - 5;
                }

                pForm->Left = Left + pt.x;
                pForm->Top  = Top  + pt.y;

                pForm->FObj = pObj;
                pObj->FData2 = (void*)pForm;
                pForm->Show();
            }
        }
    } catch(...) {}
}
//---------------------------------------------------------------------------

void __fastcall TVMS00MAP::RefreshGisLink()
{
    SelectLinkById(g_SelLink.Level, g_SelLink.Id, true);
}
//---------------------------------------------------------------------------

void __fastcall TVMS00MAP::TmrLblTrafficTimer(TObject *Sender)
{
    TmrLblTraffic->Enabled = false;
    LblTraffic->Visible = false;
}
//---------------------------------------------------------------------------

void __fastcall TVMS00MAP::FormResize(TObject *Sender)
{
    ShockwaveFlash1->Align = alClient;
}
//---------------------------------------------------------------------------

void __fastcall TVMS00MAP::ShowHideFacility()
{
    if (!MapStart) return;

    String sFacility;
    String sShowIcon;
    String sShowInfo;

    sFacility = FAC_VMS;
    sShowIcon = ChkDrawVms->Checked ? "1" : "0";
    sShowInfo = "0";
    TCommFlash::CallFunc(ShockwaveFlash1, "ShowFacility", sFacility + "|" + sShowIcon + "|" + sShowInfo);
}
//---------------------------------------------------------------------------

void __fastcall TVMS00MAP::ShockwaveFlash1FlashCall(TObject *ASender, const WideString request)
{
    try
    {
        String sTemp;
        String sFunc;
        String sArgs;

        //<invoke name="Debug" returntype="xml"><arguments><string>KKK|LinkMap 1</string></arguments></invoke>
        sTemp = request;

        int nFuncStrIdx = sTemp.Pos("\"");
        int nFuncEndIdx = sTemp.Pos("\" returntype");
        int nArgsStrIdx = sTemp.Pos("string>");
        int nArgsEndIdx = sTemp.Pos("</string");

        sFunc = sTemp.SubString(nFuncStrIdx + 1, nFuncEndIdx - (nFuncStrIdx + 1));
        sArgs = sTemp.SubString(nArgsStrIdx + 7, nArgsEndIdx - (nArgsStrIdx + 7));

#if 0
        if (Memo1->Visible)
        {
            Memo1->Lines->Add("[" + sFunc + "]  [" + sArgs + "]");
        }
#endif

        if (sFunc == "OnMapStart")
        {
            MapStart = true;

            LblZoomLevel->Caption = sArgs;

            TCommFlash::CallFunc(ShockwaveFlash1, "SetDrawMode", "vms");

            TCommFlash::CallFunc(ShockwaveFlash1, "MultiSelect", "0");

            String sFacility = "";
            sFacility += FAC_CCTV + "|";
            sFacility += FAC_VMS  + "|";
            sFacility += FAC_RSE  + "|";
            sFacility += FAC_WCAM + "|";
            sFacility += FAC_VDS  + "|";
            sFacility += FAC_AVI  + "|";
            sFacility += FAC_DSRC + "|";
            sFacility += FAC_INCD + "|";

            TCommFlash::CallFunc(ShockwaveFlash1, "AddFacilityKind", sFacility);

            ChkTrafficLayerClick(NULL); //소통정보/힌트표출여부

            PbLoadMap->Position = 20;
            PbLoadMap->Properties->Text = "링크정보 로딩 중...";
            Application->ProcessMessages();

            //TCommFlash::CallFunc(ShockwaveFlash1, "LoadNode", "1");
            TCommFlash::CallFunc(ShockwaveFlash1, "LoadLink", "2");
        }
        else
        if (sFunc == "OnZoomChanged")
        {
            TStringList *pStringList = new TStringList;
            pStringList->CommaText = sArgs;

            String sZoom = pStringList->Strings[0];

            delete pStringList;
            LblZoomLevel->Caption = sZoom;

            //ALL IFSC==level2
			switch(sZoom.ToIntDef(0))
			{
			case  1: m_nMapLevel = 2; break;	//LINK
			case  2: m_nMapLevel = 2; break;   //IFSC
			case  3: m_nMapLevel = 2; break;	//IFSC
			case  4: m_nMapLevel = 2; break;	//IFSC
			case  5: m_nMapLevel = 2; break;	//ROAD
			default: m_nMapLevel = 2; break;	//ROAD
			}
    		LblLinkLevel->Caption = String(m_nMapLevel);
        }
        else
        if (sFunc == "OnMousePos")
        {
            TStringList *pStringList = new TStringList;
            pStringList->CommaText = sArgs;

            String sMapX = pStringList->Strings[0]; //lat
            String sMapY = pStringList->Strings[1]; //lng

            delete pStringList;
            try {
                SePosX->Value = sMapX.ToDouble();
                SePosY->Value = sMapY.ToDouble();
            } catch(...) {}
        }
        else
        if (sFunc == "OnNodeLoad")
        {
            PbLoadMap->Position = 30;
            PbLoadMap->Properties->Text = "정보제공구간정보 로딩 중...";
            Application->ProcessMessages();

            TCommFlash::CallFunc(ShockwaveFlash1, "LoadLink", "2");
        }
        else
        if (sFunc == "OnLinkLoad")
        {
            TStringList *pStringList = new TStringList;
            pStringList->CommaText = sArgs;

            String sResult = pStringList->Strings[0];
            String sLevel  = pStringList->Strings[1];

            delete pStringList;

            //레벨2 정보만 로딩한다.
            if (sLevel == "2")
            {
                PbLoadMap->Position = 50;
                PbLoadMap->Properties->Text = "정보제공구간버텍스정보 로딩 중...";
                Application->ProcessMessages();

                TCommFlash::CallFunc(ShockwaveFlash1, "LoadLinkVertex", "4");
            }
        }
        else
        if (sFunc == "OnLinkVertexLoad")
        {
            TStringList *pStringList = new TStringList;
            pStringList->CommaText = sArgs;

            String sResult = pStringList->Strings[0];
            String sLevel  = pStringList->Strings[1];

            delete pStringList;

            if (sLevel == "4")
            {
                PbLoadMap->Position = 90;
                PbLoadMap->Properties->Text = "시설물정보 로딩 중...";
                Application->ProcessMessages();

                UpdateFacilityStatus(); //시설물 추가
                UpdateIncidentStatus(); //돌발추가
                RefreshMapTraffic();    //소통정보 업데이트

                PnlProgress->Visible = false;
            }
        }
        else
        if (sFunc == "OnFindLink")
        {
            TStringList *pStringList = new TStringList;
            pStringList->CommaText = sArgs;

            String sResult = pStringList->Strings[0];   //Find resule
            String sLinkId = pStringList->Strings[1];   //Link Id

            delete pStringList;
        }
        else
        if (sFunc == "OnSelLink")
        {
            TStringList *pStringList = new TStringList;
            pStringList->CommaText = sArgs;

            String sLevl = pStringList->Strings[0]; //링크레벨
            String sId   = pStringList->Strings[1]; //링크아이디
            String sZoom = pStringList->Strings[2]; //줌레벨
            String sPosX = pStringList->Strings[3]; //x
            String sPosY = pStringList->Strings[4]; //y
            String sMapX = pStringList->Strings[5]; //lat
            String sMapY = pStringList->Strings[6]; //lng

            delete pStringList;

            try {
                SePosX->Value = sMapX.ToDouble();
                SePosY->Value = sMapY.ToDouble();

                ShowLinkDetailInfo(sId, sLevl.ToIntDef(1));
            } catch(...) {}
        }
        else
        if (sFunc == "OnMousePouup")
        {
            TStringList *pStringList = new TStringList;
            pStringList->CommaText = sArgs;

            String sType = pStringList->Strings[0]; //유형
            String sId   = pStringList->Strings[1]; //아이디
            String sPosX = pStringList->Strings[2]; //x
            String sPosY = pStringList->Strings[3]; //y
            String sInfo = pStringList->Strings[4]; //정보

            delete pStringList;

            //if (ModeSelect)
            {
                OnMapPopupMenu(sType, sId, sPosX, sPosY, sInfo);
            }
        }
        else
        if (sFunc == "OnFacilityMenu")
        {
            TStringList *pStringList = new TStringList;
            pStringList->CommaText = sArgs;

            String sType = pStringList->Strings[0]; //시설물유형
            String sId   = pStringList->Strings[1]; //시설물아이디
            String sPosX = pStringList->Strings[2]; //x
            String sPosY = pStringList->Strings[3]; //y

            delete pStringList;
            //Memo1->Lines->Add(sType + "  :  " + sId + "  " + sPosX + " : " + sPosY);

            FSelId = sId;
            POINT p;
            GetCursorPos(&p);

            if (sType == "VMS")
            {
                pmuVms->Popup(p.x, p.y);
            }
        }
    }
    catch(Exception &exception)
    {
    }
}
//---------------------------------------------------------------------------

void __fastcall TVMS00MAP::OnMapPopupMenu(String AType, String AId, String APosX, String APosY, String AInfo)
{
    FSelId = AId;

    POINT p;
    GetCursorPos(&p);

    if (AType == "VMS")
    {
        pmuVms->Popup(p.x, p.y);
    }
}
//---------------------------------------------------------------------------

void __fastcall TVMS00MAP::SelGisItem(int AType, String AId)
{
    try
    {
        if (!MapStart) return;

        switch(AType)
        {
        case 0: TCommFlash::CallFunc(ShockwaveFlash1, "MoveNode", AId); break;
        case 1: TCommFlash::CallFunc(ShockwaveFlash1, "FindLink", AId); break;
        case 2: TCommFlash::CallFunc(ShockwaveFlash1, "FindLink", AId); break;
        case 3: TCommFlash::CallFunc(ShockwaveFlash1, "FindLink", AId); break;
        default: return;
        }
    }
    catch(...)
    {
    }
}
//---------------------------------------------------------------------------

void __fastcall TVMS00MAP::PnlToolBarDblClick(TObject *Sender)
{
    Memo1->Visible = !Memo1->Visible;
}
//---------------------------------------------------------------------------

void __fastcall TVMS00MAP::mnuVmsIfscClick(TObject *Sender)
{
    Application->ProcessMessages();
    TPoint pt;
    GetCursorPos(&pt);
    pt = VMS0000M->ScreenToClient(pt);
    //ShowVmsMessage(FSelId, pt);

    if (ChkViewAllIfsc->Visible == false)
    {
        ChkViewAllIfsc->Visible = true;
    }
    ChkViewAllIfsc->Checked = false;

    TCommFlash::CallFunc(ShockwaveFlash1, "SetDrawLink", "0");

    TVmsCtlr *pObj = FindVms(FSelId);
    if (!pObj) return;

    String sObjList = "";

    FOR_STL(TVmsIfscRltn *, pTmp, pObj->FIfscRltn)
    {
        TVmsIfsc *pIfsc = VmsIfscManager->FLists.Find(pTmp->VMS_IFSC_ID);
        if (!pIfsc) return;

        FOR_STL(TVmsLinkIfsc *, pIfscLink, pIfsc->FLists)
        {
            sObjList += pIfscLink->IFSC_ID + "|";
        }
    }
    if (sObjList != "")
    {
        sObjList = sObjList.SubString(1, sObjList.Length()-1);
        TCommFlash::CallFunc(ShockwaveFlash1, "DrawVmsLink", sObjList);
    }

    TCommFlash::CallFunc(ShockwaveFlash1, "RefreshMap", "");
}
//---------------------------------------------------------------------------

void __fastcall TVMS00MAP::ChkViewAllIfscClick(TObject *Sender)
{
    if (ChkViewAllIfsc->Checked)
    {
        ChkViewAllIfsc->Visible = false;

        TCommFlash::CallFunc(ShockwaveFlash1, "SetDrawLink", "1");
        TCommFlash::CallFunc(ShockwaveFlash1, "RefreshMap", "");
    }
    else
    {
        //여기는 들어올 수 없다.
    }
}
//---------------------------------------------------------------------------

void __fastcall TVMS00MAP::Memo1DblClick(TObject *Sender)
{
    Memo1->Visible = false;
}
//---------------------------------------------------------------------------

