-
Notifications
You must be signed in to change notification settings - Fork 35
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
Deal with edge case of zero length paths. #147
base: main
Are you sure you want to change the base?
Conversation
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.
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.
@@ -50,12 +50,12 @@ def parse_float(string: str) -> Optional[float]: | |||
|
|||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Running black -l 80 map_machine
will fix this.
if address: | ||
texts.append(self.label(", ".join(address))) | ||
|
||
# if name: |
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.
Feel free to remove this part.
@@ -174,6 +174,9 @@ def __init__(self, tags: dict[str, str], point: np.ndarray) -> None: | |||
|
|||
def draw(self, svg: Drawing, scheme) -> None: | |||
"""Draw gradient sector.""" | |||
|
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.
If sectors are drawn incorrectly, we should disable them with the option.
@@ -531,7 +531,12 @@ def draw(self, svg: Drawing, is_border: bool) -> None: | |||
filter_: Filter = self.get_filter(svg, is_border) | |||
|
|||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can do
if (path_commands := self.line.get_path(self.placement_offset) == None:
return
and the same for other tmp_d
variables.
@@ -104,8 +104,13 @@ def __init__( | |||
|
|||
def draw(self, svg: Drawing, flinger: Flinger) -> None: | |||
"""Draw simple building shape.""" | |||
|
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.
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_machine with the Black installed ( |
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.