📄 unitproject.~pas
字号:
unit UnitProject;
interface
uses
Windows, Messages, SysUtils, Classes, Controls, MapXLib_TLB, Dialogs,
MapXTools, Menus, Forms, ComCtrls, MapXContainer, MapXDrv, MapXBase,
UnitAppTypes, UnitAppConsts, UnitRecords;
type
TGISProjectClass=class of TGISProject;
{一般GIS工程类}
TGISProject=class
private
FGMapTools:TMapCtrlTools;
FOnTurnTool: TNotifyEvent;
FRegOwnerName: string;
FProjectName: string;
protected
procedure RegisterProjectStyles; virtual;
procedure RegisterProjectTools; virtual;
public
constructor Create(AOwner:TComponent; MapX:TMapXObject); virtual;
destructor Destroy; override;
//-----------------------------------------------------------------------//
{应用权限}
procedure DoApplayFunctions; virtual;
{检查是否有权操作}
function CheckFunction(ActionId:Integer):Boolean; virtual;
{设置属性对话框}
procedure DoOnCtrlPropDialog(Sender:TObject; ActionId:Integer; Ft:Feature); virtual;
{开始动作}
procedure DoBeginAction(ActionId:Integer; var Cancel:Boolean); virtual;
{结束动作}
procedure DoEndAction(ActionId:Integer); virtual;
{图形删除前}
procedure DoBeforeDelete(Ft:Feature; ActionId:Integer); virtual;
{图形创建后}
procedure DoFeatureCreate(Ft:Feature; ActionId:Integer); virtual;
{双击图形}
procedure DoFeatureDblClick(Sender:TObject; Ft:Feature); virtual;
{填写网格数据}
function DoWriteDataGridData(AGridFrame:TFrame_Records):Boolean; virtual;
{设置页显示}
procedure SetGISPageVisible(const PageID:Integer; const Value:Boolean); virtual;
//-----------------------------------------------------------------------//
{增加本地图层到工程}
procedure AddLayerToProject(ALyr:CMapXLayer; ALayerInfo:TLayerTreeNodeRecord;
const FCId:Integer); virtual; abstract;
{从工程下载图层}
procedure DownloadProjectLayer(ALyr:CMapXLayer; ALayerInfo:TLayerTreeNodeRecord;
const LayerName, Path:string); virtual; abstract;
{工程实例加载,包括连接数据库、加载所有系统图层等操作}
procedure LoadProject; virtual;
{加载地图}
procedure LoadMaps(const ItemIndex:Integer); virtual;
{创建业务菜单项}
procedure LoadBusinessMenuItems(AMenuItem:TMenuItem); virtual;
{注册命令}
procedure RegisterCmdCtrlGroups; virtual; abstract;
{加载父实例模块}
procedure LoadParentInstanceModules; virtual;
//-----------------------------------------------------------------------//
property ProjectName:string read FProjectName write FProjectName;
property RegOwnerName:string read FRegOwnerName write FRegOwnerName;
property GMapTools:TMapCtrlTools read FGMapTools;
property OnTurnTool:TNotifyEvent read FOnTurnTool write FOnTurnTool;
end;
implementation
uses
MapXAdvance, MainFormInstance, UnitSearch, UnitDrawShape;
{ TGISProject }
function TGISProject.CheckFunction(ActionId: Integer): Boolean;
begin
Result:=True;
end;
constructor TGISProject.Create(AOwner:TComponent; MapX:TMapXObject);
var
aItem:TBaseMapTool;
begin
inherited Create;
//创建地图操作工具对象//
FGMapTools:=CreateMapToolsObject(AOwner, MapX);
//注册所有的Style//
RegisterProjectStyles;
//注册所有的用户工具//
RegisterProjectTools;
//设置所有LayerManager的OnCtrlPropDialog//
FGMapTools.m_Layer.OnCtrlPropDialog:=DoOnCtrlPropDialog;
aItem:=FGMapTools.m_Map.UserTools.FindByClassName('TPointSelectTool');
TPointSelectTool(aItem).LayerManager.OnCtrlPropDialog:=DoOnCtrlPropDialog;
end;
destructor TGISProject.Destroy;
begin
FGMapTools.Free;
inherited Destroy;
end;
procedure TGISProject.DoApplayFunctions;
begin
end;
procedure TGISProject.DoBeforeDelete(Ft: Feature; ActionId:Integer);
begin
end;
procedure TGISProject.DoBeginAction(ActionId: Integer; var Cancel:Boolean);
begin
end;
procedure TGISProject.DoEndAction(ActionId: Integer);
begin
end;
procedure TGISProject.DoFeatureCreate(Ft: Feature; ActionId:Integer);
begin
end;
procedure TGISProject.DoFeatureDblClick(Sender: TObject; Ft: Feature);
begin
end;
procedure TGISProject.DoOnCtrlPropDialog(Sender: TObject; ActionId:Integer; Ft: Feature);
begin
end;
function TGISProject.DoWriteDataGridData(
AGridFrame: TFrame_Records): Boolean;
begin
Result:=False;
end;
procedure TGISProject.LoadBusinessMenuItems(AMenuItem: TMenuItem);
begin
end;
procedure TGISProject.LoadMaps(const ItemIndex: Integer);
begin
end;
procedure TGISProject.LoadParentInstanceModules;
begin
end;
procedure TGISProject.LoadProject;
begin
end;
procedure TGISProject.RegisterProjectStyles;
begin
end;
procedure TGISProject.RegisterProjectTools;
begin
end;
procedure TGISProject.SetGISPageVisible(const PageID: Integer;
const Value: Boolean);
begin
case PageID of
ID_PAGE_DATA:begin
if Value then
begin
if Form_Main.tsData<>nil then Exit;
Form_Main.tsData:=TTabSheet.Create(Form_Main);
with Form_Main.tsData do
begin
PageControl:=Form_Main.pcControl;
Caption:='属性数据';
Name:='tsData';
Tag:=ID_PAGE_DATA;
end;
Form_Main.ScrollBox1:=TScrollBox.Create(Form_Main);
with Form_Main.ScrollBox1 do
begin
Parent:=Form_Main.tsData;
Align:=alClient;
end;
end
else
begin
if Form_Main.tsData=nil then Exit;
Form_Main.tsData.Free;
Form_Main.tsData:=nil;
Form_Main.ScrollBox1:=nil;
end;
end;
ID_PAGE_MSG:begin
if Value then
begin
if Form_Main.tsMessage<>nil then Exit;
Form_Main.tsMessage:=TTabSheet.Create(Form_Main);
with Form_Main.tsMessage do
begin
PageControl:=Form_Main.pcControl;
Caption:='消息窗口';
Name:='tsMessage';
Tag:=ID_PAGE_MSG;
end;
Form_Main.RichEdit_UserMsg:=TRichEdit.Create(Form_Main);
with Form_Main.RichEdit_UserMsg do
begin
Parent:=Form_Main.tsMessage;
Align:=alClient;
end;
end
else
begin
if Form_Main.tsMessage=nil then Exit;
Form_Main.tsMessage.Free;
Form_Main.tsMessage:=nil;
Form_Main.RichEdit_UserMsg:=nil;
end;
end;
ID_PAGE_SEARCH:begin
if Value then
begin
if Form_Main.tsSearch<>nil then Exit;
Form_Main.tsSearch:=TTabSheet.Create(Form_Main);
with Form_Main.tsSearch do
begin
PageControl:=Form_Main.pcControl;
Caption:='查询窗口';
Name:='tsSearch';
Tag:=ID_PAGE_SEARCH;
end;
Form_Main.ScrollBox2:=TScrollBox.Create(Form_Main);
with Form_Main.ScrollBox2 do
begin
Parent:=Form_Main.tsSearch;
Align:=alClient;
end;
Form_Main.Frame_Search1:=TFrame_Search.Create(Form_Main);
with Form_Main.Frame_Search1 do
begin
Parent:=Form_Main.ScrollBox2;
Align:=alTop;
end;
end
else
begin
if Form_Main.tsSearch=nil then Exit;
Form_Main.tsSearch.Free;
Form_Main.tsSearch:=nil;
Form_Main.ScrollBox2:=nil;
Form_Main.Frame_Search1:=nil;
end;
end;
ID_PAGE_DRAW:begin
if Value then
begin
if Form_Main.tsDraw<>nil then Exit;
Form_Main.tsDraw:=TTabSheet.Create(Form_Main);
with Form_Main.tsDraw do
begin
PageControl:=Form_Main.pcControl;
Caption:='制图窗口';
Name:='tsDraw';
Tag:=ID_PAGE_DRAW;
end;
Form_Main.ScrollBox3:=TScrollBox.Create(Form_Main);
with Form_Main.ScrollBox3 do
begin
Parent:=Form_Main.tsDraw;
Align:=alClient;
end;
Form_Main.Frame_DrawShape1:=TFrame_DrawShape.Create(Form_Main);
with Form_Main.Frame_DrawShape1 do
begin
Parent:=Form_Main.ScrollBox3;
Align:=alTop;
end;
end
else
begin
if Form_Main.tsDraw=nil then Exit;
Form_Main.tsDraw.Free;
Form_Main.tsDraw:=nil;
Form_Main.ScrollBox3:=nil;
Form_Main.Frame_DrawShape1:=nil;
end;
end;
end;
if Form_Main.pcControl.PageCount=0 then
Form_Main.pcControl.Height:=0
else if Form_Main.pcControl.Height=0 then
Form_Main.pcControl.Height:=200;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -