⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ufrmmain.pas

📁 a voice guide client ,it is the second part of voice guide center
💻 PAS
📖 第 1 页 / 共 5 页
字号:
      MessageBox(Handle,PChar(E.Message),PChar('MapCloseQuery'),MB_OK+MB_ICONERROR);
    end;
  end;
end;

procedure TfrmMain.MapClose(Sender: TdxCustomDockControl);
var
  dpTemp: TdxDockPanel;
  isDelActive: Boolean;
  MapFrame: TframMap;
  Index, j: Integer;
  Viewer: TGIS_ViewerWnd;
begin
  try
    dpTemp:= TdxDockPanel(Sender);
    //释放地图窗口FormMap
    MapFrame:= TGPSClientTargetMapWin.GetMapForm4Panel(dpTemp);
    isDelActive:= MapFrame= ActiveMapFrame;
    { TODO -oTransit -cFile : 删除窗口 }
    Index:= FMapWinList.IndexOf(dpTemp);
    if isDelActive then begin
      if Index=0 then j:=1
      else j:= Index- 1;
      ActiveMapFrame:= TGPSClientTargetMapWin.GetMapForm4Panel(TdxDockPanel(FMapWinList[j] ));
      Viewer:= GetGisViewer4Panel(dpTemp);
      framGisQry1.DelViewer(Viewer);
    end;
    if Assigned(MapFrame) then MapFrame.Free;
    FMapWinList.Delete(Index);
  except
    on e: Exception do
    begin
      MessageBox(Handle,PChar(E.Message),PChar('MapClose'),MB_OK+MB_ICONERROR);
    end;
  end;
end;

procedure TfrmMain.SetActiveMapFrame(MapFrame: TFramMap);
var
  ViewTarget: TViewerTarget;
  ActiveCarId: Integer;
begin
  try
    if MapFrame=NIL then Exit;
    if not Assigned(MapFrame)
    then GIS_ControlHawkEye1.GIS_Viewer:= nil
    else begin
      GIS_ControlHawkEye1.GIS_Viewer:= MapFrame.Viewer;
      { TODO -oTransit -cMap : MapSearch }
      //SearchWindows1.SetGis(MapFrame, MapFrame.Viewer);
      framGisQry1.SetViewer(MapFrame.Viewer);

      
    end;
    FActiveMapFrame:= MapFrame;
    FActiveMapFrame.Viewer.OnAfterPaint := DoOnViewerAfterPaint;
    //设置活动Car
    ViewTarget:= TViewerTarget(FActiveMapFrame.Viewer.ActiveTarget );
    if Assigned(ViewTarget) then begin
      ActiveCarId:= GetCarId(ViewTarget.TargetObj.TargetID);
      SetActiveCar(ActiveCarId, ViewTarget.Active, MapFrame.MapFramType);
    end else SetActiveCar(-1, False, MapFrame.MapFramType);

    // 设置地图编辑事件
    dxBarBtnMapEditSymb.Action  := FActiveMapFrame.acMapEditSymb;
    dxBarBtnMapEditSelect.Action:= FActiveMapFrame.acMapEditSelect;
    dxBarBtnMapEditNew.Action   := FActiveMapFrame.acMapEditNew;
    dxBarBtnMapEditUndo.Action  := FActiveMapFrame.acMapEditUndo;
    dxBarBtnMapEditRedo.Action  := FActiveMapFrame.acMapEditRedo;
    dxBarBtnMapEditDel.Action   := FActiveMapFrame.acMapEditDelete;
    dxBarBtnMapEditEnd.Action   := FActiveMapFrame.acMapEditEndEdit;
    dxBarBtnMapEditSave.Action  := FActiveMapFrame.acMapEditSave;
    dxBarBtnMapGeoSelect.Action := FActiveMapFrame.acMapGeoSelect;
  except
    on e: Exception do
    begin
      MessageBox(Handle,PChar(E.Message),PChar('SetActiveMapFrame'),MB_OK+MB_ICONERROR);
    end;
  end;
end;

function TfrmMain.GetGisViewer4Panel(MapPanel: TdxDockPanel): TGIS_ViewerWnd;
{-----------------------------------------------------------------------------
  Procedure: TfrmMain.GetMapForm4Panel
  Author:    Transit
  Date:      04-十二月-2003
  Arguments: MapPanel: TdxDockPanel
  Result:    TfrmMap
  从TdxDockPanel中得到GisViewer
-----------------------------------------------------------------------------}
var
  MapFram: TframMap;
begin
  Result:= nil;
  try
    MapFram:= TGPSClientTargetMapWin.GetMapForm4Panel(MapPanel);
    if Assigned(MapFram)
    then Result:= MapFram.Viewer;
  except
    on e: Exception do
    begin
      MessageBox(Handle,PChar(E.Message),PChar('GetGisViewer4Panel'),MB_OK+MB_ICONERROR);
    end;
  end;
