Class: CTioga2::Graphics::Styles::LocationStyle

Inherits:
BasicStyle
  • Object
show all
Defined in:
lib/ctioga2/graphics/styles/location.rb

Overview

This class represents various aspects of the location of a object within a plot, such as:

  • X and Y axes

  • foreground/normal/background position

  • whether it should be clipped or not.

todo currently only X and Y axes are implemented.

Constant Summary

Constants inherited from BasicStyle

BasicStyle::AllStyles, BasicStyle::OldAttrAccessor

Instance Method Summary collapse

Methods inherited from BasicStyle

alias_for, aliases, attr_accessor, attribute_type, attribute_types, attributes, convert_string_hash, defined_aliases, deprecated_attribute, from_hash, inherited, #instance_variable_defined?, normalize_hash, normalize_in, normalize_out, options_hash, #set_from_hash, sub_style, sub_styles, #to_hash, typed_attribute, #update_from_other, #use_defaults_from

Instance Method Details

#finalize!(plot_style) ⇒ Object

Finalizes the location of the object, that is (for now) resolves references to default axes.



53
54
55
# File 'lib/ctioga2/graphics/styles/location.rb', line 53

def finalize!(plot_style)
  @xaxis, @yaxis = *get_axis_keys(plot_style)
end

#get_axis_keys(plot_style) ⇒ Object

Given a PlotStyle object, returns the axes keys as would PlotStyle#get_axis_key



44
45
46
47
48
49
# File 'lib/ctioga2/graphics/styles/location.rb', line 44

def get_axis_keys(plot_style)
  return [
          plot_style.get_axis_key(@xaxis || 'x'),
          plot_style.get_axis_key(@yaxis || 'y')
         ]
end