?? 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 + -