33 const QSize TermNode::LiteralNodeSize(50, 50);
34 const QSize TermNode::ExpressionNodeSize(30, 30);
35 const QSize TermNode::ConditionRootNodeSize(50, 50);
39 conditionId(conditionId),
44 this->checksTable = checksTable;
50 switch (term->getType())
55 graphicsItem->
setPixmap(QPixmap(
":/icons/arrow-right.png"));
63 graphicsItem->
setText(OperationPtr::dynamicCast(term)->getOperationString().c_str());
70 graphicsItem->
setPixmap(QPixmap(
":/icons/wave.png"));
82 graphicsItem->setToolTip(ss.str().c_str());
96 scene->addItem(graphicsItem);
100 if (checksTable && (term->getType() == eLiteral))
102 updateChecksTable(term);
117 graphicsItem->
setRect(boundingBox);
118 graphicsItem->show();
128 std::unique_lock lock(dataMutex);
133 VariantPtr var = VariantPtr::dynamicCast(curDatafield->getDataField());
134 auto valueString = var->getOutputValueOnly();
135 return QString::fromStdString(valueString);
137 catch (std::exception& e)
141 return "Retrieval Failed";
152 std::unique_lock lock(dataMutex);
156 QTableWidgetItem* item =
new QTableWidgetItem(
"true");
158 checksTable->setItem(literalRow,
eStateCol, item);
163 QTableWidgetItem* item =
new QTableWidgetItem(
"false");
165 checksTable->setItem(literalRow,
eStateCol, item);
174 std::unique_lock lock(dataMutex);
177 CheckConfiguration config = literal->getCheckConfiguration();
180 checksTable->insertRow(checksTable->rowCount());
181 literalRow = checksTable->rowCount() - 1;
184 DataFieldIdentifierPtr dataFieldIdentifier = DataFieldIdentifierPtr::dynamicCast(config.dataFieldIdentifier);
186 if (dataFieldIdentifier)
188 literaldatafieldName = dataFieldIdentifier->getIdentifierStr().c_str();
189 checksTable->setItem(literalRow,
eDataFieldCol,
new QTableWidgetItem(dataFieldIdentifier->getIdentifierStr().c_str()));
190 ObserverInterfacePrx prx = manager->getProxy<ObserverInterfacePrx>(dataFieldIdentifier->getObserverName());
194 if (prx->existsChannel(dataFieldIdentifier->channelName))
196 curDatafield =
new DatafieldRef(prx, dataFieldIdentifier->channelName, dataFieldIdentifier->datafieldName);
199 catch (std::exception& e)
207 checksTable->setItem(literalRow,
eDataFieldCol,
new QTableWidgetItem(
"NULL"));
208 literaldatafieldName =
"";
211 ARMARX_INFO <<
"updating " << dataFieldIdentifier->getIdentifierStr();
214 checksTable->setItem(literalRow,
eCheckTypeCol,
new QTableWidgetItem(config.checkName.c_str()));
217 ParameterList::iterator iter = config.checkParameters.begin();
218 std::stringstream parameters;
220 while (iter != config.checkParameters.end())
222 VariantPtr var = VariantPtr::dynamicCast(*iter);
223 parameters << var <<
", ";
227 checksTable->setItem(literalRow,
eParametersCol,
new QTableWidgetItem(parameters.str().c_str()));
235 connect(
this, SIGNAL(
literalClicked(
int)), checksTable, SLOT(selectRow(
int)));
241 checksTable->resizeColumnsToContents();
248 std::unique_lock lock(dataMutex);
249 truthy = curDatafield && literaldatafieldName == curDatafield->getDataFieldIdentifier()->getIdentifierStr();
261 if (term->getType() == eLiteral)
269 QList<QTableWidgetItem*> selectedItems = checksTable->selectedItems();
271 int size = selectedItems.size();
275 QTableWidgetItem* widget = selectedItems.front();
276 int row = checksTable->row(widget);
278 if (row == literalRow)
288 std::unique_lock lock(dataMutex);
289 checksTable->setItem(literalRow,
eCurrentValueCol,
new QTableWidgetItem(valueString));