ctioga2 0.7 → 0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. data/Changelog +8 -0
  2. data/lib/ctioga2/commands/arguments.rb +0 -2
  3. data/lib/ctioga2/commands/commands.rb +0 -2
  4. data/lib/ctioga2/commands/context.rb +0 -2
  5. data/lib/ctioga2/commands/doc/doc.rb +0 -2
  6. data/lib/ctioga2/commands/doc/documentation-commands.rb +0 -2
  7. data/lib/ctioga2/commands/doc/help.rb +0 -2
  8. data/lib/ctioga2/commands/doc/html.rb +0 -2
  9. data/lib/ctioga2/commands/doc/introspection.rb +0 -2
  10. data/lib/ctioga2/commands/doc/man.rb +0 -2
  11. data/lib/ctioga2/commands/doc/markup.rb +0 -2
  12. data/lib/ctioga2/commands/doc/wordwrap.rb +0 -2
  13. data/lib/ctioga2/commands/general-commands.rb +0 -2
  14. data/lib/ctioga2/commands/general-types.rb +0 -2
  15. data/lib/ctioga2/commands/groups.rb +0 -2
  16. data/lib/ctioga2/commands/interpreter.rb +0 -2
  17. data/lib/ctioga2/commands/parsers/command-line.rb +0 -2
  18. data/lib/ctioga2/commands/parsers/file.rb +0 -2
  19. data/lib/ctioga2/commands/parsers/old-file.rb +0 -2
  20. data/lib/ctioga2/commands/strings.rb +0 -2
  21. data/lib/ctioga2/commands/type.rb +0 -2
  22. data/lib/ctioga2/commands/variables.rb +0 -2
  23. data/lib/ctioga2/data/backends/backend.rb +0 -3
  24. data/lib/ctioga2/data/backends/backends/direct.rb +0 -3
  25. data/lib/ctioga2/data/backends/backends/gnuplot.rb +0 -3
  26. data/lib/ctioga2/data/backends/backends/math.rb +0 -2
  27. data/lib/ctioga2/data/backends/backends/text.rb +0 -3
  28. data/lib/ctioga2/data/backends/description.rb +0 -3
  29. data/lib/ctioga2/data/backends/factory.rb +18 -2
  30. data/lib/ctioga2/data/backends/parameter.rb +0 -2
  31. data/lib/ctioga2/data/datacolumn.rb +0 -2
  32. data/lib/ctioga2/data/dataset.rb +5 -3
  33. data/lib/ctioga2/data/filters.rb +0 -3
  34. data/lib/ctioga2/data/indexed-dtable.rb +0 -3
  35. data/lib/ctioga2/data/point.rb +0 -3
  36. data/lib/ctioga2/data/stack.rb +2 -4
  37. data/lib/ctioga2/graphics/coordinates.rb +0 -2
  38. data/lib/ctioga2/graphics/elements.rb +1 -2
  39. data/lib/ctioga2/graphics/elements/containers.rb +32 -2
  40. data/lib/ctioga2/graphics/elements/contour.rb +0 -2
  41. data/lib/ctioga2/graphics/elements/curve2d.rb +0 -2
  42. data/lib/ctioga2/graphics/elements/element.rb +4 -2
  43. data/lib/ctioga2/graphics/elements/gradient-region.rb +0 -2
  44. data/lib/ctioga2/graphics/elements/histogram.rb +298 -0
  45. data/lib/ctioga2/graphics/elements/parametric2d.rb +7 -3
  46. data/lib/ctioga2/graphics/elements/primitive.rb +0 -2
  47. data/lib/ctioga2/graphics/elements/redirecting-container.rb +21 -2
  48. data/lib/ctioga2/graphics/elements/region.rb +0 -2
  49. data/lib/ctioga2/graphics/elements/subplot.rb +0 -2
  50. data/lib/ctioga2/graphics/elements/tangent.rb +0 -2
  51. data/lib/ctioga2/graphics/elements/xyz-contour.rb +0 -2
  52. data/lib/ctioga2/graphics/elements/xyz-map.rb +0 -2
  53. data/lib/ctioga2/graphics/generator.rb +47 -42
  54. data/lib/ctioga2/graphics/legends.rb +0 -2
  55. data/lib/ctioga2/graphics/legends/area.rb +0 -2
  56. data/lib/ctioga2/graphics/legends/items.rb +0 -2
  57. data/lib/ctioga2/graphics/legends/multicols.rb +0 -2
  58. data/lib/ctioga2/graphics/legends/provider.rb +0 -2
  59. data/lib/ctioga2/graphics/legends/storage.rb +0 -2
  60. data/lib/ctioga2/graphics/root.rb +0 -2
  61. data/lib/ctioga2/graphics/styles/arrows.rb +0 -2
  62. data/lib/ctioga2/graphics/styles/axes.rb +0 -2
  63. data/lib/ctioga2/graphics/styles/background.rb +0 -2
  64. data/lib/ctioga2/graphics/styles/base.rb +4 -2
  65. data/lib/ctioga2/graphics/styles/box.rb +0 -2
  66. data/lib/ctioga2/graphics/styles/carrays.rb +0 -2
  67. data/lib/ctioga2/graphics/styles/colormap.rb +0 -2
  68. data/lib/ctioga2/graphics/styles/contour.rb +0 -2
  69. data/lib/ctioga2/graphics/styles/curve.rb +0 -2
  70. data/lib/ctioga2/graphics/styles/drawable.rb +0 -2
  71. data/lib/ctioga2/graphics/styles/errorbar.rb +0 -2
  72. data/lib/ctioga2/graphics/styles/factory.rb +0 -2
  73. data/lib/ctioga2/graphics/styles/gradients.rb +0 -2
  74. data/lib/ctioga2/graphics/styles/legend.rb +0 -2
  75. data/lib/ctioga2/graphics/styles/location.rb +0 -2
  76. data/lib/ctioga2/graphics/styles/map-axes.rb +0 -2
  77. data/lib/ctioga2/graphics/styles/plot-types.rb +51 -3
  78. data/lib/ctioga2/graphics/styles/plot.rb +0 -2
  79. data/lib/ctioga2/graphics/styles/sets.rb +0 -2
  80. data/lib/ctioga2/graphics/styles/sheet.rb +0 -2
  81. data/lib/ctioga2/graphics/styles/texts.rb +0 -2
  82. data/lib/ctioga2/graphics/styles/ticks.rb +0 -2
  83. data/lib/ctioga2/graphics/subplot-commands.rb +0 -2
  84. data/lib/ctioga2/graphics/types.rb +11 -4
  85. data/lib/ctioga2/graphics/types/bijection.rb +0 -2
  86. data/lib/ctioga2/graphics/types/boundaries.rb +0 -2
  87. data/lib/ctioga2/graphics/types/boxes.rb +0 -2
  88. data/lib/ctioga2/graphics/types/dimensions.rb +0 -2
  89. data/lib/ctioga2/graphics/types/fill.rb +27 -15
  90. data/lib/ctioga2/graphics/types/grid.rb +0 -2
  91. data/lib/ctioga2/graphics/types/location.rb +0 -2
  92. data/lib/ctioga2/graphics/types/point.rb +0 -2
  93. data/lib/ctioga2/log.rb +0 -2
  94. data/lib/ctioga2/metabuilder/type.rb +0 -2
  95. data/lib/ctioga2/metabuilder/types/coordinates.rb +0 -2
  96. data/lib/ctioga2/metabuilder/types/data.rb +0 -2
  97. data/lib/ctioga2/metabuilder/types/dates.rb +0 -1
  98. data/lib/ctioga2/metabuilder/types/generic.rb +0 -3
  99. data/lib/ctioga2/metabuilder/types/lists.rb +25 -3
  100. data/lib/ctioga2/metabuilder/types/numbers.rb +0 -2
  101. data/lib/ctioga2/metabuilder/types/strings.rb +0 -3
  102. data/lib/ctioga2/metabuilder/types/styles.rb +0 -2
  103. data/lib/ctioga2/plotmaker.rb +2 -4
  104. data/lib/ctioga2/postprocess.rb +0 -2
  105. data/lib/ctioga2/utils.rb +6 -64
  106. data/lib/ctioga2/version.rb +8 -0
  107. metadata +6 -4
@@ -17,8 +17,6 @@ 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: 387 $', '$Date: 2013-03-12 09:33:37 +0100 (Tue, 12 Mar 2013) $')
21
-
22
20
  module Graphics
23
21
 
24
22
  module Styles
@@ -17,8 +17,6 @@ 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: 335 $', '$Date: 2012-12-23 00:29:44 +0100 (Sun, 23 Dec 2012) $')
21
-
22
20
  module Graphics
23
21
 
24
22
  # All the styles
@@ -17,8 +17,6 @@ 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$')
21
-
22
20
  module Graphics
23
21
 
24
22
  module Styles
@@ -18,8 +18,6 @@ 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$')
22
-
23
21
  module Graphics
24
22
 
25
23
  module Styles
@@ -56,15 +54,21 @@ EOD
56
54
 
57
55
  def prepare
58
56
  @reversed = {}
59
-
57
+
60
58
  2.times do |i|
61
59
  val = self.send("z#{i+1}")
62
60
  if val
63
61
  @reversed[val] = i
62
+ @needed = i+1
64
63
  end
65
64
  end
66
65
  end
67
66
 
67
+ # The number of Z columns needed for the style.
68
+ def z_columns_needed
69
+ return @needed || 0
70
+ end
71
+
68
72
  # Returns the marker style for the given Z values.
69
73
  #
70
74
  # This will only work if #prepare has been called first !
@@ -116,6 +120,50 @@ EOD
116
120
  end
117
121
 
118
122
  end
123
+
124
+ CumulativeHistogramsType =
125
+ CmdType.new('cumulative-histograms',
126
+ {
127
+ :type => :integer,
128
+ :shortcuts => {
129
+ /next/i => :next,
130
+ /no|false/i => false
131
+ }
132
+ }, <<EOD)
133
+ How to specify that histograms should be stacked. Can be:
134
+ * a positive number, in which case the following histograms
135
+ will be added to the numbered one (0 is the first)
136
+ * no/false, in which case the following histograms are not stacked
137
+ * next, in which case the following histograms get stacked on a new slot
138
+ EOD
139
+
140
+
141
+ # This class defines various informations about the look of
142
+ # histograms.
143
+ class HistogramStyle < BasicStyle
144
+
145
+ # Separation between the histograms inside a group of histogram
146
+ typed_attribute :intra_sep, 'dimension'
147
+
148
+ # Separation between the histograms of different groups
149
+ typed_attribute :gap, 'dimension'
150
+
151
+ # Specs for cumulative
152
+ typed_attribute :cumulative, 'cumulative-histograms'
153
+
154
+ def set_from_hash(hash, name = "%s")
155
+ super
156
+
157
+ if @cumulative == :next
158
+ @last_neg ||= 0
159
+ @last_neg -= 1
160
+ @cumulative = @last_neg
161
+ end
162
+
163
+ end
164
+
165
+
166
+ end
119
167
  end
120
168
 
121
169
  end
@@ -19,8 +19,6 @@ 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: 521 $', '$Date: 2013-09-21 18:55:05 +0200 (Sat, 21 Sep 2013) $')
23
-
24
22
  module Graphics
25
23
 
26
24
  module Styles
@@ -17,8 +17,6 @@ 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: 467 $', '$Date: 2013-08-31 14:10:52 +0200 (Sat, 31 Aug 2013) $')
21
-
22
20
  module Graphics
