Class: RGeo::CoordSys::CS::Base

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

Overview

This is a base class for all OGC coordinate system objects. This includes both interfaces and data types from the OGC Coordinate Transformation spec.

This is a non-instantiable abstract class.

Instance Method Summary collapse

Instance Method Details

#_to_wkt(open_, close_) ⇒ Object

:nodoc:



214
215
216
217
218
219
220
221
222
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 214

def _to_wkt(open_, close_)  # :nodoc:
  content_ = _wkt_content(open_, close_).map{ |obj_| ",#{obj_}" }.join
  if defined?(@authority) && @authority
    authority_ = ",AUTHORITY#{open_}#{@authority.inspect},#{@authority_code.inspect}#{close_}"
  else
    authority_ = ''
  end
  "#{_wkt_typename}#{open_}#{@name.inspect}#{content_}#{authority_}#{close_}"
end

#eql?(rhs_) ⇒ Boolean Also known as: ==

Tests for equality. Two objects are defined as equal if they have the same type (class) and the same WKT representation.

Returns:

  • (Boolean)


190
191
192
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 190

def eql?(rhs_)
  rhs_.class == self.class && rhs_.to_wkt == self.to_wkt
end

#inspectObject

:nodoc:



182
183
184
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 182

def inspect  # :nodoc:
  "#<#{self.class}:0x#{object_id.to_s(16)} #{to_wkt}>"
end

#to_sObject

Returns the default WKT representation.



198
199
200
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 198

def to_s
  to_wkt
end

#to_wkt(opts_ = {}) ⇒ Object

Computes the WKT representation. Options include:

:standard_brackets

If set to true, outputs parentheses rather than square brackets. Default is false.



209
210
211
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 209

def to_wkt(opts_={})
  opts_[:standard_brackets] ? _to_wkt('(', ')') : _to_wkt('[', ']')
end