diff -r 7a96bd401351 -r bc23a0157a39 selection.cpp --- a/selection.cpp Sun Jan 30 12:58:47 2005 +0000 +++ b/selection.cpp Fri Dec 29 13:52:17 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""; +} + +