unitfeatureconfig.~pas

来自「此代码是关于mapgis的在」· ~PAS 代码 · 共 99 行

~PAS
99
字号
unit UnitFeatureConfig;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, MapXContainer, Global;

type
  TForm_FeatureConfig = class(TForm)
    GroupBox1: TGroupBox;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Edit1: TEdit;
    ComboBox1: TComboBox;
    Button1: TButton;
    Button2: TButton;
    procedure Button1Click(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    FBFt: TBusinessFeature;
    FFcItem: TFeatureClass;
    FIsOk: Boolean;
    FMode: TConfigMode;
    { Private declarations }
  public
    { Public declarations }
    property FcItem:TFeatureClass read FFcItem write FFcItem;
    property BFt:TBusinessFeature read FBFt write FBFt;
    property Mode:TConfigMode read FMode write FMode;
    property IsOk:Boolean read FIsOk;
  end;

var
  Form_FeatureConfig: TForm_FeatureConfig;

function AddFeatueItem(aFcItem:TFeatureClass):TBusinessFeature;
function ModifyFeatureItem(aBFt:TBusinessFeature):Boolean;

implementation

uses
  MapXBase;

{$R *.dfm}

function AddFeatueItem(aFcItem:TFeatureClass):TBusinessFeature;
begin
  with TForm_FeatureConfig.Create(nil) do
  begin
    try
      FcItem:=aFcItem;
      ShowModal;
      Result:=BFt;
    finally
      Free;
    end;
  end;
end;

function ModifyFeatureItem(aBFt:TBusinessFeature):Boolean;
begin
  with TForm_FeatureConfig.Create(nil) do
  begin
    try
      BFt:=aBFt;
      ShowModal;
      Result:=IsOk;
    finally
      Free;
    end;
  end;
end;

procedure TForm_FeatureConfig.Button1Click(Sender: TObject);
begin
  if Mode=cmAdd then
    BFt:=FcItem.FeatureList.Add;
  BFt.FeatureName:=Edit1.Text;
  BFt.FeatureType:=TShapeType(ComboBox1.ItemIndex+1);
//  BFt.StyleId:=GMapTools.m_Map.UserStyles
  FIsOk:=True;
  Close;
end;

procedure TForm_FeatureConfig.FormShow(Sender: TObject);
begin
  FIsOk:=False;
end;

procedure TForm_FeatureConfig.Button2Click(Sender: TObject);
begin
  Close;
end;

end.

⌨️ 快捷键说明

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