class RubyPager::Text_Line

Attributes

baseline[R]
contour[R]
id[R]
index[R]
text[R]

Public Class Methods

blank() click to toggle source
# File lib/ruby_pager/text_line.rb, line 15
def self.blank
  return Text_Line.new(0,Text_Line.blank_data)
end
blank_data() click to toggle source
# File lib/ruby_pager/text_line.rb, line 43
def self.blank_data
  res=Hash.new
  res["@id"]=""
  res["TextEquiv"]=Hash.new
  res["TextEquiv"]["Unicode"]=""
  res["Baseline"]=Hash.new
  res["Baseline"]["@points"]=Coords.blank_data
  res["Coords"]=Hash.new
  res["Coords"]["@points"]=Coords.blank_data
  return res
end
new(ex_index, ex_data) click to toggle source
# File lib/ruby_pager/text_line.rb, line 6
def initialize(ex_index, ex_data)
  @data=ex_data
  @index=ex_index
  @id = @data["@id"]
  @text = @data["TextEquiv"]["Unicode"]
  load_coords()
  load_baseline()
end

Public Instance Methods

baseline_vertical_noise(ex_std_dev) click to toggle source
# File lib/ruby_pager/text_line.rb, line 39
def baseline_vertical_noise(ex_std_dev)
  @baseline.vertical_noise(ex_std_dev)
end
get_consolidated_data() click to toggle source
# File lib/ruby_pager/text_line.rb, line 34
def get_consolidated_data
  consolidate_data()
  return @data
end
id=(ex_id) click to toggle source
# File lib/ruby_pager/text_line.rb, line 19
def id= ex_id
  raise(ArgumentError, "Got passed a non string object") if ex_id.class != String
  @id=ex_id
end
index=(ex_index) click to toggle source
# File lib/ruby_pager/text_line.rb, line 29
def index=(ex_index)
  raise(ArgumentError, "Got passed a negative value to update the index") if ex_index.to_i < 0
  @index=ex_index.to_i
end
text=(ex_text) click to toggle source
# File lib/ruby_pager/text_line.rb, line 24
def text= ex_text
  raise(ArgumentError, "Got passed a non string object") if ex_text.class != String
  @text=ex_text
end

Private Instance Methods

consolidate_data() click to toggle source
# File lib/ruby_pager/text_line.rb, line 64
def consolidate_data()
  @data["@id"]=@id
  @data["TextEquiv"]["Unicode"]=@text
  @data["Baseline"]["@points"]=@baseline.get_consolidated_data
  @data["Coords"]["@points"]=@contour.get_consolidated_data
end
load_baseline() click to toggle source
# File lib/ruby_pager/text_line.rb, line 60
def load_baseline()
  @baseline = Coords.new(@data["Baseline"]["@points"]);
end
load_coords() click to toggle source
# File lib/ruby_pager/text_line.rb, line 56
def load_coords()
  @contour = Coords.new(@data["Coords"]["@points"]);
end