ctioga2 0.3 → 0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. data/Changelog +18 -0
  2. data/lib/ctioga2/commands/arguments.rb +17 -2
  3. data/lib/ctioga2/commands/commands.rb +13 -5
  4. data/lib/ctioga2/commands/context.rb +53 -0
  5. data/lib/ctioga2/commands/doc/doc.rb +1 -1
  6. data/lib/ctioga2/commands/doc/documentation-commands.rb +1 -1
  7. data/lib/ctioga2/commands/doc/help.rb +1 -1
  8. data/lib/ctioga2/commands/doc/html.rb +1 -1
  9. data/lib/ctioga2/commands/doc/introspection.rb +16 -1
  10. data/lib/ctioga2/commands/doc/man.rb +1 -1
  11. data/lib/ctioga2/commands/doc/markup.rb +1 -1
  12. data/lib/ctioga2/commands/doc/wordwrap.rb +1 -1
  13. data/lib/ctioga2/commands/general-commands.rb +1 -1
  14. data/lib/ctioga2/commands/general-types.rb +1 -1
  15. data/lib/ctioga2/commands/groups.rb +1 -1
  16. data/lib/ctioga2/commands/interpreter.rb +22 -1
  17. data/lib/ctioga2/commands/parsers/command-line.rb +8 -1
  18. data/lib/ctioga2/commands/parsers/file.rb +2 -1
  19. data/lib/ctioga2/commands/strings.rb +1 -1
  20. data/lib/ctioga2/commands/type.rb +1 -1
  21. data/lib/ctioga2/commands/variables.rb +1 -1
  22. data/lib/ctioga2/data/backends/backend.rb +1 -1
  23. data/lib/ctioga2/data/backends/backends/gnuplot.rb +1 -1
  24. data/lib/ctioga2/data/backends/backends/math.rb +1 -1
  25. data/lib/ctioga2/data/backends/backends/text.rb +12 -2
  26. data/lib/ctioga2/data/backends/description.rb +1 -1
  27. data/lib/ctioga2/data/backends/factory.rb +1 -1
  28. data/lib/ctioga2/data/backends/parameter.rb +1 -1
  29. data/lib/ctioga2/data/datacolumn.rb +1 -1
  30. data/lib/ctioga2/data/dataset.rb +1 -1
  31. data/lib/ctioga2/data/filters.rb +1 -1
  32. data/lib/ctioga2/data/indexed-dtable.rb +1 -1
  33. data/lib/ctioga2/data/point.rb +1 -1
  34. data/lib/ctioga2/data/stack.rb +6 -6
  35. data/lib/ctioga2/graphics/coordinates.rb +1 -1
  36. data/lib/ctioga2/graphics/elements.rb +1 -1
  37. data/lib/ctioga2/graphics/elements/containers.rb +1 -1
  38. data/lib/ctioga2/graphics/elements/contour.rb +1 -1
  39. data/lib/ctioga2/graphics/elements/curve2d.rb +1 -1
  40. data/lib/ctioga2/graphics/elements/element.rb +1 -1
  41. data/lib/ctioga2/graphics/elements/gradient-region.rb +1 -1
  42. data/lib/ctioga2/graphics/elements/parametric2d.rb +1 -1
  43. data/lib/ctioga2/graphics/elements/primitive.rb +115 -69
  44. data/lib/ctioga2/graphics/elements/region.rb +1 -1
  45. data/lib/ctioga2/graphics/elements/subplot.rb +9 -3
  46. data/lib/ctioga2/graphics/elements/tangent.rb +1 -1
  47. data/lib/ctioga2/graphics/elements/xyz-map.rb +1 -1
  48. data/lib/ctioga2/graphics/generator.rb +1 -1
  49. data/lib/ctioga2/graphics/legends.rb +5 -7
  50. data/lib/ctioga2/graphics/legends/area.rb +8 -8
  51. data/lib/ctioga2/graphics/legends/items.rb +2 -2
  52. data/lib/ctioga2/graphics/legends/provider.rb +1 -1
  53. data/lib/ctioga2/graphics/legends/storage.rb +1 -1
  54. data/lib/ctioga2/graphics/root.rb +1 -1
  55. data/lib/ctioga2/graphics/styles.rb +5 -0
  56. data/lib/ctioga2/graphics/styles/arrows.rb +53 -0
  57. data/lib/ctioga2/graphics/styles/axes.rb +29 -23
  58. data/lib/ctioga2/graphics/styles/background.rb +12 -10
  59. data/lib/ctioga2/graphics/styles/base.rb +99 -5
  60. data/lib/ctioga2/graphics/styles/box.rb +67 -0
  61. data/lib/ctioga2/graphics/styles/carrays.rb +1 -1
  62. data/lib/ctioga2/graphics/styles/colormap.rb +1 -1
  63. data/lib/ctioga2/graphics/styles/curve.rb +7 -1
  64. data/lib/ctioga2/graphics/styles/drawable.rb +24 -11
  65. data/lib/ctioga2/graphics/styles/errorbar.rb +1 -1
  66. data/lib/ctioga2/graphics/styles/factory.rb +1 -1
  67. data/lib/ctioga2/graphics/styles/gradients.rb +3 -3
  68. data/lib/ctioga2/graphics/styles/legend.rb +20 -5
  69. data/lib/ctioga2/graphics/styles/location.rb +3 -3
  70. data/lib/ctioga2/graphics/styles/map-axes.rb +6 -7
  71. data/lib/ctioga2/graphics/styles/plot.rb +51 -26
  72. data/lib/ctioga2/graphics/styles/sets.rb +1 -1
  73. data/lib/ctioga2/graphics/styles/sheet.rb +348 -0
  74. data/lib/ctioga2/graphics/styles/texts.rb +45 -64
  75. data/lib/ctioga2/graphics/subplot-commands.rb +1 -1
  76. data/lib/ctioga2/graphics/types.rb +1 -3
  77. data/lib/ctioga2/graphics/types/bijection.rb +1 -1
  78. data/lib/ctioga2/graphics/types/boundaries.rb +1 -1
  79. data/lib/ctioga2/graphics/types/boxes.rb +1 -1
  80. data/lib/ctioga2/graphics/types/dimensions.rb +2 -2
  81. data/lib/ctioga2/graphics/types/grid.rb +1 -1
  82. data/lib/ctioga2/graphics/types/location.rb +2 -2
  83. data/lib/ctioga2/graphics/types/point.rb +1 -1
  84. data/lib/ctioga2/log.rb +10 -6
  85. data/lib/ctioga2/metabuilder/type.rb +1 -1
  86. data/lib/ctioga2/metabuilder/types/coordinates.rb +1 -1
  87. data/lib/ctioga2/metabuilder/types/data.rb +1 -1
  88. data/lib/ctioga2/metabuilder/types/dates.rb +1 -1
  89. data/lib/ctioga2/metabuilder/types/lists.rb +1 -1
  90. data/lib/ctioga2/metabuilder/types/numbers.rb +1 -1
  91. data/lib/ctioga2/metabuilder/types/strings.rb +1 -1
  92. data/lib/ctioga2/metabuilder/types/styles.rb +30 -3
  93. data/lib/ctioga2/plotmaker.rb +1 -1
  94. data/lib/ctioga2/postprocess.rb +1 -1
  95. data/lib/ctioga2/utils.rb +78 -3
  96. metadata +6 -5
  97. data/lib/ctioga2/git-fools-svn.rb +0 -7
  98. data/lib/ctioga2/graphics/elements/redirecting-container.rb~ +0 -123
  99. data/lib/ctioga2/metabuilder/types/generic.rb~ +0 -225
@@ -0,0 +1,67 @@
1
+ # arrows.rb: style objects for lines and arrows
2
+ # copyright (c) 2012 by Vincent Fourmond
3
+
4
+ # This program is free software; you can redistribute it and/or modify
5
+ # it under the terms of the GNU General Public License as published by
6
+ # the Free Software Foundation; either version 2 of the License, or
7
+ # (at your option) any later version.
8
+
9
+ # This program is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU General Public License for more details (in the COPYING file).
13
+
14
+ require 'ctioga2/utils'
15
+ require 'ctioga2/log'
16
+
17
+ # This module contains all the classes used by ctioga
18
+ module CTioga2
19
+
20
+ Version::register_svn_info('$Revision$', '$Date$')
21
+
22
+ module Graphics
23
+
24
+ # All the styles
25
+ module Styles
26
+
27
+ # This class represents styles attached to a box
28
+ #
29
+ # @todo Add rounded corners and the like...
30
+ class BoxStyle < StrokeStyle
31
+
32
+ sub_style 'fill', FillStyle
33
+
34
+ def draw_box(t, x1, y1, x2, y2)
35
+ t.context do
36
+ t.discard_path
37
+
38
+ ## @todo Rounded rects!
39
+ if fill && fill.color
40
+ fill.setup_fill(t)
41
+ t.append_rect_to_path(x1, y1, x2 - x1, y2 - y1)
42
+ fill.do_fill(t)
43
+ end
44
+ if color
45
+ set_stroke_style(t)
46
+ t.append_rect_to_path(x1, y1, x2 - x1, y2 - y1)
47
+ t.stroke
48
+ end
49
+ end
50
+
51
+ end
52
+
53
+ # Draws a box around the given box, leaving dx and dy
54
+ # around. If _dy_ is omitted, it defaults to _dx_
55
+ def draw_box_around(t, x1, y1, x2, y2, dx, dy = nil)
56
+ dy ||= dx
57
+ dx = dx.to_figure(t, :x)
58
+ dy = dy.to_figure(t, :y)
59
+ draw_box(t, x1 - dx, y1 + dy,
60
+ x2 + dx, y2 - dy)
61
+ end
62
+
63
+ end
64
+ end
65
+ end
66
+ end
67
+
@@ -17,7 +17,7 @@ require 'ctioga2/log'
17
17
  # This module contains all the classes used by ctioga
18
18
  module CTioga2
19
19
 
20
- Version::register_svn_info('$Revision$', '$Date$')
20
+ Version::register_svn_info('$Revision: 105 $', '$Date: 2009-09-17 22:17:16 +0200 (Thu, 17 Sep 2009) $')
21
21
 
22
22
  module Graphics
23
23
 
@@ -17,7 +17,7 @@ require 'ctioga2/log'
17
17
  # This module contains all the classes used by ctioga
18
18
  module CTioga2
19
19
 
20
- Version::register_svn_info('$Revision$', '$Date$')
20
+ Version::register_svn_info('$Revision: 199 $', '$Date: 2010-11-30 00:48:26 +0100 (Tue, 30 Nov 2010) $')
21
21
 
22
22
  module Graphics
23
23
 
@@ -17,7 +17,7 @@ require 'ctioga2/log'
17
17
  # This module contains all the classes used by ctioga
18
18
  module CTioga2
19
19
 
20
- Version::register_svn_info('$Revision$', '$Date$')
20
+ Version::register_svn_info('$Revision: 349 $', '$Date: 2012-12-25 22:23:27 +0100 (Tue, 25 Dec 2012) $')
21
21
 
22
22
  module Graphics
23
23
 
@@ -28,6 +28,9 @@ module CTioga2
28
28
  # \todo maybe for objects different than Curve2D, a subclass of
29
29
  # CurveStyle could be used ? This way, we could have clearly
30
30
  # separated legends and the like ?
31
+ #
32
+ # @todo This should probably be a subclass of basicStyle, to
33
+ # handle style sheets.
31
34
  class CurveStyle
32
35
 
33
36
  # The style of the line that is drawn, as a StrokeStyle.
@@ -105,6 +108,9 @@ module CTioga2
105
108
  # plotted onto
106
109
  #
107
110
  # \todo make #legend another object derived from BasicStyle ?
111
+ #
112
+ # @todo This function should essentially disappear if we make
113
+ # this derive from BasicStyle.
108
114
  def set_from_hash(hash)
109
115
  @line = StrokeStyle.from_hash(hash, 'line_%s')
110
116
  @marker = MarkerStyle.from_hash(hash, 'marker_%s')
@@ -17,7 +17,7 @@ require 'ctioga2/log'
17
17
  # This module contains all the classes used by ctioga
18
18
  module CTioga2
19
19
 
20
- Version::register_svn_info('$Revision$', '$Date$')
20
+ Version::register_svn_info('$Revision: 350 $', '$Date: 2012-12-25 22:23:35 +0100 (Tue, 25 Dec 2012) $')
21
21
 
22
22
  module Graphics
23
23
 
@@ -28,13 +28,13 @@ module CTioga2
28
28
  # a Tioga path.
29
29
  class StrokeStyle < BasicStyle
30
30
  # The color
31
- attr_accessor :color
31
+ typed_attribute :color, 'color-or-false'
32
32
 
33
33
  # The line style
34
- attr_accessor :style
34
+ typed_attribute :style, 'line-style'
35
35
 
36
36
  # The line width
37
- attr_accessor :width
37
+ typed_attribute :width, 'float'
38
38
 
39
39
  # Sets the stroke style to a FigureMaker object, _t_.
40
40
  def set_stroke_style(t)
@@ -42,6 +42,14 @@ module CTioga2
42
42
  t.line_type = @style if @style
43
43
  t.line_width = @width if @width
44
44
  end
45
+
46
+ # Draws a line according with this style
47
+ def draw_line(t, x1, y1, x2, y2)
48
+ t.context do
49
+ set_stroke_style(t)
50
+ t.stroke_line(x1, y1, x2, y2)
51
+ end
52
+ end
45
53
  end
46
54
 
47
55
  # This class represents all the stylistic information to draw a
@@ -54,13 +62,13 @@ module CTioga2
54
62
  class MarkerStyle < BasicStyle
55
63
 
56
64
  # The color
57
- attr_accessor :color
65
+ typed_attribute :color, 'color'
58
66
 
59
67
  # The marker
60
- attr_accessor :marker
68
+ typed_attribute :marker, 'marker'
61
69
 
62
70
  # The marker scale
63
- attr_accessor :scale
71
+ typed_attribute :scale, 'float'
64
72
 
65
73
  # Shows the marker at a given location/set of locations.
66
74
  #
@@ -97,16 +105,21 @@ module CTioga2
97
105
  #
98
106
  # \todo add ways to specify complex fills, such as patterned
99
107
  # fills and so on. Those would use clipping the path and base
100
- # themselves on the coordinates of the current frame.
108
+ # themselves on the coordinates of the current frame -- or more
109
+ # nicely use dimensions ? (which would allow to mix both to some
110
+ # extent ?)
101
111
  #
102
112
  # \todo more attributes ?
113
+ #
114
+ # @todo This class should also provide image-based fills, with
115
+ # CSS-like capacities (scaling, tiling, centering, and so on...)
103
116
  class FillStyle < BasicStyle
104
117
 
105
118
  # The color.
106
- attr_accessor :color
119
+ typed_attribute :color, "color"
107
120
 
108
121
  # The transparency
109
- attr_accessor :transparency
122
+ typed_attribute :transparency, 'float'
110
123
 
111
124
  # Sets up the parameters for the fill. Must be called before
112
125
  # any path drawing.
@@ -136,7 +149,7 @@ module CTioga2
136
149
  # fill ? A float, or:
137
150
  # * :top, :bottom
138
151
  # * false, nil to disable filling altogether
139
- attr_accessor :y0
152
+ typed_attribute :y0, 'fill-until'
140
153
 
141
154
  end
142
155
 
@@ -18,7 +18,7 @@ require 'ctioga2/log'
18
18
  # This module contains all the classes used by ctioga
19
19
  module CTioga2
20
20
 
21
- Version::register_svn_info('$Revision$', '$Date$')
21
+ Version::register_svn_info('$Revision: 123 $', '$Date: 2010-01-10 02:45:47 +0100 (Sun, 10 Jan 2010) $')
22
22
 
23
23
  module Graphics
24
24
 
@@ -17,7 +17,7 @@ require 'ctioga2/log'
17
17
  # This module contains all the classes used by ctioga
18
18
  module CTioga2
19
19
 
20
- Version::register_svn_info('$Revision$', '$Date$')
20
+ Version::register_svn_info('$Revision: 217 $', '$Date: 2010-12-31 16:18:20 +0100 (Fri, 31 Dec 2010) $')
21
21
 
22
22
  module Graphics
23
23
 
@@ -19,7 +19,7 @@ require 'ctioga2/graphics/coordinates'
19
19
  # This module contains all the classes used by ctioga
20
20
  module CTioga2
21
21
 
22
- Version::register_svn_info('$Revision$', '$Date$')
22
+ Version::register_svn_info('$Revision: 335 $', '$Date: 2012-12-23 00:29:44 +0100 (Sun, 23 Dec 2012) $')
23
23
 
24
24
  module Graphics
25
25
 
@@ -37,10 +37,10 @@ module CTioga2
37
37
  include Log
38
38
 
39
39
  # The starting color (for x = 0)
40
- attr_accessor :start
40
+ typed_attribute :start, 'color'
41
41
 
42
42
  # The ending color (for x = 1)
43
- attr_accessor :end
43
+ typed_attribute :end, 'color'
44
44
 
45
45
  def initialize(s,e)
46
46
  warn { "This class shouldn't be used anymore at #{caller.inspect}" }
@@ -17,7 +17,7 @@ require 'ctioga2/log'
17
17
  # This module contains all the classes used by ctioga
18
18
  module CTioga2
19
19
 
20
- Version::register_svn_info('$Revision$', '$Date$')
20
+ Version::register_svn_info('$Revision: 359 $', '$Date: 2012-12-26 10:45:35 +0100 (Wed, 26 Dec 2012) $')
21
21
 
22
22
  module Graphics
23
23
 
@@ -27,7 +27,7 @@ module CTioga2
27
27
  class LegendStorageStyle < BasicStyle
28
28
 
29
29
  # The distance between two lines, a Types::Dimension object.
30
- attr_accessor :dy
30
+ typed_attribute :dy, 'dimension'
31
31
 
32
32
  # The width of the legend pictogram, a Types::Dimension object.
33
33
  attr_accessor :picto_width
@@ -38,12 +38,22 @@ module CTioga2
38
38
  # The distance between the legend pictogram and the text
39
39
  attr_accessor :picto_to_text
40
40
 
41
- # The scale of the legend
42
- attr_accessor :scale
41
+ # The overall scale of the legend
42
+ typed_attribute :scale, 'float'
43
43
 
44
44
  # The scale of the legend text -- relative to the overall
45
45
  # scale.
46
- attr_accessor :text_scale
46
+ typed_attribute :text_scale, 'float'
47
+
48
+ # The scale of the pictogram
49
+ typed_attribute :symbol_scale, 'float'
50
+
51
+
52
+ # A frame around the legend
53
+ sub_style :frame, BoxStyle
54
+
55
+ # Padding around the frame
56
+ typed_attribute :frame_padding, 'dimension'
47
57
 
48
58
  def initialize
49
59
  @dy = Types::Dimension.new(:dy, 1.6, :y)
@@ -55,6 +65,11 @@ module CTioga2
55
65
 
56
66
  @scale = 0.8
57
67
  @text_scale = 0.82
68
+ @symbol_scale = 1
69
+
70
+ @frame = BoxStyle.new()
71
+
72
+ @frame_padding = Types::Dimension.from_text("1mm", :x)
58
73
  end
59
74
  end
60
75
  end
@@ -17,7 +17,7 @@ require 'ctioga2/log'
17
17
  # This module contains all the classes used by ctioga
18
18
  module CTioga2
19
19
 
20
- Version::register_svn_info('$Revision$', '$Date$')
20
+ Version::register_svn_info('$Revision: 335 $', '$Date: 2012-12-23 00:29:44 +0100 (Sun, 23 Dec 2012) $')
21
21
 
22
22
  module Graphics
23
23
 
@@ -36,10 +36,10 @@ module CTioga2
36
36
 
37
37
  # The name of the X axis, something to be fed to
38
38
  # PlotStyle#get_axis_key
39
- attr_accessor :xaxis
39
+ typed_attribute :xaxis, 'axis'
40
40
 
41
41
  # The name of the Y axis
42
- attr_accessor :yaxis
42
+ typed_attribute :yaxis, 'axis'
43
43
 
44
44
  # Given a PlotStyle object, returns the axes keys as would
45
45
  # PlotStyle#get_axis_key
@@ -32,17 +32,17 @@ module CTioga2
32
32
  attr_accessor :color_map
33
33
 
34
34
  # Zmin and Zmax boundaries
35
- attr_accessor :bounds
35
+ typed_attribute :bounds, "float-range"
36
36
 
37
37
  # Size of the bar (not counting the label)
38
- attr_accessor :bar_size
38
+ typed_attribute :bar_size, 'dimension'
39
39
 
40
40
  # Space to be left between the graph and the beginning of the
41
41
  # graph
42
- attr_accessor :bar_shift
42
+ typed_attribute :bar_shift, 'dimension'
43
43
 
44
44
  # Space to be left on the side
45
- attr_accessor :padding
45
+ typed_attribute :padding, 'dimension'
46
46
 
47
47
  # Creates a new MapAxisStyle object at the given location with
48
48
  # the given style.
@@ -155,10 +155,9 @@ module CTioga2
155
155
  end
156
156
 
157
157
  end
158
+ # @todo This naming doesn't look that good, honestly
159
+ ZAxisStyle = MapAxisStyle.options_hash()
158
160
 
159
- ZAxisStyle = FullAxisStyle.dup
160
- ZAxisStyle['bar_size'] = CmdArg.new('dimension')
161
- ZAxisStyle['bar_shift'] = CmdArg.new('dimension')
162
161
  end
163
162
  end
164
163
  end
@@ -19,7 +19,7 @@ require 'ctioga2/graphics/coordinates'
19
19
  # This module contains all the classes used by ctioga
20
20
  module CTioga2
21
21
 
22
- Version::register_svn_info('$Revision$', '$Date$')
22
+ Version::register_svn_info('$Revision: 370 $', '$Date: 2012-12-28 17:40:18 +0100 (Fri, 28 Dec 2012) $')
23
23
 
24
24
  module Graphics
25
25
 
@@ -33,6 +33,10 @@ module CTioga2
33
33
  # * ticks
34
34
  # * background (uniform fill + watermark if applicable + possibly
35
35
  # a picture .?)
36
+ #
37
+ # This class is way too complex and needs too much flexibility
38
+ # to be handled by a subclass of BasicStyle. However, all
39
+ # substyles should be.
36
40
  class PlotStyle
37
41
 
38
42
  include Tioga::FigureConstants
@@ -77,27 +81,36 @@ module CTioga2
77
81
  def initialize
78
82
  # Default style for the plots.
79
83
  @axes = {}
80
- @axes[:left] = AxisStyle.new(:left,
81
- AXIS_WITH_TICKS_AND_NUMERIC_LABELS,
82
- '$y$')
83
- @axes[:bottom] = AxisStyle.new(:bottom,
84
- AXIS_WITH_TICKS_AND_NUMERIC_LABELS,
85
- '$x$')
86
-
87
- @axes[:right] = AxisStyle.new(:right, AXIS_WITH_TICKS_ONLY)
88
- @axes[:top] = AxisStyle.new(:top, AXIS_WITH_TICKS_ONLY)
84
+ @axes[:left] =
85
+ StyleSheet.style_for(AxisStyle, 'left', :left,
86
+ AXIS_WITH_TICKS_AND_NUMERIC_LABELS,
87
+ '$y$')
88
+ @axes[:bottom] =
89
+ StyleSheet.style_for(AxisStyle, 'bottom', :bottom,
90
+ AXIS_WITH_TICKS_AND_NUMERIC_LABELS,
91
+ '$x$')
92
+
93
+ @axes[:right] =
94
+ StyleSheet.style_for(AxisStyle, 'right', :right,
95
+ AXIS_WITH_TICKS_ONLY)
96
+ @axes[:top] =
97
+ StyleSheet.style_for(AxisStyle, 'top', :top,
98
+ AXIS_WITH_TICKS_ONLY)
89
99
 
90
100
  @xaxis_location = :bottom
91
101
  @yaxis_location = :left
92
102
 
93
- @title = TextLabel.new
94
- @title.loc = Types::PlotLocation.new(:top)
103
+ @title =
104
+ StyleSheet.style_for(TextLabel, 'title',
105
+ nil,
106
+ Types::PlotLocation.new(:top))
95
107
 
96
108
  @plot_margin = nil
97
109
 
98
110
  @transforms = CoordinateTransforms.new
99
111
 
100
- @background = BackgroundStyle.new
112
+ @background =
113
+ StyleSheet.style_for(BackgroundStyle, 'background')
101
114
 
102
115
  # A padding of 4bp ? Why ?? Why not ?
103
116
  @padding = Types::Dimension.new(:bp, 4)
@@ -227,7 +240,7 @@ module CTioga2
227
240
  axis.draw_axis(t)
228
241
  rescue Exception => e
229
242
  error { "Impossible to draw axis #{which}: #{e.message}" }
230
- debug { "Full message: #{e.inspect}" }
243
+ debug { "Full message: #{e.inspect}\n#{e.backtrace.join("\n")}" }
231
244
  end
232
245
  end
233
246
  end
@@ -319,13 +332,12 @@ module CTioga2
319
332
  "Axes and labels", "Axes and labels", 40)
320
333
 
321
334
 
322
-
323
335
  AxisTypeCommands = []
324
336
  [:left, :right, :top, :bottom].each do |loc|
325
337
  AxisTypeCommands <<
326
338
  Cmd.new("#{loc}",nil,"--#{loc}",
327
339
  [
328
- CmdArg.new('axis-decoration'),
340
+ AxisStyleOptions['decoration'],
329
341
  ], PartialAxisStyle) do |plotmaker, dec, opts|
330
342
  style = AxisStyle.current_axis_style(plotmaker, loc)
331
343
  style.decoration = dec
@@ -336,14 +348,18 @@ module CTioga2
336
348
  describe("Sets the type of the #{loc} axis",
337
349
  <<"EOH", AxisGroup)
338
350
  Sets the type of the #{loc} axis.
351
+
352
+ The options have the same meaning as for {command: define-axis-style},
353
+ see that command for more information.
339
354
  EOH
355
+
340
356
  end
341
357
 
342
358
  AxisStyleCommand =
343
359
  Cmd.new("axis-style",nil,"--axis-style",
344
360
  [
345
361
  CmdArg.new('axis'),
346
- ], FullAxisStyle) do |plotmaker, which, opts|
362
+ ], AxisStyleOptions) do |plotmaker, which, opts|
347
363
  style = AxisStyle.current_axis_style(plotmaker, which)
348
364
  style.set_from_hash(opts)
349
365
  end
@@ -351,8 +367,8 @@ EOH
351
367
  describe("Sets the style of the given axis",
352
368
  <<"EOH", AxisGroup)
353
369
  This command can be used to set various aspects of the style of the
354
- given axis, through its various options:
355
- * decoration
370
+ given axis, through its various options, which are documented in more details
371
+ in the {command: define-axis-style} command.
356
372
  EOH
357
373
 
358
374
  BackgroundLinesCommand =
@@ -360,10 +376,9 @@ EOH
360
376
  [
361
377
  CmdArg.new('axis'),
362
378
  CmdArg.new('color-or-false')
363
- ],{
364
- 'style' => CmdArg.new('line-style'),
365
- 'width' => CmdArg.new('float')
366
- }) do |plotmaker, which, color, options|
379
+ ],
380
+ StrokeStyle.options_hash().without('color')
381
+ ) do |plotmaker, which, color, options|
367
382
  axis = AxisStyle.current_axis_style(plotmaker, which)
368
383
  if color
369
384
  style = {'color' => color}
@@ -388,7 +403,8 @@ EOH
388
403
  %w{x y}.each do |axis|
389
404
  labelcmd = Cmd.new("#{axis}label", "-#{axis}",
390
405
  "--#{axis}label", [ CmdArg.new('text') ],
391
- FullTextStyleOptions) do |plotmaker, label, options|
406
+ TextLabel.options_hash().without('text')
407
+ ) do |plotmaker, label, options|
392
408
  PlotStyle.current_plot_style(plotmaker).
393
409
  set_label_style("#{axis}_label", options, label)
394
410
  end
@@ -396,6 +412,8 @@ EOH
396
412
  <<"EOH", AxisGroup)
397
413
  Sets the #{axis.upcase} label of the current plot.
398
414
  EOH
415
+
416
+ Commands::make_alias_for_option "#{axis}label", 'alignment', 'align', true
399
417
 
400
418
  nolabelcmd = Cmd.new("no-#{axis}label", nil,
401
419
  "--no-#{axis}label", []) do |plotmaker|
@@ -424,8 +442,10 @@ EOD
424
442
  end
425
443
 
426
444
  TitleLabelCommand =
427
- Cmd.new('title', '-t', '--title', [ CmdArg.new('text') ],
428
- FullTextStyleOptions) do |plotmaker, label, options|
445
+ Cmd.new('title', '-t', '--title',
446
+ [ CmdArg.new('text') ],
447
+ TextLabel.options_hash().without('text')
448
+ ) do |plotmaker, label, options|
429
449
  PlotStyle.current_plot_style(plotmaker).
430
450
  set_label_style('title', options, label)
431
451
  end
@@ -435,6 +455,8 @@ EOD
435
455
  Sets the title of the current plot.
436
456
  EOH
437
457
 
458
+ Commands::make_alias_for_option 'title', 'alignment', 'align', true
459
+
438
460
  NoTitleLabelCommand =
439
461
  Cmd.new('no-title', nil, '--no-title', []) do |plotmaker|
440
462
  PlotStyle.current_plot_style(plotmaker).
@@ -501,6 +523,8 @@ EOH
501
523
  PlotStyle.current_plot_style(plotmaker).
502
524
  set_label_style(which, options)
503
525
  end
526
+
527
+ Commands::make_alias_for_option 'label-style', 'alignment', 'align', true
504
528
 
505
529
  LabelStyleCommand.describe("Sets the style of the given label",
506
530
  <<"EOH", AxisGroup)
@@ -517,6 +541,7 @@ override the color using the /stroke_color option of
517
541
  greater.
518
542
  EOH
519
543
 
544
+
520
545
  end
521
546
  end
522
547
  end