YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
builderitem.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-License-Identifier: LGPL-2.1-or-later
4 */
5
6#include "builderitem.h"
7#include "arrow.h"
8#include <cmath>
9
14 arrows.append(arrow);
15}
17 foreach (Arrow *arrow, arrows) {
18 //arrow->hide();
19// arrow->startItem()->removeArrow(arrow);
20// arrow->endItem()->removeArrow(arrow);
21 delete arrow;
22 }
23}
24
26 foreach (Arrow *arrow, arrows) {
27 if(arrow){
28 arrow->updatePosition();
29 }
30 }
31}
32
33QList<Arrow *>* BuilderItem::getArrows()
34{
35 return &arrows;
36}
37
39 int index = arrows.indexOf(arrow);
40
41 if (index != -1) {
42 arrows.removeAt(index);
43 }
44}
45
47{
48 foreach (Arrow *arrow, arrows) {
49 if(arrow->startItem() == this &&
50 arrow->endItem() == endItem){
51 return true;
52 }
53
54 }
55 return false;
56}
57
65 this->snap = snap;
66}
67QPointF BuilderItem::computeTopLeftGridPoint(const QPointF &pointP){
68 int gridSize = 16;
69 qreal xV = gridSize/2 + floor(pointP.x()/gridSize)*gridSize;
70 qreal yV = gridSize/2 + floor(pointP.y()/gridSize)*gridSize;
71 return {xV, yV};
72}
73
75{
76 return startingPoint;
77}
79{
80 return itemName;
81}
82
83QList<QAction*> BuilderItem::getActions()
84{
85 return actions;
86}
87
88void BuilderItem::setActions(QList<QAction*> acts)
89{
90 actions = acts;
91}
92
94{
95 return nestedInApp;
96}
Definition arrow.h:106
void updatePosition()
Definition arrow.cpp:329
BuilderItem * startItem() const
Definition arrow.h:132
BuilderItem * endItem() const
Definition arrow.h:133
ItemSignalHandler * sigHandler
Definition builderitem.h:90
void removeArrow(Arrow *arrow)
QPointF computeTopLeftGridPoint(const QPointF &pointP)
bool arrowAlreadyPresent(BuilderItem *endItem)
QString itemName
Definition builderitem.h:75
bool allowInputs
Definition builderitem.h:85
bool allowOutputs
Definition builderitem.h:86
QString getItemName()
void removeArrows()
QPointF getStartingPoint()
bool allowInputConnections()
void snapToGrid(bool snap)
QList< QAction * > getActions()
void addArrow(Arrow *arrow)
QList< Arrow * > * getArrows()
bool allowOutputConnections()
bool nestedInApp
Definition builderitem.h:88
ItemSignalHandler * signalHandler()
QList< Arrow * > arrows
Definition builderitem.h:91
void updateConnections()
QPointF startingPoint
Definition builderitem.h:94
void setActions(QList< QAction * >)
bool isNestedInApp()
QList< QAction * > actions
Definition builderitem.h:92