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

📄 childwin.pas

📁 Del_att Management
💻 PAS
字号:
unit CHILDWIN;

interface

uses Windows, Classes, Graphics, Forms, Controls, StdCtrls, OleCtrls,SysUtils,
  EDITVIEWLib_TLB,GISATTEDITLib_TLB,MAPGISBASCOM1LIB_TLB,MAPGISDspCOMLib_TLB,ExtCtrls;
type
  TMDIChild = class(TForm)
    EditView: TEditView;
    gisattedit:Tgisattedit;
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure FormDestroy(sender: TObject);
    procedure editviewmouseLbuttonDown(sender:TObject;xpos,ypos:Double);
    procedure editviewmouseRBubbonUp(sender:TObject;xpos,ypos:Double);
    procedure editviewmousePosition(sender:TObject;xpos,ypos:Double);
    procedure mydraw(Sender: TObject; const MpDC: IDispatch);
    procedure ResizeForm(Sender: TObject);
    Function myBrowOrEditAttStru(aiType:Enum_Entity_Type;Editable:Integer):integer;
    procedure active(Sender: TObject);
  private

    { Private declarations }
  public
  ai:Iworkarea;
  aiType:Integer;
  isBrowAtt:Integer;
  procedure mybroworeditatt(aiType:Enum_Entity_Type;Editable:Integer);
  procedure mybroworeditatt_close(aitype:enum_entity_type;editable:integer);
  procedure savefile();
  procedure savefileas();

    { Public declarations }
end;
implementation
{$R *.dfm}
uses unit1, MAIN;

procedure TMDIChild.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  Action := caFree;
end;


//关闭子窗口
procedure TMDIChild.FormDestroy(sender:TObject);
begin
  if ai<>nil then
  ai:=nil;
end;


procedure TMDIChild.editviewmouseLbuttonDown(sender:TObject;xpos,ypos:Double);
begin
  editview.SetFocus;
end;

procedure TMDIChild.editviewmouseRBubbonUp(sender:TObject;xpos,ypos:Double);
begin
  editview.SetFocus;
end;

//状态栏的第二个状态条显示鼠标处于编辑视图中的坐标位置
procedure TMDIChild.editviewmousePosition(sender:TObject;xpos,ypos:Double);
var
  str:string;
begin
  str:='    x的坐标:'+FloatToStrF(xpos,ffFixed,8,3)+'    y的坐标:'+FloatToStrF(ypos,ffFixed,8,3);
  mainform.StatusBar.Panels[1].Text:=str;
  end;
//浏览或编辑属性结构
Function tmdichild.myBrowOrEditAttStru(aiType:Enum_Entity_Type;Editable:Integer):integer;
var
  pntai:ipntarea;
  linai:ilinarea;
  netai:inetarea;
  tblai:itblarea;
  regai:iregarea;
  stru:irecord_head;
  struDlg:TAttStruDlg;
  isOK:integer;
  myform:tmdichild;
begin
  myform:=mainform.activemdichild as tmdichild;
if aitype=myform.aiType then
 begin
  myBrowOrEditAttStru:=0;
  if ai<>nil then
  begin
     case aitype of
       gispnt:
        pntai:=ai as ipntarea;
       gislin:
        linai:=ai as ilinarea;
       gisreg:
        regai:=ai as iregarea;
       gistbl:
        tblai:=ai as itblarea;
       gisnet:
        netai:=ai as inetarea;
       else
        exit;
     end;//(end case)
  end;//(end if)
    case aitype of
      gispnt_entity:
        stru:=pntai.att.stru.Clone;
      gislin_entity:
        if linai<>nil then
          stru:=linai.att.stru.Clone
        else
           if regai<>nil then
             stru:=regai.LinAtt.stru.Clone
           else
             if netai<>nil then
               stru:=netai.LinAtt.stru.Clone;
      gisreg_entity:
        stru:=regai.RegAtt.stru.Clone;
      gistbl_entity:
        stru:=tblai.stru.Clone;
      gisnet_entity:
        stru:=netai.NetAtt.stru.Clone;
      gisnod_entity:
        if regai<>nil then
           stru:=regai.NodAtt.stru.Clone
        else
          if netai<>nil then
             stru:=netai.NodAtt.stru.Clone;
      end;//(end case)
      strudlg:=Tattstrudlg.Create(application);
      strudlg.Hide;
      strudlg.browOrEditattstru(stru,editable);
      strudlg.ShowModal;
    //if 1
    if isOK=1 then
    begin
      //if 2
      if editable=1 then
      begin
         case aitype of
             gispnt_entity:
                pntai.att.stru:=stru;
             gislin_entity:
                if linai<>nil then
                   linai.att.stru:=stru
                else
                  begin
                    if regai <>nil then
                    regai.linatt.stru:=stru
                    else
                    if netai <>nil then
                      netai.linatt.stru:=stru;
                  end;
             gisreg_entity:
                regai.regatt.stru:=stru;
             gistbl_entity:
                tblai.stru:=stru;
             gisnet_entity:
                netai.netatt.stru:=stru;
             gisnod_entity:
                if regai <>nil then
                   regai.nodatt.stru:=stru
                else
                begin
                  if netai <>nil then
                     netai.nodatt.stru:=stru
                  else
                    exit;
                end;
         end;//(end case)
       end;//(end if 2)
    end;//(end if 1)
  strudlg:=nil;
  stru:=nil;
  pntai:=nil;
  netai:=nil;
  linai:=nil;
  regai:=nil;
  tblai:=nil;
  mybroworeditattstru:=1;
 end;
