Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
spot-web-app
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
3
Issues
3
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Spot
spot-web-app
Commits
c789d196
Commit
c789d196
authored
Aug 10, 2018
by
Alexandre Duret-Lutz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
automatically switch between horizontal and vertical display
parent
fa9e86df
Pipeline
#3289
passed with stage
in 1 minute and 26 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
2 deletions
+17
-2
server/spotapi.py
server/spotapi.py
+17
-2
No files found.
server/spotapi.py
View file @
c789d196
...
...
@@ -13,7 +13,10 @@ from time import time
app
=
Flask
(
__name__
)
CORS
(
app
)
os
.
environ
[
'SPOT_DOTEXTRA'
]
=
'size="6,6" edge[arrowhead=vee, arrowsize=.7]'
# We want 600px-wide SVG automata. Dot renders using 100ppi, so we ask for a
# 6in-wide picture. The vertical size is less of an issue, so let's limit it
# to twice that.
os
.
environ
[
'SPOT_DOTEXTRA'
]
=
'size="6,12" edge[arrowhead=vee, arrowsize=.7]'
import
spot
from
spot.aux
import
str_to_svg
...
...
@@ -352,7 +355,6 @@ def translate(ltlformula, method='GET'):
acc
+=
' '
+
minmax
if
oddeven
!=
'any'
:
acc
+=
' '
+
oddeven
print
(
acc
)
args
.
append
(
acc
)
arg_l
=
request
.
args
.
get
(
'l'
,
'h'
)
...
...
@@ -438,6 +440,19 @@ def translate(ltlformula, method='GET'):
spot
.
print_dot
(
dotsrc
,
aut
,
opt
+
"<30"
)
automaton_svg
=
str_to_svg
(
dotsrc
.
str
().
encode
(
'utf-8'
))
res
[
'automaton_svg'
]
=
automaton_svg
# Check if the automaton was scaled down.
m
=
re
.
search
(
'transform="scale\(([.\d]+) '
,
automaton_svg
)
if
m
:
scale
=
float
(
m
.
group
(
1
))
print
(
scale
)
if
scale
<=
.
9
:
# Re-render vertically and see if the scale is better
dotsrc
=
spot
.
ostringstream
()
spot
.
print_dot
(
dotsrc
,
aut
,
opt
+
"v<30"
)
automaton_svg
=
str_to_svg
(
dotsrc
.
str
().
encode
(
'utf-8'
))
m
=
re
.
search
(
'transform="scale\(([.\d]+) '
,
automaton_svg
)
if
m
and
scale
<
float
(
m
.
group
(
1
)):
res
[
'automaton_svg'
]
=
automaton_svg
aut
.
set_name
(
str
(
f
))
...
...
Write
Preview
Markdown
is supported
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