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


121
122
123
# File 'lib/rgeo/impl_helper/basic_line_string_methods.rb', line 121

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

#geometry_typeObject


117
118
119
# File 'lib/rgeo/impl_helper/basic_line_string_methods.rb', line 117

def geometry_type
  Feature::Line
end

#initialize(factory, start, stop) ⇒ Object


105
106
107
108
109
110
111
112
113
114
115
# File 'lib/rgeo/impl_helper/basic_line_string_methods.rb', line 105

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