Class: CTioga2::Graphics::Elements::XYZMap
- Inherits:
-
TiogaElement
- Object
- TiogaElement
- CTioga2::Graphics::Elements::XYZMap
- Includes:
- Log, Dobjects
- Defined in:
- lib/ctioga2/graphics/elements/xyz-map.rb
Overview
There should be a way to automatically display level
This class represents a XY map of Z values, ie something that is represented using an image
lines, and possibly only that.
Instance Attribute Summary collapse
-
#curve_style ⇒ Object
A Styles::CurveStyle object saying how the curve should be drawn.
-
#dataset ⇒ Object
The Data::Dataset object that should get plotted.
-
#table ⇒ Object
The IndexedTable object representing the underlying data.
Attributes inherited from TiogaElement
Instance Method Summary collapse
-
#get_boundaries ⇒ Object
Returns the Types::Boundaries of this curve.
-
#initialize(dataset, style = nil) ⇒ XYZMap
constructor
Creates a new XYZMap object with the given dataset and style.
-
#location ⇒ Object
Returns the LocationStyle object of the curve.
-
#real_do(t) ⇒ Object
Actually draws the curve.
Methods included from Log
debug, error, fatal, #format_exception, #identify, info, init_logger, logger, set_level, #spawn, warn
Methods inherited from TiogaElement
Constructor Details
#initialize(dataset, style = nil) ⇒ XYZMap
Creates a new XYZMap object with the given dataset and style.
55 56 57 58 59 |
# File 'lib/ctioga2/graphics/elements/xyz-map.rb', line 55 def initialize(dataset, style = nil) @dataset = dataset @curve_style = style prepare_data end |
Instance Attribute Details
#curve_style ⇒ Object
A Styles::CurveStyle object saying how the curve should be drawn.
Some of the elements will be overridden.
45 46 47 |
# File 'lib/ctioga2/graphics/elements/xyz-map.rb', line 45 def curve_style @curve_style end |
#dataset ⇒ Object
The Data::Dataset object that should get plotted.
39 40 41 |
# File 'lib/ctioga2/graphics/elements/xyz-map.rb', line 39 def dataset @dataset end |
#table ⇒ Object
The IndexedTable object representing the underlying data
48 49 50 |
# File 'lib/ctioga2/graphics/elements/xyz-map.rb', line 48 def table @table end |
Instance Method Details
#get_boundaries ⇒ Object
Returns the Types::Boundaries of this curve.
75 76 77 |
# File 'lib/ctioga2/graphics/elements/xyz-map.rb', line 75 def get_boundaries return @table.xy_boundaries end |
#location ⇒ Object
Returns the LocationStyle object of the curve. Returns the one from #curve_style.
70 71 72 |
# File 'lib/ctioga2/graphics/elements/xyz-map.rb', line 70 def location return @curve_style.location end |
#real_do(t) ⇒ Object
Actually draws the curve
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
# File 'lib/ctioga2/graphics/elements/xyz-map.rb', line 81 def real_do(t) debug { "Plotting curve #{inspect}" } t.context do # Of course, there are still quite a few things to do # ;-)... # Ideas: for leaving things out, I may have to use min_gt # along with masking. ## @todo handle non-homogeneous XY maps. @curve_style.color_map ||= Styles::ColorMap.from_text("Red--Green") dict = @curve_style.color_map. prepare_data_display(t,@table.table, @table.table.min, @table.table.max) if @curve_style.zaxis begin @parent.style.get_axis_style(@curve_style.zaxis). set_color_map(@curve_style.color_map, @table.table.min, @table.table.max) rescue error { "Could not set Z info to non-existent axis #{@curve_style.zaxis}" } end end dict.update(@table.corner_positions) dict.update('width' => @table.width, 'height' => @table.height) dict.update('interpolate' => false) if (! @curve_style.fill.transparency) || (@curve_style.fill.transparency < 0.99) t.show_image(dict) else info { 'Not showing map as transparency is over 0.99' } end end end |