3 using System.Collections.Generic;
4 using System.Collections.ObjectModel;
6 using System.Runtime.Serialization.Formatters.Binary;
19 private List<Lane> lanes =
new List<Lane>();
23 public ReadOnlyCollection<Lane> Lanes {
get {
return lanes.AsReadOnly(); } }
28 public bool IsEmpty {
get {
return lanes.Count == 0; } }
45 using (FileStream fs =
new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.None))
47 new BinaryFormatter().Serialize(fs,
this);
58 using (FileStream fs =
new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read))
61 if (loadedTopology.lanes == null)
63 loadedTopology.lanes =
new List<Lane>();
65 return loadedTopology;
Class representing geometric topology of road network.
void Serialize(string path)
Save geometric topology to file.
static GeometricTopology Deserialize(string path)
Load geometric topology from file.
void AddLane(Lane newLane)
Adds new lane to geometric topology.