本文整理汇总了C++中SignalData::getDomain方法的典型用法代码示例。如果您正苦于以下问题:C++ SignalData::getDomain方法的具体用法?C++ SignalData::getDomain怎么用?C++ SignalData::getDomain使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SignalData
的用法示例。
在下文中一共展示了SignalData::getDomain方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Write
void WorkspaceSerializer::Write(const QString& fileName, const SignalData& data, const PlotInfo& plotInfo, bool writeValues /*= true*/)
{
QJsonObject json;
json["background"] = plotInfo.getBackgroundColor().name();
if (writeValues)
{
if (auto domain = data.getDomain())
json["domain"] = domain->name;
}
QJsonArray signArray;
data.onSignals([&](const Signal& signal){
QJsonObject signObj;
signObj["name"] = signal.name;
signObj["color"] = signal.graphic.color.name();
signObj["visible"] = signal.graphic.visible;
signObj["range"] = ToJsonArray(QVector < qreal > {signal.graphic.rangeLower, signal.graphic.rangeUpper});
if (writeValues)
signObj["values"] = ToJsonArray(signal.y);
signObj["ticks"] = ToJsonArray(signal.graphic.ticks);
signObj["tickLabels"] = ToJsonArray(signal.graphic.tickLabels);
signArray.push_back(std::move(signObj));
});
json["signals"] = signArray;
QJsonDocument saveDoc(json);
QFile outF(fileName);
outF.open(QIODevice::WriteOnly);
outF.write(saveDoc.toJson(QJsonDocument::Indented));
}
示例2: PrepareReplay
DataToReplay PrepareReplay(const QString& file, SignalData& signalData)
{
SignalData data; PlotInfo info;
WorkspaceSerializer::Read(file, data, info);
DataMap toSet;
vector < pair<QString, QVector<qreal>>> toSend;
data.onSignals([&](const Signal& signal){
toSet.emplace(signal.name, Signal{ signal.name, {}, signal.graphic });
toSend.emplace_back(make_pair(signal.name, std::move(signal.y)));
});
for (auto& signal : toSet)
{
signalData.addIfNotExists(std::move(signal.second));
}
signalData.setAsDomain(data.getDomain()->name);
return toSend;
}
示例3: VerifyActualDataAndPersistedFile
void WorkspaceSerializerTests::VerifyActualDataAndPersistedFile(const QString& file, const DataMap& expectedDataMap, const QString& expectedDomain, const QColor& expectedBackground)
{
SignalData actualSignalData;
PlotInfo actualPlotInfo;
QSignalSpy dataSpy(&actualSignalData, SIGNAL(DataAdded(const DataMap&)));
QSignalSpy plotSpy(&actualPlotInfo, SIGNAL(BackgroundColorChanged(const QColor&)));
WorkspaceSerializer::Read(file, actualSignalData, actualPlotInfo);
QCOMPARE(1, dataSpy.count());
QCOMPARE(1, plotSpy.count());
auto actualdata = dataSpy.takeFirst().takeFirst().value<DataMap>();
QCOMPARE(actualdata, expectedDataMap);
QCOMPARE(actualSignalData.getDomain()->name, expectedDomain);
auto actualColor = plotSpy.takeFirst().takeFirst().value<QColor>();
QCOMPARE(actualColor, expectedBackground);
}