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:

%w(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, #encode_with, #eql?, #hash, #init_with, #inspect, #marshal_dump, #marshal_load, #to_s, #to_wkt

Constructor Details

#initialize(name_, orientation_) ⇒ AxisInfo

:startdoc:



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

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.



281
282
283
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 281

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

Instance Method Details

#_wkt_content(_open_, _close_) ⇒ Object

:nodoc:



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

def _wkt_content(_open_, _close_) # :nodoc:
  [NAMES_BY_VALUE[@orientation]]
end

#_wkt_typenameObject

:nodoc:



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

def _wkt_typename # :nodoc:
  "AXIS"
end