Class: Osgb::Projection

Inherits:
Object
  • Object
show all
Defined in:
lib/osgb/projection.rb

Constant Summary collapse

@@instances =
{}

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, attributes) ⇒ Projection

Returns a new instance of Projection.



6
7
8
9
10
11
12
13
14
15
# File 'lib/osgb/projection.rb', line 6

def initialize(name, attributes)
  @name = name
  @scale = attributes[:scale]
  @phi0 = attributes[:phi0].to_radians
  @lambda0 = attributes[:lambda0].to_radians
  @e0 = attributes[:e0]
  @n0 = attributes[:n0]
  @ellipsoid = Osgb::Ellipsoid[attributes[:ellipsoid]]
  @@instances[name] = self
end

Instance Attribute Details

#e0Object

Returns the value of attribute e0.



3
4
5
# File 'lib/osgb/projection.rb', line 3

def e0
  @e0
end

#ellipsoidObject

Returns the value of attribute ellipsoid.



3
4
5
# File 'lib/osgb/projection.rb', line 3

def ellipsoid
  @ellipsoid
end

#lambda0Object

Returns the value of attribute lambda0.



3
4
5
# File 'lib/osgb/projection.rb', line 3

def lambda0
  @lambda0
end

#n0Object

Returns the value of attribute n0.



3
4
5
# File 'lib/osgb/projection.rb', line 3

def n0
  @n0
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/osgb/projection.rb', line 3

def name
  @name
end

#phi0Object

Returns the value of attribute phi0.



3
4
5
# File 'lib/osgb/projection.rb', line 3

def phi0
  @phi0
end

#scaleObject

Returns the value of attribute scale.



3
4
5
# File 'lib/osgb/projection.rb', line 3

def scale
  @scale
end

Class Method Details

.[](name) ⇒ Object



17
18
19
# File 'lib/osgb/projection.rb', line 17

def self.[](name)
  @@instances[name]
end