Skip to content
Snippets Groups Projects
Commit dd1b3b54 authored by Michael Reuter's avatar Michael Reuter
Browse files

Refs #4310. Begin collecting information for XML.

The signal is now wired up to the cut indicator context menu, so now the
information gathering has begun. Workspace name and geometry at gathers. Need
to create a cut plane.
parent e2efeabf
No related branches found
No related tags found
No related merge requests found
add_subdirectory( QtWidgets )
include_directories( QtWidgets/inc )
set_mantid_subprojects( Vates/VatesAPI )
add_subdirectory( ViewWidgets )
include_directories( ViewWidgets/inc )
......
......@@ -84,6 +84,7 @@ pqApplicationComponents
pqComponents
${QT_LIBRARIES}
MantidQtAPI
VatesAPI
)
install( TARGETS VatesSimpleGuiViewWidgets ${TARGET_TYPE} DESTINATION ${PLUGINS_DIR} )
......@@ -125,6 +125,8 @@ protected slots:
void makeZcut(double value);
/// Select the appropriate indicator on the correct axis interactor widget.
void selectIndicator();
/// Launch SliceViewer with the specified cut.
void showCutInSliceViewer(const QString &name);
/**
* Update the origin position of the currently selected cut.
* @param position the origin coordinate to move the emitting slice to
......
......@@ -5,6 +5,8 @@
#include "MantidVatesSimpleGuiQtWidgets/GeometryParser.h"
#include "MantidVatesSimpleGuiQtWidgets/ScalePicker.h"
#include "MantidVatesAPI/RebinningKnowledgeSerializer.h"
#include <pqActiveObjects.h>
#include <pqApplicationCore.h>
#include <pqChartValue.h>
......@@ -27,6 +29,8 @@
#include <vtkSMProxy.h>
#include <vtkSMViewProxy.h>
#include <vtkSMPropertyIterator.h>
#include <QModelIndex>
#include <QString>
......@@ -106,6 +110,19 @@ MultiSliceView::MultiSliceView(QWidget *parent) : ViewBase(parent)
SIGNAL(showOrHideIndicator(bool, const QString &)),
this, SLOT(cutVisibility(bool, const QString &)));
QObject::connect(this->ui.xAxisWidget,
SIGNAL(showInSliceView(const QString &)),
this,
SLOT(showCutInSliceViewer(const QString &)));
QObject::connect(this->ui.yAxisWidget,
SIGNAL(showInSliceView(const QString &)),
this,
SLOT(showCutInSliceViewer(const QString &)));
QObject::connect(this->ui.zAxisWidget,
SIGNAL(showInSliceView(const QString &)),
this,
SLOT(showCutInSliceViewer(const QString &)));
this->ui.xAxisWidget->installEventFilter(this);
this->ui.yAxisWidget->installEventFilter(this);
this->ui.zAxisWidget->installEventFilter(this);
......@@ -550,6 +567,56 @@ void MultiSliceView::checkSliceViewCompat()
}
}
/**
* This function is responsible for opening the given cut in SliceViewer.
* It will gather all of the necessary information and create an XML
* representation of the current dataset and cut parameters. That will then
* be handed to the SliceViewer.
* @param name the slice to be opened in SliceViewer
*/
void MultiSliceView::showCutInSliceViewer(const QString &name)
{
std::cout << name.toStdString() << " to be shown." << std::endl;
// Get the associated workspace name
pqServerManagerModel *smModel = pqApplicationCore::instance()->getServerManagerModel();
QList<pqPipelineSource *> srcs = smModel->findItems<pqPipelineSource *>();
pqPipelineSource *src1 = NULL;
foreach (pqPipelineSource *src, srcs)
{
const QString name = src->getSMName();
if (name.contains("MDEWRebinningCutter"))
{
src1 = src;
}
}
if (NULL == src1)
{
src1 = this->origSrc;
}
QString wsName(vtkSMPropertyHelper(src1->getProxy(),
"WorkspaceName",
true).GetAsString());
// Get the current dataset characteristics
const char *geomXML = vtkSMPropertyHelper(src1->getProxy(),
"InputGeometryXML").GetAsString();
// Get the necessary information from the cut
pqPipelineSource *cut = smModel->findItem<pqPipelineSource *>(name);
vtkSMProxy *plane = vtkSMPropertyHelper(cut->getProxy(),
"CutFunction").GetAsProxy();
double origin[3];
vtkSMPropertyHelper(plane, "Origin").Get(origin, 3);
double orient[3];
vtkSMPropertyHelper(plane, "Normal").Get(orient, 3);
// Create the XML holder
VATES::RebinningKnowledgeSerializer rks(VATES::LocationNotRequired);
rks.setWorkspaceName(wsName.toStdString());
rks.setGeometryXML(geomXML);
}
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment