Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
9.2.2023: Due to updates GitLab will be unavailable for some minutes between 9:00 and 11:00.
Open sidebar
i7
peregrine
Commits
bcc8770e
Commit
bcc8770e
authored
Dec 02, 2014
by
Philipp Meyer
Browse files
Added labels and initial marking to DOT printer
parent
efd8e52a
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/Printer/DOT.hs
View file @
bcc8770e
...
...
@@ -9,8 +9,8 @@ import Data.ByteString.Builder
import
Data.Monoid
import
PetriNet
import
Structure
-- TODO: mark initially labeled places
renderNet
::
PetriNet
->
Builder
renderNet
net
=
"digraph petrinet {
\n
"
<>
...
...
@@ -18,11 +18,14 @@ renderNet net =
mconcat
(
map
transLabel
(
transitions
net
))
<>
"}
\n
"
where
placeLabel
p
=
stringUtf8
p
<>
" [label=
\"
\"
];
\n
"
transLabel
t
=
stringUtf8
t
<>
" [label=
\"
\"
, shape=box, "
<>
"style=filled, fillcolor=
\"
"
<>
(
if
checkParallelT
net
t
then
"#FF0000"
else
"#AAAAAA"
)
<>
"
\"
];
\n
"
<>
placeLabel
p
=
stringUtf8
p
<>
" [label=
\"
"
<>
stringUtf8
p
<>
(
if
initial
net
p
>
0
then
"("
<>
integerDec
(
initial
net
p
)
<>
")"
else
""
)
<>
"
\"
];
\n
"
transLabel
t
=
stringUtf8
t
<>
" [label=
\"
"
<>
stringUtf8
t
<>
"
\"
, shape=box, "
<>
"style=filled, fillcolor=
\"
#AAAAAA
\"
];
\n
"
<>
mconcat
(
map
(
\
p
->
arcLabel
(
p
,
t
))
(
pre
net
t
))
<>
mconcat
(
map
(
\
p
->
arcLabel
(
t
,
p
))
(
post
net
t
))
arcLabel
(
a
,
b
)
=
stringUtf8
a
<>
" -> "
<>
stringUtf8
b
<>
"
\n
"
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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