Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Insert user defined OWS extent for project into top layer of WMS capa…
…bilities
  • Loading branch information
mhugent committed May 15, 2013
1 parent dbb0730 commit aa0c754
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
14 changes: 11 additions & 3 deletions src/mapserver/qgsprojectparser.cpp
Expand Up @@ -131,7 +131,7 @@ void QgsProjectParser::layersAndStylesCapabilities( QDomElement& parentElement,
addLayers( doc, layerParentElem, legendElem, layerMap, nonIdentifiableLayers, version, fullProjectSettings );

parentElement.appendChild( layerParentElem );
combineExtentAndCrsOfGroupChildren( layerParentElem, doc );
combineExtentAndCrsOfGroupChildren( layerParentElem, doc, true );
}

void QgsProjectParser::featureTypeList( QDomElement& parentElement, QDomDocument& doc ) const
Expand Down Expand Up @@ -696,7 +696,7 @@ QString QgsProjectParser::editTypeString( QgsVectorLayer::EditType type )
}
}

void QgsProjectParser::combineExtentAndCrsOfGroupChildren( QDomElement& groupElem, QDomDocument& doc ) const
void QgsProjectParser::combineExtentAndCrsOfGroupChildren( QDomElement& groupElem, QDomDocument& doc, bool considerMapExtent ) const
{
QgsRectangle combinedBBox;
QSet<QString> combinedCRSSet;
Expand Down Expand Up @@ -744,6 +744,14 @@ void QgsProjectParser::combineExtentAndCrsOfGroupChildren( QDomElement& groupEle
appendCRSElementsToLayer( groupElem, doc, combinedCRSSet.toList() );

const QgsCoordinateReferenceSystem& groupCRS = projectCRS();
if ( considerMapExtent )
{
QgsRectangle mapRect = mapRectangle();
if ( !mapRect.isEmpty() )
{
combinedBBox = mapRect;
}
}
appendLayerBoundingBoxes( groupElem, doc, combinedBBox, groupCRS );
}

Expand Down Expand Up @@ -953,7 +961,7 @@ int QgsProjectParser::layersAndStyles( QStringList& layers, QStringList& styles
}

QDomDocument QgsProjectParser::getStyle( const QString& styleName, const QString& layerName ) const
{
{
QDomDocument myDocument = QDomDocument();

QDomNode header = myDocument.createProcessingInstruction( "xml", "version=\"1.0\" encoding=\"UTF-8\"" );
Expand Down
3 changes: 2 additions & 1 deletion src/mapserver/qgsprojectparser.h
Expand Up @@ -186,7 +186,8 @@ class QgsProjectParser: public QgsConfigParser

static void addLayerProjectSettings( QDomElement& layerElem, QDomDocument& doc, QgsMapLayer* currentLayer );

void combineExtentAndCrsOfGroupChildren( QDomElement& groupElement, QDomDocument& doc ) const;
/**@param considerMapExtent Take user-defined map extent instead of data-calculated extent if present in project file*/
void combineExtentAndCrsOfGroupChildren( QDomElement& groupElement, QDomDocument& doc, bool considerMapExtent = false ) const;

/**Returns dom element of composer (identified by composer title) or a null element in case of error*/
QDomElement composerByName( const QString& composerName ) const;
Expand Down

0 comments on commit aa0c754

Please sign in to comment.