Skip to content
Permalink
Browse files

remove leading dir separator from symbol path when it's relative,

SLD: remove file schema from OnlineResource tag's path
  • Loading branch information
brushtyler committed Jan 25, 2014
1 parent b399c1e commit ce346419e1cb72f44f09e6382f8e44203a50ba21
Showing with 4 additions and 11 deletions.
  1. +4 −11 src/core/symbology-ng/qgssymbollayerv2utils.cpp
@@ -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" );
@@ -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;
}

0 comments on commit ce34641

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