function TMDIChild.OpenMap(MapName:string):Boolean; var Files: string; begin try Files:=AppDir +'\maps\'+MapName+'\'+MapName+'.gst'; if fileexists(Files) then Map1.Geoset := Files; Result:=true; except Application.MessageBox('该地图不存在!','打开地图',MB_ICONERROR); Result:=false; end; end;
查找Feature:procedure TfrmNodeInfo.FindFeature(lyrName: string); var lyr: CMapXLayer; fftr: CMapXFindFeature; NodeName: string; begin with Child do begin lyr:= Map1.Layers.Item(lyrName); with DM.QryRunner do begin NodeName:= Trim(fieldbyname('DISTRICTCODE').asstring); end; if lyr.AllFeatures.Count > 0 then begin fftr := lyr.Find.Search(NodeName, EmptyParam); if (fftr.FindRC mod 10 = 1) then begin Map1.ZoomTo(Map1.Zoom, fftr.CenterX, fftr.CenterY); lyr.Selection.Replace(fftr); end; end; end; end;
var
Files: string;
begin
try
Files:=AppDir +'\maps\'+MapName+'\'+MapName+'.gst';
if fileexists(Files) then
Map1.Geoset := Files;
Result:=true;
except
Application.MessageBox('该地图不存在!','打开地图',MB_ICONERROR);
Result:=false;
end;
end;
var
lyr: CMapXLayer;
fftr: CMapXFindFeature;
NodeName: string;
begin with Child do
begin
lyr:= Map1.Layers.Item(lyrName); with DM.QryRunner do
begin
NodeName:= Trim(fieldbyname('DISTRICTCODE').asstring);
end; if lyr.AllFeatures.Count > 0 then
begin
fftr := lyr.Find.Search(NodeName, EmptyParam);
if (fftr.FindRC mod 10 = 1) then
begin
Map1.ZoomTo(Map1.Zoom, fftr.CenterX, fftr.CenterY);
lyr.Selection.Replace(fftr);
end;
end;
end;
end;
我的文件是.tab的文件,怎么可以载入呢?