-
-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use vector based graphic (SVG) for map rendering #373
Conversation
8d5c6f7
to
8d8259a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your PR :)
I'm happy to someone takes action on the map, which is nearly untouched since I forked the lib
…aces and added room rendering with labels.
…ents. Fixed various typing hints. Code cleanups.
Co-authored-by: Robert Resch <robert@resch.dev>
Fixed some comments. Fixed a pylance error on svg_map to str conversion.
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## dev #373 +/- ##
==========================================
+ Coverage 78.60% 79.66% +1.05%
==========================================
Files 64 64
Lines 2618 2582 -36
Branches 475 468 -7
==========================================
- Hits 2058 2057 -1
+ Misses 516 481 -35
Partials 44 44 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you planning to add some tests? I know the map is currently not tested, but it would be great to add some tests too (optional)
I would, but I'm a bit overwhelmed on what and how to test the map code :\ .. Maybe I can start adding a test on point to path conversion code and on the trace path generation code (better than nothing..). I will then look for other thing to test if the time allows it. |
Co-authored-by: Robert Resch <robert@resch.dev>
pre-commit.ci autofix |
for more information, see https://pre-commit.ci
@lukakama I'm not sure if you missed my two questions on the remaining conversations. I'm planning to create a new release during Christmas, and would be nice to include your PR :) |
Yea, I read them but I wasn't able to quickly reply. I will be happy if the PR could be merged for Christmas, but I don't how much time I can dedicate to changes/tests. I will try. |
The map increase for my vacuum from 14kB (png) to 33kB (SVG) but I think that's not a problem and we can improve it later |
Yeah, it should be mainly due the trace path. When creating raw SVG it could be compressed a little (whitespaces can be removed from Path instructions, and that can reduce the size of a 20-30%, but I didn't found a way to do it with the library :( ). An alternative could be to use gzip compressed SVG (it should be supported by almost all browser). I will be glad to add it as a future improvement :) . |
Ah, I need to do a pull request on the HA integration, as the SVG map requires correct content type to be reported from the image component. |
See #375 |
Use vector based graphic (SVG) for map rendering.
Why? At least for my environment, the map rendered using only raster graphic results in a very low-res map representation. Vector based graphic allows to produce pretty looking maps with high-res elements for bot, charging station, traces and so on.
For comparison:
Raster based rendering (with a black background due DeebotUniverse/Deebot-4-Home-Assistant#268 )
Vector based rendering (not the same cleaning job)
TODO: