class Terraformer::GeometryCollection

Attributes

geometries[W]

Public Class Methods

new(*args) click to toggle source
Calls superclass method Terraformer::Primitive::new
# File lib/terraformer/geometry.rb, line 134
def initialize *args
  unless args.empty?
    super *args do |arg|
      self.geometries = arg['geometries'].map {|g| Terraformer.parse g}
    end
  end
end

Public Instance Methods

convex_hull() click to toggle source
# File lib/terraformer/geometry.rb, line 153
def convex_hull
  ConvexHull.for geometries.map &:coordinates
end
geometries() click to toggle source
# File lib/terraformer/geometry.rb, line 142
def geometries
  @geometries ||= []
end
to_hash(*args) click to toggle source
# File lib/terraformer/geometry.rb, line 146
def to_hash *args
  {
    type: type,
    geometries: geometries.map {|g| g.to_hash *args}
  }
end