ctioga2 0.1 → 0.2

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.
data/Changelog CHANGED
@@ -1,3 +1,11 @@
1
+ ctioga2 (0.2)
2
+
3
+ * Fix small details in the legend positioning in the 'outside' scheme
4
+ * And added tests to ensure everything now looks (almost) fine
5
+ * Fixed a few bugs with legends inside regions and gradients
6
+
7
+ -- Vincent Fourmond <vincent.fourmond@9online.fr> Tue Feb 22 21:15:13 CET 2011
8
+
1
9
  ctioga2 (0.1)
2
10
 
3
11
  * Setting any set now resets its index
@@ -15,6 +15,7 @@
15
15
  require 'ctioga2/graphics/types'
16
16
  require 'ctioga2/graphics/elements/element'
17
17
  require 'ctioga2/graphics/elements/containers'
18
+ require 'ctioga2/graphics/elements/redirecting-container'
18
19
  require 'ctioga2/graphics/elements/subplot'
19
20
  require 'ctioga2/graphics/elements/region'
20
21
  require 'ctioga2/graphics/elements/gradient-region'
@@ -28,7 +29,7 @@ require 'ctioga2/graphics/elements/contour'
28
29
 
29
30
  module CTioga2
30
31
 
31
- Version::register_svn_info('$Revision: 187 $', '$Date: 2010-11-07 11:02:25 +0100 (Sun, 07 Nov 2010) $')
32
+ Version::register_svn_info('$Revision: 288 $', '$Date: 2011-02-22 21:12:58 +0100 (Tue, 22 Feb 2011) $')
32
33
 
33
34
  module Graphics
34
35
 
@@ -17,7 +17,7 @@ require 'ctioga2/log'
17
17
 
18
18
  module CTioga2
19
19
 
20
- Version::register_svn_info('$Revision: 159 $', '$Date: 2010-07-26 17:29:47 +0200 (Mon, 26 Jul 2010) $')
20
+ Version::register_svn_info('$Revision: 288 $', '$Date: 2011-02-22 21:12:58 +0100 (Tue, 22 Feb 2011) $')
21
21
 
22
22
  module Graphics
23
23
 
@@ -31,7 +31,7 @@ module CTioga2
31
31
  #
32
32
  # Like Region It is a fake container in the sense that all the
33
33
  # elements are actually forwarded to the parent.
34
- class GradientRegion < Container
34
+ class GradientRegion < RedirectingContainer
35
35
 
36
36
  undef :elements
37
37
  undef :subframe
@@ -70,11 +70,6 @@ module CTioga2
70
70
  def set_from_hash(hash)
71
71
  end
72
72
 
73
- # Redirects to the parent's style
74
- def style(*a)
75
- return parent.style(*a)
76
- end
77
-
78
73
  protected
79
74
 
80
75
  # Simply sets the color of the curves.
@@ -20,7 +20,7 @@ require 'Dobjects/Function'
20
20
 
21
21
  module CTioga2
22
22
 
23
- Version::register_svn_info('$Revision: 229 $', '$Date: 2011-01-17 17:34:57 +0100 (Mon, 17 Jan 2011) $')
23
+ Version::register_svn_info('$Revision: 284 $', '$Date: 2011-02-13 17:23:43 +0100 (Sun, 13 Feb 2011) $')
24
24
 
25
25
  module Graphics
26
26
 
@@ -31,9 +31,16 @@ module CTioga2
31
31
  # transparency, marker scale, marker type (discrete), possibly
32
32
  # stroke and fill colors ?
33
33
  #
34
- # @todo What would be interesting here would be to have indexed
35
- # plots, ie draw one curve for each value of Z, with a color
36
- # indexed by Z.
34
+ # @todo Find a mechanism to really say what varies. Ideally, one
35
+ # would want to say:
36
+ # * Y2 is marker color
37
+ # * Y3 is marker size
38
+ # * Y4 only takes discrete values and represents markers
39
+ #
40
+ # However, this is complex enough to be left out of the curve
41
+ # factory, I think. Color maps can be used for colors, but for
42
+ # the rest, things will have to be implemented as parameters to
43
+ # the curve generator, or even separated commands.
37
44
  class Parametric2D < TiogaElement
38
45
 
39
46
  include Log
