[Marble-devel] Problem in adding Bookmark in Folder in GeoDataDocument
gaurav gupta
1989.gaurav at googlemail.com
Mon Jun 14 22:16:49 CEST 2010
Hello Devels,
I am inserting a bookmark in a folder with name folderName which is stored
in GeoDataDocument inside BookmarkManager class(submitted a patch to
reviewboard). Please suggest me how can I do that.
I tried it with the following approach but I realized that it have some
really big bugs. In my approach I used folders() function of
GeoDataContainer which will return a QVector having all the folders. Then I
compared with the name and when it matched append bookmark( which is
GeoDataPlacemark ) in the folder.
wrote following code for that :
void BookmarkManager::addBookmark( const GeoDataPlacemark &bookmark, const
QString &folderName )
{
QVector<GeoDataFolder> bookmarkFolders = folders();
QVector<GeoDataFolder>::const_iterator i = bookmarkFolders.constBegin();
QVector<GeoDataFolder>::const_iterator end = bookmarkFolders.constEnd();
for (; i != end; ++i ) {
//Folder found where bookmark should be inserted
if( !folderName.compare( i->name() ) ){
// i->append(bookmark); uncommenting gives compiler error
break;
}
}
}
QVector<GeoDataFolder> BookmarkManager::folders() const
{
return d->m_bookmarkDocument->folders();
}
The problem I see is folders() function creates a local copy of QVector and
return that. so adding bookmark to that folder might not work since it is
local copy. So please tell me what should I do and why I am getting compiler
error when I uncomment the line.
The one way I can think of is declare m_vector as a QVector having pointer
to GeoDataFeature ( QVector<GeoDataFeature*> m_vector ) so I can add more
child nodes ( like placemarks in folders ) from outside and the changes can
be reflected in document. Please suggest me and let me know if I'm not clear
with my problem.
Thanks,
Gaurav Gupta
Final Year Undergraduate
IT BHU
GSOC 10 KDE marble
Email : 1989.gaurav at gmail.com
gaurav.gupta at acm.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/marble-devel/attachments/20100615/e0a47bb9/attachment.htm
More information about the Marble-devel
mailing list