-
Notifications
You must be signed in to change notification settings - Fork 1
/
TileServerConfiguration.cs
49 lines (41 loc) · 982 Bytes
/
TileServerConfiguration.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
using System;
using StereoKit;
using SimpleJSON;
namespace DutchSkies
{
public class TileServerConfiguration
{
public string id;
public string type;
public string[] urls;
public static TileServerConfiguration FromJSON(JSONNode spec)
{
TileServerConfiguration tsc = new TileServerConfiguration(spec["id"], spec["type"]);
JSONArray jurls = spec["urls"].AsArray;
string[] urls = new string[jurls.Count];
for (int i = 0; i < jurls.Count; i++)
urls[i] = jurls[i];
tsc.urls = urls;
return tsc;
}
public TileServerConfiguration(string id, string type)
{
this.id = id;
this.type = type;
if (type != "osm")
Log.Warn($"Unknown tile server type '{type}'");
}
/*
public string ToJSON()
{
JSONNode root = new JSONObject();
root["id"] = id;
root["type"] = type;
root["urls"] = new JSONArray();
foreach (string u in urls)
root["urls"].Add(new JSONString(u));
return root;
}
*/
}
}