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

#ifndef ITS0000MFH
#define ITS0000MFH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <DB.hpp>
#include <Menus.hpp>
#include <ExtCtrls.hpp>
#include <ADODB.hpp>
#include <ImgList.hpp>
#include <Graphics.hpp>
#include <ComCtrls.hpp>
//---------------------------------------------------------------------------

#include "CenterCommF.h"
#include "DataTypesF.h"
#include "WindowMsgF.h"

//---------------------------------------------------------------------------
#include "FRAME_FacilityStatusListF.h"
#include "FRAME_ProcessStatusListF.h"
#include "FRAME_IncidentListF.h"
#include "FRAME_RepeatCongestListF.h"
#include "FRAME_TrafficMissLinkListF.h"
#include "FRAME_IncidentAutoListF.h"
//#include "FRAME_BlackBoxEventListF.h"
#include "cxClasses.hpp"
#include "cxContainer.hpp"
#include "cxControls.hpp"
#include "cxCustomData.hpp"
#include "cxData.hpp"
#include "cxDataStorage.hpp"
#include "cxEdit.hpp"
#include "cxFilter.hpp"
#include "cxGraphics.hpp"
#include "cxGrid.hpp"
#include "cxGridCustomTableView.hpp"
#include "cxGridCustomView.hpp"
#include "cxGridLevel.hpp"
#include "cxGridTableView.hpp"
#include "cxGroupBox.hpp"
#include "cxLabel.hpp"
#include "cxLookAndFeelPainters.hpp"
#include "cxLookAndFeels.hpp"
#include "cxPC.hpp"
#include "cxPCdxBarPopupMenu.hpp"
#include "cxSplitter.hpp"
#include "cxStyles.hpp"
#include "dxSkinBlack.hpp"
#include "dxSkinBlue.hpp"
#include "dxSkinsCore.hpp"
#include "dxSkinscxPCPainter.hpp"
#include "FRAME_DatabaseStatusF.h"
#include "FRAME_OpenMapF.h"
#include "cxButtons.hpp"
#include "cxCheckBox.hpp"
#include "cxTextEdit.hpp"
#include "cxProgressBar.hpp"
#include "dxGDIPlusClasses.hpp"
#include "FRAME_AtmpPltnListF.h"
#include "FRAME_VilgFrcsListF.h"
#include "FRAME_VilgShprListF.h"
#include "dxSkinMcSkin.hpp"
#include "cxCheckComboBox.hpp"
#include "cxDropDownEdit.hpp"
#include "cxMaskEdit.hpp"
#include "cxCheckListBox.hpp"
//---------------------------------------------------------------------------

