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].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#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.


277
278
279
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 277

def create(name, orientation)
  new(name, orientation)
end

Instance Method Details

#wkt_typenameObject


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

def wkt_typename
  "AXIS"
end