RealWorldTerrainPOI.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /* INFINITY CODE 2013-2019 */
  2. /* http://www.infinity-code.com */
  3. using System;
  4. using System.Xml;
  5. using UnityEngine;
  6. namespace InfinityCode.RealWorldTerrain
  7. {
  8. /// <summary>
  9. /// Class points of interest.
  10. /// </summary>
  11. [Serializable]
  12. public class RealWorldTerrainPOI
  13. {
  14. /// <summary>
  15. /// The title of the POI.
  16. /// </summary>
  17. public string title;
  18. /// <summary>
  19. /// Longitude.
  20. /// </summary>
  21. public double x;
  22. /// <summary>
  23. /// Latitude.
  24. /// </summary>
  25. public double y;
  26. /// <summary>
  27. /// Altitude
  28. /// </summary>
  29. public float altitude;
  30. public GameObject prefab;
  31. public RealWorldTerrainPOI()
  32. {
  33. }
  34. /// <summary>
  35. /// Constructor.
  36. /// </summary>
  37. /// <param name="title">POI title.</param>
  38. /// <param name="x">Longitude.</param>
  39. /// <param name="y">Latitude.</param>
  40. public RealWorldTerrainPOI(string title, double x, double y, float altitude = 0)
  41. {
  42. this.title = title;
  43. this.x = x;
  44. this.y = y;
  45. this.altitude = altitude;
  46. }
  47. public RealWorldTerrainPOI(XmlNode node)
  48. {
  49. try
  50. {
  51. x = RealWorldTerrainXMLExt.GetAttribute<double>(node, "x");
  52. y = RealWorldTerrainXMLExt.GetAttribute<double>(node, "y");
  53. title = node.InnerText;
  54. }
  55. catch (Exception e)
  56. {
  57. Debug.Log(e.Message);
  58. throw;
  59. }
  60. }
  61. }
  62. }