Sha256: 5d9bd9db548f11a775dfd474b98ccca87724ebd68ed946a386907337331a4b08
Contents?: true
Size: 1.01 KB
Versions: 3
Compression:
Stored size: 1.01 KB
Contents
module Terraformer class Circle extend Forwardable attr_accessor :polygon attr_reader :center, :radius, :resolution def_delegators :@polygon, :contains?, :within?, :intersects?, :to_feature, :to_json def initialize c, r, res = DEFAULT_BUFFER_RESOLUTION self.center = c self.radius = r self.resolution = res recalculate end def recalculate @polygon = @center.buffer @radius, @resolution @dirty = false self end def center= c c = Coordinate.from_array c if Array === c and Numeric === c[0] c = c.coordinates if Point === c raise ArgumentError unless Coordinate === c @center = c @dirty = true self end def radius= r raise ArgumentError unless Numeric === r @radius = r @dirty = true self end def resolution= res raise ArgumentError unless Fixnum === res @resolution = res @dirty = true self end def dirty? @dirty end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
terraformer-0.0.4 | lib/terraformer/circle.rb |
terraformer-0.0.3 | lib/terraformer/circle.rb |
terraformer-0.0.2 | lib/terraformer/circle.rb |