Class: Chem::CDX::CDXRectangle
- Inherits:
-
Object
- Object
- Chem::CDX::CDXRectangle
- Defined in:
- lib/chem/db/cdx.rb
Instance Attribute Summary collapse
-
#bottom ⇒ Object
readonly
Returns the value of attribute bottom.
-
#left ⇒ Object
readonly
Returns the value of attribute left.
-
#right ⇒ Object
readonly
Returns the value of attribute right.
-
#top ⇒ Object
readonly
Returns the value of attribute top.
Instance Method Summary collapse
-
#initialize(top, left, bottom, right) ⇒ CDXRectangle
constructor
A new instance of CDXRectangle.
- #to_bin ⇒ Object
- #to_xml ⇒ Object
Constructor Details
#initialize(top, left, bottom, right) ⇒ CDXRectangle
Returns a new instance of CDXRectangle.
587 588 589 |
# File 'lib/chem/db/cdx.rb', line 587 def initialize top, left, bottom, right @top, @left, @bottom, @right = top.to_f, left.to_f, bottom.to_f, right.to_f end |
Instance Attribute Details
#bottom ⇒ Object (readonly)
Returns the value of attribute bottom.
585 586 587 |
# File 'lib/chem/db/cdx.rb', line 585 def bottom @bottom end |
#left ⇒ Object (readonly)
Returns the value of attribute left.
585 586 587 |
# File 'lib/chem/db/cdx.rb', line 585 def left @left end |
#right ⇒ Object (readonly)
Returns the value of attribute right.
585 586 587 |
# File 'lib/chem/db/cdx.rb', line 585 def right @right end |
#top ⇒ Object (readonly)
Returns the value of attribute top.
585 586 587 |
# File 'lib/chem/db/cdx.rb', line 585 def top @top end |
Instance Method Details
#to_bin ⇒ Object
591 |
# File 'lib/chem/db/cdx.rb', line 591 def to_bin ; [@top.to_i, @left.to_i, @bottom.to_i, @right.to_i].pack('V4') ; end |
#to_xml ⇒ Object
593 594 595 |
# File 'lib/chem/db/cdx.rb', line 593 def to_xml "%.2f %.2f %.2f %.2f" % [@top / 65536, @left / 65536, @bottom / 65536, @right / 65536] end |