Skip to content

Commit

Permalink
Revert "Re #6162. Added a new tool button to Pick Tab"
Browse files Browse the repository at this point in the history
This reverts commit 956a6a9.
  • Loading branch information
mantid-roman committed Dec 3, 2012
1 parent 0e844c9 commit 00244cf
Show file tree
Hide file tree
Showing 22 changed files with 311 additions and 162 deletions.
15 changes: 3 additions & 12 deletions Code/Mantid/Framework/DataObjects/src/PeaksWorkspace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,7 @@ 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 @@ -203,10 +200,7 @@ 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 @@ -217,10 +211,7 @@ 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: 28 additions & 30 deletions Code/Mantid/Images/images.qrc
Original file line number Diff line number Diff line change
@@ -1,32 +1,30 @@
<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>
<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>
<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>
</RCC>
Binary file removed Code/Mantid/Images/selection-peaks.png
Binary file not shown.
5 changes: 2 additions & 3 deletions Code/Mantid/MantidPlot/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,6 @@ 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 @@ -220,6 +219,7 @@ 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,7 +425,6 @@ 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 @@ -444,6 +443,7 @@ 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,7 +672,6 @@ 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: 57 additions & 0 deletions Code/Mantid/MantidPlot/src/Mantid/InstrumentWidget/DetSelector.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
//--------------------------------
// Includes
//--------------------------------
#include "DetSelector.h"
#include "MantidKernel/System.h"

#include <QPainter>
#include <algorithm>

DetSelector::DetSelector():
m_xStart(0),m_yStart(0),m_inProgress(false),m_color(Qt::blue)
{
}

void DetSelector::draw(QPainter& painter)
{
UNUSED_ARG(painter);
}

DetSelector* DetSelector::create(DetSelectionType type)
{
switch(type)
{
case Single:
return new DetSelector();
default:
return new BoxDetSelector();
};
}

void DetSelector::start(int x, int y)
{
m_xStart = x;
m_yStart = y;
m_inProgress = true;
}

void DetSelector::stop()
{
m_inProgress = false;
}

void BoxDetSelector::draw(QPainter& painter)
{
if (!m_inProgress) return;
painter.setPen(m_color);
painter.drawRect(m_xStart,m_yStart,m_xEnd,m_yEnd);
}

void BoxDetSelector::move(int x, int y)
{
if (!m_inProgress) return;
m_xEnd = x;
m_yEnd = y;
if (m_xEnd < m_xStart) std::swap(m_xEnd,m_xStart);
if (m_yEnd < m_yStart) std::swap(m_yEnd,m_yStart);
}
68 changes: 68 additions & 0 deletions Code/Mantid/MantidPlot/src/Mantid/InstrumentWidget/DetSelector.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#ifndef DETSELECTOR_H_
#define DETSELECTOR_H_

#include <QColor>
/**
\class DetSelector
\brief class to pick group of detectors
\author Roman Tolchenov
\date 10 Feb 2011
Copyright &copy; 2007 ISIS Rutherford Appleton Laboratory & NScD Oak Ridge National Laboratory
This file is part of Mantid.
Mantid is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
Mantid is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
File change history is stored at: <https://github.com/mantidproject/mantid>
*/

class QPainter;

/**
* Enumerates the ways teh detectors can be selected.
* SingleDetectorSelection separates ways of selecting a single detector from
* those of groups of detectors
*/
enum DetSelectionType {Single=0,Peak,SingleDetectorSelection,BoxType,Tube};

class DetSelector
{
public:
DetSelector(); ///< Constructor
virtual ~DetSelector(){} ///< Destructor
virtual void draw(QPainter& painter);
virtual void start(int x, int y);
virtual void move(int , int ){}
virtual void stop();
static DetSelector* create(DetSelectionType type);
protected:
int m_xStart;
int m_yStart;
bool m_inProgress;
QColor m_color;
};

