Ejemplo n.º 1
0
int MainWidget::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QMainWindow::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0:
            loadGraph();
            break;
        case 1:
            saveGraph();
            break;
        case 2:
            saveGraphVrml();
            break;
        case 3:
            setDrawGraph((*reinterpret_cast< bool(*)>(_a[1])));
            break;
        case 4:
            setDrawHirarchy((*reinterpret_cast< bool(*)>(_a[1])));
            break;
        default:
            ;
        }
        _id -= 5;
    }
    return _id;
}
Ejemplo n.º 2
0
void OlvisExecGuiPlugin::saveGraphString(QString &data)
{
    QXmlStreamWriter writer(&data);
    writer.writeStartDocument();
    saveGraph(writer);
    writer.writeEndDocument();
}
Ejemplo n.º 3
0
void OlvisExecGuiPlugin::saveGraphFile(const QString &filename)
{
    QFile file(filename);
    file.open(QFile::WriteOnly | QFile::Text);
    QXmlStreamWriter writer(&file);
    writer.setAutoFormatting(true);
    writer.writeStartDocument();
    saveGraph(writer);
    writer.writeEndDocument();
}
Ejemplo n.º 4
0
unsigned int arlCore::PlaneSystem::printGraph( void ) const
{
    unsigned int n=saveGraph(GRAPHVIZ_TMP);
    if(n>0)
    {
        std::string exe = GRAPHVIZ_EXE;
        std::string tmp = GRAPHVIZ_TMP;
        std::string cmd = exe + " ";
        cmd = cmd +tmp;
        system(cmd.c_str());
    }
    return n;
}
void EnergyPlotter::plotData(int limb, const QString& outFilename)
{
	QTextStream& s = openTempFile();
	
	switch (limb)
	{
		case 0: writeThighData   (LeftLeg,  frameInfo()->leftLeg(),  s); break;
		case 1: writeThighData   (RightLeg, frameInfo()->rightLeg(), s); break;
		case 2: writeLowerLegData(LeftLeg,  frameInfo()->leftLeg(),  s); break;
		case 3: writeLowerLegData(RightLeg, frameInfo()->rightLeg(), s); break;
	}
	
	m_limb = limb;
	saveGraph(outFilename);
}
Ejemplo n.º 6
0
int main()
{
    printf("Enter Time Limit : ");
    scanf("%f",&TIME_LIMIT);
    int i, j;
    srand(time(NULL));
    Heap *heap;
    Ball **ball;
    Interaction *nextCollision;
    heap = initHeap();
    ball = (Ball **)malloc(PARTICLE_COUNT * sizeof(Ball *));
    gnuplotPipe = initPipe();
    for(i = 0; i < PARTICLE_COUNT; i++)
    {
        logFile[i] = initGraph(i);
        gnuplotGraphPipe[i] = initGraphPipe(i);
    }
    for(i = 0; i < PARTICLE_COUNT; i++)
    {
        ball[i] = initBallRandom(i);
        insertToHeap(heap, eventWallCollideX(heap, ball[i]));
        insertToHeap(heap, eventWallCollideY(heap, ball[i]));
        for(j = 0; j < i; j++)
            insertToHeap(heap, eventBallCollide(heap, ball[i], ball[j]));
    }
    while(sim_time < TIME_LIMIT)
    {
        nextCollision = getNextEvent(heap);
        simulateTo(ball, nextCollision->tstamp);
        printf("Collision at t=%lf\n", sim_time);
        resolveCollision(nextCollision);
        removeFromHeap(heap, nextCollision->interactee->id);
        scheduleEvent(ball, heap, nextCollision->interactee->id);
        if(nextCollision->interactor != NULL)
        {
            removeFromHeap(heap, nextCollision->interactor->id);
            scheduleEvent(ball, heap, nextCollision->interactor->id);
        }
    }
    fprintf(gnuplotPipe, "quit\n");
    saveGraph(ball);
    showGraph(ball);
    return 0;
}
Ejemplo n.º 7
0
void FftPlotter::plot(const QString& plot, const QString& outFilename)
{
	m_plot = plot;
	
	QTextStream& s = openTempFile();
	
	for (int i=0 ; i<m_fft->resultSize() ; ++i)
	{
		double magnitude = std::abs(m_fft->result()[i]);
		double phase = std::arg(m_fft->result()[i]);
		
		QStringList cols;
		cols << QString::number(i);
		cols << QString::number(magnitude, 'f');
		cols << QString::number(phase, 'f');
		cols << QString::number(phase * magnitude, 'f');
		
		s << cols.join(" ") << "\n";
	}
	
	saveGraph(outFilename);
}
Ejemplo n.º 8
0
bool processMenu(int choice) {
	string name;
	switch(choice-1) {
		case CREATE_NODE: 
			createNode();
			break;
		case DELETE_NODE:
			deleteNode();
			break;
		case CREATE_RELATION:
			createRelation();
			break;
		case DELETE_RELATION:
			deleteRelation();
			break;
		case SAVE_GRAPH:
			saveGraph();
			break;
		case LOAD_GRAPH:
			loadGraph();
			break;
		case DISPLAY_GRAPH:
			displayGraph();
			break;
		case RUN_PRIM:
			runPrim();
			break;
		case QUIT:
			return true;
			break;
		default:
			cout << "Invalid input" << endl;
			cout << endl;
			break;
	}
	return false;
}