#include <StationCoordinates.h>
Public Member Functions | |
bool | init (SubSignalPool *subPool) |
Point | lookup (Signal *sig, bool &ok) |
void | setReadOnly (bool ro) |
StationCoordinates (QWidget *parent=0, Qt::WFlags fl=0) | |
~StationCoordinates () | |
Protected Member Functions | |
bool | addStation (QString name, Point coord, bool force) |
virtual Point | coordinates (Signal *sig) |
virtual QString | keyName (Signal *sig) |
Protected Attributes | |
QList< NamedPoint > | _stations |
StationCoordinates::StationCoordinates | ( | QWidget * | parent = 0 , |
Qt::WFlags | fl = 0 |
||
) |
References _stations, GeopsyGui::StationCoordinatesItem::setStations(), and TRACE.
: Dialog(parent, fl) { TRACE; setupUi(this); StationCoordinatesItem * model=new StationCoordinatesItem(this); model->setStations(&_stations); stationTable->setModel(model); stationTable->setItemDelegate(new StationCoordinatesDelegate(this) ); stationTable->setSelectionBehavior(QAbstractItemView::SelectRows); stationTable->setSelectionMode(QAbstractItemView::ExtendedSelection); stationTable->setEditTriggers(QAbstractItemView::AllEditTriggers); _map=0; }
bool StationCoordinates::addStation | ( | QString | name, |
Point | coord, | ||
bool | force | ||
) | [protected] |
Add a new station if name does not exist in current list, else modify station named name. If force is true and name exists in current list, the station named name is not modified, but a newone is added. In this last case addStation() return true.
References _stations, QGpCoreTools::NamedPoint::setName(), and TRACE.
Referenced by init().
{ TRACE; NamedPoint * st; QMap<QString, int>::iterator it=_map->find(name); bool ret; if(it!=_map->end()) { st=&_stations[it.value()]; if(force && coord!=*st) { _stations.append(NamedPoint()); st=&_stations.last(); st->setName(name); ret=true; } else { ret=false; } } else { _stations.append(NamedPoint()); st=&_stations.last(); st->setName(name); _map->insert(name, _map->count()); ret=false; } *st=coord; return ret; }
virtual Point StationCoordinates::coordinates | ( | Signal * | sig | ) | [inline, protected, virtual] |
Reimplemented in SourceCoordinates.
References GeopsyCore::Signal::receiver().
Referenced by init().
{return sig->receiver();}
bool StationCoordinates::init | ( | SubSignalPool * | subPool | ) |
Return true if two stations have the same names
Reimplemented in SourceCoordinates.
References _stations, addStation(), GeopsyCore::SubSignalPool::begin(), coordinates(), GeopsyCore::SubSignalPool::end(), keyName(), and TRACE.
Referenced by GeopsyMainWindow::setReceivers().
{ TRACE; _stations.clear(); bool doubleNames=false; beginMap(); for(SubSignalPool::iterator it=subPool->begin(); it!= subPool->end(); it++ ) { QString key=keyName( *it); if(addStation( keyName( *it), coordinates(*it), true) ) { doubleNames=true; } } endMap(); refreshStationList(); return doubleNames; }
virtual QString StationCoordinates::keyName | ( | Signal * | sig | ) | [inline, protected, virtual] |
Reimplemented in SourceCoordinates.
References GeopsyCore::Signal::name().
Referenced by init(), and lookup().
{return sig->name();}
Point StationCoordinates::lookup | ( | Signal * | sig, |
bool & | ok | ||
) |
References _stations, keyName(), and TRACE.
Referenced by GeopsyMainWindow::setReceivers(), and GeopsyMainWindow::setSources().
void StationCoordinates::setReadOnly | ( | bool | ro | ) | [inline] |
Referenced by GeopsyMainWindow::setReceivers().
{buttonOk->setEnabled(!ro);}
QList<NamedPoint> StationCoordinates::_stations [protected] |
Referenced by addStation(), init(), lookup(), and StationCoordinates().