Skip to content

Commit

Permalink
dxf import: fix text positions and orientation when importing DXF (fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Dec 23, 2016
1 parent 645f2c8 commit 567f920
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
7 changes: 3 additions & 4 deletions src/app/dwg/libdxfrw/drw_entities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1224,8 +1224,7 @@ void DRW_Insert::parseCode( int code, dxfReader *reader )
zscale = reader->getDouble();
break;
case 50:
angle = reader->getDouble();
angle = angle / ARAD; //convert to radian
angle = reader->getDouble() / ARAD;
break;
case 70:
colcount = reader->getInt32();
Expand Down Expand Up @@ -1590,7 +1589,7 @@ void DRW_Text::parseCode( int code, dxfReader *reader )
widthscale = reader->getDouble();
break;
case 50:
angle = reader->getDouble();
angle = reader->getDouble() / ARAD;
break;
case 51:
oblique = reader->getDouble();
Expand Down Expand Up @@ -1630,7 +1629,7 @@ bool DRW_Text::parseDwg( DRW::Version version, dwgBuffer *buf, duint32 bs )

QgsDebugMsg( "***************************** parsing text *********************************************" );

// DataFlags RC Used to determine presence of subsquent data, set to 0xFF for R14-
// DataFlags RC Used to determine presence of subsequent data, set to 0xFF for R14-
duint8 data_flags = 0x00;
if ( version > DRW::AC1014 ) //2000+
{
Expand Down
6 changes: 4 additions & 2 deletions src/app/dwg/qgsdwgimporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2270,8 +2270,10 @@ void QgsDwgImporter::addText( const DRW_Text &data )

setPoint( dfn, f, "ext", data.extPoint );

QgsPointV2 p( QgsWkbTypes::PointZ, data.secPoint.x, data.secPoint.y, data.secPoint.z );

QgsPointV2 p( QgsWkbTypes::PointZ,
( data.alignH > 0 || data.alignV > 0 ) ? data.secPoint.x : data.basePoint.x,
( data.alignH > 0 || data.alignV > 0 ) ? data.secPoint.y : data.basePoint.y,
( data.alignH > 0 || data.alignV > 0 ) ? data.secPoint.z : data.basePoint.z );

if ( !createFeature( layer, f, p ) )
{
Expand Down

0 comments on commit 567f920

Please sign in to comment.