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:



253
254
255
256
257
258
259
260
261
262
263
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 253

def initialize(name, orientation) # :nodoc:
  super()
  @name = name
  @orientation =
    case orientation
    when String, Symbol
      NAMES_BY_VALUE.index(orientation.to_s.upcase).to_i
    else
      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.



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

def name
  @name
end

#orientationObject (readonly)

Gets enumerated value for orientation.



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

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_typenameObject



272
273
274
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 272

def wkt_typename
  "AXIS"
end