8 Selection::~Selection()
12 void Selection::setMapCenter(MapCenterObj *mco)
17 void Selection::copy(const Selection &other)
19 mapCenter=other.mapCenter;
20 selectList=other.selectList;
21 lastSelectList=other.lastSelectList;
24 void Selection::clear()
27 lastSelectList.clear();
30 bool Selection::select(LinkableMapObj *lmo) // TODO no multiselections yet
32 if (!selectList.isEmpty()) unselect();
33 selectList.append (lmo);
38 bool Selection::select (const QString &s) // TODO no multiselections yet
40 LinkableMapObj *lmo=mapCenter->findObjBySelect(s);
42 // Finally select the found object
53 bool Selection::reselect () // TODO no multiselections yet
55 if (!lastSelectList.isEmpty())
57 select (lastSelectList.first());
64 void Selection::unselect()
66 if (!selectList.isEmpty() )
68 for (int i=0; i< selectList.count(); ++i)
69 selectList.at(i)->unselect();
70 lastSelectList=selectList;
75 bool Selection::isEmpty()
77 return selectList.isEmpty();
80 uint Selection::count()
82 return selectList.count();
85 SelectionType Selection::type() // TODO no multiselections yet
87 if (!selectList.isEmpty())
89 LinkableMapObj *sel=selectList.first();
90 if (typeid (*sel)==typeid (BranchObj)) return Branch;
91 if (typeid (*sel)==typeid (MapCenterObj)) return MapCenter;
92 if (typeid (*sel)==typeid (FloatImageObj)) return FloatImage;
97 LinkableMapObj* Selection::first()
99 if (!selectList.isEmpty())
100 return selectList.first();
105 LinkableMapObj* Selection::single()
107 if (selectList.count() == 1)
108 return selectList.first();
113 BranchObj* Selection::getBranch()
115 if (!selectList.isEmpty())
117 LinkableMapObj *sel=selectList.first();
118 if (typeid (*sel)==typeid (BranchObj) ||
119 typeid (*sel)==typeid (MapCenterObj))
120 return (BranchObj*)sel;
125 FloatImageObj* Selection::getFloatImage()
127 if (!selectList.isEmpty())
129 LinkableMapObj *sel=selectList.first();
130 if (typeid (*sel)==typeid (FloatImageObj))
131 return (FloatImageObj*)sel;
136 QString Selection::getSelectString()// TODO no multiselections yet
138 if (selectList.count()==1)
139 return selectList.first()->getSelectString();