コード例 #1
0
                log.error(f"cannot validate {filename}")

            if root.findall("./symbols/symbol"):
                for symbol in root.findall("./symbols/symbol"):
                    symbol.attrib['tags'] = auth + ',geology'
                    n = (symbol.attrib['name'])
                    print(n)
                    c, d = name_parser(n)
                symbols.append(symbol)
                count_dict[auth] += 1

                style = QgsStyle()
                style.importXml(xmlfile)
                n_styles = style.symbolCount()
                symbol_name = style.symbolNames()[0]
                symbol = style.symbol(symbol_name)
                size = QSize(64, 64)
                image = symbol.asImage(size)
                path, filename = os.path.split(xmlfile)
                png_filename = filename.replace('.xml', '.png')
                png_dir = os.path.join("../docs/images/library/", auth)

                if not os.path.exists(png_dir):
                    os.makedirs(png_dir)
                image.save(r"{}".format(png_dir + '/' + png_filename), "PNG")

                status_path = os.path.join("docs/images/library/", auth)
                lnk = "![]({})".format(os.path.join(status_path, png_filename))
                writer.value_matrix.append([lnk, auth, str(c), d, ''])

            if root.findall("./colorramps/colorramp"):
コード例 #2
0
ファイル: images.py プロジェクト: opengisch/simboli_pr
    def _get_symbol(self, symbol_name):
        """Return the QgsSymbol or None if not found"""

        style = QgsStyle().defaultStyle()
        return style.symbol(symbol_name)