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

#ifndef ITS00GEOFH
#define ITS00GEOFH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <DB.hpp>
#include <DBClient.hpp>
#include <Provider.hpp>
#include <ADODB.hpp>
#include <ExtCtrls.hpp>
#include <Graphics.hpp>
#include <ImgList.hpp>
#include <Menus.hpp>
#include <pngimage.hpp>
#include <map.h>
#include <vector.h>
#include "ImageBtn.h"
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
#include "DataTypesF.h"
#include "WindowMsgF.h"
#include "cxCheckBox.hpp"
#include "cxContainer.hpp"
#include "cxControls.hpp"
#include "cxEdit.hpp"
#include "cxGraphics.hpp"
#include "cxGroupBox.hpp"
#include "cxLabel.hpp"
#include "cxLookAndFeelPainters.hpp"
#include "cxLookAndFeels.hpp"
#include "cxMaskEdit.hpp"
#include "cxProgressBar.hpp"
#include "cxSpinEdit.hpp"
#include "cxTextEdit.hpp"
#include "dxGDIPlusClasses.hpp"
#include "dxSkinBlack.hpp"
#include "dxSkinBlue.hpp"
#include "dxSkinCaramel.hpp"
#include "dxSkinCoffee.hpp"
#include "dxSkinDarkRoom.hpp"
#include "dxSkinDarkSide.hpp"
#include "dxSkinFoggy.hpp"
#include "dxSkinGlassOceans.hpp"
#include "dxSkiniMaginary.hpp"
#include "dxSkinLilian.hpp"
#include "dxSkinLiquidSky.hpp"
#include "dxSkinLondonLiquidSky.hpp"
#include "dxSkinMcSkin.hpp"
#include "dxSkinMoneyTwins.hpp"
#include "dxSkinOffice2007Black.hpp"
#include "dxSkinOffice2007Blue.hpp"
#include "dxSkinOffice2007Green.hpp"
#include "dxSkinOffice2007Pink.hpp"
#include "dxSkinOffice2007Silver.hpp"
#include "dxSkinOffice2010Black.hpp"
#include "dxSkinOffice2010Blue.hpp"
#include "dxSkinOffice2010Silver.hpp"
#include "dxSkinsCore.hpp"
#include "dxSkinSeven.hpp"
#include "dxSkinSharp.hpp"
#include "dxSkinSilver.hpp"
#include "dxSkinStardust.hpp"
#include <OleCtrls.hpp>
#include <SHDocVw.hpp>
#include "GMClasses.hpp"
#include "GMMap.hpp"
#include "GMMapVCL.hpp"
#include "GMLinkedComponents.hpp"
#include "GMRectangle.hpp"
#include "GMRectangleVCL.hpp"
#include <AppEvnts.hpp>
#include "GMGeoCode.hpp"

//---------------------------------------------------------------------------
/*
******************************************************************************
* Define constant
******************************************************************************
*/
/*
*  소통정보 레이어 최대갯수
*/
#define MAX_LAYERS              7

/*
*  이전/다음 구현을 위한 구조체 선언(정적 이중링크로 구현)
*/
#define D_EXT_QUEUE_SIZE        256 //512//1024/2048
#define D_EXT_QUEUE_MASK        (D_EXT_QUEUE_SIZE-1)

/*
*  레이어 Extent 정보
*/
typedef struct
{
    bool    bExtent;
    short   userIdx;
    short   currIdx;
    //TDDRect extent[D_EXT_QUEUE_SIZE+1];
} EXTENT_LIST_QUEUE;

//---------------------------------------------------------------------------
class TITS00GEO : public TForm
{
__published:	// IDE-managed Components
    TImageList *ImgGis;
    TTimer *TmrShow;
    TPanel *PnlProgress;
    TcxProgressBar *PbLoadMap;
    TPanel *Panel5;
    TImage *ImgBoundary_n;
    TImage *ImgPrint_n;
    TImage *ImgPrint_c;
    TImage *ImgRefresh_c;
    TImage *ImgRefresh_n;
    TImage *ImgFull_n;
    TImage *ImgFull_c;
    TImage *ImgSquare_c;
    TImage *ImgSquare_n;
    TImage *ImgBoundary_c;
    TImage *ImgNext_c;
    TImage *ImgNext_n;
    TImage *ImgPan_n;
    TImage *ImgPan_c;
    TImage *ImgZoomOut_c;
    TImage *ImgZoomOut_n;
    TImage *ImgStnd_c;
    TImage *ImgSave_n;
    TImage *ImgSave_c;
    TImage *ImgStnd_n;
    TImage *ImgDist_c;
    TImage *ImgCircle_n;
    TImage *ImgCircle_c;
    TImage *ImgDist_n;
    TImage *ImgSel_c;
    TImage *ImgSel_n;
    TImage *ImgPrev_n;
    TImage *ImgPrev_c;
    TImage *ImgCenter_c;
    TImage *ImgCenter_n;
    TImage *ImgZoomIn_c;
    TImage *ImgZoomIn_n;
    TImageBtn *ImgBoundary;
    TImageBtn *ImgPrint;
    TImageBtn *ImgDist;
    TImageBtn *ImgSquare;
    TImageBtn *ImgCircle;
    TImageBtn *ImgSave;
    TTimer *TmrSelect;
    TTimer *TmrLinkSelect;
    TImage *ImgSelect;
    TPanel *PnlToolBar;
    TGroupBox *GroupBox1;
    TImageBtn *ImgPan;
    TImageBtn *ImgZoomIn;
    TImageBtn *ImgZoomOut;
    TImageBtn *ImgSel;
    TImageBtn *ImgCenter;
    TImageBtn *ImgPrev;
    TImageBtn *ImgNext;
    TImageBtn *ImgFull;
    TImageBtn *ImgStnd;
    TImageBtn *ImgRefresh;
    TGroupBox *GroupBox2;
    TGroupBox *GroupBox3;
    TcxCheckBox *ChkDrawCtv;
    TcxCheckBox *ChkDrawVms;
    TcxCheckBox *ChkDrawRse;
    TcxCheckBox *ChkViewExample;
    TcxCheckBox *ChkTrafficLayer;
    TcxCheckBox *ChkDrawIncident;
    TcxCheckBox *ChkGisSearch;
    TcxCheckBox *ChkToolTip;
    TGroupBox *GrpPos;
    TLabel *Label11;
    TLabel *Label12;
    TcxSpinEdit *SePosY;
    TcxSpinEdit *SePosX;
    TcxCheckBox *ChkDrawCenter;
    TGroupBox *GroupBox4;
    TGroupBox *GroupBox5;
    TImage *ImgCurrent;
    TcxLabel *LblCurrTemp;
    TImage *ImgForecast;
    TcxLabel *LblMaxFore;
    TcxLabel *LblMinFore;
    TcxGroupBox *panRemark;
    TGroupBox *GroupBox6;
    TGroupBox *GroupBox7;
    TGroupBox *GroupBox8;
    TGroupBox *GroupBox9;
    TGroupBox *GroupBox10;
    TImage *ImgRseN;
    TImage *ImgRseC;
    TcxLabel *cxLabel1;
    TcxLabel *cxLabel2;
    TImage *ImgCctvN;
    TImage *ImgCctvC;
    TImage *ImgCctvM;
    TcxLabel *cxLabel3;
    TcxLabel *cxLabel4;
    TcxLabel *cxLabel5;
    TImage *ImgVmsN;
    TImage *ImgVmsC;
    TImage *ImgVmsM;
    TcxLabel *cxLabel6;
    TcxLabel *cxLabel7;
    TcxLabel *cxLabel8;
    TImage *ImgInc01;
    TImage *ImgInc02;
    TImage *ImgInc03;
    TImage *ImgInc04;
    TcxLabel *cxLabel9;
    TcxLabel *cxLabel10;
    TcxLabel *cxLabel11;
    TcxLabel *cxLabel12;
    TPanel *PnlTrf01;
    TPanel *PnlTrf02;
    TPanel *PnlTrf03;
    TPanel *PnlTrf00;
    TcxLabel *cxLabel13;
    TcxLabel *cxLabel14;
    TcxLabel *cxLabel15;
    TcxLabel *cxLabel16;
    TImage *ImgOffice;
    TImage *ImgTemp;
    TImage *ImgTurn001;
    TImage *ImgTurn002;
    TImage *ImgTurn003;
    TImage *ImgTurn011;
    TImage *ImgTurn012;
    TImage *ImgTurn101;
    TImage *ImgTurn102;
    TImage *ImgTurn103;
    TPopupMenu *pmuGis;
    TMenuItem *N1;
    TMenuItem *pmuGisDefault;
    TMenuItem *pmuMove;
    TMenuItem *pmuZoomIn;
    TMenuItem *pmuZoomOut;
    TMenuItem *pmuIconSel;
    TMenuItem *pmuMoveCenter;
    TMenuItem *N2;
    TMenuItem *pmuCalLen;
    TMenuItem *pmuCalArea;
    TMenuItem *pmuRadius;
    TMenuItem *N7;
    TMenuItem *MnuSetStdArea;
    TMenuItem *MnuDrawAntiAlias;
    TMenuItem *MnuViewGray;
    TMenuItem *MnuLayerSetting;
    TMenuItem *MnuMoveStdArea;
    TPopupMenu *pmuCctv;
    TMenuItem *MnuCctvId;
    TMenuItem *N6;
    TMenuItem *mnuStopImage;
    TMenuItem *mnuCctvCam;
    TMenuItem *mnuCctvPingCtrl;
    TPopupMenu *pmuVms;
    TMenuItem *mnuVmsMsg;
    TMenuItem *mnuVmsCam;
    TMenuItem *mnuVmsPingCtrl;
    TPopupMenu *pmuRse;
    TMenuItem *pmuRsePing;
    TPanel *PnlMapInfo;
    TImage *ImgDesc27;
    TImage *ImgDesc37;
    TLabel *Label16;
    TLabel *Label3;
    TLabel *LblZoomLevel;
    TLabel *LblLinkLevel;
    TImage *Image1;
    TcxLabel *cxLabel17;
    TMenuItem *MnuVmsId;
    TMenuItem *N3;
    TMenuItem *MnuRseId;
    TMenuItem *N4;
    TMenuItem *NetworkPing1;
    TMenuItem *mnuCctvPingCapt;
    TMenuItem *mnuCctvPingEncd;
    TMenuItem *mnuCctvPingStrm;
    TMenuItem *NetworkPing2;
    TMenuItem *mnuVmsPingWeb;
    TWebBrowser *WebBrowser1;
    TGMMap *GMMap1;
    TEdit *Edit1;
    TEdit *Edit2;
    TGMRectangle *GMVehRect;
    TApplicationEvents *ApplicationEvents1;
    TGMGeoCode *GMGeoCode1;
    TMemo *Memo1;
    void __fastcall FormDestroy(TObject *Sender);
    void __fastcall FormShow(TObject *Sender);
    void __fastcall TmrShowTimer(TObject *Sender);
    void __fastcall MnuLayerSettingClick(TObject *Sender);
    void __fastcall pmuGisCalcClick(TObject *Sender);
    void __fastcall pmuControlGisClick(TObject *Sender);
    void __fastcall ImgPrevClick(TObject *Sender);
    void __fastcall ImgNextClick(TObject *Sender);
    void __fastcall ChkTrafficLayerClick(TObject *Sender);
    void __fastcall ChkDrawGisClick(TObject *Sender);
    void __fastcall ChkToolTipClick(TObject *Sender);
    void __fastcall TmrSelectTimer(TObject *Sender);
    void __fastcall TmrLinkSelectTimer(TObject *Sender);
    void __fastcall MnuSetStdAreaClick(TObject *Sender);
    void __fastcall mnuStopImageClick(TObject *Sender);
    void __fastcall mnuFacilityPingClick(TObject *Sender);
    void __fastcall pmuFacilityPopup(TObject *Sender);
    void __fastcall mnuCctvCamClick(TObject *Sender);
    void __fastcall mnuVmsMsgClick(TObject *Sender);
    void __fastcall mnuVmsCamClick(TObject *Sender);
    void __fastcall ChkDrawIncidentClick(TObject *Sender);
    void __fastcall ChkGisSearchClick(TObject *Sender);
    void __fastcall FormClose(TObject *Sender, TCloseAction &Action);
    void __fastcall panRemarkMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y);
    void __fastcall ChkViewExamplePropertiesChange(TObject *Sender);
    void __fastcall GMMap1AfterPageLoaded(TObject *Sender, bool First);
    void __fastcall WebBrowser1DocumentComplete(TObject *ASender, const IDispatch *pDisp, OleVariant &URL);
    void __fastcall GMMap1ZoomChanged(TObject *Sender, int NewZoom);
    void __fastcall ImgStndClick(TObject *Sender);
    void __fastcall GMMap1Click(TObject *Sender, TLatLng *LatLng, double X, double Y);
    void __fastcall FormCreate(TObject *Sender);
    void __fastcall GMMap1MouseMove(TObject *Sender, TLatLng *LatLng, double X, double Y);
    void __fastcall GMVehRectMouseUp(TObject *Sender, TLatLng *LatLng, int Index, TLinkedComponent *LinkedComponent);
