Module: RGeo::ImplHelper::BasicLineMethods

Included in:
Cartesian::LineImpl, Geographic::ProjectedLineImpl, Geographic::SphericalLineImpl
Defined in:
lib/rgeo/impl_helper/basic_line_string_methods.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#coordinatesObject


171
172
173
# File 'lib/rgeo/impl_helper/basic_line_string_methods.rb', line 171

def coordinates
  @points.map(&:coordinates)
end

#geometry_typeObject


167
168
169
# File 'lib/rgeo/impl_helper/basic_line_string_methods.rb', line 167

def geometry_type
  Feature::Line
end

#initialize(factory, start, stop) ⇒ Object


155
156
157
158
159
160
161
162
163
164
165
# File 'lib/rgeo/impl_helper/basic_line_string_methods.rb', line 155

def initialize(factory, start, stop)
  self.factory = factory
  cstart = Feature.cast(start, factory, Feature::Point)
  unless cstart
    raise Error::InvalidGeometry, "Could not cast start: #{start}"
  end
  cstop = Feature.cast(stop, factory, Feature::Point)
  raise Error::InvalidGeometry, "Could not cast end: #{stop}" unless cstop
  @points = [cstart, cstop]
  validate_geometry
end