Class: Bio::Graphics::Glyph::Common

Inherits:
Object
  • Object
show all
Defined in:
lib/bio/graphics/glyphs/common.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(subfeature, feature_context) ⇒ Common

Returns a new instance of Common.



11
12
13
# File 'lib/bio/graphics/glyphs/common.rb', line 11

def initialize(subfeature, feature_context)
  @subfeature, @feature_context = subfeature, feature_context
end

Instance Attribute Details

#feature_contextObject

Returns the value of attribute feature_context.



14
15
16
# File 'lib/bio/graphics/glyphs/common.rb', line 14

def feature_context
  @feature_context
end

#subfeatureObject

Returns the value of attribute subfeature.



14
15
16
# File 'lib/bio/graphics/glyphs/common.rb', line 14

def subfeature
  @subfeature
end

Instance Method Details

#left_pixelObject



16
17
18
19
20
21
22
23
24
# File 'lib/bio/graphics/glyphs/common.rb', line 16

def left_pixel
  if self.class == Bio::Graphics::Glyph::Triangle
    return @subfeature.pixel_range_collection[0].lend - Bio::Graphics::FEATURE_ARROW_LENGTH
  elsif self.class == Bio::Graphics::Glyph::Dot
    return @subfeature.pixel_range_collection[0].lend - @radius
  else
    return @subfeature.pixel_range_collection.sort_by{|pr| pr.lend}[0].lend
  end
end

#right_pixelObject



26
27
28
29
30
31
32
33
34
# File 'lib/bio/graphics/glyphs/common.rb', line 26

def right_pixel
  if self.class == Bio::Graphics::Glyph::Triangle
    return @subfeature.pixel_range_collection[0].rend + Bio::Graphics::FEATURE_ARROW_LENGTH
  elsif self.class == Bio::Graphics::Glyph::Dot
    return @subfeature.pixel_range_collection[0].rend + @radius
  else
    return @subfeature.pixel_range_collection.sort_by{|pr| pr.lend}[-1].rend
  end
end