Skip to content

Commit

Permalink
Split multiline labels for dxf export
Browse files Browse the repository at this point in the history
  • Loading branch information
mhugent committed Jan 17, 2014
1 parent 82acf76 commit 78bd89d
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/core/dxf/qgsdxfpallabeling.cpp
Expand Up @@ -76,8 +76,16 @@ void QgsDxfPalLabeling::drawLabel( pal::LabelPosition* label, QgsRenderContext&
{
line.append( QgsPoint( label->getX( i ), label->getY( i ) ) );
}
mDxfExport->writePolyline( line, layerName, "CONTINUOUS", 0, 1, true );*/
mDxfExport->writePolyline( line, layerName, "CONTINUOUS", 1, 0.01, true );*/

mDxfExport->writeText( layerName, text, QgsPoint( label->getX(), label->getY() ), label->getHeight(), angle, mDxfExport->closestColorMatch( tmpLyr.textColor.rgb() ) );
QStringList textList = text.split( "\n" );
double textHeight = label->getHeight() / textList.size();
QFontMetricsF fm( tmpLyr.textFont );
double textAscent = textHeight * fm.ascent() / fm.height();

for ( int i = 0; i < textList.size(); ++i )
{
mDxfExport->writeText( layerName, textList.at( i ), QgsPoint( label->getX(), label->getY() + i * textHeight ), textAscent, angle, mDxfExport->closestColorMatch( tmpLyr.textColor.rgb() ) );
}
}
}

0 comments on commit 78bd89d

Please sign in to comment.