Skip to content
Snippets Groups Projects
_instrumentview.sip 8.01 KiB
Newer Older
%ModuleCode
#include "MantidQtWidgets/InstrumentView/InstrumentWidget.h"
// Allows suppression of namespaces within the module
using namespace MantidQt::MantidWidgets;
%End

%Include ../../../common_sip/exceptions.sip

%InitialisationCode
qRegisterMetaType<std::string>("StdString");
qRegisterMetaType<Mantid::API::Workspace_sptr>("Workspace");
%End

//----------------------------------------------------------------------------
// Classes
// ---------------------------------------------------------------------------


//------------------------------------------------
// InstrumentWidgetTab
//-------------------------------------------------
class InstrumentWidgetTab: QFrame
{
%TypeHeaderCode
#include "MantidQtWidgets/InstrumentView/InstrumentWidgetTab.h"
%End
public:
	// This is a duplicate from the same enum in InstrumentWidget, just so you
	// can do like InstrumentWidgetRenderTab.FULL3D
	enum SurfaceType { FULL3D, CYLINDRICAL_X, CYLINDRICAL_Y, CYLINDRICAL_Z,
                     SPHERICAL_X, SPHERICAL_Y, SPHERICAL_Z,
                     RENDERMODE_SIZE };
private:
  InstrumentWidgetTab(const InstrumentWidgetTab &);
};


//---------------------------------------------------
// InstrumentWidget
//---------------------------------------------------
class InstrumentWidget : QWidget {
%TypeHeaderCode
#include "MantidQtWidgets/InstrumentView/InstrumentWidget.h"
%End

  // Note this enum is also defined in InstrumentWidgetTab
  enum SurfaceType { FULL3D, CYLINDRICAL_X, CYLINDRICAL_Y, CYLINDRICAL_Z,
                     SPHERICAL_X, SPHERICAL_Y, SPHERICAL_Z,
                     RENDERMODE_SIZE };
  enum Tab { RENDER, PICK, MASK, TREE };


  // constructor
  InstrumentWidget(const QString &ws_name, QWidget *parent /TransferThis/ = 0,
                   bool reset_geometry = true, bool autoscaling = true,
                   double scale_min = 0.0, double scale_max = 0.0,
                   bool set_default_view = true) throw (std::runtime_error);
  bool overlay(const QString & ws_name);
  int getCurrentTab() const;
%Docstring
  Get the index of the current tab.
  It can be used with getTab(tab)

  Returns:
       an integer as the index of current tab
%End


  InstrumentWidgetTab * getTab(const QString & title) const;
%Docstring
    Returns a handler to the requested tab by tab name/title

    Args:

        title The full title of a tab in the window

    Returns:
        a pointer to the requested tab widget

%End

  // get tab (2)
  InstrumentWidgetTab * getTab(const Tab tab) const;
%Docstring
    Returns a handler to the requested tab by tab index

    Args:
        tab One of the Tab enumeration types:
	    InstrumentWidget.RENDER,InstrumentWidget.PICK,
	    InstrumentWidget.MASK,InstrumentWidget.TREE

    Returns:
        a pointer to the requested tab widget

%End

  // get render tab
  InstrumentWidgetRenderTab *getRenderTab(const Tab tab) const;
%Docstring
  InstrumentWidgetRenderTab *getRenderTab(const Tab tab) const
  ------------------------------------------------------------
      Get the handler to the 'RENDER' tab inside instrument view
      if the given tab is a Render tag

      Args:
        tab: One of the Tab enumeration types

      Returns:
          a pointer to the InstrumentWidgetRenderTab object.

%End

  // get pick tab
  InstrumentWidgetPickTab *getPickTab(const Tab tab) const;
%Docstring
  InstrumentWidgetRenderTab *getPickTab(const Tab tab) const
  ----------------------------------------------------------
     Get the handler to the 'PICK' tab inside instrument view
     if the given tab is a pick tag

    Args:
       tab: One of the Tab enumeration types

     Returns:
         a pointer to the InstrumentWidgetPickTab object.

%End
  // select tab
  void selectTab(Tab tab);
%Docstring
  void selectTab(Tab tab)
  ---------------------------------------------------------
   Select tab

   Args:
     tab: One of the Tab enumeration types

   Returns:
       a pointer to the InstrumentWidgetPickTab object.

  void setBinRange(double min_value, double max_value);
%Docstring
    void setBinRange(double min_value, double max_value)
    ----------------------------------------------------
    Updates the integration range over which the colours
    are calculated

    Args:
        min_value The minimum value over which the data is integrated
        max_value The maximum value over which the data is integrated
%End

class InstrumentWidgetEncoder {
%TypeHeaderCode
#include "MantidQtWidgets/InstrumentView/InstrumentWidgetEncoder.h"
%End
public:
  InstrumentWidgetEncoder();
  QMap<QString, QVariant> encode(const InstrumentWidget &obj,
                                 const QString &projectPath,
                                 const bool saveMask = true) /ReleaseGIL/;
class InstrumentWidgetDecoder : QObject{
%TypeHeaderCode
#include "MantidQtWidgets/InstrumentView/InstrumentWidgetDecoder.h"
%End
public:
  InstrumentWidgetDecoder();
  void decode(const QMap<QString, QVariant> &map,
              InstrumentWidget &obj,
              const QString &projectPath,
              const bool loadMask = true) /ReleaseGIL/;


// Render Tab
class InstrumentWidgetRenderTab: InstrumentWidgetTab
{
%TypeHeaderCode
#include "MantidQtWidgets/InstrumentView/InstrumentWidgetRenderTab.h"
%End

public:

  // set surface type
  void setSurfaceType(int index);
%Docstring
    Set the surface type of the current window.

    Args:
        type A known suface type: FULL3D, CYLINDRICAL_X, CYLINDRICAL_Y,
                                  CYLINDRICAL_Z,SPHERICAL_X, SPHERICAL_Y,
                                  SPHERICAL_Z
%End

  void setMinValue(double value, bool apply);
    void setMinValue(double value, bool apply)
    ----------------------------------------------------
Zhang, Chen's avatar
Zhang, Chen committed
    Set minimum value on the colormap scale.

    Args:
        value: minimum value for the color bar
        apply: flag to apply the change other than color bar by sending singal out.
%End

    void setMaxValue(double value, bool apply);
%Docstring
    void setMaxValue(double value, bool apply)
    ----------------------------------------------------
Zhang, Chen's avatar
Zhang, Chen committed
    Set maximum value on the colormap scale.

    Args:
        value: maximum value for the color bar
        apply: flag to apply the change other than color bar by sending singal out.
%End

    void setRange(double minValue, double maxValue, bool apply);
%Docstring
    void setRange(double minValue, double maxValue, bool apply)
    -----------------------------------------------------------
    Set minimum and maximum values on the colormap scale.

    Args:
        minValue: minimum value for the color bar
        maxValue: maximum value for the color bar
        apply: flag to apply the change other than color bar by sending singal out.
%End

    void setLegendScaleType(int index);
%Docstring
    void setLegendScaleType(int index)
    ----------------------------------

    Args:
      index: valid option including [0, 1, 2] where
          0: Linear
          1: SymmetricLog10
          2: Power
%End

  // set Axis at Full 3D
  void setAxis(const QString &axisNameArg);
%Docstring
    void setAxis(const QString &axisNameArg)
    ----------------------------------------------------
    Set axis to plot in FULL3D surface type

    Args:
       axisNameAr: name of the Axis to plot against including (Z+, Z-, Y+, Y-, X+, X-)
%End

  // Enable/disable auto scaling checkbox
  void setColorMapAutoscaling(bool on);
%Docstring
    setColorMapAutoscaling(bool on)
    ----------------------------------------------------
    Enable or disable autoscaling option for color map

    Args:
       on: turn on or off autoscaling
%End

private:
  // constructors all private
  InstrumentWidgetRenderTab();
  InstrumentWidgetRenderTab(const InstrumentWidgetRenderTab &);

};

// Pick tab
class InstrumentWidgetPickTab: InstrumentWidgetTab
{
    %TypeHeaderCode
#include "MantidQtWidgets/InstrumentView/InstrumentWidgetPickTab.h"
    %End

    private:
        // constructors all private
        InstrumentWidgetPickTab();
        InstrumentWidgetPickTab(const InstrumentWidgetPickTab &);

};