Skip to content
Permalink
Browse files

fix for #814

git-svn-id: http://svn.osgeo.org/qgis/trunk@7448 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef
jef committed Nov 18, 2007
1 parent b7de177 commit 2bec93edb53a758108dcb02de8af98d52e7a3426
Showing with 33 additions and 15 deletions.
  1. +5 −0 src/core/qgsvectorlayer.cpp
  2. +9 −7 tools/mapserver_export/ms_export.py
  3. +19 −8 tools/mapserver_export/qgsmapserverexport.cpp
@@ -1912,6 +1912,11 @@ bool QgsVectorLayer::setDataProvider( QString const & provider )

if ( myLabel )
{
dField = document.createElement( "labelfield" );
dFieldText = document.createTextNode( myLabel->labelField(QgsLabel::Text ) );
dField.appendChild( dFieldText );
layer_node.appendChild( dField );

std::stringstream labelXML;

myLabel->writeXML(labelXML);
@@ -323,13 +323,16 @@ def writeMapLayers(self):
wmsStyles.append( '' )
# Create necesssary wms metadata
format = rasterProp.getElementsByTagName('wmsFormat')[0].childNodes[0].nodeValue.encode('utf-8')
ct = lyr.getElementsByTagName('coordinatetransform')[0]
srs = ct.getElementsByTagName('sourcesrs')[0].getElementsByTagName('spatialrefsys')[0]
epsg = srs.getElementsByTagName('epsg')[0].childNodes[0].nodeValue.encode('utf-8')
self.outFile.write(" METADATA\n")
self.outFile.write(" 'wms_name' '" + ','.join(wmsNames) + "'\n")
self.outFile.write(" 'wms_server_version' '1.1.1'\n")
self.outFile.write(" 'wms_srs' 'EPSG:4326 EPSG:" + epsg + "'\n")
try:
ct = lyr.getElementsByTagName('coordinatetransform')[0]
srs = ct.getElementsByTagName('sourcesrs')[0].getElementsByTagName('spatialrefsys')[0]
epsg = srs.getElementsByTagName('epsg')[0].childNodes[0].nodeValue.encode('utf-8')
self.outFile.write(" 'wms_srs' 'EPSG:4326 EPSG:" + epsg + "'\n")
except:
pass
self.outFile.write(" 'wms_format' '" + format + "'\n")
self.outFile.write(" 'wms_style' '" + ','.join(wmsStyles) + "'\n")
self.outFile.write(" END\n")
@@ -371,9 +374,8 @@ def writeMapLayers(self):

# Check for label field (ie LABELITEM) and label status
try:
labelOn = lyr.getElementsByTagName("label")[0].childNodes[0].nodeValue.encode('utf-8')
labelNode = lyr.getElementsByTagName('labelattributes')[0]
labelField = labelNode.getElementsByTagName('label')[0].getAttribute('field').encode('utf-8')
labelOn = lyr.getElementsByTagName( "label")[0].childNodes[0].nodeValue.encode('utf-8')
labelField = lyr.getElementsByTagName("labelfield")[0].childNodes[0].nodeValue.encode('utf-8')
if labelField != '' and labelField is not None and labelOn == "1":
self.outFile.write(" LABELITEM '" + labelField + "'\n");
except:
@@ -119,7 +119,11 @@ void QgsMapserverExport::apply()
#ifdef Q_WS_MACX
QString dataPath = prefixPath + "/../../../../share/qgis";
#elif WIN32
# ifndef _MSC_VER
QString dataPath = prefixPath + "/share/qgis";
# else
QString dataPath = prefixPath;
# endif
#else
QString dataPath ( PKGDATAPATH );
#endif
@@ -133,6 +137,10 @@ void QgsMapserverExport::apply()
// Import the module
std::cout << "Importing module" << std::endl;
pmod = PyImport_ImportModule("ms_export");
if(!pmod) {
QMessageBox::warning(this, "Map Export Error", "ms_export python module not found");
return;
}

std::cout << "Getting Qgis2Map constructor as python obj" << std::endl;
pclass = PyObject_GetAttrString(pmod, "Qgis2Map");
@@ -167,14 +175,17 @@ void QgsMapserverExport::apply()
pargs = Py_BuildValue("()");
// Execute the writeMapFile method to parse the QGIS project file and create the .map file
pstr = PyEval_CallObject(pmeth, pargs);
// Show the return value
PyArg_Parse(pstr, "s", &cstr);
std::cout << "Result: " << std::endl << cstr << std::endl;
// Show the results to the user
QMessageBox::information(this, "Results of Export", QString(cstr));

Py_DECREF(pstr);

if(pstr) {
// Show the return value
PyArg_Parse(pstr, "s", &cstr);
std::cout << "Result: " << std::endl << cstr << std::endl;

// Show the results to the user
QMessageBox::information(this, "Results of Export", QString(cstr));
Py_DECREF(pstr);
} else {
QMessageBox::warning(this, "Mapfile Export Error", "method call failed");
}
}
void QgsMapserverExport::on_buttonBox_helpRequested()
{

0 comments on commit 2bec93e

Please sign in to comment.
You can’t perform that action at this time.