Class: ChemScanner::ChemDraw::BracketGroup

Inherits:
BaseNode
  • Object
show all
Defined in:
lib/chem_scanner/chem_draw/node/bracket_group.rb

Overview

CDX Bracket parser

Constant Summary

Constants included from BaseValue

ChemScanner::ChemDraw::BaseValue::ARROW_NOGO_CROSS, ChemScanner::ChemDraw::BaseValue::CDXML_ARROW_TYPE, ChemScanner::ChemDraw::BaseValue::CDXML_ATOM_EXTERNAL_CONNECTION_TYPE, ChemScanner::ChemDraw::BaseValue::CDXML_CDX_POINT, ChemScanner::ChemDraw::BaseValue::CDXML_GRAPHIC_TYPE, ChemScanner::ChemDraw::BaseValue::CDXML_LINE_TYPE, ChemScanner::ChemDraw::BaseValue::CDXML_NODE_TYPE, ChemScanner::ChemDraw::BaseValue::CDXML_ORBITAL_TYPE, ChemScanner::ChemDraw::BaseValue::CDXML_OVAL_TYPE, ChemScanner::ChemDraw::BaseValue::TEXT_ATTRIBUTES

Instance Attribute Summary collapse

Attributes inherited from BaseNode

#id, #parser, #parser_type, #polygon

Instance Method Summary collapse

Methods inherited from BaseNode

#assign_center, #bounding_box, #cdx_read, #cdxml_read, #center_x, #center_y, #get_tempid, #post_parse_node, #pre_parse_node, #read, #set_cdx, #set_cdxml

Methods included from BaseValue

#binary_chunks, #cdx_styles, #cdx_text, #cdxml_text, #do_unhandled, #point_2d, #point_3d, #polygon_from_bb, #read_bounding_box, #read_ids, #read_int, #read_type, #read_value

Constructor Details

#initialize(parser, parser_type, id) ⇒ BracketGroup

Returns a new instance of BracketGroup.



11
12
13
14
15
16
# File 'lib/chem_scanner/chem_draw/node/bracket_group.rb', line 11

def initialize(parser, parser_type, id)
  super(parser, parser_type, id)

  @attachments = []
  @object_ids = []
end

Instance Attribute Details

#attachmentsObject (readonly)

Returns the value of attribute attachments.



9
10
11
# File 'lib/chem_scanner/chem_draw/node/bracket_group.rb', line 9

def attachments
  @attachments
end

#object_idsObject (readonly)

Returns the value of attribute object_ids.



9
10
11
# File 'lib/chem_scanner/chem_draw/node/bracket_group.rb', line 9

def object_ids
  @object_ids
end

Instance Method Details

#parse_node(tag, id, data) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/chem_scanner/chem_draw/node/bracket_group.rb', line 18

def parse_node(tag, id, data)
  if @props_ref[tag] == "BracketedObjects"
    @object_ids = read_value(tag, data)
    return
  end

  return do_unhandled(tag) unless @obj_ref[tag] == "BracketAttachment"

  attachment = BracketAttachment.new(@parser, @parser_type, id)
  attachment.read
  @attachments.push(attachment)
end