diff -r 699f28529079 -r 41c3d7f9f532 selection.cpp --- a/selection.cpp Tue Aug 15 12:01:14 2006 +0000 +++ b/selection.cpp Tue Aug 29 08:31:42 2006 +0000 @@ -5,21 +5,19 @@ { } -Selection::Selection(const Selection &other) -{ -} - Selection::~Selection() { } -void Selection::init() +void Selection::setMapCenter(MapCenterObj *mco) { - selectList.setAutoDelete(true); + mapCenter=mco; } void Selection::copy(const Selection &other) { + mapCenter=other.mapCenter; + selectList=other.selectList; } void Selection::clear() @@ -29,11 +27,29 @@ bool Selection::select(LinkableMapObj *lmo) { + clear(); + selectList.append (lmo); return false; } -void Selection::unselect(LinkableMapObj *lmo) +bool Selection::select (const QString &s) { + LinkableMapObj *lmo=mapCenter->findObjBySelect(s); + + // Finally select the found object + if (lmo) + { + clear(); + select (lmo); + return true; + } + return false; + +} + +void Selection::unselect() +{ + clear(); } bool Selection::isEmpty() @@ -45,3 +61,14 @@ { return selectList.count(); } + +QString Selection::getSelectString() +{ + // TODO multiselection (maybe separated by ";") + if (selectList.count()==1) + return selectList.first()->getSelectString(); + else + return""; +} + +