Class: CTioga2::Graphics::Elements::XYZContour
- Inherits:
-
PlotBasedElement
- Object
- TiogaElement
- PlotBasedElement
- CTioga2::Graphics::Elements::XYZContour
- Includes:
- Log, Dobjects
- Defined in:
- lib/ctioga2/graphics/elements/xyz-contour.rb
Overview
This class displays a XYZ element using contour lines.
Constant Summary
Constants inherited from TiogaElement
TiogaElement::StyleBaseOptions
Instance Attribute Summary collapse
-
#curve_style ⇒ Object
A Styles::CurveStyle object saying how the curve should be drawn.
-
#table ⇒ 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) ⇒ XYZContour
constructor
Creates a new XYZContour 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) ⇒ XYZContour
Creates a new XYZContour object with the given dataset and style.
Lots of code in common with XYZMap
47 48 49 50 51 |
# File 'lib/ctioga2/graphics/elements/xyz-contour.rb', line 47 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.
36 37 38 |
# File 'lib/ctioga2/graphics/elements/xyz-contour.rb', line 36 def curve_style @curve_style end |
#table ⇒ Object
The IndexedTable object representing the underlying data
39 40 41 |
# File 'lib/ctioga2/graphics/elements/xyz-contour.rb', line 39 def table @table end |
Instance Method Details
#get_boundaries ⇒ Object
Returns the Types::Boundaries of this curve.
62 63 64 |
# File 'lib/ctioga2/graphics/elements/xyz-contour.rb', line 62 def get_boundaries return @table.xy_boundaries end |
#real_do(t) ⇒ Object
Actually draws the curve
68 69 70 71 72 73 74 75 76 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 |
# File 'lib/ctioga2/graphics/elements/xyz-contour.rb', line 68 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") 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 # Computation of equally spaced level lines nb = 20 zmin = @table.table.min zmax = @table.table.max t.context do @curve_style.line.set_stroke_style(t) @curve_style.contour.plot_contours(t, table, zmin, zmax, @curve_style.color_map) end end end |