Example #1
0
int main(int argc, char *argv[])
{
	IfcPlusPlusApplication app(argc, argv);
	IfcPlusPlusSystem* sys = new IfcPlusPlusSystem();
	ViewerWidget* viewer_widget = new ViewerWidget( sys );
	OrbitCameraManipulator* camera_manip = new OrbitCameraManipulator( sys );
	viewer_widget->getMainView()->setCameraManipulator( camera_manip );
	viewer_widget->setRootNode( sys->getRootNode() );

	MainWindow* window = new MainWindow( sys, viewer_widget );
	app.connect( window,	SIGNAL(signalMainWindowClosed()),	&app,	SLOT(quit()) );
	
	window->show();
	viewer_widget->setFocus();
	viewer_widget->startTimer();
	viewer_widget->getMainView()->addEventHandler( sys );

	if( argc > 1 )
	{
		std::string arg1 = argv[1];
		
		if( arg1.length() > 4 )
		{
			std::string file_type = arg1.substr(arg1.find_last_of(".") + 1);
			std::transform( file_type.begin(), file_type.end(), file_type.begin(), []( unsigned char c ) -> unsigned char { return std::toupper( c ); } );

			if( file_type.compare( "IFC" ) == 0 || file_type.compare( "STP" ) == 0  )
			{
				QString path(arg1.c_str());
				window->getTabReadWrite()->slotLoadIfcFile( path );
			}
		}
	}

	int re=0;
	try
	{
		re = app.exec();
	}
	catch( BuildingException& e )
	{
		std::cout << "BuildingException in app.exec(): " << e.what();
	}
	catch( std::exception& e )
	{
		std::cout << "std::exception in app.exec(): " << e.what();
	}
	catch( std::exception* e )
	{
		std::cout << "std::exception in app.exec(): " << e->what();
	}

	viewer_widget->getCompositeViewer()->setDone(true);
	viewer_widget->stopTimer();

	return re;
}
Example #2
0
void MainWindow::closeEvent( QCloseEvent *event )
{
	QSettings settings(QSettings::UserScope, QLatin1String("IfcPlusPlus"));
	settings.setValue("MainWindowGeometry", saveGeometry());
	settings.setValue("mainWindowState", saveState());
	
	m_tab_read_write->closeEvent( event );
	QMainWindow::closeEvent( event );

	emit( signalMainWindowClosed() );
}
Example #3
0
void MainWindow::closeEvent( QCloseEvent *event )
{
	QSettings settings(QSettings::UserScope, QLatin1String("IfcPlusPlus"));
	settings.setValue("MainWindowGeometry", saveGeometry());
	settings.setValue("mainWindowState", saveState());
	
	// for some reason, closeEvent or other close methods are not called on widgets, so do it manually here...
	m_tab_read_write->closeEvent( event );
	QMainWindow::closeEvent( event );

	emit( signalMainWindowClosed() );
}
Example #4
0
int main(int argc, char *argv[])
{
	IfcPlusPlusApplication app(argc, argv);
	QPixmap pixmap( ":img/IfcPlusPlusViewerSplash.png" );
	QSplashScreen splash( pixmap );

#ifndef _DEBUG
	splash.show();
	app.processEvents();
	QTimer::singleShot( 1500, &splash, SLOT(close()));
#endif

	IfcPlusPlusSystem* sys = new IfcPlusPlusSystem();

#ifdef _DEBUG
	DebugViewer* debug_viewer = new DebugViewer();
	debug_viewer->m_viewer_widget->startTimer();
	debug_viewer->show();
	//createTest( sys->getViewController()->getModelNode(), sys->getViewController()->getRootNode() );
#endif

	ViewerWidget* viewer_widget = new ViewerWidget();
	Orbit3DManipulator* camera_manip = new Orbit3DManipulator( sys );
	viewer_widget->getMainView()->setCameraManipulator( camera_manip );
	viewer_widget->setRootNode( sys->getViewController()->getRootNode() );

	MainWindow* window = new MainWindow( sys, viewer_widget );
	app.connect( window,	SIGNAL(signalMainWindowClosed()),	&app,	SLOT(quit()) );
	
	window->show();
	viewer_widget->setFocus();
	viewer_widget->startTimer();
	viewer_widget->getMainView()->addEventHandler( sys );

	if( argc > 1 )
	{
		std::string arg1 = argv[1];
		
		if( arg1.length() > 4 )
		{
			std::string file_type = arg1.substr(arg1.find_last_of(".") + 1);
			std::transform(file_type.begin(), file_type.end(), file_type.begin(), toupper);

			if( file_type.compare( "IFC" ) == 0 || file_type.compare( "STP" ) == 0  )
			{
				QString path(arg1.c_str());
				window->getTabReadWrite()->slotLoadIfcFile( path );
			}
		}
	}

	int re=0;
	try
	{
		re = app.exec();
	}
	catch( IfcPPException& e )
	{
		std::cout << "IfcPPException in app.exec(): " << e.what();
	}
	catch( std::exception& e )
	{
		std::cout << "std::exception in app.exec(): " << e.what();
	}
	catch( std::exception* e )
	{
		std::cout << "std::exception in app.exec(): " << e->what();
	}

	viewer_widget->getViewer().setDone(true);
	viewer_widget->stopTimer();

	return re;
}
void MainWindow::closeEvent(QCloseEvent *e){
    emit signalMainWindowClosed();
    QMainWindow::closeEvent(e);
}