epgsql_geometry.hrl 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. -type point_type() :: '2d' | '3d' | '2dm' | '3dm'.
  2. -record(point,{
  3. point_type :: point_type(),
  4. x :: float(),
  5. y :: float(),
  6. z :: float(),
  7. m :: float()
  8. }).
  9. -type point(PointType) :: #point{ point_type :: PointType }.
  10. -record(multi_point,{
  11. point_type :: PointType,
  12. points :: [point(PointType)]
  13. }).
  14. -type multi_point(PointType) :: #multi_point{ point_type :: PointType }.
  15. -record(line_string,{
  16. point_type :: PointType,
  17. points :: [point(PointType)]
  18. }).
  19. -type line_string(PointType) :: #line_string{ point_type :: PointType }.
  20. -record(multi_line_string,{
  21. point_type :: PointType,
  22. line_strings :: [line_string(PointType)]
  23. }).
  24. -type multi_line_string(PointType) :: #multi_line_string{ point_type :: PointType }.
  25. -record(circular_string,{
  26. point_type :: PointType,
  27. points :: [point(PointType)]
  28. }).
  29. -type basic_string(PointType) :: #circular_string{ point_type :: PointType } | #line_string{ point_type :: PointType }.
  30. -record(compound_curve,{
  31. point_type :: PointType,
  32. lines :: [basic_string(PointType)]
  33. }).
  34. -type curve(PointType) :: #circular_string{ point_type :: PointType } | #line_string{ point_type :: PointType } | #compound_curve{ point_type :: PointType }.
  35. -record(multi_curve,{
  36. point_type :: PointType,
  37. curves :: [curve(PointType)]
  38. }).
  39. -type multi_curve(PointType) :: #multi_curve{ point_type :: PointType }.
  40. -record(polygon,{
  41. point_type :: PointType,
  42. rings :: [line_string(PointType)]
  43. }).
  44. -type polygon(PointType) :: #polygon{ point_type :: PointType }.
  45. -record(multi_polygon,{
  46. point_type :: PointType,
  47. polygons :: [polygon(PointType)]
  48. }).
  49. -type multi_polygon(PointType) :: #multi_polygon{ point_type :: PointType }.
  50. -record(triangle,{
  51. point_type :: PointType,
  52. rings :: [line_string(PointType)]
  53. }).
  54. -type triangle(PointType) :: #triangle{ point_type :: PointType }.
  55. -record(curve_polygon,{
  56. point_type :: PointType,
  57. rings :: [curve(PointType)]
  58. }).
  59. -type curve_polygon(PointType) :: #curve_polygon{ point_type :: PointType }.
  60. -record(polyhedral_surface,{
  61. point_type :: PointType,
  62. polygons :: [polygon(PointType)]
  63. }).
  64. -type polyhedral_surface(PointType) :: #polyhedral_surface{ point_type :: PointType }.
  65. -type surface(PointType) :: polygon(PointType) | curve_polygon(PointType) | polyhedral_surface(PointType).
  66. -record(multi_surface,{
  67. point_type :: PointType,
  68. surfaces :: [surface(PointType)]
  69. }).
  70. -type multi_surface(PointType) :: #multi_surface{ point_type :: PointType }.
  71. -record(tin,{
  72. point_type :: PointType,
  73. triangles :: [triangle(PointType)]
  74. }).
  75. -type tin(PointType) :: #tin{ point_type :: PointType }.
  76. -type geometry(PointType) :: point(PointType) |
  77. line_string(PointType) |
  78. triangle(PointType) |
  79. tin(PointType) |
  80. curve(PointType) |
  81. surface(PointType) |
  82. multi_point(PointType) |
  83. multi_line_string(PointType) |
  84. multi_polygon(PointType) |
  85. multi_curve(PointType) |
  86. multi_surface(PointType) |
  87. geometry_collection(PointType).
  88. -type geometry() :: geometry(point_type()).
  89. -type geometry_collection(PointType) :: [geometry(PointType)].