Class: CTioga2::Graphics::Styles::LocationStyle
- Inherits:
-
BasicStyle
- Object
- BasicStyle
- CTioga2::Graphics::Styles::LocationStyle
- 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
Instance Attribute Summary collapse
-
#xaxis ⇒ Object
The name of the X axis, something to be fed to PlotStyle#get_axis_key.
-
#yaxis ⇒ Object
The name of the Y axis.
Instance Method Summary collapse
-
#finalize!(plot_style) ⇒ Object
Finalizes the location of the object, that is (for now) resolves references to default axes.
-
#get_axis_keys(plot_style) ⇒ Object
Given a PlotStyle object, returns the axes keys as would PlotStyle#get_axis_key.
Methods inherited from BasicStyle
attr_accessor, attributes, from_hash, #instance_variable_defined?, #set_from_hash, #to_hash, #update_from_other
Instance Attribute Details
#xaxis ⇒ Object
The name of the X axis, something to be fed to PlotStyle#get_axis_key
39 40 41 |
# File 'lib/ctioga2/graphics/styles/location.rb', line 39 def xaxis @xaxis end |
#yaxis ⇒ Object
The name of the Y axis
42 43 44 |
# File 'lib/ctioga2/graphics/styles/location.rb', line 42 def yaxis @yaxis end |
Instance Method Details
#finalize!(plot_style) ⇒ Object
Finalizes the location of the object, that is (for now) resolves references to default axes.
55 56 57 |
# File 'lib/ctioga2/graphics/styles/location.rb', line 55 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
46 47 48 49 50 51 |
# File 'lib/ctioga2/graphics/styles/location.rb', line 46 def get_axis_keys(plot_style) return [ plot_style.get_axis_key(@xaxis || 'x'), plot_style.get_axis_key(@yaxis || 'y') ] end |