Class: RGeo::CoordSys::CS::CompoundCoordinateSystem

Inherits:
CoordinateSystem show all
Defined in:
lib/rgeo/coord_sys/cs/entities.rb

Overview

OGC spec description

An aggregate of two coordinate systems (CRS). One of these is usually a CRS based on a two dimensional coordinate system such as a geographic or a projected coordinate system with a horizontal datum. The other is a vertical CRS which is a one-dimensional coordinate system with a vertical datum.

Instance Attribute Summary collapse

Attributes inherited from CoordinateSystem

#dimension

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, head, tail, *optional) ⇒ CompoundCoordinateSystem

:nodoc:


945
946
947
948
949
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 945

def initialize(name, head, tail, *optional) # :nodoc:
  super(name, head.dimension + tail.dimension, *optional)
  @head = head
  @tail = tail
end

Instance Attribute Details

#headObject (readonly)

Gets first sub-coordinate system.


952
953
954
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 952

def head
  @head
end

#tailObject (readonly)

Gets second sub-coordinate system.


955
956
957
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 955

def tail
  @tail
end

Class Method Details

.create(name, head, tail, *optional) ⇒ Object

Create a CompoundCoordinateSystem given two sub-coordinate systems. You may also provide the optional parameters specified by the Info interface.


980
981
982
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 980

def create(name, head, tail, *optional)
  new(name, head, tail, *optional)
end

Instance Method Details

#get_axis(index) ⇒ Object

Implements CoordinateSystem#get_axis


959
960
961
962
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 959

def get_axis(index)
  hd = @head.dimension
  index < hd ? @head.get_axis(index) : @tail.get_axis(index - hd)
end

#get_units(index) ⇒ Object

Implements CoordinateSystem#get_units


966
967
968
969
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 966

def get_units(index)
  hd = @head.dimension
  index < hd ? @head.get_units(index) : @tail.get_units(index - hd)
end

#wkt_typenameObject


971
972
973
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 971

def wkt_typename
  "COMPD_CS"
end