ctioga2 0.8 → 0.9
Sign up to get free protection for your applications and to get access to all the features.
- data/Changelog +15 -0
- data/bin/ct2-make-movie +253 -0
- data/lib/ctioga2/commands/doc/doc.rb +4 -0
- data/lib/ctioga2/commands/doc/documentation-commands.rb +23 -8
- data/lib/ctioga2/commands/doc/html.rb +111 -60
- data/lib/ctioga2/commands/doc/markup.rb +2 -2
- data/lib/ctioga2/commands/function.rb +90 -0
- data/lib/ctioga2/commands/general-commands.rb +12 -0
- data/lib/ctioga2/commands/general-functions.rb +106 -0
- data/lib/ctioga2/commands/general-types.rb +8 -3
- data/lib/ctioga2/commands/interpreter.rb +11 -0
- data/lib/ctioga2/commands/parsers/file.rb +7 -5
- data/lib/ctioga2/commands/strings.rb +25 -4
- data/lib/ctioga2/commands/variables.rb +5 -1
- data/lib/ctioga2/data/point.rb +12 -4
- data/lib/ctioga2/graphics/elements/curve2d.rb +13 -2
- data/lib/ctioga2/graphics/elements/subplot.rb +13 -1
- data/lib/ctioga2/graphics/styles/axes.rb +12 -2
- data/lib/ctioga2/graphics/styles/map-axes.rb +1 -1
- data/lib/ctioga2/graphics/styles/plot.rb +48 -6
- data/lib/ctioga2/graphics/styles/texts.rb +9 -1
- data/lib/ctioga2/graphics/styles/ticks.rb +34 -0
- data/lib/ctioga2/graphics/subplot-commands.rb +35 -0
- data/lib/ctioga2/graphics/types.rb +30 -4
- data/lib/ctioga2/graphics/types/boxes.rb +13 -0
- data/lib/ctioga2/graphics/types/dimensions.rb +7 -0
- data/lib/ctioga2/plotmaker.rb +2 -0
- data/lib/ctioga2/postprocess.rb +15 -2
- data/lib/ctioga2/utils.rb +120 -0
- data/lib/ctioga2/version.rb +2 -2
- metadata +5 -2
data/lib/ctioga2/utils.rb
CHANGED
@@ -17,6 +17,8 @@ require 'rbconfig'
|
|
17
17
|
# The version
|
18
18
|
require 'ctioga2/version'
|
19
19
|
|
20
|
+
require 'set'
|
21
|
+
|
20
22
|
|
21
23
|
module CTioga2
|
22
24
|
|
@@ -174,6 +176,9 @@ module CTioga2
|
|
174
176
|
while (a.size > 1) && (a.first < tolerance * a.last)
|
175
177
|
a.shift
|
176
178
|
end
|
179
|
+
if a.first == 0
|
180
|
+
return 0
|
181
|
+
end
|
177
182
|
|
178
183
|
return Math.log10(a.first).send(method)
|
179
184
|
end
|
@@ -207,6 +212,23 @@ module CTioga2
|
|
207
212
|
return file # But that will fail later on.
|
208
213
|
end
|
209
214
|
|
215
|
+
# Returns the biggest vector of multiples of delta contained
|
216
|
+
# within bot and top
|
217
|
+
def self.integer_subdivisions(bot, top, delta)
|
218
|
+
if bot > top
|
219
|
+
bot, top = top, bot
|
220
|
+
end
|
221
|
+
tn = (top/delta).floor
|
222
|
+
bn = (bot/delta).ceil
|
223
|
+
ret = Dobjects::Dvector.new()
|
224
|
+
nb = (tn - bn).to_i + 1
|
225
|
+
|
226
|
+
nb.times do |i|
|
227
|
+
ret << (bn + i) * delta
|
228
|
+
end
|
229
|
+
return ret
|
230
|
+
end
|
231
|
+
|
210
232
|
|
211
233
|
|
212
234
|
# Cross-platform way of finding an executable in the $PATH.
|
@@ -293,6 +315,7 @@ module CTioga2
|
|
293
315
|
end
|
294
316
|
return ret
|
295
317
|
end
|
318
|
+
|
296
319
|
end
|
297
320
|
|
298
321
|
|
@@ -351,6 +374,103 @@ module CTioga2
|
|
351
374
|
|
352
375
|
end
|
353
376
|
|
377
|
+
|
378
|
+
# This class watches over a list of named texts and can be queried
|
379
|
+
# for size/position information.
|
380
|
+
class TextSizeWatcher
|
381
|
+
|
382
|
+
# Watched text names
|
383
|
+
attr_accessor :watched_names
|
384
|
+
|
385
|
+
# A left, bottom, right, up bounding box (in output coordinates
|
386
|
+
# divided by 10)
|
387
|
+
attr_accessor :bb
|
388
|
+
|
389
|
+
def initialize
|
390
|
+
@watched_names = Set.new
|
391
|
+
end
|
392
|
+
|
393
|
+
def watch(*names)
|
394
|
+
@watched_names += names
|
395
|
+
end
|
396
|
+
|
397
|
+
# Given the MarginsBox with which the text was drawn, returns
|
398
|
+
# another MarginsBox item that specifies how much the text extends
|
399
|
+
# from the previous box. Works using the current frame
|
400
|
+
# coordinates.
|
401
|
+
#
|
402
|
+
# Padding in big points
|
403
|
+
#
|
404
|
+
# Min is the minimum size, also in big points.
|
405
|
+
def update_margins(t, margins, padding = 2, min = 4)
|
406
|
+
compute_bb(t)
|
407
|
+
if ! @bb
|
408
|
+
# Don't change anything if the bounding box does not exist
|
409
|
+
return margins
|
410
|
+
end
|
411
|
+
left, top, right, bottom = *margins.to_frame_coordinates(t)
|
412
|
+
|
413
|
+
xl = 0.1 * t.convert_page_to_output_x(t.convert_frame_to_page_x(left))
|
414
|
+
xr = 0.1 * t.convert_page_to_output_x(t.convert_frame_to_page_x(right))
|
415
|
+
yt = 0.1 * t.convert_page_to_output_y(t.convert_frame_to_page_y(top))
|
416
|
+
yb = 0.1 * t.convert_page_to_output_y(t.convert_frame_to_page_y(bottom))
|
417
|
+
|
418
|
+
vals = [ xl - @bb[0], @bb[2] - xr, @bb[3] - yt, yb - @bb[1]].map do |x|
|
419
|
+
x += padding
|
420
|
+
x = if x > min
|
421
|
+
x
|
422
|
+
else
|
423
|
+
min
|
424
|
+
end
|
425
|
+
Graphics::Types::Dimension.new(:bp, x)
|
426
|
+
end
|
427
|
+
|
428
|
+
return Graphics::Types::MarginsBox.
|
429
|
+
new(*vals)
|
430
|
+
end
|
431
|
+
|
432
|
+
|
433
|
+
def compute_bb(t)
|
434
|
+
|
435
|
+
@bb = nil
|
436
|
+
|
437
|
+
for w in @watched_names
|
438
|
+
info = t.get_text_size(w)
|
439
|
+
if info.key? 'points'
|
440
|
+
# We need to take every single point, since for rotated
|
441
|
+
# text, potentially all coordinates are different
|
442
|
+
for p in info['points']
|
443
|
+
update_bb(*p)
|
444
|
+
end
|
445
|
+
end
|
446
|
+
end
|
447
|
+
end
|
448
|
+
|
449
|
+
|
450
|
+
protected
|
451
|
+
|
452
|
+
# update the current bounding box to take into account the given point
|
453
|
+
def update_bb(x, y)
|
454
|
+
if ! @bb
|
455
|
+
@bb = [x,y,x,y]
|
456
|
+
else
|
457
|
+
if x < @bb[0]
|
458
|
+
@bb[0] = x
|
459
|
+
elsif x > @bb[2]
|
460
|
+
@bb[2] = x
|
461
|
+
end
|
462
|
+
if y < @bb[1]
|
463
|
+
@bb[1] = y
|
464
|
+
elsif y > @bb[3]
|
465
|
+
@bb[3] = y
|
466
|
+
end
|
467
|
+
end
|
468
|
+
end
|
469
|
+
|
470
|
+
|
471
|
+
|
472
|
+
end
|
473
|
+
|
354
474
|
end
|
355
475
|
|
356
476
|
######################################################################
|
data/lib/ctioga2/version.rb
CHANGED
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.
|
4
|
+
version: '0.9'
|
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:
|
12
|
+
date: 2014-02-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: tioga
|
@@ -61,9 +61,11 @@ files:
|
|
61
61
|
- lib/ctioga2/commands/doc/html.rb
|
62
62
|
- lib/ctioga2/commands/arguments.rb
|
63
63
|
- lib/ctioga2/commands/context.rb
|
64
|
+
- lib/ctioga2/commands/general-functions.rb
|
64
65
|
- lib/ctioga2/commands/general-types.rb
|
65
66
|
- lib/ctioga2/commands/general-commands.rb
|
66
67
|
- lib/ctioga2/commands/commands.rb
|
68
|
+
- lib/ctioga2/commands/function.rb
|
67
69
|
- lib/ctioga2/postprocess.rb
|
68
70
|
- lib/ctioga2/utils.rb
|
69
71
|
- lib/ctioga2/version.rb
|
@@ -154,6 +156,7 @@ files:
|
|
154
156
|
- COPYING
|
155
157
|
- Changelog
|
156
158
|
- setup.rb
|
159
|
+
- bin/ct2-make-movie
|
157
160
|
- bin/ctioga2
|
158
161
|
homepage: http://ctioga2.sourceforge.net
|
159
162
|
licenses: []
|