本文整理汇总了C++中setProperty函数的典型用法代码示例。如果您正苦于以下问题:C++ setProperty函数的具体用法?C++ setProperty怎么用?C++ setProperty使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setProperty函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QLOG_DEBUG
void KonvergoWindow::handleHostCommand(QString hostCommand)
{
QLOG_DEBUG() << "Got command:" << hostCommand;
QString arguments = "";
int arguments_start = hostCommand.indexOf(":");
if (arguments_start > 0)
{
arguments = hostCommand.mid(arguments_start + 1);
hostCommand = hostCommand.mid(0, arguments_start);
}
if (hostCommand == "fullscreen")
{
SettingsComponent::Get().setValue(SETTINGS_SECTION_MAIN, "fullscreen", !SettingsComponent::Get().value(SETTINGS_SECTION_MAIN, "fullscreen").toBool());
}
else if (hostCommand == "close")
{
close();
}
else if (hostCommand == "player")
{
PlayerComponent::Get().userCommand(arguments);
}
else if (hostCommand == "toggleDebug")
{
if (property("showDebugLayer").toBool())
{
m_infoTimer->stop();
setProperty("showDebugLayer", false);
}
else
{
m_infoTimer->start();
updateDebugInfo();
setProperty("showDebugLayer", true);
}
}
else if (hostCommand == "recreateRpiUi")
{
DisplayManager* display_manager = DisplayComponent::Get().getDisplayManager();
if (display_manager)
display_manager->resetRendering();
}
else if (hostCommand == "reload")
{
emit reloadWebClient();
}
else if (hostCommand == "crash!")
{
*(volatile int*)0=0;
}
else if (hostCommand == "poweroff")
{
PowerComponent::Get().PowerOff();
}
else if (hostCommand == "suspend")
{
PowerComponent::Get().Suspend();
}
else if (hostCommand == "reboot")
{
PowerComponent::Get().Reboot();
}
else
{
QLOG_WARN() << "unknown host command" << hostCommand;
}
}
示例2: setProperty
void CSSMutableStyleDeclaration::setProperty(int propertyID, const String& value, bool important, ExceptionCode& ec)
{
setProperty(propertyID, value, important, true, ec);
}
示例3: setProperty
void
HrPwWindow::configChanged(qint32)
{
setProperty("color", GColor(CPLOTBACKGROUND));
}
示例4: HWSensorsFatalLog
bool PTIDSensors::start(IOService * provider)
{
if (!super::start(provider))
return false;
acpiDevice = (IOACPIPlatformDevice *)provider;
if (!acpiDevice) {
HWSensorsFatalLog("ACPI device not ready");
return false;
}
// On some computers (eg. RehabMan's ProBook 4530s), the system will hang on startup
// if kernel cache is used, because of the early call to updateTemperatures and/or
// updateTachometers. At least that is the case with an SSD and a valid pre-linked
// kernel, along with kernel cache enabled. This 1000ms sleep seems to fix the problem,
// enabling a clean boot with PTIDSensors enabled.
IOSleep(1000);
// Update timers
temperaturesLastUpdated = ptimer_read() - NSEC_PER_SEC;
tachometersLastUpdated = temperaturesLastUpdated;
acpiDevice->evaluateInteger("IVER", &version);
if (version == 0) {
OSString *name = OSDynamicCast(OSString, provider->getProperty("name"));
if (name && name->isEqualTo("INT3F0D"))
version = 0x30000;
else
return false;
}
setProperty("version", version, 64);
// Parse sensors
switch (version) {
case 0x30000: {
OSObject *object = NULL;
// Temperatures
if(kIOReturnSuccess == acpiDevice->evaluateObject("TSDL", &object) && object) {
if (OSArray *description = OSDynamicCast(OSArray, object)) {
HWSensorsDebugLog("Parsing temperatures...");
int count = description->getCount();
for (int i = 1; i < count; i += 2) {
parseTemperatureName(OSDynamicCast(OSString, description->getObject(i)), i/2);
}
}
}
else HWSensorsErrorLog("failed to evaluate TSDL table");
// Tachometers
if(kIOReturnSuccess == acpiDevice->evaluateObject("OSDL", &object) && object) {
if (OSArray *description = OSDynamicCast(OSArray, object)) {
HWSensorsDebugLog("Parsing tachometers...");
int count = description->getCount();
for (int i = 2; i < count; i += 3) {
parseTachometerName(OSDynamicCast(OSString, description->getObject(i)), OSDynamicCast(OSString, description->getObject(i-1)), i/3);
}
}
}
else HWSensorsErrorLog("failed to evaluate OSDL table");
break;
}
case 0x20001: {
OSObject *object = NULL;
// Temperatures
if (kIOReturnSuccess == acpiDevice->evaluateObject("TMPV", &object) && object) {
if (OSArray *description = OSDynamicCast(OSArray, object)) {
HWSensorsDebugLog("Parsing temperatures...");
int count = description->getCount();
for (int i = 1; i < count; i += 3) {
parseTemperatureName(OSDynamicCast(OSString, description->getObject(i)), i+1);
}
}
}
else HWSensorsErrorLog("failed to evaluate TMPV table");
// Tachometers
if (kIOReturnSuccess == acpiDevice->evaluateObject("OSDV", &object) && object) {
if (OSArray *description = OSDynamicCast(OSArray, object)) {
HWSensorsDebugLog("Parsing tachometers...");
int count = description->getCount();
for (int i = 2; i < count; i += 4) {
parseTachometerName(OSDynamicCast(OSString, description->getObject(i)), OSDynamicCast(OSString, description->getObject(i-1)), i+1);
}
}
}
else HWSensorsErrorLog("failed to evaluate OSDV table");
break;
}
//.........这里部分代码省略.........
示例5: toLamMonitor
/**
* Convert the TOF workspace into a monitor workspace. Crops to the monitorIndex and applying flat background correction as part of the process.
* @param toConvert : TOF wavlength to convert.
* @param monitorIndex : Monitor index to crop to
* @param backgroundMinMax : Min and Max Lambda range for Flat background correction.
* @return The cropped and corrected monitor workspace.
*/
MatrixWorkspace_sptr ReflectometryWorkflowBase::toLamMonitor(const MatrixWorkspace_sptr& toConvert,
const int monitorIndex, const MinMax& backgroundMinMax)
{
// Convert Units.
auto convertUnitsAlg = this->createChildAlgorithm("ConvertUnits");
convertUnitsAlg->initialize();
convertUnitsAlg->setProperty("InputWorkspace", toConvert);
convertUnitsAlg->setProperty("Target", "Wavelength");
convertUnitsAlg->setProperty("AlignBins", true);
convertUnitsAlg->execute();
// Crop the to the monitor index.
MatrixWorkspace_sptr monitorWS = convertUnitsAlg->getProperty("OutputWorkspace");
auto cropWorkspaceAlg = this->createChildAlgorithm("CropWorkspace");
cropWorkspaceAlg->initialize();
cropWorkspaceAlg->setProperty("InputWorkspace", monitorWS);
cropWorkspaceAlg->setProperty("StartWorkspaceIndex", monitorIndex);
cropWorkspaceAlg->setProperty("EndWorkspaceIndex", monitorIndex);
cropWorkspaceAlg->execute();
monitorWS = cropWorkspaceAlg->getProperty("OutputWorkspace");
// Flat background correction
auto correctMonitorsAlg = this->createChildAlgorithm("CalculateFlatBackground");
correctMonitorsAlg->initialize();
correctMonitorsAlg->setProperty("InputWorkspace", monitorWS);
correctMonitorsAlg->setProperty("WorkspaceIndexList",
boost::assign::list_of(0).convert_to_container<std::vector<int> >());
correctMonitorsAlg->setProperty("StartX", backgroundMinMax.get<0>());
correctMonitorsAlg->setProperty("EndX", backgroundMinMax.get<1>());
correctMonitorsAlg->setProperty("SkipMonitors",false);
correctMonitorsAlg->execute();
monitorWS = correctMonitorsAlg->getProperty("OutputWorkspace");
return monitorWS;
}
示例6: setFunction
/** Executes the algorithm
*
* @throw runtime_error Thrown if algorithm cannot execute
*/
void Fit::exec()
{
// this is to make it work with AlgorithmProxy
if (!m_domainCreator)
{
setFunction();
addWorkspaces();
}
std::string ties = getPropertyValue("Ties");
if (!ties.empty())
{
m_function->addTies(ties);
}
std::string contstraints = getPropertyValue("Constraints");
if (!contstraints.empty())
{
m_function->addConstraints(contstraints);
}
// prepare the function for a fit
m_function->setUpForFit();
API::FunctionDomain_sptr domain;
API::FunctionValues_sptr values; // TODO: should values be part of domain?
m_domainCreator->ignoreInvalidData(getProperty("IgnoreInvalidData"));
m_domainCreator->createDomain(domain,values);
// do something with the function which may depend on workspace
m_domainCreator->initFunction(m_function);
// get the minimizer
std::string minimizerName = getPropertyValue("Minimizer");
API::IFuncMinimizer_sptr minimizer = API::FuncMinimizerFactory::Instance().createMinimizer(minimizerName);
// Try to retrieve optional properties
const int maxIterations = getProperty("MaxIterations");
// get the cost function which must be a CostFuncFitting
boost::shared_ptr<CostFuncFitting> costFunc = boost::dynamic_pointer_cast<CostFuncFitting>(
API::CostFunctionFactory::Instance().create(getPropertyValue("CostFunction"))
);
costFunc->setFittingFunction(m_function,domain,values);
minimizer->initialize(costFunc);
const int64_t nsteps = maxIterations*m_function->estimateNoProgressCalls();
API::Progress prog(this,0.0,1.0,nsteps);
m_function->setProgressReporter(&prog);
// do the fitting until success or iteration limit is reached
size_t iter = 0;
bool success = false;
std::string errorString;
g_log.debug("Starting minimizer iteration\n");
while (static_cast<int>(iter) < maxIterations)
{
iter++;
g_log.debug() << "Starting iteration " << iter << "\n";
m_function->iterationStarting();
if ( !minimizer->iterate() )
{
errorString = minimizer->getError();
g_log.debug() << "Iteration stopped. Minimizer status string=" << errorString << "\n";
success = errorString.empty() || errorString == "success";
if (success)
{
errorString = "success";
}
break;
}
prog.report();
m_function->iterationFinished();
if(g_log.is(Kernel::Logger::Priority::PRIO_INFORMATION))
{
g_log.debug() << "Iteration " << iter << ", cost function = " << minimizer->costFunctionVal() << "\n";
}
}
g_log.debug() << "Number of minimizer iterations=" << iter << "\n";
if (static_cast<int>(iter) >= maxIterations)
{
if ( !errorString.empty() )
{
errorString += '\n';
}
errorString += "Failed to converge after " + boost::lexical_cast<std::string>(maxIterations) + " iterations.";
}
// return the status flag
setPropertyValue("OutputStatus",errorString);
// degrees of freedom
size_t dof = domain->size() - costFunc->nParams();
if (dof == 0) dof = 1;
//.........这里部分代码省略.........
示例7: getProperty
void ModeratorTzero::execEvent(const std::string &emode) {
g_log.information("Processing event workspace");
const MatrixWorkspace_const_sptr matrixInputWS =
getProperty("InputWorkspace");
// generate the output workspace pointer
API::MatrixWorkspace_sptr matrixOutputWS = getProperty("OutputWorkspace");
if (matrixOutputWS != matrixInputWS) {
matrixOutputWS = matrixInputWS->clone();
setProperty("OutputWorkspace", matrixOutputWS);
}
auto outputWS = boost::dynamic_pointer_cast<EventWorkspace>(matrixOutputWS);
// calculate tof shift once for all neutrons if emode==Direct
double t0_direct(-1);
if (emode == "Direct") {
Kernel::Property *eiprop = outputWS->run().getProperty("Ei");
double Ei = boost::lexical_cast<double>(eiprop->value());
mu::Parser parser;
parser.DefineVar("incidentEnergy", &Ei); // associate E1 to this parser
parser.SetExpr(m_formula);
t0_direct = parser.Eval();
}
const auto &spectrumInfo = outputWS->spectrumInfo();
const double Lss = spectrumInfo.l1();
// Loop over the spectra
const size_t numHists = static_cast<size_t>(outputWS->getNumberHistograms());
Progress prog(this, 0.0, 1.0, numHists); // report progress of algorithm
PARALLEL_FOR_IF(Kernel::threadSafe(*outputWS))
for (int i = 0; i < static_cast<int>(numHists); ++i) {
PARALLEL_START_INTERUPT_REGION
size_t wsIndex = static_cast<size_t>(i);
EventList &evlist = outputWS->getSpectrum(wsIndex);
if (evlist.getNumberEvents() > 0) // don't bother with empty lists
{
double L1(Lss); // distance from source to sample
double L2(-1); // distance from sample to detector
if (spectrumInfo.hasDetectors(i)) {
if (spectrumInfo.isMonitor(i)) {
// redefine the sample as the monitor
L1 = Lss + spectrumInfo.l2(i); // L2 in SpectrumInfo defined negative
L2 = 0;
} else {
L2 = spectrumInfo.l2(i);
}
} else {
g_log.error() << "Unable to calculate distances to/from detector" << i
<< '\n';
}
if (L2 >= 0) {
// One parser for each parallel processor needed (except Edirect mode)
double E1;
mu::Parser parser;
parser.DefineVar("incidentEnergy", &E1); // associate E1 to this parser
parser.SetExpr(m_formula);
// fast neutrons are shifted by min_t0_next, irrespective of tof
double v1_max = L1 / m_t1min;
E1 = m_convfactor * v1_max * v1_max;
double min_t0_next = parser.Eval();
if (emode == "Indirect") {
double t2(-1.0); // time from sample to detector. (-1) signals error
if (spectrumInfo.isMonitor(i)) {
t2 = 0.0;
} else {
static const double convFact =
1.0e-6 * sqrt(2 * PhysicalConstants::meV /
PhysicalConstants::NeutronMass);
std::vector<double> wsProp =
spectrumInfo.detector(i).getNumberParameter("Efixed");
if (!wsProp.empty()) {
double E2 = wsProp.at(0); //[E2]=meV
double v2 = convFact * sqrt(E2); //[v2]=meter/microsec
t2 = L2 / v2;
} else {
// t2 is kept to -1 if no Efixed is found
g_log.debug() << "Efixed not found for detector " << i << '\n';
}
}
if (t2 >= 0) // t2 < 0 when no detector info is available
{
// fix the histogram bins
auto &x = evlist.mutableX();
for (double &tof : x) {
if (tof < m_t1min + t2)
tof -= min_t0_next;
else
tof -= CalculateT0indirect(tof, L1, t2, E1, parser);
}
MantidVec tofs = evlist.getTofs();
for (double &tof : tofs) {
if (tof < m_t1min + t2)
tof -= min_t0_next;
//.........这里部分代码省略.........
示例8: QWidget
LoginPage::LoginPage(QWidget* parent)
: QWidget(parent)
, country_code_(new LineEditEx(this))
, phone_(new LineEditEx(this))
, combobox_(new CountrySearchCombobox(this))
, remaining_seconds_(0)
, timer_(new QTimer(this))
{
setStyleSheet(Utils::LoadStyle(":/main_window/login_page.qss", Utils::get_scale_coefficient(), true));
if (objectName().isEmpty())
setObjectName(QStringLiteral("login_page"));
setProperty("LoginPageWidget", QVariant(true));
QVBoxLayout* verticalLayout = new QVBoxLayout(this);
verticalLayout->setSpacing(0);
verticalLayout->setObjectName(QStringLiteral("verticalLayout"));
verticalLayout->setContentsMargins(0, 0, 0, 0);
auto back_button_widget = new QWidget(this);
auto back_button_layout = new QHBoxLayout(back_button_widget);
Utils::ApplyStyle(back_button_widget, "background-color: transparent;");
back_button_widget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
back_button_layout->setSpacing(0);
back_button_layout->setContentsMargins(Utils::scale_value(14), Utils::scale_value(14), 0, 0);
back_button_layout->setAlignment(Qt::AlignLeft);
{
prev_page_link_ = new BackButton(back_button_widget);
prev_page_link_->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
prev_page_link_->setFlat(true);
prev_page_link_->setFocusPolicy(Qt::NoFocus);
prev_page_link_->setCursor(Qt::PointingHandCursor);
{
const QString s = "QPushButton { width: 20dip; height: 20dip; border: none; background-color: transparent; border-image: url(:/resources/contr_back_100.png); margin: 10dip; } QPushButton:hover { border-image: url(:/resources/contr_back_100_hover.png); } QPushButton#back_button:pressed { border-image: url(:/resources/contr_back_100_active.png); }";
Utils::ApplyStyle(prev_page_link_, s);
}
back_button_layout->addWidget(prev_page_link_);
}
verticalLayout->addWidget(back_button_widget);
/*
QWidget* back_button_widget = new QWidget(this);
back_button_widget->setObjectName(QStringLiteral("back_button_widget"));
back_button_widget->setProperty("BackButtonWidget", QVariant(true));
QHBoxLayout* back_button_layout = new QHBoxLayout(back_button_widget);
back_button_layout->setSpacing(0);
back_button_layout->setObjectName(QStringLiteral("back_button_layout"));
back_button_layout->setContentsMargins(Utils::scale_value(14), Utils::scale_value(14), 0, 0);
prev_page_link_ = new BackButton(back_button_widget);
prev_page_link_->setObjectName(QStringLiteral("prev_page_link"));
prev_page_link_->setCursor(QCursor(Qt::PointingHandCursor));
prev_page_link_->setProperty("LoginBackButton", QVariant(true));
back_button_layout->addWidget(prev_page_link_);
QSpacerItem* horizontalSpacer_3 = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
back_button_layout->addItem(horizontalSpacer_3);
verticalLayout->addWidget(back_button_widget);
*/
QSpacerItem* verticalSpacer = new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
verticalLayout->addItem(verticalSpacer);
QWidget* main_widget = new QWidget(this);
main_widget->setObjectName(QStringLiteral("main_widget"));
QSizePolicy sizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding);
sizePolicy.setHorizontalStretch(0);
sizePolicy.setVerticalStretch(0);
sizePolicy.setHeightForWidth(main_widget->sizePolicy().hasHeightForWidth());
main_widget->setSizePolicy(sizePolicy);
main_widget->setProperty("CenterControlWidgetBack", QVariant(true));
QHBoxLayout* main_layout = new QHBoxLayout(main_widget);
main_layout->setSpacing(0);
main_layout->setObjectName(QStringLiteral("main_layout"));
main_layout->setContentsMargins(0, 0, 0, 0);
QSpacerItem* horizontalSpacer_6 = new QSpacerItem(0, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
main_layout->addItem(horizontalSpacer_6);
QWidget* controls_widget = new QWidget(main_widget);
controls_widget->setObjectName(QStringLiteral("controls_widget"));
QSizePolicy sizePolicy1(QSizePolicy::Minimum, QSizePolicy::Minimum);
sizePolicy1.setHorizontalStretch(0);
sizePolicy1.setVerticalStretch(0);
sizePolicy1.setHeightForWidth(controls_widget->sizePolicy().hasHeightForWidth());
controls_widget->setSizePolicy(sizePolicy1);
controls_widget->setProperty("CenterContolWidget", QVariant(true));
QVBoxLayout* controls_layout = new QVBoxLayout(controls_widget);
controls_layout->setSpacing(0);
controls_layout->setObjectName(QStringLiteral("controls_layout"));
controls_layout->setContentsMargins(0, 0, 0, 0);
PictureWidget* logo_widget = new PictureWidget(controls_widget, ":/resources/main_window/content_logo_100.png");
logo_widget->setFixedHeight(Utils::scale_value(80));
logo_widget->setFixedWidth(Utils::scale_value(80));
controls_layout->addWidget(logo_widget);
controls_layout->setAlignment(logo_widget, Qt::AlignHCenter);
QLabel* welcome_label = new QLabel(controls_widget);
welcome_label->setObjectName(QStringLiteral("welcome_label"));
welcome_label->setAlignment(Qt::AlignCenter);
welcome_label->setProperty("WelcomeTitle", QVariant(true));
//.........这里部分代码省略.........
示例9: UITaskMediumEnumeration
/** Constructs @a medium enumeration task. */
UITaskMediumEnumeration(const UIMedium &medium)
: UITask(UITask::Type_MediumEnumeration)
{
/* Store medium as property: */
setProperty("medium", QVariant::fromValue(medium));
}
示例10: setProperty
/**
* Remove the options menu from this screen.
* @return True if success, false otherwise ( for instance the options
* menu has no content.
*/
void Screen::removeOptionsMenu()
{
setProperty(MAW_SCREEN_REMOVE_OPTIONS_MENU,"");
}
示例11: patchEntities
//.........这里部分代码省略.........
{
e = getEntityByStartXY(x, y);
if (e != NULL)
{
e->inUse = FALSE;
found = TRUE;
}
}
}
else if (strcmpignorecase(itemName, "UPDATE_ENTITY") == 0 && skipping == FALSE)
{
read = sscanf(line, "%*s %s %s %s", itemName, key, value);
if (strcmpignorecase(itemName, "PLAYER") == 0)
{
e = &player;
}
else
{
e = getEntityByObjectiveName(itemName);
}
if (e != NULL)
{
if (strcmpignorecase(value, "NULL") == 0)
{
STRNCPY(value, "", sizeof(value));
}
setProperty(e, key, value);
}
}
else if (strcmpignorecase(itemName, "UPDATE_ENTITY_BY_START") == 0 && skipping == FALSE)
{
read = sscanf(line, "%*s %d %d %s %[^\n]s", &x, &y, key, value);
if (strcmpignorecase(itemName, "PLAYER") == 0)
{
e = &player;
}
else
{
e = getEntityByStartXY(x, y);
}
if (e != NULL)
{
setProperty(e, key, value);
}
}
else if (strcmpignorecase(itemName, "UPDATE_ENTITY_BY_XY") == 0 && skipping == FALSE)
{
read = sscanf(line, "%*s %d %d %s %[^\n]s", &x, &y, key, value);
if (strcmpignorecase(itemName, "PLAYER") == 0)
{
e = &player;
}
示例12: malloc
//.........这里部分代码省略.........
}
else if (strstr(line, "INVENTORY_INDEX") != NULL)
{
sscanf(line, "%*s %d", &startX);
setInventoryIndex(startX);
}
else if (strcmpignorecase(line, "ENTITY_DATA") == 0)
{
resourceType = ENTITY_DATA;
}
else if (strcmpignorecase(line, "{") == 0)
{
i = 0;
name = type = startX = startY = -1;
e = NULL;
}
else if (strcmpignorecase(line, "}") == 0)
{
e = addEntityFromResource(value[type], value[name], startX == -1 ? 0 : atoi(value[startX]), startY == -1 ? 0 : atoi(value[startY]));
if (e != NULL)
{
for (i=0;i<MAX_PROPS_FILES;i++)
{
if (strlen(key[i]) > 0)
{
setProperty(e, key[i], value[i]);
}
}
if (resourceType == PLAYER_INVENTORY)
{
addToInventory(e);
}
}
for (i=0;i<MAX_PROPS_FILES;i++)
{
key[i][0] = '\0';
value[i][0] = '\0';
}
i = 0;
}
else
{
token = strtok_r(line, " ", &savePtr2);
STRNCPY(key[i], token, MAX_VALUE_LENGTH);
token = strtok_r(NULL, "\0", &savePtr2);
if (token != NULL)
{
STRNCPY(value[i], token, MAX_VALUE_LENGTH);
}
示例13: getProperty
//.........这里部分代码省略.........
//Get input workspace and offset
const MatrixWorkspace_sptr inputW = getProperty("InputWorkspace");
m_algFactor = getProperty("Factor");
m_parname = getPropertyValue("InstrumentParameter");
m_combine = getProperty("Combine");
if(m_combine && m_parname.empty())
{
throw std::invalid_argument("Combine behaviour requested but the InstrumentParameter argument is blank.");
}
const std::string op = getPropertyValue("Operation");
API::MatrixWorkspace_sptr outputW = createOutputWS(inputW);
//Get number of histograms
int histnumber = static_cast<int>(inputW->getNumberHistograms());
m_progress = new API::Progress(this, 0.0, 1.0, histnumber+1);
m_progress->report("Scaling X");
m_wi_min = 0;
m_wi_max = histnumber-1;
//check if workspace indexes have been set
int tempwi_min = getProperty("IndexMin");
int tempwi_max = getProperty("IndexMax");
if ( tempwi_max != Mantid::EMPTY_INT() )
{
if ((m_wi_min <= tempwi_min) && (tempwi_min <= tempwi_max) && (tempwi_max <= m_wi_max))
{
m_wi_min = tempwi_min;
m_wi_max = tempwi_max;
}
else
{
g_log.error("Invalid Workspace Index min/max properties");
throw std::invalid_argument("Inconsistent properties defined");
}
}
// Setup appropriate binary function
const bool multiply = (op=="Multiply");
if(multiply) m_binOp = std::multiplies<double>();
else m_binOp = std::plus<double>();
//Check if its an event workspace
EventWorkspace_const_sptr eventWS = boost::dynamic_pointer_cast<const EventWorkspace>(inputW);
if (eventWS != NULL)
{
this->execEvent();
return;
}
// do the shift in X
PARALLEL_FOR2(inputW, outputW)
for (int i = 0; i < histnumber; ++i)
{
PARALLEL_START_INTERUPT_REGION
//Copy y and e data
auto & outY = outputW->dataY(i);
outY = inputW->dataY(i);
auto & outE = outputW->dataE(i);
outE = inputW->dataE(i);
auto & outX = outputW->dataX(i);
const auto & inX = inputW->readX(i);
//Change bin value by offset
if ((i >= m_wi_min) && (i <= m_wi_max))
{
double factor = getScaleFactor(inputW, i);
// Do the offsetting
std::transform(inX.begin(), inX.end(), outX.begin(), std::bind2nd(m_binOp, factor));
// reverse the vector if multiplicative factor was negative
if(multiply && factor < 0.0)
{
std::reverse( outX.begin(), outX.end() );
std::reverse( outY.begin(), outY.end() );
std::reverse( outE.begin(), outE.end() );
}
}
else
{
outX = inX; //copy
}
m_progress->report("Scaling X");
PARALLEL_END_INTERUPT_REGION
}
PARALLEL_CHECK_INTERUPT_REGION
// Copy units
if (outputW->getAxis(0)->unit().get())
outputW->getAxis(0)->unit() = inputW->getAxis(0)->unit();
try
{
if (inputW->getAxis(1)->unit().get())
outputW->getAxis(1)->unit() = inputW->getAxis(1)->unit();
}
catch(Exception::IndexError &)
{
// OK, so this isn't a Workspace2D
}
// Assign it to the output workspace property
setProperty("OutputWorkspace",outputW);
}
示例14: DataAbstractModule
RendererImage::RendererImage() : DataAbstractModule(1,0,0) {
//FIXME add DataPorts here instead of Model.cpp
setProperty("FIXME", 112); // FIXME setting properties should be done via makros
}
示例15: Config
Config(int port) {
setProperty("listen.port", port);
}