Class: CTioga2::Graphics::Elements::XYZMap
- Inherits:
-
PlotBasedElement
- Object
- TiogaElement
- PlotBasedElement
- 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.
Constant Summary
Constants inherited from TiogaElement
TiogaElement::StyleBaseOptions
Instance Attribute Summary collapse
-
#tables ⇒ Object
The IndexedTable object representing the underlying data.
Attributes inherited from PlotBasedElement
Attributes inherited from TiogaElement
#clipped, #depth, #hidden, #location, #object_classes, #object_id, #object_parent, #parent
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.
-
#real_do(t) ⇒ Object
Actually draws the curve.
Methods included from Log
context, counts, debug, error, fatal, #format_exception, #identify, info, init_logger, log_to, logger, set_level, #spawn, warn
Methods inherited from PlotBasedElement
Methods inherited from TiogaElement
all_styles, base_style, #check_styled, define_style, #do, find_object, find_objects, #get_style, #has_style?, inherited, #inspect, register_object, register_style, #setup_style, #style_class, style_class, style_name, #style_name, styled_classes, #update_style
Constructor Details
#initialize(dataset, style = nil) ⇒ XYZMap
Creates a new XYZMap object with the given dataset and style.
42 43 44 45 46 47 |
# File 'lib/ctioga2/graphics/elements/xyz-map.rb', line 42 def initialize(dataset, style = nil) @dataset = dataset @curve_style = style prepare_data @boundaries = nil end |
Instance Attribute Details
#tables ⇒ Object
The IndexedTable object representing the underlying data
37 38 39 |
# File 'lib/ctioga2/graphics/elements/xyz-map.rb', line 37 def tables @tables end |
Instance Method Details
#get_boundaries ⇒ Object
Returns the Types::Boundaries of this curve.
65 66 67 68 69 70 71 72 73 |
# File 'lib/ctioga2/graphics/elements/xyz-map.rb', line 65 def get_boundaries if @boundaries return @boundaries end bnds = Graphics::Types::Boundaries.bounds(@dataset.x.values, @dataset.y.values) @boundaries = bnds return bnds end |
#real_do(t) ⇒ Object
Actually draws the curve
77 78 79 80 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 77 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") zmin = @dataset.z.values.min zmax = @dataset.z.values.max for tbl in @tables dict = @curve_style.color_map. prepare_data_display(t,tbl.table, zmin, zmax) if @curve_style.zaxis begin @parent.style.get_axis_style(@curve_style.zaxis). set_color_map(@curve_style.color_map, zmin, zmax) rescue error { "Could not set Z info to non-existent axis #{@curve_style.zaxis}" } end end dict.update(tbl.corner_positions) dict.update('width' => tbl.width, 'height' => tbl.height) dict.update('interpolate' => false) if (! @curve_style.fill.transparency) || (@curve_style.fill.transparency < 0.99) t.show_image(dict) # t.stroke_rect(dict['ul'][0], dict['ul'][1], dict['lr'][0] - dict['ul'][0], dict['lr'][1] - dict['ul'][1]) else info { 'Not showing map as transparency is over 0.99' } end end end end |