class BoxDetSelector: public DetSelector
{
public:
void draw(QPainter& painter);
void move(int x, int y);
protected:
int m_xEnd;
int m_yEnd;
};

#endif /*DETSELECTOR_H_*/

Original file line number Diff line number Diff line change
Expand Up @@ -441,11 +441,9 @@ 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();
InstrumentWindowTab* tab = dynamic_cast<InstrumentWindowTab*>(mControlsTab->currentWidget());
if ( tab ) tab->initOnShow();
m_renderTab->init();
m_pickTab->init();
m_maskTab->init();

connect(surface,SIGNAL(singleDetectorTouched(int)),this,SLOT(singleDetectorTouched(int)));
connect(surface,SIGNAL(singleDetectorPicked(int)),this,SLOT(singleDetectorPicked(int)));
Expand Down Expand Up @@ -528,8 +526,6 @@ 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 @@ -975,7 +971,7 @@ void InstrumentWindow::showEvent(QShowEvent* e)

QWidget * InstrumentWindow::createInstrumentTreeTab(QTabWidget* ControlsTab)
{
InstrumentWindowTab* instrumentTree=new InstrumentWindowTab(ControlsTab);
QWidget* instrumentTree=new QWidget(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):
InstrumentWindowTab(instrWindow),
QFrame(instrWindow),
m_instrumentWindow(instrWindow),
m_activity(Select),
m_hasMaskToApply(false),
Expand Down Expand Up @@ -170,7 +170,7 @@ m_userEditing(true)

}

void InstrumentWindowMaskTab::initOnShow()
void InstrumentWindowMaskTab::init()
{
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()->setInteractionMode(ProjectionSurface::MoveMode);
m_instrumentWindow->getSurface()->setInteractionModeMove();
}
else if (m_pointer->isChecked())
{
m_activity = Select;
m_instrumentWindow->getSurface()->setInteractionMode(ProjectionSurface::DrawMode);
m_instrumentWindow->getSurface()->setInteractionModeDraw();
}
else if (m_ellipse->isChecked())
{
m_activity = DrawEllipse;
m_instrumentWindow->getSurface()->startCreatingShape2D("ellipse",borderColor,fillColor);
m_instrumentWindow->getSurface()->setInteractionMode(ProjectionSurface::DrawMode);
m_instrumentWindow->getSurface()->setInteractionModeDraw();
}
else if (m_rectangle->isChecked())
{
m_activity = DrawEllipse;
m_instrumentWindow->getSurface()->startCreatingShape2D("rectangle",borderColor,fillColor);
m_instrumentWindow->getSurface()->setInteractionMode(ProjectionSurface::DrawMode);
m_instrumentWindow->getSurface()->setInteractionModeDraw();
}
else if (m_ring_ellipse->isChecked())
{
m_activity = DrawEllipse;
m_instrumentWindow->getSurface()->startCreatingShape2D("ring ellipse",borderColor,fillColor);
m_instrumentWindow->getSurface()->setInteractionMode(ProjectionSurface::DrawMode);
m_instrumentWindow->getSurface()->setInteractionModeDraw();
}
else if (m_ring_rectangle->isChecked())
{
m_activity = DrawEllipse;
m_instrumentWindow->getSurface()->startCreatingShape2D("ring rectangle",borderColor,fillColor);
m_instrumentWindow->getSurface()->setInteractionMode(ProjectionSurface::DrawMode);
m_instrumentWindow->getSurface()->setInteractionModeDraw();
}
}

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 InstrumentWindowTab
class InstrumentWindowMaskTab: public QFrame
{
Q_OBJECT
public:
enum Activity {Move = 0, Select = 1, DrawEllipse};
InstrumentWindowMaskTab(InstrumentWindow* instrWindow);
void initOnShow();
void init();
signals:
void executeAlgorithm(const QString&, const QString&);
protected slots:
Expand Down

0 comments on commit 00244cf

Please sign in to comment.