Welcome to SMACHA_GUI’s documentation!

Contents:

Class list

Class CBlockBase

class CBlockBase

Base class for al blocks.

All common functions for all blocks are listed in this class.

Class CBlockHub

class CBlockHub

Class for interaction between GUI and Blocks.

This class manages all cblock*.cpp and cblock*.h classes. There should be no interaction between the GUI and the block classes directly.

1) Create an ENUM Type

Class CRos

class CRos

Class for interaction between GUI and Ros.

Here all functions are hidden for Ros. The GUI has no functions itself!

Class QNEBlock

class QNEBlock : public QObject, public QGraphicsPathItem

QT drawing of blocks.

This class holds all QT drawing functions for blocks.

Class QNEConnection

class QNEConnection : public QGraphicsPathItem

QT drawing of connections.

This class holds all QT drawing functions for connections between blocks.

Class QNEMainWindow

class QNEMainWindow : public QMainWindow

QT drawing of main window.

This class holds all QT drawing functions for the main GUI window.

Class QNEPort

class QNEPort : public QGraphicsPathItem

QT drawing of port.

This class holds all QT drawing functions for ports.

Class QNodesEditor

class QNodesEditor : public QObject

QT logic of connections.

This class holds all QT logic functions for drawing blocks and connections on the main QT scene.

File list

File cblockbase.cpp

File cblockbase.h

Enums

enum SLOTTYPE

Values:

SLOTTYPE_DATA = 0
SLOTTYPE_CONNECT_IN = 1
SLOTTYPE_CONNECT_OUT = 2
enum TEMPLATETYPE

Values:

TEMPLATETYPE_SUBSCRIPT = 0
TEMPLATETYPE_STATE = 1
class CBlockBase
#include <cblockbase.h>

Base class for al blocks.

All common functions for all blocks are listed in this class.

Public Functions

CBlockBase()
~CBlockBase()
void addSlotIn(string s)

This will add one slot.

void addSlotOut(string s)

This will add one slot.

void setSlotInType(int row, SLOTTYPE s)

Changes type of port in nr row.

void setSlotOutType(int row, SLOTTYPE s)

Changes type of port in nr row.

int getSlotInSize()

Returns number of input slots.

int getSlotOutSize()

Returns number of output slots.

string getSlotInName(int row)

Returns name of Slot.

string getSlotOutName(int row)

Returns name of Slot.

vector<string> getSlotInName(SLOTTYPE type)

Retuns all name of slots of type type.

vector<string> getSlotOutName(SLOTTYPE type)

Retuns all name of slots of type type.

SLOTTYPE getSlotInType(int row)

Returns type of Slot.

SLOTTYPE getSlotOutType(int row)

Returns type of Slot.

string getSlotInTypename(int row)

Returns type string of Slot.

string getSlotOutTypename(int row)

Returns type string of Slot.

void setDescription(string s)

This function sets the blocks description as displyed in the GUI.

string getDescription()

This function returns the blocks description.

void setName(string s)

This function sets the blocks name as displyed in the GUI.

string getName()

This function returns the blocks name.

void setMeta(string name, string tooltip, string description)

This function sets the blocks name as displyed in the GUI.

This function sets the blocks name, tooltip, and description as displyed in the GUI

Parameters
  • string: name Input name
  • string: tooltip Tooltip text
  • string: description Descrition text

void addInput(string name, bool lastblock, bool tf, bool database, vector<string> types, string tooltip, bool isInput)

This function adds an input field.

Parameters
  • string: name Input name
  • bool: lastBlock show input field from last block
  • bool: tf show input field from tf server
  • bool: database show input field from database
  • vector<string>: types list of types, which is displayed
  • string: tooltip tooltip

void addSlider(string name, double min, double max, double stepsize, double defaultV, string tooltip, int scale, bool isInput)

This function adds an slider in the GUI.

Parameters
  • string: name Slider name
  • double: min min value
  • double: max max value
  • double: stepsize stepsize of slider
  • double: defaultV defa ult value: min <= defaultV <= max
  • string: tooltip Tooltip to show when hovering over widget
  • bool: isInput true will display the element in the input list, false in the output list

void addValuefield(string name, map<string, string> values, vector<string> units, string tooltip, bool isInput)

