Class: MotionPlot::PlotSymbol
- Inherits:
-
Object
- Object
- MotionPlot::PlotSymbol
- Defined in:
- lib/motion-plot/utilities/plot_symbol.rb
Constant Summary collapse
- ALIASES =
{ :rectangle => "rectanglePlotSymbol", :plus => "plusPlotSymbol", :star => "starPlotSymbol", :diamond => "diamondPlotSymbol", :triangle => "trianglePlotSymbol", :pentagon => "pentagonPlotSymbol", :hexagon => "hexagonPlotSymbol", :dash => "dashPlotSymbol", :snow => "snowPlotSymbol" }
Instance Attribute Summary collapse
-
#enabled ⇒ Object
Returns the value of attribute enabled.
-
#size ⇒ Object
Returns the value of attribute size.
-
#type ⇒ Object
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ PlotSymbol
constructor
A new instance of PlotSymbol.
- #symbol_for(plot) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ PlotSymbol
Returns a new instance of PlotSymbol.
34 35 36 37 38 39 40 |
# File 'lib/motion-plot/utilities/plot_symbol.rb', line 34 def initialize(={}) .each_pair {|key, value| send("#{key}=", value) if(respond_to?("#{key}=")) } @type = [:type] ? self.class.send([:type]) : MotionPlot::PlotSymbol[[:index]] end |
Instance Attribute Details
#enabled ⇒ Object
Returns the value of attribute enabled.
32 33 34 |
# File 'lib/motion-plot/utilities/plot_symbol.rb', line 32 def enabled @enabled end |
#size ⇒ Object
Returns the value of attribute size.
32 33 34 |
# File 'lib/motion-plot/utilities/plot_symbol.rb', line 32 def size @size end |
#type ⇒ Object
Returns the value of attribute type.
32 33 34 |
# File 'lib/motion-plot/utilities/plot_symbol.rb', line 32 def type @type end |
Class Method Details
.[](index) ⇒ Object
25 26 27 28 29 |
# File 'lib/motion-plot/utilities/plot_symbol.rb', line 25 def [](index) index = 0 if(index > 9) send(ALIASES.keys[index]) end |
Instance Method Details
#symbol_for(plot) ⇒ Object
42 43 44 45 46 47 48 49 50 51 |
# File 'lib/motion-plot/utilities/plot_symbol.rb', line 42 def symbol_for(plot) _style = CPTMutableLineStyle.lineStyle _style.lineColor = plot.dataLineStyle.lineColor symbol = @type symbol.fill = CPTFill.fillWithColor(plot.dataLineStyle.lineColor, colorWithAlphaComponent:0.5) symbol.lineStyle = _style symbol.size = CGSizeMake(size.to_f, size.to_f) symbol end |