Skip to content

Commit

Permalink
remove leading dir separator from symbol path when it's relative,
Browse files Browse the repository at this point in the history
SLD: remove file schema from OnlineResource tag's path
  • Loading branch information
brushtyler committed Jan 25, 2014
1 parent b399c1e commit ce34641
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions src/core/symbology-ng/qgssymbollayerv2utils.cpp
Expand Up @@ -2301,18 +2301,11 @@ 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() );
}

// get resource url or relative path
QString url = symbolPathToName( path );
QDomElement onlineResourceElem = doc.createElement( "se:OnlineResource" );
onlineResourceElem.setAttribute( "xlink:type", "simple" );
onlineResourceElem.setAttribute( "xlink:href", url.toString() );
onlineResourceElem.setAttribute( "xlink:href", url );
element.appendChild( onlineResourceElem );

QDomElement formatElem = doc.createElement( "se:Format" );
Expand Down Expand Up @@ -2945,7 +2938,7 @@ QString QgsSymbolLayerV2Utils::symbolPathToName( QString path )

if ( !dir.isEmpty() && path.startsWith( dir ) )
{
path = path.mid( dir.size() );
path = path.mid( dir.size() + 1 );
isInSvgPathes = true;
break;
}
Expand Down

0 comments on commit ce34641

Please sign in to comment.