This function adds a field of number inputs to the GUI.

Parameters
  • string: name Value field name
  • map<stringstring>: values map of names and default values
  • string: tooltip Tooltip to show when hovering over widget
  • bool: isInput true will display the element in the input list, false in the output list
  • vector<string>: List of units for labels

void addTextfield(string name, map<string, string> values, vector<string> units, string tooltip, bool isInput)

This function adds a field of text inputs to the GUI.

Parameters
  • string: name Value field name
  • map<stringstring>: values map of names and default values
  • string: tooltip Tooltip to show when hovering over widget
  • bool: isInput true will display the element in the input list, false in the output list
  • vector<string>: List of units for labels

void addCheckox(string name, vector<string> values, int defaultV, string tooltip, bool isInput)

This function adds a field of checkboxes to the GUI.

Parameters
  • string: name Value field name
  • vector<string>: values vector of names
  • int: defaultV entry of vector, which is active by default: 0 <= defaultV < values.size()
  • string: tooltip Tooltip to show when hovering over widget
  • bool: isInput true will display the element in the input list, false in the output list

void addService(string name, string tooltip, bool isInput)

This function adds a service selection to the GUI.

Parameters
  • string: name Value field name
  • string: tooltip Tooltip to show when hovering over widget
  • bool: isInput true will display the element in the input list, false in the output list

void addToollist(string name, vector<string> values, vector<vector<string>> dropdown, int defaultV, vector<int> defaultDropdown, string tooltip, bool isInput)

This function adds a tool list to the GUI.

Parameters
  • string: name Value field name
  • vector<string>: values vector of names of checkboxes
  • vector<vector: <string> > dropdown dropdown entries
  • int: devaultV default selection of checkbox
  • vector<int>: defaultDropdown default selection of dropdown menu
  • string: tooltip Tooltip to show when hovering over widget
  • bool: isInput true will display the element in the input list, false in the output list

void addTransformation(string name, int defaultV1, int defaultV2, string tooltip, bool isInput)

This function adds a transformation list to the GUI.

Parameters
  • string: name Value field name
  • int: defaultV1 default selection of first dropdown menu
  • int: defaultV2 default selection of second dropdown menu
  • string: tooltip Tooltip to show when hovering over widget
  • bool: isInput true will display the element in the input list, false in the output list

void addContainer(string name, string tooltip, bool isInput)

This function adds a button, which will create a container block and store it to database.

Parameters
  • string: name Value field name
  • string: tooltip Tooltip to show when hovering over widget
  • bool: isInput true will display the element in the input list, false in the output list

map<string, string> getMapInput()

This function returns a map of all input fields with values.

map<string, string> getMapOutput()

This function returns a map of all output fields with values.

Public Members

YAML::Node templateMetadata

The loaded yaml code is stored here.

TEMPLATETYPE templateType

This variable differentiates between block or container.

string templateFilename

Filename to loaded template.

vector<INPUT> guiInput

Holds all input elements of one block.

vector<SLIDER> guiSlider

Holds all slider elements of one block.

vector<VALUEFIELD> guiValuefield

Holds all value field elements of one block.

vector<TEXTFIELD> guiTextfield

Holds all text field elements of one block.

vector<CHECKBOX> guiCheckbox

Holds all checkbox elements of one block.

vector<TOOLLIST> guiToollist

Holds all toollist elements of one block.

vector<TRANSFORMATION> guiTransformation

Holds all transformation elements of one block.

vector<CONTAINER> guiContainer

Holds all container elements of one block. There should, usually only be one.

vector<SERVICE> guiService

Holds all service elements of one block. There should, usually only be one.

META guiMeta

Holds all meta information of this block.

bool hasRobotfield

Should a robot param field printed in the SMACHA scribt.

Private Members

vector<SlotSingle> SlotIn

This will hold all input slots.

vector<SlotSingle> SlotOut

This will hold all output slots.

string Name

This will hold the blocks human readable name.

struct CHECKBOX
#include <cblockbase.h>

GUI element: checkbox.

Public Members

string name
vector<string> values
int curr
string tooltip
bool isInput
string templatename
struct CONTAINER
#include <cblockbase.h>

GUI element: Container menu.

Public Members

string name
string tooltip
string description
bool isInput
QToolButton *buttonSave
struct INPUT
#include <cblockbase.h>

GUI element: input field.

Public Members

string name
bool lastblock
bool tf
bool database
bool isInput
bool lastblockIsChecked
bool tfIsChecked
bool databaseIsChecked
int currLastblock
int currTf1
int currTf2
int currDatabase
string currStrLastblock
string currStrTf1
string currStrTf2
string currStrDatabase
vector<string> types
string tooltip
string templatename
QRadioButton *formRadiobuttonLastblock
QRadioButton *formRadiobuttonTf
QRadioButton *formRadiobuttonDatabase
QComboBox *formComboboxLastblock
QComboBox *formComboboxTf1
QComboBox *formComboboxTf2
QComboBox *formComboboxDatabase
struct META
#include <cblockbase.h>

block meta information

Public Members

string name
string tooltip
string description
struct SERVICE
#include <cblockbase.h>

GUI element: service list.

Public Members

string name
string tooltip
bool isInput
int currService
string currStrService
QComboBox *formComboboxService
vector<pair<string, string>> requestValues
vector<string> requestUnits
vector<QLineEdit *> requestLineedit
vector<string> savedValues
string templatename
struct SLIDER
#include <cblockbase.h>

GUI element: slider.

Public Members

string name
double min
double max
double stepsize
double curr
string tooltip
bool isInput
int scale
string templatename
QSlider *slider
QLineEdit *lineedit
struct SlotSingle
#include <cblockbase.h>

This will hold one slot input.

Public Members

SLOTTYPE Slottype
string Name
struct TEXTFIELD
#include <cblockbase.h>

GUI element: text field.

Public Members

string name
map<string, string> values
vector<string> units
string tooltip
bool isInput
string templatename
vector<QLineEdit *> lineedit
struct TOOLLIST
#include <cblockbase.h>

GUI element: toollist.

Public Members

string name
vector<string> values
vector<vector<string>> dropdown
int curr
vector<int> dropdownCurr
string tooltip
bool isInput
string templatename
struct TRANSFORMATION
#include <cblockbase.h>

GUI element: transformation.

Public Members

string name
int curr1
int curr2
string tooltip
bool isInput
string templatename
struct VALUEFIELD
#include <cblockbase.h>

GUI element: value field.

Public Members

string name
map<string, string> values
vector<string> units
string tooltip
bool isInput
string templatename
vector<QLineEdit *> lineedit

File cblockhub.cpp

File cblockhub.h

Enums

enum BLOCKTYPE

Used as type, if there is no block on the grid.

Values:

BLOCKTYPE_EMPTY = -1
struct Cell
#include <cblockhub.h>

Defines position of one block on the grid.

Public Members

int CellX
int CellY
struct Connection
#include <cblockhub.h>

Holds one connection.

Public Members

Cell CellFrom
Cell CellTo
int OutPort
int InPort
bool isData = false
class CBlockHub
#include <cblockhub.h>

Class for interaction between GUI and Blocks.

This class manages all cblock*.cpp and cblock*.h classes. There should be no interaction between the GUI and the block classes directly.

1) Create an ENUM Type

Public Functions

CBlockHub()
~CBlockHub()
vector<string> getName()

Returns a vector holding all block names. The position in the vector identifies the block.

string getName(int i)

Returns a vector holding one block name.

vector<string> getDescription()

Returns a vector holding all block descriptions. The position in the vector identifies the block.

string getDescription(int i)

Returns a vector holding one block descriptions.

vector<CBlockBase> getBlockList()

Returns a vector holding all Blocklist.

CBlockBase getBlockList(int i)

Returns a vector holding one block.

void delBlockList(int i)

Removes one entry from block list.

vector<int> getFieldStateEmpty()

Returns a vector holding indices of empty slots in FieldState. -1 means that row is full.

vector<Cell> getFieldStateFull()

Returns a vector holding indices of slots with blocks. -1 means that row is full.

bool isFieldStateEmpty(int x, int y)

Checks, if in State in FieldState is BLOCKSTATE_EMPTY. If so, than true is returned, false otherwise.

bool isFieldStateEmpty(Cell cell)

Checks, if in State in FieldState is BLOCKSTATE_EMPTY. If so, than true is returned, false otherwise.

void setFieldState(Cell cell, int i)

Sets one state in one cell on slots in FieldState.

void setFieldState(int x, int y, int i)

Sets one state in one cell on slots in FieldState.

int getFieldState(int x, int y)

Returns Blocktype at position x, y.

int getSlotInByName(int CellX, int CellY, string _name)

Retuns position in slot vector by name.

int getSlotOutByName(int CellX, int CellY, string _name)

Retuns position in slot vector by name.

vector<Connection> getConnectionList()

Returns ConnectionList.

Connection getConnection(int i)

Returns one item from ConnectionList.

void clearConnectionList()

Removes all connections from ConnectionList vector.

void addConnectionList(Connection conn)

Adds a connection to ConnectionList vector.

void moveConnectionList(int FromCellX, int FromCellY, int ToCellX, int ToCellY)

Updates ConenctionList, if a block is moved on the grid.

void delConnectionList(int CellX, int CellY)

Updates ConenctionList, if a block is deleted from the grid.

void delConnectionList(int FromCellX, int FromCellY, int ToCellX, int ToCellY, int OutPort, int InPort)

Updates ConenctionList, if a connection is deleted from the grid.

int getNrInputs(Cell CellTo, int row)

Returns number of inputs into one input slot.

int getNrOutputs(Cell cellFrom, int row)

Returns number of outputs from one output slot.

void addBlockContainer(int CellX, int CellY)

Adds one cell to the container list and checks for double entries.

void addOrDelBlockContainer(int CellX, int CellY)

Adds one cell to the container list, if it is not already present. If it is already in the list, the entry is removed.

void delBlockContainer(int CellX, int CellY)

Removes one cell to the container list.

vector<Cell> getBlockContainer()

Returns container list.

void clearBlockContainer()

Removes all cells from the container list.

vector<Cell> getConnectedFromCell(int FromCellX, int FromCellY)

Retuns a vector, which holds all cells, that are connected to the output port of FromCell.

vector<Cell> getConnectedToCell(int ToCellX, int ToCellY)

Retuns a vector, which holds all cells, that are connected to the input port of ToCell.

vector<Cell> getDataFromCell(int FromCellX, int FromCellY)

Retuns a vector, which holds all cells, that are connected to the output port of FromCell.

vector<Cell> getDataToCell(int ToCellX, int ToCellY)

Retuns a vector, which holds all cells, that are connected to the input port of ToCell.

void AddBlockList(CBlockBase block)

Adds a block to the blocklist.

bool compareCell(Cell cell1, Cell cell2)

Compares position of two cells. True, if cells are on the same position.

void printConnection(Connection conn)

Prints details about one connection to std::out. Debug function.

Cell getCellById(int Id)

Public Members

Connection ConnectionStart

Temporary Connection, which is pushed after connection is made into vector ConnectionList.

int BlockListWidth

X-Size of block cells on grid.

int BlockListHeight

Y-Size of block cells on grid.

int GridWidth

X-Size of block grid in pixels.

int GridHeight

Y-Size of block grid in pixels.

Private Members

vector<vector<int>> FieldState

This holds all states and position We define a 2d matrix (19 positions, 2 lines)

vector<CBlockBase> BlockList

This holds a list of blocks. Blocks are identified by position in this vector.

vector<Connection> ConnectionList

This will hold all connections.

vector<std::shared_ptr<CBlockBase>> BlockPointer

This holds a list of pointers to all blocks. Pointers live as long as block is in UI.

vector<Cell> BlockContainer

This vector holds all cells selected for merging in a container.

File cros.cpp

File cros.h

class CRos
#include <cros.h>

Class for interaction between GUI and Ros.

Here all functions are hidden for Ros. The GUI has no functions itself!

Public Functions

CRos(QNEMainWindow *pointerQNEMainWindow)
~CRos()
std::vector<std::pair<boost::shared_ptr<geometry_msgs::Pose>, string>> getMongoPose()

Returns all pose messages with names from mongo.

std::vector<string> getRosServicelist()

Returns all ROS services.

std::vector<vector<std::pair<string, string>>> getRosServiceRequestdetailslist()

