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:



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

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.



501
502
503
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 501

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.



513
514
515
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 513

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

Instance Method Details

#wkt_typenameObject



503
504
505
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 503

def wkt_typename
  "UNIT"
end