Skip to content
Snippets Groups Projects
Commit 39e4a22d authored by Andreas Schenk's avatar Andreas Schenk
Browse files

added SetSelection to DataViewer

parent 39923f72
No related branches found
No related tags found
No related merge requests found
......@@ -73,6 +73,7 @@ void export_data_viewer()
.def("AddOverlay",&DataViewer::AddOverlay,o_AddOverlay())
.def("ClearOverlays",&DataViewer::ClearOverlays)
.def("GetSelection",&DataViewer::GetSelection)
.def("SetSelection",&DataViewer::SetSelection)
.def("UpdateView",&DataViewer::UpdateView)
.def("Recenter",&DataViewer::Recenter)
.def("AddDockWidget",add_dock1)
......
......@@ -118,6 +118,12 @@ Extent DataViewer::GetSelection() const
return panel_->GetSelection();
}
void DataViewer::SetSelection(const Extent& selection)
{
assert(panel_);
panel_->SetSelection(selection);
}
void DataViewer::SetName(const String& name)
{
setWindowTitle(QString::fromStdString(name));
......
......@@ -80,6 +80,9 @@ public:
//! return currently active selection
Extent GetSelection() const;
//! set currently active selection
void SetSelection(const Extent& selection);
//! set the name, displayed as the window title
void SetName(const String& name);
......
......@@ -643,6 +643,18 @@ Extent DataViewerPanelBase::GetSelection() const
return selection_;
}
void DataViewerPanelBase::SetSelection(const Extent& selection)
{
selection_=selection;
update_rubberband_from_selection_();
if(selection==Extent()){
rubberband_->hide();
}else{
rubberband_->show();
}
UpdateView(false);
}
Real DataViewerPanelBase::GetZoomScale() const
{
return zoom_scale_;
......
......@@ -101,6 +101,9 @@ public:
*/
Extent GetSelection() const;
//! set currently active selection
void SetSelection(const Extent& extent);
//! convert window coordinates to image point
Point WinToPoint(int mx, int my) const;
Point WinToPoint(const QPoint& p) const;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment