12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- # -*- coding:utf-8 -*-
- ##
- # This file is part of connectSVG.
- #
- # connectSVG is free software: you can redistribute it and/or modify it
- # under the terms of the GNU General Public License as published by
- # the Free Software Foundation, either version 3 of the License,
- # or (at your option) any later version.
- #
- # connectSVG is distributed in the hope that it will be useful, but WITHOUT ANY
- # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- # details.
- #
- # You should have received a copy of the GNU General Public License along
- # with connectSVG. If not, see <https://www.gnu.org/licenses/>.
- ##
- import logging
- log = logging.getLogger("connectsvg")
- def breakUncontinuous(paths, attributes) :
- log.info("Starting with %d paths", len(paths))
- i = 0
- while i < len(paths) :
- path = paths[i]
- pathAttributes = attributes[i]
- log.debug("Processing path "+str(i))
- if not path.iscontinuous() :
- replacePaths = path.continuous_subpaths()
- paths.pop(i)
- attributes.pop(i)
- i -= 1
- for replacePath in replacePaths :
- paths.insert(i, replacePath)
- attributes.insert(i, pathAttributes)
- i += 1
- log.debug("Replaced by %d paths", len(replacePaths))
- i += 1
- log.info("Ending with %d paths", len(paths))
- return paths, attributes
|