Class: Cosmos::Plot

Inherits:
Object show all
Defined in:
lib/cosmos/tools/tlm_grapher/plots/plot.rb

Overview

Represents a plot

Direct Known Subclasses

LinegraphPlot

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializePlot

Creates a new Plot



34
35
36
37
38
39
40
41
42
43
# File 'lib/cosmos/tools/tlm_grapher/plots/plot.rb', line 34

def initialize
  @tab = nil
  @data_objects = []
  @gui_object = nil
  @redraw_needed = false

  # Type is classname without Plot
  @plot_type = self.class.to_s[0..-5].upcase
  @plot_type = @plot_type.split("::")[-1] # Remove Cosmos:: if present
end

Instance Attribute Details

#data_objectsObject

Array of data objects in the plot



22
23
24
# File 'lib/cosmos/tools/tlm_grapher/plots/plot.rb', line 22

def data_objects
  @data_objects
end

#gui_objectObject

GUI object associated with this plot



25
26
27
# File 'lib/cosmos/tools/tlm_grapher/plots/plot.rb', line 25

def gui_object
  @gui_object
end

#plot_typeObject

Type of plot



28
29
30
# File 'lib/cosmos/tools/tlm_grapher/plots/plot.rb', line 28

def plot_type
  @plot_type
end

#redraw_neededObject

Flag to indicate if plot redraw is needed



31
32
33
# File 'lib/cosmos/tools/tlm_grapher/plots/plot.rb', line 31

def redraw_needed
  @redraw_needed
end

#tabObject

Tab containing this plot



19
20
21
# File 'lib/cosmos/tools/tlm_grapher/plots/plot.rb', line 19

def tab
  @tab
end

Instance Method Details

#configuration_stringObject

Returns the configuration lines used to create this plot



46
47
48
49
50
51
52
53
# File 'lib/cosmos/tools/tlm_grapher/plots/plot.rb', line 46

def configuration_string
  string = "  PLOT #{@plot_type}\n"
  string << plot_configuration_string()
  @data_objects.each do |data_object|
    string << data_object.configuration_string
  end
  string
end

#handle_keyword(parser, keyword, parameters) ⇒ Object

Handles plot specific keywords

Raises:

  • (ArgumentError)


56
57
58
# File 'lib/cosmos/tools/tlm_grapher/plots/plot.rb', line 56

def handle_keyword(parser, keyword, parameters)
  raise ArgumentError, "Unknown keyword received by #{self.class}: #{keyword}"
end