Class RCAP::CAP_1_1::Point

  1. lib/rcap/cap_1_1/point.rb
Parent: Object

A Point object is valid if

  • it has a lattitude within the minimum and maximum lattitude values
  • it has a longitude within the minimum and maximum longitude values

Methods

public class

  1. new

public instance

  1. ==
  2. to_s

Included modules

  1. Validation

Constants

MAX_LONGITUDE = 180
MIN_LONGITUDE = -180
MAX_LATTITUDE = 90
MIN_LATTITUDE = -90

Attributes

lattitude [RW]
longitude [RW]

Public class methods

new ( attributes = {} )
[show source]
# File lib/rcap/cap_1_1/point.rb, line 21
      def initialize( attributes = {} )
        @lattitude = attributes[ :lattitude ]
        @longitude = attributes[ :longitude ]
      end

Public instance methods

== ( other )

Two points are equivalent if they have the same lattitude and longitude

[show source]
# File lib/rcap/cap_1_1/point.rb, line 37
      def ==( other )
        [ self.lattitude, self.longitude ] == [ other.lattitude, other.longitude ]
      end
to_s ()

Returns a string representation of the point of the form

lattitude,longitude
[show source]
# File lib/rcap/cap_1_1/point.rb, line 28
      def to_s
        "#{ self.lattitude },#{ self.longitude }"
      end