Class: RGeo::CoordSys::CS::Unit
- 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
Instance Attribute Summary collapse
-
#conversion_factor ⇒ Object
readonly
This field is not part of the OGC CT spec, but is part of the SFS.
Attributes inherited from Info
#abbreviation, #alias, #authority, #authority_code, #name, #remarks
Class Method Summary collapse
-
.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.
Instance Method Summary collapse
-
#_wkt_content(_open_, _close_) ⇒ Object
:nodoc:.
-
#_wkt_typename ⇒ Object
:nodoc:.
-
#initialize(name_, conversion_factor_, *optional_) ⇒ Unit
constructor
:nodoc:.
Methods inherited from Info
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_, conversion_factor_, *optional_) ⇒ Unit
:nodoc:
482 483 484 485 |
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 482 def initialize(name_, conversion_factor_, *optional_) # :nodoc: super(name_, *optional_) @conversion_factor = conversion_factor_.to_f end |
Instance Attribute Details
#conversion_factor ⇒ Object (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.
490 491 492 |
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 490 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.
506 507 508 |
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 506 def create(name_, conversion_factor_, *optional_) new(name_, conversion_factor_, *optional_) end |
Instance Method Details
#_wkt_content(_open_, _close_) ⇒ Object
:nodoc:
496 497 498 |
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 496 def _wkt_content(_open_, _close_) # :nodoc: [@conversion_factor] end |
#_wkt_typename ⇒ Object
:nodoc:
492 493 494 |
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 492 def _wkt_typename # :nodoc: "UNIT" end |