Class: RegionExtractor::Region
- Inherits:
-
Object
- Object
- RegionExtractor::Region
- Defined in:
- lib/region_extractor/region.rb
Instance Attribute Summary collapse
-
#holes ⇒ Object
Returns the value of attribute holes.
-
#points ⇒ Object
Returns the value of attribute points.
-
#zone ⇒ Object
Returns the value of attribute zone.
Instance Method Summary collapse
- #add_hole(region) ⇒ Object
- #coordinates(output_projection = Proj4::Projection.new( :proj => 'latlong', :datum => 'WGS84' )) ⇒ Object
-
#initialize(options = {}) ⇒ Region
constructor
A new instance of Region.
- #transformed_points(output_projection = Proj4::Projection.new( :proj => 'latlong', :datum => 'WGS84' )) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Region
Returns a new instance of Region.
4 5 6 7 8 9 |
# File 'lib/region_extractor/region.rb', line 4 def initialize( = {}) @points = [:points] @zone = [:zone] @projection = Proj4::Projection.new( :proj => 'utm', :datum => "NAD83", :zone => @zone) @holes = [] end |
Instance Attribute Details
#holes ⇒ Object
Returns the value of attribute holes.
3 4 5 |
# File 'lib/region_extractor/region.rb', line 3 def holes @holes end |
#points ⇒ Object
Returns the value of attribute points.
3 4 5 |
# File 'lib/region_extractor/region.rb', line 3 def points @points end |
#zone ⇒ Object
Returns the value of attribute zone.
3 4 5 |
# File 'lib/region_extractor/region.rb', line 3 def zone @zone end |
Instance Method Details
#add_hole(region) ⇒ Object
19 20 21 |
# File 'lib/region_extractor/region.rb', line 19 def add_hole(region) @holes << region end |
#coordinates(output_projection = Proj4::Projection.new( :proj => 'latlong', :datum => 'WGS84' )) ⇒ Object
15 16 17 |
# File 'lib/region_extractor/region.rb', line 15 def coordinates(output_projection = Proj4::Projection.new( :proj => 'latlong', :datum => 'WGS84' )) transformed_points(output_projection).map{|p|"#{p.x},#{p.y},0.000000"}.join("\n") end |
#transformed_points(output_projection = Proj4::Projection.new( :proj => 'latlong', :datum => 'WGS84' )) ⇒ Object
11 12 13 |
# File 'lib/region_extractor/region.rb', line 11 def transformed_points(output_projection = Proj4::Projection.new( :proj => 'latlong', :datum => 'WGS84' )) @points.map{|p| Point.tranform_point(p, @projection, output_projection) } end |