本文整理汇总了C++中MultiLayer::applicationWindow方法的典型用法代码示例。如果您正苦于以下问题:C++ MultiLayer::applicationWindow方法的具体用法?C++ MultiLayer::applicationWindow怎么用?C++ MultiLayer::applicationWindow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MultiLayer
的用法示例。
在下文中一共展示了MultiLayer::applicationWindow方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init
/**
* @param g :: The Graph widget which will display the curve
* @param distr :: True if this is a distribution,
* not applicable here.
* @param style :: The graph style to use
* @param multipleSpectra :: True if there are multiple spectra,
* not applicable here.
*/
void MantidMDCurve::init(Graph *g, bool distr, GraphOptions::CurveType style,
bool multipleSpectra) {
UNUSED_ARG(distr);
UNUSED_ARG(multipleSpectra);
IMDWorkspace_const_sptr ws = boost::dynamic_pointer_cast<IMDWorkspace>(
AnalysisDataService::Instance().retrieve(m_wsName.toStdString()));
if (!ws) {
std::string message =
"Could not extract IMDWorkspace of name: " + m_wsName.toStdString();
throw std::runtime_error(message);
}
if (ws->getNonIntegratedDimensions().size() != 1) {
std::string message = "This plot only applies to MD Workspaces with a "
"single expanded dimension";
throw std::invalid_argument(message);
}
this->setTitle(m_wsName + "-signal");
const bool log = g->isLog(QwtPlot::yLeft);
MantidQwtIMDWorkspaceData data(ws, log);
setData(data);
int lineWidth = 1;
MultiLayer *ml = dynamic_cast<MultiLayer *>(g->parent()->parent()->parent());
if (ml && (style == GraphOptions::Unspecified ||
ml->applicationWindow()->applyCurveStyleToMantid)) {
// FIXME: Style HorizontalSteps does NOT seem to be applied
applyStyleChoice(style, ml, lineWidth);
} else {
setStyle(QwtPlotCurve::Lines);
}
g->insertCurve(this, lineWidth);
// set the option to draw all error bars from the global settings
if (hasErrorBars()) {
setErrorBars(true, g->multiLayer()->applicationWindow()->drawAllErrors);
}
// Initialise error bar colour to match curve colour
m_errorSettings->m_color = pen().color();
m_errorSettings->setWidth(pen().widthF());
connect(g, SIGNAL(axisScaleChanged(int, bool)), this,
SLOT(axisScaleChanged(int, bool)));
observePostDelete();
connect(this, SIGNAL(resetData(const QString &)), this,
SLOT(dataReset(const QString &)));
observeAfterReplace();
observeADSClear();
}
示例2: init
/**
* @param g :: The Graph widget which will display the curve
* @param distr :: True for a distribution
* @param style :: The curve type to use
*/
void MantidMatrixCurve::init(Graph *g, bool distr,
GraphOptions::CurveType style) {
// Will throw if name not found but return NULL ptr if the type is incorrect
MatrixWorkspace_const_sptr workspace =
AnalysisDataService::Instance().retrieveWS<MatrixWorkspace>(
m_wsName.toStdString());
if (!workspace) // The respective *Data classes will check for index validity
{
std::stringstream ss;
ss << "Workspace named '" << m_wsName.toStdString()
<< "' found but it is not a MatrixWorkspace. ID='"
<< AnalysisDataService::Instance().retrieve(m_wsName.toStdString())->id()
<< "'";
throw std::invalid_argument(ss.str());
}
// Set the curve name if it the non-naming constructor was called
if (this->title().isEmpty()) {
// If there's only one spectrum in the workspace, title is simply workspace
// name
if (workspace->getNumberHistograms() == 1)
this->setTitle(m_wsName);
else
this->setTitle(createCurveName(workspace));
}
Mantid::API::MatrixWorkspace_const_sptr matrixWS =
boost::dynamic_pointer_cast<const Mantid::API::MatrixWorkspace>(
workspace);
// we need to censor the data if there is a log scale because it can't deal
// with negative values, only the y-axis has been found to be problem so far
const bool log = g->isLog(QwtPlot::yLeft);
// Y units are the same for both spectrum and bin plots, e.g. counts
m_yUnits.reset(new Mantid::Kernel::Units::Label(matrixWS->YUnit(),
matrixWS->YUnitLabel()));
if (m_indexType == Spectrum) // Spectrum plot
{
QwtWorkspaceSpectrumData data(*matrixWS, m_index, log, distr);
setData(data);
// For spectrum plots, X axis are actual X axis, e.g. TOF
m_xUnits = matrixWS->getAxis(0)->unit();
} else // Bin plot
{
QwtWorkspaceBinData data(*matrixWS, m_index, log);
setData(data);
// For bin plots, X axis are "spectra axis", e.g. spectra numbers
m_xUnits = matrixWS->getAxis(1)->unit();
}
if (!m_xUnits) {
m_xUnits.reset(new Mantid::Kernel::Units::Empty());
}
int lineWidth = 1;
MultiLayer *ml = dynamic_cast<MultiLayer *>(g->parent()->parent()->parent());
if (ml && (style == GraphOptions::Unspecified ||
ml->applicationWindow()->applyCurveStyleToMantid)) {
applyStyleChoice(style, ml, lineWidth);
} else if (matrixWS->isHistogramData() && !matrixWS->isDistribution()) {
setStyle(QwtPlotCurve::Steps);
setCurveAttribute(
Inverted,
true); // this is the Steps style modifier that makes horizontal steps
} else {
setStyle(QwtPlotCurve::Lines);
}
g->insertCurve(this, lineWidth);
// set the option to draw all error bars from the global settings
if (hasErrorBars()) {
setErrorBars(true, g->multiLayer()->applicationWindow()->drawAllErrors);
}
// Initialise error bar colour to match curve colour
m_errorSettings->m_color = pen().color();
m_errorSettings->setWidth(pen().widthF());
connect(g, SIGNAL(axisScaleChanged(int, bool)), this,
SLOT(axisScaleChanged(int, bool)));
observePostDelete();
connect(this, SIGNAL(resetData(const QString &)), this,
SLOT(dataReset(const QString &)));
observeAfterReplace();
observeADSClear();
}