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
sfwatergit
Flatland
Commits
e08e21e3
Commit
e08e21e3
authored
5 years ago
by
Erik Nygren
Browse files
Options
Downloads
Patches
Plain Diff
fixed issues with editor with refactored rendertools.py
removed prints for debugging
parent
ded160fe
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
flatland/utils/graphics_pil.py
+2
-1
2 additions, 1 deletion
flatland/utils/graphics_pil.py
notebooks/Scene_Editor.ipynb
+2
-33
2 additions, 33 deletions
notebooks/Scene_Editor.ipynb
with
4 additions
and
34 deletions
flatland/utils/graphics_pil.py
+
2
−
1
View file @
e08e21e3
...
...
@@ -221,7 +221,8 @@ class PILGL(GraphicsLayer):
def
save_image
(
self
,
filename
):
"""
Renders the current scene into a image file
:param filename: filename where to store the rendering output_generator (supported image format *.bmp , .. , *.png)
:param filename: filename where to store the rendering output_generator
(supported image format *.bmp , .. , *.png)
"""
img
=
self
.
alpha_composite_layers
()
img
.
save
(
filename
)
...
...
This diff is collapsed.
Click to expand it.
notebooks/Scene_Editor.ipynb
+
2
−
33
View file @
e08e21e3
...
...
@@ -11,20 +11,7 @@
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<style>.container { width:95% !important; }</style>"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"outputs": [],
"source": [
"from IPython.core.display import display, HTML\n",
"display(HTML(\"<style>.container { width:95% !important; }</style>\"))"
...
...
@@ -70,7 +57,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "
8f5b5ed248ec4cd7a4410ff504b67949
",
"model_id": "
bd784815032c4d89803fa93399def9cf
",
"version_major": 2,
"version_minor": 0
},
...
...
@@ -80,24 +67,6 @@
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"redrawing outside\n",
"Output()\n",
"redrawing outside\n",
"Output()\n",
"redrawing outside\n",
"Output(outputs=({'output_type': 'stream', 'text': 'load file: complex_scene.pkl\\nRegenerate size 50 20\\n', 'name': 'stdout'},))\n",
"redrawing outside\n",
"Output(outputs=({'output_type': 'stream', 'text': 'load file: complex_scene.pkl\\nRegenerate size 50 20\\n', 'name': 'stdout'},))\n",
"redrawing outside\n",
"Output(outputs=({'output_type': 'stream', 'text': 'load file: complex_scene.pkl\\nRegenerate size 50 20\\n', 'name': 'stdout'},))\n",
"redrawing outside\n",
"Output(outputs=({'output_type': 'stream', 'text': 'load file: complex_scene.pkl\\nRegenerate size 50 20\\n', 'name': 'stdout'},))\n"
]
}
],
"source": [
...
...
%% Cell type:markdown id: tags:
# Railway Scene Editor
%% Cell type:code id: tags:
```
python
from
IPython.core.display
import
display
,
HTML
display
(
HTML
(
"
<style>.container { width:95% !important; }</style>
"
))
```
%% Output
%% Cell type:code id: tags:
```
python
from
flatland.utils.editor
import
EditorMVC
mvc
=
EditorMVC
(
sGL
=
"
PILSVG
"
)
```
%% Cell type:markdown id: tags:
## Instructions
-
Drag to draw (improved dead-ends)
-
ctrl-click to add agent or select agent
-
if agent is selected:
-
ctrl-click to move agent position
-
use rotate agent to rotate 90°
-
ctrl-shift-click to set target for selected agent
-
target can be moved by repeating
-
to Resize the env (cannot preserve work):
-
select "Regen" tab, set regen size slider, click regenerate.
-
alt-click remove all rails from cell
Demo Scene: complex_scene.pkl
%% Cell type:code id: tags:
```
python
mvc
.
view
.
display
()
```
%% Output
redrawing outside
Output()
redrawing outside
Output()
redrawing outside
Output(outputs=({'output_type': 'stream', 'text': 'load file: complex_scene.pkl\nRegenerate size 50 20\n', 'name': 'stdout'},))
redrawing outside
Output(outputs=({'output_type': 'stream', 'text': 'load file: complex_scene.pkl\nRegenerate size 50 20\n', 'name': 'stdout'},))
redrawing outside
Output(outputs=({'output_type': 'stream', 'text': 'load file: complex_scene.pkl\nRegenerate size 50 20\n', 'name': 'stdout'},))
redrawing outside
Output(outputs=({'output_type': 'stream', 'text': 'load file: complex_scene.pkl\nRegenerate size 50 20\n', 'name': 'stdout'},))
%% Cell type:code id: tags:
```
python
```
...
...
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