rubyfca 0.2.7 → 0.2.9

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 (5) hide show
  1. data/VERSION +1 -1
  2. data/bin/rubyfca +13 -4
  3. data/lib/rubyfca.rb +9 -4
  4. data/rubyfca.gemspec +1 -1
  5. metadata +1 -1
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.7
1
+ 0.2.9
@@ -25,13 +25,18 @@ where:
25
25
  [options]:
26
26
  EOS
27
27
 
28
- opt :circle, "Use circle shaped concept nodes", :default=> false
29
28
  opt :full, "Do not contract concept labels", :default=> false
30
- opt :legend, "Print the legend of concept nodes (available only when using circle node shape)", :default => false
31
29
  opt :coloring, "Color concept nodes [0 = none (default), 1 = lightblue/pink, 2 = monochrome]", :default => 0
32
- opt :straight, "Straighten edges (available when output format is either png, jpg, or eps)", :default => false
30
+ opt :straight, "Straighten edges (available when output format is either png, jpg, svg, pdf, or eps)", :default => false
31
+ opt :nodesep, "Size of separation between sister nodes (from 0.1 to 5.0)", :default => 0.4
32
+ opt :ranksep, "Size of separation between ranks (from 0.1 to 5.0)", :default => 0.2
33
+ opt :legend, "Print the legend of concept nodes (available only when using circle node shape)", :default => false
34
+ opt :circle, "Use circle shaped concept nodes", :default=> false
35
+
33
36
  end
34
37
  Trollop::die :coloring, "must be 0, 1, or 2" if (opts[:coloring] > 2 || opts[:coloring] < 0)
38
+ Trollop::die :ranksep, "must be within 0.1 - 5.0" if (opts[:ranksep] < 0.1 || opts[:ranksep] > 5.0)
39
+ Trollop::die :nodesep, "must be within 0.1 - 5.0" if (opts[:nodesep] < 0.1 || opts[:nodesep] > 5.0)
35
40
  ############### main program ###############
36
41
 
37
42
  if ARGV.size != 2
@@ -47,7 +52,7 @@ filename2 = ARGV[1] #output filename
47
52
  input_type = filename1.slice(/\.[^\.]+\z/).split(//)[1..-1].join("")
48
53
  output_type = filename2.slice(/\.[^\.]+\z/).split(//)[1..-1].join("")
49
54
 
50
- if (input_type !~ /\A(cxt|csv)\z/ || output_type !~ /\A(dot|png|jpg|eps)\z/)
55
+ if (input_type !~ /\A(cxt|csv)\z/ || output_type !~ /\A(dot|png|jpg|svg|pdf|eps)\z/)
51
56
  showerror("These file extensions are not (yet) supported.", 1)
52
57
  end
53
58
 
@@ -92,6 +97,10 @@ when "png"
92
97
  ctxt.generate_img(filename2, "png", opts)
93
98
  when "jpg"
94
99
  ctxt.generate_img(filename2, "jpg", opts)
100
+ when "svg"
101
+ ctxt.generate_img(filename2, "svg", opts)
102
+ when "pdf"
103
+ ctxt.generate_img(filename2, "pdf", opts)
95
104
  when "eps"
96
105
  ctxt.generate_img(filename2, "eps", opts)
97
106
  end
@@ -327,8 +327,9 @@ class FormalContext
327
327
  ## For options, see 'rubyfca'
328
328
  def generate_dot(opts)
329
329
  index_max_width = @concepts.size.to_s.split(//).size
330
-
331
- clattice = RubyGraphviz.new("clattice", :rankdir => "", :nodesep => "0.4", :ranksep => "0.2")
330
+ nodesep = opts[:nodesep] ? opts[:nodesep].to_s : "0.4"
331
+ ranksep = opts[:ranksep] ? opts[:ranksep].to_s : "0.2"
332
+ clattice = RubyGraphviz.new("clattice", :rankdir => "", :nodesep => nodesep, :ranksep => ranksep)
332
333
 
333
334
  if opts[:circle] and opts[:legend]
334
335
  legend = RubyGraphviz.new("legend", :rankdir => "TB", :lebelloc => "t", :centered => "false")
@@ -352,7 +353,9 @@ class FormalContext
352
353
  attrfull = []
353
354
  0.upto(@gammaM.size - 1) do |j|
354
355
  if @gammaM[j][i] == 2
355
- obj = opts[:full] ? @objects[j] + " " + [0x261C].pack("U") : @objects[j]
356
+ # pointing finger does not appear correctly in eps...
357
+ # obj = opts[:full] ? @objects[j] + " " + [0x261C].pack("U") : @objects[j]
358
+ obj = opts[:full] ? @objects[j] + "*" : @objects[j]
356
359
  objfull << obj
357
360
  elsif @gammaM[j][i] == 1
358
361
  objfull << @objects[j]
@@ -360,7 +363,9 @@ class FormalContext
360
363
  end
361
364
  0.upto(@muM.size - 1) do |k|
362
365
  if @muM[k][i] == 2
363
- att = opts[:full] ? @attributes[k] + " " + [0x261C].pack("U") : @attributes[k]
366
+ # pointing finger does not appear correctly in eps...
367
+ # att = opts[:full] ? @attributes[k] + " " + [0x261C].pack("U") : @attributes[k]
368
+ att = opts[:full] ? @attributes[k] + "*" : @attributes[k]
364
369
  attrfull << att
365
370
  elsif @muM[k][i] == 1
366
371
  attrfull << @attributes[k]
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{rubyfca}
8
- s.version = "0.2.7"
8
+ s.version = "0.2.9"
9
9
  s.required_ruby_version = ">=1.8.6"
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Yoichiro Hasebe", "Kow Kuroda"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubyfca
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.7
4
+ version: 0.2.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yoichiro Hasebe