変更履歴: 2006/11/07 堀之内 作成
2006/10/30 に西澤氏がコミットした変更より。
app/controllers/analysis_controller.rb: revision 1.50 -> 1.51 app/views/analysis/_draw_tone_settings.rhtml: revision 1.1 -> 1.2 app/models/analysis.rb: revision 1.14 -> 1.15
ただし、analysis_controller.rb の変更にはバグフィックスを含む。
作業の流れは次のようになる。
ユーザーは、tone/contourに関する指定は analysis の左下の Draw メニュー内の Specific Settings サブメニューで行う。 本ファイルはその rhtml ソースである(このファイルは Draw で Tone and Contour を指定した場合専用)。
Analysis クラスを定義。このクラスは、解析・可視化に関する設定をため込 んで、 AnalysisController#draw に伝えるのが役目。models に入っているが、 対応するデータベーステーブルは存在しない。
analysis/ のコントローラー。可視化等の設定受付は index で、 可視化アクションは draw で行われる。
次のうち :transpose --> "transpose" の変更はバグフィックス。 それ以外の部分が、最大値、最小値指定を追加するための変更。 (∴一部掲載を省略)
diff -u -r1.50 -r1.51
--- app/controllers/analysis_controller.rb 26 Oct 2006 12:14:34 -0000 1.50
+++ app/controllers/analysis_controller.rb 30 Oct 2006 15:16:43 -0000 1.51
@@ -333,10 +333,12 @@
else
options[:method] = :tone_cont
if analysis.x_axis > analysis.y_axis
- options[:transpose] = true
+ options["transpose"] = true
end
options[:tone] = analysis.draw_tone
options[:contour] = analysis.draw_contour
+ options["min"] = analysis.tone_min
+ options["max"] = analysis.tone_max
end
when "vector"
if vars.length != 2
ここでは、options[:method] = :tone_cont となってるところの下に追加する ことで、tone and contour のオプション設定となる。 VizShot 固有のオプションはシンボルで、そうでなく GGraph の可視化メソッドに引き継いでほしいオプションは文字列で指定する。 上では文字列で指定した "min", "max" が GGraph::tone, GGraph::contour に渡される。
diff -u -r1.1 -r1.2
--- app/views/analysis/_draw_tone_settings.rhtml 30 Sep 2006 05:59:21 -0000 1.1
+++ app/views/analysis/_draw_tone_settings.rhtml 30 Oct 2006 15:16:44 -0000 1.2
@@ -3,4 +3,10 @@
<label for="analysis_draw_tone">Draw tone</label>
<%= check_box("analysis", "draw_contour") %>
<label for="analysis_draw_contour">Draw contour</label>
+ <br/>
+ <label for="analysis_tone_min">minimum tone level</label>
+ <%= text_field("analysis", "tone_min", :size => 4) %>
+ <br/>
+ <label for="analysis_tone_max">maximum tone level</label>
+ <%= text_field("analysis", "tone_max", :size => 4) %>
</div>
diff -u -r1.14 -r1.15
--- app/models/analysis.rb 8 Oct 2006 06:29:11 -0000 1.14
+++ app/models/analysis.rb 30 Oct 2006 15:16:44 -0000 1.15
@@ -42,6 +42,7 @@
attr_reader :draw_projection
attr_reader :draw_keep, :draw_size
attr_reader :draw_tone, :draw_contour
+ attr_reader :tone_min, :tone_max
attr_reader :function
@@ -81,6 +82,10 @@
self.draw_tone = v
when "draw_contour"
self.draw_contour = v
+ when "tone_min"
+ self.tone_min = v
+ when "tone_max"
+ self.tone_max = v
when "function"
self.function = v
end
@@ -237,6 +242,22 @@
end
end
+ def tone_min=(val)
+ if val==""
+ @tone_min = nil
+ else
+ @tone_min = val.to_f
+ end
+ end
+
+ def tone_max=(val)
+ if val==""
+ @tone_max = nil
+ else
+ @tone_max = val.to_f
+ end
+ end
+
def index
@index = Array.new
dims = @region