Method: ChemScanner::ChemDraw::BaseValue#read_bounding_box

Defined in:
lib/chem_scanner/chem_draw/node/base_value.rb

#read_bounding_box(data) ⇒ Object



122
123
124
125
126
127
128
129
130
131
132
133
134
# File 'lib/chem_scanner/chem_draw/node/base_value.rb', line 122

def read_bounding_box(data)
  if @parser_type == "cdxml"
    left, top, right, bottom = data.text.split(" ").map do |x|
      x.to_f / CDXML_CDX_POINT
    end
  else
    top, left, bottom, right = binary_chunks(data, 4).map do |x|
      read_int(x, false) * 1.0e-6
    end
  end

  [top, left, bottom, right]
end