Skip to content

Commit

Permalink
Set text color and show label boxes for debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
mhugent committed Jan 17, 2014
1 parent a7a942c commit 82acf76
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/core/dxf/qgsdxfexport.cpp
Expand Up @@ -871,11 +871,11 @@ void QgsDxfExport::writeCircle( const QString& layer, int color, const QgsPoint&
writeGroup( 40, radius );
}

void QgsDxfExport::writeText( const QString& layer, const QString& text, const QgsPoint& pt, double size, double angle )
void QgsDxfExport::writeText( const QString& layer, const QString& text, const QgsPoint& pt, double size, double angle, int color )
{
writeGroup( 0, "TEXT" );
writeGroup( 8, layer );
//todo: color with code 64
writeGroup( 62, color );
writeGroup( 10, pt.x() );
writeGroup( 20, pt.y() );
writeGroup( 30, 0 );
Expand Down
2 changes: 1 addition & 1 deletion src/core/dxf/qgsdxfexport.h
Expand Up @@ -83,7 +83,7 @@ class CORE_EXPORT QgsDxfExport

void writeCircle( const QString& layer, int color, const QgsPoint& pt, double radius );

void writeText( const QString& layer, const QString& text, const QgsPoint& pt, double size, double angle );
void writeText( const QString& layer, const QString& text, const QgsPoint& pt, double size, double angle, int color );

static double mapUnitScaleFactor( double scaleDenominator, QgsSymbolV2::OutputUnit symbolUnits, QGis::UnitType mapUnits );

Expand Down
10 changes: 9 additions & 1 deletion src/core/dxf/qgsdxfpallabeling.cpp
Expand Up @@ -70,6 +70,14 @@ void QgsDxfPalLabeling::drawLabel( pal::LabelPosition* label, QgsRenderContext&
//angle
double angle = label->getAlpha() * 180 / M_PI;

mDxfExport->writeText( layerName, text, QgsPoint( label->getX(), label->getY() ), label->getHeight(), angle );
//debug: show label rectangle
/*QgsPolyline line;
for( int i = 0; i < 4; ++i )
{
line.append( QgsPoint( label->getX( i ), label->getY( i ) ) );
}
mDxfExport->writePolyline( line, layerName, "CONTINUOUS", 0, 1, true );*/

mDxfExport->writeText( layerName, text, QgsPoint( label->getX(), label->getY() ), label->getHeight(), angle, mDxfExport->closestColorMatch( tmpLyr.textColor.rgb() ) );
}
}

0 comments on commit 82acf76

Please sign in to comment.