1.1 --- a/selection.cpp Sun Jan 30 12:58:47 2005 +0000
1.2 +++ b/selection.cpp Fri Dec 29 13:52:17 2006 +0000
1.3 @@ -5,21 +5,19 @@
1.4 {
1.5 }
1.6
1.7 -Selection::Selection(const Selection &other)
1.8 -{
1.9 -}
1.10 -
1.11 Selection::~Selection()
1.12 {
1.13 }
1.14
1.15 -void Selection::init()
1.16 +void Selection::setMapCenter(MapCenterObj *mco)
1.17 {
1.18 - selectList.setAutoDelete(true);
1.19 + mapCenter=mco;
1.20 }
1.21
1.22 void Selection::copy(const Selection &other)
1.23 {
1.24 + mapCenter=other.mapCenter;
1.25 + selectList=other.selectList;
1.26 }
1.27
1.28 void Selection::clear()
1.29 @@ -29,11 +27,29 @@
1.30
1.31 bool Selection::select(LinkableMapObj *lmo)
1.32 {
1.33 + clear();
1.34 + selectList.append (lmo);
1.35 return false;
1.36 }
1.37
1.38 -void Selection::unselect(LinkableMapObj *lmo)
1.39 +bool Selection::select (const QString &s)
1.40 {
1.41 + LinkableMapObj *lmo=mapCenter->findObjBySelect(s);
1.42 +
1.43 + // Finally select the found object
1.44 + if (lmo)
1.45 + {
1.46 + clear();
1.47 + select (lmo);
1.48 + return true;
1.49 + }
1.50 + return false;
1.51 +
1.52 +}
1.53 +
1.54 +void Selection::unselect()
1.55 +{
1.56 + clear();
1.57 }
1.58
1.59 bool Selection::isEmpty()
1.60 @@ -45,3 +61,14 @@
1.61 {
1.62 return selectList.count();
1.63 }
1.64 +
1.65 +QString Selection::getSelectString()
1.66 +{
1.67 + // TODO multiselection (maybe separated by ";")
1.68 + if (selectList.count()==1)
1.69 + return selectList.first()->getSelectString();
1.70 + else
1.71 + return"";
1.72 +}
1.73 +
1.74 +