class TITS0000M : public TForm
{
__published:	// IDE-managed Components
    TTimer *TmrShow;
    TPanel *PnlInfoLeft;
    TcxSplitter *SplitterLeft;
    TcxGroupBox *GrpProcess;
    TcxGroupBox *GrpFacility;
    TPanel *PnlCenter;
    TcxSplitter *SplitterSystem;
    TPanel *PnlMapBack;
    TPanel *PnlBottom;
    TcxGroupBox *GrpSystem;
    TcxPageControl *PgSystem;
    TcxTabSheet *TsIncident;
    TcxTabSheet *TsRrCongest;
    TcxTabSheet *TsMissingLink;
    TImageList *ImageList1;
    TFRAMEIncidentList *FRAMEIncidentList1;
    TFRAMERepeatCongestList *FRAMERepeatCongestList1;
    TFRAMETrafficMissLinkList *FRAMETrafficMissLinkList1;
    TcxLabel *LblAlarm;
    TFRAMEProcessStatusList *FRAMEProcessStatusList1;
    TPopupMenu *pmuVms;
    TMenuItem *MnuVmsId;
    TMenuItem *N3;
    TMenuItem *mnuVmsMsg;
    TMenuItem *mnuVmsCam;
    TPopupMenu *pmuRse;
    TMenuItem *MnuRseId;
    TMenuItem *N4;
    TMenuItem *mmuRsePing;
    TPopupMenu *pmuCctv;
    TMenuItem *MnuCctvId;
    TMenuItem *N6;
    TMenuItem *mnuStopImage;
    TMenuItem *mnuCctvCam;
    TMenuItem *mnuCctvPingCtrl;
    TMenuItem *N1;
    TMenuItem *mnuMoveCctv;
    TMenuItem *N2;
    TMenuItem *mnuMoveVms;
    TMenuItem *N5;
    TMenuItem *mnuMoveRse;
    TMenuItem *NetworkPing1;
    TMenuItem *mnuCctvPingFibr;
    TMenuItem *mnuCctvPingStrm;
    TMenuItem *mnuCctvPingEncd;
    TMenuItem *mnuCctvPingCapt;
    TMenuItem *NetworkPing2;
    TMenuItem *mnuVmsPingWeb;
    TMenuItem *mnuVmsPingCtrl;
    TcxSplitter *cxSplitter2;
    TPopupMenu *pmuWCam;
    TMenuItem *MnuWebCamId;
    TMenuItem *MenuItem2;
    TMenuItem *MnuWebCam;
    TMenuItem *MnuWebCamPing;
    TMenuItem *N7;
    TMenuItem *mnuMoveVmsWebCam;
    TPopupMenu *pmuVds;
    TMenuItem *MnuVdsId;
    TMenuItem *MenuItem3;
    TMenuItem *MenuItem4;
    TMenuItem *MenuItem6;
    TMenuItem *MenuItem7;
    TPopupMenu *pmuAvi;
    TMenuItem *MnuAviId;
    TMenuItem *MenuItem9;
    TMenuItem *MenuItem10;
    TMenuItem *MenuItem11;
    TMenuItem *MenuItem12;
    TPopupMenu *pmuDsrc;
    TMenuItem *MnuDsrcId;
    TMenuItem *MenuItem14;
    TMenuItem *MenuItem15;
    TMenuItem *MenuItem16;
    TMenuItem *MenuItem17;
    TcxTabSheet *TsIncidentAuto;
    TFRAMEIncidentAutoList *FRAMEIncidentAutoList1;
    TPopupMenu *pmuBit;
    TMenuItem *MnuBitId;
    TMenuItem *MenuItem8;
    TMenuItem *mmuBitPing;
    TMenuItem *MenuItem18;
    TMenuItem *mnuMoveBit;
    TPopupMenu *pmuSig;
    TMenuItem *MnuSigId;
    TMenuItem *MenuItem20;
    TMenuItem *mmuSigPing;
    TMenuItem *MenuItem22;
    TMenuItem *mnuMoveSig;
    TPopupMenu *pmuSigDet;
    TMenuItem *MnuSigDetId;
    TMenuItem *MenuItem19;
    TMenuItem *mmuSigDetPing;
    TMenuItem *MenuItem23;
    TMenuItem *mnuMoveSigDet;
    TPopupMenu *pmuPVms;
    TMenuItem *MnuPisId;
    TMenuItem *MenuItem13;
    TMenuItem *MenuItem21;
    TMenuItem *MenuItem24;
    TMenuItem *MenuItem25;
    TPopupMenu *pmuPark;
    TMenuItem *MnuPcsId;
    TMenuItem *MenuItem26;
    TMenuItem *MenuItem27;
    TMenuItem *MenuItem28;
    TMenuItem *MenuItem29;
    TPanel *PnlBottomRight;
    TcxGroupBox *GrpBottomUtis;
    TcxLabel *lblSysTab;
    TcxSplitter *cxSplitter1;
    TFRAMEOpenMap *FRAMEOpenMap1;
    TPanel *PnlToolbar;
    TcxButton *BtnMapToJpg;
    TcxButton *BtnZoomIn;
    TcxButton *BtnZoomOut;
    TcxButton *BtnRefresh;
    TEdit *EdFocus;
    TcxButton *BtnMoveDefBounds;
    TcxLabel *cxLabel26;
    TcxLabel *cxLabel27;
    TPanel *PnlGisTool;
    TcxLabel *cxLabel1;
    TPanel *PnlLoading;
    TImage *ImgLoading;
    TcxLabel *LblZoom;
    TcxButton *BtnMapSelect;
    TPanel *PnlResource;
    TLabel *Label2;
    TLabel *Label1;
    TPanel *PnlProgress;
    TcxProgressBar *PbLoadMap;
    TcxLabel *lblGisStep1;
    TTimer *TmrInitGis;
    TcxLabel *lblGisStep2;
    TPanel *PnlTraffic;
    TPanel *PnlFacility;
    TcxCheckBox *ChkVms;
    TcxCheckBox *ChkVds;
    TcxCheckBox *ChkWCam;
    TcxCheckBox *ChkIncident;
    TcxLabel *lblGisStep3;
    TcxLabel *lblGisStep4;
    TPopupMenu *pmuGis;
    TMenuItem *MenuItem1;
    TMenuItem *pmuGisDefault;
    TMenuItem *pmuMove;
    TMenuItem *pmuZoomIn;
    TMenuItem *pmuZoomOut;
    TMenuItem *pmuIconSel;
    TMenuItem *pmuMoveCenter;
    TMenuItem *MenuItem30;
    TMenuItem *pmuCalLen;
    TMenuItem *pmuCalArea;
    TMenuItem *pmuRadius;
    TMenuItem *MenuItem31;
    TMenuItem *MnuSetStdArea;
    TMenuItem *MnuMoveStdArea;
    TcxGroupBox *panRemark;
    TGroupBox *GrpRse;
    TImage *ImgRseN;
    TImage *ImgRseC;
    TImage *Image1;
    TcxLabel *cxLabel2;
    TcxLabel *cxLabel3;
    TcxLabel *cxLabel17;
    TGroupBox *GroupBox7;
    TImage *ImgInc01;
    TImage *ImgInc02;
    TImage *ImgInc03;
    TImage *ImgInc04;
    TcxLabel *cxLabel9;
    TcxLabel *cxLabel10;
    TcxLabel *cxLabel11;
    TcxLabel *cxLabel12;
    TGroupBox *GroupBox8;
    TPanel *PnlTrf01;
    TPanel *PnlTrf02;
    TPanel *PnlTrf03;
    TPanel *PnlTrf00;
    TcxLabel *cxLabel13;
    TcxLabel *cxLabel14;
    TcxLabel *cxLabel15;
    TcxLabel *cxLabel16;
    TGroupBox *GroupBox9;
    TImage *ImgCctvN;
    TImage *ImgCctvC;
    TImage *ImgCctvM;
    TcxLabel *cxLabel4;
    TcxLabel *cxLabel5;
    TcxLabel *cxLabel6;
    TGroupBox *GroupBox10;
    TImage *ImgVmsN;
    TImage *ImgVmsC;
    TImage *ImgVmsM;
    TcxLabel *cxLabel7;
    TcxLabel *cxLabel8;
    TcxLabel *cxLabel18;
    TGroupBox *GrpWeb;
    TImage *Image2;
    TImage *Image3;
    TImage *Image4;
    TcxLabel *cxLabel19;
    TcxLabel *cxLabel20;
    TcxLabel *cxLabel21;
    TGroupBox *GrpDsrc;
    TImage *Image5;
    TImage *Image6;
    TImage *Image7;
    TcxLabel *cxLabel22;
    TcxLabel *cxLabel23;
    TcxLabel *cxLabel24;
    TGroupBox *GrpAvi;
    TImage *Image8;
    TImage *Image9;
    TImage *Image10;
    TcxLabel *cxLabel25;
    TcxLabel *cxLabel28;
    TcxLabel *cxLabel29;
    TGroupBox *GrpVds;
    TImage *Image11;
    TImage *Image12;
    TImage *Image13;
    TcxLabel *cxLabel30;
    TcxLabel *cxLabel31;
    TcxLabel *cxLabel32;
    TcxCheckBox *ChkTraffic;
    TMenuItem *N8;
    TMenuItem *N9;
    TMenuItem *N10;
    TMenuItem *N11;
    TMenuItem *N12;
    TMenuItem *N13;
    TMenuItem *N14;
    TMenuItem *N15;
    TMenuItem *N16;
    TMenuItem *N17;
    TTimer *TmrRefresh;
    TcxCheckBox *ChkTrafficTooltip;
    TcxCheckBox *ChkGisSearch;
    TTimer *TmrDebugHide;
    TcxLabel *LblMsg;
    TcxTabSheet *TabDebug;
    TMemo *reMsg;
    TcxPageControl *PgSystemOpr;
    TcxTabSheet *TsFacilityOpr;
    TcxTabSheet *TsDatabaseOpr;
    TFRAMEDatabaseStatus *FRAMEDatabaseStatus1;
    TcxGrid *CxStatus;
    TcxGridTableView *TvStatus;
    TcxGridColumn *ColName;
    TcxGridColumn *ColTotal;
    TcxGridColumn *ColNormal;
    TcxGridColumn *ColFail;
    TcxGridColumn *ColModule;
    TcxGridLevel *GlStatus;
    TcxTabSheet *TsAtmpPltn;
    TFRAMEAtmpPltnList *FRAMEAtmpPltnList1;
    TcxTabSheet *TsVilgFrcs;
    TcxTabSheet *TsVilgShpr;
    TFRAMEVilgShprList *FRAMEVilgShprList1;
    TFRAMEVilgFrcsList *FRAMEVilgFrcsList1;
    TFRAMEFacilityStatusList *FRAMEFacilityStatusList1;
    TcxCheckBox *ChkCCam;
    TPopupMenu *pmuCCam;
    TMenuItem *MenuItem5;
    TMenuItem *MenuItem32;
    TMenuItem *MenuItem33;
    TMenuItem *MenuItem34;
    TMenuItem *MnuCrsCam;
    TMenuItem *N18;
    TMenuItem *mnuMoveCrsCam;
    TcxTabSheet *TsClctSystStts;
    TcxGrid *CxClctStts;
    TcxGridTableView *TvClctStts;
    TcxGridColumn *Column1;
    TcxGridColumn *Column2;
    TcxGridColumn *Column3;
    TcxGridColumn *Column4;
    TcxGridColumn *Column5;
    TcxGridLevel *GlClctStts;
    TcxCheckBox *ChkPark;
    TMenuItem *mnuParkMsg;
    TcxCheckBox *ChkCctv;
    TcxCheckBox *ChkIncCam;
    TPopupMenu *pmuIncCctv;
    TMenuItem *MenuItem35;
    TMenuItem *MenuItem36;
    TMenuItem *MenuItem37;
    TMenuItem *MenuItem38;
    TMenuItem *MenuItem39;
    TMenuItem *MenuItem40;
    TMenuItem *MenuItem41;
    TMenuItem *MenuItem42;
    TMenuItem *mnuIncCam;
    TMenuItem *MenuItem44;
    TMenuItem *N231;
    TMenuItem *mnuMoveIncCctv;
    TcxCheckComboBox *CbLayerVisible;
    TcxLabel *cxLabel33;
    TPopupMenu *pmuCrsCam;
    TMenuItem *MenuItem43;
    TMenuItem *MenuItem45;
    TMenuItem *MenuItem46;
    TMenuItem *MenuItem47;
    TMenuItem *MenuItem48;
    TMenuItem *N19;
    TMenuItem *MenuItem50;
    TPopupMenu *pmuCrs;
    TMenuItem *MenuItem51;
    TMenuItem *MenuItem52;
    TMenuItem *MenuItem53;
    TMenuItem *MenuItem54;
    TMenuItem *mnuCrsStream;
    TMenuItem *N20;
    TMenuItem *MenuItem57;
    void __fastcall FormCreate(TObject *Sender);
    void __fastcall FormShow(TObject *Sender);
    void __fastcall TmrShowTimer(TObject *Sender);
    void __fastcall PgSystemPageChanging(TObject *Sender, TcxTabSheet *NewPage, bool &AllowChange);
    void __fastcall FormClose(TObject *Sender, TCloseAction &Action);
    void __fastcall FRAMEIncidentList1TvListCellDblClick(TcxCustomGridTableView *Sender, TcxGridTableDataCellViewInfo *ACellViewInfo,
          TMouseButton AButton, TShiftState AShift, bool &AHandled);
    void __fastcall FRAMERepeatCongestList1TvListCellDblClick(TcxCustomGridTableView *Sender, TcxGridTableDataCellViewInfo *ACellViewInfo,
          TMouseButton AButton, TShiftState AShift, bool &AHandled);
    void __fastcall FRAMETrafficMissLinkList1TvListCellDblClick(TcxCustomGridTableView *Sender, TcxGridTableDataCellViewInfo *ACellViewInfo,
          TMouseButton AButton, TShiftState AShift, bool &AHandled);
    void __fastcall FRAMEFacilityStatusList1TvListCellDblClick(TcxCustomGridTableView *Sender, TcxGridTableDataCellViewInfo *ACellViewInfo,
          TMouseButton AButton, TShiftState AShift, bool &AHandled);
    void __fastcall FRAMEFacilityStatusList1TvListCellClick(TcxCustomGridTableView *Sender, TcxGridTableDataCellViewInfo *ACellViewInfo,
          TMouseButton AButton, TShiftState AShift, bool &AHandled);
    void __fastcall pmuFacilityPopup(TObject *Sender);
    void __fastcall mnuFacilityPingClick(TObject *Sender);
    void __fastcall mnuFacilityMoveClick(TObject *Sender);
    void __fastcall mnuStopImageClick(TObject *Sender);
    void __fastcall mnuVmsMsgClick(TObject *Sender);
    void __fastcall mnuStrmCamClick(TObject *Sender);
    void __fastcall FRAMEIncidentAutoList1TvList2CellDblClick(TcxCustomGridTableView *Sender, TcxGridTableDataCellViewInfo *ACellViewInfo,
          TMouseButton AButton, TShiftState AShift, bool &AHandled);
    void __fastcall ColNameCustomDrawCell(TcxCustomGridTableView *Sender, TcxCanvas *ACanvas,
          TcxGridTableDataCellViewInfo *AViewInfo, bool &ADone);
    void __fastcall ColTotalCustomDrawCell(TcxCustomGridTableView *Sender, TcxCanvas *ACanvas,
          TcxGridTableDataCellViewInfo *AViewInfo, bool &ADone);
    void __fastcall ColNormalCustomDrawCell(TcxCustomGridTableView *Sender, TcxCanvas *ACanvas,
          TcxGridTableDataCellViewInfo *AViewInfo, bool &ADone);
    void __fastcall ColFailCustomDrawCell(TcxCustomGridTableView *Sender, TcxCanvas *ACanvas,
          TcxGridTableDataCellViewInfo *AViewInfo, bool &ADone);
    void __fastcall ColModuleCustomDrawCell(TcxCustomGridTableView *Sender, TcxCanvas *ACanvas,
          TcxGridTableDataCellViewInfo *AViewInfo, bool &ADone);
    void __fastcall TvStatusCustomDrawCell(TcxCustomGridTableView *Sender, TcxCanvas *ACanvas,
          TcxGridTableDataCellViewInfo *AViewInfo, bool &ADone);
    void __fastcall BtnRefreshClick(TObject *Sender);
    void __fastcall BtnMapSelectClick(TObject *Sender);
    void __fastcall BtnMapToJpgClick(TObject *Sender);
    void __fastcall BtnMoveDefBoundsClick(TObject *Sender);
    void __fastcall BtnZoomInClick(TObject *Sender);
    void __fastcall BtnZoomOutClick(TObject *Sender);
    void __fastcall TmrInitGisTimer(TObject *Sender);
    void __fastcall ChkFacilityLayerShowHideClick(TObject *Sender);
    void __fastcall LblZoomDblClick(TObject *Sender);
    void __fastcall ChkTrafficClick(TObject *Sender);
    void __fastcall ChkGisSearchClick(TObject *Sender);
    void __fastcall TmrRefreshTimer(TObject *Sender);
    void __fastcall ChkTrafficTooltipClick(TObject *Sender);
    void __fastcall FormCloseQuery(TObject *Sender, bool &CanClose);
    void __fastcall TmrDebugHideTimer(TObject *Sender);
    void __fastcall reMsgDblClick(TObject *Sender);
    void __fastcall FRAMEAtmpPltnList1TvListCellDblClick(TcxCustomGridTableView *Sender, TcxGridTableDataCellViewInfo *ACellViewInfo,
          TMouseButton AButton, TShiftState AShift, bool &AHandled);
    void __fastcall FRAMEVilgShprList1TvListCellDblClick(TcxCustomGridTableView *Sender, TcxGridTableDataCellViewInfo *ACellViewInfo,
          TMouseButton AButton, TShiftState AShift, bool &AHandled);
    void __fastcall FRAMEVilgFrcsList1TvListCellDblClick(TcxCustomGridTableView *Sender, TcxGridTableDataCellViewInfo *ACellViewInfo,
          TMouseButton AButton, TShiftState AShift, bool &AHandled);
    void __fastcall PnlFacilityDblClick(TObject *Sender);
    void __fastcall mnuParkMsgClick(TObject *Sender);
    void __fastcall CbLayerVisiblePropertiesChange(TObject *Sender);
    void __fastcall mnuCrsStreamClick(TObject *Sender);
    void __fastcall CbLayerVisiblePropertiesCloseUp(TObject *Sender);




private:	// User declarations
    void __fastcall CommClose();

public:
    int             FIncidentCnt;
    int             FRrCongestCnt;
    int             FMissLinkCnt;
    int             FIncidentAutoCnt;
    int             FBlackBoxEventCnt;
    int             FVilgFrcsCnt1;
    int             FVilgFrcsCnt2;
    int             FVilgFrcsCnt3;
    int             FAtmpPlntCnt;

