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 CoordinateSystem

create_from_wkt, #geographic?, #projected?, #transform_coords

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:



988
989
990
991
992
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 988

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.



995
996
997
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 995

def head
  @head
end

#tailObject (readonly)

Gets second sub-coordinate system.



998
999
1000
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 998

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.



1023
1024
1025
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 1023

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

Instance Method Details

#get_axis(index) ⇒ Object

Implements CoordinateSystem#get_axis



1002
1003
1004
1005
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 1002

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



1009
1010
1011
1012
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 1009

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

#wkt_typenameObject



1014
1015
1016
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 1014

def wkt_typename
  "COMPD_CS"
end