Returns all ROS services request details.

vector<std::pair<string, string>> getRosServiceRequestdetailslist(int i)

Returns ROS services request details for one service.

void setRosServiceRequestdetailslist(int i, vector<std::pair<string, string>> val)

Sets one service request details for one service. This is used as the pair holds <name, value> to set the value.

std::vector<vector<string>> getRosServiceRequestdetailslistUnits()

Returns all ROS services request details.

vector<string> getRosServiceRequestdetailslistUnits(int i)

Returns ROS services request details for one service.

vector<string> getRosServiceTypelist()

Returns ROS service type list.

string getRosServiceTypelist(int i)

Returns ROS service type for one service.

void fillMongoPose()

Fills vector of pose messages.

void fillRosServicelist()
std::vector<std::pair<boost::shared_ptr<sensor_msgs::JointState>, string>> getMongoJointState()

Returns all joint state messages with names form mongo.

void fillMongoJointState()

Fills vector of joint state messages.

std::vector<string> getTfNames()

Returns all pose names form tf.

void fillTfNames()

Fills vector of pose names.

void fillTfNamesCallback()

Thread Callback for fillTfNames()

tf::StampedTransform getTfTransformation(string frameA, string frameB)

Returns a Tf transformation.

void fillBlocklist()

Fills block list in cblockhub. Reads blocks from ROS.

void saveContainerToFile(string name, string description)

Saves the current selection, e.g. container to file.

void saveAllblocksToFile(string filename)

Saves all blocks and connections to file.

YAML::Node saveBlocksToFile(vector<Cell> cells, string name, string description, string filename, bool isContainer)

Saves a vector of cells to a file in filename. This includes user settings and all conections between these blocks.

void loadAllblocksFromFile(string filename)

Loads blocks from filename. This includes user settings and all conections between these blocks.

CBlockBase loadBlockFromYaml(YAML::Node metadata, string templatename)

Parses one yaml entry and returns one finished block.

CBlockBase loadContainerFromYaml(YAML::Node metadata)

Parses one yaml entry and returns finished block containing all containered blocks.

void deleteFile(string filename)

Deletes file from harddrive.

void updateMetadata(QNEBlock *block, Cell cell)

Updates the YAMl code based on the gui inputs and stores it inside block->mCBlockbase.templateMetadata.

YAML::Node updateMetadataBlock(CBlockBase block)

Helper function for updateMetadata(). Only one block is parsed here, regardless of container state.

vector<CBlockBase> extractContainerBlocks(YAML::Node metadata)

Extracts single blocks from container YAML code.

vector<Connection> extractContainerConnections(YAML::Node metadata)

Extracts connections from a container state.

vector<Cell> extractContainerCells(YAML::Node metadata)

Extracts cells from a container state.

vector<Cell> getNextCell(Cell cellCurrent, int rowFrom, vector<Cell> cells, vector<Connection> connections, bool isData)

Returns next cell given vector of cells and connections.

string requestSmachaGenerate(string script)

Requests SMACHA Generate Service given YAML::Script. Returns string answer.

Public Members

QNEMainWindow *pointerToQNEMainWindow

Used to call parent class.

string path

Path to node.

string pathBlocks

Path to blocks.conf.

string pathSmachaserverTemplate

Path to SMACHA Server Templates.

string pathSmachaserverGenerate

Path to SMACHA Server Generate.

Private Members

ros::NodeHandle n

Local node handle.

std::vector<std::pair<boost::shared_ptr<geometry_msgs::Pose>, string>> mongoPose

Holds all Mongo Pose information.

std::vector<std::pair<boost::shared_ptr<sensor_msgs::JointState>, string>> mongoJointState

Holds all Mongo Joint information.

std::vector<string> tfNames

Holds all TF name information.

std::thread threadFillTfNames

Thread for TF name collection.

std::vector<string> rosServicelist

Holds all Ros services.

std::vector<string> rosServiceTypelist

Holds all Ros service types.

std::vector<vector<std::pair<string, string>>> rosServiceRequestdetailslist

Holds all Ros service request details.

std::vector<vector<string>> rosServiceRequestdetailslistUnits

Holds units of rosServiceRequestdetailslist.

std::vector<string> templatesAlwaysloadfromfile

This list will always be loaded from file. It is used to load the standard robot starting block.

File main.cpp

Functions

int main(int argc, char *argv[])

File qneblock.cpp

File qneblock.h

class QNEBlock : public QObject, public QGraphicsPathItem
#include <qneblock.h>

QT drawing of blocks.

This class holds all QT drawing functions for blocks.

Public Types

enum [anonymous]

Values:

Type = QGraphicsItem::UserType + 3

Public Functions

QNEBlock(QGraphicsItem *parent, QNEMainWindow *pointerQNEMainWindow, CBlockBase block)
~QNEBlock()
QNEPort *addPort(const QString &name, bool isOutput, int flags = 0, int ptr = 0)

This function adds one port to a block. Instead of directly calling this function, use addInputPort, addOutputPort, addInputPorts, or addOutputPorts.

Parameters
  • QString: name description of port
  • bool: isOutput set to true, if port should be on right side of block.

void addInputPort(const QString &name)

This function adds one input port.

Parameters
  • QString: name description of port

void addOutputPort(const QString &name)

This function adds one output port.

Parameters
  • QString: name description of port

void addInputPorts(const QStringList &names)

This function adds multiple input ports.

Parameters
  • QStringList: names descriptions of port

void addOutputPorts(const QStringList &names)

This function adds multiple output ports.

Parameters
  • QStringList: names descriptions of port

void save(QDataStream &ds)

Serializes qt data. Deprecated.

void load(QDataStream &ds, QMap<quint64, QNEPort *> &portMap)

Deserializes qt data. Deprecated.

void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)

Paints one widget to the scene.

QVector<QNEPort *> ports()

List of ports.

int type() const
void drawUI(QWidget *container)

draws parameter menu

void drawUIEmpty(QWidget *container)

draws empty parameter menu

void setBlockId(int _blockId)

sets current Block Id

int getBlockId()

returns current block id

void drawSlots()

draws all Slots and Name of Block

string getUniquename()

returns a block unique name, made up of block type and block id

int getHorzMargin()
int getVertMargin()
int getWidth()
int getHeight()
int getFontWidth()
int getFontHeight()
int getPortRadius()

Public Members

QNEMainWindow *pointerToQNEMainWindow

Used to call parent class.

CBlockBase mCBlockbase

All block gui information are stored here.

Public Slots

void drawUIInputSave(int nr)

Draws the parameter menu for input elements of this block.

Parameters
  • int: nr There could be multiple elements. They are stored in a vector. nr refers to the position in the vector.

void drawUISliderSave(int nr)

Draws the parameter menu for slider elements of this block.

Parameters
  • int: nr There could be multiple elements. They are stored in a vector. nr refers to the position in the vector.

void drawUIValuefieldSave(int nr)

Draws the parameter menu for value field elements of this block.

Parameters
  • int: nr There could be multiple elements. They are stored in a vector. nr refers to the position in the vector.

void drawUITextfieldSave(int nr)

Draws the parameter menu for text field elements of this block.

Parameters
  • int: nr There could be multiple elements. They are stored in a vector. nr refers to the position in the vector.

void drawUIServiceSave(int nr)

Draws the parameter menu for Service state elements of this block.

Parameters
  • int: nr There could be multiple elements. They are stored in a vector. nr refers to the position in the vector.

void drawUIServicerequestSave(int nr)

Draws the parameter menu for service request elements of this block.

Parameters
  • int: nr There could be multiple elements. They are stored in a vector. nr refers to the position in the vector.

void containerSave()

Draws the container menu.

Parameters
  • int: nr There could be multiple elements. They are stored in a vector. nr refers to the position in the vector.

map<string, string> getDataInput()

This function returns a map of all inputs coming from data connections.

Protected Functions

QVariant itemChange(GraphicsItemChange change, const QVariant &value)

Private Members

int horzMargin

Horizontal margin of block.

int vertMargin

Vertical margin of block.

int width

Width of block.

int height

Height of block.

int idCounterOut

ID of out ports.

int idCounterIn

ID of in ports.

int fontWidth

Font parameter.

int fontHeight

Font parameter.

int portRadius

Size of one port.

int blockId

Unique ID of this block.

File qneconnection.cpp

File qneconnection.h

class QNEConnection : public QGraphicsPathItem
#include <qneconnection.h>

QT drawing of connections.

This class holds all QT drawing functions for connections between blocks.

Public Types

enum [anonymous]

Values:

Type = QGraphicsItem::UserType + 2

Public Functions

QNEConnection(QGraphicsItem *parent = 0)
~QNEConnection()
void setPos1(const QPointF &p)

This sets the starting point of a connection to p.

Parameters
  • QPointF: p position p

void setPos2(const QPointF &p)

This sets the end point of a connection to p.

Parameters
  • QPointF: p position p

void setPort1(QNEPort *p)

This sets the starting point of a connection to port p.

Parameters

void setPort2(QNEPort *p)

This sets the end point of a connection to port p.

Parameters

void updatePosFromPorts()

Redraws connection based on m_port1 and m_port2.

void updatePath()

Redraws connection based on pos1 and pos2.

QNEPort *port1() const

Returns port m_port1.

QNEPort *port2() const

Returns port m_port2.

void save(QDataStream &ds)

Serializes QT data. Deprecated.

void load(QDataStream&, const QMap<quint64, QNEPort *> &portMap) const

Deserializes QT data. Deprecated.

Public Members

bool connectsOwnBlock

If true, than this connections goes to the input of this block.

Private Members

QPointF pos1

Start point of connection.

QPointF pos2

End point of connection.

QNEPort *m_port1

Start port of connection.

QNEPort *m_port2

End port of connection.

File qnemainwindow.cpp

File qnemainwindow.h

class QNEMainWindow : public QMainWindow
#include <qnemainwindow.h>

QT drawing of main window.

This class holds all QT drawing functions for the main GUI window.

Public Functions

QNEMainWindow(QWidget *parent = 0, QNEMainWindow *pointerQNEMainWindow = 0)
~QNEMainWindow()
void parametermenuEmpty()

This function simply updates the parameter menu when block is deleted.

void parametermenuContainer()

This function updates the parameter menu to show the container menu.

void parametermenuBlock(QNEBlock *block)

This function updates the parameter menu to show the block menu.

void parametermenuUpdate()

This function updates the parameter menu according to number of selected states.

void blockAdd(CBlockBase block, Cell cell)

This function adds one specific block to the display. Blocktype is always 1.

void connectionAdd(Connection Conn)

This function adds one connections.

void fillBlockmenu()

Resets left block menu and rereads entries.

Public Members

QNEMainWindow *pointerToQNEMainWindow
QNodesEditor *nodesEditor
shared_ptr<CRos> mCRos

Class for all ROS communications.

shared_ptr<CBlockHub> mCBlockhub

Class for block communication.

Private Functions

void drawGrid()

Draws the grid.

Private Members

QMenu *fileMenu
QGraphicsView *view
QGraphicsScene *scene
QListWidget *listBlockmenu
QVBoxLayout *layoutV1
QVBoxLayout *layoutV2
QVBoxLayout *layoutV3
QWidget *widgetContainer1
QWidget *widgetContainer2
QWidget *widgetContainerUpdate
QDockWidget dockwidgetBlock

This holds the left widget, should be blocks menu.

QDockWidget dockwidgetParameter

This holds the left widget, should be parameter menu.

int blockId = 0

Counter for block ids.

QNEBlock *blockGui

Block to draw gui in empty or container state.

Private Slots

void saveFile()

Serializes QT data. Deprecated.

void loadFile()

Deserializes QT data. Deprecated.

void blockAdd()

This function adds a block to the display. Blocktype is chosen from list, Cell is the first empty one.

void containerDelete()

This function removes a block from the display.

void quit()

Terminates Application.

void generate()

Generates SMACHA code.

YAML::Node generateBlock(QNEBlock *block, Cell cell, int *idCounter, string robotName)

Generates SMACHA code for one block.

YAML::Node generateContainer(QNEBlock *block, Cell cell, int *idCounter, string robotName)

Generates SMACHA code for one container.

void blockDeleteAll()

Deletes all blocks and connections.

File qneport.cpp

File qneport.h

class QNEPort : public QGraphicsPathItem
#include <qneport.h>

QT drawing of port.

This class holds all QT drawing functions for ports.

Public Types

enum [anonymous]

Values:

Type = QGraphicsItem::UserType + 1
enum [anonymous]

Values:

NamePort = 1
TypePort = 2
ConnectPort = 3

Public Functions

QNEPort(QGraphicsItem *parent = 0)
~QNEPort()
void setNEBlock(QNEBlock *b)

This sets a pointer to the block this port is drawn on.

Parameters

void setName(const QString &n)

Set description of port.

Parameters
  • QString: n Description

void setIsOutput(bool o)

If true, port is drawn on right side of block.

Parameters
  • bool: o True/False

int radius()

Returns radius of port.

bool isOutput()

Returns, if port is output.

QVector<QNEConnection *> &connections()

List of all connections.

void setPortFlags(int f)

Flags for one port, block is drawn differently based on flags.

const QString &portName() const

Returns description of port.

int portFlags() const

Returns flags.

int type() const
QNEBlock *block() const

Returns pointer to block this port is drawn on.

quint64 ptr()
void setPtr(quint64 p)
bool isConnected(QNEPort *other)

True, if port is connected to some other port.

void setId(int i)

Sets unique block id.

int getId()

Returns unique block id.

Protected Functions

QVariant itemChange(GraphicsItemChange change, const QVariant &value)

Private Members

QNEBlock *m_block

Pointer to block this port is drawn on.

QString name

Port description.

bool isOutput_

True, if port should be drawn on right side.

QGraphicsTextItem *label

Text label, description of port.

int radius_

Size of port.

int margin

Distance to block border.

QVector<QNEConnection *> m_connections

List of all connections.

int m_portFlags

Flags of port.

quint64 m_ptr
int id

Unique port id.

File qnodeseditor.cpp

File qnodeseditor.h

class QNodesEditor : public QObject
#include <qnodeseditor.h>

QT logic of connections.

This class holds all QT logic functions for drawing blocks and connections on the main QT scene.

Public Functions

QNodesEditor(QObject *parent = 0)
void install(QGraphicsScene *scene)
bool eventFilter(QObject *o, QEvent *e)
void drawBackground(QPainter *painter, const QRectF &rect)
void itemDelete(QPointF pos)

Deletes an item at position pos.

QGraphicsItem *itemAt(const QPointF &pos)
QPointF getCell(QNEBlock *block)

Returns closest cell integers on grid, which block is in.

QPointF getCell(QPointF pos)

Returns closest cell integers on grid, which pos is in.

QPointF getPos(Cell cell)

Returns center position of cell.

QNEBlock *getBlock(Cell cell)

Returns block object in cell;.

Cell getRobotstart(int robotId)

Public Members

shared_ptr<CBlockHub> mCBlockhub
QNEMainWindow *pointerToQNEMainWindow

Used to call parent class.

Private Members

QGraphicsScene *scene
QNEConnection *conn
QSize mCellSize
QGraphicsItem *mDragged
QPointF mDragOffset
QPointF mDragStart
bool mControlPressed

Struct list

Struct CBlockBase::CHECKBOX

struct CHECKBOX

GUI element: checkbox.

Struct CBlockBase::CONTAINER

struct CONTAINER

GUI element: Container menu.

Struct CBlockBase::INPUT

struct INPUT

GUI element: input field.

Struct CBlockBase::META

struct META

block meta information

Struct CBlockBase::SERVICE

struct SERVICE

GUI element: service list.

Struct CBlockBase::SLIDER

struct SLIDER

GUI element: slider.

Struct CBlockBase::SlotSingle

struct SlotSingle

This will hold one slot input.

Struct CBlockBase::TEXTFIELD

struct TEXTFIELD

GUI element: text field.

Struct CBlockBase::TOOLLIST

struct TOOLLIST

GUI element: toollist.

Struct CBlockBase::TRANSFORMATION

struct TRANSFORMATION

GUI element: transformation.

Struct CBlockBase::VALUEFIELD

struct VALUEFIELD

GUI element: value field.

Struct Cell

struct Cell

Defines position of one block on the grid.

Struct Connection

struct Connection

Holds one connection.

Namespace list

Namespace YAML

namespace YAML

Namespace std

namespace std

Indices and tables