def testVectorFontStylingUpload(self): layer = layers.resolveLayer(PT1) sld, icons = getGsCompatibleSld(layer) #QgsMessageLog.logMessage("sld:" + sld, level=QgsMessageLog.WARNING) sldfile = os.path.join(os.path.dirname(__file__), "resources", "font.sld") with open(sldfile, 'r') as f: sldref = f.read() self.compareSld(sldref, sld)
def publishStyle(self, layer, overwrite = True, name = None): ''' Publishes the style of a given layer style in the specified catalog. If the overwrite parameter is True, it will overwrite a style with that name in case it exists ''' if isinstance(layer, basestring): layer = layers.resolveLayer(layer) sld = getGsCompatibleSld(layer) if sld is not None: name = name if name is not None else layer.name() name = name.replace(" ", "_") self.catalog.create_style(name, sld, overwrite) return sld
def publishStyle(self, layer, overwrite=True, name=None): ''' Publishes the style of a given layer style in the specified catalog. If the overwrite parameter is True, it will overwrite a style with that name in case it exists ''' if isinstance(layer, str): layer = layers.resolveLayer(layer) sld, icons = getGsCompatibleSld(layer) if sld is not None: name = name if name is not None else layer.name() name = name.replace(" ", "_") self.uploadIcons(icons) self.catalog.create_style(name, sld.encode('utf-8'), overwrite) return sld
def testVectorFontStylingUpload(self): layer = layers.resolveLayer(PT1) sld, icons = getGsCompatibleSld(layer) self.assertTrue( "<WellKnownName>ttf://DejaVu Sans#0x46</WellKnownName>" in sld)
def testVectorFontStylingUpload(self): layer = layers.resolveLayer(PT1) sld, icons = getGsCompatibleSld(layer) self.assertTrue("<WellKnownName>ttf://DejaVu Sans#0x46</WellKnownName>" in sld)