-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added DXF style attribute of TEXT and MTEXT to OGR style string #198
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -478,6 +478,7 @@ OGRFeature *OGRDXFLayer::TranslateMTEXT() | |
bool bHaveZ = false; | ||
int nAttachmentPoint = -1; | ||
CPLString osText; | ||
CPLString styleName; | ||
|
||
while( (nCode = poDS->ReadValue(szLineBuf,sizeof(szLineBuf))) > 0 ) | ||
{ | ||
|
@@ -524,6 +525,10 @@ OGRFeature *OGRDXFLayer::TranslateMTEXT() | |
dfAngle = CPLAtof(szLineBuf); | ||
break; | ||
|
||
case 7: | ||
styleName = TextUnescape(szLineBuf); | ||
break; | ||
|
||
default: | ||
TranslateGenericProperty( poFeature, nCode, szLineBuf ); | ||
break; | ||
|
@@ -595,8 +600,13 @@ OGRFeature *OGRDXFLayer::TranslateMTEXT() | |
/* -------------------------------------------------------------------- */ | ||
CPLString osStyle; | ||
char szBuffer[64]; | ||
|
||
if (styleName == "") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. replace that by initialization to "Arial" at declaration time There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed. Removed if and changed to setting at declaration time. |
||
{ | ||
styleName = "Arial"; | ||
} | ||
|
||
osStyle.Printf("LABEL(f:\"Arial\",t:\"%s\"",osText.c_str()); | ||
osStyle.Printf("LABEL(f:\"%s\",t:\"%s\"", styleName.c_str(), osText.c_str()); | ||
|
||
if( dfAngle != 0.0 ) | ||
{ | ||
|
@@ -652,6 +662,7 @@ OGRFeature *OGRDXFLayer::TranslateTEXT() | |
double dfAngle = 0.0; | ||
double dfHeight = 0.0; | ||
CPLString osText; | ||
CPLString styleName; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. naming convention: use osStyleName There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed |
||
bool bHaveZ = false; | ||
int nAnchorPosition = 1; | ||
int nHorizontalAlignment = 0; | ||
|
@@ -695,6 +706,10 @@ OGRFeature *OGRDXFLayer::TranslateTEXT() | |
nVerticalAlignment = atoi(szLineBuf); | ||
break; | ||
|
||
case 7: | ||
styleName = TextUnescape(szLineBuf); | ||
break; | ||
|
||
default: | ||
TranslateGenericProperty( poFeature, nCode, szLineBuf ); | ||
break; | ||
|
@@ -804,8 +819,13 @@ OGRFeature *OGRDXFLayer::TranslateTEXT() | |
CPLString osStyle; | ||
char szBuffer[64]; | ||
|
||
osStyle.Printf("LABEL(f:\"Arial\",t:\"%s\"",osText.c_str()); | ||
if (styleName == "") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. replace that by initialization to "Arial" at declaration time There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed. Removed if and changed to setting at declaration time. |
||
{ | ||
styleName = "Arial"; | ||
} | ||
|
||
osStyle.Printf("LABEL(f:\"%s\",t:\"%s\"", styleName.c_str(), osText.c_str()); | ||
|
||
osStyle += CPLString().Printf(",p:%d", nAnchorPosition); | ||
|
||
if( dfAngle != 0.0 ) | ||
|
@@ -2534,4 +2554,4 @@ int OGRDXFLayer::TestCapability( const char * pszCap ) | |
|
||
{ | ||
return EQUAL(pszCap, OLCStringsAsUTF8); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
naming convention: use osStyleName
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed