Map > Map Assembly Interfaces > IMapTopobase > IMapTopobase.SaveToFile
SaveToFile(FileName: String);
FileName. Name of the file, to which a topobase will be saved.
The SaveToFile method saves a topobase to a file.
Executing the example requires a form with the following components: the Button component named Button1, the MapBox component named MapBox1, and the UiMap component named UiMap1. UiMap1 is a data source for MapBox1. The file system should include the C:\MAP_RF.tbs file containing a topobase.
The example is a handler of the OnClick event for the Button1 component.
Add links to the ExtCtrls, Forms, Map, Metabase, and Ui system assemblies.
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
MetaBase: IMetabase;
TopoBase: IMapTopobase;
Map: IMap;
Begin
MetaBase := MetabaseClass.Active;
TopoBase := MetaBase.ItemById("MAP_RF").Bind As IMapTopobase;
Map := UiMap1.Map;
Map.Topobase := TopoBase;
TopoBase.SaveToFile("C:\MAP_RF.tbs");
WinApplication.InformationBox("Topobase '" + TopoBase.Name + "' is saved to file");
End Sub Button1OnClick;
After executing the example the MAP_RF map is loaded to the MapBox component. Then the topobase is saved to the C:\MAP_RF.tbs file, and an appropriate information message is displayed.
See also: