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


156
157
158
# File 'lib/rgeo/impl_helper/basic_line_string_methods.rb', line 156

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

#geometry_typeObject


152
153
154
# File 'lib/rgeo/impl_helper/basic_line_string_methods.rb', line 152

def geometry_type
  Feature::Line
end

#initialize(factory, start, stop) ⇒ Object


140
141
142
143
144
145
146
147
148
149
150
# File 'lib/rgeo/impl_helper/basic_line_string_methods.rb', line 140

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