Class: Bio::Graphics::Glyph::Common
- Inherits:
-
Object
- Object
- Bio::Graphics::Glyph::Common
- Defined in:
- lib/bio/graphics/glyphs/common.rb
Direct Known Subclasses
Box, DirectedBox, DirectedGeneric, DirectedSpliced, Dot, Generic, Line, LineWithHandles, Spliced, Transcript, Triangle
Instance Attribute Summary collapse
-
#feature_context ⇒ Object
Returns the value of attribute feature_context.
-
#subfeature ⇒ Object
Returns the value of attribute subfeature.
Instance Method Summary collapse
-
#initialize(subfeature, feature_context) ⇒ Common
constructor
A new instance of Common.
- #left_pixel ⇒ Object
- #right_pixel ⇒ Object
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_context ⇒ Object
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 |
#subfeature ⇒ Object
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_pixel ⇒ Object
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_pixel ⇒ Object
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 |