Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
processes
DoubleTankLab.jl
Commits
bf1d3931
Commit
bf1d3931
authored
Mar 08, 2018
by
Jacob Wikmark
Browse files
nicer layout
parent
29dcdab7
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/tankgraphic.jl
View file @
bf1d3931
...
...
@@ -30,9 +30,6 @@ function stream(width, height, x, y)
anim2
=
dom
"svg:animate"
(
attributes
=
animate2
)
stline1
=
Node
(
instanceof
(
dom
"svg:rect"
()),
anim1
,
style
=
smallstyle
,
attributes
=
attr_small
)
stline2
=
Node
(
instanceof
(
dom
"svg:rect"
()),
anim2
,
style
=
smallstyle
,
attributes
=
attr_small
)
#stlines = (svg_rect(width, thickness, x, y+(speed*time() + i)%ht, smallstyle)
#for i in 0:ht/lines:ht)
#(svg_rect(width, height, x, y, bigstyle), stlines...)
(
svg_rect
(
width
,
height
,
x
,
y
,
bigstyle
),
stline1
,
stline2
)
end
...
...
@@ -40,7 +37,6 @@ end
function
water_container
(
width
,
height
,
fill
,
x
=
0
,
y
=
0
)
#Produces an SVG water container of size height, width, filled from the
#bottom to the height fill (as a proportion of height
#fill_level = fill*height
fill_level
=
fill
*
height
water_style
=
Dict
(
:
fill
=>
"rgb
$
s_blue"
)
wall_style
=
Dict
(
:
fill
=>
"rgb
$
s_black"
)
...
...
@@ -48,7 +44,6 @@ function water_container(width, height, fill, x=0, y=0)
"y"
=>
"
$
y"
,
"width"
=>
"
$
width"
,
"height"
=>
"
$
height"
)
#svg_rect(width, fill_level, height-fill_level, water_style)
Node
(
svgsvg_symb
,
svg_rect
(
width
,
fill_level
,
0
,
height
-
fill_level
,
water_style
),
svg_rect
(
wall_thickness
,
height
,
0
,
0
,
wall_style
),
...
...
@@ -65,7 +60,6 @@ function tank_construct(upper, lower, pump_speed = 1, tnum = 0, r = -1)
arrowwidth
=
0
arrowheight
=
20
arrowtext
=
""
upper_x
=
75
upper_y
=
100
lower_x
=
75
...
...
@@ -91,7 +85,6 @@ function tank_construct(upper, lower, pump_speed = 1, tnum = 0, r = -1)
(
tank_width
/
2
+
pipe_thickness
*
2
,
4
*
pt
)],
s_black
)
#remove constraints later when controller is bug free
w1
=
mouth_width
*
sqrt
(
max
(
0
,
pump_speed
))
w2
=
mouth_width
*
sqrt
(
max
(
0
,
upper
))
w3
=
mouth_width
*
sqrt
(
max
(
0
,
lower
))
...
...
src/tanklabgui.jl
View file @
bf1d3931
...
...
@@ -49,7 +49,7 @@ function makegui(P, plottingframerate = 10, guiframerate = 10)
else
tankg
=
tank_construct
(
measure
(
P
)
...
,
obs
(
u
)[]
*
ptfr
)
end
Node
(
:
div
,
tankg
,
id
=
"tanks"
)
Node
(
:
div
,
tankg
,
id
=
"tanks"
,
attributes
=
tankattr
)
end
w2
,
graphic2
=
@construct
for
...
...
@@ -130,7 +130,11 @@ function makegui(P, plottingframerate = 10, guiframerate = 10)
left_element
=
setindex_
(
left_element
,
corner_element
,
1
,
1
)
left_element
=
setindex_
(
left_element
,
graphic2
,
2
,
1
)
layout
=
setindex_
(
layout
,
left_element
,
1
,
1
)
layout
=
setindex_
(
layout
,
Node
(
:
div
,
graphic1
,
dummygraphic1
,
dummygraphic2
,
io_element
),
1
,
2
)
layout
=
setindex_
(
layout
,
Node
(
:
div
,
graphic1
,
dummygraphic1
,
dummygraphic2
,
io_element
,
attributes
=
tankattr
),
1
,
2
)
#This makes it look a bit nicer, reducing the width of the right column
layout
[
1
][
2
]
.
props
[
:
style
][
:
width
]
=
"25%"
LabGUI
.
set!
(
gui
,
layout
)
...
...
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