Newer
Older
#ifndef MANTID_VATES_VTK_MD_HEX_FACTORY_H_
#define MANTID_VATES_VTK_MD_HEX_FACTORY_H_
Owen Arnold
committed
#include "MantidAPI/IMDEventWorkspace_fwd.h"
#include "MantidDataObjects/MDEventFactory.h"
#include "MantidDataObjects/MDEventWorkspace.h"
#include "MantidVatesAPI/Normalization.h"
Janik Zikovsky
committed
#include "MantidVatesAPI/ThresholdRange.h"
Owen Arnold
committed
#include "MantidVatesAPI/TimeToTimeStep.h"
#include "MantidVatesAPI/vtkDataSetFactory.h"
Owen Arnold
committed
#include <boost/shared_ptr.hpp>
Owen Arnold
committed
using Mantid::DataObjects::MDEventWorkspace;
Janik Zikovsky
committed
Owen Arnold
committed
/// Round up to next multiple of factor
coord_t DLLExport roundUp(const coord_t num_to_round, const coord_t factor);
/// Round down to previous multiple of factor
coord_t DLLExport roundDown(const coord_t num_to_round, const coord_t factor);
/** Class is used to generate vtkUnstructuredGrids from IMDEventWorkspaces.
Utilises the non-uniform nature of the underlying workspace grid/box structure
as the basis for generating visualisation cells. The recursion depth through the
box structure is configurable.
Owen Arnold
committed
@author Owen Arnold, Tessella plc
@date 27/July/2011
Copyright © 2010 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge
National Laboratory & European Spallation Source
Owen Arnold
committed
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>
Owen Arnold
committed
Code Documentation is available at: <http://doxygen.mantidproject.org>
*/
class DLLExport vtkMDHexFactory : public vtkDataSetFactory {
Owen Arnold
committed
public:
/// Constructor
vtkMDHexFactory(ThresholdRange_scptr thresholdRange,
const VisualNormalization normalizationOption,
const size_t maxDepth = 1000);
Owen Arnold
committed
/// Destructor
~vtkMDHexFactory() override;
Owen Arnold
committed
/// Factory Method. Should also handle delegation to successors.
vtkSmartPointer<vtkDataSet>
create(ProgressAction &progressUpdate) const override;
Owen Arnold
committed
/// Initalize with a target workspace.
void initialize(Mantid::API::Workspace_sptr) override;
Owen Arnold
committed
/// Get the name of the type.
std::string getFactoryTypeName() const override { return "vtkMDHexFactory"; }
Owen Arnold
committed
void setRecursionDepth(size_t depth) override;
Owen Arnold
committed
Owen Arnold
committed
/// Set the time value.
void setTime(double timeStep);
Owen Arnold
committed
private:
coord_t getNextBinBoundary(Mantid::API::IMDEventWorkspace_sptr imdws) const;
coord_t
getPreviousBinBoundary(Mantid::API::IMDEventWorkspace_sptr imdws) const;
Janik Zikovsky
committed
void doCreate(typename MDEventWorkspace<MDE, nd>::sptr ws) const;
Owen Arnold
committed
/// Template Method pattern to validate the factory before use.
void validate() const override;
Owen Arnold
committed
/// Threshold range strategy.
ThresholdRange_scptr m_thresholdRange;
/// Normalization option and info.
const VisualNormalization m_normalizationOption;
Owen Arnold
committed
/// Member workspace to generate vtkdataset from.
Mantid::API::Workspace_sptr m_workspace;
Owen Arnold
committed
/// Maximum recursion depth to use.
Owen Arnold
committed
size_t m_maxDepth;
Owen Arnold
committed
Janik Zikovsky
committed
/// Data set that will be generated
mutable vtkSmartPointer<vtkDataSet> dataSet;
Janik Zikovsky
committed
/// We are slicing down from > 3 dimensions
mutable bool slice;
/// Mask for choosing along which dimensions to slice
mutable std::unique_ptr<bool[]> sliceMask;
Janik Zikovsky
committed
/// Implicit function to define which boxes to render.
mutable boost::shared_ptr<Mantid::Geometry::MDImplicitFunction>
sliceImplicitFunction;
Janik Zikovsky
committed
Owen Arnold
committed
/// Time value.
double m_time;
Owen Arnold
committed
};
}
}