Class: ChemScanner::Cdx

Inherits:
ChemScanner::ChemDraw::Parser show all
Defined in:
lib/chem_scanner/cdx.rb

Overview

Class which traverse the tree in CDX binary files and parse

Constant Summary collapse

CREATIONPROGRAM =
0x0003
COLORTABLE =
0x0300
FONTTABLE =
0x0100

Instance Attribute Summary collapse

Attributes inherited from ChemScanner::ChemDraw::Parser

#bracket_map, #color_table, #font_table, #fragment_group_map, #fragment_map, #geometry_map, #graphic_map, #molecules, #reactions, #reader, #tempid, #text_map

Instance Method Summary collapse

Methods inherited from ChemScanner::ChemDraw::Parser

#fragment_as_line, #get_tempid, #n_atoms

Constructor Details

#initializeCdx

Returns a new instance of Cdx.



16
17
18
19
20
# File 'lib/chem_scanner/cdx.rb', line 16

def initialize
  super

  @type = "cdx"
end

Instance Attribute Details

#versionObject

Returns the value of attribute version.



10
11
12
# File 'lib/chem_scanner/cdx.rb', line 10

def version
  @version
end

Instance Method Details

#raw_dataObject



39
40
41
# File 'lib/chem_scanner/cdx.rb', line 39

def raw_data
  @reader.bin
end

#read(file, is_path = true) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/chem_scanner/cdx.rb', line 22

def read(file, is_path = true)
  @reader = ChemDraw::CdxReader.new(file, is_path)
  return false unless @reader.valid

  read_global
  read_objects until @reader.end?
  rebuild_objects_map

  @scheme = Interpreter::Scheme.new(self)
  @scheme.interpret

  @molecules = @scheme.molecules
  @reactions = @scheme.reactions

  true
end