selection.cpp
author insilmaril
Tue, 05 Sep 2006 10:03:29 +0000
changeset 369 1f6263d403a0
parent 16 41c3d7f9f532
child 421 5522d1da7e37
permissions -rw-r--r--
Moved qt4-port branch to head
     1 #include "selection.h"
     2 
     3 
     4 Selection::Selection()
     5 {
     6 }
     7 
     8 Selection::~Selection()
     9 {
    10 }
    11 
    12 void Selection::setMapCenter(MapCenterObj *mco)
    13 {
    14 	mapCenter=mco;
    15 }
    16 
    17 void Selection::copy(const Selection &other)
    18 {
    19 	mapCenter=other.mapCenter;
    20 	selectList=other.selectList;
    21 }
    22 
    23 void Selection::clear()
    24 {
    25 	selectList.clear();
    26 }
    27 
    28 bool Selection::select(LinkableMapObj *lmo)
    29 {
    30 	clear();
    31 	selectList.append (lmo);
    32 	return false;
    33 }
    34 
    35 bool Selection::select (const QString &s)
    36 {
    37 	LinkableMapObj *lmo=mapCenter->findObjBySelect(s);
    38 
    39 	// Finally select the found object
    40 	if (lmo)
    41 	{
    42 		clear();
    43 		select (lmo);
    44 		return true;
    45 	} 
    46 	return false;
    47 
    48 }
    49 
    50 void Selection::unselect()
    51 {
    52 	clear();
    53 }
    54 
    55 bool Selection::isEmpty()
    56 {
    57 	return selectList.isEmpty();
    58 }
    59 
    60 uint Selection::count()
    61 {
    62 	return selectList.count();
    63 }
    64 
    65 QString Selection::getSelectString()
    66 {
    67 	// TODO multiselection (maybe separated by ";")
    68 	if (selectList.count()==1)
    69 		return selectList.first()->getSelectString();
    70 	else
    71 		return"";
    72 }
    73 
    74