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



148
149
150
# File 'lib/rgeo/impl_helper/basic_line_string_methods.rb', line 148

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

#geometry_typeObject



144
145
146
# File 'lib/rgeo/impl_helper/basic_line_string_methods.rb', line 144

def geometry_type
  Feature::Line
end

#initialize(factory, start, stop) ⇒ Object



134
135
136
137
138
139
140
141
142
# File 'lib/rgeo/impl_helper/basic_line_string_methods.rb', line 134

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