23
21
 
24
22
  module Styles
@@ -19,8 +19,6 @@ 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$')
23
-
24
22
  module Graphics
25
23
 
26
24
  module Styles
@@ -17,8 +17,6 @@ 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: 478 $', '$Date: 2013-09-01 11:24:02 +0200 (Sun, 01 Sep 2013) $')
21
-
22
20
  module Graphics
23
21
 
24
22
  module Styles
@@ -19,8 +19,6 @@ 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$')
23
-
24
22
  module Graphics
25
23
 
26
24
  module Styles
@@ -16,8 +16,6 @@ require 'ctioga2/log'
16
16
 
17
17
  module CTioga2
18
18
 
19
- Version::register_svn_info('$Revision: 214 $', '$Date: 2010-12-31 02:50:03 +0100 (Fri, 31 Dec 2010) $')
20
-
21
19
  module Graphics
22
20
 
23
21
  # The group containing all commands linked to subplots and other
@@ -26,8 +26,6 @@ require 'ctioga2/graphics/types/grid'
26
26
  # This module contains all the classes used by ctioga
27
27
  module CTioga2
28
28
 
29
- Version::register_svn_info('$Revision: 523 $', '$Date: 2013-09-22 15:31:16 +0200 (Sun, 22 Sep 2013) $')
30
-
31
29
  module Graphics
32
30
 
33
31
  # A small convenience module for line styles
@@ -96,7 +94,9 @@ EOD
96
94
  /no(ne)?|off/i => false,
97
95
  }
98
96
  }, <<EOD)
99
- A line style, or @no@, @none@ or @off@ to mean no line.
97
+ A line style, which is one of @solid@, @dots@, @dashes@, @small_dots@,
98
+ a series of comma-separated numbers which are the length of the
99
+ strokes and gaps, or @no@, @none@ or @off@ to mean no line.
100
100
  EOD
101
101
 
102
102
  MarkerType =
@@ -109,7 +109,14 @@ EOD
109
109
  'none' => 'None',
110
110
  'off' => 'None',
111
111
  },}, <<EOD)
