Beispiel #1
0
def test_reversals(multipolygons_pair: MultipolygonsPair) -> None:
    left_multipolygon, right_multipolygon = multipolygons_pair

    result = intersect_multipolygons(left_multipolygon, right_multipolygon)

    assert result == intersect_multipolygons(
            reverse_multipolygon(left_multipolygon), right_multipolygon)
    assert result == intersect_multipolygons(
            left_multipolygon, reverse_multipolygon(right_multipolygon))
    assert result == intersect_multipolygons(
            reverse_multipolygon_borders(left_multipolygon),
            right_multipolygon)
    assert result == intersect_multipolygons(
            left_multipolygon,
            reverse_multipolygon_borders(right_multipolygon))
    assert result == intersect_multipolygons(
            reverse_multipolygon_holes(left_multipolygon), right_multipolygon)
    assert result == intersect_multipolygons(
            left_multipolygon, reverse_multipolygon_holes(right_multipolygon))
    assert result == intersect_multipolygons(
            reverse_multipolygon_holes_contours(left_multipolygon),
            right_multipolygon)
    assert result == intersect_multipolygons(
            left_multipolygon,
            reverse_multipolygon_holes_contours(right_multipolygon))
Beispiel #2
0
def test_reversals(multipolygons_pair: MultipolygonsPair) -> None:
    left_multipolygon, right_multipolygon = multipolygons_pair

    result = symmetric_subtract_multipolygons(left_multipolygon,
                                              right_multipolygon)

    assert are_multipolygons_similar(
        result,
        symmetric_subtract_multipolygons(
            reverse_multipolygon(left_multipolygon), right_multipolygon))
    assert are_multipolygons_similar(
        result,
        symmetric_subtract_multipolygons(
            left_multipolygon, reverse_multipolygon(right_multipolygon)))
    assert are_multipolygons_similar(
        result,
        symmetric_subtract_multipolygons(
            reverse_multipolygon_borders(left_multipolygon),
            right_multipolygon))
    assert are_multipolygons_similar(
        result,
        symmetric_subtract_multipolygons(
            left_multipolygon,
            reverse_multipolygon_borders(right_multipolygon)))
    assert are_multipolygons_similar(
        result,
        symmetric_subtract_multipolygons(
            reverse_multipolygon_holes(left_multipolygon), right_multipolygon))
    assert are_multipolygons_similar(
        result,
        symmetric_subtract_multipolygons(
            left_multipolygon, reverse_multipolygon_holes(right_multipolygon)))
    assert are_multipolygons_similar(
        result,
        symmetric_subtract_multipolygons(
            reverse_multipolygon_holes_contours(left_multipolygon),
            right_multipolygon))
    assert are_multipolygons_similar(
        result,
        symmetric_subtract_multipolygons(
            left_multipolygon,
            reverse_multipolygon_holes_contours(right_multipolygon)))
Beispiel #3
0
def test_reversals(multipolygon_with_multiregion
                   : Tuple[Multipolygon, Multiregion]) -> None:
    multipolygon, multiregion = multipolygon_with_multiregion

    result = multiregion_in_multipolygon(multiregion, multipolygon)

    assert result is multiregion_in_multipolygon(
            reverse_multiregion(multiregion), multipolygon)
    assert result is multiregion_in_multipolygon(
            multiregion, reverse_multipolygon_borders(multipolygon))
    assert result is multiregion_in_multipolygon(
            multiregion, reverse_multipolygon_holes(multipolygon))
    assert result is multiregion_in_multipolygon(
            multiregion, reverse_multipolygon_holes_contours(multipolygon))
    assert result is multiregion_in_multipolygon(
            reverse_multiregion_coordinates(multiregion),
            reverse_multipolygon_coordinates(multipolygon))
def test_reversals(
        multipolygon_with_point: Tuple[Multipolygon, Point]) -> None:
    multipolygon, point = multipolygon_with_point

    result = point_in_multipolygon(point, multipolygon)

    assert result is point_in_multipolygon(point,
                                           reverse_multipolygon(multipolygon))
    assert result is point_in_multipolygon(
        point, reverse_multipolygon_borders(multipolygon))
    assert result is point_in_multipolygon(
        point, reverse_multipolygon_holes(multipolygon))
    assert result is point_in_multipolygon(
        point, reverse_multipolygon_holes_contours(multipolygon))
    assert result is point_in_multipolygon(
        reverse_point_coordinates(point),
        reverse_multipolygon_coordinates(multipolygon))
Beispiel #5
0
def test_reversals(
        multipolygon_with_multisegment: MultipolygonWithMultisegment) -> None:
    multipolygon, multisegment = multipolygon_with_multisegment

    result = complete_intersect_multisegment_with_multipolygon(
        multisegment, multipolygon)

    assert result == complete_intersect_multisegment_with_multipolygon(
        multisegment, reverse_multipolygon(multipolygon))
    assert result == complete_intersect_multisegment_with_multipolygon(
        multisegment, reverse_multipolygon_borders(multipolygon))
    assert result == complete_intersect_multisegment_with_multipolygon(
        multisegment, reverse_multipolygon_holes(multipolygon))
    assert result == complete_intersect_multisegment_with_multipolygon(
        multisegment, reverse_multipolygon_holes_contours(multipolygon))
    assert result == complete_intersect_multisegment_with_multipolygon(
        reverse_multisegment(multisegment), multipolygon)
    assert result == complete_intersect_multisegment_with_multipolygon(
        reverse_multisegment_endpoints(multisegment), multipolygon)
def test_reversals(
        multipolygon_with_segment: Tuple[Multipolygon, Segment]) -> None:
    multipolygon, segment = multipolygon_with_segment

    result = segment_in_multipolygon(segment, multipolygon)

    assert result is segment_in_multipolygon(reverse_segment(segment),
                                             multipolygon)
    assert result is segment_in_multipolygon(
        segment, reverse_multipolygon(multipolygon))
    assert result is segment_in_multipolygon(
        segment, reverse_multipolygon_borders(multipolygon))
    assert result is segment_in_multipolygon(
        segment, reverse_multipolygon_holes(multipolygon))
    assert result is segment_in_multipolygon(
        segment, reverse_multipolygon_holes_contours(multipolygon))
    assert result is segment_in_multipolygon(
        reverse_segment_coordinates(segment),
        reverse_multipolygon_coordinates(multipolygon))
Beispiel #7
0
def test_reversals(
        multipolygon_with_multisegment: MultipolygonWithMultisegment) -> None:
    multipolygon, multisegment = multipolygon_with_multisegment

    result = subtract_multipolygon_from_multisegment(multisegment,
                                                     multipolygon)

    assert result == subtract_multipolygon_from_multisegment(
        multisegment, reverse_multipolygon(multipolygon))
    assert result == subtract_multipolygon_from_multisegment(
        multisegment, reverse_multipolygon_borders(multipolygon))
    assert result == subtract_multipolygon_from_multisegment(
        multisegment, reverse_multipolygon_holes(multipolygon))
    assert result == subtract_multipolygon_from_multisegment(
        multisegment, reverse_multipolygon_holes_contours(multipolygon))
    assert are_multisegments_similar(
        result,
        subtract_multipolygon_from_multisegment(
            reverse_multisegment(multisegment), multipolygon))
    assert are_multisegments_similar(
        result,
        subtract_multipolygon_from_multisegment(
            reverse_multisegment_endpoints(multisegment), multipolygon))