Example #1
0
int main(int argc, char *argv[])
{
#if _DEBUG || (__GNUC__ && !NDEBUG)
#ifdef _WIN32
  const char *logfilepath = "./resultsviewer.log";
#else
  const char *logfilepath = "/var/log/resultsviewer.log";
#endif
  openstudio::Logger::instance().standardOutLogger().setLogLevel(Debug);
  openstudio::FileLogSink fileLog(openstudio::toPath(logfilepath));
  fileLog.setLogLevel(Debug);
#else
  openstudio::Logger::instance().standardOutLogger().setLogLevel(Warn);
#endif

  bool cont = true;
  while(cont) {
    cont = false;

    // Make the run path the default plugin search location
    QCoreApplication::addLibraryPath(openstudio::toQString(openstudio::getApplicationRunDirectory()));

    QApplication qApplication(argc,argv);
    openstudio::Application::instance().setApplication(&qApplication);

    try {
      resultsviewer::MainWindow w;
      w.show();

      return qApplication.exec();

    } catch (const std::exception &e) {
      LOG_FREE(Fatal, "ResultsViewer", "An unhandled exception has occurred: " << e.what());
      cont = true;
      QMessageBox msgBox;
      msgBox.setWindowTitle("Unhandled Exception");
      msgBox.setIcon(QMessageBox::Critical);
      msgBox.setText("An unhandled exception has occurred.");
      msgBox.setInformativeText(e.what());
      msgBox.setStandardButtons(QMessageBox::Retry | QMessageBox::Close);
      msgBox.button(QMessageBox::Retry)->setText("Relaunch");
      if (msgBox.exec() == QMessageBox::Close) {
        cont = false;
      }
    } catch (...) {
      LOG_FREE(Fatal, "ResultsViewer", "An unknown exception has occurred.");
      cont = true;
      QMessageBox msgBox;
      msgBox.setWindowTitle("Unknown Exception");
      msgBox.setIcon(QMessageBox::Critical);
      msgBox.setText("An unknown exception has occurred.");
      msgBox.setStandardButtons(QMessageBox::Retry | QMessageBox::Close);
      msgBox.button(QMessageBox::Retry)->setText("Relaunch");
      if (msgBox.exec() == QMessageBox::Close) {
        cont = false;
      }
    }
  }
}
Example #2
0
int main(int argc, char *argv[])
{
  QApplication qApplication(argc, argv);
  MainWindow mainWindow;
  mainWindow.show();
  
  return qApplication.exec();
}
Example #3
0
int main( int argc, char** argv )
{
    QApplication    qApplication( argc, argv );
                    qApplication.setQuitOnLastWindowClosed(true);

    PictureViewer   pictureViewer( qApplication.arguments().value(1) );
                    pictureViewer.show();

    return qApplication.exec();
}
Example #4
0
int main( int argc, char* argv[] )
{
	// creating the qt-application object
	QApplication qApplication( argc, argv );
	qApplication.setQuitOnLastWindowClosed( true );
	
	// creating downloader object, and showing it
	Downloader downloader;
	downloader.initEnvironement();
	downloader.show();
	
	// running the application
	return qApplication.exec();
}
Example #5
0
int main( int argc, char** argv )
{
    QApplication qApplication( argc, argv );
                 qApplication.setQuitOnLastWindowClosed( true );

    TextEditor  textEditor;
                textEditor.show();

    // open the the specified command line files if any
    if( qApplication.arguments().size() > 1 )
        for( int index=1; index < qApplication.arguments().size(); index++ )
            textEditor.newTab( qApplication.arguments().value(index) );

    return qApplication.exec();
}
Example #6
0
int main(int argc, char *argv[])
{
  openstudio::Logger::instance().standardOutLogger().disable();

  openstudio::FileLogSink logFile(openstudio::toPath(logfilepath));
  logFile.setLogLevel(Warn);

  bool cont = true;
  while(cont) {
    cont = false;

    QApplication qApplication(argc,argv);
    openstudio::Application::instance().setApplication(&qApplication);

    try {
      resultsviewer::MainWindow w;
      w.show();

      return qApplication.exec();

    } catch (const std::exception &e) {
      LOG_FREE(Fatal, "ResultsViewer", "An unhandled exception has occurred: " << e.what());
      cont = true;
      QMessageBox msgBox;
      msgBox.setWindowTitle("Unhandled Exception");
      msgBox.setIcon(QMessageBox::Critical);
      msgBox.setText("An unhandled exception has occurred.");
      msgBox.setInformativeText(e.what());
      msgBox.setStandardButtons(QMessageBox::Retry | QMessageBox::Close);
      msgBox.button(QMessageBox::Retry)->setText("Relaunch");
      if (msgBox.exec() == QMessageBox::Close) {
        cont = false;
      }
    } catch (...) {
      LOG_FREE(Fatal, "ResultsViewer", "An unknown exception has occurred.");
      cont = true;
      QMessageBox msgBox;
      msgBox.setWindowTitle("Unknown Exception");
      msgBox.setIcon(QMessageBox::Critical);
      msgBox.setText("An unknown exception has occurred.");
      msgBox.setStandardButtons(QMessageBox::Retry | QMessageBox::Close);
      msgBox.button(QMessageBox::Retry)->setText("Relaunch");
      if (msgBox.exec() == QMessageBox::Close) {
        cont = false;
      }
    }
  }
}
Example #7
0
int main(int argc, char **argv)
{

    TopoDS_Shape shape = MakeBottle(50, 70, 30);


    Handle(Aspect_DisplayConnection) aDisplayConnection = new Aspect_DisplayConnection();

    Handle(OpenGl_GraphicDriver) aGraphicDriver = new OpenGl_GraphicDriver(aDisplayConnection);


    Handle(V3d_Viewer) aViewer = new V3d_Viewer(aGraphicDriver, Standard_ExtString("Test"), "");
//    ,
//            // Space size
//                                                400.,
//            // Default projection
//                                                V3d_Xpos,
//            // Default  background
//                                                Quantity_NOC_DARKVIOLET,
//            // Type of  visualization
//                                                V3d_ZBUFFER,
//            // Shading  model
//                                                V3d_GOURAUD,
//            // Update mode
//                                                V3d_WAIT
//    );

// set parameters for V3d_Viewer
// defines default lights -
//   positional-light 0.3 0.0 0.0
//   directional-light V3d_XnegYposZpos
//   directional-light V3d_XnegYneg
//   ambient-light
//    aViewer->SetDefaultLights();
//// activates all the lights defined in this viewer
//    aViewer->SetLightOn();
//// set background color to black
//    aViewer->SetDefaultBackgroundColor(Quantity_NOC_BLACK);


    Handle(AIS_InteractiveContext) aContext = new AIS_InteractiveContext(aViewer);

    Handle(AIS_Shape) anAis = new AIS_Shape(shape);

    aContext->Display(anAis);


    QApplication qApplication(argc, argv);

    QWidget qWidget;

    qWidget.show();

    Handle(Xw_Window) aWindow = new Xw_Window(aDisplayConnection, qWidget.winId());

    Handle(V3d_View) aView = aViewer->CreateView();

    aView->SetWindow(aWindow);

    /////////////////////////////////////////////////////////


    // Create document
    Handle(TDocStd_Document) aDoc;
    Handle(XCAFApp_Application) anApp = XCAFApp_Application::GetApplication();
    anApp->NewDocument("MDTV-XCAF", aDoc);

    // Create label and add our shape
    Handle (XCAFDoc_ShapeTool) myShapeTool = XCAFDoc_DocumentTool::ShapeTool(aDoc->Main());
    TDF_Label aLabel = myShapeTool->NewShape();
    myShapeTool->SetShape(aLabel, shape);

    // Write as STEP file
    STEPCAFControl_Writer *myWriter = new STEPCAFControl_Writer();
    myWriter->Perform(aDoc, "demo.stp");


    return qApplication.exec();

}
Example #8
0
int main( int argc, char** argv )
{
    QApplication qApplication(argc, argv);
    qApplication.setOrganizationName("Opposite Renderer");
    qApplication.setApplicationName("Opposite Renderer");

    QTextStream out(stdout);
    QTextStream in(stdin);

    try
    {
        ComputeDeviceRepository repository;

        const std::vector<ComputeDevice> & repo = repository.getComputeDevices();

		if(repo.empty())
		{
			out << "You must have a CUDA enabled GPU to run this application." 
				<< endl << "Press ENTER to quit." << endl;
			in.read(1);
			return 1;
		}

		out << "Available compute devices:" << endl;

        for(int i = 0; i < repo.size(); i++)
        {
            const ComputeDevice & device = repo.at(i);
            out << "   " <<  i << ": " << device.getName() << " (CC " << device.getComputeCapability() << " PCI Bus "<< device.getPCIBusId() <<")" << endl;
        }

        int deviceNumber = repo.size() == 1 ? 0 : -1;

        while (deviceNumber >= repo.size() || deviceNumber < 0)
        {
            out << "Select 0-" << repo.size()-1 << ":" << endl;
            in >> deviceNumber;
        }

        out << deviceNumber << endl;

        ComputeDevice device = repo.at(deviceNumber);

        StandaloneApplication application = StandaloneApplication(qApplication, device);

        // Run application
        QThread* applicationThread = new QThread(&qApplication);
        application.moveToThread(applicationThread);
        applicationThread->start();

        MainWindowBase mainWindow(application);
        mainWindow.showMaximized();
        int returnCode = qApplication.exec();
        application.wait();

        applicationThread->quit();
        applicationThread->wait();

        return returnCode;
    }
    catch(const std::exception & E)
    {
        QMessageBox::warning(NULL, "Exception Thrown During Launch of Standalone", E.what());
        return -1;
    }
}
int main( int argc, char** argv )
{
    QApplication qApplication(argc, argv);
    qApplication.setOrganizationName("Opposite Renderer");
    qApplication.setApplicationName("Opposite Renderer");
    //attachConEmu();

    QTextStream out(stdout);
    QTextStream in(stdin);
    
    //setvbuf(stdout, NULL, _IONBF, NULL);	// vmarz: disable output stream buffering, otherwise printf output doesn't show up consistently
    //setvbuf(stderr, NULL, _IONBF, NULL);

    try
    {
        ComputeDeviceRepository repository;

        const std::vector<ComputeDevice> & repo = repository.getComputeDevices();

        if(repo.empty())
        {
            out << "You must have a CUDA enabled GPU to run this application." 
                << endl << "Press ENTER to quit." << endl;
            in.read(1);
            return 1;
        }

        out << "Available compute devices:" << endl;

        for(int i = 0; i < repo.size(); i++)
        {
            const ComputeDevice & device = repo.at(i);
            out << "   " <<  i << ": " << device.getName() << " (CC " << device.getComputeCapability() << " PCI Bus "<< device.getPCIBusId() <<")" << endl;
        }

        int deviceNumber = repo.size() == 1 ? 0 : -1;

        while (deviceNumber >= repo.size() || deviceNumber < 0)
        {
            out << "Select 0-" << repo.size()-1 << ":" << endl;
            in >> deviceNumber;
        }

        out << "Using device: " << deviceNumber << endl;

        ComputeDevice device = repo.at(deviceNumber);
        StandaloneApplication application = StandaloneApplication(qApplication, device);

        // Run application
        QThread* applicationThread = new QThread(&qApplication);
        applicationThread->setObjectName("QThread::Application");
        application.moveToThread(applicationThread);
        applicationThread->start();

        MainWindowBase mainWindow(application);
        //mainWindow.showMaximized();
        mainWindow.show();
        mainWindow.resize(1150,700);

        // vmarz: start render manager after MainWindow initialization when all signals/slots hooked up
        application.startRenderManager();
        int returnCode = qApplication.exec();
        application.wait();

        applicationThread->quit();
        applicationThread->wait();

        return returnCode;
    }
    catch(const std::exception & E)
    {
        QMessageBox::warning(NULL, "Exception Thrown During Launch of Standalone", E.what());
        return -1;
    }
}