Skip to content

Commit

Permalink
SLD support: export local svg paths to URI (fix #6792)
Browse files Browse the repository at this point in the history
  • Loading branch information
brushtyler committed Dec 2, 2012
1 parent dffae79 commit b45e215
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/core/symbology-ng/qgssymbollayerv2utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2176,9 +2176,18 @@ bool QgsSymbolLayerV2Utils::functionFromSldElement( QDomElement &element, QStrin
void QgsSymbolLayerV2Utils::createOnlineResourceElement( QDomDocument &doc, QDomElement &element,
QString path, QString format )
{
QString relpath = symbolPathToName( path );

// convert image path to url
QUrl url( relpath );
if ( !url.isValid() || url.scheme().isEmpty() )
{
url.setUrl( QUrl::fromLocalFile( relpath ).toString() );
}

QDomElement onlineResourceElem = doc.createElement( "se:OnlineResource" );
onlineResourceElem.setAttribute( "xlink:type", "simple" );
onlineResourceElem.setAttribute( "xlink:href", path );
onlineResourceElem.setAttribute( "xlink:href", url.toString() );
element.appendChild( onlineResourceElem );

QDomElement formatElem = doc.createElement( "se:Format" );
Expand Down

0 comments on commit b45e215

Please sign in to comment.