-
Notifications
You must be signed in to change notification settings - Fork 52
/
Copy pathBalloonFeatures.cs
32 lines (29 loc) · 1016 Bytes
/
BalloonFeatures.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
using System;
using SharpKml.Dom;
using SharpKml.Engine;
namespace Examples
{
/// <summary>
/// Iterates over all the Features in a Kml file and displays an information balloon
/// </summary>
public static class BalloonFeatures
{
public static void Run()
{
KmlFile file = Program.OpenFile("Enter a file to show the features of:");
if ((file != null) && (file.Root != null))
{
var mapper = new EntityMapper(file);
foreach (Element element in file.Root.Flatten())
{
if (element is Feature feature)
{
string name = feature.Name ?? "Unnamed feature";
string balloon = mapper.CreateBalloonText(feature);
Console.WriteLine("Feature balloon text for '{0}'\n{1}\n", name, balloon);
}
}
}
}
}
}