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

Constructor Details

#initialize(name_, orientation_) ⇒ AxisInfo

:startdoc:


300
301
302
303
304
305
306
307
308
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 300

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.


313
314
315
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 313

def name
  @name
end

#orientationObject (readonly)

Gets enumerated value for orientation.


316
317
318
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 316

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.


339
340
341
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 339

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

Instance Method Details

#_wkt_content(open_, close_) ⇒ Object

:nodoc:


323
324
325
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 323

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

#_wkt_typenameObject

:nodoc:


319
320
321
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 319

def _wkt_typename  # :nodoc:
  "AXIS"
end