Beispiel #1
0
AbstractNode* OsgCluster::uncluster(bool returnResult) {
	if (isClustering())
		return this;
	bool expand = isExpanded();
	if (nodeCluster->unclusterChildren()) {
		setVisible(false);
		OsgNodeGroup* unclusterGroup = NULL;
		if (returnResult)
			unclusterGroup = new OsgNodeGroup();
		QSetIterator<Model::Node*> nodeIt = nodeCluster->getChildrenIterator();
		while (nodeIt.hasNext()) {
			OsgNode* child = nodeIt.next()->getOsgNode();
			child->setVisible(true);
			child->updatePosition();
			if (returnResult)
				unclusterGroup->addNode(child, false, false);
			child->setExpanded(expand);
		}
		if (returnResult)
			unclusterGroup->updateSizeAndPos();
		return unclusterGroup;
	} else {
		return this;
	}
}
Beispiel #2
0
AbstractNode* OsgCluster::cluster() {
	if (isClustering())
		return NULL;
	bool expand = false;
	if (nodeCluster->clusterChildren()) {
		QSetIterator<Model::Node*> nodeIt = nodeCluster->getChildrenIterator();
		while (nodeIt.hasNext()) {
			OsgNode* child = nodeIt.next()->getOsgNode();
			child->setMovingToCluster(true);
			child->setPickable(false);
			expand = expand || child->isExpanded();
			child->setDimmed(true);
			childrenMovingIn++;
		}
		setExpanded(expand);
		return this;
	} else {
		return NULL;
	}
}
Beispiel #3
0
// Reconstruct the area exit data in a format that actually makes sense - only
// needed until the TRoom & TArea classes can be restructured to store exits
// using the exit direction as a key and the to room as a value instead of vice-versa
const QMultiMap<int, QPair<QString, int>> TArea::getAreaExitRoomData() const
{
    QMultiMap<int, QPair<QString, int>> results;
    QSet<int> roomsWithOtherAreaSpecialExits;

    QMapIterator<int, QPair<int, int>> itAreaExit = exits;
    // First parse the normal exits and also find the rooms where there is at
    // least one special area exit
    while (itAreaExit.hasNext()) {
        itAreaExit.next();
        QPair<QString, int> exitData;
        exitData.second = itAreaExit.value().first;
        switch (itAreaExit.value().second) {
        case DIR_NORTH:     exitData.first = QString("north");                         break;
        case DIR_NORTHEAST: exitData.first = QString("northeast");                     break;
        case DIR_NORTHWEST: exitData.first = QString("northwest");                     break;
        case DIR_SOUTH:     exitData.first = QString("south");                         break;
        case DIR_WEST:      exitData.first = QString("west");                          break;
        case DIR_EAST:      exitData.first = QString("east");                          break;
        case DIR_SOUTHEAST: exitData.first = QString("southeast");                     break;
        case DIR_SOUTHWEST: exitData.first = QString("southwest");                     break;
        case DIR_UP:        exitData.first = QString("up");                            break;
        case DIR_DOWN:      exitData.first = QString("down");                          break;
        case DIR_IN:        exitData.first = QString("in");                            break;
        case DIR_OUT:       exitData.first = QString("out");                           break;
        case DIR_OTHER:     roomsWithOtherAreaSpecialExits.insert(itAreaExit.key());   break;
        default:
            qWarning("TArea::getAreaExitRoomData() Warning: unrecognised exit code %i found for exit from room %i to room %i.",
                     itAreaExit.value().second, itAreaExit.key(), itAreaExit.value().first);
        }
        if (!exitData.first.isEmpty()) {
            results.insert(itAreaExit.key(), exitData);
        }
    }
    // Now have to find the special area exits in the rooms where we know there
    // IS one
    QSetIterator<int> itRoomWithOtherAreaSpecialExit = roomsWithOtherAreaSpecialExits;
    while (itRoomWithOtherAreaSpecialExit.hasNext()) {
        int fromRoomId = itRoomWithOtherAreaSpecialExit.next();
        TRoom* pFromRoom = mpRoomDB->getRoom(fromRoomId);
        if (pFromRoom) {
            QMapIterator<int, QString> itOtherExit = pFromRoom->getOtherMap();
            while (itOtherExit.hasNext()) {
                itOtherExit.next();
                QPair<QString, int> exitData;
                exitData.second = itOtherExit.key();
                TRoom* pToRoom = mpRoomDB->getRoom(exitData.second);
                if (pToRoom && mpRoomDB->getArea(pToRoom->getArea()) != this) {
                    // Note that pToRoom->getArea() is misnamed, should be getAreaId() !
                    if (itOtherExit.value().mid(0, 1) == QStringLiteral("0") || itOtherExit.value().mid(0, 1) == QStringLiteral("1")) {
                        exitData.first = itOtherExit.value().mid(1);
                    } else {
                        exitData.first = itOtherExit.value();
                    }
                    if (!exitData.first.isEmpty()) {
                        results.insert(fromRoomId, exitData);
                    }
                }
            }
        }
    }
    return results;
}
void FahrtagWindow::loadData()
{
    if (nehme) {
        nehme = false;
        // Allgemeine Daten von AActivity
        ui->dateDate->setDate(fahrtag->getDatum());
        ui->textAnlass->clear();
        ui->textAnlass->insertPlainText(fahrtag->getAnlass());
        ui->timeEnde->setTime(fahrtag->getZeitEnde());
        ui->checkBoxBenoetigt->setChecked(fahrtag->getPersonalBenoetigt());

        // Daten von Manager_Reservierungen
        ui->comboWagenreihung->setCurrentText(fahrtag->getWagenreihung());
        QSetIterator<Reservierung*> iter = fahrtag->getReservierungen();
        while(iter.hasNext()) {
            Reservierung *r = iter.next();
            QListWidgetItem *item = new QListWidgetItem(r->getName());
            resToItem->insert(r, item);
            itemToRes->insert(item, r);
            ui->listRes->insertItem(0, item);
        }
        ui->listRes->sortItems();
        ui->checkBoxAll->setEnabled(false);
        ui->buttonVerteile->setEnabled(Fahrtag::Nikolauszug == fahrtag->getArt());

        ui->checkBoxAll->setChecked(fahrtag->getCheckAll());
        ui->checkBoxAll->setEnabled(fahrtag->getArt() == Fahrtag::Nikolauszug);
        ui->buttonVerteile->setEnabled(fahrtag->getArt() == Fahrtag::Nikolauszug);

        // Daten von Fahrtag
        ui->comboArt->setCurrentIndex((int)fahrtag->getArt());
        ui->comboTimeTfH->setCurrentText(fahrtag->getZeitTf().toString("HH"));
        ui->comboTimeTfM->setCurrentText(fahrtag->getZeitTf().toString("mm"));
        ui->comboTimeZH->setCurrentText(fahrtag->getZeitAnfang().toString("HH"));
        ui->comboTimeZM->setCurrentText(fahrtag->getZeitAnfang().toString("mm"));
        ui->checkWichtig->setChecked(fahrtag->getWichtig());
        ui->checkTf->setChecked(fahrtag->getBenoetigeTf());
        ui->checkZf->setChecked(fahrtag->getBenoetigeZf());
        ui->checkZub->setChecked(fahrtag->getBenoetigeZub());
        ui->checkService->setChecked(fahrtag->getBenoetigeService());

        /* LIstTf, ListZf, ListZub, ListService fehlt noch */
        QMap<Person*, AActivity::Infos*> tf;
        QMap<Person*, AActivity::Infos*> zf;
        QMap<Person*, AActivity::Infos*> zub;
        QMap<Person*, AActivity::Infos*> service;
        QMap<Person*, AActivity::Infos*> sonstige;

        listeMitNamen = new QMap<QListWidgetItem*, QString>();
        listToTable = new QMap<QListWidgetItem*, QTableWidgetItem*>();
        namen = new QSet<QString>();

        // Aufsplitten der Personen auf die Einzelnen Listen
        for(Person *p: fahrtag->getPersonen()->keys()) {
            AActivity::Infos *info = fahrtag->getPersonen()->value(p);

            QListWidgetItem *item;
            if (info->bemerkung == "") {
                item = new QListWidgetItem(p->getName());
            } else {
                item = new QListWidgetItem(p->getName()+"; "+info->bemerkung);
            }
            item->setFlags(Qt::ItemIsSelectable|Qt::ItemIsEditable|Qt::ItemIsEnabled);
            listeMitNamen->insert(item, p->getName());
            namen->insert(p->getName());

            bool block = true;

            switch (fahrtag->getPersonen()->value(p)->kategorie) {
            case AActivity::Tf:
            case AActivity::Tb:
                tf.insert(p, info);
                ui->listTf->insertItem(0, item);
                ui->buttonTfDelete->setEnabled(true);
                break;
            case AActivity::Zf:
                zf.insert(p, info);
                ui->listZf->insertItem(0, item);
                ui->buttonZfDelete->setEnabled(true);
                break;
            case AActivity::Zub:
            case AActivity::Begleiter:
                zub.insert(p, info);
                ui->listZub->insertItem(0, item);
                ui->buttonZubDelete->setEnabled(true);
                break;
            case AActivity::Service:
                service.insert(p, info);
                ui->listService->insertItem(0, item);
                ui->buttonServiceDelete->setEnabled(true);
                break;
            default:
                sonstige.insert(p, info);
                block = false;
                ui->buttonRemove->setEnabled(true);
                break;
            }

            // Zeile für die Person in die Tabelle einfügen
            QString bem = info->bemerkung.toUpper();
            if ( ! (bem.contains("EXTERN") || ((bem.contains("AZUBI") || bem.contains("FS")) && (info->kategorie == AActivity::Tf  || info->kategorie == AActivity::Tb)))) {

                ui->tablePersonen->insertRow(0);

                QTableWidgetItem *zelleName = new QTableWidgetItem(p->getName());
                if (block) zelleName->setFlags(Qt::NoItemFlags);
                ui->tablePersonen->setItem(0,0,zelleName);

                if (info->beginn != QTime(0, 0)) {
                    QTableWidgetItem *zelleBeginn = new QTableWidgetItem(info->beginn.toString("hh:mm"));
                    ui->tablePersonen->setItem(0, 1, zelleBeginn);
                }
                if (info->ende != QTime(0,0)) {
                    QTableWidgetItem *zelleEnde = new QTableWidgetItem(info->ende.toString("hh:mm"));
                    ui->tablePersonen->setItem(0, 2, zelleEnde);
                }
                QTableWidgetItem *zelleAufgabe;
                if (info->aufgabe == "") {
                    zelleAufgabe = new QTableWidgetItem(AActivity::getStringFromCategory(info->kategorie));
                } else {
                    zelleAufgabe = new QTableWidgetItem(info->aufgabe);
                }
                if (block) zelleAufgabe->setFlags(Qt::NoItemFlags);
                ui->tablePersonen->setItem(0, 3, zelleAufgabe);
                listToTable->insert(item, zelleName);
            }
        }
        nehme = true;
    }
}