    int             FSelMenuTag;
    String          FSelId;

    String sJs;
    int    FLayerIdx;

    String FLayerVisible;

public:		// User declarations
    __fastcall TITS0000M(TComponent* Owner);

    void __fastcall LoadLocalSkin();

    void __fastcall InitListData();
    void __fastcall UpdateAlarmStatus();
    void __fastcall UpdateTrafficMissLinkInfo();
    void __fastcall UpdateTrafficRrCongestInfo();
    void __fastcall UpdateIncidentInfo();
    void __fastcall UpdateFacilityStatusInfo();
    void __fastcall UpdateProcessStatusInfo();
    void __fastcall UpdateUtisStatusInfo();
    void __fastcall UpdateFacilityInfo();
    void __fastcall UpdateBlackBoxEventInfo();
    void __fastcall UpdateVilgFrcsInfo();
    void __fastcall UpdateDatabaseStatusInfo();
    void __fastcall UpdateClctSystStts();

    void __fastcall UpdateVmsMsg(int AType);

    void __fastcall MoveGisFacility(String AType, String AId);

    void __fastcall UpdateFacilityStatusTotal();

    void __fastcall UpdateGisFacility();
    void __fastcall InitGisFacility();

    void __fastcall UpdateGisTraffic();
    void __fastcall InitGisTraffic_File();
    void __fastcall InitGisTraffic();

