예제 #1
0
void OlvisExecGuiPlugin::loadProject(const QString &projectFile)
{
    QSettings settings(projectFile, QSettings::IniFormat);
    if(!settings.contains("visionFile"))
        settings.setValue("visionFile", QFileInfo(projectFile).baseName() + ".ogr");
    QString graphName = settings.value("visionFile").toString();
    graphFile = QFileInfo(projectFile).absolutePath() + "/" + graphName;
    autoSaveFile =  QFileInfo(projectFile).absolutePath() + "/~" + graphName;

    if(QFileInfo(graphFile).lastModified() < QFileInfo(autoSaveFile).lastModified()
        &&QMessageBox::warning(0, "Autosave file for a vision configuration detected",
                             "An autosave file was detected, that is newer than the original file. Do you want to recover the autosave file?",
                             QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes) == QMessageBox::Yes)
    {
        loadGraphFile(autoSaveFile);
    }
    else
        loadGraphFile(graphFile);
    if(mInterface->getProcessors().count() == 0)
    {
        mInterface->createProcessor("Default");
        saveGraphFile(graphFile);
    }
    mInterface->clearUpdateFlag();
    toolbar->setEnabled(true);
    videoWidget->setEnabled(true);
    mTimer.start();
}
예제 #2
0
파일: counter.c 프로젝트: Jeky/graph
DegNode *countDegree(const char *filename, int nodeCount, int sortBy){
    DegNode *nodes;
    double totalTime;
    int i;

    NEW_ARRAY(nodes, DegNode, nodeCount);
    for(i = 0; i < nodeCount; i++){
        nodes[i].index = i;
        nodes[i].inDeg = 0;
        nodes[i].outDeg = 0;
    }

    logMsg("Start Counting Degree in Graph From File: %s.\n", filename);
    totalTime = loadGraphFile(nodes, filename, &degreeCounter);

    logMsg("Finish Counting Degree. Total Time: %0.2lf sec.\n", totalTime);
    switch(sortBy){
        case SORT_BY_INDEG:
            logMsg("Sort Degree by Indegree...\n");
            qsort(nodes, nodeCount, sizeof(DegNode), indegreeComparator);
            break;
        case SORT_BY_OUTDEG:
            logMsg("Sort Degree by Outdegree...\n");
            qsort(nodes, nodeCount, sizeof(DegNode), outdegreeComparator);
            break;
    }

    return nodes;
}
예제 #3
0
void OlvisExecGuiPlugin::restore()
{
    if(!graphFile.isEmpty())
    {
        loadGraphFile(graphFile);
        mInterface->clearUpdateFlag();
    }
}
예제 #4
0
파일: counter.c 프로젝트: Jeky/graph
int countNode(const char *filename){
    int maxNodeIndex = 0;
    double totalTime;

    logMsg("Start Counting Nodes in Graph From File: %s.\n", filename);
    totalTime = loadGraphFile(&maxNodeIndex, filename, &nodeCounter);

    logMsg("Node Count: %d. Total Time: %0.2lf sec.\n", maxNodeIndex + 1, totalTime);
    return maxNodeIndex + 1;
}
예제 #5
0
파일: pathfinder.cpp 프로젝트: ej2xu/cs106b
int main() {
	InitGraphics();
	SetWindowTitle("CS106 Pathfinder");
    cout << "This masterful piece of work is a graph extravaganza!" << endl
        << "The main attractions include a lovely visual presentation of the graph" << endl
        << "along with an implementation of Dijkstra's shortest path algorithm and" << endl
        << "the computation of a minimal spanning tree.  Enjoy!" << endl;
	Graph graph;
	Map<coordT> nodeCor;
	string loc1, loc2, image;
	image = loadGraphFile(graph, nodeCor);
	drawMap(graph, nodeCor);
	while (true) {
		int choice = promptForChoice();
		switch (choice) {
			case 1:
				graph.clear();
				nodeCor.clear();
				image = loadGraphFile(graph, nodeCor);
				drawMap(graph, nodeCor);
				break;
			case 2:
				cout << endl;
				loc1 = getLocName("Click on starting location...  ", nodeCor);
				loc2 = getLocName("Click on ending location...  ", nodeCor);
				displayMinPath(graph, nodeCor, loc1, loc2);
				break;
			case 3:
				InitGraphics();
				DrawNamedPicture(image);
				drawVertices(nodeCor);
				displayMST(graph, nodeCor);
				break;
			case 4:
				displayDomSet(graph, nodeCor);
				break;
			case 5: exit(0);
		}
	} 

    return (0);
}