Deal with edge case of zero length paths.#147
Conversation
enzet
left a comment
There was a problem hiding this comment.
Hello, @RadostW,
I am really sorry for not responding so much time. I had a rough time doing pet projects.
Thank you for your contribution! It means a lot! If you are still interesting in the project, could you please take a look at the review.
map_machine/osm/osm_reader.py
Outdated
| def parse_levels(string: str) -> list[float]: | ||
| """Parse string representation of level sequence value.""" | ||
| # TODO: add `-` parsing | ||
| # TODO: add `-` parsing |
There was a problem hiding this comment.
Running black -l 80 map_machine will fix this.
map_machine/text.py
Outdated
| if address: | ||
| texts.append(self.label(", ".join(address))) | ||
|
|
||
| # if name: |
|
|
||
| def draw(self, svg: Drawing, scheme) -> None: | ||
| """Draw gradient sector.""" | ||
|
|
There was a problem hiding this comment.
If sectors are drawn incorrectly, we should disable them with the option.
|
|
||
| style: dict[str, Union[int, float, str]] = self.get_style(is_border) | ||
| path_commands: str = self.line.get_path(self.placement_offset) | ||
|
|
There was a problem hiding this comment.
We can do
if (path_commands := self.line.get_path(self.placement_offset) == None:
returnand the same for other tmp_d variables.
|
|
||
| def draw(self, svg: Drawing, flinger: Flinger) -> None: | ||
| """Draw simple building shape.""" | ||
|
|
There was a problem hiding this comment.
There is a comment below about tmp_ variables. We can nicely avoid them.
|
Checks had failed mostly because of style issues. The project uses Black style formatter. To apply Black style, one have to simply run black -l 80 map_machinewith the Black installed ( |
|
@RadostW Thank you for the PR. I'm really sorry for pushing into your fork's |
When cropping larger OSM datasets sometimes paths with zero nodes are formed.
Such paths break path -> svg code.
Checking for len < 2 resolves this problem.