Class: GrADS::Command::Area

Inherits:
Object
  • Object
show all
Defined in:
lib/grads/command.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(x1, x2, y1, y2) ⇒ Area

Returns a new instance of Area.



764
765
766
767
768
769
# File 'lib/grads/command.rb', line 764

def initialize (x1, x2, y1, y2)
  @x1 = x1
  @x2 = x2
  @y1 = y1
  @y2 = y2
end

Instance Attribute Details

#x1Object (readonly)

Returns the value of attribute x1.



771
772
773
# File 'lib/grads/command.rb', line 771

def x1
  @x1
end

#x2Object (readonly)

Returns the value of attribute x2.



771
772
773
# File 'lib/grads/command.rb', line 771

def x2
  @x2
end

#y1Object (readonly)

Returns the value of attribute y1.



771
772
773
# File 'lib/grads/command.rb', line 771

def y1
  @y1
end

#y2Object (readonly)

Returns the value of attribute y2.



771
772
773
# File 'lib/grads/command.rb', line 771

def y2
  @y2
end

Instance Method Details

#centerObject



781
782
783
# File 'lib/grads/command.rb', line 781

def center
  return @x1 + w/2
end

#hObject



777
778
779
# File 'lib/grads/command.rb', line 777

def h
  return @y2 - @y1
end

#midObject



785
786
787
# File 'lib/grads/command.rb', line 785

def mid
  return @y1 + h/2
end

#wObject



773
774
775
# File 'lib/grads/command.rb', line 773

def w
  return @x2 - @x1
end