Sha256: b79864f82f17b4daff7a8a362a51e9e6fc3c2493ff08bfb28e6c8d858deb7302
Contents?: true
Size: 1.02 KB
Versions: 3
Compression:
Stored size: 1.02 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, :to_hash 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.8 | lib/terraformer/circle.rb |
terraformer-0.0.7 | lib/terraformer/circle.rb |
terraformer-0.0.6 | lib/terraformer/circle.rb |