end;
//显示工作区
procedure TMDIChild.mydraw(Sender: TObject; const MpDC: IDispatch);
var
  mapDC:iMapGisDC;
begin
  mapDC:= mpDC as imapgisdc;
  mapDC.DispArea (ai,0);
  mapDC := nil;
end;

//保存当前文件
procedure TMDIChild.savefile();
begin
  if ai <> nil then
      ai.Save('','','','');
end;
//另存当前文件
procedure TMDIChild.savefileas();
var
  myform:TMDIChild;
begin
  if ai<>nil then
    if ai.SaveAs() then
    myform.Caption:=ai.Name;
end;

//浏览或编辑属性
procedure TMDIChild.mybroworeditatt(aiType: Enum_Entity_Type;Editable: Integer);
var
  myform:tmdichild;
begin
  myform:=mainform.activemdichild as tmdichild;
if aitype=myform.aiType then
 begin
 if Ai<>nil  Then
    begin
    GisAttEdit.AttachArea(ai,aitype);
    GisAttEdit.EditEnable:= Editable;
    EditView.AttachAttWorkArea(ai);
    end;
    isBrowAtt := 1;
    ResizeForm(NIL);
 end;
end;
//关闭(浏览或编辑)属性
procedure TMDIChild.mybroworeditatt_close(aitype:enum_entity_type;editable:integer);
begin
  if ai<>nil then
  begin
  isbrowatt:=0;
  resizeform(nil);
  gisattedit.DetachArea;
  editview.AttachAttWorkArea(nil);
  editview.StopFlash;
  end;
end;

//重新设置控件的大小
procedure TMDIChild.ResizeForm(Sender: TObject);
begin
  if isbrowatt=0 then
    if aitype=gisTBL then
      //只显示属性编辑控件
      begin
      editview.Left:=0;
      editview.Top:=0;
      editview.Height :=0;
      editview.Width:=0;
      gisattedit.Left:=0;
      gisattedit.Top:=0;
      gisattedit.Height:=clientheight;
      gisattedit.Width:=clientwidth;
      end
    else
      //只显示编辑视图控件
      begin
      editview.Left:=0;
      editview.Top:=0;
      editview.Height:=clientheight;
      editview.Width:=clientwidth;
      gisattedit.Left:=0;
      gisattedit.Top:=0;
      gisattedit.Height:=0;
      gisattedit.Width:=0;
      end
  else
      begin
        if aitype=gistbl then
          begin
          //只显示属性编辑控件
          editview.Left:=0;
          editview.Top:=0;
          editview.Height:=0;
          editview.Width:=0;
          gisattedit.Left:=0;
          gisattedit.Top:=0;
          gisattedit.Height:=clientHeight;
          gisattedit.Width:=clientheight;
          end
        else
          begin
          //编辑视图控件和属性编辑控件各占窗口的1/2
          editview.Left:=0;
          editview.Top:=0;
          editview.Height:=clientheight div 2;
          editview.Width:=clientwidth;
          gisattedit.Left:=0;
          gisattedit.Top:=clientheight div 2;
          gisattedit.Height:=clientheight div 2;
          gisattedit.Width:=clientwidth;

          end
    end
end;
//激活子窗口
procedure TMDIChild.active(Sender: TObject);
begin
  updatemainmenu();
end;

end.

⌨️ 快捷键说明

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