@@ -0,0 +1,52 @@
1
+ # containers.rb: drawables that contains other drawables
2
+ # copyright (c) 2011 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
+
15
+ require 'ctioga2/utils'
16
+ require 'ctioga2/log'
17
+
18
+ module CTioga2
19
+
20
+ Version::register_svn_info('$Revision$', '$Date$')
21
+
22
+ module Graphics
23
+
24
+ module Elements
25
+
26
+ # A Container that redirect most of its trafic to the parents.
27
+ class RedirectingContainer < Container
28
+
29
+ ###########################################
30
+ # The following functions are plain redirections to the
31
+ # parent.
32
+ #
33
+ # \todo a scheme should probably be designed to allow simple
34
+ # redirection in the form of an accessor. Using forwardable
35
+ # should do
36
+
37
+ def style(*a)
38
+ return parent.style(*a)
39
+ end
40
+
41
+ def add_legend_item(item)
42
+ return parent.add_legend_item(item)
43
+ end
44
+
45
+ def legend_area=(l)
46
+ return parent.legend_area = l
47
+ end
48
+
49
+ end
50
+ end
51
+ end
52
+ end
@@ -17,7 +17,7 @@ require 'ctioga2/log'
17
17
 
18
18
  module CTioga2
19
19
 
20
- Version::register_svn_info('$Revision: 139 $', '$Date: 2010-01-22 00:12:17 +0100 (Fri, 22 Jan 2010) $')
20
+ Version::register_svn_info('$Revision: 288 $', '$Date: 2011-02-22 21:12:58 +0100 (Tue, 22 Feb 2011) $')
21
21
 
22
22
  module Graphics
23
23
 
@@ -26,7 +26,7 @@ module CTioga2
26
26
  # A Region is an object that draws filled regions among its
27
27
  # "elements". It is a fake container in the sense that all the
28
28
  # elements are actually forwarded to the parent.
29
- class Region < Container
29
+ class Region < RedirectingContainer
30
30
 
31
31
  undef :elements
32
32
  undef :subframe
@@ -74,11 +74,6 @@ module CTioga2
74
74
  @reversed_fill_style.set_from_hash(hash, 'reversed_%s')
75
75
  end
76
76
 
77
- # Redirects to the parent's style
78
- def style(*a)
79
- return parent.style(*a)
80
- end
81
-
82
77
  protected
83
78
 
84
79
  # Creates the appropriate subfigure and draws all its elements
@@ -16,7 +16,7 @@ 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) $')
19
+ Version::register_svn_info('$Revision: 285 $', '$Date: 2011-02-22 21:12:47 +0100 (Tue, 22 Feb 2011) $')
20
20
 
21
21
  module Graphics
22
22
 
@@ -26,6 +26,13 @@ module CTioga2
26
26
  # * inclusion of curves
27
27
  # * legends
28
28
  # * a way to set/get its figure boundaries.
29
+ #
30
+ # @todo It would be interesting to feature several layers:
31
+ # background/normal/foreground, that could be addressed just
32
+ # using options to drawing commands
33
+ #
34
+ # @todo It would also be interesting to offer the possibility to
35
+ # output non-clipped objects.
29
36
  class Subplot < Container
30
37
 
31
38
  # Various stylistic aspects of the plot, as a
@@ -16,7 +16,7 @@ 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) $')
19
+ Version::register_svn_info('$Revision: 285 $', '$Date: 2011-02-22 21:12:47 +0100 (Tue, 22 Feb 2011) $')
20
20
 
21
21
  module Graphics
22
22
 
@@ -86,10 +86,10 @@ module CTioga2
86
86
 
87
87
  # We make figure coordinates frame coordinates
88
88
  t.set_bounds([0, 1, 1, 0])
89
- # \todo customize this !
89
+ ## \todo customize this !
90
90
  x, y = initial_xy(t, container)
91
91
  for item in items
92
- # \todo transform the 0.0 for x into a negative
92
+ ## \todo transform the 0.0 for x into a negative
93
93
  # user-specifiable stuff.
94
94
  item.draw(t, @legend_style, x , y)
95
95
  y -= @legend_style.dy.to_figure(t,:y)
@@ -145,9 +145,6 @@ module CTioga2
145
145
  #
146
146
  # These arrays can be used as arguments for subframe_margins
147
147
  # or respectively the graph and the legends part of the plot.
148
- #
149
- # This function will *eventually* also work in the case of a
150
- # #legend_type :inside?
151
148
  def partition_frame(t, container)
152
149
  w,h = size(t, container)
153
150
  case @legend_type
@@ -176,14 +173,14 @@ module CTioga2
176
173
  def initial_xy(t, container)
177
174
  case @legend_type
178
175
  when :right
179
- l,r,t,b = container.actual_subframe(t).to_frame_margins(t)
176
+ l,r,top,b = container.actual_subframe(t).to_frame_margins(t)
180
177
  # Here, we take profit from the fact that frame
181
178
  # coordinates are also figure coordinates within the
182
179
  # legend.
183
180
 
184
- # \todo that won't work in the case of labels on the
181
+ ## \todo that won't work in the case of labels on the
185
182
  # right-hand-side.
186
- return [- l/2, 1.0 - t]
183
+ return [0, 1.0 - top]
187
184
  when :inside
188
185
  return [0.0, 1.0]
189
186
  else
data/lib/ctioga2/utils.rb CHANGED
@@ -24,7 +24,7 @@ module CTioga2
24
24
  # The current version of the program.
