Skip to content
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

[visualise] Draw rectangular section outlines when possible #80

Merged
merged 2 commits into from
May 14, 2020

Conversation

jstockwin
Copy link
Owner

@jstockwin jstockwin commented May 14, 2020

Description

First checks if we can draw a simple rectangle around a section (with increasingly smaller margins). If we can't (because there will always be an element that is NOT in the section that would be in the rectangle), then the old behaviour using Voronoi diagrams will be used. The Voronoi diagram is only computed when needed.

This change involved a bit of a refactor where more data is stored on the class, rather than passing it between lots of functions.

Linked issues

Closes #72

Testing

This is been tested on a few example PDFs locally. Unfortunately we cannot easily write tests for the visualise tool.

Checklist

  • I have provided a good description of the change above
  • I have added any necessary tests
  • I have added all necessary type hints
  • I have checked my linting (docker-compose run --rm lint)
  • I have added/updated all necessary documentation
  • I have updated CHANGELOG.md, following the format from
    Keep a Changelog.

Copy link

@pauloAmaral pauloAmaral left a comment

Choose a reason for hiding this comment

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

Small changes required only, looks awesome 👍

py_pdf_parser/visualise/sections.py Outdated Show resolved Hide resolved
py_pdf_parser/visualise/sections.py Outdated Show resolved Hide resolved
@jstockwin
Copy link
Owner Author

@pauloAmaral updated

Copy link

@pauloAmaral pauloAmaral left a comment

Choose a reason for hiding this comment

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

👍

@jstockwin jstockwin merged commit 2dcd94f into master May 14, 2020
@jstockwin jstockwin deleted the simple-visualisations branch May 14, 2020 15:27
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.

Section visualisations can be made simpler in some cases
2 participants