Beispiel #1
0
        public static string getJson(List <Station> stations, Dictionary <ushort, MapTransportLine> transportLines)
        {
            var cto = new CityTransportObject
            {
                transportLines = transportLines
            };

            return(cto.toJson());
        }
Beispiel #2
0
 /// <summary>
 /// The header.<>
 /// 0 = Height
 /// 1 = Width
 /// </summary>
 public string getHtmlHeader(int height, int width, CityTransportObject cto)
 {
     return($@"
      <!DOCTYPE html><html><head> <meta charset='UTF-8'> 
      <style>{KlyteResourceLoader.LoadResourceString("MapDrawer.lineDrawBasicCss.css") }</style>
      <script src=""https://code.jquery.com/jquery-3.3.1.min.js"" integrity=""sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="" crossorigin=""anonymous""></script>
      <script>var _infoLines = {cto.toJson()};</script>
      <script>{KlyteResourceLoader.LoadResourceString("MapDrawer.app.js") }</script>
      </head><body>
      <style id=""styleSelectionLineMap""></style>
      <svg id=""map"" height='{height}' width='{width}'>
      <defs>
      <marker orient=""auto"" markerHeight=""6"" markerWidth=""6"" refY=""2.5"" refX=""1"" viewBox=""0 0 10 5"" id=""Triangle1""><path d=""M 0 0 L 10 2.5 L 0 5 z""/></marker>
      <marker orient=""auto"" markerHeight=""6"" markerWidth=""6"" refY=""2.5"" refX=""1"" viewBox=""0 0 10 5"" id=""Triangle2""><path d=""M 10 0 L 0 2.5 L 10 5 z""/></marker>
      </defs>");
 }
        public static string printToJson(List <Station> stations, Dictionary <ushort, MapTransportLine> transportLines, string mapName)
        {
            CityTransportObject cto = new CityTransportObject
            {
                transportLines = transportLines
            };

            String folder = "Transport Lines Manager";

            TLMUtils.EnsureFolderCreation(folder);
            String filename = folder + Path.DirectorySeparatorChar + "TLM_MAP_" + mapName + ".json";

            if (File.Exists(filename))
            {
                File.Delete(filename);
            }
            var sr = File.CreateText(filename);

            sr.WriteLine(cto.toJson());
            sr.Close();
            return(filename);
        }