Class RCAP::CAP_1_2::Area

  1. lib/rcap/cap_1_2/area.rb
Parent: Object

An Area object is valid if

  • it has an area description
  • all Circle objects contained in circles are valid
  • all Geocode objects contained in geocodes are valid
  • all Polygon objects contained in polygons are valid
  • altitude has a value if ceiling is set

Methods

public class

  1. new

public instance

  1. ==
  2. add_circle
  3. add_geocode
  4. add_polygon
  5. to_s

Included modules

  1. Validation

Attributes

altitude [RW] Expressed in feet above sea level
area_desc [RW] Area Description - Textual description of area.
ceiling [RW] Expressed in feet above sea level.
circles [R] Collection of Circle objects
geocodes [R] Collection of Geocode objects
polygons [R] Collection of Polygon objects

Public class methods

new ( attributes = {})
[show source]
# File lib/rcap/cap_1_2/area.rb, line 39
      def initialize( attributes = {})
        @area_desc = attributes[ :area_desc ]
        @altitude  = attributes[ :altitude ]
        @ceiling   = attributes[ :ceiling ]
        @circles   = Array( attributes[ :circles ])
        @geocodes  = Array( attributes[ :geocodes ])
        @polygons  = Array( attributes[ :polygons ])
      end

Public instance methods

== ( other )

Implements an equality operator for the Area object. Two Area objects are equal if all their attributes are equal.

[show source]
# File lib/rcap/cap_1_2/area.rb, line 92
      def ==( other )
        comparison_attributes = lambda{ |area| [ area.area_desc, area.altitude, area.ceiling, area.circles, area.geocodes, area.polygons ]}
        comparison_attributes.call( self ) == comparison_attributes.call( other )
      end
add_circle ( circle_attributes = {})

Creates a new Circle object and adds it to the circles array. The circle_attributes are passed as a parameter to Circle.new.

[show source]
# File lib/rcap/cap_1_2/area.rb, line 58
      def add_circle( circle_attributes = {})
        circle = Circle.new( circle_attributes )
        self.circles << circle
        circle
      end
add_geocode ( geocode_attributes = {})

Creates a new Geocode object and adds it to the geocodes array. The geocode_attributes are passed as a parameter to Geocode.new.

[show source]
# File lib/rcap/cap_1_2/area.rb, line 66
      def add_geocode( geocode_attributes = {})
        geocode = Geocode.new( geocode_attributes )
        self.geocodes << geocode
        geocode
      end
add_polygon ( polygon_attributes = {})

Creates a new Polygon object and adds it to the polygons array. The polygon_attributes are passed as a parameter to Polygon.new.

[show source]
# File lib/rcap/cap_1_2/area.rb, line 50
      def add_polygon( polygon_attributes = {})
        polygon = Polygon.new( polygon_attributes )
        self.polygons << polygon
        polygon
      end
to_s ()

Returns a string representation of the area of the form

area_desc
[show source]
# File lib/rcap/cap_1_2/area.rb, line 108
      def to_s
        self.area_desc
      end