From fe1a40cbc2341dc03c568013bcea638d1bd1ba86 Mon Sep 17 00:00:00 2001 From: Nicolas Hiillos Date: Thu, 9 Mar 2023 15:04:29 +0200 Subject: [PATCH] Fix loading numbers in form 'Xe-Y' --- .../drawing_controller/svg_processor.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/drawing_controller/drawing_controller/svg_processor.py b/src/drawing_controller/drawing_controller/svg_processor.py index bc54db9..0c6c1d2 100644 --- a/src/drawing_controller/drawing_controller/svg_processor.py +++ b/src/drawing_controller/drawing_controller/svg_processor.py @@ -118,16 +118,19 @@ class SVGProcessor(): # Numbers if c == '+' or c == '-' or c.isdecimal(): s = c - isdelim = lambda x: x.isspace() or x.isalpha() or x in [',', '+'] + isdelim = lambda x: x.isspace() or (x.isalpha() and c != 'e') or x in [',', '+'] while i < len(pathstr) and not isdelim(c): c = pathstr[i] if not isdelim(c): s = s + c - if c.isalpha(): + if c.isalpha() and c != 'e': break i += 1 path.append(s) + #print(path) + #input() + # Parser self.logger.info("Parsing path :'{}...' with {} tokens".format(path[:20], len(path))) x = 0.0 @@ -431,7 +434,7 @@ class SVGProcessor(): Simplify line with https://pypi.org/project/simplification/ """ # For RDP, Try an epsilon of 1.0 to start with. Other sensible values include 0.01, 0.001 - epsilon = 0.0001 + epsilon = 0.001 tmp = [] out = []