Created
March 20, 2013 13:32
-
-
Save TNick/5204656 to your computer and use it in GitHub Desktop.
DRW_Text::parseDwg
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bool DRW_Text::parseDwg(DRW::Version version, dwgBuffer *buf){ | |
bool ret = DRW_Entity::parseDwg(version, buf); | |
if (!ret) | |
return ret; | |
DBG("\n***************************** parsing text *********************************************\n"); | |
if (version < DRW::AC1015) {//14- | |
basePoint.z = buf->getBitDouble(); /* Elevation BD --- */ | |
basePoint.x = buf->getBitDouble(); /* Insertion pt 2RD 10 */ | |
basePoint.y = buf->getBitDouble(); | |
extPoint.x = buf->getBitDouble(); /* Alignment pt 2RD 11 */ | |
extPoint.y = buf->getBitDouble(); | |
extrusionPoint.x = buf->getBitDouble(); /* Extrusion 3BD 210 */ | |
extrusionPoint.y = buf->getBitDouble(); | |
extrusionPoint.z = buf->getBitDouble(); | |
thickness = buf->getBitDouble(); /* Thickness BD 39 */ | |
oblique = buf->getBitDouble(); /* Oblique ang BD 51 */ | |
angle = buf->getBitDouble(); /* Rotation ang BD 50 */ | |
height = buf->getBitDouble(); /* Height BD 40 */ | |
widthscale = buf->getBitDouble(); /* Width factor BD 41 */ | |
text = buf->getVariableUtf8Text(); /* Text value TV 1 */ | |
textgen = buf->getBitShort(); /* Generation BS 71 */ | |
alignH = (HAlign)buf->getBitShort(); /* Horiz align. BS 72 */ | |
alignV = (VAlign)buf->getBitShort(); /* Vert align. BS 73 */ | |
} | |
if (version > DRW::AC1014) {//2000+ | |
duint8 data_flags = buf->getRawChar8(); /* DataFlags RC Used to determine presence of subsquent data */ | |
if ( data_flags & 0x01 ) | |
{ /* Elevation RD --- present if !(DataFlags & 0x01) */ | |
basePoint.z = buf->getRawDouble(); | |
} | |
basePoint.x = buf->getBitDouble(); /* Insertion pt 2RD 10 */ | |
basePoint.y = buf->getBitDouble(); | |
if ( data_flags & 0x02 ) | |
{ /* Alignment pt 2DD 11 present if !(DataFlags & 0x02), use 10 & 20 values for 2 default values.*/ | |
extPoint.x = buf->getDefaultDouble(basePoint.x); | |
extPoint.y = buf->getDefaultDouble(basePoint.y); | |
} | |
else | |
{ | |
extPoint = basePoint; | |
} | |
/** @todo use getExtrusion() */ | |
extrusionPoint.x = buf->getBitDouble(); /* Extrusion BE 210 */ | |
extrusionPoint.y = buf->getBitDouble(); | |
extrusionPoint.z = buf->getBitDouble(); | |
/** @todo use getThickness() */ | |
thickness = buf->getBitDouble(); /* Thickness BT 39 */ | |
if ( data_flags & 0x04 ) | |
{ /* Oblique ang RD 51 present if !(DataFlags & 0x04) */ | |
oblique = buf->getRawDouble(); | |
} | |
if ( data_flags & 0x08 ) | |
{ /* Rotation ang RD 50 present if !(DataFlags & 0x08) */ | |
angle = buf->getRawDouble(); | |
} | |
height = buf->getRawDouble(); /* Height RD 40 */ | |
if ( data_flags & 0x10 ) | |
{ /* Width factor RD 41 present if !(DataFlags & 0x10) */ | |
widthscale = buf->getRawDouble(); | |
} | |
text = buf->getVariableUtf8Text(); /* Text value TV 1 */ | |
if ( data_flags & 0x20 ) | |
{ /* Generation BS 71 present if !(DataFlags & 0x20) */ | |
textgen = buf->getBitShort(); | |
} | |
if ( data_flags & 0x40 ) | |
{ /* Horiz align. BS 72 present if !(DataFlags & 0x40) */ | |
alignH = buf->getBitShort(); | |
} | |
if ( data_flags & 0x80 ) | |
{ /* Vert align. BS 73 present if !(DataFlags & 0x80) */ | |
alignV = buf->getBitShort(); | |
} | |
} | |
/* Common Entity Handle Data */ | |
ret = DRW_Entity::parseDwgEntHandle(version, buf); | |
if (!ret) | |
return ret; | |
/** @todo H 7 STYLE (hard pointer) */ | |
/* CRC X --- */ | |
return buf->isGood(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
line 9 and 10 are 2RD not BD dxf codes 10 & 20
lines 11 & 12 are 2RD not BD dxf codes 11 & 21 DRW_Text::secPoint
lines 13, 14 & 15 are extrusion dxf codes 210,220 & 230 in DRW_Text::extPoint
buf->getBitDouble = BD
buf->getRawDouble = RD
see class dwgBuffer dwgbuffer.cpp #101