ConcretePeaksPresenter.h 4.05 KB
Newer Older
1
2
#ifndef MANTID_SLICEVIEWER_CONCRETEPEAKSPRESENTER_H_
#define MANTID_SLICEVIEWER_CONCRETEPEAKSPRESENTER_H_
Owen Arnold's avatar
Owen Arnold committed
3
4
#include "MantidGeometry/Crystal/PeakTransform.h"
#include "MantidGeometry/Crystal/PeakTransformFactory.h"
5
#include "MantidQtSliceViewer/PeaksPresenter.h"
6
#include "MantidQtSliceViewer/PeakOverlayViewFactory.h"
7
8
#include "MantidAPI/MDGeometry.h"
#include "MantidAPI/IPeaksWorkspace.h"
9
#include "MantidKernel/SpecialCoordinateSystem.h"
Owen Arnold's avatar
Owen Arnold committed
10
#include "MantidKernel/V3D.h"
11
#include <vector>
Owen Arnold's avatar
Owen Arnold committed
12
#include <boost/shared_ptr.hpp>
13

Owen Arnold's avatar
Owen Arnold committed
14
15
16
17
namespace MantidQt {
namespace SliceViewer {
/// Alias for Vector of Peak Overlay Views
typedef std::vector<boost::shared_ptr<PeakOverlayView>> VecPeakOverlayView;
18

Owen Arnold's avatar
Owen Arnold committed
19
20
/// Coordinate System Enum to String.
std::string DLLExport
21
    coordinateToString(Mantid::Kernel::SpecialCoordinateSystem coordSystem);
22

Owen Arnold's avatar
Owen Arnold committed
23
24
/*---------------------------------------------------------
ConcretePeaksPresenter
25

Owen Arnold's avatar
Owen Arnold committed
26
27
28
29
30
31
32
33
Concrete implmentation of the Peaks presenter.
----------------------------------------------------------*/
class DLLExport ConcretePeaksPresenter : public PeaksPresenter {
public:
  ConcretePeaksPresenter(
      PeakOverlayViewFactory_sptr viewFactory,
      Mantid::API::IPeaksWorkspace_sptr peaksWS,
      boost::shared_ptr<Mantid::API::MDGeometry> mdWS,
Owen Arnold's avatar
Owen Arnold committed
34
      Mantid::Geometry::PeakTransformFactory_sptr transformFactory);
Owen Arnold's avatar
Owen Arnold committed
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
  void reInitialize(Mantid::API::IPeaksWorkspace_sptr peaksWS);
  virtual ~ConcretePeaksPresenter();
  virtual void update();
  virtual void updateWithSlicePoint(const PeakBoundingBox &slicePoint);
  virtual bool changeShownDim();
  virtual bool isLabelOfFreeAxis(const std::string &label) const;
  SetPeaksWorkspaces presentedWorkspaces() const;
  void setForegroundColor(const QColor);
  void setBackgroundColor(const QColor);
  std::string getTransformName() const;
  void setShown(const bool shown);
  virtual PeakBoundingBox getBoundingBox(const int) const;
  virtual void sortPeaksWorkspace(const std::string &byColumnName,
                                  const bool ascending);
  virtual void setPeakSizeOnProjection(const double fraction);
  virtual void setPeakSizeIntoProjection(const double fraction);
  virtual double getPeakSizeOnProjection() const;
  virtual double getPeakSizeIntoProjection() const;
  virtual void registerOwningPresenter(UpdateableOnDemand *owner);
  virtual bool getShowBackground() const;
  virtual QColor getBackgroundColor() const;
  virtual QColor getForegroundColor() const;
  virtual void zoomToPeak(const int index);
  virtual bool isHidden() const;
Owen Arnold's avatar
Owen Arnold committed
59
  virtual bool contentsDifferent(PeaksPresenter const *  other) const;
60

Owen Arnold's avatar
Owen Arnold committed
61
62
63
64
65
66
67
68
private:
  /// Peak overlay view.
  PeakOverlayView_sptr m_viewPeaks;
  /// View factory
  boost::shared_ptr<PeakOverlayViewFactory> m_viewFactory;
  /// Peaks workspace.
  boost::shared_ptr<const Mantid::API::IPeaksWorkspace> m_peaksWS;
  /// Transform factory
Owen Arnold's avatar
Owen Arnold committed
69
  boost::shared_ptr<Mantid::Geometry::PeakTransformFactory> m_transformFactory;
Owen Arnold's avatar
Owen Arnold committed
70
  /// Peak transformer
Owen Arnold's avatar
Owen Arnold committed
71
  Mantid::Geometry::PeakTransform_sptr m_transform;
Owen Arnold's avatar
Owen Arnold committed
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
  /// current slicing point.
  PeakBoundingBox m_slicePoint;
  /// Viewable Peaks
  std::vector<bool> m_viewablePeaks;
  /// Owning presenter.
  UpdateableOnDemand *m_owningPresenter;
  /// Flag to indicate that this is hidden.
  bool m_isHidden;
  /// Configure peak transformations
  bool configureMappingTransform();
  /// Hide all views
  void hideAll();
  /// Show all views
  void showAll();
  /// Determine wheter a dimension name corresponds to the free axis for the
  /// peaks workspace.
  bool isDimensionNameOfFreeAxis(const std::string &name) const;
  /// Switch between showing background radius or not
  void showBackgroundRadius(const bool show);
  /// Produce the views from the PeaksWorkspace
  void produceViews();
  /// Check workspace compatibilities.
  void checkWorkspaceCompatibilities(
      boost::shared_ptr<Mantid::API::MDGeometry> mdWS);
  /// Find peaks interacting with the slice and update the view.
  void doFindPeaksInRegion();
  /// make owner update.
  void informOwnerUpdate();
  /// initialize the setup
  void initialize();
};
}
104
105
}

106
#endif /* MANTID_SLICEVIEWER_CONCRETEPEAKSPRESENTER_H_ */