📄 ufrmsyssett.pas
字号:
unit uFrmSysSett;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, RzTabs, cxLookAndFeelPainters, StdCtrls, cxButtons,
cxCheckListBox, cxCheckBox, cxGroupBox, cxRadioGroup, cxControls, cxContainer,
cxEdit, cxTextEdit, cxMaskEdit, cxDropDownEdit, ActnList, ComCtrls,
ExtCtrls, cxSpinEdit, cxColorComboBox, GisViewerWnd, uFramMap, uBaseDBDefs,
uGPSClientCarInfoListDisplay, ufrmGPSClientVehicleInfoEdit, uFrmCmdSend,
uGPSClientProcessTrack, uGPSClientProcessUtils, uGPSClientProcessOperation;
type
TfrmSysSett = class(TForm)
RzPageControl1: TRzPageControl;
TabSheet1: TRzTabSheet;
TabSheet2: TRzTabSheet;
btnOk: TcxButton;
btnCancel: TcxButton;
cxGroupBox1: TcxGroupBox;
clbCarInfoTypeSet: TcxCheckListBox;
ActionList1: TActionList;
actOk: TAction;
Label1: TLabel;
cbLookFeel: TComboBox;
StatusBar1: TStatusBar;
Label5: TLabel;
cbRepalyInterval: TComboBox;
Label6: TLabel;
cbPopOnEm: TComboBox;
cbAutoCall: TcxCheckBox;
rgTargetLabel: TRadioGroup;
rgTrackType: TRadioGroup;
cbPopOnMsg: TComboBox;
Label7: TLabel;
Label8: TLabel;
EdTrackPtCount: TcxSpinEdit;
cxCheckTrackNew: TcxCheckBox;
TabSheet3: TRzTabSheet;
Label9: TLabel;
Label10: TLabel;
Label11: TLabel;
Label12: TLabel;
cbGISBkgColor: TcxColorComboBox;
cbRulerBkgColor: TcxColorComboBox;
cbRulerInterColor1: TcxColorComboBox;
cbRulerInterColor2: TcxColorComboBox;
pnlCallOption: TPanel;
Label2: TLabel;
cbCallInterval: TComboBox;
Label3: TLabel;
cbCallTimes: TComboBox;
pnlNotice: TPanel;
Label4: TLabel;
cbTargetShowHint: TComboBox;
ckbFullExtentViewAll: TcxCheckBox;
ckbFullExtentSearch: TcxCheckBox;
ckbIsShowRoadName: TcxCheckBox;
edtVerionName: TcxTextEdit;
Label13: TLabel;
tsFilterDescription: TRzTabSheet;
tsFilterOperation: TRzTabSheet;
tsFilterTrack: TRzTabSheet;
ckbIsTrackGenOper: TcxCheckBox;
ckbIsEnableTrackHijack: TcxCheckBox;
ckbIsShowDebugLog: TcxCheckBox;
ckbIsIgnoreAdditionalTrack: TcxCheckBox;
ckbIsGenLowSpeedAlarm: TcxCheckBox;
edtLowSpeedAlarmValue: TcxTextEdit;
Label14: TLabel;
clbConverter: TcxCheckListBox;
ckbIsAutoCancelAlarm: TcxCheckBox;
clbGPSDescFilter: TcxCheckListBox;
Label15: TLabel;
Label16: TLabel;
clbOperationFilter: TcxCheckListBox;
ckbIsNormalizeSpeedAlarm: TcxCheckBox;
ckbIsGenDoorOpen: TcxCheckBox;
ckbIsGenEFenAlarm: TcxCheckBox;
ckbIsGenLateAlarm: TcxCheckBox;
Label17: TLabel;
ckbIsShowMessage: TcxCheckBox;
tsTrackReplay: TRzTabSheet;
cxGroupBox2: TcxGroupBox;
cbxQryResult: TcxCheckListBox;
cbxShowRoadName: TcxCheckBox;
cbxShowStopSect: TcxCheckBox;
cbxShowStirCan: TcxCheckBox;
ckbIsIgnorNormalOper: TcxCheckBox;
procedure OnObjEnter(Sender: TObject);
procedure OnObjExit(Sender: TObject);
procedure actOkExecute(Sender: TObject);
procedure clbCarInfoTypeSetDblClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure StatusBar1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure ckbIsTrackGenOperPropertiesChange(Sender: TObject);
procedure ckbIsGenLowSpeedAlarmPropertiesChange(Sender: TObject);
procedure clbGPSDescFilterClickCheck(Sender: TObject; AIndex: Integer;
APrevState, ANewState: TcxCheckBoxState);
procedure clbConverterClickCheck(Sender: TObject; AIndex: Integer;
APrevState, ANewState: TcxCheckBoxState);
procedure clbOperationFilterClickCheck(Sender: TObject;
AIndex: Integer; APrevState, ANewState: TcxCheckBoxState);
private
FVehicleInfoFieldList: TList;
procedure clearVehicleInfoFieldList;
procedure displayGPSTrackConverter;
procedure storeGPSTrackConverter;
procedure displayGPSDescFilter;
procedure storeGPSDescFilter;
procedure displayOperationFilter;
procedure storeOperationFilter;
procedure Options2UI;
procedure UI2Options;
public
function Execute: Boolean;
end;
procedure ExecuteSysSett;
implementation
uses uFrmMain, uPubFun, uFaceFun, GisControlScale, uGPSClientLanguage,
uFrmReplay;
var
frmSysSett: TfrmSysSett;
{$R *.dfm}
//------------------------------------------------------------------------------
// 全局方法
//------------------------------------------------------------------------------
procedure ExecuteSysSett;
begin
if frmSysSett = nil then
frmSysSett:= TfrmSysSett.Create(Application);
GPSClientLanguageUtils.TranslateLanguage(frmSysSett);
frmSysSett.Execute;
end;
//------------------------------------------------------------------------------
// 执行方法
//------------------------------------------------------------------------------
function TfrmSysSett.Execute: Boolean;
var
active_map_frame: TFramMap;
active_viewer : TGIS_ViewerWnd;
begin
// 显示参数
Options2UI;
Result := ShowModal = mrOk;
// 是否提交
if Result then
begin
// 取得数据
UI2Options;
// 写入配置文件
WriteIni;
// 变更内存中的参数
frmMain.SetLookFeel(gLookFeel);
// TGPSClientCarInfoListDisplay.FillList(frmMain.lvCarInfoList, []);
frmMain.IsTree := False;
frmMain.IsGroupTree := False;
TGPSClientCarInfoListDisplay.FillvTTree(frmMain.vtCarinfoTree, []);
// frmMain.TargetDelAll;
// 重新调整列
TGPSClientCarInfoListDisplay.RefreshActiveVehicleList(nil, frmMain.vtActiveVehicle);
// 刷新活动目标列表
frmMain.vtActiveVehicle.Invalidate;
if Assigned(frmCmdSend) then
TGPSClientCarInfoListDisplay.FillvTTree(frmCmdSend.vtCarInfo, [gpsClientVehicleInfoColumnOptionSendResult]);
frmMain.SetAllTargetName;
frmMain.SetAllTargetTrack;
frmMain.SetAllTargetInfo(gTargetHintShow);
frmMain.TargetCommander1.TrackCacheSize := gTrackPtCount;
active_viewer := frmMain.ActiveMapView;
active_map_frame := frmMain.ActiveMapFrame;
if Assigned(active_viewer) and Assigned(active_map_frame) then
begin
active_viewer.Color := cbGISBkgColor.ColorValue;
active_map_frame.GIS_ControlScale1.Color := cbRulerBkgColor.ColorValue;
active_map_frame.GIS_ControlScale1.InterColor1 := cbRulerInterColor1.ColorValue;
active_map_frame.GIS_ControlScale1.InterColor2 := cbRulerInterColor2.ColorValue;
end;
end;
end;
//------------------------------------------------------------------------------
// 用户界面和配置参数的数据交换
//------------------------------------------------------------------------------
procedure TfrmSysSett.UI2Options;
var
i : Integer;
p_info_column : PGPSClientVehicleInfoColumn;
setting_str : string;
begin
gLookFeel := TLookFeel(cbLookFeel.ItemIndex);
gTargetHintShow := TTargetHintShow(cbTargetShowHint.ItemIndex);
// 默认呼叫、默认回放
gDefCallInterval := StrToIntDef(cbCallInterval.Text, 15);
gDefCallTimes := StrToIntDef(cbCallTimes.Text, 15);
gDefReplayInterval := StrToIntDef(cbRepalyInterval.Text, 100);
gPopOnEm := Boolean(cbPopOnEm.ItemIndex);
gPopOnMsg := Boolean(cbPopOnMsg.ItemIndex);
gSysAutoCall := cbAutoCall.Checked;
// 保存字段配置文件
// 遍历所有 车辆信息复选列表框 的项目
gShowCarInfo := '';
for i := 0 to clbCarInfoTypeSet.Items.count - 1 do
begin
p_info_column := PGPSClientVehicleInfoColumn(FVehicleInfoFieldList.Items[i]);
p_info_column^.FieldInfo^.ShowInListView :=
clbCarInfoTypeSet.Items[i].State = cbsChecked;
if clbCarInfoTypeSet.Items[i].State = cbsChecked then
begin
setting_str := Format('%s=%d', [
p_info_column^.FieldInfo^.FieldName, p_info_column^.FieldInfo^.ColumnWidth]);
if gShowCarInfo = '' then
gShowCarInfo := setting_str
else
gShowCarInfo := gShowCarInfo + ',' + setting_str;
end;
end;
gShowCarInfoActive := '';
// 活动车辆列表设置
for i := 0 to clbCarInfoTypeSet.Items.count - 1 do
begin
p_info_column := PGPSClientVehicleInfoColumn(FVehicleInfoFieldList.Items[i]);
if p_info_column^.FieldInfo^.IsInput then
Continue;
if p_info_column^.IsShowInActive then
begin
if gShowCarInfoActive = '' then
gShowCarInfoActive := p_info_column^.FieldInfo^.FieldName
else
gShowCarInfoActive := gShowCarInfoActive + ',' + p_info_column^.FieldInfo^.FieldName;
end;
end;
// ShowTrackType
gShowTrackType := TShowTrackType(rgTrackType.ItemIndex);
// 目标轨迹点数目
gTrackPtCount := integer(EdTrackPtCount.Value);
// 跟踪新数据
gTrackNewData := cxCheckTrackNew.Checked;
// GIS显示风格
gFullExtentViewAll := ckbFullExtentViewAll.Checked;
frmMain.ActiveMapFrame.Viewer.FullExtentViewAll := gFullExtentViewAll;
gFullExtentSearch := ckbFullExtentSearch.Checked;
gIsShowRoadName := ckbIsShowRoadName.Checked;
gAppVersionName := edtVerionName.Text;
// 定制选项
// 状态
gShowDebugInfo := ckbIsShowDebugLog.Checked;
gSysAutoCancelAlert := ckbIsAutoCancelAlarm.Checked;
storeGPSDescFilter;
// 定位数据
gTrackGenOper := ckbIsTrackGenOper.Checked;
gShowDacoity := ckbIsEnableTrackHijack.Checked;
gIgnorCompensate := ckbIsIgnoreAdditionalTrack.Checked;
gEmSpeedSlowEnable := ckbIsGenLowSpeedAlarm.Checked;
gEmSpeedSlow := StrToIntDef(edtLowSpeedAlarmValue.Text, 0);
// 保存轨迹数据转换器设置
storeGPSTrackConverter;
// 业务
gOverSpeedNormal := ckbIsNormalizeSpeedAlarm.Checked;
gDoorAlert := ckbIsGenDoorOpen.Checked;
gEmAreaEnable := ckbIsGenEFenAlarm.Checked;
gEmLaterEnable := ckbIsGenLateAlarm.Checked;
gShowMessages := ckbIsShowMessage.Checked;
frmMain.FIgnorOper := ckbIsIgnorNormalOper.Checked;
storeOperationFilter;
if gAppVersionName <> '' then
frmMain.Caption := gTitle + '(' + gAppVersionName + ')'
else
frmMain.Caption := gTitle;
//ShowTargetLabel
gShowTargetLabel := rgTargetLabel.ItemIndex;
// 轨迹回放
gShowQryGetRoadName := cbxShowRoadName.Checked;
gIsShowStopSect := cbxShowStopSect.Checked;
gShowQryResultStirCan := cbxShowStirCan.Checked;
gShowQryResultVehicleName := cbxQryResult.Items.Items[1].Checked;
gShowQryResultTimeSect := cbxQryResult.Items.Items[2].Checked;
gShowQryResultRecordCount := cbxQryResult.Items.Items[3].Checked;
gShowQryResultMileage := cbxQryResult.Items.Items[4].Checked;
gShowQryResultAverageSpeed := cbxQryResult.Items.Items[5].Checked;
gShowQryResultOilCost := cbxQryResult.Items.Items[6].Checked;
gShowQryResultOilFee := cbxQryResult.Items.Items[7].Checked;
gShowQryResultInvalidRate := cbxQryResult.Items.Items[8].Checked;
gShowQryResultValidRate := cbxQryResult.Items.Items[9].Checked;
if Assigned(frmReplay) then
begin
TGPSClientCarInfoListDisplay.InitialColumns(nil, frmReplay.VtQryGps, [gpsClientVehicleInfoColumnOptionTrackReplayData]);
frmReplay.IniQryResult;
frmReplay.IniStopSectTree;
frmReplay.IniValidGpsDataTree;
frmReplay.IniInvalidGpsDataTree;
frmReplay.IniStirCanGpsDataTree;
end;
end;
procedure TfrmSysSett.Options2UI;
var
i : Integer;
item_index : Integer;
active_map_frame : TFramMap;
active_viewer : TGIS_ViewerWnd;
p_info_column : PGPSClientVehicleInfoColumn;
check_list_item : TcxCheckListBoxItem;
begin
// 外观风格
cbLookFeel.ItemIndex := Ord(gLookFeel);
cbTargetShowHint.ItemIndex := Ord(gTargetHintShow);
// 呼叫间隔
item_index := cbCallInterval.Items.IndexOf(IntToStr(gDefCallInterval));
if item_index <> -1 then
cbCallInterval.ItemIndex := item_index
else
cbCallInterval.ItemIndex := 0;
// 呼叫次数
item_index := cbCallTimes.Items.IndexOf(IntToStr(gDefCallTimes));
if item_index <> -1 then
cbCallTimes.ItemIndex := item_index
else
cbCallTimes.ItemIndex := 0;
// 通大版本隐藏 呼叫间隔与次数 设置
if gVersionFlag = 69 then
begin
if gTongDaClient = 0 then
begin
pnlCallOption.Visible := False;
pnlNotice.Top := 50;
end;
end;
// 回放间隔 信息/报警提示 自动呼叫
cbRepalyInterval.Text := IntToStr(gDefReplayInterval);
cbPopOnEm.ItemIndex := Integer(gPopOnEm);
cbPopOnMsg.ItemIndex := Integer(gPopOnMsg);
cbAutoCall.Checked := gSysAutoCall;
clbCarInfoTypeSet.Clear;
clearVehicleInfoFieldList;
// 遍历车辆信息列定义列表
for i := 0 to GPSClientCarInfoColumnList.Count - 1 do
begin
p_info_column := PGPSClientVehicleInfoColumn(GPSClientCarInfoColumnList.Objects[i]);
// 如果不是输入字段
if not p_info_column^.FieldInfo^.IsInput then
begin
// 字段名无效,跳过
if p_info_column^.FieldInfo^.FieldName = '' then
Continue;
end;
// 跳过指令发送结果字段
if p_info_column^.IsCommnd then
Continue;
FVehicleInfoFieldList.Add(p_info_column);
check_list_item := clbCarInfoTypeSet.Items.Add;
check_list_item.Text := p_info_column^.FieldInfo^.FieldCaption;
if p_info_column^.FieldInfo^.ShowInListView then
check_list_item.State := cbsChecked
else
check_list_item.State := cbsUnchecked;
if (p_info_column^.FieldInfo^.FieldName = 'CarCode') or
(p_info_column^.FieldInfo^.FieldName = 'RegistrationNO') or
// (p_info_column^.FieldInfo^.FieldName = 'CarOwnerName') or
(p_info_column^.FieldInfo^.FieldName = 'OwnerName') then
begin
check_list_item.State := cbsChecked;
check_list_item.Enabled := False;
end;
end;
// 轨迹显示方式
rgTrackType.ItemIndex:= Ord(gShowTrackType);
//目标轨迹点数目
EdTrackPtCount.Value := frmMain.TargetCommander1.TrackCacheSize;
//跟踪新数据
cxCheckTrackNew.Checked := gTrackNewData;
//ShowTargetLabel
rgTargetLabel.ItemIndex := gShowTargetLabel;
active_viewer := frmMain.ActiveMapView;
active_map_frame := frmMain.ActiveMapFrame;
// GIS显示风格
ckbFullExtentViewAll.Checked := gFullExtentViewAll;
ckbFullExtentSearch.Checked := gFullExtentSearch;
ckbIsShowRoadName.Checked := gIsShowRoadName;
edtVerionName.Text := gAppVersionName;
// 颜色
if Assigned(active_viewer) and Assigned(active_map_frame) then
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -