Tree: String;
Tree: string;
The Tree property returns the topobase tree-structure.
Using the tree-structure, by means of the ITopobase.GetSpecificTopobase method it is possible to create custom topobases on base of existing topobases.
Executing the example requires a form containing the MapBox component with the MapBox1 identifier and the UiMap component with the UiMap1 identifier. The map must be loaded in the UiMap1 component and the component must be the data source for the MapBox1 component.
Add links to the Topobase system assembly.
Sub UserProc;
Var
Map: IMap;
Topo, SpecTopo: ITopobase;
Tree: String;
Begin
// Get map
Map := UiMap1.Map;
// Get topobase
Topo := Map.Topobase As ITopobase;
// Get topobase tree-structure
Tree := Topo.Tree;
// Display it to the console window
Debug.WriteLine(Tree);
// Set new tree-structure for topobase
Tree := "<Topobase><Layer Name=" + """" + "RootLayer" + """" + " Id=" + """" + "1" + """" +
"><Layer Name=" + """" + "Regions" + """" + " Id=" + """" + "2" + """" +
"><Shape Name=" + """" + "Republic Adygea" + """" + " Id=" + """" + "135" + """" + "/></Layer></Layer></Topobase>";
// Get topobase based on the new tree-structure
SpecTopo := Topo.GetSpecificTopobase(Tree, True);
// Display the new topobase in the UiMap1 component
Map.Topobase := SpecTopo As IMapTopobase;
End Sub UserProc;
After executing the example the zoomed fragment of the initial map will be displayed in the UiMap1 component.
The requirements and result of the Fore.NET example execution match with those in the Fore example. Use Fore.NET analogs instead of Fore components.
Imports Prognoz.Platform.Interop.Map;
Imports Prognoz.Platform.Interop.Topobase;
…
Public Sub UserProc();
Var
Map: IMap;
Topo, SpecTopo: ITopobase;
Tree: String;
Begin
// Get map
Map := uiMapNet1.MapUi.Map;
// Get topobase
Topo := Map.Topobase As ITopobase;
// Get topobase tree-structure
Tree := Topo.Tree;
// Display it to the console window
System.Diagnostics.Debug.WriteLine(Tree);
// Set new tree-structure for topobase
Tree := "<Topobase><Layer Name=" + """" + "RootLayer" + """" + " Id=" + """" + "1" + """" +
"><Layer Name=" + """" + "Regions" + """" + " Id=" + """" + "2" + """" +
"><Shape Name=" + """" + "Republic Adygea" + """" + " Id=" + """" + "135" + """" + "/></Layer></Layer></Topobase>";
// Get topobase based on the new tree-structure
SpecTopo := Topo.GetSpecificTopobase(Tree, True);
// Display the new topobase in the UiMap1 component
Map.Topobase := SpecTopo As DxMapTopobase;
End Sub UserProc;
See also: