void SetFixNodeStateExecutor::execute_server() {
    int id;
    bool state;

    *stream >> id >> state;

    Data::Graph * currentGraph = Manager::GraphManager::getInstance()->getActiveGraph();
    QMap<qlonglong, osg::ref_ptr<Data::Node> >* nodes = currentGraph -> getNodes();
    if (nodes->contains(id)) {
        this->SetFixNodeState(*nodes->find(id), state);
    } else {
        QMap<qlonglong, osg::ref_ptr<Data::Node> >* mergeNodes = currentGraph->getMetaNodes();
        if (mergeNodes->contains(id)) {
            this->SetFixNodeState(*mergeNodes->find(id),state);
        }
    }

    Server * server = Server::getInstance();
    server->sendFixNodeState(id, state);

    if (((QOSG::CoreWindow *)server->getCoreWindowReference())->playing()) {
        server->getLayoutThread()->play();
    }

}
void SetFixNodeStateExecutor::execute_client() {
    int id;
    bool state;

    *stream >> id >> state;


    Data::Graph * currentGraph = Manager::GraphManager::getInstance()->getActiveGraph();
    QMap<qlonglong, osg::ref_ptr<Data::Node> >* nodes = currentGraph -> getNodes();
    Client * client = Client::getInstance();
    if (nodes->contains(id)) {
        Data::Node * node = *nodes->find(id);
        this->SetFixNodeState(node, state);
        if (client->selected_nodes.contains(node)) {
            client->selected_nodes.removeOne(node);
        }
    } else {
        QMap<qlonglong, osg::ref_ptr<Data::Node> >* mergeNodes = currentGraph->getMetaNodes();
        if (mergeNodes->contains(id)) {
            Data::Node * node = *mergeNodes->find(id);
            this->SetFixNodeState(node,state);
            if (client->selected_nodes.contains(node)) {
                client->selected_nodes.removeOne(node);
            }
        }
    }

}
示例#3
0
void MoveNodeExecutor::execute_client() {

    int id;
    float x,y,z;

    *stream >> id >> x >> y >> z;

    Data::Graph * currentGraph = Manager::GraphManager::getInstance()->getActiveGraph();
    QMap<qlonglong, osg::ref_ptr<Data::Node> >* nodes = currentGraph -> getNodes();
    //qDebug() << "Moving" << id << "to" << x << y << z;
    if (nodes->contains(id)) {
        this->moveNode(*nodes->find(id), osg::Vec3(x,y,z));
    } else {
        QMap<qlonglong, osg::ref_ptr<Data::Node> >* mergeNodes = currentGraph->getMetaNodes();
        if (mergeNodes->contains(id)) {
            this->moveNode(*mergeNodes->find(id), osg::Vec3(x,y,z));
        } else {
            qDebug() << "Nepoznam uzol" << id;
        }
    }

    //TODO: refactor
    // Stupid way to fix restriction shape refreshing
    ((QOSG::CoreWindow *)Client::getInstance()->getCoreWindowReference())->getLayoutThread()->pause();
    ((QOSG::CoreWindow *)Client::getInstance()->getCoreWindowReference())->getLayoutThread()->play();
}