Skip to content

Commit

Permalink
making it compatible with older shapely #12
Browse files Browse the repository at this point in the history
  • Loading branch information
behrisch committed Jan 10, 2024
1 parent d2859ee commit 9f3d66b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions tools/import/dxf/dxf2jupedsim.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@
import os
import sys
import warnings
import itertools

import numpy
import ezdxf
import pyproj
import shapely
import itertools
from shapely.geometry import Polygon, LineString

sys.path.append(os.path.join(os.environ["SUMO_HOME"], 'tools'))
import sumolib # noqa
Expand Down Expand Up @@ -61,10 +62,9 @@ def polygon_as_XML_element(polygon, typename, index, color, layer):
print("Warning: polygon '%s' had some equal consecutive points removed: %s" % (polygonID, duplicates))

# Check for simplicity and output hints.
simple = shapely.is_simple(shapely.Polygon(cleanPolygon))
if not simple:
if not Polygon(cleanPolygon).is_valid:
print("Warning: polygon '%s' is not simple." % polygonID)
segments = list(map(shapely.LineString, zip(cleanPolygon[:-1], cleanPolygon[1:])))
segments = list(map(LineString, zip(cleanPolygon[:-1], cleanPolygon[1:])))
intersect = False
for segment1, segment2 in itertools.combinations(segments, 2):
if segment1.crosses(segment2):
Expand Down
2 changes: 1 addition & 1 deletion tools/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
shapely>=2.0.1
ezdxf>=0.14.2
fmpy>=0.3.5,!=0.3.17
lxml>=4.5.0
Expand All @@ -13,4 +12,5 @@ pyperclip>=1.7.0
pyproj>=2.5.0
rtree>=0.9.4
scipy>=1.3.3
shapely>=1.8.0
texttest>=4.2.1

0 comments on commit 9f3d66b

Please sign in to comment.