<DIV>Hi,</DIV>
<DIV> When i tried to update my whole program from ver1.4.1 to 1.5.2, all worked well except the OGRFeatureStyle module. The function OGRStyleMgr::AddStyle() couldn't write the provided style name and style string right with ver1.5.2, but could run smoothly with version 1.4.1. </DIV>
<DIV> My code :</DIV>
<DIV>///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////</DIV>
<DIV>bool CBcgtDoc::CreateDefaultStyle(CString strTlbPath, int nType)<BR>{ <BR> OGRStyleTable oStyleTable;<BR> OGRStyleMgr *poStyleMgr = new OGRStyleMgr(&oStyleTable);<BR> bool res;<BR> switch(nType)<BR> {<BR> case 1: //point</DIV>
<DIV> {<BR> res = poStyleMgr->AddStyle("@symbol", "SYMBOL(c:#00FF00,id:\"swS0\",s:1.0,l:1)");<BR> res = poStyleMgr->AddStyle("@label", "LABEL(c:#FFFF00,f:\"MS Gothic\",s:10px,t:\"\",l:1)");<BR> res = oStyleTable.SaveStyleTable(strTlbPath);<BR> }<BR> break;<BR> case 2: //line</DIV>
<DIV> {<BR> res = poStyleMgr->AddStyle("@symbol", "SYMBOL(c:#00FF00,id:\"swS0\",s:1.0,l:1)");//<BR> res = poStyleMgr->AddStyle("@label", "LABEL(c:#0000FF,f:\"MS Gothic\",s:10px,t:\"\",l:1)");//<BR> res = poStyleMgr->AddStyle("@line", "PEN(c:#FF0000,w:3px,id:\"swL0\",l:1)");//<BR> res = oStyleTable.SaveStyleTable(strTlbPath); <BR> }<BR> break;<BR> case 3: //polygon</DIV>
<DIV> {<BR> res = poStyleMgr->AddStyle("@symbol", "SYMBOL(c:#00FF00,id:\"swS0\",s:1.0,l:1)");<BR> res = poStyleMgr->AddStyle("@label", "LABEL(c:#FF0000,f:\"MS Gothic\",s:10px,t:\"\",l:1)");<BR> res = poStyleMgr->AddStyle("@line", "PEN(c:#FF0000,w:3px,id:\"swL0\",l:1)");<BR> res = poStyleMgr->AddStyle("@brush", "BRUSH(fc:#C0C0C0,id:\"swR0\")");<BR> res = oStyleTable.SaveStyleTable(strTlbPath); <BR> }<BR> break;<BR> default:<BR> break;<BR> }<BR> if(poStyleMgr)<BR> {<BR> delete poStyleMgr;<BR> poStyleMgr = NULL;<BR> }<BR> if(!res)<BR> {<BR> return false;<BR> }<BR> return true;<BR>}</DIV>
<DIV>///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////</DIV>
<DIV> Thank you.</DIV>
<DIV style="FONT-SIZE: 12px; COLOR: #909090; FONT-FAMILY: Arial Narrow">------------------</DIV>
<DIV>
<DIV>To the world you're little, but to a person you're the world.</DIV>
<DIV> Chen Xuexia</DIV></DIV>