Class: Neo4j::Driver::Types::Point
- Inherits:
-
Object
- Object
- Neo4j::Driver::Types::Point
- Defined in:
- lib/neo4j/driver/types/point.rb
Constant Summary collapse
- SRID =
{ 'WGS-84': 4326, 'WGS-84-3D': 4979, cartesian: 7203, 'cartesian-3D': 9157 }.with_indifferent_access.freeze
Instance Attribute Summary collapse
-
#srid ⇒ Object
Returns the value of attribute srid.
-
#x ⇒ Object
Returns the value of attribute x.
-
#y ⇒ Object
Returns the value of attribute y.
-
#z ⇒ Object
Returns the value of attribute z.
Instance Method Summary collapse
- #coordinates ⇒ Object
-
#initialize(args) ⇒ Point
constructor
A new instance of Point.
Constructor Details
#initialize(args) ⇒ Point
Returns a new instance of Point.
16 17 18 19 20 21 |
# File 'lib/neo4j/driver/types/point.rb', line 16 def initialize(args) self.x = args[:longitude] || args[:x] self.y = args[:latitude] || args[:y] self.z = args[:height] || args[:z] self.srid = args[:srid] || SRID[args[:crs] || implied_crs(args[:longitude] || args[:latitude])] end |
Instance Attribute Details
#srid ⇒ Object
Returns the value of attribute srid.
7 8 9 |
# File 'lib/neo4j/driver/types/point.rb', line 7 def srid @srid end |
#x ⇒ Object
Returns the value of attribute x.
7 8 9 |
# File 'lib/neo4j/driver/types/point.rb', line 7 def x @x end |
#y ⇒ Object
Returns the value of attribute y.
7 8 9 |
# File 'lib/neo4j/driver/types/point.rb', line 7 def y @y end |
#z ⇒ Object
Returns the value of attribute z.
7 8 9 |
# File 'lib/neo4j/driver/types/point.rb', line 7 def z @z end |
Instance Method Details
#coordinates ⇒ Object
23 24 25 |
# File 'lib/neo4j/driver/types/point.rb', line 23 def coordinates [x, y, z].compact.map(&:to_f) end |