Skip to content

Commit

Permalink
Fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco Hugentobler committed Oct 18, 2012
1 parent 1960bea commit 7411f3c
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 23 deletions.
45 changes: 23 additions & 22 deletions src/mapserver/qgswfsserver.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ QDomDocument QgsWFSServer::getCapabilities()
QDomElement wfsCapabilitiesElement = doc.createElement( "WFS_Capabilities"/*wms:WFS_Capabilities*/ ); QDomElement wfsCapabilitiesElement = doc.createElement( "WFS_Capabilities"/*wms:WFS_Capabilities*/ );
wfsCapabilitiesElement.setAttribute( "xmlns", WFS_NAMESPACE ); wfsCapabilitiesElement.setAttribute( "xmlns", WFS_NAMESPACE );
wfsCapabilitiesElement.setAttribute( "xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance" ); wfsCapabilitiesElement.setAttribute( "xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance" );
wfsCapabilitiesElement.setAttribute( "xsi:schemaLocation", WFS_NAMESPACE+" http://schemas.opengis.net/wfs/1.0.0/wfs.xsd" ); wfsCapabilitiesElement.setAttribute( "xsi:schemaLocation", WFS_NAMESPACE + " http://schemas.opengis.net/wfs/1.0.0/wfs.xsd" );
wfsCapabilitiesElement.setAttribute( "xmlns:ogc", OGC_NAMESPACE ); wfsCapabilitiesElement.setAttribute( "xmlns:ogc", OGC_NAMESPACE );
wfsCapabilitiesElement.setAttribute( "xmlns:gml", GML_NAMESPACE ); wfsCapabilitiesElement.setAttribute( "xmlns:gml", GML_NAMESPACE );
wfsCapabilitiesElement.setAttribute( "xmlns:ows", "http://www.opengis.net/ows" ); wfsCapabilitiesElement.setAttribute( "xmlns:ows", "http://www.opengis.net/ows" );
Expand Down Expand Up @@ -621,14 +621,14 @@ void QgsWFSServer::startGetFeature( QgsRequestHandler& request, const QString& f


//wfs:FeatureCollection valid //wfs:FeatureCollection valid
fcString = "<wfs:FeatureCollection"; fcString = "<wfs:FeatureCollection";
fcString += " xmlns:wfs=\""+WFS_NAMESPACE+"\""; fcString += " xmlns:wfs=\"" + WFS_NAMESPACE + "\"";
fcString += " xmlns:ogc=\""+OGC_NAMESPACE+"\""; fcString += " xmlns:ogc=\"" + OGC_NAMESPACE + "\"";
fcString += " xmlns:gml=\""+GML_NAMESPACE+"\""; fcString += " xmlns:gml=\"" + GML_NAMESPACE + "\"";
fcString += " xmlns:ows=\"http://www.opengis.net/ows\""; fcString += " xmlns:ows=\"http://www.opengis.net/ows\"";
fcString += " xmlns:xlink=\"http://www.w3.org/1999/xlink\""; fcString += " xmlns:xlink=\"http://www.w3.org/1999/xlink\"";
fcString += " xmlns:qgs=\""+QGS_NAMESPACE+"\""; fcString += " xmlns:qgs=\"" + QGS_NAMESPACE + "\"";
fcString += " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""; fcString += " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"";
fcString += " xsi:schemaLocation=\""+WFS_NAMESPACE+" http://schemas.opengis.net/wfs/1.0.0/wfs.xsd "+QGS_NAMESPACE+" "+ hrefString.replace( "&", "&amp;" ) +"\""; fcString += " xsi:schemaLocation=\"" + WFS_NAMESPACE + " http://schemas.opengis.net/wfs/1.0.0/wfs.xsd " + QGS_NAMESPACE + " " + hrefString.replace( "&", "&amp;" ) + "\"";
fcString += ">"; fcString += ">";
result = fcString.toUtf8(); result = fcString.toUtf8();
request.startGetFeatureResponse( &result, format ); request.startGetFeatureResponse( &result, format );
Expand Down Expand Up @@ -671,7 +671,7 @@ void QgsWFSServer::sendGetFeature( QgsRequestHandler& request, const QString& fo
else else
{ {
QDomDocument gmlDoc; QDomDocument gmlDoc;
QDomElement featureElement = createFeatureGML2( feat, gmlDoc, crs, fields, hiddenAttributes ); QDomElement featureElement = createFeatureGML2( feat, gmlDoc, crs, fields, excludedAttributes );
gmlDoc.appendChild( featureElement ); gmlDoc.appendChild( featureElement );


result = gmlDoc.toByteArray(); result = gmlDoc.toByteArray();
Expand Down Expand Up @@ -733,10 +733,10 @@ QDomDocument QgsWFSServer::transaction( const QString& requestBody )


for ( int i = docChildNodes.count(); 0 < i; --i ) for ( int i = docChildNodes.count(); 0 < i; --i )
{ {
actionElem = docChildNodes.at( i-1 ).toElement(); actionElem = docChildNodes.at( i - 1 ).toElement();
actionName = actionElem.localName(); actionName = actionElem.localName();


if (actionName == "Insert" ) if ( actionName == "Insert" )
{ {
QDomElement featureElem = actionElem.firstChild().toElement(); QDomElement featureElem = actionElem.firstChild().toElement();
typeName = featureElem.localName(); typeName = featureElem.localName();
Expand All @@ -757,7 +757,7 @@ QDomDocument QgsWFSServer::transaction( const QString& requestBody )
mDocElem.appendChild( typeNameElem ); mDocElem.appendChild( typeNameElem );
} }
else else
typeNameElem = typeNameList.at(0).toElement(); typeNameElem = typeNameList.at( 0 ).toElement();


typeNameElem.appendChild( actionElem ); typeNameElem.appendChild( actionElem );
} }
Expand All @@ -769,7 +769,7 @@ QDomDocument QgsWFSServer::transaction( const QString& requestBody )
QDomElement respElem = resp.createElement( "WFS_TransactionResponse"/*wfs:WFS_TransactionResponse*/ ); QDomElement respElem = resp.createElement( "WFS_TransactionResponse"/*wfs:WFS_TransactionResponse*/ );
respElem.setAttribute( "xmlns", WFS_NAMESPACE ); respElem.setAttribute( "xmlns", WFS_NAMESPACE );
respElem.setAttribute( "xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance" ); respElem.setAttribute( "xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance" );
respElem.setAttribute( "xsi:schemaLocation", WFS_NAMESPACE+" http://schemas.opengis.net/wfs/1.0.0/wfs.xsd" ); respElem.setAttribute( "xsi:schemaLocation", WFS_NAMESPACE + " http://schemas.opengis.net/wfs/1.0.0/wfs.xsd" );
respElem.setAttribute( "xmlns:ogc", OGC_NAMESPACE ); respElem.setAttribute( "xmlns:ogc", OGC_NAMESPACE );
respElem.setAttribute( "version", "1.0.0" ); respElem.setAttribute( "version", "1.0.0" );
resp.appendChild( respElem ); resp.appendChild( respElem );
Expand Down Expand Up @@ -807,7 +807,7 @@ QDomDocument QgsWFSServer::transaction( const QString& requestBody )


// Start the update transaction // Start the update transaction
layer->startEditing(); layer->startEditing();
if ( (cap & QgsVectorDataProvider::ChangeAttributeValues ) && (cap & QgsVectorDataProvider::ChangeGeometries ) ) if (( cap & QgsVectorDataProvider::ChangeAttributeValues ) && ( cap & QgsVectorDataProvider::ChangeGeometries ) )
{ {
// Loop through the update elements for this layer // Loop through the update elements for this layer
QDomNodeList upNodeList = typeNameElem.elementsByTagNameNS( WFS_NAMESPACE, "Update" ); QDomNodeList upNodeList = typeNameElem.elementsByTagNameNS( WFS_NAMESPACE, "Update" );
Expand All @@ -827,7 +827,7 @@ QDomDocument QgsWFSServer::transaction( const QString& requestBody )
QDomElement nameElem; QDomElement nameElem;
QDomElement valueElem; QDomElement valueElem;
QDomElement geometryElem; QDomElement geometryElem;

for ( int l = 0; l < propertyNodeList.count(); ++l ) for ( int l = 0; l < propertyNodeList.count(); ++l )
{ {
propertyElem = propertyNodeList.at( l ).toElement(); propertyElem = propertyNodeList.at( l ).toElement();
Expand Down Expand Up @@ -876,8 +876,9 @@ QDomDocument QgsWFSServer::transaction( const QString& requestBody )
layer->changeAttributeValue( *fidIt, fieldIt.key(), it.value() ); layer->changeAttributeValue( *fidIt, fieldIt.key(), it.value() );
} }


if ( !geometryElem.isNull() ) { if ( !geometryElem.isNull() )
if (!layer->changeGeometry( *fidIt, QgsGeometry::fromGML2( geometryElem ) ) ) {
if ( !layer->changeGeometry( *fidIt, QgsGeometry::fromGML2( geometryElem ) ) )
throw QgsMapServiceException( "RequestNotWellFormed", "Error in change geometry" ); throw QgsMapServiceException( "RequestNotWellFormed", "Error in change geometry" );
} }
} }
Expand Down Expand Up @@ -905,7 +906,7 @@ QDomDocument QgsWFSServer::transaction( const QString& requestBody )
} }
// Start the delete transaction // Start the delete transaction
layer->startEditing(); layer->startEditing();
if ( ( cap & QgsVectorDataProvider::DeleteFeatures ) ) if (( cap & QgsVectorDataProvider::DeleteFeatures ) )
{ {
// Loop through the delete elements // Loop through the delete elements
QDomNodeList delNodeList = typeNameElem.elementsByTagNameNS( WFS_NAMESPACE, "Delete" ); QDomNodeList delNodeList = typeNameElem.elementsByTagNameNS( WFS_NAMESPACE, "Delete" );
Expand Down Expand Up @@ -959,15 +960,15 @@ QDomDocument QgsWFSServer::transaction( const QString& requestBody )
actionElem = inNodeList.at( j ).toElement(); actionElem = inNodeList.at( j ).toElement();
// Loop through the feature element // Loop through the feature element
QDomNodeList featNodes = actionElem.childNodes(); QDomNodeList featNodes = actionElem.childNodes();
for ( int l = 0; l< featNodes.count(); l++ ) for ( int l = 0; l < featNodes.count(); l++ )
{ {
// Create feature for this layer // Create feature for this layer
QgsFeature* f = new QgsFeature(); QgsFeature* f = new QgsFeature();
unsigned char* wkb = 0; unsigned char* wkb = 0;
int wkbSize = 0; int wkbSize = 0;
QGis::WkbType currentType; QGis::WkbType currentType;


QDomElement featureElem = featNodes.at(l).toElement(); QDomElement featureElem = featNodes.at( l ).toElement();


QDomNode currentAttributeChild = featureElem.firstChild(); QDomNode currentAttributeChild = featureElem.firstChild();


Expand Down Expand Up @@ -1034,7 +1035,7 @@ QDomDocument QgsWFSServer::transaction( const QString& requestBody )
return resp; return resp;
} }
// Get the Feature Ids of the inserted feature // Get the Feature Ids of the inserted feature
for (int j = 0; j < inFeatList.size(); j++ ) for ( int j = 0; j < inFeatList.size(); j++ )
{ {
insertResults.insert( inFeatList[j].id() ); insertResults.insert( inFeatList[j].id() );
} }
Expand Down Expand Up @@ -1068,7 +1069,7 @@ QDomDocument QgsWFSServer::transaction( const QString& requestBody )
return resp; return resp;
} }


QgsFeatureIds QgsWFSServer::getFeatureIdsFromFilter( QDomElement filter, QgsVectorLayer* layer ) QgsFeatureIds QgsWFSServer::getFeatureIdsFromFilter( QDomElement filter, QgsVectorLayer* layer )
{ {
QgsFeatureIds fids; QgsFeatureIds fids;


Expand Down Expand Up @@ -1099,7 +1100,7 @@ QgsFeatureIds QgsWFSServer::getFeatureIdsFromFilter( QDomElement filter, QgsVect
return fids; return fids;
} }


QString QgsWFSServer::createFeatureGeoJSON( QgsFeature* feat, QgsCoordinateReferenceSystem &, QMap< int, QgsField > fields, QSet<QString> hiddenAttributes ) /*const*/ QString QgsWFSServer::createFeatureGeoJSON( QgsFeature* feat, QgsCoordinateReferenceSystem &, QMap< int, QgsField > fields, QSet<QString> excludedAttributes ) /*const*/
{ {
QString fStr = "{\"type\": \"Feature\",\n"; QString fStr = "{\"type\": \"Feature\",\n";


Expand Down Expand Up @@ -1159,7 +1160,7 @@ QString QgsWFSServer::createFeatureGeoJSON( QgsFeature* feat, QgsCoordinateRefer
return fStr; return fStr;
} }


QDomElement QgsWFSServer::createFeatureGML2( QgsFeature* feat, QDomDocument& doc, QgsCoordinateReferenceSystem& crs, QMap< int, QgsField > fields, QSet<QString> hiddenAttributes ) /*const*/ QDomElement QgsWFSServer::createFeatureGML2( QgsFeature* feat, QDomDocument& doc, QgsCoordinateReferenceSystem& crs, QMap< int, QgsField > fields, QSet<QString> excludedAttributes ) /*const*/
{ {
//gml:FeatureMember //gml:FeatureMember
QDomElement featureElement = doc.createElement( "gml:featureMember"/*wfs:FeatureMember*/ ); QDomElement featureElement = doc.createElement( "gml:featureMember"/*wfs:FeatureMember*/ );
Expand Down
2 changes: 1 addition & 1 deletion src/mapserver/qgswfsserver.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class QgsWFSServer
QString createFeatureGeoJSON( QgsFeature* feat, QgsCoordinateReferenceSystem& crs, QMap< int, QgsField > fields, QSet<QString> excludedAttributes ) /*const*/; QString createFeatureGeoJSON( QgsFeature* feat, QgsCoordinateReferenceSystem& crs, QMap< int, QgsField > fields, QSet<QString> excludedAttributes ) /*const*/;


//methods to write GML2 //methods to write GML2
QDomElement createFeatureGML2( QgsFeature* feat, QDomDocument& doc, QgsCoordinateReferenceSystem& crs, QMap< int, QgsField > fields, QSet<QString> hiddenAttributes ) /*const*/; QDomElement createFeatureGML2( QgsFeature* feat, QDomDocument& doc, QgsCoordinateReferenceSystem& crs, QMap< int, QgsField > fields, QSet<QString> excludedAttributes ) /*const*/;


QDomElement createBoxGML2( QgsRectangle* box, QDomDocument& doc ) /* const */; QDomElement createBoxGML2( QgsRectangle* box, QDomDocument& doc ) /* const */;


Expand Down

0 comments on commit 7411f3c

Please sign in to comment.