Skip to content

Commit

Permalink
ogr feature style for simple marker
Browse files Browse the repository at this point in the history
  • Loading branch information
mhugent committed Dec 18, 2012
1 parent 3fba12f commit 307c49c
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 0 deletions.
60 changes: 60 additions & 0 deletions src/core/symbology-ng/qgsmarkersymbollayerv2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,66 @@ void QgsSimpleMarkerSymbolLayerV2::writeSldMarker( QDomDocument &doc, QDomElemen
QgsSymbolLayerV2Utils::createDisplacementElement( doc, graphicElem, mOffset );
}

QString QgsSimpleMarkerSymbolLayerV2::ogrFeatureStyle() const
{
#if 0
QString ogrType = "3"; //default is circle
if ( mName == "square" )
{
ogrType = "5";
}
else if ( mName == "triangle" )
{
ogrType = "7";
}
else if ( mName == "star" )
{
ogrType = "9";
}
else if ( mName == "circle" )
{
ogrType = "3";
}
else if ( mName == "cross" )
{
ogrType = "0";
}
else if ( mName == "x" || mName == "cross2" )
{
ogrType = "1";
}
else if ( mName == "line" )
{
ogrType = "10";
}

QString ogrString;
ogrString.append( "SYMBOL(" );
ogrString.append( "id:" );
ogrString.append( "\"" );
ogrString.append( "ogr-sym-" );
ogrString.append( ogrType );
ogrString.append( "\"" );
ogrString.append( ",c:" );
ogrString.append( mColor.name() );
ogrString.append( ",o:" );
ogrString.append( mBorderColor.name() );
ogrString.append( QString( ",s:%1mm" ).arg( mSize ) );
ogrString.append( ")" );
return ogrString;
#endif //0

QString ogrString;
ogrString.append( "PEN(" );
ogrString.append( "c:" );
ogrString.append( mColor.name() );
ogrString.append( ",w:" );
ogrString.append( QString::number( mSize ) );
ogrString.append( "mm" );
ogrString.append( ")" );
return ogrString;
}

QgsSymbolLayerV2* QgsSimpleMarkerSymbolLayerV2::createFromSld( QDomElement &element )
{
QgsDebugMsg( "Entered." );
Expand Down
2 changes: 2 additions & 0 deletions src/core/symbology-ng/qgsmarkersymbollayerv2.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ class CORE_EXPORT QgsSimpleMarkerSymbolLayerV2 : public QgsMarkerSymbolLayerV2

void writeSldMarker( QDomDocument &doc, QDomElement &element, QgsStringMap props ) const;

QString ogrFeatureStyle() const;

QString name() const { return mName; }
void setName( QString name ) { mName = name; }

Expand Down

0 comments on commit 307c49c

Please sign in to comment.