[Qgis-developer] multimap object dereferencing in a plugin
maaza mekuria
sailmcm at yahoo.com
Thu May 12 12:53:27 EDT 2011
I have been trying hard to find how to get access to the object I stored in a QMultiMap container. I am able to retrieve the numbered keys but when I try accessing the object QGIS crashes.
I have done similar work in plain C++ and it has worked with out any problem, I used regualr multimap before. Here I tried both QT multimap and regualr multimap and while trying to access the second item in the iterator QGIS seems to give up. Any help will be appreciated. I have pasted a piece of the code below,
typedef QMultiMap<long,QgsPoint> mmaplngQPt;
// QgsPoint map iterator objects
typedef mmaplngQPt::iterator maplngQPtit1, maplngQPtit2;
mmaplngQPt::iterator Pt1Qmapit, Pt2Qmapit,itQlow, itQup;
typedef pair < long, QgsPoint > QPt_pair;
mmaplngPt mapQPt,mapQPt0,mapQPt1;
mmaplngPt::iterator mapQPtit;
long iKey;
int lbx,ubx;
QgsPoint vx;
itQlow=mapQPt.lowerBound (lbX);
itQup=mapQPt.upperBound (ubX);
for ( mapQPtit=itQlow ; mapQPtit != itQup; mapQPtit++ )
{
txtStream <<"key = "<<itQlow.key()<<endl;
iKey = (QPt1mapit).key();
vx = (QPt1mapit).value();
}
The program crashes write after it prints the key value. By the way any way of finding a meaningful error message in QGIS?
Thank you,
Maaza
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/qgis-developer/attachments/20110512/3fd549f1/attachment.html
More information about the Qgis-developer
mailing list