📄 viewattra.pas
字号:
unit ViewAttra;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, MapObjects2_TLB, Controls, Forms, Dialogs,
Grids, ComCtrls;
type
TViewAttrFrm = class(TForm)
StringGrid1: TStringGrid;
StatusBar1: TStatusBar;
procedure StringGrid1Click(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
public
{ Public declarations }
end;
var
ViewAttrFrm: TViewAttrFrm;
implementation
uses Main;
{$R *.DFM}
procedure TViewAttrFrm.StringGrid1Click(Sender: TObject);
var
i,j: integer;
ExpressStr: string;
ThisTableDesc:ImoTableDesc;
Mypolygon: ImoPolygon;
Myfield: IMoField;
begin
ExpressStr:='';
i:= StringGrid1.Row;
//showmessage(intTostr(i));
ThisTableDesc:=coTableDesc.Create;
ThisTableDesc:=CurrentLayer.Records.TableDesc;
//if CurrentLayer.shapeType<>moShapeTypePoint then
for j:=0 to ThisTableDesc.FieldCount-1 do
begin
Case ThisTableDesc.FieldType[j] of
MoString:
ExpressStr:=ExpressStr+' '+StringGrid1.Cells[j,0]+'='+Chr(39)+StringGrid1.Cells[j,i]+Chr(39);
else
ExpressStr:=ExpressStr+' '+StringGrid1.Cells[j,0]+'='+StringGrid1.Cells[j,i];
end;
if ExpressStr<>''then
ExpressStr:=ExpressStr+' '+'and';
end;
delete(ExpressStr,length(ExpressStr)-3,3);
// showmessage(ExpressStr);
MainFrm.FindRecord:= CurrentLayer.SearchExpression(ExpressStr);
if not MainFrm.FindRecord.EOF then
begin
Myfield:= MainFrm.FindRecord.Fields.Item('shape');
Mypolygon := IMoPolygon(IDispatch(Myfield.value));
mainfrm.mainmap.CenterAt(Mypolygon.Centroid.x,Mypolygon.centroid.y);
if MainFrm.Mnzl.Checked then mainFrm.ShowZl();//调出资料
MainFrm.Mainmap.FlashShape(MainFrm.FindRecord.Fields.Item('Shape').Value,4);
MainFrm.FindRecord:=nil;
end;
MainFrm.Mainmap.Refresh;
end;
procedure TViewAttrFrm.FormActivate(Sender: TObject);
begin
StatusBar1.Panels[0].Text:='共有'+ intTostr(StringGrid1.RowCount-1) +'条记录';
end;
procedure TViewAttrFrm.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
mainFrm.MnVAttrabute.Checked:=false;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -