Commit f2831db7 authored by Tobias WEBER's avatar Tobias WEBER
Browse files

added selection option

parent 67e00e03
...@@ -196,6 +196,8 @@ MolDynDlg::MolDynDlg(QWidget* pParent) : QMainWindow{pParent}, ...@@ -196,6 +196,8 @@ MolDynDlg::MolDynDlg(QWidget* pParent) : QMainWindow{pParent},
m_atomContextMenu->addAction("Delete Atom", this, &MolDynDlg::DeleteAtomUnderCursor); m_atomContextMenu->addAction("Delete Atom", this, &MolDynDlg::DeleteAtomUnderCursor);
m_atomContextMenu->addAction("Delete All Atoms Of Selected Type", this, &MolDynDlg::DeleteAllAtomsOfSameType); m_atomContextMenu->addAction("Delete All Atoms Of Selected Type", this, &MolDynDlg::DeleteAllAtomsOfSameType);
m_atomContextMenu->addAction("Only Keep Atoms Of Selected Type", this, &MolDynDlg::KeepAtomsOfSameType); m_atomContextMenu->addAction("Only Keep Atoms Of Selected Type", this, &MolDynDlg::KeepAtomsOfSameType);
m_atomContextMenu->addSeparator();
m_atomContextMenu->addAction("Select All Atoms of Same Type", this, &MolDynDlg::SelectAtomsOfSameType);
} }
...@@ -944,6 +946,26 @@ MolDynDlg::GetAtomIndexFromHandle(std::size_t handle) const ...@@ -944,6 +946,26 @@ MolDynDlg::GetAtomIndexFromHandle(std::size_t handle) const
} }
/**
* select all atoms of the same type as the one under the cursor
*/
void MolDynDlg::SelectAtomsOfSameType()
{
// nothing under cursor
if(m_curPickedObj <= 0)
return;
// atom type to be selected
const std::string& atomLabel = m_plot->GetImpl()->GetObjectDataString(m_curPickedObj);
for(auto handle : m_sphereHandles)
if(m_plot->GetImpl()->GetObjectDataString(handle) == atomLabel)
m_plot->GetImpl()->SetObjectHighlight(handle, 1);
m_plot->update();
}
/** /**
* delete one atom * delete one atom
*/ */
......
...@@ -52,17 +52,18 @@ protected: ...@@ -52,17 +52,18 @@ protected:
void PickerIntersection(const t_vec3_gl* pos, std::size_t objIdx, const t_vec3_gl* posSphere); void PickerIntersection(const t_vec3_gl* pos, std::size_t objIdx, const t_vec3_gl* posSphere);
void AfterGLInitialisation(); void AfterGLInitialisation();
void SliderValueChanged(int val);
void SelectAll();
void SelectNone();
std::tuple<bool, std::size_t, std::size_t, std::size_t> GetAtomIndexFromHandle(std::size_t handle) const; std::tuple<bool, std::size_t, std::size_t, std::size_t> GetAtomIndexFromHandle(std::size_t handle) const;
void CalculateDistanceBetweenAtoms(); void CalculateDistanceBetweenAtoms();
void CalculatePositionsOfAtoms(); void CalculatePositionsOfAtoms();
void CalculateDeltaDistancesOfAtoms(); void CalculateDeltaDistancesOfAtoms();
void SliderValueChanged(int val);
void SelectAll();
void SelectNone();
void SelectAtomsOfSameType();
void DeleteAtomUnderCursor(); void DeleteAtomUnderCursor();
void DeleteAllAtomsOfSameType(); void DeleteAllAtomsOfSameType();
void KeepAtomsOfSameType(); void KeepAtomsOfSameType();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment