Class: RGeo::CoordSys::CS::AxisInfo

Inherits:
Base
  • Object
show all
Defined in:
lib/rgeo/coord_sys/cs/entities.rb

Overview

OGC spec description

Details of axis. This is used to label axes, and indicate the orientation.

Constant Summary collapse

NAMES_BY_VALUE =

:stopdoc:

['OTHER', 'NORTH', 'SOUTH', 'EAST', 'WEST', 'UP', 'DOWN']

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#_to_wkt, #eql?, #inspect, #to_s, #to_wkt

Constructor Details

#initialize(name_, orientation_) ⇒ AxisInfo

:startdoc:



246
247
248
249
250
251
252
253
254
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 246

def initialize(name_, orientation_)  # :nodoc:
  @name = name_
  case orientation_
  when ::String, ::Symbol
    @orientation = NAMES_BY_VALUE.index(orientation_.to_s.upcase).to_i
  else
    @orientation = orientation_.to_i
  end
end

Instance Attribute Details

#nameObject (readonly)

Human readable name for axis. Possible values are “X”, “Y”, “Long”, “Lat” or any other short string.



259
260
261
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 259

def name
  @name
end

#orientationObject (readonly)

Gets enumerated value for orientation.



262
263
264
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 262

def orientation
  @orientation
end

Class Method Details

.create(name_, orientation_) ⇒ Object

Creates an AxisInfo. you must pass the human readable name for the axis (e.g. “X”, “Y”, “Long”, “Lat”, or other short string) and either an integer orientation code or a string. Possible orientation values are “OTHER”, “NORTH”, “SOUTH”, “EAST”, “WEST”, “UP”, and “DOWN”, or the corresponding integer values 0-5.



285
286
287
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 285

def create(name_, orientation_)
  new(name_, orientation_)
end

Instance Method Details

#_wkt_content(open_, close_) ⇒ Object

:nodoc:



269
270
271
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 269

def _wkt_content(open_, close_)  # :nodoc:
  [NAMES_BY_VALUE[@orientation]]
end

#_wkt_typenameObject

:nodoc:



265
266
267
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 265

def _wkt_typename  # :nodoc:
  "AXIS"
end