Class: RGeo::CoordSys::CS::Unit

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

Overview

OGC spec description

Base interface for defining units.

Notes

Normally, you will instantiate one of the subclasses LinearUnit or AngularUnit. However, it is possible to instantiate Unit if it is not clear whether the data refers to a LinearUnit or AngularUnit.

Direct Known Subclasses

AngularUnit, LinearUnit

Instance Attribute Summary collapse

Attributes inherited from Info

#abbreviation, #alias, #authority, #authority_code, #name, #remarks

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Info

#extension

Methods inherited from Base

#encode_with, #eql?, #hash, #init_with, #inspect, #marshal_dump, #marshal_load, #to_s, #to_wkt

Constructor Details

#initialize(name, conversion_factor, *optional) ⇒ Unit

:nodoc:


485
486
487
488
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 485

def initialize(name, conversion_factor, *optional) # :nodoc:
  super(name, *optional)
  @conversion_factor = conversion_factor.to_f
end

Instance Attribute Details

#conversion_factorObject (readonly)

This field is not part of the OGC CT spec, but is part of the SFS. It is an alias of the appropriate field in the subclass, i.e. LinearUnit#meters_per_unit or AngularUnit#radians_per_unit.


493
494
495
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 493

def conversion_factor
  @conversion_factor
end

Class Method Details

.create(name, conversion_factor, *optional) ⇒ Object

Create a bare Unit that does not specify whether it is a LinearUnit or an AngularUnit, given a unit name and a conversion factor. You may also provide the optional parameters specified by the Info interface.


505
506
507
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 505

def create(name, conversion_factor, *optional)
  new(name, conversion_factor, *optional)
end

Instance Method Details

#wkt_typenameObject


495
496
497
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 495

def wkt_typename
  "UNIT"
end