Skip to content

Commit c630d62

Browse files
committed
feat: Force visibility of new geometries
1 parent 3d52e4a commit c630d62

File tree

4 files changed

+30
-0
lines changed

4 files changed

+30
-0
lines changed

QTDialogs/GeometriesEditorTab/GeometriesEditorTab.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,10 @@ void CGeometriesEditorTab::AddGeometryStd(EVolumeShape _shape, EType _type)
524524
if (!geometry) return;
525525
UpdateGeometriesList();
526526
ui.listGeometries->SetCurrentItem(QString::fromStdString(geometry->Key()));
527+
if (_type == EType::GEOMETRY)
528+
emit GeometryAdded(geometry->Key());
529+
else
530+
emit VolumeAdded(geometry->Key());
527531
EmitChangeSignals();
528532
}
529533

@@ -541,6 +545,10 @@ void CGeometriesEditorTab::AddGeometryLib(const std::string& _key, EType _type)
541545
if (!geometry) return;
542546
UpdateGeometriesList();
543547
ui.listGeometries->SetCurrentItem(QString::fromStdString(geometry->Key()));
548+
if (_type == EType::GEOMETRY)
549+
emit GeometryAdded(geometry->Key());
550+
else
551+
emit VolumeAdded(geometry->Key());
544552
EmitChangeSignals();
545553
}
546554

QTDialogs/GeometriesEditorTab/GeometriesEditorTab.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,4 +130,6 @@ private slots:
130130
signals:
131131
void ObjectsChanged();
132132
void AnalysisGeometriesChanged();
133+
void GeometryAdded(const std::string& _key); // Is emitted when a new real geometry is created in the system.
134+
void VolumeAdded(const std::string& _key); // Is emitted when a new analysis volume is created in the system.
133135
};

QTDialogs/MUSENMainWindow/MUSENMainWindow.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,8 @@ void MUSENMainWindow::InitializeConnections()
172172
connect(tab, &CMusenDialog::UpdateViewLegend , m_pViewManager, &CViewManager::UpdateLegend );
173173
}
174174

175+
connect(m_pGeometriesEditorTab, &CGeometriesEditorTab::GeometryAdded, this, &MUSENMainWindow::MakeGeometryVisible);
176+
connect(m_pGeometriesEditorTab, &CGeometriesEditorTab::VolumeAdded, this, &MUSENMainWindow::MakeVolumeVisible);
175177
connect(m_pGeometriesEditorTab, &CGeometriesEditorTab::ObjectsChanged, m_pPackageGeneratorTab, &CPackageGeneratorTab::UpdateWholeView);
176178
connect(m_pObjectsEditorTab, &CObjectsEditorTab::MaterialsChanged, m_pViewOptionsTab, &CViewOptionsTab::UpdateMaterials);
177179

@@ -542,6 +544,22 @@ void MUSENMainWindow::UpdateMaterialsInSystemStructure()
542544
m_SystemStructure.UpdateAllObjectsCompoundsProperties();
543545
}
544546

547+
void MUSENMainWindow::MakeGeometryVisible(const std::string& _key) const
548+
{
549+
// force new geometry to be visible
550+
auto visibleGeometries = m_pViewSettings->VisibleGeometries();
551+
visibleGeometries.insert(_key);
552+
m_pViewSettings->VisibleGeometries(visibleGeometries);
553+
}
554+
555+
void MUSENMainWindow::MakeVolumeVisible(const std::string& _key) const
556+
{
557+
// force new volume to be visible
558+
auto visibleVolumes = m_pViewSettings->VisibleVolumes();
559+
visibleVolumes.insert(_key);
560+
m_pViewSettings->VisibleVolumes(visibleVolumes);
561+
}
562+
545563
void MUSENMainWindow::ClearSystemStructure()
546564
{
547565
if (QMessageBox::question(this, "Confirmation", "Delete all objects?", QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel) != QMessageBox::Yes) return;

QTDialogs/MUSENMainWindow/MUSENMainWindow.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,8 @@ private slots:
146146

147147
void ChangeCurrentTime(); // Change selected time point in all controls.
148148
void UpdateMaterialsInSystemStructure();
149+
void MakeGeometryVisible(const std::string& _key) const; // Reaction on adding a new geometry to the system structure.
150+
void MakeVolumeVisible(const std::string& _key) const; // Reaction on adding a new volume to the system structure.
149151

150152
void ClearSystemStructure();
151153
void ClearAllTimePoints(); // Delete all time points in the system structure.

0 commit comments

Comments
 (0)