|
35 | 35 | """ |
36 | 36 |
|
37 | 37 | from __future__ import absolute_import, division, print_function, unicode_literals |
38 | | - |
39 | | -import math |
| 38 | +from io import BytesIO, StringIO |
40 | 39 | import os |
41 | | -import re |
42 | 40 | import sys |
43 | | -from io import StringIO |
| 41 | +import math |
| 42 | +import re |
44 | 43 |
|
45 | | -import ezdxf |
46 | | -import numpy as np |
47 | | -from ezdxf.enums import TextEntityAlignment |
48 | | -from ezdxf.math.clipping import ClippingRect2d |
| 44 | +import matplotlib |
49 | 45 | from matplotlib.backend_bases import ( |
| 46 | + RendererBase, |
50 | 47 | FigureCanvasBase, |
51 | | - FigureManagerBase, |
52 | 48 | GraphicsContextBase, |
53 | | - RendererBase, |
| 49 | + FigureManagerBase, |
54 | 50 | ) |
55 | 51 | from matplotlib.transforms import Affine2D |
| 52 | +import matplotlib.transforms as transforms |
| 53 | +import matplotlib.collections as mplc |
| 54 | +import numpy as np |
56 | 55 | from shapely.geometry import LineString, Polygon |
| 56 | +import ezdxf |
| 57 | +from ezdxf.enums import TextEntityAlignment |
| 58 | +from ezdxf.math.clipping import Clipping, ClippingRect2d, ConvexClippingPolygon2d |
57 | 59 |
|
58 | 60 | from . import dxf_colors |
59 | 61 |
|
@@ -155,7 +157,7 @@ def _clip_mpl(self, gc, vertices, obj): |
155 | 157 | # Check if intersection is a multi-part geometry |
156 | 158 | if intersection.is_empty: |
157 | 159 | vertices = [] # No intersection |
158 | | - if ( |
| 160 | + elif ( |
159 | 161 | "Multi" in intersection.geom_type |
160 | 162 | or "GeometryCollection" in intersection.geom_type |
161 | 163 | ): |
@@ -214,8 +216,6 @@ def _draw_mpl_patch(self, gc, path, transform, rgbFace=None): |
214 | 216 | """Draw a matplotlib patch object""" |
215 | 217 |
|
216 | 218 | poly = self._draw_mpl_lwpoly(gc, path, transform, obj="patch") |
217 | | - if math.isclose(path.vertices[0][1], 421.2598): |
218 | | - pass |
219 | 219 | if not poly: |
220 | 220 | return |
221 | 221 | # check to see if the patch is filled |
@@ -318,35 +318,6 @@ def _draw_mpl_hatch(self, gc, path, transform, pline): |
318 | 318 | hatch = self.modelspace.add_hatch(color=dxfcolor) |
319 | 319 | line = hatch.paths.add_polyline_path(clipped) |
320 | 320 |
|
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 | | - |
350 | 321 | def draw_path_collection( |
351 | 322 | self, |
352 | 323 | gc, |
@@ -390,7 +361,6 @@ def draw_path(self, gc, path, transform, rgbFace=None): |
390 | 361 | elif self._groupd[-1] == "line2d": |
391 | 362 | line = self._draw_mpl_line2d(gc, path, transform) |
392 | 363 |
|
393 | | - # Note if this is used then tick marks and lines with markers go through this function |
394 | 364 | def draw_markers(self, gc, marker_path, marker_trans, path, trans, rgbFace=None): |
395 | 365 | # print('\nEntered ###DRAW_MARKERS###') |
396 | 366 | # print('\t', self._groupd) |
|
0 commit comments