[gdal-dev] OGRFeatureStyle update from version1.4.1 to 1.5.2;
wow
27949218 at qq.com
Mon Aug 18 21:33:14 EDT 2008
Frank, this is my example for you to test the ver1.5.2 OGRFeatureStyle.cpp. Thank you.
//-------------------------------CODE----------------------------------------------------------
bool CreateDefaultStyle("shpcreate\\1.tbl", 2);
void main()
{
bool res = CreateDefaultStyle("shpcreate\\1.tbl", 2);
}
bool 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;
}
//--------------------------------END----------------------------------------------------------
------------------
To the world you're little, but to a person you're the world.
Chen Xuexia
------------------ Original ------------------
From: "wow"<27949218 at qq.com>;
Date: Tue, Aug 19, 2008 09:13 AM
To: "Frank Warmerdam"<warmerdam at pobox.com>;
Cc: "gdal-dev"<gdal-dev at lists.osgeo.org>;
Subject: Re: [gdal-dev] OGRFeatureStyle update from version1.4.1 to 1.5.2;
Hi, Frank, welcome to China. I'd like to see you in Beijing, i'm sure that you're the joss of many young students, hehe.
I have found the reason why failed to deal styles with ver1.5.2. Compared with ver1.4.1, CPLSPrintf() is replaced the CPLString().Printf() , and i could trace the error to CPLString().Printf() every time debug. It might not allocate memory for the dest string in CPLString().Printf(). Of cource, if i still use CPLSPrintf(), no error occurs. Is this a bug in whole OGRFeatureStyle.cpp in ver1.5.2?
------------------
To the world you're little, but to a person you're the world.
Chen Xuexia
------------------ Original ------------------
From: "Frank Warmerdam"<warmerdam at pobox.com>;
Date: Mon, Aug 18, 2008 11:12 PM
To: "wow"<27949218 at qq.com>;
Cc: "gdal-dev"<gdal-dev at lists.osgeo.org>;
Subject: Re: [gdal-dev] OGRFeatureStyle update from version1.4.1 to 1.5.2;
On 8/17/08, wow <27949218 at qq.com> wrote:
> 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 :
Chen,
There has been some work on the style string parser since 1.4 and
I suspect it has been subtly broken for your case in some fashion.
Could you file a ticket? Make sure you provide any additional
details we might need, like the format you are trying to write to.
Ideally a single small self contained program demonstrating the
problem would be best.
Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush | Geospatial Programmer for Rent
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20080819/3aa10c22/attachment-0001.html
More information about the gdal-dev
mailing list