25
25
  def self.version
26
26
  if CTIOGA_VERSION =~ /SVN/
27
- return "SVN, revision #{SVN_INFO['revision']}, #{SVN_INFO['date']}"
27
+ return "SVN, revision #{SVN_INFO['revision']}#{SVN_INFO['suffix']}, #{SVN_INFO['date']}"
28
28
  else
29
29
  return CTIOGA_VERSION
30
30
  end
@@ -34,7 +34,7 @@ module CTioga2
34
34
  # arguments and have the Date and Revision svn:keyword:. Use this
35
35
  # way:
36
36
  #
37
- # Version::register_svn_info('$Revision: 194 $', '$Date: 2010-11-22 10:26:54 +0100 (Mon, 22 Nov 2010) $')
37
+ # Version::register_svn_info('$Revision: 286 $', '$Date: 2011-02-22 21:12:50 +0100 (Tue, 22 Feb 2011) $')
38
38
  #
39
39
  # To set the correct properties, the following command-line can be
40
40
  # used:
@@ -49,6 +49,10 @@ module CTioga2
49
49
  SVN_INFO['revision'] = rev.to_i
50
50
  SVN_INFO['date'] = date
51
51
  end
52
+ # Hmmm, we want to see how many revisions is git ahead of SVN
53
+ if rev_str =~ /(\+git\d+)/
54
+ SVN_INFO['suffix'] = $1
55
+ end
52
56
  end
53
57
  end
54
58
 
@@ -65,11 +69,12 @@ module CTioga2
65
69
  # Informations collected about subversion revisions
66
70
  SVN_INFO = {
67
71
  'revision' => 0,
68
- 'date' => "old"
72
+ 'date' => "old",
73
+ 'suffix' => ''
69
74
  }
70
75
 
71
76
  # The position of the URL, used for getting the version
72
- SVN_URL = '$HeadURL: svn+ssh://rubyforge.org/var/svn/ctioga2/releases/ctioga2-0.1/lib/ctioga2/utils.rb $'
77
+ SVN_URL = '$HeadURL: svn+ssh://rubyforge.org/var/svn/ctioga2/releases/ctioga2-0.2/lib/ctioga2/utils.rb $'
73
78
 
74
79
  # The version of ctioga2
75
80
  CTIOGA_VERSION = if SVN_URL =~ /releases\/ctioga2-([^\/]+)/
@@ -78,7 +83,7 @@ module CTioga2
78
83
  "SVN version"
79
84
  end
80
85
 
81
- register_svn_info('$Revision: 194 $', '$Date: 2010-11-22 10:26:54 +0100 (Mon, 22 Nov 2010) $')
86
+ register_svn_info('$Revision: 286 $', '$Date: 2011-02-22 21:12:50 +0100 (Tue, 22 Feb 2011) $')
82
87
 
83
88
  end
84
89
 
@@ -137,3 +142,11 @@ module CTioga2
137
142
  end
138
143
 
139
144
  end
145
+
146
+ begin
147
+ # This is a dirty hack in order to ensure that the SVN revision
148
+ # information is kept up-to-date even when using git-svn. This
149
+ # file is not present in standard installations.
150
+ require 'ctioga2/git-fools-svn'
151
+ rescue LoadError => e
152
+ end
metadata CHANGED
@@ -1,12 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ctioga2
3
3
  version: !ruby/object:Gem::Version
4
- hash: 9
4
+ hash: 15
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 1
9
- version: "0.1"
8
+ - 2
9
+ version: "0.2"
10
10
  platform: ruby
11
11
  authors:
12
12
  - Vincent Fourmond <vincent.fourmond@9online.fr>
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-01-31 00:00:00 +01:00
17
+ date: 2011-02-23 00:00:00 +01:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -32,7 +32,13 @@ dependencies:
32
32
  version: "1.13"
33
33
  type: :runtime
34
34
  version_requirements: *id001
35
- description:
35
+ description: |
36
+ ctioga2 is a command-driven plotting program that produces
37
+ high quality PDF files. It can be used both from the command-line
38
+ and using command files (at the same time).
39
+
40
+ It is based on Tioga.
41
+
36
42
  email: vincent.fourmond@9online.fr
37
43
  executables:
38
44
  - ctioga2
@@ -102,6 +108,7 @@ files:
102
108
  - lib/ctioga2/graphics/types.rb
103
109
  - lib/ctioga2/graphics/elements/subplot.rb
104
110
  - lib/ctioga2/graphics/elements/parametric2d.rb
111
+ - lib/ctioga2/graphics/elements/redirecting-container.rb
105
112
  - lib/ctioga2/graphics/elements/primitive.rb
106
113
  - lib/ctioga2/graphics/elements/region.rb
107
114
  - lib/ctioga2/graphics/elements/curve2d.rb