Skip to content

Commit 93e31fc

Browse files
Charles PIGNEROLlelandaisb
authored andcommitted
Polydata migration fix for experimental room.
1 parent 07a705c commit 93e31fc

File tree

3 files changed

+36
-16
lines changed

3 files changed

+36
-16
lines changed

src/QtVtkComponents/CMakeLists.txt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,12 @@ target_include_directories (QtVtkComponents PUBLIC $<BUILD_INTERFACE:${CMAKE_CUR
2727
target_compile_options (QtVtkComponents PRIVATE -DMAGIX3D_VERSION="${MAGIX3D_VERSION}")
2828
target_link_libraries (QtVtkComponents PUBLIC QtComponents VtkComponents QtVtk::QtVtk)
2929
if (ExperimentalRoom_FOUND)
30-
# target_compile_options (QtVtkComponents PUBLIC -DUSE_EXPERIMENTAL_ROOM) # Déjà fourni dans QtComponents
3130
target_link_libraries (QtVtkComponents PUBLIC ExperimentalRoom::ExperimentalRoom)
32-
find_package (ExperimentalRoomTExtension REQUIRED)
33-
target_link_libraries (QtVtkComponents PUBLIC ExperimentalRoomTExtension::ExperimentalRoomTExtension)
31+
find_package (ExperimentalRoomTExtension)
32+
if (ExperimentalRoomTExtension_FOUND)
33+
target_compile_definitions (QtVtkComponents PRIVATE USE_EXPERIMENTAL_ROOM_TRAYS)
34+
target_link_libraries (QtVtkComponents PUBLIC ExperimentalRoomTExtension::ExperimentalRoomTExtension)
35+
endif (ExperimentalRoomTExtension_FOUND)
3436
endif (ExperimentalRoom_FOUND)
3537

3638
target_compile_options (QtVtkComponents PRIVATE ${SHARED_CFLAGS}) # Requested by Qt ...

src/QtVtkComponents/QtVtkMgx3DExperimentalRoomPanel.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,6 @@ void QtVtkMgx3DExperimentalRoomPanel::useSelection (Context& context, bool globa
164164
mask = true == global ? context.globalMask ((*it)->getType ( )) : gr->getRepresentationMask ( ); // Correctif CP 31/07/20 : inefficace en mode global
165165
bool useSurfaceMask = (0 != (GraphicalEntityRepresentation::SURFACES & mask) ? true : false);
166166
bool useVolumeMask = (0 != (GraphicalEntityRepresentation::VOLUMES & mask) ? true : false);
167-
// std::cout<<"QtVtkMgx3DExperimentalRoomPanel::useSelection pour "<<(*it)->getName()
168-
// <<" SURFACES ? "<<useSurfaceMask<<std::endl;
169167
// pas de représentation triangulaire
170168
if (!useSurfaceMask && !useVolumeMask)
171169
nbEntitiesWithoutTriangulation += 1;
@@ -178,12 +176,11 @@ void QtVtkMgx3DExperimentalRoomPanel::useSelection (Context& context, bool globa
178176
continue;
179177

180178
VTKEntityRepresentation* vtkRepresentation = dynamic_cast<VTKEntityRepresentation*>(gr);
181-
vtkUnstructuredGrid* grid =
182-
0 == vtkRepresentation ? 0 : vtkRepresentation->getSurfacicGrid ( );
183-
if (0 == grid)
179+
vtkPolyData* polydata = 0 == vtkRepresentation ? 0 : vtkRepresentation->getSurfacicPolyData ( );
180+
if (0 == polydata)
184181
continue;
185182

186-
grids.push_back (grid);
183+
polydatas.push_back (polydata);
187184
names.push_back ((*it)->getName ( ));
188185
} // for(vector<Entity*>::iterator it = entities.begin ( ); ...
189186

src/QtVtkComponents/QtVtkMgx3DMainWindow.cpp

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@
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

5456
namespace 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

Comments
 (0)