[QGIS Commit] r9983 - trunk/qgis/python/plugins/mapserver_export
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Mon Jan 19 14:53:23 EST 2009
Author: wonder
Date: 2009-01-19 14:53:23 -0500 (Mon, 19 Jan 2009)
New Revision: 9983
Modified:
trunk/qgis/python/plugins/mapserver_export/mapserverexport.py
trunk/qgis/python/plugins/mapserver_export/ms_export.py
Log:
mapserver export: fixed i18n problems, fixed continuous color renderer export
Modified: trunk/qgis/python/plugins/mapserver_export/mapserverexport.py
===================================================================
--- trunk/qgis/python/plugins/mapserver_export/mapserverexport.py 2009-01-19 19:16:14 UTC (rev 9982)
+++ trunk/qgis/python/plugins/mapserver_export/mapserverexport.py 2009-01-19 19:53:23 UTC (rev 9983)
@@ -78,17 +78,17 @@
if result == 1:
# get the settings from the dialog and export the map file
print "Creating exporter using %s and %s" % (self.dlg.ui.txtQgisFilePath.text(), self.dlg.ui.txtMapFilePath.text())
- exporter = Qgis2Map(str(self.dlg.ui.txtQgisFilePath.text()), str(self.dlg.ui.txtMapFilePath.text()))
+ exporter = Qgis2Map(unicode(self.dlg.ui.txtQgisFilePath.text()), unicode(self.dlg.ui.txtMapFilePath.text()))
print "Setting options"
exporter.setOptions(
- self.dlg.ui.cmbMapUnits.itemData( self.dlg.ui.cmbMapUnits.currentIndex() ).toString(),
- self.dlg.ui.cmbMapImageType.currentText(),
- self.dlg.ui.txtMapName.text(),
- self.dlg.ui.txtMapWidth.text(),
- self.dlg.ui.txtMapHeight.text(),
- self.dlg.ui.txtWebTemplate.text(),
- self.dlg.ui.txtWebFooter.text(),
- self.dlg.ui.txtWebHeader.text()
+ unicode(self.dlg.ui.cmbMapUnits.itemData( self.dlg.ui.cmbMapUnits.currentIndex() ).toString()),
+ unicode(self.dlg.ui.cmbMapImageType.currentText()),
+ unicode(self.dlg.ui.txtMapName.text()),
+ unicode(self.dlg.ui.txtMapWidth.text()),
+ unicode(self.dlg.ui.txtMapHeight.text()),
+ unicode(self.dlg.ui.txtWebTemplate.text()),
+ unicode(self.dlg.ui.txtWebFooter.text()),
+ unicode(self.dlg.ui.txtWebHeader.text())
)
print "Calling writeMapFile"
result = exporter.writeMapFile()
Modified: trunk/qgis/python/plugins/mapserver_export/ms_export.py
===================================================================
--- trunk/qgis/python/plugins/mapserver_export/ms_export.py 2009-01-19 19:16:14 UTC (rev 9982)
+++ trunk/qgis/python/plugins/mapserver_export/ms_export.py 2009-01-19 19:53:23 UTC (rev 9983)
@@ -53,17 +53,17 @@
# Set the options collected from the GUI
def setOptions(self, units, image, mapname, width, height, template, header, footer):
- self.units = units
- self.imageType = str(image)
- self.mapName = mapname
- self.width = width
- self.height = height
+ self.units = units.encode('utf-8')
+ self.imageType = image.encode('utf-8')
+ self.mapName = mapname.encode('utf-8')
+ self.width = width.encode('utf-8')
+ self.height = height.encode('utf-8')
#self.minimumScale = minscale
#self.maximumScale = maxscale
- self.template = template
- self.header = header
- self.footer = footer
- print units, image, mapname, width, height, template, header, footer
+ self.template = template.encode('utf-8')
+ self.header = header.encode('utf-8')
+ self.footer = footer.encode('utf-8')
+ #print units, image, mapname, width, height, template, header, footer
## All real work happens here by calling methods to write the
## various sections of the map file
@@ -121,7 +121,7 @@
# Write the general parts of the map section
def writeMapSection(self):
- self.outFile.write("# Map file created from QGIS project file " + self.project + "\n")
+ self.outFile.write("# Map file created from QGIS project file " + self.project.encode('utf-8') + "\n")
self.outFile.write("# Edit this file to customize for your map interface\n")
self.outFile.write("# (Created with PyQgis MapServer Export plugin)\n")
self.outFile.write("MAP\n")
@@ -417,10 +417,10 @@
# outline color
outlineNode = symbolNode.getElementsByTagName('outlinecolor')[0]
- class_def += " OUTLINECOLOR " + outlineNode.getAttribute('red') + ' ' + outlineNode.getAttribute('green') + ' ' + outlineNode.getAttribute('blue') + "\n"
+ class_def += " OUTLINECOLOR " + outlineNode.getAttribute('red').encode('utf-8') + ' ' + outlineNode.getAttribute('green').encode('utf-8') + ' ' + outlineNode.getAttribute('blue').encode('utf-8') + "\n"
# color
colorNode = symbolNode.getElementsByTagName('fillcolor')[0]
- class_def += " COLOR " + colorNode.getAttribute('red') + ' ' + colorNode.getAttribute('green') + ' ' + colorNode.getAttribute('blue') + "\n"
+ class_def += " COLOR " + colorNode.getAttribute('red').encode('utf-8') + ' ' + colorNode.getAttribute('green').encode('utf-8') + ' ' + colorNode.getAttribute('blue').encode('utf-8') + "\n"
class_def += " END\n"
@@ -469,10 +469,10 @@
# outline color
outlineNode = cls.getElementsByTagName('outlinecolor')[0]
- class_def += " OUTLINECOLOR " + outlineNode.getAttribute('red') + ' ' + outlineNode.getAttribute('green') + ' ' + outlineNode.getAttribute('blue') + "\n"
+ class_def += " OUTLINECOLOR " + outlineNode.getAttribute('red').encode('utf-8') + ' ' + outlineNode.getAttribute('green').encode('utf-8') + ' ' + outlineNode.getAttribute('blue').encode('utf-8') + "\n"
# color
colorNode = cls.getElementsByTagName('fillcolor')[0]
- class_def += " COLOR " + colorNode.getAttribute('red') + ' ' + colorNode.getAttribute('green') + ' ' + colorNode.getAttribute('blue') + "\n"
+ class_def += " COLOR " + colorNode.getAttribute('red').encode('utf-8') + ' ' + colorNode.getAttribute('green').encode('utf-8') + ' ' + colorNode.getAttribute('blue').encode('utf-8') + "\n"
class_def += " END\n"
@@ -493,7 +493,7 @@
classField = layerNode.getElementsByTagName('classificationattribute')[0].childNodes[0].nodeValue.encode('utf-8')
# write the rendering info for each class
- class_def += " CLASS\n"
+ class_def = " CLASS\n"
# Class name irrelevant for color ramps since mapserver can't render their legend
#self.outFile.write(" NAME '" + classField + "'\n")
@@ -510,7 +510,7 @@
class_def += " STYLE\n"
# The first and last color of the ramp ( r g b r g b )
- class_def += " COLORRANGE " + lowerColor.getAttribute('red') + " " + lowerColor.getAttribute('green') + " " + lowerColor.getAttribute('blue') + " " + upperColor.getAttribute('red') + " " + upperColor.getAttribute('green') + " " + upperColor.getAttribute('blue') + "\n"
+ class_def += " COLORRANGE " + lowerColor.getAttribute('red').encode('utf-8') + " " + lowerColor.getAttribute('green').encode('utf-8') + " " + lowerColor.getAttribute('blue').encode('utf-8') + " " + upperColor.getAttribute('red').encode('utf-8') + " " + upperColor.getAttribute('green').encode('utf-8') + " " + upperColor.getAttribute('blue').encode('utf-8') + "\n"
# The range of values over which to ramp the colors
class_def += " DATARANGE " + lower.getElementsByTagName('lowervalue')[0].childNodes[0].nodeValue.encode('utf-8') + ' ' + upper.getElementsByTagName('lowervalue')[0].childNodes[0].nodeValue.encode('utf-8') + '\n'
@@ -519,7 +519,7 @@
class_def += " END\n"
class_def += " STYLE\n"
- class_def += " OUTLINECOLOR " + outlineNode.getAttribute('red') + " " + outlineNode.getAttribute('green') + " " + outlineNode.getAttribute('blue') + "\n"
+ class_def += " OUTLINECOLOR " + outlineNode.getAttribute('red').encode('utf-8') + " " + outlineNode.getAttribute('green').encode('utf-8') + " " + outlineNode.getAttribute('blue').encode('utf-8') + "\n"
class_def += " END\n"
# label
@@ -577,17 +577,17 @@
# outline color
outlineNode = cls.getElementsByTagName('outlinecolor')[0]
class_def += " OUTLINECOLOR " \
- + outlineNode.getAttribute('red') + ' ' \
- + outlineNode.getAttribute('green') + ' ' \
- + outlineNode.getAttribute('blue') \
+ + outlineNode.getAttribute('red').encode('utf-8') + ' ' \
+ + outlineNode.getAttribute('green').encode('utf-8') + ' ' \
+ + outlineNode.getAttribute('blue').encode('utf-8') \
+ "\n"
# color
colorNode = cls.getElementsByTagName('fillcolor')[0]
class_def += " COLOR " \
- + colorNode.getAttribute('red') + ' ' \
- + colorNode.getAttribute('green') + ' ' \
- + colorNode.getAttribute('blue') \
+ + colorNode.getAttribute('red').encode('utf-8') + ' ' \
+ + colorNode.getAttribute('green').encode('utf-8') + ' ' \
+ + colorNode.getAttribute('blue').encode('utf-8') \
+ "\n"
class_def += " END\n"
More information about the QGIS-commit
mailing list