Beispiel #1
0
void MyMoveServer::observeGestures()
{    
    qDebug("MyMoveServer::observeGestures");
    if (m_state == IDLE)
    {
        loadGestures();
        m_state = OBSERVING;
    }
}
Beispiel #2
0
void testApp::guiEvent(ofxUIEventArgs &e)
{
	string name = e.widget->getName();
	int kind = e.widget->getKind();
    
	cout << "got event from: " << name << endl;
	
    // if any paramenter needs to be adjusted,
    // the appropriate gvfhandler method will be called
    
    if(name == "amount of particles")
	{
        cout << nsNumDialer->getValue() << endl;
        gvfh.setNumberOfParticles(nsNumDialer->getValue());
    }
    else if(name == "resampling threshold")
    {
        gvfh.gvf_rt((int) rtNumDialer->getValue());
    }
    else if(name == "smoothing coefficient")
    {
        gvfh.gvf_std(soNumDialer->getValue());
    }
    else if(name == "position" || name == "speed" ||
            name == "scale" || name == "rotation")
    {
        std::vector<float> sigs;
        sigs.push_back(sigPosND->getValue());
        sigs.push_back(sigSpeedND->getValue());
        sigs.push_back(sigScaleND->getValue());
        sigs.push_back(sigRotND->getValue());
        
        gvfh.gvf_adaptspeed(sigs);
    }
    
    // if save or load is requested,
    // the appropriate dialog is shown and the task is carried out
    else if(name == "Save gesture(s)")
    {
        ofxUILabelButton *button = (ofxUILabelButton*) e.widget;
        if(button->getValue() && gvfh.getTemplateCount() > 0)
        {
            ofFileDialogResult dialogResult = ofSystemSaveDialog("my gestures.xml", "Save gestures");
            if(dialogResult.bSuccess)
            {
                saveGestures(dialogResult);
            }
        }
    }
    else if(name == "Load gesture(s)")
    {
        ofxUILabelButton *button = (ofxUILabelButton*) e.widget;
        if(button->getValue())
        {
            ofFileDialogResult dialogResult = ofSystemLoadDialog("Select the xml file containing gesture data");
            if(dialogResult.bSuccess)
            {
                loadGestures(dialogResult);
            }
            
        }
    }
}