Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Flatland
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
yoogottamk
Flatland
Commits
3c28b2d5
Commit
3c28b2d5
authored
5 years ago
by
u214892
Browse files
Options
Downloads
Patches
Plain Diff
Merge branch master of gitlab.aicrowd.com:flatland/flatland into cleanup-continuous-integration
parent
67362db3
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
flatland/utils/graphics_pil.py
+12
-13
12 additions, 13 deletions
flatland/utils/graphics_pil.py
with
12 additions
and
13 deletions
flatland/utils/graphics_pil.py
+
12
−
13
View file @
3c28b2d5
...
@@ -193,7 +193,7 @@ class PILGL(GraphicsLayer):
...
@@ -193,7 +193,7 @@ class PILGL(GraphicsLayer):
img
=
Image
.
new
(
"
RGBA
"
,
(
self
.
widthPx
,
self
.
heightPx
),
(
255
,
255
,
255
,
opacity
))
img
=
Image
.
new
(
"
RGBA
"
,
(
self
.
widthPx
,
self
.
heightPx
),
(
255
,
255
,
255
,
opacity
))
return
img
return
img
def
clear_layer
(
self
,
iLayer
=
0
,
opacity
=
None
):
def
clear_layer
(
self
,
iLayer
=
0
,
opacity
=
None
):
if
opacity
is
None
:
if
opacity
is
None
:
opacity
=
0
if
iLayer
>
0
else
255
opacity
=
0
if
iLayer
>
0
else
255
self
.
layers
[
iLayer
]
=
img
=
self
.
create_image
(
opacity
)
self
.
layers
[
iLayer
]
=
img
=
self
.
create_image
(
opacity
)
...
@@ -216,11 +216,11 @@ class PILGL(GraphicsLayer):
...
@@ -216,11 +216,11 @@ class PILGL(GraphicsLayer):
if
clear
:
if
clear
:
self
.
clear_layer
(
iLayer
)
self
.
clear_layer
(
iLayer
)
def
create_layers
(
self
,
clear
=
True
):
def
create_layers
(
self
,
clear
=
True
):
self
.
create_layer
(
0
,
clear
=
clear
)
# rail / background (scene)
self
.
create_layer
(
0
,
clear
=
clear
)
# rail / background (scene)
self
.
create_layer
(
1
,
clear
=
clear
)
# agents
self
.
create_layer
(
1
,
clear
=
clear
)
# agents
self
.
create_layer
(
2
,
clear
=
clear
)
# drawing layer for selected agent
self
.
create_layer
(
2
,
clear
=
clear
)
# drawing layer for selected agent
self
.
create_layer
(
3
,
clear
=
clear
)
# drawing layer for selected agent's target
self
.
create_layer
(
3
,
clear
=
clear
)
# drawing layer for selected agent's target
class
PILSVG
(
PILGL
):
class
PILSVG
(
PILGL
):
...
@@ -379,7 +379,7 @@ class PILSVG(PILGL):
...
@@ -379,7 +379,7 @@ class PILSVG(PILGL):
return
dPil
return
dPil
def
setRailAt
(
self
,
row
,
col
,
binTrans
,
iTarget
=
None
,
isSelected
=
False
):
def
setRailAt
(
self
,
row
,
col
,
binTrans
,
iTarget
=
None
,
isSelected
=
False
):
if
iTarget
is
None
:
if
iTarget
is
None
:
if
binTrans
in
self
.
dPilRail
:
if
binTrans
in
self
.
dPilRail
:
pilTrack
=
self
.
dPilRail
[
binTrans
]
pilTrack
=
self
.
dPilRail
[
binTrans
]
...
@@ -395,9 +395,8 @@ class PILSVG(PILGL):
...
@@ -395,9 +395,8 @@ class PILSVG(PILGL):
if
isSelected
:
if
isSelected
:
svgBG
=
self
.
pilFromSvgFile
(
"
./svg/Selected_Agent.svg
"
)
svgBG
=
self
.
pilFromSvgFile
(
"
./svg/Selected_Agent.svg
"
)
self
.
clear_layer
(
3
,
0
)
self
.
clear_layer
(
3
,
0
)
self
.
drawImageRC
(
svgBG
,(
row
,
col
),
layer
=
3
)
self
.
drawImageRC
(
svgBG
,
(
row
,
col
),
layer
=
3
)
def
recolorImage
(
self
,
pil
,
a3BaseColor
,
ltColors
):
def
recolorImage
(
self
,
pil
,
a3BaseColor
,
ltColors
):
rgbaImg
=
array
(
pil
)
rgbaImg
=
array
(
pil
)
...
@@ -447,7 +446,7 @@ class PILSVG(PILGL):
...
@@ -447,7 +446,7 @@ class PILSVG(PILGL):
for
iColor
,
pilZug3
in
enumerate
(
lPils
):
for
iColor
,
pilZug3
in
enumerate
(
lPils
):
self
.
dPilZug
[(
iDirIn2
,
iDirOut2
,
iColor
)]
=
lPils
[
iColor
]
self
.
dPilZug
[(
iDirIn2
,
iDirOut2
,
iColor
)]
=
lPils
[
iColor
]
def
setAgentAt
(
self
,
iAgent
,
row
,
col
,
iDirIn
,
iDirOut
,
isSelected
):
def
setAgentAt
(
self
,
iAgent
,
row
,
col
,
iDirIn
,
iDirOut
,
isSelected
):
delta_dir
=
(
iDirOut
-
iDirIn
)
%
4
delta_dir
=
(
iDirOut
-
iDirIn
)
%
4
iColor
=
iAgent
%
self
.
nAgentColors
iColor
=
iAgent
%
self
.
nAgentColors
# when flipping direction at a dead end, use the "iDirOut" direction.
# when flipping direction at a dead end, use the "iDirOut" direction.
...
@@ -458,8 +457,8 @@ class PILSVG(PILGL):
...
@@ -458,8 +457,8 @@ class PILSVG(PILGL):
if
isSelected
:
if
isSelected
:
svgBG
=
self
.
pilFromSvgFile
(
"
./svg/Selected_Agent.svg
"
)
svgBG
=
self
.
pilFromSvgFile
(
"
./svg/Selected_Agent.svg
"
)
self
.
clear_layer
(
2
,
0
)
self
.
clear_layer
(
2
,
0
)
self
.
drawImageRC
(
svgBG
,(
row
,
col
),
layer
=
2
)
self
.
drawImageRC
(
svgBG
,
(
row
,
col
),
layer
=
2
)
def
main2
():
def
main2
():
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment