📄 main.~pas
字号:
unit MAIN;
interface
uses Windows, SysUtils, Classes, Graphics, Forms, Controls, Menus,Variants,
StdCtrls, Dialogs, Buttons, Messages, ExtCtrls, ComCtrls,OleCtrls,
MAPGISBASCOM1Lib_TLB,CHILDWIN;
type
TMainForm = class(TForm)
StatusBar: TStatusBar;
MainMenu1: TMainMenu;
IDMN_FILE: TMenuItem;
IDMN_FILE_PNT: TMenuItem;
IDMN_FILE_LIN: TMenuItem;
IDMN_FILE_REG: TMenuItem;
IDMN_FILE_NET: TMenuItem;
IDMN_FILE_TBL: TMenuItem;
IDMN_FILE_SEPERATOR1: TMenuItem;
IDMN_FILE_SAVE: TMenuItem;
IDMN_FILE_SAVE_AS: TMenuItem;
IDMN_FILE_SEPERATOR2: TMenuItem;
IDMN_FILE_EXIT: TMenuItem;
IDMN_STRU: TMenuItem;
IDMN_STRU_BROW: TMenuItem;
IDMN_STRU_EDIT: TMenuItem;
IDMN_STRU_BROW_PNT: TMenuItem;
IDMN_STRU_BROW_LIN: TMenuItem;
IDMN_STRU_BROW_REG: TMenuItem;
IDMN_STRU_BROW_NET: TMenuItem;
IDMN_STRU_BROW_TBL: TMenuItem;
IDMN_STRU_BROW_NOD: TMenuItem;
IDMN_STRU_EDIT_PNT: TMenuItem;
IDMN_STRU_EDIT_LIN: TMenuItem;
IDMN_STRU_EDIT_REG: TMenuItem;
IDMN_STRU_EDIT_NET: TMenuItem;
IDMN_STRU_EDIT_TBL: TMenuItem;
IDMN_STRU_EDIT_NOD: TMenuItem;
IDMN_ATT: TMenuItem;
IDMN_ATT_BROW: TMenuItem;
IDMN_ATT_EDIT: TMenuItem;
IDMN_ATT_PNT_BROW: TMenuItem;
IDMN_ATT_LIN_BROW: TMenuItem;
IDMN_ATT_REG_BROW: TMenuItem;
IDMN_ATT_BROW_SEPERATOR: TMenuItem;
IDMN_ATT_END_BROW: TMenuItem;
IDMN_ATT_PNT_EDIT: TMenuItem;
IDMN_ATT_LIN_EDIT: TMenuItem;
IDMN_ATT_REG_EDIT: TMenuItem;
IDMN_ATT_EDIT_SEPERATOR: TMenuItem;
IDMN_ATT_END_EDIT: TMenuItem;
IDMN_SETTING: TMenuItem;
IDMN_SETTING_MODENV: TMenuItem;
IDMN_SETTING_SEPERATOR: TMenuItem;
IDMN_SETTING_STATUSBAR: TMenuItem;
N1: TMenuItem;
About: TMenuItem;
procedure IDMN_FILE_PNTClick(Sender: TObject);
procedure IDMN_FILE_LINClick(Sender: TObject);
procedure IDMN_FILE_REGClick(Sender: TObject);
procedure IDMN_FILE_NETClick(Sender: TObject);
procedure IDMN_FILE_TBLClick(Sender: TObject);
procedure IDMN_FILE_SAVEClick(Sender: TObject);
procedure IDMN_FILE_EXITClick(Sender: TObject);
procedure IDMN_SETTING_MODENVClick(Sender: TObject);
procedure IDMN_FILE_SAVE_ASClick(Sender: TObject);
procedure IDMN_ATT_PNT_BROWClick(Sender: TObject);
procedure IDMN_ATT_LIN_BROWClick(Sender: TObject);
procedure IDMN_ATT_REG_BROWClick(Sender: TObject);
procedure IDMN_ATT_PNT_EDITClick(Sender: TObject);
procedure IDMN_ATT_LIN_EDITClick(Sender: TObject);
procedure IDMN_ATT_REG_EDITClick(Sender: TObject);
procedure IDMN_ATT_END_BROWClick(Sender: TObject);
procedure IDMN_ATT_END_EDITClick(Sender: TObject);
procedure IDMN_SETTING_STATUSBARClick(Sender: TObject);
procedure IDMN_STRU_BROW_PNTClick(Sender: TObject);
procedure IDMN_STRU_BROW_LINClick(Sender: TObject);
procedure IDMN_STRU_BROW_REGClick(Sender: TObject);
procedure IDMN_STRU_BROW_NETClick(Sender: TObject);
procedure IDMN_STRU_BROW_TBLClick(Sender: TObject);
procedure IDMN_STRU_BROW_NODClick(Sender: TObject);
procedure IDMN_STRU_EDIT_PNTClick(Sender: TObject);
procedure IDMN_STRU_EDIT_LINClick(Sender: TObject);
procedure IDMN_STRU_EDIT_REGClick(Sender: TObject);
procedure IDMN_STRU_EDIT_NETClick(Sender: TObject);
procedure IDMN_STRU_EDIT_TBLClick(Sender: TObject);
procedure IDMN_STRU_EDIT_NODClick(Sender: TObject);
procedure AboutClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
MainForm: TMainForm;
ai:Iworkarea;
aiType:Integer;
isbrow:integer;
isBrowAtt:Integer;
function loadfile(aiType:Enum_Area_Type):Integer;
function broworeditattstru(aitype:enum_entity_type;editable:integer):integer;
function BrowOrEditAtt( aiType : Enum_Entity_Type; Editable: Integer):integer;
function broworeditatt_close(aiType:Enum_Entity_Type; Editable: Integer):integer;
function updatemainmenu():integer;
implementation
{$R *.dfm}
uses Unit1, about,ComObj;
//导入相应的文件
function loadfile(aiType:Enum_Area_Type):integer;
var
pntai:ipntarea;
linai:ilinarea;
regai:iregarea;
netai:inetarea;
tblai:itblarea;
myform:TMDIChild;
val:integer;
begin
loadfile:=0;
val:=0;
isbrowatt:=0;
case aiType of
gispnt://装入点文件
begin
pntai:=CreateComObject(class_pntarea) as Ipntarea;
if pntai.Load('','','','') then
begin
myform := TMDIChild.Create(application);
loadfile:=1;
val:=1;
myform.Caption:=pntai.Name;
myform.ai:= pntai;
myform.aiType := gispnt;
myform.EditView.SetWinMapRange(pntai.rect.xmin,pntai.rect.ymin,
pntai.rect.xmax,pntai.rect.ymax);
end
end;
gislin://装入线文件
begin
linai:=CreateComObject(class_linarea) as Ilinarea;
if linai.load('','','','') then
begin
myform := TMDIChild.Create(application);
loadfile:=1;
val:=1;
myform.Caption:=linai.Name;
myform.aiType:=gislin;
myform.ai := linai;
myform.EditView.SetWinMapRange(linai.rect.xmin,linai.rect.ymin,
linai.rect.xmax,linai.rect.ymax);
end
end;
gisreg://装入区文件
begin
regai:=CreateComObject(class_regarea) as Iregarea;
if regai.load('','','','') then
begin
myform := TMDIChild.Create(application);
loadfile:=1;
val:=1;
myform.Caption:=regai.Name;
myform.aiType:=gisreg;
myform.ai:=regai;
myform.EditView.SetWinMapRange(regai.rect.xmin,regai.rect.ymin,
regai.rect.xmax,regai.rect.ymax);
end
end;
gisnet://装入网文件
begin
netai:=CreateComObject(class_netarea) as Inetarea;
if netai.load('','','','') then
begin
myform := TMDIChild.Create(application);
loadfile:=1;
val:=1;
myform.Caption:=netai.Name;
myform.aiType:=gisnet;
myform.ai:=netai;
myform.EditView.SetWinMapRange(netai.rect.xmin,netai.rect.ymin,
netai.rect.xmax,netai.rect.ymax);
end
end;
gistbl://装入表文件
begin
tblai:=CreateComObject(class_tblarea) as Itblarea;
if tblai.load('','','','') then
begin
myform := TMDIChild.Create(application);
loadfile:=1;
val:=1;
myform.Caption:=tblai.Name;
myform.aiType:=gistbl;
myform.ai:=tblai;
BrowOrEditAtt(gistbl_entity,0);
isbrowatt:=1;
end
end;
end;
if val=1 then
myform.resizeform(nil);
myform.EditView.RestoreWindow;
end;
//浏览编辑属性
Function BrowOrEditAtt(aiType:Enum_Entity_Type; Editable: Integer):integer;
var
myform :TMDIChild;
begin
If MainForm.ActiveMDIChild <>nil Then
begin
myform := MainForm.ActiveMDIChild as tmdichild;
myform.mybroworeditatt(aitype,editable);
end;
myform:= nil;
end;
//关闭(浏览或编辑)属性
function broworeditatt_close(aiType:Enum_Entity_Type; Editable: Integer):integer;
var
myform:TMDIChild;
begin
if mainform.ActiveMDIChild<>nil then
begin
myform:=mainform.ActiveMDIChild as tmdichild;
myform.mybroworeditatt_close(aitype,editable);
end;
broworeditatt_close:=1
end;
//浏览编辑属性结构
function broworeditattstru(aitype:enum_entity_type;editable:integer):integer;
var
myform:tmdichild;
begin
if mainform.activeMDIChild<>nil then
begin
myform:=mainform.ActiveMDIChild as TMDIChild;
myform.mybrowOrEditattstru(aitype,editable);
end;
myform:=nil;
end;
//打开点文件
procedure TMainForm.IDMN_FILE_PNTClick(Sender: TObject);
begin
loadfile(gispnt);
updatemainmenu();
end;
//打开线文件
procedure TMainForm.IDMN_FILE_LINClick(Sender: TObject);
begin
loadfile(gislin);
updatemainmenu();
end;
//打开区文件
procedure TMainForm.IDMN_FILE_REGClick(Sender: TObject);
begin
loadfile(gisreg);
updatemainmenu();
end;
//打开网文件
procedure TMainForm.IDMN_FILE_NETClick(Sender: TObject);
begin
loadfile(gisnet);
updatemainmenu();
end;
//打开表文件
procedure TMainForm.IDMN_FILE_TBLClick(Sender: TObject);
begin
loadfile(gistbl);
updatemainmenu();
end;
//保存
procedure TMainForm.IDMN_FILE_SAVEClick(Sender: TObject);
var
myform:TMDIChild;
begin
myform := ActiveMDIChild as tmdichild;
if myform<>nil then
myform.savefile();
myform:=nil;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -