Skip to content

Commit

Permalink
Refs #5101. Added masked entry for MaskWorkspace data.
Browse files Browse the repository at this point in the history
This time Martin should be happier as there is an interface class in API so packages
stay as they were.
  • Loading branch information
peterfpeterson committed May 4, 2012
1 parent 3350bf0 commit 814e664
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 1 deletion.
1 change: 1 addition & 0 deletions Code/Mantid/Framework/API/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ set ( INC_FILES
inc/MantidAPI/IFunctionWithLocation.h
inc/MantidAPI/ILiveListener.h
inc/MantidAPI/ILocatedData.h
inc/MantidAPI/IMaskWorkspace.h
inc/MantidAPI/IMDEventWorkspace.h
inc/MantidAPI/IMDHistoWorkspace.h
inc/MantidAPI/IMDIterator.h
Expand Down
52 changes: 52 additions & 0 deletions Code/Mantid/Framework/API/inc/MantidAPI/IMaskWorkspace.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#ifndef MANTID_API_IMASKWORKSPACE_H_
#define MANTID_API_IMASKWORKSPACE_H_

#include "MantidAPI/MatrixWorkspace.h"

namespace Mantid
{
namespace API
{


/** This class provides an interface to a MaskWorkspace.
Copyright © 2010 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://svn.mantidproject.org/mantid/trunk/Code/Mantid>.
Code Documentation is available at: <http://doxygen.mantidproject.org>
*/
class DLLExport IMaskWorkspace
{
public:
/// Return the workspace typeID
virtual const std::string id() const { return "IMaskWorkspace"; }
/// Total number of masked pixels
virtual std::size_t getNumberMasked() const = 0;
};

///shared pointer to the matrix workspace base class
typedef boost::shared_ptr<IMaskWorkspace> IMaskWorkspace_sptr;
///shared pointer to the matrix workspace base class (const version)
typedef boost::shared_ptr<const IMaskWorkspace> IMaskWorkspace_const_sptr;


}
}

#endif //MANTID_API_IMASKWORKSPACE_H_
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef MANTID_DATAOBJECTS_MASKWORKSPACE_H
#define MANTID_DATAOBJECTS_MASKWORKSPACE_H

#include "MantidAPI/IMaskWorkspace.h"
#include "MantidAPI/MatrixWorkspace.h"
#include "MantidDataObjects/SpecialWorkspace2D.h"
#include "MantidDataObjects/Workspace2D.h"
Expand All @@ -11,7 +12,7 @@ namespace Mantid
namespace DataObjects
{

class DLLExport MaskWorkspace : public SpecialWorkspace2D
class DLLExport MaskWorkspace : public SpecialWorkspace2D, public API::IMaskWorkspace
{
public:
MaskWorkspace();
Expand Down
12 changes: 12 additions & 0 deletions Code/Mantid/MantidPlot/src/Mantid/MantidDock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <MantidAPI/AlgorithmFactory.h>
#include <MantidAPI/MemoryManager.h>
#include <MantidAPI/IEventWorkspace.h>
#include <MantidAPI/IMaskWorkspace.h>
#include <MantidAPI/IMDEventWorkspace.h>
#include <MantidAPI/IMDWorkspace.h>
#include "MantidAPI/IMDHistoWorkspace.h"
Expand Down Expand Up @@ -701,6 +702,17 @@ void MantidDockWidget::populateMatrixWorkspaceData(Mantid::API::MatrixWorkspace_
excludeItemFromSort(data_item);
ws_item->addChild(data_item);
}
else
{
if (workspace->id() == "MaskWorkspace")
{
IMaskWorkspace_sptr maskWS = boost::dynamic_pointer_cast<IMaskWorkspace>(workspace);
data_item = new MantidTreeWidgetItem(QStringList("Masked: " + QLocale(QLocale::English).toString(double(maskWS->getNumberMasked()), 'd', 0)), m_tree);
data_item->setFlags(Qt::NoItemFlags);
excludeItemFromSort(data_item);
ws_item->addChild(data_item);
}
}


//Extra stuff for EventWorkspace
Expand Down

0 comments on commit 814e664

Please sign in to comment.