查看单个帖子
旧 2009-05-06, 02:39 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】how to get and change an image name

how to get and change an image name
how to get and change an image name
hi there,
i have a raster image in a file. and i want to change the 'image name' and 'saved path'. i already changed the saved path using oddbrasterimagedef::setsourcefilename(myimagefile) . however, i don't know how to change the image name.
does anyone have some sample code to get the change the image name?
thanks!
al
hi,
i may be wrong, but i don't think it's possible to change the name of a raster once it has been inserted in the image dictionary.
a workaround could be to copy the existing oddbrasterimagedef and insert it with another name in the image dictionary. then you have to delete the existing one, and change the rasterdef object id of all referenced raster images.
torsten
raster image name is not stored in rasterimagedef. it's a the name of entry in raster image dictionary.
code:
oddbrasterimagedefptr pimagedef;
// raster image def dictionary
oddbdictionaryptr pdic = pimagedef->ownerid().safeopenobject(oddb::kforwrite);
pdic->setname(pdic->nameat(pimagedef->objectid()), newname);
sergey slezkin
sergey,
that's what i am looking for. thank you for your help.
al

how to set pimagedef?? thanks
quote:
originally posted by sergey slezkin
raster image name is not stored in rasterimagedef. it's a the name of entry in raster image dictionary.
code:
oddbrasterimagedefptr pimagedef;
// raster image def dictionary
oddbdictionaryptr pdic = pimagedef->ownerid().safeopenobject(oddb::kforwrite);
pdic->setname(pdic->nameat(pimagedef->objectid()), newname);
which pimagedef?
given raster image entity use:
oddbrasterimage::imagedefid()
given image name from image dictionary:
oddbdictionary::getat(name)
pointer from id can be obtained using oddbobjectidenobject()
sergey slezkin
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)