end;

//function TfrmMain.GetMapForm4Panel(MapPanel: TdxDockPanel): TframMap;
//{-----------------------------------------------------------------------------
//  Procedure: Not available
//  Author:    Administrator
//  Date:      04-十二月-2003
//  Arguments: None
//  Result:    None
//  从TdxDockPanel中得到TFrmMap
//-----------------------------------------------------------------------------}
//begin
//  Result:= nil;
//  try
//    if not Assigned(MapPanel) then Exit;
//    if MapPanel.ControlCount<1 then Exit;
//    if (MapPanel.Controls[0] is TFramMap)
//    then Result:= (MapPanel.Controls[0] as TframMap);
//  except
//    on e: Exception do
//    begin
//      MessageBox(Handle,PChar(E.Message),PChar('GetMapForm4Panel'),MB_OK+MB_ICONERROR);
//    end;
//  end;
//end;

procedure TfrmMain.MapActivate(Sender: TdxCustomDockControl;
  Active: Boolean);
begin
  //活动
  try
    if not Active then Exit;
    ActiveMapFrame:= TGPSClientTargetMapWin.GetMapForm4Panel(Sender as TdxDockPanel);
  except
    on e: Exception do
    begin
      MessageBox(Handle,PChar(E.Message),PChar('MapActivate'),MB_OK+MB_ICONERROR);
    end;
  end;
end;

procedure TfrmMain.MapVisibleChanged(Sender: TdxCustomDockControl);
var
  MapFrame: TFramMap;
begin
  try
    if not Sender.Visible then Exit;
    if Sender.ControlCount<1 then Exit;
    if (Sender.Controls[0] is TFramMap) then begin
      MapFrame:= TGPSClientTargetMapWin.GetMapForm4Panel(Sender as TdxDockPanel);
      MapFrame.MapLoad;
      Sender.Caption:= MapFrame.Viewer.CurrentMap.Name;;
    end;
  except
    on e: Exception do
    begin
      MessageBox(Handle,PChar(E.Message),PChar('MapVisibleChanged'),MB_OK+MB_ICONERROR);
    end;
  end;
end;

procedure TfrmMain.MapPageCreateTabContainer(
  Sender: TdxCustomDockControl; ATabContainer: TdxTabContainerDockSite);
begin
  try
    if (Sender.ControlCount<1) then Exit;
    if (Sender.Controls[0] is TFramMap) then begin
      FTabContainer:= ATabContainer;
      FTabContainer.Dockable:= False;
      FTabContainer.OnClose:= TabMapClose;
      FTabContainer.OnDocking:= TabMapDocking;
      FTabContainer.OnActiveChildChanged:= TabMapActiveChildChanged;
    end;
  except
    on e: Exception do
    begin
      MessageBox(Handle,PChar(E.Message),PChar('MapPageCreateTabContainer'),MB_OK+MB_ICONERROR);
    end;
  end;
end;

//**********************************************************//
procedure TfrmMain.TabMapClose(Sender: TdxCustomDockControl);
begin
  FTabContainer:= nil;
end;

procedure TfrmMain.TabMapDocking(Sender: TdxCustomDockControl;
  Zone: TdxZone; X, Y: Integer; var Accept: Boolean);
begin
//  Accept:= False;
//  if Sender.ControlCount<1 then Exit;
//  Accept:= (Sender.Controls[0] is TFramMap);
end;


procedure TfrmMain.TabMapActiveChildChanged(Sender: TdxContainerDockSite;
  Child: TdxCustomDockControl);
var
  MapFrame: TFramMap;
begin
  try
    //AddLog('ActiveChild: '+ Child.Caption);
    if Child.ControlCount<1 then Exit;
    if (Child.Controls[0] is TFramMap) then begin
      MapFrame:= TGPSClientTargetMapWin.GetMapForm4Panel(Child as TdxDockPanel);
      MapFrame.MapLoad;
      Child.Caption:= MapFrame.Viewer.CurrentMap.Name;
      ActiveMapFrame:= MapFrame;
      GIS_ControlHawkEye1.GIS_Viewer:= MapFrame.Viewer;
    end;
  except
    on e: Exception do
    begin
      MessageBox(Handle,PChar(E.Message),PChar('TabMapActiveChildChanged'),MB_OK+MB_ICONERROR);
    end;
  end;
end;
//**********************************************************//

function TfrmMain.GetActiveGisViewer: TGIS_ViewerWnd;
begin
  Result:= FActiveMapFrame.Viewer;
end;


//************** Map Fun ***********************************//
procedure TfrmMain.actMapUpdate(Sender: TObject);
begin
  try
    (Sender as TAction).Enabled:= Assigned(ActiveMapFrame);
  except
    on e: Exception do
    begin
      MessageBox(Handle,PChar(E.Message),PChar('actMapUpdate'),MB_OK+MB_ICONERROR);
    end;
  end;
end;

procedure TfrmMain.actMapExecute(Sender: TObject);
begin
  try
    case (Sender as TAction).Tag of
      1: ActiveMapFrame.SetMapTools(mtZoom);
      2: ActiveMapFrame.SetMapTools(mtPan);
      3: ActiveMapFrame.SetMapTools(mtViewEntireLayers);
      4: ActiveMapFrame.SetMapTools(mtCust_Ruler);
      5: ActiveMapFrame.SetMapTools(mtCust_Area);
      6: ActiveMapFrame.SetMapTools(mtSearchPath);
      7: dpMapbox.Show; //查询
      8: ActiveMapFrame.SetMapTools(mtPrint);
      9: ActiveMapFrame.SetMapTools(mtSelPoint);
      10: ActiveMapFrame.SetMapTools(mtSelOilInfo);
      11: ActiveMapFrame.SetMapTools(mtMapPointSelection);
    end;
    //ActiveMapFrame.Viewer.Mode:= gisZoom;
  except
    on e: Exception do
    begin
      MessageBox(Handle,PChar(E.Message),PChar('actMapExecute'),MB_OK+MB_ICONERROR);
    end;
  end;
end;

procedure TfrmMain.HookMapPanel(MapPanel: TdxDockPanel);
begin
  try
    MapPanel.OnActivate:= MapActivate;
    MapPanel.OnClose:= MapClose;
    MapPanel.OnCloseQuery:= MapCloseQuery;
    MapPanel.OnCreateTabContainer:= MapPageCreateTabContainer;
    MapPanel.OnVisibleChanged:= MapVisibleChanged;
  except
    on e: Exception do
    begin
      MessageBox(Handle,PChar(E.Message),PChar('HookMapPanel'),MB_OK+MB_ICONERROR);
    end;
  end;
end;

procedure TfrmMain.SetLookFeel(LookFeel: TLookFeel);
begin
  try
    case LookFeel of
      lfStard:
        begin
          dxBarManager1.Style:= bmsStandard;
          dxDockingManager1.ViewStyle:= vsStandard;
          dxStatusBar1.PaintStyle:= stpsStandard;
        end;
      lfNet:
        begin
          dxBarManager1.Style:= bmsFlat;
          dxDockingManager1.ViewStyle:= vsNET;
          dxStatusBar1.PaintStyle:= stpsFlat;
        end;
      lfXp:
        begin
          dxBarManager1.Style:= bmsXP;
          dxDockingManager1.ViewStyle:= vsXP;
          dxStatusBar1.PaintStyle:= stpsXP;
        end;
      lfOffice:
        begin
          dxBarManager1.Style:= bmsOffice11;
          dxDockingManager1.ViewStyle:= vsOffice11;
          dxStatusBar1.PaintStyle:= stpsOffice11;
        end;
    end;
    framGisQry1.SetLookFeel(LookFeel);
  except
    on e: Exception do
    begin
      MessageBox(Handle,PChar(E.Message),PChar('SetLookFeel'),MB_OK+MB_ICONERROR);
    end;
  end;
end;

procedure TfrmMain.actFileSysSettExecute(Sender: TObject);
begin
  try
    ExecuteSysSett;
  except
    on e: Exception do
    begin
      MessageBox(Handle,PChar(E.Message),PChar('actFileSysSettExecute'),MB_OK+MB_ICONERROR);
    end;
  end;
end;

procedure TfrmMain.DoAfterLogOn;
begin
  try
    // 报警指示灯动画定时器
    Timer1.Enabled:= True;

    // 自动重联定时器
    tmCheckLink.Enabled := True;

//    TGPSClientCarInfoListDisplay.FillList(
//      lvCarInfoList, []);

    // 长庆树形显示
    if gVersionFlag = 85 then
    begin
//      // 设置排序字段
//      OrderTreeFieldName := 'OwnerName';
//      // 根据排序字段刷新列表
//      refreshTreeOrder;
      actOrderTreeExecute(nil);
    end
    else begin
      // 填写车辆列表
      TGPSClientCarInfoListDisplay.FillvTTree(
        vtCarinfoTree, []);
    end;

    // 建立 车辆编号 与 目标编号 的 对应关系表
    CreateTargetIdList;

    // 设置工具栏图标
    SetToolIcon(titBig);

    // 设置轨迹缓存数量
    TargetCommander1.TrackCacheSize := gTrackPtCount;

    FIgnorOper        

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -