Hi,
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.
My code :
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool CBcgtDoc::CreateDefaultStyle(CString strTlbPath, int nType)
{
OGRStyleTable oStyleTable;
OGRStyleMgr *poStyleMgr = new OGRStyleMgr(&oStyleTable);
bool res;
switch(nType)
{
case 1: //point
{
res = poStyleMgr->AddStyle("@symbol",
"SYMBOL(c:#00FF00,id:\"swS0\",s:1.0,l:1)");
res = poStyleMgr->AddStyle("@label", "LABEL(c:#FFFF00,f:\"MS
Gothic\",s:10px,t:\"\",l:1)");
res = oStyleTable.SaveStyleTable(strTlbPath);
}
break;
case 2: //line
{
res = poStyleMgr->AddStyle("@symbol",
"SYMBOL(c:#00FF00,id:\"swS0\",s:1.0,l:1)");//
res = poStyleMgr->AddStyle("@label", "LABEL(c:#0000FF,f:\"MS
Gothic\",s:10px,t:\"\",l:1)");//
res = poStyleMgr->AddStyle("@line",
"PEN(c:#FF0000,w:3px,id:\"swL0\",l:1)");//
res = oStyleTable.SaveStyleTable(strTlbPath);
}
break;
case 3: //polygon
{
res = poStyleMgr->AddStyle("@symbol",
"SYMBOL(c:#00FF00,id:\"swS0\",s:1.0,l:1)");
res = poStyleMgr->AddStyle("@label", "LABEL(c:#FF0000,f:\"MS
Gothic\",s:10px,t:\"\",l:1)");
res = poStyleMgr->AddStyle("@line",
"PEN(c:#FF0000,w:3px,id:\"swL0\",l:1)");
res = poStyleMgr->AddStyle("@brush",
"BRUSH(fc:#C0C0C0,id:\"swR0\")");
res = oStyleTable.SaveStyleTable(strTlbPath);
}
break;
default:
break;
}
if(poStyleMgr)
{
delete poStyleMgr;
poStyleMgr = NULL;
}
if(!res)
{
return false;
}
return true;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Thank you.
------------------
To the world you're little, but to a person you're the world.
Chen Xuexia_______________________________________________
gdal-dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/gdal-dev