Skip to content

Commit 991eb37

Browse files
committed
tidy
1 parent 011ded9 commit 991eb37

File tree

1 file changed

+13
-43
lines changed

1 file changed

+13
-43
lines changed

mpldxf/backend_dxf.py

Lines changed: 13 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -35,25 +35,27 @@
3535
"""
3636

3737
from __future__ import absolute_import, division, print_function, unicode_literals
38-
39-
import math
38+
from io import BytesIO, StringIO
4039
import os
41-
import re
4240
import sys
43-
from io import StringIO
41+
import math
42+
import re
4443

45-
import ezdxf
46-
import numpy as np
47-
from ezdxf.enums import TextEntityAlignment
48-
from ezdxf.math.clipping import ClippingRect2d
44+
import matplotlib
4945
from matplotlib.backend_bases import (
46+
RendererBase,
5047
FigureCanvasBase,
51-
FigureManagerBase,
5248
GraphicsContextBase,
53-
RendererBase,
49+
FigureManagerBase,
5450
)
5551
from matplotlib.transforms import Affine2D
52+
import matplotlib.transforms as transforms
53+
import matplotlib.collections as mplc
54+
import numpy as np
5655
from shapely.geometry import LineString, Polygon
56+
import ezdxf
57+
from ezdxf.enums import TextEntityAlignment
58+
from ezdxf.math.clipping import Clipping, ClippingRect2d, ConvexClippingPolygon2d
5759

5860
from . import dxf_colors
5961

@@ -155,7 +157,7 @@ def _clip_mpl(self, gc, vertices, obj):
155157
# Check if intersection is a multi-part geometry
156158
if intersection.is_empty:
157159
vertices = [] # No intersection
158-
if (
160+
elif (
159161
"Multi" in intersection.geom_type
160162
or "GeometryCollection" in intersection.geom_type
161163
):
@@ -214,8 +216,6 @@ def _draw_mpl_patch(self, gc, path, transform, rgbFace=None):
214216
"""Draw a matplotlib patch object"""
215217

216218
poly = self._draw_mpl_lwpoly(gc, path, transform, obj="patch")
217-
if math.isclose(path.vertices[0][1], 421.2598):
218-
pass
219219
if not poly:
220220
return
221221
# check to see if the patch is filled
@@ -318,35 +318,6 @@ def _draw_mpl_hatch(self, gc, path, transform, pline):
318318
hatch = self.modelspace.add_hatch(color=dxfcolor)
319319
line = hatch.paths.add_polyline_path(clipped)
320320

321-
"""
322-
def draw_path_collection(
323-
self,
324-
gc,
325-
master_transform,
326-
paths,
327-
all_transforms,
328-
offsets,
329-
offsetTrans,
330-
facecolors,
331-
edgecolors,
332-
linewidths,
333-
linestyles,
334-
antialiaseds,
335-
urls,
336-
offset_position,
337-
):
338-
if self._groupd[-1] == "PolyCollection":
339-
# Handles PolyCollection as a collection of 'patch'-objects
340-
for path in paths:
341-
# combines master_transform with path_transform for each path
342-
combined_transform = master_transform
343-
if facecolors.size:
344-
rgbFace = facecolors[0] if facecolors is not None else None
345-
else:
346-
rgbFace = None
347-
self._draw_mpl_patch(gc, path, combined_transform, rgbFace)
348-
"""
349-
350321
def draw_path_collection(
351322
self,
352323
gc,
@@ -390,7 +361,6 @@ def draw_path(self, gc, path, transform, rgbFace=None):
390361
elif self._groupd[-1] == "line2d":
391362
line = self._draw_mpl_line2d(gc, path, transform)
392363

393-
# Note if this is used then tick marks and lines with markers go through this function
394364
def draw_markers(self, gc, marker_path, marker_trans, path, trans, rgbFace=None):
395365
# print('\nEntered ###DRAW_MARKERS###')
396366
# print('\t', self._groupd)

0 commit comments

Comments
 (0)