qq-2 commited on
Commit
b70511f
·
verified ·
1 Parent(s): 97892f8

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__init__.py +0 -0
  2. grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/conftest.cpython-311.pyc +0 -0
  3. grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_affinity.cpython-311.pyc +0 -0
  4. grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_box.cpython-311.pyc +0 -0
  5. grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_buffer.cpython-311.pyc +0 -0
  6. grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_cga.cpython-311.pyc +0 -0
  7. grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_clip_by_rect.cpython-311.pyc +0 -0
  8. grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_create_inconsistent_dimensionality.cpython-311.pyc +0 -0
  9. grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_delaunay.cpython-311.pyc +0 -0
  10. grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_empty_polygons.cpython-311.pyc +0 -0
  11. grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_equality.cpython-311.pyc +0 -0
  12. grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_geointerface.cpython-311.pyc +0 -0
  13. grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_invalid_geometries.cpython-311.pyc +0 -0
  14. grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_linear_referencing.cpython-311.pyc +0 -0
  15. grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_linemerge.cpython-311.pyc +0 -0
  16. grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_locale.cpython-311.pyc +0 -0
  17. grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_make_valid.cpython-311.pyc +0 -0
  18. grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_mapping.cpython-311.pyc +0 -0
  19. grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_minimum_clearance.cpython-311.pyc +0 -0
  20. grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_ndarrays.cpython-311.pyc +0 -0
  21. grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_nearest.cpython-311.pyc +0 -0
  22. grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_operations.cpython-311.pyc +0 -0
  23. grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_operators.cpython-311.pyc +0 -0
  24. grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_orient.cpython-311.pyc +0 -0
  25. grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_parallel_offset.cpython-311.pyc +0 -0
  26. grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_persist.cpython-311.pyc +0 -0
  27. grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_pickle.cpython-311.pyc +0 -0
  28. grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_polygonize.cpython-311.pyc +0 -0
  29. grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_polylabel.cpython-311.pyc +0 -0
  30. grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_predicates.cpython-311.pyc +0 -0
  31. grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_prepared.cpython-311.pyc +0 -0
  32. grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_products_z.cpython-311.pyc +0 -0
  33. grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_shape.cpython-311.pyc +0 -0
  34. grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_shared_paths.cpython-311.pyc +0 -0
  35. grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_singularity.cpython-311.pyc +0 -0
  36. grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_snap.cpython-311.pyc +0 -0
  37. grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_split.cpython-311.pyc +0 -0
  38. grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_substring.cpython-311.pyc +0 -0
  39. grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_svg.cpython-311.pyc +0 -0
  40. grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_transform.cpython-311.pyc +0 -0
  41. grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_union.cpython-311.pyc +0 -0
  42. grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_validation.cpython-311.pyc +0 -0
  43. grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_vectorized.cpython-311.pyc +0 -0
  44. grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_voronoi_diagram.cpython-311.pyc +0 -0
  45. grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_wkb.cpython-311.pyc +0 -0
  46. grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/test_ndarrays.py +42 -0
  47. grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/test_nearest.py +18 -0
  48. grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/test_operations.py +124 -0
  49. grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/test_operators.py +60 -0
  50. grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/test_orient.py +92 -0
grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__init__.py ADDED
File without changes
grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/conftest.cpython-311.pyc ADDED
Binary file (849 Bytes). View file
 
grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_affinity.cpython-311.pyc ADDED
Binary file (18.6 kB). View file
 
grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_box.cpython-311.pyc ADDED
Binary file (1.84 kB). View file
 
grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_buffer.cpython-311.pyc ADDED
Binary file (12.8 kB). View file
 
grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_cga.cpython-311.pyc ADDED
Binary file (3.65 kB). View file
 
grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_clip_by_rect.cpython-311.pyc ADDED
Binary file (6.3 kB). View file
 
grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_create_inconsistent_dimensionality.cpython-311.pyc ADDED
Binary file (9.06 kB). View file
 
grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_delaunay.cpython-311.pyc ADDED
Binary file (2.33 kB). View file
 
grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_empty_polygons.cpython-311.pyc ADDED
Binary file (1.74 kB). View file
 
grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_equality.cpython-311.pyc ADDED
Binary file (1.74 kB). View file
 
grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_geointerface.cpython-311.pyc ADDED
Binary file (4.67 kB). View file
 
grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_invalid_geometries.cpython-311.pyc ADDED
Binary file (2.12 kB). View file
 
grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_linear_referencing.cpython-311.pyc ADDED
Binary file (7.85 kB). View file
 
grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_linemerge.cpython-311.pyc ADDED
Binary file (2.48 kB). View file
 
grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_locale.cpython-311.pyc ADDED
Binary file (2.48 kB). View file
 
grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_make_valid.cpython-311.pyc ADDED
Binary file (1.55 kB). View file
 
grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_mapping.cpython-311.pyc ADDED
Binary file (1.34 kB). View file
 
grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_minimum_clearance.cpython-311.pyc ADDED
Binary file (1.68 kB). View file
 
grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_ndarrays.cpython-311.pyc ADDED
Binary file (2.73 kB). View file
 
grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_nearest.cpython-311.pyc ADDED
Binary file (1.54 kB). View file
 
grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_operations.cpython-311.pyc ADDED
Binary file (7.47 kB). View file
 
grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_operators.cpython-311.pyc ADDED
Binary file (3.62 kB). View file
 
grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_orient.cpython-311.pyc ADDED
Binary file (6.67 kB). View file
 
grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_parallel_offset.cpython-311.pyc ADDED
Binary file (4.38 kB). View file
 
grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_persist.cpython-311.pyc ADDED
Binary file (3.3 kB). View file
 
grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_pickle.cpython-311.pyc ADDED
Binary file (5.2 kB). View file
 
grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_polygonize.cpython-311.pyc ADDED
Binary file (3.45 kB). View file
 
grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_polylabel.cpython-311.pyc ADDED
Binary file (4.91 kB). View file
 
grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_predicates.cpython-311.pyc ADDED
Binary file (5.64 kB). View file
 
grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_prepared.cpython-311.pyc ADDED
Binary file (5.41 kB). View file
 
grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_products_z.cpython-311.pyc ADDED
Binary file (1.27 kB). View file
 
grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_shape.cpython-311.pyc ADDED
Binary file (3.89 kB). View file
 
grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_shared_paths.cpython-311.pyc ADDED
Binary file (3.52 kB). View file
 
grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_singularity.cpython-311.pyc ADDED
Binary file (1.22 kB). View file
 
grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_snap.cpython-311.pyc ADDED
Binary file (1.67 kB). View file
 
grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_split.cpython-311.pyc ADDED
Binary file (17.2 kB). View file
 
grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_substring.cpython-311.pyc ADDED
Binary file (28.5 kB). View file
 
grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_svg.cpython-311.pyc ADDED
Binary file (10.8 kB). View file
 
grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_transform.cpython-311.pyc ADDED
Binary file (7.35 kB). View file
 
grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_union.cpython-311.pyc ADDED
Binary file (4.66 kB). View file
 
grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_validation.cpython-311.pyc ADDED
Binary file (995 Bytes). View file
 
grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_vectorized.cpython-311.pyc ADDED
Binary file (8.58 kB). View file
 
grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_voronoi_diagram.cpython-311.pyc ADDED
Binary file (8.22 kB). View file
 
grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/__pycache__/test_wkb.cpython-311.pyc ADDED
Binary file (11 kB). View file
 
grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/test_ndarrays.py ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Tests of support for Numpy ndarrays. See
2
+ # https://github.com/sgillies/shapely/issues/26 for discussion.
3
+
4
+ import unittest
5
+ from functools import reduce
6
+
7
+ import numpy as np
8
+
9
+ from shapely import geometry
10
+
11
+
12
+ class TransposeTestCase(unittest.TestCase):
13
+ def test_multipoint(self):
14
+ arr = np.array([[1.0, 1.0, 2.0, 2.0, 1.0], [3.0, 4.0, 4.0, 3.0, 3.0]])
15
+ tarr = arr.T
16
+ shape = geometry.MultiPoint(tarr)
17
+ coords = reduce(lambda x, y: x + y, [list(g.coords) for g in shape.geoms])
18
+ assert coords == [(1.0, 3.0), (1.0, 4.0), (2.0, 4.0), (2.0, 3.0), (1.0, 3.0)]
19
+
20
+ def test_linestring(self):
21
+ a = np.array([[1.0, 1.0, 2.0, 2.0, 1.0], [3.0, 4.0, 4.0, 3.0, 3.0]])
22
+ t = a.T
23
+ s = geometry.LineString(t)
24
+ assert list(s.coords) == [
25
+ (1.0, 3.0),
26
+ (1.0, 4.0),
27
+ (2.0, 4.0),
28
+ (2.0, 3.0),
29
+ (1.0, 3.0),
30
+ ]
31
+
32
+ def test_polygon(self):
33
+ a = np.array([[1.0, 1.0, 2.0, 2.0, 1.0], [3.0, 4.0, 4.0, 3.0, 3.0]])
34
+ t = a.T
35
+ s = geometry.Polygon(t)
36
+ assert list(s.exterior.coords) == [
37
+ (1.0, 3.0),
38
+ (1.0, 4.0),
39
+ (2.0, 4.0),
40
+ (2.0, 3.0),
41
+ (1.0, 3.0),
42
+ ]
grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/test_nearest.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import unittest
2
+
3
+ import pytest
4
+
5
+ from shapely.geometry import Point
6
+ from shapely.ops import nearest_points
7
+
8
+
9
+ class Nearest(unittest.TestCase):
10
+ def test_nearest(self):
11
+ first, second = nearest_points(
12
+ Point(0, 0).buffer(1.0),
13
+ Point(3, 0).buffer(1.0),
14
+ )
15
+ assert first.x == pytest.approx(1.0)
16
+ assert second.x == pytest.approx(2.0)
17
+ assert first.y == pytest.approx(0.0)
18
+ assert second.y == pytest.approx(0.0)
grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/test_operations.py ADDED
@@ -0,0 +1,124 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import unittest
2
+
3
+ import pytest
4
+
5
+ import shapely
6
+ from shapely import geos_version
7
+ from shapely.errors import TopologicalError
8
+ from shapely.geometry import GeometryCollection, LineString, MultiPoint, Point, Polygon
9
+ from shapely.wkt import loads
10
+
11
+
12
+ class OperationsTestCase(unittest.TestCase):
13
+ def test_operations(self):
14
+ point = Point(0.0, 0.0)
15
+
16
+ # General geometry
17
+ assert point.area == 0.0
18
+ assert point.length == 0.0
19
+ assert point.distance(Point(-1.0, -1.0)) == pytest.approx(1.4142135623730951)
20
+
21
+ # Topology operations
22
+
23
+ # Envelope
24
+ assert isinstance(point.envelope, Point)
25
+
26
+ # Intersection
27
+ assert point.intersection(Point(-1, -1)).is_empty
28
+
29
+ # Buffer
30
+ assert isinstance(point.buffer(10.0), Polygon)
31
+ assert isinstance(point.buffer(10.0, quad_segs=32), Polygon)
32
+
33
+ # Simplify
34
+ p = loads(
35
+ "POLYGON ((120 120, 140 199, 160 200, 180 199, 220 120, 122 122, 121 121, "
36
+ "120 120))"
37
+ )
38
+ expected = loads(
39
+ "POLYGON ((120 120, 140 199, 160 200, 180 199, 220 120, 120 120))"
40
+ )
41
+ s = p.simplify(10.0, preserve_topology=False)
42
+ assert s.equals_exact(expected, 0.001)
43
+
44
+ p = loads(
45
+ "POLYGON ((80 200, 240 200, 240 60, 80 60, 80 200),"
46
+ "(120 120, 220 120, 180 199, 160 200, 140 199, 120 120))"
47
+ )
48
+ expected = loads(
49
+ "POLYGON ((80 200, 240 200, 240 60, 80 60, 80 200),"
50
+ "(120 120, 220 120, 180 199, 160 200, 140 199, 120 120))"
51
+ )
52
+ s = p.simplify(10.0, preserve_topology=True)
53
+ assert s.equals_exact(expected, 0.001)
54
+
55
+ # Convex Hull
56
+ assert isinstance(point.convex_hull, Point)
57
+
58
+ # Differences
59
+ assert isinstance(point.difference(Point(-1, 1)), Point)
60
+
61
+ assert isinstance(point.symmetric_difference(Point(-1, 1)), MultiPoint)
62
+
63
+ # Boundary
64
+ assert isinstance(point.boundary, GeometryCollection)
65
+
66
+ # Union
67
+ assert isinstance(point.union(Point(-1, 1)), MultiPoint)
68
+
69
+ assert isinstance(point.representative_point(), Point)
70
+ assert isinstance(point.point_on_surface(), Point)
71
+ assert point.representative_point() == point.point_on_surface()
72
+
73
+ assert isinstance(point.centroid, Point)
74
+
75
+ def test_relate(self):
76
+ # Relate
77
+ assert Point(0, 0).relate(Point(-1, -1)) == "FF0FFF0F2"
78
+
79
+ # issue #294: should raise TopologicalError on exception
80
+ invalid_polygon = loads(
81
+ "POLYGON ((40 100, 80 100, 80 60, 40 60, 40 100), "
82
+ "(60 60, 80 60, 80 40, 60 40, 60 60))"
83
+ )
84
+ assert not invalid_polygon.is_valid
85
+ if geos_version < (3, 13, 0):
86
+ with pytest.raises((TopologicalError, shapely.GEOSException)):
87
+ invalid_polygon.relate(invalid_polygon)
88
+ else: # resolved with RelateNG
89
+ assert invalid_polygon.relate(invalid_polygon) == "2FFF1FFF2"
90
+
91
+ def test_hausdorff_distance(self):
92
+ point = Point(1, 1)
93
+ line = LineString([(2, 0), (2, 4), (3, 4)])
94
+
95
+ distance = point.hausdorff_distance(line)
96
+ assert distance == point.distance(Point(3, 4))
97
+
98
+ def test_interpolate(self):
99
+ # successful interpolation
100
+ test_line = LineString([(1, 1), (1, 2)])
101
+ known_point = Point(1, 1.5)
102
+ interpolated_point = test_line.interpolate(0.5, normalized=True)
103
+ assert interpolated_point == known_point
104
+
105
+ # Issue #653; should nog segfault for empty geometries
106
+ empty_line = loads("LINESTRING EMPTY")
107
+ assert empty_line.is_empty
108
+ interpolated_point = empty_line.interpolate(0.5, normalized=True)
109
+ assert interpolated_point.is_empty
110
+
111
+ # invalid geometry should raise TypeError on exception
112
+ polygon = loads("POLYGON EMPTY")
113
+ with pytest.raises(TypeError, match="incorrect geometry type"):
114
+ polygon.interpolate(0.5, normalized=True)
115
+
116
+ def test_normalize(self):
117
+ point = Point(1, 1)
118
+ result = point.normalize()
119
+ assert result == point
120
+
121
+ line = loads("MULTILINESTRING ((1 1, 0 0), (1 1, 1 2))")
122
+ result = line.normalize()
123
+ expected = loads("MULTILINESTRING ((1 1, 1 2), (0 0, 1 1))")
124
+ assert result == expected
grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/test_operators.py ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import unittest
2
+
3
+ from shapely.geometry import LineString, MultiPoint, Point, Polygon
4
+
5
+
6
+ class OperatorsTestCase(unittest.TestCase):
7
+ def test_point(self):
8
+ point = Point(0, 0)
9
+ point2 = Point(-1, 1)
10
+ assert point.union(point2).equals(point | point2)
11
+ assert (point & point2).is_empty
12
+ assert point.equals(point - point2)
13
+ assert point.symmetric_difference(point2).equals(point ^ point2)
14
+ assert point != point2
15
+ point_dupe = Point(0, 0)
16
+ assert point, point_dupe
17
+
18
+ def test_multipoint(self):
19
+ mp1 = MultiPoint([(0, 0), (1, 1)])
20
+ mp1_dup = MultiPoint([(0, 0), (1, 1)])
21
+ mp1_rev = MultiPoint([(1, 1), (0, 0)])
22
+ mp2 = MultiPoint([(0, 0), (1, 1), (2, 2)])
23
+ mp3 = MultiPoint([(0, 0), (1, 1), (2, 3)])
24
+
25
+ assert mp1 == mp1_dup
26
+ assert mp1 != mp1_rev
27
+ assert mp1 != mp2
28
+ assert mp2 != mp3
29
+
30
+ p = Point(0, 0)
31
+ mp = MultiPoint([(0, 0)])
32
+ assert p != mp
33
+ assert mp != p
34
+
35
+ def test_polygon(self):
36
+ shell = ((0, 0), (3, 0), (3, 3), (0, 3))
37
+ hole = ((1, 1), (2, 1), (2, 2), (1, 2))
38
+ p_solid = Polygon(shell)
39
+ p2_solid = Polygon(shell)
40
+ p_hole = Polygon(shell, holes=[hole])
41
+ p2_hole = Polygon(shell, holes=[hole])
42
+
43
+ assert p_solid == p2_solid
44
+ assert p_hole == p2_hole
45
+ assert p_solid != p_hole
46
+
47
+ shell2 = ((-5, 2), (10.5, 3), (7, 3))
48
+ p3_hole = Polygon(shell2, holes=[hole])
49
+ assert p_hole != p3_hole
50
+
51
+ def test_linestring(self):
52
+ line1 = LineString([(0, 0), (1, 1), (2, 2)])
53
+ line2 = LineString([(0, 0), (2, 2)])
54
+ line2_dup = LineString([(0, 0), (2, 2)])
55
+ # .equals() indicates these are the same
56
+ assert line1.equals(line2)
57
+ # but != indicates these are different
58
+ assert line1 != line2
59
+ # but dupes are the same with ==
60
+ assert line2 == line2_dup
grounding-dino/.eval_venv/lib/python3.11/site-packages/shapely/tests/legacy/test_orient.py ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import unittest
2
+
3
+ from numpy.testing import assert_array_equal
4
+
5
+ from shapely.geometry import (
6
+ GeometryCollection,
7
+ LinearRing,
8
+ LineString,
9
+ MultiLineString,
10
+ MultiPoint,
11
+ MultiPolygon,
12
+ Point,
13
+ Polygon,
14
+ )
15
+ from shapely.ops import orient
16
+
17
+
18
+ class OrientTestCase(unittest.TestCase):
19
+ def test_point(self):
20
+ point = Point(0, 0)
21
+ assert orient(point, 1) == point
22
+ assert orient(point, -1) == point
23
+
24
+ def test_multipoint(self):
25
+ multipoint = MultiPoint([(0, 0), (1, 1)])
26
+ assert orient(multipoint, 1) == multipoint
27
+ assert orient(multipoint, -1) == multipoint
28
+
29
+ def test_linestring(self):
30
+ linestring = LineString([(0, 0), (1, 1)])
31
+ assert orient(linestring, 1) == linestring
32
+ assert orient(linestring, -1) == linestring
33
+
34
+ def test_multilinestring(self):
35
+ multilinestring = MultiLineString([[(0, 0), (1, 1)], [(1, 0), (0, 1)]])
36
+ assert orient(multilinestring, 1) == multilinestring
37
+ assert orient(multilinestring, -1) == multilinestring
38
+
39
+ def test_linearring(self):
40
+ linearring = LinearRing([(0, 0), (0, 1), (1, 0)])
41
+ assert orient(linearring, 1) == linearring
42
+ assert orient(linearring, -1) == linearring
43
+
44
+ def test_empty_polygon(self):
45
+ polygon = Polygon()
46
+ assert orient(polygon) == polygon
47
+
48
+ def test_polygon(self):
49
+ polygon = Polygon([(0, 0), (0, 1), (1, 0)])
50
+ polygon_reversed = Polygon(polygon.exterior.coords[::-1])
51
+ assert (orient(polygon, 1)) == polygon_reversed
52
+ assert (orient(polygon, -1)) == polygon
53
+
54
+ def test_multipolygon(self):
55
+ polygon1 = Polygon([(0, 0), (0, 1), (1, 0)])
56
+ polygon2 = Polygon([(1, 0), (2, 0), (2, 1)])
57
+ polygon1_reversed = Polygon(polygon1.exterior.coords[::-1])
58
+ polygon2_reversed = Polygon(polygon2.exterior.coords[::-1])
59
+ multipolygon = MultiPolygon([polygon1, polygon2])
60
+ assert not polygon1.exterior.is_ccw
61
+ assert polygon2.exterior.is_ccw
62
+ assert orient(multipolygon, 1) == MultiPolygon([polygon1_reversed, polygon2])
63
+ assert orient(multipolygon, -1) == MultiPolygon([polygon1, polygon2_reversed])
64
+
65
+ def test_geometrycollection(self):
66
+ polygon = Polygon([(0, 0), (0, 1), (1, 0)])
67
+ polygon_reversed = Polygon(polygon.exterior.coords[::-1])
68
+ collection = GeometryCollection([polygon])
69
+ assert orient(collection, 1) == GeometryCollection([polygon_reversed])
70
+ assert orient(collection, -1) == GeometryCollection([polygon])
71
+
72
+ def test_polygon_with_holes(self):
73
+ ring_cw = LinearRing([(0, 0), (0, 1), (1, 1), (0, 0)])
74
+ ring_cw2 = LinearRing([(0, 0), (0, 3), (3, 3), (0, 0)])
75
+ ring_ccw = LinearRing([(0, 0), (1, 1), (0, 1), (0, 0)])
76
+ ring_ccw2 = LinearRing([(0, 0), (2, 2), (0, 2), (0, 0)])
77
+
78
+ polygon_with_holes_mixed = Polygon(
79
+ ring_ccw, [ring_cw, ring_ccw2, ring_cw2, ring_ccw]
80
+ )
81
+ polygon_with_holes_ccw = Polygon(
82
+ ring_ccw, [ring_cw, ring_ccw2.reverse(), ring_cw2, ring_ccw.reverse()]
83
+ )
84
+
85
+ assert_array_equal(orient(polygon_with_holes_ccw, 1), polygon_with_holes_ccw)
86
+ assert_array_equal(
87
+ orient(polygon_with_holes_ccw, -1), polygon_with_holes_ccw.reverse()
88
+ )
89
+ assert_array_equal(orient(polygon_with_holes_mixed, 1), polygon_with_holes_ccw)
90
+ assert_array_equal(
91
+ orient(polygon_with_holes_mixed, -1), polygon_with_holes_ccw.reverse()
92
+ )