Class: CTioga::GridItemLayout

Inherits:
SimpleLayout show all
Defined in:
lib/CTioga/layout.rb

Overview

The layout that should be used for every single object in a grid. Should.

Instance Attribute Summary

Attributes inherited from SimpleLayout

#bounding_box

Attributes inherited from Layout

#child_layouts, #object, #parent

Instance Method Summary collapse

Methods inherited from SimpleLayout

#extension, #initialize

Methods inherited from Layout

#add_child, #compute_padding, #convert_layout, #extension, #initialize, #legend_extension, #legend_only_specs, #update_extension_with_object, #update_extensions

Methods included from Log

#identify, #init_logger, #logger, #logger_options, #spawn

Constructor Details

This class inherits a constructor from CTioga::SimpleLayout

Instance Method Details

#legend_specs(t = nil) ⇒ Object

Returns the object’s frame.



567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
# File 'lib/CTioga/layout.rb', line 567

def legend_specs(t = nil)
  # To compute the legend specification, 
  a = parent.child_extension(self, t)

  frames = @object.outer_frame(t)
  padding = Dimension.absolute_to_relative(a, frames)

  padding_prefs = @object.layout_preferences.
    padding_relative_values(frames)

  update_extensions(padding, padding_prefs)
  my_frame = parent.child_frame(t, self)
  
  debug "Child frame #{my_frame.inspect}"
  debug "Child padding #{padding.inspect}"
  debug "Child padding prefs #{padding_prefs.inspect}"
  
  specs = {}
  i = 0
  for s in %w(left right top bottom)
    specs["plot_#{s}_margin"] = padding[i] + my_frame[i]
    i += 1
  end
  debug "Child specs #{specs.inspect}"
  return specs
end