2727#ifdef USE_EXPERIMENTAL_ROOM
2828#include < ExperimentalRoom/QtExpRoomFileDialog.h>
2929#include < ExperimentalRoom/ExperimentalRoomDistribution.h>
30+ #ifdef USE_EXPERIMENTAL_ROOM_TRAYS
3031#include < ExperimentalRoomTExtension/TRaysIO.h>
32+ #endif // USE_EXPERIMENTAL_ROOM_TRAYS
3133#include < ExperimentalRoom/VisRadCsvIO.h>
3234#include < ExperimentalRoom/ERDRaysIO.h>
3335#endif // USE_EXPERIMENTAL_ROOM
@@ -49,7 +51,7 @@ using namespace Mgx3D::QtComponents;
4951
5052#undef LOCK_INSTANCE
5153#define LOCK_INSTANCE AutoReferencedMutex autoReferencedMutex (TkUtil::ObjectBase::getMutex ( ));
52-
54+ const string ERD_INTERNAL_EXTENSION_EXT ( " erd " );
5355
5456namespace Mgx3D
5557{
@@ -540,8 +542,10 @@ void QtVtkMgx3DMainWindow::saveAsRaysCallback ( )
540542 File file (_experimentalRoomPanel->getExperimentalRoom ( ).getRaysFilePath ( ));
541543 string dir = file.getPath ( ).getFullFileName ( );
542544 vector<QtExpRoomFileDialog::Format> formats;
545+ #ifdef USE_EXPERIMENTAL_ROOM_TRAYS
543546 vector<string> tExt = TRaysIO::getFileExtensions ( );
544547 formats.push_back (QtExpRoomFileDialog::Format (" T" , tExt, true , true ));
548+ #endif // USE_EXPERIMENTAL_ROOM_TRAYS
545549 vector<string> erdExt = ERDRaysIO::getFileExtensions ( );
546550 formats.push_back (QtExpRoomFileDialog::Format (" Experimental Room Description" , erdExt, true , true ));
547551 static bool hiddenRays = false ;
@@ -565,7 +569,7 @@ void QtVtkMgx3DMainWindow::saveAsRaysCallback ( )
565569 file.setFullFileName (fileList [0 ].toStdString ( ));
566570 hiddenRays = !dialog.processVisiblesOnly ( );
567571
568-
572+ # ifdef USE_EXPERIMENTAL_ROOM_TRAYS
569573 if ((file.getExtension ( ) == T_INTERNAL_EXTENSION) || ((true == dialog.selectedNameFilter ( ).startsWith (" T " )) && ((false == file.exists ( )) || (ExperimentalRoomTIOManager::isTFile (file.getFullFileName ( ))))))
570574 {
571575 ioManager = dynamic_cast <ExperimentalRoomTIOManager*>(_experimentalRoomPanel->getRaysIOManager ( ));
@@ -576,8 +580,8 @@ void QtVtkMgx3DMainWindow::saveAsRaysCallback ( )
576580 } // if (0 == ioManager)
577581 }
578582 else
579-
580- if ((file.getExtension ( ) == ERD_INTERNAL_EXTENSION ) || ((true == dialog.selectedNameFilter ( ).startsWith (" Experimental Room Description" )) && ((false == file.exists ( )) || (ExperimentalRoomERDIOManager::isERDFile (file.getFullFileName ( ))))))
583+ # endif // USE_EXPERIMENTAL_ROOM_TRAYS
584+ if ((file.getExtension ( ) == ERD_INTERNAL_EXTENSION_EXT ) || ((true == dialog.selectedNameFilter ( ).startsWith (" Experimental Room Description" )) && ((false == file.exists ( )) || (ExperimentalRoomERDIOManager::isERDFile (file.getFullFileName ( ))))))
581585 {
582586 ioManager = dynamic_cast <ExperimentalRoomERDIOManager*>(_experimentalRoomPanel->getRaysIOManager ( ));
583587 if (0 == ioManager)
@@ -644,8 +648,10 @@ défini (Menu Chambre expérimentale).", Charset::UTF_8));
644648 }
645649
646650 vector<QtExpRoomFileDialog::Format> formats;
651+ #ifdef USE_EXPERIMENTAL_ROOM_TRAYS
647652 vector<string> tExt = TRaysIO::getFileExtensions ( );
648653 formats.push_back (QtExpRoomFileDialog::Format (" T" , tExt, false , true ));
654+ #endif // USE_EXPERIMENTAL_ROOM_TRAYS
649655 vector<string> erdExt = ERDRaysIO::getFileExtensions ( );
650656 formats.push_back (QtExpRoomFileDialog::Format (" Experimental Room Description" , erdExt, false , true ));
651657 vector<string> visradExt = VisRadCsvReader::getFileExtensions ( );
@@ -674,8 +680,12 @@ défini (Menu Chambre expérimentale).", Charset::UTF_8));
674680 const bool eraseAppData= !file.isWritable ( );
675681 ExperimentalRoomIOManager* ioManager = 0 ;
676682 ExperimentalRoom* room = 0 ;
677- if ((file.getExtension ( ) == ERD_INTERNAL_EXTENSION) || ((file.getExtension ( ) == " xml" ) && (ExperimentalRoomERDIOManager::isERDFile (file.getFullFileName ( )))))
683+ cout << __FILE__ << ' ' << __LINE__ << " QtVtkMgx3DMainWindow::loadRays File=" << file.getFullFileName ( ) << " Ext=" << file.getExtension ( ) << " ERD_EXT=" << ERD_INTERNAL_EXTENSION_EXT << endl;
684+ if (file.getExtension ( ) == ERD_INTERNAL_EXTENSION_EXT) cout << " IT IS ERD" << endl;
685+ else cout << " IT IS NOT ERD" << endl;
686+ if ((file.getExtension ( ) == ERD_INTERNAL_EXTENSION_EXT) || ((file.getExtension ( ) == " xml" ) && (ExperimentalRoomERDIOManager::isERDFile (file.getFullFileName ( )))))
678687 {
688+ cout << __FILE__ << ' ' << __LINE__ << " QtVtkMgx3DMainWindow::loadRays File=" << file.getFullFileName ( ) << " Ext=" << file.getExtension ( ) << endl;
679689 ioManager = new ExperimentalRoomERDIOManager ( );
680690 room = new ExperimentalRoom (file.getFileName ( ), ExperimentalRoom::TARGET);
681691 ioManager->getReader ( ).loadRoom (file.getFullFileName ( ), *room, ExperimentRay::LASER, ExperimentRay::CARTESIAN_EXP_ROOM);
@@ -686,12 +696,14 @@ défini (Menu Chambre expérimentale).", Charset::UTF_8));
686696 room = new ExperimentalRoom (file.getFileName ( ), ExperimentalRoom::TARGET);
687697 ioManager->getReader ( ).loadRoom (file.getFullFileName ( ), *room, ExperimentRay::LASER, ExperimentRay::CARTESIAN_EXP_ROOM);
688698 } // if (file.getExtension ( ) == "csv")
699+ #ifdef USE_EXPERIMENTAL_ROOM_TRAYS
689700 else if ((file.getExtension ( ) == T_INTERNAL_EXTENSION) || ((file.getExtension ( ) == " xml" ) && (ExperimentalRoomTIOManager::isTFile (file.getFullFileName ( )))))
690701 {
691702 ioManager = new ExperimentalRoomTIOManager ( );
692703 room = new ExperimentalRoom (file.getFileName ( ), ExperimentalRoom::TARGET);
693704 ioManager->getReader ( ).loadRoom (file.getFullFileName ( ), *room, ExperimentRay::LASER, ExperimentRay::CARTESIAN_EXP_ROOM);
694705 }
706+ #endif // USE_EXPERIMENTAL_ROOM_TRAYS
695707 else if (file.getExtension ( ) == " vrw" )
696708 {
697709 ioManager = new VisRadVrwIOManager ( );
@@ -770,8 +782,10 @@ void QtVtkMgx3DMainWindow::saveAsDiagsCallback ( )
770782 File file (_experimentalRoomPanel->getExperimentalRoom ( ).getDiagsFilePath ( ));
771783 string dir = file.getPath ( ).getFullFileName ( );
772784 vector<QtExpRoomFileDialog::Format> formats;
785+ #ifdef USE_EXPERIMENTAL_ROOM_TRAYS
773786 vector<string> tExt = TRaysIO::getFileExtensions ( );
774787 formats.push_back (QtExpRoomFileDialog::Format (" T" , tExt, true , true ));
788+ #endif // USE_EXPERIMENTAL_ROOM_TRAYS
775789 vector<string> erdExt = ERDRaysIO::getFileExtensions ( );
776790 formats.push_back (QtExpRoomFileDialog::Format (" Experimental Room Description" , erdExt, true , true ));
777791 const Charset::CHARSET charset =
@@ -788,6 +802,7 @@ void QtVtkMgx3DMainWindow::saveAsDiagsCallback ( )
788802 QStringList fileList = dialog.selectedFiles ( );
789803 file.setFullFileName (fileList [0 ].toStdString ( ));
790804
805+ #ifdef USE_EXPERIMENTAL_ROOM_TRAYS
791806 if ((file.getExtension ( ) == T_INTERNAL_EXTENSION) || ((true == dialog.selectedNameFilter ( ).startsWith (" T " )) && ((false == file.exists ( )) || (ExperimentalRoomTIOManager::isTFile (file.getFullFileName ( ))))))
792807 {
793808 ioManager = dynamic_cast <ExperimentalRoomTIOManager*>(_experimentalRoomPanel->getDiagsIOManager ( ));
@@ -797,7 +812,9 @@ void QtVtkMgx3DMainWindow::saveAsDiagsCallback ( )
797812 _experimentalRoomPanel->setDiagsIOManager (ioManager);
798813 } // if (0 == ioManager)
799814 }
800- else if ((file.getExtension ( ) == ERD_INTERNAL_EXTENSION) || ((true == dialog.selectedNameFilter ( ).startsWith (" Experimental Room Description" )) && ((false == file.exists ( )) || (ExperimentalRoomERDIOManager::isERDFile (file.getFullFileName ( ))))))
815+ else
816+ #endif // USE_EXPERIMENTAL_ROOM_TRAYS
817+ if ((file.getExtension ( ) == ERD_INTERNAL_EXTENSION_EXT) || ((true == dialog.selectedNameFilter ( ).startsWith (" Experimental Room Description" )) && ((false == file.exists ( )) || (ExperimentalRoomERDIOManager::isERDFile (file.getFullFileName ( ))))))
801818 {
802819 ioManager = dynamic_cast <ExperimentalRoomERDIOManager*>(_experimentalRoomPanel->getDiagsIOManager ( ));
803820 if (0 == ioManager)
@@ -845,8 +862,10 @@ défini (Menu Chambre expérimentale).", Charset::UTF_8));
845862 QString lastDir (dir.c_str ( ));
846863 static QString lastFilter (" " );
847864 vector<QtExpRoomFileDialog::Format> formats;
865+ #ifdef USE_EXPERIMENTAL_ROOM_TRAYS
848866 vector<string> tExt = TRaysIO::getFileExtensions ( );
849867 formats.push_back (QtExpRoomFileDialog::Format (" T" , tExt, false , true ));
868+ #endif // USE_EXPERIMENTAL_ROOM_TRAYS
850869 vector<string> erdExt = ERDRaysIO::getFileExtensions ( );
851870 formats.push_back (QtExpRoomFileDialog::Format (" Experimental Room Description" , erdExt, false , true ));
852871 QtExpRoomFileDialog dialog (this , getAppTitle ( ).c_str ( ), ExperimentRay::DIAGNOSIS, QFileDialog::AcceptOpen, lastDir.toStdString ( ), formats);
@@ -865,7 +884,7 @@ défini (Menu Chambre expérimentale).", Charset::UTF_8));
865884 // Faudra t'il détruire les données applicatives de la chambre ?
866885 const bool eraseAppData = !file.isWritable ( );
867886
868- if ((file.getExtension ( ) == ERD_INTERNAL_EXTENSION ) || ((file.getExtension ( ) == " xml" ) && (ExperimentalRoomERDIOManager::isERDFile (file.getFullFileName ( )))))
887+ if ((file.getExtension ( ) == ERD_INTERNAL_EXTENSION_EXT ) || ((file.getExtension ( ) == " xml" ) && (ExperimentalRoomERDIOManager::isERDFile (file.getFullFileName ( )))))
869888 {
870889 ExperimentalRoomERDIOManager* ioManager = new ExperimentalRoomERDIOManager ( );
871890 ExperimentalRoom* room = new ExperimentalRoom (file.getFileName ( ), ExperimentalRoom::TARGET);
@@ -885,6 +904,7 @@ défini (Menu Chambre expérimentale).", Charset::UTF_8));
885904 diags2.clear ( ); // not mandatory
886905 delete room; room = 0 ;
887906 }
907+ #ifdef USE_EXPERIMENTAL_ROOM_TRAYS
888908 else if ((file.getExtension ( ) == T_INTERNAL_EXTENSION) || ((file.getExtension ( ) == " xml" ) && (ExperimentalRoomTIOManager::isTFile (file.getFullFileName ( )))))
889909 {
890910 ExperimentalRoomTIOManager* ioManager = new ExperimentalRoomTIOManager ( );
@@ -905,6 +925,7 @@ défini (Menu Chambre expérimentale).", Charset::UTF_8));
905925 diags2.clear ( ); // not mandatory
906926 delete room; room = 0 ;
907927 }
928+ #endif // USE_EXPERIMENTAL_ROOM_TRAYS
908929 else
909930 throw Exception (" Format de fichier non reconnu" );
910931} // QtVtkMgx3DMainWindow::loadDiags
0 commit comments