Class: GeoScript::Geom::MultiLineString

Inherits:
JTSMultiLineString
  • Object
show all
Includes:
GeoScript::Geom
Defined in:
lib/geoscript/geom/multilinestring.rb

Constant Summary

Constants included from GeoScript::Geom

GEOM_FACTORY, PREP_FACTORY

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from GeoScript::Geom

buffer, enhance, from_wkt, get_bounds, prepare, simplify, to_wkt

Constructor Details

#initialize(*line_strings) ⇒ MultiLineString

Returns a new instance of MultiLineString.



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/geoscript/geom/multilinestring.rb', line 10

def initialize(*line_strings)
  strings = []

  if line_strings.first.kind_of? JTSMultiLineString
    multi_line_string_geom = line_strings.first
    for i in range(0...multi_line_string_geom.num_geometries)
      strings << multi_line_string_geom.get_geometry_n(i)
    end
  else
    line_strings.each do |line_string|
      if line_string.kind_of? LineString
        strings << line_string
      else
        strings << LineString.new(*line_string)
      end
    end
  end

  super(strings.to_java(com.vividsolutions.jts.geom.LineString), GEOM_FACTORY)
end

Instance Attribute Details

#boundsObject

Returns the value of attribute bounds.



8
9
10
# File 'lib/geoscript/geom/multilinestring.rb', line 8

def bounds
  @bounds
end

Instance Method Details

#buffer(dist) ⇒ Object



31
32
33
# File 'lib/geoscript/geom/multilinestring.rb', line 31

def buffer(dist)
  Polygon.new super
end

#to_jsonObject



43
44
45
# File 'lib/geoscript/geom/multilinestring.rb', line 43

def to_json
  IO.write_json self
end

#to_wkbObject



39
40
41
# File 'lib/geoscript/geom/multilinestring.rb', line 39

def to_wkb
  IO.write_wkb self
end

#to_wktObject



35
36
37
# File 'lib/geoscript/geom/multilinestring.rb', line 35

def to_wkt
  IO.write_wkt self
end