Skip to content

Conversation

@dl3sdo
Copy link
Member

@dl3sdo dl3sdo commented Mar 26, 2023

There are .ocd files that erroneously contain an empty area hole, i.e., there are two subsequent points with the Ocd::OcdPoint32::FlagHole property.
If such a malformed .ocd file is imported Mapper will crash if the area object containing the empty hole is selected.
To fix this, the first of these .ocd points needs to be ignored. Since setPointFlags() applies the HolePoint property to the last point instead of the first point of the next part, the consequence is that instead of removing the first point of these two .ocd points, the second point of the two Mapper points with the HolePoint property needs to be removed.

Copy link
Member Author

@dl3sdo dl3sdo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing empty area holes should not be restricted to just one but be extended to multiple subsequent ones by replacing the if statement by a while loop.

There are .ocd files that erroneously contain an empty area hole, i.e.,
there are two subsequent points with the Ocd::OcdPoint32::FlagHole
property.
If such a malformed .ocd file is imported Mapper will crash if the
area object containing the empty hole is selected.
To fix this, the first of these .ocd points needs to be ignored.
Since setPointFlags() applies the HolePoint property to the last point
instead of the first point of the next part, the consequence is that
instead of removing the first point of these two .ocd points, the
second point of the two Mapper points with the HolePoint property needs
to be removed.
Using a loop ensures that multiple subsequent empty area holes are
removed.

Co-authored-by: lpechacek <[email protected]>
Copy link
Member

@dg0yt dg0yt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe I need some real or synthetical test data here.

// the consequence is that instead of removing the first point of these two .ocd points,
// the second point of the two Mapper points with the HolePoint property needs to be removed.
// Using a loop ensures that multiple subsequent empty area holes are removed.
while (is_area && i < object->coords.size() - 1 && object->coords[i].isHolePoint() && object->coords[i+1].isHolePoint())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it might be better to use a separate loop (or STL algorithm) then to nest loops.

@dl3sdo
Copy link
Member Author

dl3sdo commented Apr 13, 2024

Kai, I'll send you files via email.

@dl3sdo dl3sdo marked this pull request as draft July 29, 2024 09:07
@dl3sdo
Copy link
Member Author

dl3sdo commented Jul 29, 2024

Superseded by #2224 and #2225

@dl3sdo dl3sdo closed this Jul 29, 2024
@dl3sdo dl3sdo deleted the fix-empty-holes branch July 29, 2024 09:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants