Class: GeoScript::Geom::Point

Inherits:
JTSPoint
  • Object
show all
Includes:
GeoScript::Geom
Defined in:
lib/geoscript/geom/point.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(*coords) ⇒ Point

Returns a new instance of Point.



11
12
13
14
15
16
17
18
19
20
# File 'lib/geoscript/geom/point.rb', line 11

def initialize(*coords)
  if coords.first.kind_of? JTSPoint
    p = coords.first
  else
    c = Coordinate.new coords[0], coords[1]
    c.z = coords[2] if coords[2]
    p = GEOM_FACTORY.create_point c
  end
  super p.coordinate_sequence, GEOM_FACTORY
end

Instance Attribute Details

#boundsObject

Returns the value of attribute bounds.



9
10
11
# File 'lib/geoscript/geom/point.rb', line 9

def bounds
  @bounds
end

Instance Method Details

#buffer(dist) ⇒ Object



22
23
24
# File 'lib/geoscript/geom/point.rb', line 22

def buffer(dist)
  Polygon.new super
end

#to_jsonObject



34
35
36
# File 'lib/geoscript/geom/point.rb', line 34

def to_json
  IO.write_json self
end

#to_wkbObject



30
31
32
# File 'lib/geoscript/geom/point.rb', line 30

def to_wkb
  IO.write_wkb self
end

#to_wktObject



26
27
28
# File 'lib/geoscript/geom/point.rb', line 26

def to_wkt
  IO.write_wkt self
end