Class: Charta::LineString

Inherits:
Geometry show all
Defined in:
lib/charta/line_string.rb

Overview

Represent a Geometry which contains points in a line string.

Instance Method Summary collapse

Methods inherited from Geometry

#!=, #==, #area, #bounding_box, #buffer, #centroid, #collection?, #convert_to, #difference, #empty?, #ewkt, factory, feature, #feature, #feature=, #find_srid, #flatten_multi, from_ewkt, from_rgeo, #initialize, #inspect, #intersection, #intersects?, #merge, #method_missing, #point_on_surface, #respond_to_missing?, #srid, srs_database, #surface?, #to_binary, #to_ewkt, #to_geojson, #to_json_feature, #to_json_object, #to_rgeo, #to_svg, #to_svg_path, #to_text, #transform, #type

Constructor Details

This class inherits a constructor from Charta::Geometry

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Charta::Geometry

Instance Method Details

#each_point(&block) ⇒ Object

Browse each point



5
6
7
8
9
10
11
12
13
# File 'lib/charta/line_string.rb', line 5

def each_point(&block)
  if block.arity == 1
    points.each(&block)
  elsif block.arity == 2
    points.each_with_index(&block)
  else
    raise 'Cannot browse each point without parameter'
  end
end

#pointsObject



15
16
17
18
19
# File 'lib/charta/line_string.rb', line 15

def points
  @points ||= feature.points.map do |point|
    Point.new(point)
  end || []
end