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

Validity Handling #275

Merged
merged 27 commits into from
Jan 31, 2022
Merged

Validity Handling #275

merged 27 commits into from
Jan 31, 2022

Commits on Jan 13, 2022

  1. Added tests that should fail because of issue #218, fixed floating po…

    …int error on buffer_with_style test
    keithdoggett authored and BuonOmo committed Jan 13, 2022
    Configuration menu
    Copy the full SHA
    b647059 View commit details
    Browse the repository at this point in the history
  2. Improve geos multipolygon creation performance (#251)

    Replace a manual validity check on MultiPolygon, which was iterating on
    each polygon combination, by a direct call of GEOSisValid.
    Quiwin authored and BuonOmo committed Jan 13, 2022
    Configuration menu
    Copy the full SHA
    4da6790 View commit details
    Browse the repository at this point in the history
  3. Added Segment#segment_intersection to get points from intersections, …

    …created SweeplineIntersector class to compute intersections on groups of segments.
    
    Segment#segment_intersection sligtly modifies the code from intersects_segment? and actually computes the intersection point (or nil if none).
    Edge cases for colinear segments are handled by return a single point from the intersection.
    intersects_segment? was modified to just check if segment_intersection is not nil.
    
    A SweeplineIntersector class was added that uses a basic sweepline algorithm to compute the intersections in a set of segments.
    This should be faster or as fast as the current validate_geometry intersection algorithm being used (more testing needed), since
    it only compares segments where their y-range includes the y value of the event the sweepline is handling.
    There are options to return all intersections or proper intersections that will filter out the connections in LineStrings.
    
    In the future, it is possible to make a Sweepline class and have the SweeplineIntersector inherit from it. This would allow
    us to use the sweepline more generically in other applications (some polygon clipping algos use a sweepline).
    keithdoggett authored and BuonOmo committed Jan 13, 2022
    Configuration menu
    Copy the full SHA
    af7e100 View commit details
    Browse the repository at this point in the history
  4. Move SweeplineIntersector to its own file. Remove Queue, replace obse…

    …rved_segments with Set, condense event creation branching.
    keithdoggett authored and BuonOmo committed Jan 13, 2022
    Configuration menu
    Copy the full SHA
    59466e9 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    291f85c View commit details
    Browse the repository at this point in the history
  6. Add PlanarGraph Implementation

    Adds a PlanarGraph implementation based on a Doubly Connected Edge List (DCEL). A DCEL is a graph data structure of
    vertices and half-edges. Half-edges are directed edges where one segment can be represented by a pair of half-edges.
    Half-edges are linked so that faces can be traversed (although faces are not stored).
    
    The PlanarGraph accepts an array of segments to build it and additional edges can be added via the add_edge and add_edges methods.
    When edges are added, intersections are automatically recomputed and handled. When possible, existing half-edges are preserved
    so that geometries can reference those half-edges.
    
    Also adds GeometryGraph which is a convenient way to interface geometries to a planar graph and provides ways to find important
    half-edges in each geometry.
    
    I haven't done a full performance test yet, but one notable area of improvement is that everytime an edge or edges is added,
    all of the half-edges are re-linked when we likely only need to re-link the half-edges that originate at new vertices.
    keithdoggett authored and BuonOmo committed Jan 13, 2022
    Configuration menu
    Copy the full SHA
    92f085f View commit details
    Browse the repository at this point in the history
  7. Change HalfEdge#each to cycle, simplify some methods, raise on invali…

    …d class in GeometryGraph
    keithdoggett authored and BuonOmo committed Jan 13, 2022
    Configuration menu
    Copy the full SHA
    152d79c View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    49592e9 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    91cd3ec View commit details
    Browse the repository at this point in the history
  10. Change structure to Cartesian::PlanarGraph, Cartesian::PlanarGraph::H…

    …alfEdge and Cartesian::GeometryGraph
    keithdoggett authored and BuonOmo committed Jan 13, 2022
    Configuration menu
    Copy the full SHA
    e54e976 View commit details
    Browse the repository at this point in the history
  11. Fix indentation

    keithdoggett authored and BuonOmo committed Jan 13, 2022
    Configuration menu
    Copy the full SHA
    44b965f View commit details
    Browse the repository at this point in the history
  12. Change HalfEdge#and_connected to return and enumerator instead of set…

    … if no block is given
    keithdoggett authored and BuonOmo committed Jan 13, 2022
    Configuration menu
    Copy the full SHA
    50c7302 View commit details
    Browse the repository at this point in the history
  13. Add ImplHelper::ValidOp module to provide a uniform interface for val…

    …idity checking of geometries.
    
    The ValidOp module provides methods based on simple geometric predicates to determine validity for a geometry and can be used as a fallback or overridden.
    The module can be overriden fully (in the case of Cartesian polygons) or just by implementing #invalid_reason (FFI and CAPI factories).
    
    Removes #validate_geometry from all classes and replaces them with #prepare_geometry. Any required validations were moved to the constructors.
    
    Adds the ValidityTest module to test/common to ensure that all classes of geometries validate in the same way.
    keithdoggett authored and BuonOmo committed Jan 13, 2022
    Configuration menu
    Copy the full SHA
    c979c1d View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    bb6ca22 View commit details
    Browse the repository at this point in the history
  15. Split ValidOp into ValidOp and ValidOpHelpers

    ValidOp is to be included in feature classes and has the invalid_reason and valid? methods, as well as feature type specific methods that walk through the validity flow for each
    geometry type.
    
    ValidOpHelpers is a collection of functions where an object is passed to them. These perform the specific checks and return the invalid reason if applicable.
    
    Also added overrides for both modules for cartesian functions.
    keithdoggett authored and BuonOmo committed Jan 13, 2022
    Configuration menu
    Copy the full SHA
    c2e93eb View commit details
    Browse the repository at this point in the history
  16. Configuration menu
    Copy the full SHA
    7833e63 View commit details
    Browse the repository at this point in the history
  17. Implement #crosses? and #intersects? between spherical line strings a…

    …nd fix tests, ValidOp so the spherical factory passes validity checks
    keithdoggett authored and BuonOmo committed Jan 13, 2022
    Configuration menu
    Copy the full SHA
    16f61f6 View commit details
    Browse the repository at this point in the history
  18. Appease Rubocop

    keithdoggett authored and BuonOmo committed Jan 13, 2022
    Configuration menu
    Copy the full SHA
    d36cdf3 View commit details
    Browse the repository at this point in the history
  19. Configuration menu
    Copy the full SHA
    9c30b7c View commit details
    Browse the repository at this point in the history
  20. use ubuntugis-unstable packages

    keithdoggett authored and BuonOmo committed Jan 13, 2022
    Configuration menu
    Copy the full SHA
    6e19eab View commit details
    Browse the repository at this point in the history
  21. Add validity check per method and validity API (#276)

    Co-authored-by: Keith Doggett <keith.doggett887@gmail.com>
    BuonOmo and keithdoggett committed Jan 13, 2022
    Configuration menu
    Copy the full SHA
    2827250 View commit details
    Browse the repository at this point in the history
  22. rebase adjustements

    BuonOmo committed Jan 13, 2022
    Configuration menu
    Copy the full SHA
    23d64d2 View commit details
    Browse the repository at this point in the history

Commits on Jan 14, 2022

  1. Add geometry validity doc

    I've added our `.yardopts` to make sure our options are used by
    rubydoc.info
    
    I've made examples point images to github to be sure we always see an
    image, wether we're on rubydoc or github.
    
    Completed TODOs.
    
    Added Klaxit to the gallery :)
    BuonOmo committed Jan 14, 2022
    Configuration menu
    Copy the full SHA
    41228d5 View commit details
    Browse the repository at this point in the history

Commits on Jan 15, 2022

  1. Configuration menu
    Copy the full SHA
    c098786 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    05d39d2 View commit details
    Browse the repository at this point in the history

Commits on Jan 19, 2022

  1. Fix make_valid and operator methods

    (1) `make_valid` should raise when it cannot produce a geometry, not
        return nil.
    
    (2) +, -, * operator methods would generate uncallable `unsafe_+`
        methods, hence we alias those with text.
    BuonOmo committed Jan 19, 2022
    Configuration menu
    Copy the full SHA
    fccbf67 View commit details
    Browse the repository at this point in the history

Commits on Jan 24, 2022

  1. Configuration menu
    Copy the full SHA
    22dd912 View commit details
    Browse the repository at this point in the history