PeriDyno 1.2.1
Loading...
Searching...
No Matches
WtNode.cpp
Go to the documentation of this file.
1#include "WtNode.h"
2
3#include <utility>
4#include <iostream>
5#include <cmath>
6#include <Wt/WPainter.h>
7#include <Wt/WFont.h>
8#include <Wt/WFontMetrics.h>
9#include <Wt/WLabel.h>
10#include <Wt/WPaintDevice.h>
11
13#include "WtNodeDataModel.h"
14
15WtNodeGeometry::WtNodeGeometry(std::unique_ptr<WtNodeDataModel> const& dataModel, Wt::WPaintDevice* paintDevice)
16 : _width(100)
17 , _height(150)
18 , _inputPortWidth(70)
20 , _entryHeight(20)
21 , _spacing(20)
22 , _hotkeyWidth(20)
24 , _hotkeyOffset(15)
26 , _hovered(false)
27 , _nSources(dataModel->nPorts(PortType::Out))
28 , _nSinks(dataModel->nPorts(PortType::In))
29 , _draggingPos(-1000, -1000)
30 , _dataModel(dataModel)
31 , _fontMetrics(paintDevice->fontMetrics())
32 , isPortTipsShow(new bool(false))
33 , isNodeTipsShow(new bool(false))
34{
35}
36
38{
39 //HidePortTips();
40}
41
43{
44 //*isNodeTipsShow = true;
45
46 //Wt::WLabel* TipsLabel = new Wt::WLabel;
47 //TipsLabel->setAlignment(Qt::AlignLeft | Qt::AlignTop);
48 //TipsLabel->setParent(TipsWidget);
49 //TipsLabel->setText(_dataModel->nodeTips());
50 //TipsLabel->setWordWrap(true);
51 //TipsLabel->setFixedWidth(200);
52 //TipsLabel->adjustSize();
53 //TipsLabel->setStyleSheet("QLabel{color:white;background-color:#346792;border: 1px solid #000000;border-radius:3px; padding: 0px;}");
54
55 //TipsWidget->setWindowFlags(Qt::WindowTransparentForInput | Qt::ToolTip);
56 //TipsWidget->move(QCursor().pos().x() + 20, QCursor().pos().y() + 20);
57 //if (!_dataModel->nodeTips().isEmpty())
58 //{
59 // TipsWidget->show();
60 //}
61}
62
64{
65 //*isNodeTipsShow = false;
66 //TipsWidget->hide();
67 //delete TipsWidget->findChild<QLabel*>();
68}
69
71{
72 //if (*isPortTipsShow)
73 // *isPortTipsShow = false;
74 //PortTipsWidget->hide();
75 //delete PortTipsWidget->findChild<QLabel*>();
76}
77
79
81{
82 //if (!*isPortTipsShow && !*isNodeTipsShow)
83 //{
84 // *isPortTipsShow = true;
85
86 // QLabel* PortTipsLabel = new QLabel;
87 // PortTipsLabel->setAlignment(Qt::AlignLeft | Qt::AlignTop);
88 // PortTipsLabel->setParent(PortTipsWidget);
89 // PortTipsLabel->setText(_dataModel->portTips(hoverport_type, hoverport_id));
90 // PortTipsLabel->setWordWrap(true);
91
92 // //PortTipsLabel->setFixedWidth(200);
93 // PortTipsLabel->adjustSize();
94 // PortTipsLabel->setStyleSheet("QLabel{color:white;background-color:#346792;border: 1px solid #000000;border-radius:3px ; padding: 0px;}");
95 // PortTipsWidget->setWindowFlags(Qt::WindowTransparentForInput | Qt::ToolTip);
96
97 // PortTipsWidget->move(QCursor().pos().x() + 20, QCursor().pos().y() + 20);
98
99 // if (!_dataModel->portTips(hoverport_type, hoverport_id).isEmpty())
100 // {
101 // PortTipsWidget->show();
102 // }
103
104 //}
105}
106
107unsigned int WtNodeGeometry::nSources() const
108{
109 return _dataModel->nPorts(PortType::Out);
110}
111
112unsigned int WtNodeGeometry::nSinks() const
113{
114 return _dataModel->nPorts(PortType::In);
115}
116
117bool WtNodeGeometry::checkHitHotKey0(Wt::WPointF point, Wt::WTransform const& t /*= Wt::WTransform()*/) const
118{
119 auto const& nodeStyle = WtStyleCollection::nodeStyle();
120
121 float diam = nodeStyle.ConnectionPointDiameter;
122
123 Wt::WPointF p0 = t.map(Wt::WPointF(width() + diam, -diam));
124
125 float x = p0.x() - point.x();
126 float y = point.y() - p0.y();
127
128 float h = diam + captionHeight();
129
130 if (y > 0.0f && y < h)
131 {
132 float ext = hotkeyIncline() * y / h;
133
134 if (x > hotkeyOffset() && x < hotkeyWidth() + hotkeyOffset() + ext)
135 {
136 return true;
137 }
138 }
139 return false;
140}
141
142bool WtNodeGeometry::checkHitHotKey1(Wt::WPointF point, Wt::WTransform const& t /*= Wt::WTransform()*/) const
143{
144 auto const& nodeStyle = WtStyleCollection::nodeStyle();
145
146 float diam = nodeStyle.ConnectionPointDiameter;
147
148 Wt::WPointF p0 = t.map(Wt::WPointF(width() + diam, -diam));
149
150 float x = p0.x() - point.x();
151 float y = point.y() - p0.y();
152
153 float h = diam + captionHeight();
154
155 if (y > 0.0f && y < h)
156 {
157 float ext = hotkeyIncline() * y / h;
158
159 if (x > hotkeyWidth() + hotkeyOffset() && x < 2 * hotkeyWidth() + hotkeyOffset() + ext)
160 {
161 return true;
162 }
163 }
164 return false;
165}
166
168{
169 unsigned int rectSize = 7;
170
171 return Wt::WRectF(_width - rectSize,
172 _height - rectSize,
173 rectSize,
174 rectSize);
175}
176
178{
179 std::string msg = _dataModel->validationMessage();
180
181 return _fontMetrics.height();
182}
183
185{
186 std::string msg = _dataModel->validationMessage();
187
188 return calculateWidth(msg);
189}
190
191//TODO:NodeGeometry need transplant
192
193std::string WtNodeGeometry::strFormat(std::string str) const
194{
195 std::string trueName;
196
197 size_t pos = str.find('<');
198
199 if (pos != std::string::npos)
200 {
201 trueName = str.substr(0, pos);
202 }
203 else
204 {
205 trueName = str;
206 }
207
208 return trueName;
209}
210
212{
213 double const addon = 0.0;
214
215 return Wt::WRectF(0 - addon,
216 0 - addon,
217 _entryWidth + 2 * addon,
218 _entryHeight + 2 * addon);
219}
220
222{
223 auto const& nodeStyle = WtStyleCollection::nodeStyle();
224
225 double addon = 4 * nodeStyle.ConnectionPointDiameter;
226
227 return Wt::WRectF(0 - addon,
228 0 - addon,
229 _width + 2 * addon,
230 _height + 2 * addon);
231}
232
234{
235 _entryHeight = _fontMetrics.height();
236
237 {
238 unsigned int maxNumOfEntries = std::max(_nSinks, _nSources);
239 unsigned int step = _entryHeight + _spacing;
240 _height = step * maxNumOfEntries;
241 }
242
243 //if (auto w = _dataModel->embeddedWidget())
244 //{
245 // _height = std::max(_height, static_cast<unsigned>(w->height()));
246 //}
247
249
252
254
255 //if (auto w = _dataModel->embeddedWidget())
256 //{
257 // _width += w->width();
258 //}
259
260 _width = std::max(_width, captionWidth());
261
262 if (_dataModel->validationState() != NodeValidationState::Valid)
263 {
264 _width = std::max(_width, validationWidth());
266 _height += _spacing;
267 }
268}
269
270Wt::WPointF WtNodeGeometry::portScenePosition(PortIndex index, PortType portType, Wt::WTransform const& t) const
271{
272 auto const& nodeStyle = WtStyleCollection::nodeStyle();
273
274 unsigned int step = _entryHeight + _spacing;
275
276 Wt::WPointF result;
277
278 double totalHeight = captionHeightSpacing();
279
280 totalHeight += captionHeight();
281
282 totalHeight += step * index;
283
284 // TODO: why?
285 totalHeight += step / 2.0;
286
287 switch (portType)
288 {
289 case PortType::Out:
290 {
291 double x = _width + nodeStyle.ConnectionPointDiameter;
292
293 result = _dataModel->allowExported() ? Wt::WPointF(x, totalHeight - captionHeight() - captionHeightSpacing() - step / 3.0) : Wt::WPointF(x, totalHeight);
294 break;
295 }
296
297 case PortType::In:
298 {
299 double x = 0.0 - nodeStyle.ConnectionPointDiameter;
300
301 result = Wt::WPointF(x, totalHeight);
302 break;
303 }
304
305 default:
306 break;
307 }
308
309 return t.map(result);
310}
311
312PortIndex WtNodeGeometry::checkHitScenePoint(PortType portType, Wt::WPointF const scenePoint, Wt::WTransform const& sceneTransform) const
313{
314 auto const& nodeStyle = WtStyleCollection::nodeStyle();
315
316 PortIndex result = INVALID_PORT;
317
318 if (portType == PortType::None)
319 return result;
320
321 double const tolerance = 2.0 * nodeStyle.ConnectionPointDiameter;
322
323 unsigned int const nItems = _dataModel->nPorts(portType);
324
325 for (unsigned int i = 0; i < nItems; ++i)
326 {
327 auto pp = portScenePosition(i, portType, sceneTransform);
328
329 Wt::WPointF p(pp.x() - scenePoint.x(), pp.y() - scenePoint.y());
330
331 double dotProduct = p.x() * p.x() + p.y() * p.y();
332
333 auto distance = std::sqrt(dotProduct);
334 if (distance < tolerance)
335 {
336 result = PortIndex(i);
337 break;
338 }
339 }
340
341 return result;
342}
343
344PortIndex WtNodeGeometry::hoverHitScenePoint(PortType portType, Wt::WPointF const scenePoint, Wt::WTransform const& sceneTransform) const
345{
346 auto const& nodeStyle = WtStyleCollection::nodeStyle();
347
348 PortIndex result = INVALID_PORT;
349
350 if (portType == PortType::None)
351 return result;
352
353 double const tolerance = 2.0 * nodeStyle.ConnectionPointDiameter;
354
355 unsigned int const nItems = _dataModel->nPorts(portType);
356
357 for (unsigned int i = 0; i < nItems; ++i)
358 {
359 auto pp = portScenePosition(i, portType, sceneTransform);
360 Wt::WPointF p(pp.x() - scenePoint.x(), pp.y() - scenePoint.y());
361 double dotProduct = p.x() * p.x() + p.y() * p.y();
362 auto distance = std::sqrt(dotProduct);
363 if (distance < tolerance)
364 {
365 result = PortIndex(i);
366 break;
367 }
368 }
369
370 return result;
371}
372
373//PortIndex NodeGeometry::hoverHitPortArea(
374// PortType portType,
375// Wt::WPointF const scenePoint,
376// Wt::WTransform const& sceneTransform,
377// NodeGeometry const& geom,
378// WtNodeDataModel const* model,
379// Wt::WFontMetrics const& metrics) const
380//{
381// auto const& nodeStyle = WtStyleCollection::nodeStyle();
382//
383// PortIndex result = INVALID_PORT;
384//
385// if (portType == PortType::None)
386// return result;
387//
388// Wt::WPointF p1;
389// Wt::WPointF p2;
390//
391// unsigned int const nItems = _dataModel->nPorts(portType);
392//
393// //std::string type;
394// for (size_t i = 0; i < nItems; ++i)
395// {
396// p1 = geom.portScenePosition(i, portType, sceneTransform);
397// Wt::WPointF pt = Wt::WPointF(geom.portScenePosition(i, portType, sceneTransform));
398// //if (portType == PortType::None)
399// //{
400// // type = "None";
401// //}
402// //else if (portType == PortType::In)
403// //{
404// // type = "In";
405// //}
406// //else if (portType == PortType::Out)
407// //{
408// // type = "Out";
409// //}
410// std::string s;
411//
412// if (model->portCaptionVisible(portType, (PortIndex)i))
413// {
414// s = model->portCaption(portType, (PortIndex)i);
415// }
416// else
417// {
418// s = model->dataType(portType, (PortIndex)i).name;
419// }
420//
421// auto rect = metrics.boundingRect(s);
422//
423// p2.setY(p1.y() + rect.height() / 4);
424// p1.setY(p1.y() - rect.height() * 3 / 5);
425//
426// switch (portType)
427// {
428// case PortType::In:
429// p1.setX(0 + sceneTransform.dx());
430// p2.setX(rect.width() + sceneTransform.dx());
431// break;
432//
433// case PortType::Out:
434// p1.setX(geom.width() - rect.width() + sceneTransform.dx());
435// p2.setX(geom.width() + sceneTransform.dx());
436// break;
437//
438// default:
439// break;
440// }
441// //std::cout << type <<":" << i << "--" << "p1\B5\C4λ\D6\C3 x=" << p1.x() << " y=" << p1.y() << std::endl;
442// //std::cout << type <<":" << i << "--" << "p2\B5\C4λ\D6\C3 x=" << p2.x() << " y=" << p2.y() << std::endl;
443//
444// if (scenePoint.x() > p1.x() && scenePoint.x() < p2.x() && scenePoint.y() > p1.y() && scenePoint.y() < p2.y())
445// {
446// //std::cout <<"\B7\B5\BB\D8Öµ\A3\BA" << type << i << std::endl;
447// //std::cout << "********************* < \D2Ñ·\B5\BB\D8 > *********************" << std::endl;
448// return PortIndex(i);
449// //std::cout << "********************* < break > *********************" << std::endl;
450// break;
451// }
452//
453// }
454// return result = INVALID_PORT;
455//}
456
457//PortIndex NodeGeometry::findHitPort(PortType portType,
458// Wt::WPointF const scenePoint,
459// Wt::WTransform const& sceneTransform,
460// NodeGeometry const& geom,
461// WtNodeDataModel const* model) const
462//{
463// PortIndex result = INVALID_PORT;
464// PortType _portType = portType;
465// Wt::WPointF const _scenePoint = scenePoint;
466// Wt::WTransform const _sceneTransform = sceneTransform;
467// NodeGeometry const _geom = geom;
468// WtNodeDataModel const* _model = model;
469//
470// result = geom.hoverHitPortArea(_portType, _scenePoint, _sceneTransform, _geom, _model);
471// //std::cout << "result1=" << result << std::endl;
472// if (result == INVALID_PORT)
473// {
474// result = geom.hoverHitScenePoint(_portType, _scenePoint, _sceneTransform);
475// //std::cout << "result2=" << result << std::endl;
476// }
477//
478// return result;
479//
480//}
481
482//Wt::WPointF NodeGeometry::widgetPosition() const
483//{
484// if (auto w = _dataModel->embeddedWidget())
485// {
486// if (w->sizePolicy().verticalPolicy() & QSizePolicy::ExpandFlag)
487// {
488// // If the widget wants to use as much vertical space as possible, place it immediately after the caption.
489// return Wt::WPointF(_spacing + portWidth(PortType::In), captionHeight());
490// }
491// else
492// {
493// if (_dataModel->validationState() != NodeValidationState::Valid)
494// {
495// return Wt::WPointF(_spacing + portWidth(PortType::In),
496// (captionHeight() + _height - validationHeight() - _spacing - w->height()) / 2.0);
497// }
498//
499// return Wt::WPointF(_spacing + portWidth(PortType::In),
500// (captionHeight() + _height - w->height()) / 2.0);
501// }
502// }
503// return Wt::WPointF();
504//}
505
506//int WtNodeGeometry::equivalentWidgetHeight() const
507//{
508// if (_dataModel->validationState() != NodeValidationState::Valid)
509// {
510// return height() - captionHeight() + validationHeight();
511// }
512//
513// return height() - captionHeight();
514//}
515
517{
518 if (!_dataModel->captionVisible())
519 return 0;
520
521 std::string name = _dataModel->caption();
522
523 return _fontMetrics.height() + captionHeightSpacing();
524}
525
527{
528 if (!_dataModel->captionVisible())
529 return 0;
530
531 std::string name = strFormat(_dataModel->caption());
532
533 // no width, bug
534 unsigned int w = _dataModel->hotkeyEnabled() ? 2 * captionHeight() + calculateWidth(name) + 2 * hotkeyWidth() + hotkeyIncline() : 2 * captionHeight() + calculateWidth(name);
535
536 return w;
537}
538
539double WtNodeGeometry::calculateWidth(std::string str) const
540{
541 double height = _fontMetrics.height();
542 int widthNum = str.size();
543 return height * widthNum / 2.5;
544}
545
547{
548 double height = _fontMetrics.height();
549 return height * num / 2.5;
550}
551
552unsigned int WtNodeGeometry::portWidth(PortType portType) const
553{
554 unsigned width = 0;
555
556 for (auto i = 0ul; i < _dataModel->nPorts(portType); ++i)
557 {
558 std::string name;
559
560 if (_dataModel->portCaptionVisible(portType, i))
561 {
562 name = _dataModel->portCaption(portType, i);
563 }
564 else
565 {
566 name = _dataModel->dataType(portType, i).name;
567 }
568 //width = std::max(unsigned(_fontMetrics.boundingRect(name).width()), width);
569 }
570
571 return width;
572}
573
574WtNodeState::WtNodeState(std::unique_ptr<WtNodeDataModel> const& model)
575 : _inConnections(model->nPorts(PortType::In))
576 , _outConnections(model->nPorts(PortType::Out))
579 , _resizing(false)
580{}
581
582std::vector<WtNodeState::ConnectionPtrSet> const& WtNodeState::getEntries(PortType portType) const
583{
584 if (portType == PortType::In)
585 return _inConnections;
586 else
587 return _outConnections;
588}
589
590std::vector<WtNodeState::ConnectionPtrSet>& WtNodeState::getEntries(PortType portType)
591{
592 if (portType == PortType::In)
593 return _inConnections;
594 else
595 return _outConnections;
596}
597
599{
600 auto const& connections = getEntries(portType);
601
602 return connections[portIndex];
603}
604
606 PortType portType,
607 PortIndex portIndex,
608 WtConnection& connection)
609{
610 auto& connections = getEntries(portType);
611
612 connections.at(portIndex).insert(std::make_pair(connection.id(),
613 &connection));
614}
615
617 PortType portType,
618 PortIndex portIndex,
619 Wt::Guid id)
620{
621 getEntries(portType)[portIndex].erase(id);
622}
623
628
633
638
650
652{
653 return _reaction == REACTING;
654}
655
660
662{
663 return _resizing;
664}
665
666WtNode::WtNode(std::unique_ptr<WtNodeDataModel>&& dataModel, Wt::WPaintDevice* paintDevice)
667 : _uid(Wt::newGuid())
668 , _nodeDataModel(std::move(dataModel))
670 , _nodeGeometry(_nodeDataModel, paintDevice)
671 , _nodeGraphicsObject(nullptr)
672{
673 _nodeGeometry.recalculateSize();
674
675}
676
677WtNode::~WtNode() = default;
678
680{
681 return _uid;
682}
683
685{
687 //_nodeGraphicsObject->update();
688}
689
691{
692 return *_nodeGraphicsObject.get();
693}
694
699
700void WtNode::setGraphicsObject(std::unique_ptr<WtNodeGraphicsObject>&& graphics)
701{
702 _nodeGraphicsObject = std::move(graphics);
703
704 _nodeGeometry.recalculateSize();
705}
706
711
713{
714 return _nodeGeometry;
715}
716
718{
719 return _nodeState;
720}
721
723{
724 return _nodeState;
725}
726
728{
729 return _nodeDataModel.get();
730}
731
732void WtNode::propagateData(std::shared_ptr<WtNodeData> nodeData,
733 PortIndex inPortIndex) const
734{
735 _nodeDataModel->setInData(std::move(nodeData), inPortIndex);
736
737 //Recalculate the nodes visuals. A data change can result in the node taking more space than before, so this forces a recalculate+repaint on the affected node
738 _nodeGraphicsObject->setGeometryChanged();
739 _nodeGeometry.recalculateSize();
740 //_nodeGraphicsObject->update();
741 _nodeGraphicsObject->moveConnections();
742}
743
745{
746 auto nodeData = _nodeDataModel->outData(index);
747
748 auto connections = _nodeState.connections(PortType::Out, index);
749
750 for (auto const& c : connections)
751 {
752
753 c.second->propagateData(nodeData);
754 }
755
756}
757
759{
760 /*if (nodeDataModel()->embeddedWidget())
761 {
762 nodeDataModel()->embeddedWidget()->adjustSize();
763 }*/
765 for (PortType type : {PortType::In, PortType::Out})
766 {
767 for (auto& conn_set : nodeState().getEntries(type))
768 {
769 for (auto& pair : conn_set)
770 {
771 WtConnection* conn = pair.second;
772 //conn->getConnectionGraphicsObject().move();
773 }
774 }
775 }
776}
int PortIndex
static const int INVALID_PORT
PortType
Wt::Guid id() const
unsigned int _hotkeyOffset
Definition WtNode.h:172
unsigned int captionHeightSpacing() const
Definition WtNode.h:61
WtNodeGeometry(std::unique_ptr< WtNodeDataModel > const &dataModel, Wt::WPaintDevice *paintDevice)
Definition WtNode.cpp:15
unsigned int _entryHeight
Definition WtNode.h:166
void HidePortTips() const
Definition WtNode.cpp:70
PortIndex hoverHitScenePoint(PortType portType, Wt::WPointF point, Wt::WTransform const &t=Wt::WTransform()) const
Definition WtNode.cpp:344
bool * isNodeTipsShow
Definition WtNode.h:91
bool * isPortTipsShow
Definition WtNode.h:90
unsigned int captionHeight() const
Definition WtNode.cpp:516
unsigned int captionWidth() const
Definition WtNode.cpp:526
unsigned int nSinks() const
Definition WtNode.cpp:112
Wt::WPointF portScenePosition(PortIndex index, PortType portType, Wt::WTransform const &t=Wt::WTransform()) const
Definition WtNode.cpp:270
unsigned int hotkeyIncline() const
Definition WtNode.h:51
unsigned int _height
Definition WtNode.h:162
bool checkHitHotKey1(Wt::WPointF point, Wt::WTransform const &t=Wt::WTransform()) const
Definition WtNode.cpp:142
Wt::WFontMetrics _fontMetrics
Definition WtNode.h:183
Wt::WRectF resizeRect() const
Definition WtNode.cpp:167
void recalculateSize() const
Definition WtNode.cpp:233
unsigned int portWidth(PortType portType) const
Definition WtNode.cpp:552
unsigned int width() const
Definition WtNode.h:35
void ShowTips() const
Definition WtNode.cpp:42
bool _hovered
Definition WtNode.h:174
unsigned int _entryWidth
Definition WtNode.h:163
unsigned int _hotkeyIncline
Definition WtNode.h:171
unsigned int hotkeyWidth() const
Definition WtNode.h:47
unsigned int height() const
Definition WtNode.h:31
bool getPortTipsState() const
Definition WtNode.cpp:78
std::unique_ptr< WtNodeDataModel > const & _dataModel
Definition WtNode.h:181
void ShowPortTips() const
Definition WtNode.cpp:80
Wt::WRectF boundingRect() const
Definition WtNode.cpp:221
double calculateWidth(std::string) const
Definition WtNode.cpp:539
unsigned int _hotkeyWidth
Definition WtNode.h:170
unsigned int _width
Definition WtNode.h:161
unsigned int validationHeight() const
Definition WtNode.cpp:177
unsigned int hotkeyOffset() const
Definition WtNode.h:55
PortIndex checkHitScenePoint(PortType portType, Wt::WPointF point, Wt::WTransform const &t=Wt::WTransform()) const
Definition WtNode.cpp:312
void HideTips() const
Definition WtNode.cpp:63
unsigned int _captionHeightSpacing
Definition WtNode.h:168
unsigned int _inputPortWidth
Definition WtNode.h:164
unsigned int _outputPortWidth
Definition WtNode.h:165
unsigned int _nSources
Definition WtNode.h:176
unsigned int _nSinks
Definition WtNode.h:177
std::string strFormat(std::string str) const
Definition WtNode.cpp:193
unsigned int nSources() const
Definition WtNode.cpp:107
Wt::WPointF _draggingPos
Definition WtNode.h:179
unsigned int validationWidth() const
Definition WtNode.cpp:184
unsigned int _spacing
Definition WtNode.h:167
bool checkHitHotKey0(Wt::WPointF point, Wt::WTransform const &t=Wt::WTransform()) const
Definition WtNode.cpp:117
Wt::WRectF entryBoundingRect() const
Definition WtNode.cpp:211
std::unique_ptr< WtNodeDataModel > _nodeDataModel
Definition WtNode.h:329
WtNodeDataModel * nodeDataModel() const
Definition WtNode.cpp:727
WtNodeState _nodeState
Definition WtNode.h:331
Wt::Guid id() const
Definition WtNode.cpp:679
std::unique_ptr< WtNodeGraphicsObject > _nodeGraphicsObject
Definition WtNode.h:335
void setGraphicsObject(std::unique_ptr< WtNodeGraphicsObject > &&graphics)
Definition WtNode.cpp:700
void onDataUpdated(PortIndex index)
Definition WtNode.cpp:744
WtNodeGraphicsObject const & nodeGraphicsObject() const
Definition WtNode.cpp:690
virtual ~WtNode()
WtNodeGeometry _nodeGeometry
Definition WtNode.h:333
WtNode(std::unique_ptr< WtNodeDataModel > &&dataModel, Wt::WPaintDevice *paintDevice)
Definition WtNode.cpp:666
Wt::Guid _uid
Definition WtNode.h:327
void resetReactionToConnection()
Definition WtNode.cpp:684
void propagateData(std::shared_ptr< WtNodeData > nodeData, PortIndex inPortIndex) const
Propagates incoming data to the underlying model.
Definition WtNode.cpp:732
WtNodeState const & nodeState() const
Definition WtNode.cpp:717
WtNodeGeometry & nodeGeometry()
Definition WtNode.cpp:707
void onNodeSizeUpdated()
update the graphic part if the size of the embeddedwidget changes
Definition WtNode.cpp:758
std::vector< ConnectionPtrSet > _outConnections
Definition WtNode.h:240
bool isReacting() const
Definition WtNode.cpp:651
std::unordered_map< Wt::Guid, WtConnection * > ConnectionPtrSet
Definition WtNode.h:200
WtNodeState(std::unique_ptr< WtNodeDataModel > const &model)
Definition WtNode.cpp:574
std::vector< ConnectionPtrSet > _inConnections
Definition WtNode.h:239
std::vector< ConnectionPtrSet > const & getEntries(PortType) const
Definition WtNode.cpp:582
PortType reactingPortType() const
Definition WtNode.cpp:629
ReactToConnectionState reaction() const
Definition WtNode.cpp:624
NodeDataType _reactingDataType
Definition WtNode.h:244
ConnectionPtrSet connections(PortType portType, PortIndex portIndex) const
Definition WtNode.cpp:598
PortType _reactingPortType
Definition WtNode.h:243
ReactToConnectionState
Definition WtNode.h:191
@ NOT_REACTING
Definition WtNode.h:193
void eraseConnection(PortType portType, PortIndex portIndex, Wt::Guid id)
Definition WtNode.cpp:616
ReactToConnectionState _reaction
Definition WtNode.h:242
void setConnection(PortType portType, PortIndex portIndex, WtConnection &connection)
Definition WtNode.cpp:605
bool _resizing
Definition WtNode.h:246
void setReaction(ReactToConnectionState reaction, PortType reactingPortType=PortType::None, NodeDataType reactingDataType=NodeDataType())
Definition WtNode.cpp:639
void setResizing(bool resizing)
Definition WtNode.cpp:656
NodeDataType reactingDataType() const
Definition WtNode.cpp:634
bool resizing() const
Definition WtNode.cpp:661
static WtNodeStyle const & nodeStyle()
Definition guid.cpp:5
Definition guid.cpp:136