    void __fastcall UpdateGisIncident();
    void __fastcall OnMapPopupMenu(int ALayerType, String AFID, bool AOnList);
    void __fastcall SelectObjectByPos(double dPosX, double dPosY, bool bArrow=false);
    void __fastcall SetGisTrafficColor();
    bool __fastcall SelectLinkById(int ALinkLevel, String AId, bool AHide=false);
    void __fastcall RefreshGisLink();
    void __fastcall SelGisItem(int AType, String AId);

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

    void __fastcall ShowStrmCamera(String AId, TPoint pt);
    void __fastcall ShowCrsStrmCamera(String AId, TPoint pt);

    void __fastcall ShowParkingLotInfo(String AId, TPoint pt);

    void __fastcall ShowLinkDetailInfo(String ALinkId, int ALinkLevel);
    void __fastcall DebugMsg(String AMsg);
    void __fastcall DebugLog(String AMsg);
    void __fastcall MapZoomChanged(int AMapZoom);

    void __fastcall OpenMapCallback(TObject *ASender, const String AFunc, const String AArgs, const bool AFirst);

    void __fastcall OnMainFormMessage(TMessage &Msg);
	BEGIN_MESSAGE_MAP
        MESSAGE_HANDLER(WM_MAINFORM, TMessage, OnMainFormMessage)
    END_MESSAGE_MAP(TForm)
};
//---------------------------------------------------------------------------
extern PACKAGE TITS0000M *ITS0000M;
//---------------------------------------------------------------------------

#endif

