GeoFence_Old.cs 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. // using System;
  2. // using System.Collections.Generic;
  3. // using System.Drawing;
  4. // using System.Globalization;
  5. // using System.IO;
  6. // using System.Linq;
  7. // using InABox.Core;
  8. //
  9. // namespace Comal.Classes
  10. // {
  11. //
  12. //
  13. // public class GeoJSONCrsProperties
  14. // {
  15. // public string Name { get; set; }
  16. // }
  17. //
  18. // public class GeoJSONCrs
  19. // {
  20. // public string Type { get; set; }
  21. // public GeoJSONCrsProperties Properties { get; set; }
  22. // }
  23. //
  24. // public class GeoJSONFeatureGeometry
  25. // {
  26. // public string Type { get; set; }
  27. // public List<List<List<List<float>>>> Coordinates { get; set; }
  28. //
  29. // public List<PointF> Points()
  30. // {
  31. // var result = new List<PointF>();
  32. // var list = Coordinates?.FirstOrDefault()?.FirstOrDefault() ?? new List<List<float>>();
  33. // foreach (var item in list)
  34. // {
  35. // if (item.Count == 2)
  36. // result.Add(new PointF(item[0], item[1]));
  37. // }
  38. // return result;
  39. // }
  40. //
  41. // public Tuple<PointF,PointF> Bounds()
  42. // {
  43. // float minX = float.MaxValue, minY = float.MaxValue, maxX = float.MinValue, maxY = float.MinValue;
  44. // var points = Points();
  45. // foreach (var point in points)
  46. // {
  47. // if (point.X < minX) minX = point.X;
  48. // if (point.X > maxX) maxX = point.X;
  49. // if (point.Y < minY) minY = point.Y;
  50. // if (point.Y > maxY) maxY = point.Y;
  51. // }
  52. // return new Tuple<PointF,PointF>(new PointF(minX, minY), new PointF(maxX, maxY));
  53. // }
  54. // }
  55. //
  56. // public class GeoJSONFeatureProperties
  57. // {
  58. // public int? Land_ID { get; set; }
  59. // public string? Road_Number_type { get; set; }
  60. // public string? Road_Number_1 { get; set; }
  61. // public string? Road_Number_2 { get; set; }
  62. // public string? Lot_Number { get; set; }
  63. // public string? Road_Name { get; set; }
  64. // public string? Road_Type { get; set; }
  65. // public string? Road_Suffix { get; set; }
  66. // public string? Locality { get; set; }
  67. // public string? View_Scale { get; set; }
  68. // public double? ST_Area_Shape_ { get; set; }
  69. // public double? ST_Perimeter_Shape_ { get; set; }
  70. //
  71. // public string ID() => Land_ID?.ToString() ?? "";
  72. //
  73. // public string FullAddress() => $"{Street()} {Suburb()} {State()} {Country()}".Trim().ToUpper();
  74. //
  75. // public String Street()
  76. // {
  77. // List<String> result = new List<string>();
  78. // if (string.IsNullOrWhiteSpace(Lot_Number))
  79. // {
  80. // if (!string.IsNullOrWhiteSpace(Road_Number_2))
  81. // result.Add($"{Road_Number_1 ?? ""}/{Road_Number_2 ?? ""}");
  82. // else
  83. // result.Add(Road_Number_1 ?? "");
  84. // }
  85. // else
  86. // result.Add($"LOT {Lot_Number ?? ""}");
  87. // result.Add(Road_Name ?? "");
  88. // result.Add(Road_Type ?? "");
  89. //
  90. // return CultureInfo.CurrentCulture.TextInfo.ToTitleCase(string.Join(" ", result).ToLower());
  91. // }
  92. //
  93. // public String Suburb() => CultureInfo.CurrentCulture.TextInfo.ToTitleCase(Locality?.ToLower() ?? "");
  94. //
  95. // public String State() => "";
  96. //
  97. // public String Postcode() => "";
  98. //
  99. // public String Country() => "";
  100. //
  101. // }
  102. //
  103. // public class GeoJSONFeature
  104. // {
  105. // public string? Type { get; set; }
  106. //
  107. // public GeoJSONFeatureProperties? Properties { get; set; }
  108. //
  109. // public GeoJSONFeatureGeometry? Geometry { get; set; }
  110. //
  111. // }
  112. //
  113. // public class GeoJSONFile
  114. // {
  115. // public string? Type { get; set; }
  116. // public string? Name { get; set; }
  117. // public GeoJSONCrs? Crs { get; set; }
  118. // public List<GeoJSONFeature>? Features { get; set; }
  119. //
  120. // public static GeoJSONFile? Load(string filename)
  121. // {
  122. // var fs = new FileStream(filename, FileMode.Open);
  123. // var geojson = Serialization.Deserialize<GeoJSONFile>(fs);
  124. // return geojson;
  125. // }
  126. // }
  127. //
  128. // public class GeoFence : Entity, IRemotable, IPersistent
  129. // {
  130. // public String Street { get; set; }
  131. // public String City { get; set; }
  132. // public String State { get; set; }
  133. // public String Country { get; set; }
  134. // public String PostCode { get; set; }
  135. //
  136. // public string FullAddress { get; set; }
  137. //
  138. // public double MinX { get; set; }
  139. // public double MinY { get; set; }
  140. // public double MaxX { get; set; }
  141. // public double MaxY { get; set; }
  142. //
  143. // public string Geometry { get; set; }
  144. // }
  145. //
  146. // }