class GeoScript::Geom::LineString
Attributes
bounds[RW]
Public Class Methods
new(*coords)
click to toggle source
Calls superclass method
# File lib/geoscript/geom/linestring.rb, line 11 def initialize(*coords) if coords.size == 1 if coords.first.kind_of? JTSLineString elsif coords.kind_of? Array if coords.first.kind_of? Array l = [] coords.first.each do |coord| l << Coordinate.new(coord[0], coord[1]) l.last.z = coord[2] if coord[2] end if l.size > 0 ls = GEOM_FACTORY.create_line_string l.to_java(com.vividsolutions.jts.geom.Coordinate) end end end else l = [] coords.each do |coord| l << Coordinate.new(coord[0], coord[1]) l.last.z = coord[2] if coord[2] end if l.size > 0 ls = GEOM_FACTORY.create_line_string l.to_java(com.vividsolutions.jts.geom.Coordinate) end end if ls super(ls.coordinate_sequence, GEOM_FACTORY) else raise 'LineString could not be created. Check inputs.' end end
Public Instance Methods
buffer(dist)
click to toggle source
Calls superclass method
GeoScript::Geom::buffer
# File lib/geoscript/geom/linestring.rb, line 44 def buffer(dist) Polygon.new super end
to_json()
click to toggle source
# File lib/geoscript/geom/linestring.rb, line 56 def to_json IO.write_json self end
to_wkb()
click to toggle source
# File lib/geoscript/geom/linestring.rb, line 52 def to_wkb IO.write_wkb self end
to_wkt()
click to toggle source
# File lib/geoscript/geom/linestring.rb, line 48 def to_wkt IO.write_wkt self end