@@ -130,6 +130,81 @@ def test_plot_can_render_multipolygons_that_say_they_are_polygons(self):
130130
131131 fig .tight_layout ()
132132
133+ def test_plot_can_render_polygon_with_inverted_inner_ring (self ):
134+ ext = [
135+ (7.866043666934409 , 32.80184055229537 ),
136+ (19.016191271980425 , 203.48380872801957 ),
137+ (75.90086964475744 , 236.02570144190528 ),
138+ (229.48380872801957 , 235.98380872801957 ),
139+ (235.98380872801957 , 5.516191271980426 ),
140+ (197.42585593903195 , 6.144892860751103 ),
141+ (116.5 , 96.4575926540027 ),
142+ (55.65582863082729 , 12.531294107459374 ),
143+ (7.866043666934409 , 32.80184055229537 ),
144+ ]
145+
146+ interior = [
147+ (160.12353079731844 , 173.21221665537414 ),
148+ (181.80184055229537 , 159.13395633306558 ),
149+ (198.86604366693442 , 179.80184055229537 ),
150+ (178.19815944770465 , 198.86604366693442 ),
151+ (160.12353079731844 , 173.21221665537414 ),
152+ ]
153+
154+ polygon = Polygon (ext , [interior ])
155+ geo_df = gpd .GeoDataFrame (geometry = [polygon ])
156+ sdata = SpatialData (shapes = {"inverted_ring" : ShapesModel .parse (geo_df )})
157+
158+ fig , ax = plt .subplots ()
159+ sdata .pl .render_shapes (element = "inverted_ring" ).pl .show (ax = ax )
160+ ax .set_xlim (0 , 250 )
161+ ax .set_ylim (0 , 250 )
162+
163+ fig .tight_layout ()
164+
165+ def test_plot_can_render_multipolygon_with_inverted_inner_ring_and_disjoint_part (self ):
166+ ext = [
167+ (7.866043666934409 , 32.80184055229537 ),
168+ (19.016191271980425 , 203.48380872801957 ),
169+ (75.90086964475744 , 236.02570144190528 ),
170+ (229.48380872801957 , 235.98380872801957 ),
171+ (235.98380872801957 , 5.516191271980426 ),
172+ (197.42585593903195 , 6.144892860751103 ),
173+ (116.5 , 96.4575926540027 ),
174+ (55.65582863082729 , 12.531294107459374 ),
175+ (7.866043666934409 , 32.80184055229537 ),
176+ ]
177+
178+ interior = [
179+ (160.12353079731844 , 173.21221665537414 ),
180+ (181.80184055229537 , 159.13395633306558 ),
181+ (198.86604366693442 , 179.80184055229537 ),
182+ (178.19815944770465 , 198.86604366693442 ),
183+ (160.12353079731844 , 173.21221665537414 ),
184+ ]
185+
186+ # Part with a hole and non-standard orientation, plus a disjoint simple part
187+ poly_with_hole = Polygon (ext , [interior ])
188+ disjoint_poly = Polygon (
189+ [
190+ (300.0 , 300.0 ),
191+ (320.0 , 300.0 ),
192+ (320.0 , 320.0 ),
193+ (300.0 , 320.0 ),
194+ (300.0 , 300.0 ),
195+ ]
196+ )
197+ multipoly = MultiPolygon ([poly_with_hole , disjoint_poly ])
198+ geo_df = gpd .GeoDataFrame (geometry = [multipoly ])
199+ sdata = SpatialData (shapes = {"inverted_ring_multipoly" : ShapesModel .parse (geo_df )})
200+
201+ fig , ax = plt .subplots ()
202+ sdata .pl .render_shapes (element = "inverted_ring_multipoly" ).pl .show (ax = ax )
203+ ax .set_xlim (0 , 350 )
204+ ax .set_ylim (0 , 350 )
205+
206+ fig .tight_layout ()
207+
133208 def test_plot_can_color_multipolygons_with_multiple_holes (self ):
134209 square = [(0.0 , 0.0 ), (5.0 , 0.0 ), (5.0 , 5.0 ), (0.0 , 5.0 ), (0.0 , 0.0 )]
135210 first_hole = [(1.0 , 1.0 ), (2.0 , 1.0 ), (2.0 , 2.0 ), (1.0 , 2.0 ), (1.0 , 1.0 )]
0 commit comments