Skip to content

Commit

Permalink
Re #6162. Added a new tool button to Pick Tab
Browse files Browse the repository at this point in the history
  • Loading branch information
mantid-roman committed Dec 3, 2012
1 parent 39a3290 commit 956a6a9
Show file tree
Hide file tree
Showing 22 changed files with 162 additions and 311 deletions.
15 changes: 12 additions & 3 deletions Code/Mantid/Framework/DataObjects/src/PeaksWorkspace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,10 @@ namespace DataObjects
*/
void PeaksWorkspace::removePeak(const int peakNum)
{
if (peakNum >= static_cast<int>(peaks.size()) || peakNum < 0 ) throw std::invalid_argument("PeaksWorkspace::removePeak(): peakNum is out of range.");
if (peakNum >= static_cast<int>(peaks.size()) || peakNum < 0 )
{
throw std::invalid_argument("PeaksWorkspace::removePeak(): peakNum is out of range.");
}
peaks.erase(peaks.begin()+peakNum);
}

Expand All @@ -200,7 +203,10 @@ namespace DataObjects
*/
API::IPeak & PeaksWorkspace::getPeak(const int peakNum)
{
if (peakNum >= static_cast<int>(peaks.size()) || peakNum < 0 ) throw std::invalid_argument("PeaksWorkspace::getPeak(): peakNum is out of range.");
if (peakNum >= static_cast<int>(peaks.size()) || peakNum < 0 )
{
throw std::invalid_argument("PeaksWorkspace::getPeak(): peakNum is out of range.");
}
return peaks[peakNum];
}

Expand All @@ -211,7 +217,10 @@ namespace DataObjects
*/
const API::IPeak & PeaksWorkspace::getPeak(const int peakNum) const
{
if (peakNum >= static_cast<int>(peaks.size()) || peakNum < 0 ) throw std::invalid_argument("PeaksWorkspace::getPeak(): peakNum is out of range.");
if (peakNum >= static_cast<int>(peaks.size()) || peakNum < 0 )
{
throw std::invalid_argument("PeaksWorkspace::getPeak(): peakNum is out of range.");
}
return peaks[peakNum];
}

Expand Down
58 changes: 30 additions & 28 deletions Code/Mantid/Images/images.qrc
Original file line number Diff line number Diff line change
@@ -1,30 +1,32 @@
<RCC>
<qresource prefix="/">
<file>pvIcon.png</file>
<file>MantidSplashScreen.png</file>
<file>MantidPlot_Icon_32offset.png</file>
<file>SNS_logo_trans_back.gif</file>
<file>Tessella_Logo_Transparent.gif</file>
<file>Mantid_Logo_Transparent_Cropped.png</file>
<file>HFIR_logo_small.png</file>
<file>ISIS_Logo_Transparent.gif</file>
<file>Mantid_Logo_Transparent.png</file>
<file>data_replace.png</file>
</qresource>
<qresource prefix="/Icons">
<file>LoadFile.png</file>
</qresource>
<qresource prefix="/PickTools">
<file>selection-tube.png</file>
<file>selection-box.png</file>
<file>selection-circle.png</file>
<file>selection-pointer.png</file>
<file>selection-text.png</file>
<file>selection-peak.png</file>
</qresource>
<qresource prefix="/MaskTools">
<file>selection-pointer.png</file>
<file>selection-circle.png</file>
<file>selection-box.png</file>
</qresource>
<qresource prefix="/">
<file>pvIcon.png</file>
<file>MantidSplashScreen.png</file>
<file>MantidPlot_Icon_32offset.png</file>
<file>SNS_logo_trans_back.gif</file>
<file>Tessella_Logo_Transparent.gif</file>
<file>Mantid_Logo_Transparent_Cropped.png</file>
<file>HFIR_logo_small.png</file>
<file>ISIS_Logo_Transparent.gif</file>
<file>Mantid_Logo_Transparent.png</file>
<file>data_replace.png</file>
</qresource>
<qresource prefix="/Icons">
<file>LoadFile.png</file>
</qresource>
<qresource prefix="/PickTools">
<file>selection-tube.png</file>
<file>selection-box.png</file>
<file>selection-circle.png</file>
<file>selection-pointer.png</file>
<file>selection-text.png</file>
<file>selection-peak.png</file>
<file>selection-peaks.png</file>
<file>shape-pointer.png</file>
</qresource>
<qresource prefix="/MaskTools">
<file>selection-pointer.png</file>
<file>selection-circle.png</file>
<file>selection-box.png</file>
</qresource>
</RCC>
Binary file added Code/Mantid/Images/selection-peaks.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions Code/Mantid/MantidPlot/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ set ( MANTID_SRCS src/Mantid/AbstractMantidLog.cpp
src/Mantid/InstrumentWidget/InstrumentTreeModel.cpp
src/Mantid/InstrumentWidget/InstrumentTreeWidget.cpp
src/Mantid/InstrumentWidget/InstrumentWindow.cpp
src/Mantid/InstrumentWidget/InstrumentWindowTab.cpp
src/Mantid/InstrumentWidget/InstrumentWindowRenderTab.cpp
src/Mantid/InstrumentWidget/InstrumentWindowPickTab.cpp
src/Mantid/InstrumentWidget/InstrumentWindowMaskTab.cpp
Expand All @@ -219,7 +220,6 @@ set ( MANTID_SRCS src/Mantid/AbstractMantidLog.cpp
src/Mantid/InstrumentWidget/PeakOverlay.cpp
src/Mantid/InstrumentWidget/OneCurvePlot.cpp
src/Mantid/InstrumentWidget/CollapsiblePanel.cpp
src/Mantid/InstrumentWidget/DetSelector.cpp
src/Mantid/InstrumentWidget/XIntegrationControl.cpp
src/Mantid/InstrumentWidget/Shape2D.cpp
src/Mantid/InstrumentWidget/Shape2DCollection.cpp
Expand Down Expand Up @@ -425,6 +425,7 @@ set ( MANTID_HDRS src/Mantid/AbstractMantidLog.h
src/Mantid/InstrumentWidget/InstrumentTreeModel.h
src/Mantid/InstrumentWidget/InstrumentTreeWidget.h
src/Mantid/InstrumentWidget/InstrumentWindow.h
src/Mantid/InstrumentWidget/InstrumentWindowTab.h
src/Mantid/InstrumentWidget/InstrumentWindowRenderTab.h
src/Mantid/InstrumentWidget/InstrumentWindowPickTab.h
src/Mantid/InstrumentWidget/InstrumentWindowMaskTab.h
Expand All @@ -443,7 +444,6 @@ set ( MANTID_HDRS src/Mantid/AbstractMantidLog.h
src/Mantid/InstrumentWidget/Projection3D.h
src/Mantid/InstrumentWidget/OneCurvePlot.h
src/Mantid/InstrumentWidget/CollapsiblePanel.h
src/Mantid/InstrumentWidget/DetSelector.h
src/Mantid/InstrumentWidget/XIntegrationControl.h
src/Mantid/InstrumentWidget/Shape2D.h
src/Mantid/InstrumentWidget/Shape2DCollection.h
Expand Down Expand Up @@ -672,6 +672,7 @@ set ( MANTID_MOC_FILES src/Mantid/AlgorithmMonitor.h
src/Mantid/InstrumentWidget/InstrumentTreeModel.h
src/Mantid/InstrumentWidget/InstrumentTreeWidget.h
src/Mantid/InstrumentWidget/InstrumentWindow.h
src/Mantid/InstrumentWidget/InstrumentWindowTab.h
src/Mantid/InstrumentWidget/InstrumentWindowRenderTab.h
src/Mantid/InstrumentWidget/InstrumentWindowPickTab.h
src/Mantid/InstrumentWidget/InstrumentWindowMaskTab.h
Expand Down
57 changes: 0 additions & 57 deletions Code/Mantid/MantidPlot/src/Mantid/InstrumentWidget/DetSelector.cpp

This file was deleted.

68 changes: 0 additions & 68 deletions Code/Mantid/MantidPlot/src/Mantid/InstrumentWidget/DetSelector.h

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -441,9 +441,11 @@ void InstrumentWindow::setSurfaceType(int type)
setSurface(surface);
// make sure to switch to the right instrument display
selectOpenGLDisplay( useOpenGL );
m_renderTab->init();
m_pickTab->init();
m_maskTab->init();
// m_renderTab->init();
// m_pickTab->init();
// m_maskTab->init();
InstrumentWindowTab* tab = dynamic_cast<InstrumentWindowTab*>(mControlsTab->currentWidget());
if ( tab ) tab->initOnShow();

connect(surface,SIGNAL(singleDetectorTouched(int)),this,SLOT(singleDetectorTouched(int)));
connect(surface,SIGNAL(singleDetectorPicked(int)),this,SLOT(singleDetectorPicked(int)));
Expand Down Expand Up @@ -526,6 +528,8 @@ void InstrumentWindow::tabChanged(int i)
m_instrumentActor->accept(SetAllVisibleVisitor());
}
setInfoText(surface->getInfoText());
InstrumentWindowTab* tab = dynamic_cast<InstrumentWindowTab*>(mControlsTab->widget(i));
if ( tab ) tab->initOnShow();
updateInstrumentView();
}

Expand Down Expand Up @@ -971,7 +975,7 @@ void InstrumentWindow::showEvent(QShowEvent* e)

QWidget * InstrumentWindow::createInstrumentTreeTab(QTabWidget* ControlsTab)
{
QWidget* instrumentTree=new QWidget(ControlsTab);
InstrumentWindowTab* instrumentTree=new InstrumentWindowTab(ControlsTab);
QVBoxLayout* instrumentTreeLayout=new QVBoxLayout(instrumentTree);
//Tree Controls
mInstrumentTree = new InstrumentTreeWidget(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
#include <algorithm>

InstrumentWindowMaskTab::InstrumentWindowMaskTab(InstrumentWindow* instrWindow):
QFrame(instrWindow),
InstrumentWindowTab(instrWindow),
m_instrumentWindow(instrWindow),
m_activity(Select),
m_hasMaskToApply(false),
Expand Down Expand Up @@ -170,7 +170,7 @@ m_userEditing(true)

}

void InstrumentWindowMaskTab::init()
void InstrumentWindowMaskTab::initOnShow()
{
connect(m_instrumentWindow->getSurface(),SIGNAL(shapeCreated()),this,SLOT(shapeCreated()));
connect(m_instrumentWindow->getSurface(),SIGNAL(shapeSelected()),this,SLOT(shapeSelected()));
Expand All @@ -186,36 +186,36 @@ void InstrumentWindowMaskTab::setActivity()
if (m_move->isChecked())
{
m_activity = Move;
m_instrumentWindow->getSurface()->setInteractionModeMove();
m_instrumentWindow->getSurface()->setInteractionMode(ProjectionSurface::MoveMode);
}
else if (m_pointer->isChecked())
{
m_activity = Select;
m_instrumentWindow->getSurface()->setInteractionModeDraw();
m_instrumentWindow->getSurface()->setInteractionMode(ProjectionSurface::DrawMode);
}
else if (m_ellipse->isChecked())
{
m_activity = DrawEllipse;
m_instrumentWindow->getSurface()->startCreatingShape2D("ellipse",borderColor,fillColor);
m_instrumentWindow->getSurface()->setInteractionModeDraw();
m_instrumentWindow->getSurface()->setInteractionMode(ProjectionSurface::DrawMode);
}
else if (m_rectangle->isChecked())
{
m_activity = DrawEllipse;
m_instrumentWindow->getSurface()->startCreatingShape2D("rectangle",borderColor,fillColor);
m_instrumentWindow->getSurface()->setInteractionModeDraw();
m_instrumentWindow->getSurface()->setInteractionMode(ProjectionSurface::DrawMode);
}
else if (m_ring_ellipse->isChecked())
{
m_activity = DrawEllipse;
m_instrumentWindow->getSurface()->startCreatingShape2D("ring ellipse",borderColor,fillColor);
m_instrumentWindow->getSurface()->setInteractionModeDraw();
m_instrumentWindow->getSurface()->setInteractionMode(ProjectionSurface::DrawMode);
}
else if (m_ring_rectangle->isChecked())
{
m_activity = DrawEllipse;
m_instrumentWindow->getSurface()->startCreatingShape2D("ring rectangle",borderColor,fillColor);
m_instrumentWindow->getSurface()->setInteractionModeDraw();
m_instrumentWindow->getSurface()->setInteractionMode(ProjectionSurface::DrawMode);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#ifndef INSTRUMENTWINDOWMASKTAB_H_
#define INSTRUMENTWINDOWMASKTAB_H_

#include "InstrumentWindowTab.h"
#include "MantidGLWidget.h"
#include "DetSelector.h"

#include <QFrame>
#include <QMap>
Expand Down Expand Up @@ -43,13 +43,13 @@ namespace Mantid
/**
* Implements the Mask tab in InstrumentWindow
*/
class InstrumentWindowMaskTab: public QFrame
class InstrumentWindowMaskTab: public InstrumentWindowTab
{
Q_OBJECT
public:
enum Activity {Move = 0, Select = 1, DrawEllipse};
InstrumentWindowMaskTab(InstrumentWindow* instrWindow);
void init();
void initOnShow();
signals:
void executeAlgorithm(const QString&, const QString&);
protected slots:
Expand Down

0 comments on commit 956a6a9

Please sign in to comment.