112
- A Tioga Marker.
112
+ A Tioga Marker, ie either a name from the list at {url:
113
+ http://tioga.rubyforge.org/doc/Tioga/MarkerConstants.html}, such as
114
+ @Box@, @Star@, @Spade@ or two or three comma-separated numbers,
115
+ _font_, _number_ and _width_. _font_ defines the font (standard PDF
116
+ fonts, from 1 to 14), _number_ the number of the character within the
117
+ font (between 0 and 255), and if _width_ is specified, the marker is
118
+ stroked and not filled, and the number is the line width for the
119
+ stroke.
113
120
  EOD
114
121
 
115
122
  PointType =
@@ -16,8 +16,6 @@ require 'ctioga2/log'
16
16
 
17
17
  module CTioga2
18
18
 
19
- Version::register_svn_info('$Revision: 155 $', '$Date: 2010-06-21 21:41:32 +0200 (Mon, 21 Jun 2010) $')
20
-
21
19
  module Graphics
22
20
 
23
21
  module Types
@@ -16,8 +16,6 @@ require 'ctioga2/log'
16
16
 
17
17
  module CTioga2
18
18
 
19
- Version::register_svn_info('$Revision: 125 $', '$Date: 2010-01-12 00:56:15 +0100 (Tue, 12 Jan 2010) $')
20
-
21
19
  # This module contains all graphical elements of CTioga2
22
20
  module Graphics
23
21
 
@@ -16,8 +16,6 @@ require 'ctioga2/log'
16
16
 
17
17
  module CTioga2
18
18
 
19
- Version::register_svn_info('$Revision: 92 $', '$Date: 2009-06-24 01:17:46 +0200 (Wed, 24 Jun 2009) $')
20
-
21
19
  # This module contains all graphical elements of CTioga2
22
20
  module Graphics
23
21
 
@@ -16,8 +16,6 @@ require 'ctioga2/log'
16
16
 
17
17
  module CTioga2
18
18
 
19
- Version::register_svn_info('$Revision: 469 $', '$Date: 2013-08-31 14:10:56 +0200 (Sat, 31 Aug 2013) $')
20
-
21
19
  module Graphics
22
20
 
23
21
  module Types
@@ -16,8 +16,6 @@ require 'ctioga2/log'
16
16
 
17
17
  module CTioga2
18
18
 
19
- Version::register_svn_info('$Revision$', '$Date$')
20
-
21
19
  module Graphics
22
20
 
23
21
  module Types
@@ -66,33 +64,47 @@ module CTioga2
66
64
  return @type != :none
67
65
  end
68
66
 
67
+ # Wether we are closing by a vertical line
68
+ def vertical?
69
+ return (@type == :x || @type == :left || @type = :right)
70
+ end
71
+
72
+ # Wether we are closing with a horizontal line
73
+ def horizontal?
74
+ return (@type == :y || @type == :bottom || @type = :top)
75
+ end
76
+
77
+ # Returns the effective value of the
78
+ def effective_value(bounds)
79
+ case @type
80
+ when :bottom, :top
81
+ return bounds.send(@type)
82
+ when :left, :right
83
+ return bounds.send(@type)
84
+ else
85
+ return @value
86
+ end
87
+ end
88
+
69
89
  # Closes the current path according to the current style, based on:
70
90
  # * _bounds_, the boundaries of the plot
71
91
  # * _first_, the first point ([x, y])
72
92
  # * _last_, the last point
73
93
  def close_path(t, bounds, first, last)
74
94
  tp = @type
75
- target = @value
95
+ target = effective_value(bounds)
96
+
76
97
  case tp
77
98
  when :none
78
99
  raise "Close the path !"
79
- when :bottom, :top
80
- target = bounds.send(tp)
81
- tp = :y
82
- when :left, :right
83
- target = bounds.send(tp)
84
- tp = :x
85
- end
86
-
87
- case tp
88
- when :x
100
+ when :x, :left, :right
89
101
  t.append_point_to_path(target, last[1])
90
102
  t.append_point_to_path(target, first[1])
91
- when :y
103
+ when :y, :bottom, :top
92
104
  t.append_point_to_path(last[0], target)
93
105
  t.append_point_to_path(first[0], target)
94
106
  when :xy
95
- t.append_point_to_path(* @value.to_figure_xy(t))
107
+ t.append_point_to_path(* target.to_figure_xy(t))
96
108
  when :close
97
109
  else
98
110
  raise "Should not be here"
@@ -19,8 +19,6 @@ require 'ctioga2/graphics/types/boxes'
19
19
 
20
20
  module CTioga2
21
21
 
22
- Version::register_svn_info('$Revision: 147 $', '$Date: 2010-04-06 21:13:28 +0200 (Tue, 06 Apr 2010) $')
23
-
24
22
  module Graphics
25
23
 
26
24
  module Types
@@ -16,8 +16,6 @@ require 'ctioga2/log'
16
16
 
17
17
  module CTioga2
18
18
 
19
- Version::register_svn_info('$Revision: 360 $', '$Date: 2012-12-26 11:09:11 +0100 (Wed, 26 Dec 2012) $')
20
-
21
19
  module Graphics
22
20
 
23
21
  module Types
@@ -16,8 +16,6 @@ require 'ctioga2/log'
16
16
 
17
17
  module CTioga2
18
18
 
19
- Version::register_svn_info('$Revision: 196 $', '$Date: 2010-11-25 20:15:32 +0100 (Thu, 25 Nov 2010) $')
20
-
21
19
  module Graphics
22
20
 
23
21
  module Types
data/lib/ctioga2/log.rb CHANGED
@@ -16,8 +16,6 @@ require 'logger'
16
16
 
17
17
  module CTioga2
18
18
 
19
- Version::register_svn_info('$Revision: 522 $', '$Date: 2013-09-22 12:02:48 +0200 (Sun, 22 Sep 2013) $')
20
-
21
19
  # This module should be included (or extended) by every class that
22
20
  # need logging/debugging facilities.
23
21
  #
@@ -19,8 +19,6 @@
19
19
  require 'ctioga2/utils'
20
20
 
21
21
  module CTioga2
22
-
23
- Version::register_svn_info('$Revision: 523 $', '$Date: 2013-09-22 15:31:16 +0200 (Sun, 22 Sep 2013) $')
24
22
 
25
23
 
26
24
  # The MetaBuilder module contains a framework to perform
@@ -20,8 +20,6 @@ require 'ctioga2/utils'
20
20
 
21
21
  module CTioga2
22
22
 
23
- Version::register_svn_info('$Revision: 198 $', '$Date: 2010-11-30 00:48:23 +0100 (Tue, 30 Nov 2010) $')
24
-
25
23
  module MetaBuilder
26
24
  module Types
27
25
 
@@ -20,8 +20,6 @@ require 'ctioga2/utils'
20
20
 
21
21
  module CTioga2
22
22
 
23
- Version::register_svn_info('$Revision: 171 $', '$Date: 2010-10-22 17:07:52 +0200 (Fri, 22 Oct 2010) $')
24
-
25
23
  module MetaBuilder
26
24
  module Types
27
25
 
@@ -19,7 +19,6 @@ require 'time'
19
19
  require 'ctioga2/utils'
20
20
 
21
21
  module CTioga2
22
- Version::register_svn_info('$Revision: 2 $', '$Date: 2009-04-25 14:03:30 +0200 (Sat, 25 Apr 2009) $')
23
22
 
24
23
  module MetaBuilder
25
24
 
@@ -20,9 +20,6 @@ require 'ctioga2/utils'
20
20
 
21
21
  module CTioga2
22
22
 
23
- Version::register_svn_info('$Revision$', '$Date$')
24
-
25
-
26
23
  module MetaBuilder
27
24
 
28
25
  module Types
@@ -20,9 +20,6 @@ require 'ctioga2/utils'
20
20
 
21
21
  module CTioga2
22
22
 
23
- Version::register_svn_info('$Revision: 484 $', '$Date: 2013-09-02 22:44:42 +0200 (Mon, 02 Sep 2013) $')
24
-
25
-
26
23
  module MetaBuilder
27
24
 
28
25
  # The module Types should be used for all subclasses of
@@ -213,6 +210,31 @@ module CTioga2
213
210
  nb.times do |i|
214
211
  array << Utils::mix_objects(e,s, i * fact)
215
212
  end
213
+ elsif str =~ /(.*)!(\d+)(?:!(.*))?\s*$/
214
+ # We have a mixing
215
+ nb = $2.to_i
216
+ fact = nb*0.01
217
+ if fact > 1.0 || fact < 0.0
218
+ error { "Invalid number for mixing: #{nb}, using 50"}
219
+ fact = 0.5
220
+ end
221
+ st1 = $1
222
+ st2 = $3 || 'White' # default to colors !
223
+
224
+ ar1 = string_to_type(st1)
225
+ ar2 = string_to_type(st2)
226
+
227
+ # Make all the sequential combinations until we fall back
228
+ # on the first one.
229
+ ts = ar1.size.lcm(ar2.size)
230
+ ar1 *= ts/ar1.size
231
+ ar2 *= ts/ar2.size
232
+
233
+ arf = []
234
+ ar1.each_index do |i|
235
+ arf << Utils::mix_objects(ar1[i], ar2[i], fact)
236
+ end
237
+ return arf
216
238
  else
217
239
  array = super
218
240
  end