Commit e1bd38bd authored by Bruno Guillaume's avatar Bruno Guillaume Committed by Bruno Guillaume

on-going new version of rew_display

parent fe182a1d
......@@ -9,7 +9,7 @@ VERSION = `cat VERSION`
all: native
native: src/grew_glade.ml datadir
native: src/grew_glade.ml src/new_glade.ml datadir
$(OCB) -tag-line "true: package(libgrew)" grew_main.native
datadir:
......@@ -18,7 +18,7 @@ datadir:
install:
cp grew_main.native $(BINDIR)/grew
mkdir -p $(DATA_DIR)
cp src/grew.glade $(DATA_DIR)
cp src/*.glade $(DATA_DIR)
uninstall:
rm -f $(BINDIR)/grew
......@@ -29,7 +29,7 @@ uninstall:
clean:
$(OCB) -clean
rm -f DATA_DIR
rm -f src/grew_glade.ml
rm -f src/*_glade.ml
info:
@echo "BINDIR = $(BINDIR)"
......@@ -40,3 +40,10 @@ src/grew_glade.ml : src/grew.glade
lablgladecc2 $< > $@
sed -iback 's|src/grew.glade|$(DATA_DIR)grew.glade|g' src/grew_glade.ml
rm -f src/grew_glade.mlback
# glade file are not handle by ocamlbuild
src/new_glade.ml : src/new.glade
lablgladecc2 $< > $@
sed -iback 's|src/new.glade|$(DATA_DIR)new.glade|g' src/new_glade.ml
rm -f src/new_glade.mlback
......@@ -14,7 +14,7 @@ open Libgrew
module Grew_args = struct
type mode = Gui | Corpus | Filter | Det | Full | Grep
type mode = Gui | Corpus | Filter | Det | Full | Grep | Test
let mode = ref Gui
type html_mode =
......@@ -60,6 +60,7 @@ module Grew_args = struct
"-det", Unit (fun () -> mode := Det), " enable det mode: rewrite a corpus with a deterministric grs";
"-full", Unit (fun () -> mode := Full), " enable full mode: rewrite a corpus (conll output)";
"-filter", Unit (fun () -> mode := Filter), " enable filter mode";
"-test", Unit (fun () -> mode := Test), " Undocumented";
"-grep", Unit (fun () -> mode := Grep), " enable grep mode\n\nOptions for all modes";
"-grs", String (fun s -> grs := absolute s), "<grs_file> chose the grs file to load";
......
......@@ -645,14 +645,20 @@ let init () =
grew_window#vpane_right#set_position 30;
true
| ["showOnBottom2"; graph] ->
printf "...> 1\n%!";
(try
let svg_file =
if grew_window#btn_gr_bottom_dot#active
then (Grew_rew_display.get_dot_graph_with_background ?domain
~main_feat:(!Grew_config.current_config.Grew_config.main_feat) ~botop:(true,false) graph)
else (Grew_rew_display.get_dep_graph_with_background ?domain ~filter:(get_current_filter ())
~main_feat:(!Grew_config.current_config.Grew_config.main_feat) ~botop:(true,false) graph) in
printf "...> 2\n%!";
graph_bottom_webkit#load_uri ("file://"^svg_file);
printf "...> 3\n%!";
Grew_rew_display.current_bottom_graph := graph;
printf "...> 4\n%!";
with exc -> printf "--->%s<----\n%!" (Printexc.to_string exc); show_error "XXX");
true
| ["showOnTop2"; graph] ->
let svg_file = if grew_window#btn_gr_top_dot#active
......
......@@ -30,3 +30,5 @@ let _ =
| Grew_args.Full -> Grew_corpus.full ()
| Grew_args.Filter -> Grew_corpus.multi_conll ()
| Grew_args.Grep -> Grew_corpus.grep ()
| Grew_args.Test -> Grew_test.init ()
......@@ -153,7 +153,7 @@ module Grew_rew_display = struct
add " node [fontname=Arial];";
add " ranksep=0.01;";
add " nodesep=0.04";
(* add " edge [color=transparent]";*)
(* add " edge [color=transparent]";*)
let module_counter = ref 0 in
let graph_counter = ref 0 in
let previous_mod = ref "" in
......@@ -168,36 +168,36 @@ module Grew_rew_display = struct
begin
try
let modu = List.assoc (n^"_"^(string_of_int level)) !modules in
kadd " {rank=same; %s; node_mod_%d_0}" gid (modu-1);
kadd " node_mod_%d_0 -> %s [color=transparent]" (modu-1) gid;
with Not_found ->
kadd " node_mod_%d_0 [label=\"\", fontcolor=transparent, color=transparent]" !module_counter;
kadd " node_mod_%d [label=\"%s\"%s]" !module_counter n (if n = "##end##" then ", fontcolor=transparent, color=transparent" else "");
kadd " {rank=same; %s; node_mod_%d_0}" gid !module_counter;
kadd " node_mod_%d_0 -> %s [color=transparent]" !module_counter gid;
kadd " node_mod_%d_0 -> node_mod_%d [color=transparent]" !module_counter !module_counter;
if !previous_mod <> ""
kadd " {rank=same; %s; node_mod_%d_0}" gid (modu-1);
kadd " node_mod_%d_0 -> %s [color=transparent]" (modu-1) gid;
with Not_found ->
kadd " node_mod_%d_0 [label=\"\", fontcolor=transparent, color=transparent]" !module_counter;
kadd " node_mod_%d [label=\"%s\"%s]" !module_counter n (if n = "##end##" then ", fontcolor=transparent, color=transparent" else "");
kadd " {rank=same; %s; node_mod_%d_0}" gid !module_counter;
kadd " node_mod_%d_0 -> %s [color=transparent]" !module_counter gid;
kadd " node_mod_%d_0 -> node_mod_%d [color=transparent]" !module_counter !module_counter;
if !previous_mod <> ""
then kadd " %s -> node_mod_%d_0 [color=transparent]" !previous_mod !module_counter;
previous_mod := Printf.sprintf "node_mod_%d" !module_counter;
incr module_counter;
modules := ((Printf.sprintf "%s_%d" n level), !module_counter) :: !modules;
end;
graph_map := (gid, (g, (pid, module_name, bs))) :: !graph_map;
previous_mod := Printf.sprintf "node_mod_%d" !module_counter;
incr module_counter;
modules := ((Printf.sprintf "%s_%d" n level), !module_counter) :: !modules;
end;
graph_map := (gid, (g, (pid, module_name, bs))) :: !graph_map;
in
let connect_up () =
if parent <> "" then kadd " %s -> %s%s" pid gid (if pt_is_nf then " [style=dotted]" else "") in
let step () =
if !graph_counter = 0
if !graph_counter = 0
then kadd " %s [shape=box, label=\"%s\", style=filled, fillcolor=\"%s\"]" gid gid top_color
else kadd " %s [shape=box, label=\"%s\"]" gid gid in
begin
match rew_display with
| Libgrew_types.Empty -> ()
| Libgrew_types.Leaf g ->
common_part "##end##" g;
match rew_display with
| Libgrew_types.Empty -> ()
| Libgrew_types.Leaf g ->
common_part "##end##" g;
incr graph_counter;
(match !first_leaf with
| Leaf _ ->
......@@ -210,19 +210,19 @@ module Grew_rew_display = struct
| No ->
first_leaf := Leaf gid;
kadd " %s [shape=box, label=\"%s\", style=filled, fillcolor=\"%s\", peripheries=2]" gid gid bottom_color
);
);
connect_up ();
| Libgrew_types.Local_normal_form (g,n,rd) ->
| Libgrew_types.Local_normal_form (g,n,rd) ->
common_part n g;
let previous_node = !graph_counter in
let previous_node = !graph_counter in
step ();
incr graph_counter;
incr graph_counter;
connect_up ();
ignore(transform (string_of_int previous_node) true n rd (level+1));
()
| Libgrew_types.Node (g,n,[]) ->
ignore(transform (string_of_int previous_node) true n rd (level+1));
()
| Libgrew_types.Node (g,n,[]) ->
common_part n g;
connect_up ();
......@@ -230,30 +230,30 @@ module Grew_rew_display = struct
| (0,_) -> kadd " %s [shape=box, label=\"%s\", style=filled, fillcolor=\"%s\"]" gid gid top_color
| (_,No) -> first_leaf := Dead_lock gid; kadd " %s [shape=box, label=\"%s\", style=filled, fillcolor=\"%s\"]" gid gid bottom_color
| _ -> kadd " %s [shape=box, label=\"%s\" ]" gid gid);
incr graph_counter
incr graph_counter
| Libgrew_types.Node (g,n,children) ->
| Libgrew_types.Node (g,n,children) ->
common_part n g;
let previous_node = !graph_counter in
let previous_node = !graph_counter in
step ();
incr graph_counter;
incr graph_counter;
connect_up ();
let tmp_list = ref [] in
List.iter (fun (bs,rd) ->
let id = transform (string_of_int previous_node) false ~bs:(Some bs) n rd (level+1) in
tmp_list := id::(!tmp_list)
) children;
let tmp_list = ref [] in
List.iter (fun (bs,rd) ->
let id = transform (string_of_int previous_node) false ~bs:(Some bs) n rd (level+1) in
tmp_list := id::(!tmp_list)
) children;
kadd "{rank=same; %s; %s}"
kadd "{rank=same; %s; %s}"
(String.concat "; " (List.map (fun id -> Printf.sprintf "G%d" id) !tmp_list))
(try
(try
let mod_id = List.assoc (n^"_"^(string_of_int level)) !modules in
(Printf.sprintf "node_mod_%d_0" mod_id)
with Not_found -> ""
(Printf.sprintf "node_mod_%d_0" mod_id)
with Not_found -> ""
)
end;
tmp_id
......@@ -305,278 +305,308 @@ module Grew_rew_display = struct
let out_ch = open_out file_out in
try
while true do
let line = input_line in_ch in
let line = input_line in_ch in
match !graph_line_counter with
| 0 -> (* matching de la premiere ligne pour un graphe (<!-- GXX -->) *)
if (Str.string_match init line 0)
match !graph_line_counter with
(* ================================================================================================================================= *)
| 0 -> (* matching de la premiere ligne pour un graphe *)
if (Str.string_match init line 0)
then
begin
let id = Str.matched_group 1 line in
let classe = Str.matched_group 2 line
and transform = Str.matched_group 3 line in
if (show_bottom) then (
output_string out_ch ("<g id=\""^id^"\" onload=\"window.scrollBy(0,100000);\" class=\""^classe^"\" transform=\""^transform^"\">");
) else (
output_string out_ch line
)
end
else if (Str.string_match graph_comment_match line 0)
then
begin
graph_id_internal := Str.matched_group 1 line;
incr graph_line_counter;
output_string out_ch (line^"\n");
(* Log.fdebug "[Grew_rew_display]--> Graph found : %s" !graph_id_internal *)
end
else if (Str.string_match edge_comment_match line 0)
then
begin
(* Log.fdebug "[Grew_rew_display]--> edge found : %s -> %s" (Str.matched_group 1 line) (Str.matched_group 3 line); *)
edge_from := (Str.matched_group 1 line);
edge_to := (Str.matched_group 3 line);
graph_line_counter := 4;
output_string out_ch (line^"\n");
end
else if (Str.string_match svg_match line 0)
then
begin
graph_line_counter := 99;
output_string out_ch (line^"\n");
end
else if (Str.string_match module_match line 0)
then
begin
graph_line_counter := 59;
output_string out_ch (line^"\n");
end
else if (Str.string_match background_match line 0)
then
begin
let _1 = Str.matched_group 1 line
and _2 = Str.matched_group 2 line in
x_left := _1;
x_right := _2;
output_string out_ch (line^"\n");
end
let id = Str.matched_group 1 line in
let classe = Str.matched_group 2 line
and transform = Str.matched_group 3 line in
if show_bottom
then (output_string out_ch ("<g id=\""^id^"\" onload=\"window.scrollBy(0,100000);\" class=\""^classe^"\" transform=\""^transform^"\">");)
else (output_string out_ch line)
end
else
if (Str.string_match graph_comment_match line 0)
then
begin
graph_id_internal := Str.matched_group 1 line;
incr graph_line_counter;
output_string out_ch (line^"\n");
(* Log.fdebug "[Grew_rew_display]--> Graph found : %s" !graph_id_internal *)
end
else
if (Str.string_match edge_comment_match line 0)
then
begin
(* Log.fdebug "[Grew_rew_display]--> edge found : %s -> %s" (Str.matched_group 1 line) (Str.matched_group 3 line); *)
edge_from := (Str.matched_group 1 line);
edge_to := (Str.matched_group 3 line);
graph_line_counter := 4;
output_string out_ch (line^"\n");
end
else
if (Str.string_match svg_match line 0)
then
begin
graph_line_counter := 99;
output_string out_ch (line^"\n");
end
else
if (Str.string_match module_match line 0)
then
begin
graph_line_counter := 59;
output_string out_ch (line^"\n");
end
else
if (Str.string_match background_match line 0)
then
begin
let _1 = Str.matched_group 1 line
and _2 = Str.matched_group 2 line in
x_left := _1;
x_right := _2;
output_string out_ch (line^"\n");
end
else output_string out_ch (line^"\n")
(* ================================================================================================================================= *)
| 1 -> (* deuxieme ligne du graphe (g) *)
if (Str.string_match g_match line 0)
then (
graph_id := Str.matched_group 1 line;
incr graph_line_counter;
output_string out_ch (Printf.sprintf "<g id=\"%s\" class=\"node\" >\n" !graph_id);
(* Log.fdebug "[Grew_rew_display] Graph id : %s" !graph_id *)
)
else output_string out_ch (line^"\n");
(* ================================================================================================================================= *)
| 2 ->
if (Str.string_match polygon_matchA line 0) || (Str.string_match polygon_matchB line 0)
then (
incr graph_line_counter;
let fill = Str.matched_group 1 line in
let _1 = Str.matched_group 2 line
and _2 = Str.matched_group 3 line
and _3 = Str.matched_group 4 line
and _4 = Str.matched_group 5 line
and _5 = Str.matched_group 6 line
and _6 = Str.matched_group 7 line
and _7 = Str.matched_group 8 line
and _8 = Str.matched_group 9 line
and _9 = Str.matched_group 10 line
and _10 = Str.matched_group 11 line in
polygon_back_tmp := Printf.sprintf
"<polygon id=\"polygon_%s_back\" fill=\"%s\" fill-opacity=\"%d\" stroke=\"transparent\" points=\"%s,%s %s,%s %s,%s %s,%s %s,%s\"/>\n"
!graph_id_internal
fill
(if (fill<>"none") then 1 else 0)
_1 _2 _3 _4 _5 _6 _7 _8 _9 _10;
polygon_tmp := Printf.sprintf
"<polygon id=\"polygon_%s\"
onmouseover=\"this.setAttribute('stroke','orange');document.getElementById('polygon_%s_top').style.display='block';document.getElementById('polygon_%s_bottom').style.display='block';\"
onmouseout=\"this.setAttribute('stroke','black');document.getElementById('polygon_%s_top').style.display='none';document.getElementById('polygon_%s_bottom').style.display='none';show_current_edge()\"
fill=\"white\" fill-opacity=\"0\" stroke=\"black\" stroke-width=\"2\" points=\"%s,%s %s,%s %s,%s %s,%s %s,%s\"/>\n"
!graph_id_internal !graph_id_internal !graph_id_internal !graph_id_internal !graph_id_internal
_1 _2 _3 _4 _5 _6 _7 _8 _9 _10;
polygon_tmp := Printf.sprintf
"%s<polygon
onmouseover=\"this.style.display='block';document.getElementById('polygon_%s').setAttribute('stroke','orange');\"
onmouseout=\"this.style.display='none';document.getElementById('polygon_%s').setAttribute('stroke','black');show_current_edge()\"
onclick=\"alert('showOnTop::%s');remove_back_from_current_top();current_top='%s';add_back_from_current_top();\"
id=\"polygon_%s_top\" style=\"cursor:ne-resize;display:none\" fill=\"grey\" stroke=\"black\" points=\"%s,%s %s,%s %s,%s\"/>\n"
!polygon_tmp
!graph_id_internal
!graph_id_internal
!graph_id_internal
!graph_id_internal
!graph_id_internal
(sof ((fos _1) -. 2.) ^ "0")
(sof ((fos _2) +. 7.) ^ "0")
(sof ((fos _1) -. 2.) ^ "0")
(sof ((fos _2) +. 2.) ^ "0")
(sof ((fos _1) -. 7.) ^ "0")
(sof ((fos _2) +. 2.) ^ "0");
polygon_tmp := Printf.sprintf
"%s<polygon
onmouseover=\"this.style.display='block';document.getElementById('polygon_%s').setAttribute('stroke','orange');\"
onmouseout=\"this.style.display='none';document.getElementById('polygon_%s').setAttribute('stroke','black');show_current_edge()\"
onclick=\"alert('showOnBottom::%s');remove_back_from_current_bottom();current_bottom='%s';add_back_from_current_bottom();\"
id=\"polygon_%s_bottom\" style=\"cursor:se-resize;display:none\" fill=\"grey\" stroke=\"black\" points=\"%s,%s %s,%s %s,%s\"/>\n"
!polygon_tmp
!graph_id_internal
!graph_id_internal
!graph_id_internal
!graph_id_internal
!graph_id_internal
(sof ((fos _7) -. 2.) ^ "0")
(sof ((fos _8) -. 7.) ^ "0")
(sof ((fos _7) -. 2.) ^ "0")
(sof ((fos _8) -. 2.) ^ "0")
(sof ((fos _7) -. 7.) ^ "0")
(sof ((fos _8) -. 2.) ^ "0");
(* Log.fdebug "[Grew_rew_display] Polygon found : %s" _1 *)
)
else output_string out_ch (line^"\n")
| 1 -> (* deuxieme ligne du graphe (g) *)
if (Str.string_match g_match line 0)
(* ================================================================================================================================= *)
| 3 ->
output_string out_ch !polygon_back_tmp;
output_string out_ch (line^"\n");
output_string out_ch !polygon_tmp;
graph_line_counter := 0;
(* ================================================================================================================================= *)
| 4 -> (* recuperation des coordonnées utiles pour les aretes *)
if (Str.string_match edge_path_match line 0)
then (
graph_id := Str.matched_group 1 line;
incr graph_line_counter;
output_string out_ch (Printf.sprintf "<g id=\"%s\" class=\"node\" >\n" !graph_id);
(* Log.fdebug "[Grew_rew_display] Graph id : %s" !graph_id *)
) else (
output_string out_ch (line^"\n");
)
| 2 ->
if (Str.string_match polygon_matchA line 0) || (Str.string_match polygon_matchB line 0) then (
incr graph_line_counter;
let fill = Str.matched_group 1 line in
let _1 = Str.matched_group 2 line
and _2 = Str.matched_group 3 line
and _3 = Str.matched_group 4 line
and _4 = Str.matched_group 5 line
and _5 = Str.matched_group 6 line
and _6 = Str.matched_group 7 line
and _7 = Str.matched_group 8 line
and _8 = Str.matched_group 9 line
and _9 = Str.matched_group 10 line
and _10 = Str.matched_group 11 line in
polygon_back_tmp := Printf.sprintf "<polygon id=\"polygon_%s_back\"
fill=\"%s\" fill-opacity=\"%d\" stroke=\"transparent\" points=\"%s,%s %s,%s %s,%s %s,%s %s,%s\"/>\n"
!graph_id_internal
fill
(if (fill<>"none") then 1 else 0)
_1 _2 _3 _4 _5 _6 _7 _8 _9 _10;
polygon_tmp := Printf.sprintf "<polygon id=\"polygon_%s\"
onmouseover=\"this.setAttribute('stroke','orange');document.getElementById('polygon_%s_top').style.display='block';document.getElementById('polygon_%s_bottom').style.display='block';\"
onmouseout=\"this.setAttribute('stroke','black');document.getElementById('polygon_%s_top').style.display='none';document.getElementById('polygon_%s_bottom').style.display='none';show_current_edge()\"
fill=\"white\" fill-opacity=\"0\" stroke=\"black\" stroke-width=\"2\" points=\"%s,%s %s,%s %s,%s %s,%s %s,%s\"/>\n"
!graph_id_internal !graph_id_internal !graph_id_internal !graph_id_internal !graph_id_internal
_1 _2 _3 _4 _5 _6 _7 _8 _9 _10;
polygon_tmp := Printf.sprintf "%s<polygon
onmouseover=\"this.style.display='block';document.getElementById('polygon_%s').setAttribute('stroke','orange');\"
onmouseout=\"this.style.display='none';document.getElementById('polygon_%s').setAttribute('stroke','black');show_current_edge()\"
onclick=\"alert('showOnTop::%s');remove_back_from_current_top();current_top='%s';add_back_from_current_top();\"
id=\"polygon_%s_top\" style=\"cursor:ne-resize;display:none\" fill=\"grey\" stroke=\"black\" points=\"%s,%s %s,%s %s,%s\"/>\n"
!polygon_tmp
!graph_id_internal
!graph_id_internal
!graph_id_internal
!graph_id_internal
!graph_id_internal
(sof ((fos _1) -. 2.) ^ "0")
(sof ((fos _2) +. 7.) ^ "0")
(sof ((fos _1) -. 2.) ^ "0")
(sof ((fos _2) +. 2.) ^ "0")
(sof ((fos _1) -. 7.) ^ "0")
(sof ((fos _2) +. 2.) ^ "0");
polygon_tmp := Printf.sprintf "%s<polygon
onmouseover=\"this.style.display='block';document.getElementById('polygon_%s').setAttribute('stroke','orange');\"
onmouseout=\"this.style.display='none';document.getElementById('polygon_%s').setAttribute('stroke','black');show_current_edge()\"
onclick=\"alert('showOnBottom::%s');remove_back_from_current_bottom();current_bottom='%s';add_back_from_current_bottom();\"
id=\"polygon_%s_bottom\" style=\"cursor:se-resize;display:none\" fill=\"grey\" stroke=\"black\" points=\"%s,%s %s,%s %s,%s\"/>\n"
!polygon_tmp
!graph_id_internal
!graph_id_internal
!graph_id_internal
!graph_id_internal
!graph_id_internal
(sof ((fos _7) -. 2.) ^ "0")
(sof ((fos _8) -. 7.) ^ "0")
(sof ((fos _7) -. 2.) ^ "0")
(sof ((fos _8) -. 2.) ^ "0")
(sof ((fos _7) -. 7.) ^ "0")
(sof ((fos _8) -. 2.) ^ "0");
(* Log.fdebug "[Grew_rew_display] Polygon found : %s" _1 *)
) else (
output_string out_ch (line^"\n");
)
| 3 ->
output_string out_ch !polygon_back_tmp;
output_string out_ch (line^"\n");
output_string out_ch !polygon_tmp;
graph_line_counter := 0;
| 4 -> (* recuperation des coordonnées utiles pour les aretes *)
if (Str.string_match edge_path_match line 0) then (
if (Str.matched_group 1 line) = "black" then (
incr graph_line_counter;
(* Log.fdebug "[Grew_rew_display] color: %s, x1:%s, y1:%s" (Str.matched_group 1 line) (Str.matched_group 2 line) (Str.matched_group 3 line); *)
edge_color := (Str.matched_group 1 line);
x1 := (Str.matched_group 2 line);
y1 := (Str.matched_group 3 line);
) else (
graph_line_counter := 0;
)
);
output_string out_ch (line^"\n");
| 5 ->
if (Str.string_match edge_polygon_match line 0) then (
x2 := (Str.matched_group 1 line);
y2 := (Str.matched_group 2 line);
output_string out_ch (line^"\n");
output_string out_ch (Printf.sprintf "<polygon id=\"edge_%d\" style=\"cursor:pointer;\"
onmouseover=\"this.setAttribute('stroke-opacity','1');this.setAttribute('stroke-width','2');document.getElementById('polygon_%s').setAttribute('stroke','orange');document.getElementById('polygon_%s').setAttribute('stroke','orange');\"
onmouseout=\"this.setAttribute('stroke-opacity','0');document.getElementById('polygon_%s').setAttribute('stroke','black');document.getElementById('polygon_%s').setAttribute('stroke','black');show_current_edge()\"
onclick=\"alert('showModuleFromGraph::%s');hide_current_edge();current_edge_two='edge_%d';current_top_graph='polygon_%s';current_bottom_graph='polygon_%s';show_current_edge();
alert('showOnTop2::%s');remove_back_from_current_top();current_top='%s';add_back_from_current_top();
alert('showOnBottom2::%s');remove_back_from_current_bottom();current_bottom='%s';add_back_from_current_bottom();\"
stroke=\"orange\" stroke-dasharray=\"2\" stroke-opacity=\"0\" fill=\"orange\" fill-opacity=\"0\"
points=\"%s,%s %s,%s %s,%s %s,%s %s,%s %s,%s\"/>%!\n"
!edge_counter
!edge_from !edge_to
!edge_from !edge_to
!edge_to
!edge_counter
!edge_from !edge_to
!edge_from !edge_from
!edge_to !edge_to
!x1 !y1
(sof ((fos !x1) +. 5.) ^ "0") !y1
(sof ((fos !x2) +. 5.) ^ "0") !y2
(sof ((fos !x2) -. 5.) ^ "0") !y2
(sof ((fos !x1) -. 5.) ^ "0") !y1
!x1 !y1);
incr edge_counter;
) else (
output_string out_ch (line^"\n");
);
graph_line_counter := 0;
| 99 ->
let ecmascript = "<script type=\"text/ecmascript\">
<![CDATA[
var current_top = \"G0\";
var current_bottom = \""^fl^"\";
var current_bottom_graph = \""^fl^"\";
var current_top_graph = \"G0\";
var current_edge_two = \"\";
function remove_back_from_current_top() {
if (document.getElementById('polygon_'+current_top+'_back')) {
document.getElementById('polygon_'+current_top+'_back').setAttribute('fill-opacity','0');
if (current_top==current_bottom) {
document.getElementById('polygon_'+current_top+'_back').setAttribute('fill-opacity','1');
document.getElementById('polygon_'+current_top+'_back').setAttribute('fill','"^bottom_color^"');
}
}
}
function remove_back_from_current_bottom() {
if (document.getElementById('polygon_'+current_bottom+'_back')) {
document.getElementById('polygon_'+current_bottom+'_back').setAttribute('fill-opacity','0');
if (current_bottom==current_top) {
document.getElementById('polygon_'+current_bottom+'_back').setAttribute('fill-opacity','1');
document.getElementById('polygon_'+current_bottom+'_back').setAttribute('fill','"^top_color^"');
}
}
}
function add_back_from_current_top() {
if (document.getElementById('polygon_'+current_top+'_back')) {
document.getElementById('polygon_'+current_top+'_back').setAttribute('fill-opacity','1');
document.getElementById('polygon_'+current_top+'_back').setAttribute('fill','"^top_color^"');
if (current_bottom==current_top) {
document.getElementById('polygon_'+current_top+'_back').setAttribute('fill','"^middle_color^"');
}
}
}
function add_back_from_current_bottom() {
if (document.getElementById('polygon_'+current_bottom+'_back')) {
document.getElementById('polygon_'+current_bottom+'_back').setAttribute('fill-opacity','1');
document.getElementById('polygon_'+current_bottom+'_back').setAttribute('fill','"^bottom_color^"');
if (current_bottom==current_top) {
document.getElementById('polygon_'+current_top+'_back').setAttribute('fill','"^middle_color^"');
}
}
}
function hide_current_edge() {
if (document.getElementById(current_edge_two)) {
document.getElementById(current_edge_two).setAttribute('stroke','orange')
document.getElementById(current_top_graph).setAttribute('stroke','orange')
document.getElementById(current_bottom_graph).setAttribute('stroke','orange')
document.getElementById(current_edge_two).setAttribute('stroke-opacity','0');
document.getElementById(current_top_graph).setAttribute('stroke','black')
document.getElementById(current_bottom_graph).setAttribute('stroke','black')
}
}
function show_current_edge() {
if (document.getElementById(current_edge_two)) {
document.getElementById(current_edge_two).setAttribute('stroke','red')
document.getElementById(current_top_graph).setAttribute('stroke','red')
document.getElementById(current_bottom_graph).setAttribute('stroke','red')
document.getElementById(current_edge_two).setAttribute('stroke-opacity','1');
document.getElementById(current_top_graph).setAttribute('stroke-opacity','1');
document.getElementById(current_bottom_graph).setAttribute('stroke-opacity','1');
}
}
var edge_flag = false;
function set_edge_flag(b) { edge_flag = b; }
function get_edge_flag() { return edge_flag; }
]]>
</script>" in
output_string out_ch (line^"\n");
output_string out_ch (ecmascript^"\n");
graph_line_counter := 0;
| 59 ->
if (Str.string_match module_text_match line 0) then (
Printf.fprintf out_ch "<text text-anchor=\"middle\" x=\"%s\" y=\"%s\" font-family=\"%s\"
font-size=\"%s\"
font-variant=\"small-caps\">%s</text>\n"
(Str.matched_group 1 line)
(Str.matched_group 2 line)
(Str.matched_group 3 line)
(Str.matched_group 4 line)
(Str.matched_group 5 line);
graph_line_counter := 0;
)
| _ -> ()
if (Str.matched_group 1 line) = "black"
then (
incr graph_line_counter;
(* Log.fdebug "[Grew_rew_display] color: %s, x1:%s, y1:%s" (Str.matched_group 1 line) (Str.matched_group 2 line) (Str.matched_group 3 line); *)
edge_color := (Str.matched_group 1 line);
x1 := (Str.matched_group 2 line);
y1 := (Str.matched_group 3 line);
)
else graph_line_counter := 0;
);
output_string out_ch (line^"\n");
(* ================================================================================================================================= *)
| 5 ->
if (Str.string_match edge_polygon_match line 0)
then (
x2 := (Str.matched_group 1 line);
y2 := (Str.matched_group 2 line);
output_string out_ch (line^"\n");
output_string out_ch
(Printf.sprintf
"<polygon id=\"edge_%d\" style=\"cursor:pointer;\"
onmouseover=\"this.setAttribute('stroke-opacity','1');this.setAttribute('stroke-width','2');document.getElementById('polygon_%s').setAttribute('stroke','orange');document.getElementById('polygon_%s').setAttribute('stroke','orange');\"
onmouseout=\"this.setAttribute('stroke-opacity','0');document.getElementById('polygon_%s').setAttribute('stroke','black');document.getElementById('polygon_%s').setAttribute('stroke','black');show_current_edge()\"
onclick=\"alert('showModuleFromGraph::%s');hide_current_edge();current_edge_two='edge_%d';current_top_graph='polygon_%s';current_bottom_graph='polygon_%s';show_current_edge();
alert('showOnTop2::%s');remove_back_from_current_top();current_top='%s';add_back_from_current_top();
alert('showOnBottom2::%s');remove_back_from_current_bottom();current_bottom='%s';add_back_from_current_bottom();\"
stroke=\"orange\" stroke-dasharray=\"2\" stroke-opacity=\"0\" fill=\"orange\" fill-opacity=\"0\"
points=\"%s,%s %s,%s %s,%s %s,%s %s,%s %s,%s\"/>%!\n"
!edge_counter
!edge_from !edge_to
!edge_from !edge_to
!edge_to
!edge_counter
!edge_from !edge_to
!edge_from !edge_from
!edge_to !edge_to
!x1 !y1
(sof ((fos !x1) +. 5.) ^ "0") !y1
(sof ((fos !x2) +. 5.) ^ "0") !y2
(sof ((fos !x2) -. 5.) ^ "0") !y2
(sof ((fos !x1) -. 5.) ^ "0") !y1
!x1 !y1);
incr edge_counter;
)
else output_string out_ch (line^"\n");
graph_line_counter := 0;
(* ================================================================================================================================= *)
| 99 ->
let ecmascript = "<script type=\"text/ecmascript\">
<![CDATA[
var current_top = \"G0\";
var current_bottom = \""^fl^"\";
var current_bottom_graph = \""^fl^"\";
var current_top_graph = \"G0\";
var current_edge_two = \"\";
function remove_back_from_current_top() {
if (document.getElementById('polygon_'+current_top+'_back')) {
document.getElementById('polygon_'+current_top+'_back').setAttribute('fill-opacity','0');
if (current_top==current_bottom) {
document.getElementById('polygon_'+current_top+'_back').setAttribute('fill-opacity','1');
document.getElementById('polygon_'+current_top+'_back').setAttribute('fill','"^bottom_color^"');
}
}