(self)
Apply transforms to element coordinates.
Apply transforms to element coordinates.
Apply transforms to element coordinates .
def applyTransforms(self):
        """ Apply transforms to element coordinates. """
        
        for element in self.tree.iter():
            if 'transform' in element.keys():
                all_transforms = element.get('transform')
                transform_list = re_transform.findall(all_transforms)
                transform_list.reverse()
                
                element_type = element.tag.split('}')[1]
                if element_type == 'g':
                    self._applyGroupTransforms(element, transform_list)
                
                sucessful_transformation = False
                for transformation in transform_list:
                    delta = [float(n) for n in transformation[1:] if n]
                    if transformation[0] == 'translate':
                        sucessful_transformation = self._translateElement(element, delta)
                    elif transformation[0] == 'scale':
                        sucessful_transformation = self._scaleElement(element, delta)
                
                # Doesn't take into account if one transformation isn't sucessful
                if sucessful_transformation:
                    del element.attrib["transform"]
def applyTransforms ( self ) : for element in self . tree . iter ( ) : if 'transform' in element . keys ( ) : all_transforms = element . get ( 'transform' ) transform_list = re_transform . findall ( all_transforms ) transform_list . reverse ( ) element_type = element . tag . split ( '}' ) [ 1 ] if element_type == 'g' : self . _applyGroupTransforms ( element , transform_list ) sucessful_transformation = False for transformation in transform_list : delta = [ float ( n ) for n in transformation [ 1 : ] if n ] if transformation [ 0 ] == 'translate' : sucessful_transformation = self . _translateElement ( element , delta ) elif transformation [ 0 ] == 'scale' : sucessful_transformation = self . _scaleElement ( element , delta ) # Doesn't take into account if one transformation isn't sucessful if sucessful_transformation : del element . attrib [ "transform" ]