Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Benoit Barbot
GraphEditor
Commits
e3200113
Commit
e3200113
authored
Oct 10, 2018
by
Benoit Barbot
Browse files
prog
parent
ee7defb6
Changes
3
Hide whitespace changes
Inline
Side-by-side
TikzEditor/TikzGraph.ml
View file @
e3200113
...
...
@@ -50,7 +50,7 @@ let draw_state (s,at) p =
let
get_state_attr
(
s
,
at
)
=
"Node"
,
((
A
,
"content"
,
`String
s
)
::
(
List
.
mapi
(
fun
i
sv
->
(
B
i
)
,
"
a
ttribute
"
^
(
string_of_int
(
i
+
1
))
,
(
`String
sv
))
at
))
(
List
.
mapi
(
fun
i
sv
->
(
B
i
)
,
"
A
ttribute
"
,
(
`String
sv
))
at
))
let
update_state_attr
(
s
,
at
)
attr_id
=
function
|
None
->
begin
match
attr_id
with
A
->
Some
(
""
,
at
)
...
...
@@ -73,7 +73,7 @@ let update_state_attr (s,at) attr_id = function
|
_
->
None
let
get_new_state_attr
(
s
,
at
)
_
=
[
"
node a
ttribute"
,
fun
(
s
,
at
)
->
(
s
,
at
@
[
""
])
,
B
(
List
.
length
at
)
"
A
ttribute"
,
fun
(
s
,
at
)
->
(
s
,
at
@
[
""
])
,
B
(
List
.
length
at
)
]
...
...
@@ -108,13 +108,13 @@ let draw_arc (at,cn) (source_sh,target_sh) =
let
get_arc_attr
(
atlist
,
controllist
)
=
"Arc"
,
(
(
List
.
mapi
(
fun
i
sv
->
(
B
i
)
,
"
a
ttribute
"
^
(
string_of_int
(
i
+
1
))
,
(
`String
sv
))
atlist
)
(
List
.
mapi
(
fun
i
sv
->
(
B
i
)
,
"
A
ttribute
"
,
(
`String
sv
))
atlist
)
@
(
List
.
mapi
(
fun
i
sv
->
(
match
sv
with
`Text
(
_
,
s
)
->
C
i
,
"
n
ode
"
^
(
string_of_int
(
i
+
1
))
,
`Text
(
_
,
s
)
->
C
i
,
"
N
ode
"
,
(
`String
s
)
|
`Point
p
->
C
i
,
"
p
oint
"
^
(
string_of_int
(
i
+
1
))
,
|
`Point
p
->
C
i
,
"
P
oint
"
,
(
`ControlPoint
p
)
|
`ControlPoint
p
->
C
i
,
"
c
ontrol
"
^
(
string_of_int
(
i
+
1
))
,
|
`ControlPoint
p
->
C
i
,
"
C
ontrol
"
,
(
`ControlPoint
p
)
))
controllist
)
)
...
...
editor/genericSerializer.ml
View file @
e3200113
...
...
@@ -143,4 +143,9 @@ let write_attribute b (_,s,a) =
add_char
b
'
T'
;
buff_string
b
s
;
buff_attribute
b
a
let
read_attribute
b
pos
=
assert
(
b
.
[
pos
]
=
'
T'
);
let
pos2
,
s
=
string_buff
b
(
pos
+
1
)
in
let
pos3
,
at
=
attribute_buff
b
pos2
in
pos3
,
(
s
,
at
)
editor/graphDrawing.ml
View file @
e3200113
...
...
@@ -204,7 +204,7 @@ module GraphEditor (G: GRAPH ) = struct
buff_float
buff
f1
;
buff_float
buff
f2
;
let
attr
=
snd
@@
G
.
get_node_attribute
graph
node
in
List
.
iter
(
write_attribute
buff
)
attr
buff_list
buff
write_attribute
attr
);
G
.
iter_arc
graph
(
fun
arc
->
let
n1
,
n2
=
G
.
nodes_of_arc
graph
arc
in
...
...
@@ -231,6 +231,8 @@ module GraphEditor (G: GRAPH ) = struct
Hashtbl
.
add
map
!
i
node
;
incr
i
;
pos
:=
!
pos
+
8
;
let
npos
,
attr
=
list_buff
str
read_attribute
!
pos
in
pos
:=
npos
done
;
while
!
pos
+
7
<=
length
&&
str
.
[
!
pos
]
=
'
A'
do
let
n1
=
Hashtbl
.
find
map
(
int_buff
str
(
!
pos
+
1
))
in
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment