ctioga2 0.11 → 0.12

Sign up to get free protection for your applications and to get access to all the features.
@@ -221,6 +221,11 @@ module CTioga2
221
221
 
222
222
  # The stack of CurveStyle objects that were used so far.
223
223
  attr_accessor :curve_style_stack
224
+
225
+ # Whether or not one should pause at the end if there are
226
+ # errors. Useful on windows, where the windows closes before one
227
+ # has a chance to see anything.
228
+ attr_accessor :pause_on_errors
224
229
 
225
230
 
226
231
  # The first instance of PlotMaker created
@@ -291,6 +296,15 @@ module CTioga2
291
296
  debug { format_exception(e) }
292
297
  fatal { "#{e.message}" }
293
298
  end
299
+ errs = Log.counts[:error]
300
+ warns = Log.counts[:warn]
301
+ if errs + warns > 0
302
+ puts "ctioga2 finished with #{errs} errors and #{warns} warning"
303
+ if @pause_on_errors
304
+ puts "Hit ENTER to exit"
305
+ STDIN.gets
306
+ end
307
+ end
294
308
  end
295
309
 
296
310
  # Flushes the current root object and starts a new one:
@@ -144,7 +144,7 @@ module CTioga2
144
144
  return formula
145
145
  end
146
146
 
147
-
147
+ # Sorts strings according to their numeric suffix
148
148
  def self.suffix_numeric_sort(strings)
149
149
  strings.sort do |a,b|
150
150
  a =~ /.*?(\d+)$/
@@ -232,6 +232,13 @@ module CTioga2
232
232
  return Math.log10(a.first).send(method)
233
233
  end
234
234
 
235
+ # Returns the segment scaled about its center by the given factor
236
+ def self.scale_segment(left, right, factor)
237
+ dx = 0.5*(right - left)
238
+ mid = 0.5*(right + left)
239
+ return mid - factor * dx, mid + factor * dx
240
+ end
241
+
235
242
 
236
243
  # Transcodes the given string from all encodings into the target
237
244
  # encoding until an encoding is found in which the named file
@@ -278,6 +285,39 @@ module CTioga2
278
285
  return ret
279
286
  end
280
287
 
288
+ # Takes a vector, and splits it into a series of contiguous
289
+ # subvectors which
290
+ def self.split_homogeneous_deltas(vect, tolerance = 1e-4)
291
+ rv = []
292
+ idx = 1
293
+ dx = nil
294
+ lst = nil
295
+ while idx < vect.size
296
+ cdx = vect[idx] - vect[idx - 1]
297
+ if ! dx
298
+ dx = cdx
299
+ lst = Dobjects::Dvector.new()
300
+ rv << lst
301
+ lst << vect[idx-1] << vect[idx]
302
+ else
303
+ if (cdx - dx).abs <= tolerance * dx
304
+ # keep going
305
+ lst << vect[idx]
306
+ else
307
+ dx = nil
308
+ end
309
+ end
310
+ idx += 1
311
+ end
312
+
313
+ # Flush the last one if alone
314
+ if ! dx
315
+ nv = Dobjects::Dvector.new()
316
+ nv << vect.last
317
+ rv << nv
318
+ end
319
+ return rv
320
+ end
281
321
 
282
322
 
283
323
  # Cross-platform way of finding an executable in the $PATH.
@@ -348,8 +388,7 @@ module CTioga2
348
388
  end
349
389
 
350
390
  return ret
351
- end
352
-
391
+ end
353
392
 
354
393
  # Returns a hash value -> [elements] in which the elements are in
355
394
  # the same order
@@ -554,6 +593,15 @@ class Hash
554
593
  self.delete(old)
555
594
  end
556
595
 
596
+ # Strip the given keys if they evaluate to false
597
+ def strip_if_false!(keys)
598
+ for k in keys
599
+ if key?(k) and (not self[k])
600
+ self.delete(k)
601
+ end
602
+ end
603
+ end
604
+
557
605
  end
558
606
 
559
607
 
@@ -2,7 +2,7 @@
2
2
  module CTioga2
3
3
 
4
4
  module Version
5
- GIT_VERSION = '0.11'
6
- GIT_DATE = 'Thu 1 Jan 23:31:57 CET 2015'
5
+ GIT_VERSION = '0.12'
6
+ GIT_DATE = 'Mon 23 Mar 21:27:39 CET 2015'
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ctioga2
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.11'
4
+ version: '0.12'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vincent Fourmond <vincent.fourmond@9online.fr>
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-01 00:00:00.000000000 Z
11
+ date: 2015-03-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tioga
@@ -128,6 +128,7 @@ files:
128
128
  - lib/ctioga2/graphics/styles/map-axes.rb
129
129
  - lib/ctioga2/graphics/styles/plot-types.rb
130
130
  - lib/ctioga2/graphics/styles/plot.rb
131
+ - lib/ctioga2/graphics/styles/scope.rb
131
132
  - lib/ctioga2/graphics/styles/sets.rb
132
133
  - lib/ctioga2/graphics/styles/styles.rb
133
134
  - lib/ctioga2/graphics/styles/stylesheet.rb
@@ -161,7 +162,8 @@ files:
161
162
  - lib/ctioga2/version.rb
162
163
  - setup.rb
163
164
  homepage: http://ctioga2.sourceforge.net
164
- licenses: []
165
+ licenses:
166
+ - GPL-2.0+
165
167
  metadata: {}
166
168
  post_install_message:
167
169
  rdoc_options: []