private:	// User declarations
public:

    // For Map
    int             m_nMapLevel;

	//마우스 제어 플래그
	TPoint          m_ptDown;
    bool            m_bMouseDown;
    bool            m_bMoveCenter;
    bool            m_bCalcMode;
    bool            m_bCalcCont;
    
public:
    /*
    *  지도 이전/이후 보기 핸들러, 전자지도엔진에서 함수지원은 하나 기능이 수행안됨
    */
    EXTENT_LIST_QUEUE   m_ExtQ;                 // 이전/다음 정보를 저장할 전역변수
    //TDDRect             m_PrevExt;
    bool __fastcall PrevExtentQ();
    bool __fastcall NextExtentQ();
    //bool __fastcall AddExtentQ(TDDRect &curRc);
    //void __fastcall SetExtent(TDDRect &curRc);

    bool FRectangle;
    int  FRectangleIdx;
    TRectangle      *FVehRect;
    TLatLngBounds   *FVehBounds;
private:
    void __fastcall WebMessageHandler(TMsg &Msg, bool &Handled);

public:		// User declarations
    __fastcall TITS00GEO(TComponent* Owner, TForm *ParentForm);

    void __fastcall LoadConfig();
    void __fastcall LoadImageFile(String sImgFile, TImage *pImage);
    
    void __fastcall LoadLocalSkin();
    void __fastcall CommClose();
    bool __fastcall FormInit();

    void __fastcall LoadGisMap();
    void __fastcall SetGisTrafficColor();
    //void __fastcall SetMapOperation(TXiMapOperation nMapOper);
    
    void __fastcall GisMenuCheckClear();
    void __fastcall ShowLayerEditForm();

    void __fastcall SetTrafficInfo(bool bFlag);
    void __fastcall RefreshMapTraffic();
    

    void __fastcall SetTrfLayerShow(bool bShow);

    // Object Select
    //TDDPoint        m_ptSelect;
    void __fastcall SelectObjectByPos(double dPosX, double dPosY, bool bArrow=false);
    void __fastcall SelectObjectByPos();

    String __fastcall GetLinkLayerName();
    bool __fastcall GetLevelLinkId(int ALinkLevel, String &sLinkId, int X, int Y);
    bool __fastcall SelectLinkById(int ALinkLevel, String sId, bool bHide=false);
    bool __fastcall SelectLinkByPos(int X, int Y);

    void __fastcall ShowCctvStopImage(String AId, TPoint pt);
    void __fastcall ShowCctvCamera(String AId, TPoint pt);
    void __fastcall ShowVmsMessage(String AId, TPoint pt);
    void __fastcall ShowVmsCamera(String AId, TPoint pt);

    void __fastcall ShowLinkDetailInfo(String sLinkId, int nLinkLevel);

    void __fastcall UpdateFacilityStatus();
    void __fastcall UpdateIncidentStatus();
    String  FSelId;
};
//---------------------------------------------------------------------------
extern PACKAGE TITS00GEO *ITS00GEO;
//---------------------------------------------------------------------------
#endif

