ctioga2 0.10 → 0.10.1

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,10 @@
1
+ ctioga2 (0.10.1)
2
+
3
+ * Fix problems with Ruby1.8
4
+ * Fix clipping of regions
5
+
6
+ -- Vincent <vincent.fourmond@9online.fr> Wed 26 Mar 22:13:47 CET 2014
7
+
1
8
  ctioga2 (0.10)
2
9
 
3
10
  * A draw-image function to include JPEG and PNG images
@@ -139,6 +139,8 @@ encoders = [ EncodingJob.new ]
139
139
  cur_enc = encoders.first
140
140
 
141
141
 
142
+ ct2_extra_args = []
143
+
142
144
  opts = OptionParser.new do |opts|
143
145
  opts.banner = "Usage: #$0 [options] file.ct2 arguments..."
144
146
 
@@ -197,6 +199,20 @@ opts = OptionParser.new do |opts|
197
199
  end
198
200
 
199
201
 
202
+ opts.on("", "--ctioga2-args ARGS", "Extra args for ctioga2") do |v|
203
+ ct2_extra_args += Shellwords.split(v)
204
+ end
205
+
206
+ opts.on("-s", "--set EXPR", "Sets the given variable") do |t|
207
+ l = t.split(/\s*=\s*/, 2)
208
+ if l.size != 2
209
+ puts "The argument of --set must be in the form 'variable=value'"
210
+ exit 1
211
+ end
212
+ ct2_extra_args += ['--set', *l]
213
+ end
214
+
215
+
200
216
  end
201
217
 
202
218
  opts.parse!(ARGV)
@@ -260,6 +276,7 @@ for f in args
260
276
  name = format % index
261
277
 
262
278
  ct2_cmdline = [ct2,
279
+ *ct2_extra_args,
263
280
  "--set", "arg", f,
264
281
  "--set", "index", "#{index}",
265
282
  "-f", file, "--name", name, "-r", ct2_page_size]
@@ -114,7 +114,7 @@ module CTioga2
114
114
 
115
115
  # Now, create the command
116
116
  cmd_args = comp.map do |x|
117
- if x.respond_to?(:type)
117
+ if x.is_a? CmdArg
118
118
  x
119
119
  else
120
120
  CmdArg.new(x)
@@ -123,7 +123,7 @@ module CTioga2
123
123
 
124
124
  cmd_opts = {}
125
125
  for k,v in opts
126
- cmd_opts[k] = if v.respond_to?(:type)
126
+ cmd_opts[k] = if v.is_a? CmdArg
127
127
  v
128
128
  else
129
129
  CmdArg.new(v)
@@ -15,6 +15,8 @@
15
15
  require 'ctioga2/utils'
16
16
  require 'ctioga2/log'
17
17
 
18
+ require 'forwardable'
19
+
18
20
  module CTioga2
19
21
 
20
22
  module Graphics
@@ -24,6 +26,8 @@ module CTioga2
24
26
  # A Container that redirect most of its trafic to the parents.
25
27
  class RedirectingContainer < Container
26
28
 
29
+ extend Forwardable
30
+
27
31
  ###########################################
28
32
  # The following functions are plain redirections to the
29
33
  # parent.
@@ -32,27 +36,10 @@ module CTioga2
32
36
  # redirection in the form of an accessor. Using forwardable
33
37
  # should do
34
38
 
35
- def style(*a)
36
- return parent.style(*a)
37
- end
38
-
39
- def add_legend_item(item)
40
- return parent.add_legend_item(item)
41
- end
42
-
43
- def legend_area=(l)
44
- return parent.legend_area = l
45
- end
46
-
47
39
  undef :gp_cache, :gp_cache=
48
-
49
- def gp_cache
50
- return parent.gp_cache
51
- end
52
40
 
53
- def gp_cache=(c)
54
- return parent.gp_cache = c
55
- end
41
+ def_delegators :parent, :style, :add_legend_item, :legend_area=,
42
+ :gp_cache, :gp_cache=, :set_user_boundaries
56
43
 
57
44
  def each_item(leaf_only = true, recursive = false, tl = true, &blk)
58
45
  if tl
@@ -41,6 +41,7 @@ module CTioga2
41
41
  # Creates a new empty region
42
42
  def initialize(parent = nil, root = nil)
43
43
  @parent = parent
44
+ @clipped = true # clipped by default !
44
45
 
45
46
  # elements to be given to tioga
46
47
  @curves = []
@@ -85,7 +86,7 @@ module CTioga2
85
86
  def real_do(t)
86
87
  # This function will be called with the proper figure
87
88
  # coordinates.
88
-
89
+
89
90
  if @fill_style.color
90
91
  t.context do
91
92
  @fill_style.setup_fill(t)
@@ -85,7 +85,8 @@ module CTioga2
85
85
  style = Styles::StyleSheet.style_for(Styles::ArrowStyle ,st_name)
86
86
  style.set_from_hash(options)
87
87
 
88
- style.draw_arrow(t, *options['tail'], *options['head'])
88
+ coords = options['tail'] + options['head']
89
+ style.draw_arrow(t, *coords)
89
90
  end
90
91
  end
91
92
 
@@ -66,7 +66,7 @@ EOD
66
66
  dict = info.dup
67
67
  dict.merge!('ul' => ul,
68
68
  'll' => ll,
69
- 'lr' => lr,)
69
+ 'lr' => lr)
70
70
 
71
71
  # @todo provide a way to reuse images ?
72
72
  t.context do
@@ -2,7 +2,7 @@
2
2
  module CTioga2
3
3
 
4
4
  module Version
5
- GIT_VERSION = '0.10'
6
- GIT_DATE = 'Sun 16 Mar 18:22:35 CET 2014'
5
+ GIT_VERSION = '0.10.1'
6
+ GIT_DATE = 'Wed 26 Mar 22:14:59 CET 2014'
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ctioga2
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.10'
4
+ version: 0.10.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-03-16 00:00:00.000000000 Z
12
+ date: 2014-03-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: tioga