# Path: drawingDimensioning/py3_helpers.py
# def map(function, arg):
#     return list(_map(function, arg))


import numpy
from numpy import sin, cos, dot
from drawingDimensioning.py3_helpers import map
        

    def prettify(self, indent='', indentIncrease='  '):
        if len(self.children) == 0:
            return indent + self.header + self.footer
        else:
            return indent + self.header + '\n' + '\n'.join([c.prettify( indent+indentIncrease ) for c in self.children]) + '\n' + indent + self.footer

    def __repr__(self):
        return self.prettify()

    def applyTransforms(self, x, y):
        R = numpy.eye(2)
        r_o = numpy.zeros(2)
        tx, ty = 0, 0
        sx, sy = 1.0, 1.0
        if 'transform=' in self.header:
            if 'rotate(' in self.header:
                rotateParms = map(float, extractParms(self.header, 0, 'rotate(', ', ', ')'))
                if len(rotateParms) == 3:
                    rotateDegrees, rx, ry = rotateParms
                else:
                    assert len(rotateParms) == 1
                    rotateDegrees, rx, ry = rotateParms[0], 0.0, 0.0
                rads = numpy.pi * rotateDegrees / 180
                R = numpy.array([ [ cos(rads), -sin(rads)], [ sin(rads), cos(rads)] ])
                r_o = numpy.array([ rx, ry])
            if 'translate(' in self.header:
                tx, ty = map(float, extractParms(self.header, 0, 'translate(', ', ', ')'))
            if 'scale(' in self.header:

# Path: drawingDimensioning/py3_helpers.py
# def map(function, arg):
#     return list(_map(function, arg))


# Path: drawingDimensioning/XMLlib.py
import numpy
from numpy import sin, cos, dot
from drawingDimensioning.py3_helpers import map

        

    def prettify(self, indent='', indentIncrease='  '):
        if len(self.children) == 0:
            return indent + self.header + self.footer
        else:
            return indent + self.header + '\n' + '\n'.join([c.prettify( indent+indentIncrease ) for c in self.children]) + '\n' + indent + self.footer

    def __repr__(self):
        return self.prettify()

    def applyTransforms(self, x, y):
        R = numpy.eye(2)
        r_o = numpy.zeros(2)
        tx, ty = 0, 0
        sx, sy = 1.0, 1.0
        if 'transform=' in self.header:
            if 'rotate(' in self.header:
                rotateParms = map(float, extractParms(self.header, 0, 'rotate(', ', ', ')'))
                if len(rotateParms) == 3:
                    rotateDegrees, rx, ry = rotateParms
                else:
                    assert len(rotateParms) == 1
                    rotateDegrees, rx, ry = rotateParms[0], 0.0, 0.0
                rads = numpy.pi * rotateDegrees / 180
                R = numpy.array([ [ cos(rads), -sin(rads)], [ sin(rads), cos(rads)] ])
                r_o = numpy.array([ rx, ry])
            if 'translate(' in self.header:
                tx, ty = map(float, extractParms(self.header, 0, 'translate(', ', ', ')'))
            if 'scale(' in self.header:

                scaleParms = map(float, extractParms(self.header, 0, 'scale(', ', ', ')'))