Laser Cutter application v1.0

Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Private Attributes | Static Private Attributes | List of all members
SvgLabel Class Reference

Custom class used for handling SVG images and its transformations. More...

`#include <svglabel.h>`

Inheritance diagram for SvgLabel:

## Public Types
enum | startPositions { drag }
| The startPositions enum (expandable to contain scaling posibilites for the SvgLabel) More...

## Public Member Functions
| SvgLabel (QWidget *parent=nullptr)
| ~SvgLabel ()
size_t | GetID () const
bool | XML_edit ()
| Edits the XML file of the instance. More...

## Static Public Member Functions
static std::vector< QString > | GetXmlAttributes ()
static size_t | GetTotal ()

## Public Attributes
SvgLabel * | m_select
| Pointer to self - should be a generic bool flag. More...
double | m_rotate
| Rotation of the instance. More...
QPixmap | m_img
| Holds the original QPixmap of the image. More...
QPixmap | m_scaled_img
QString | pathToImg
| Holds the absolute path to the image. Used in the XML_edit() method to edit the SVG file. More...
int | m_OG_position_x
| Position.x of non-rotated img. More...
int | m_OG_position_y
| Position.y of non-rotated img. More...
int | m_y_pos_offset
| Offset.y of the rotated image with regards to the non-rotated. More...
int | m_x_pos_offset
| Offset.x of the rotated image with regards to the non-rotated. More...
enum SvgLabel::startPositions | startPositions
cv::Point_< double > | m_image_position
| Position of the image with regards to the top-left corner of the camera frame. More...

## Protected Member Functions
void | mousePressEvent (QMouseEvent *event)
| mousePressEvent More...
void | mouseMoveEvent (QMouseEvent *event)
| mouseMoveEvent More...

## Private Attributes
const size_t | iID
QPoint | dragStartPosition
| Start position of the move event. More...
QRect | dragStartGeometry
| Starting geometry of the move event. More...
enum startPositions | startPos

## Static Private Attributes
static size_t | iLiving =0
static size_t | iTotal =0
static std::vector< QString > | m_XML_attributes = {"rect", "circle", "ellipse", "line", "polyline", "polygon", "path"}

## Detailed Description

Custom class used for handling SVG images and its transformations.

Its purpose is to be able to be able to move the instance with the mouse and rotate. Subsequently to be able to modify, the adequate changes, the SVG file.

## Member Enumeration Documentation

## ◆ startPositions

enum SvgLabel::startPositions

The startPositions enum (expandable to contain scaling posibilites for the SvgLabel)

Enumerator
drag |

## Constructor & Destructor Documentation

## ◆ SvgLabel()

SvgLabel::SvgLabel | ( | QWidget * | parent = `nullptr` | ) |
| explicit

## ◆ ~SvgLabel()

SvgLabel::~SvgLabel | ( |  | ) |

## Member Function Documentation

## ◆ GetID()

size_t SvgLabel::GetID | ( |  | ) | const
| inline

Returns
  Returns the ID

## ◆ GetTotal()

static size_t SvgLabel::GetTotal | ( |  | ) |
| inline static

## ◆ GetXmlAttributes()

static std::vector<QString> SvgLabel::GetXmlAttributes | ( |  | ) |
| inline static

## ◆ mouseMoveEvent()

void SvgLabel::mouseMoveEvent | ( | QMouseEvent * | event | ) |
| protected

mouseMoveEvent

Calculates and moves the instance according to the position of the mouse. (The offset of the instance and the mouse event position)

Parameters

  event | MouseMove event

## ◆ mousePressEvent()

void SvgLabel::mousePressEvent | ( | QMouseEvent * | event | ) |
| protected

mousePressEvent

Frames the clicked instance to appear highlighted by its bounding box. Calls the methods of LasserCutter to initialize the information about the instance Prepares for the move event

Parameters

  event | MousePress event

## ◆ XML_edit()

bool SvgLabel::XML_edit | ( |  | ) |

Edits the XML file of the instance.

Adds the transform matrix according to the member variables of the instance

| cos(a) -sin(a) -cx × cos(a) + cy × sin(a) + cx + tx | | sin(a) cos(a) -cx × sin(a) - cy × cos(a) + cy + ty | | 0 0 1 |

Returns
  Returns true if successful, otherwise false.

## Member Data Documentation

## ◆ dragStartGeometry

QRect SvgLabel::dragStartGeometry
| private

Starting geometry of the move event.

## ◆ dragStartPosition

QPoint SvgLabel::dragStartPosition
| private

Start position of the move event.

## ◆ iID

const size_t SvgLabel::iID
| private

## ◆ iLiving

size_t SvgLabel::iLiving =0
| static private

## ◆ iTotal

size_t SvgLabel::iTotal =0
| static private

## ◆ m_image_position

cv::Point_<double> SvgLabel::m_image_position

Position of the image with regards to the top-left corner of the camera frame.

## ◆ m_img

QPixmap SvgLabel::m_img

Holds the original QPixmap of the image.

## ◆ m_OG_position_x

int SvgLabel::m_OG_position_x

Position.x of non-rotated img.

## ◆ m_OG_position_y

int SvgLabel::m_OG_position_y

Position.y of non-rotated img.

## ◆ m_rotate

double SvgLabel::m_rotate

Rotation of the instance.

## ◆ m_scaled_img

QPixmap SvgLabel::m_scaled_img

## ◆ m_select

SvgLabel* SvgLabel::m_select

Pointer to self - should be a generic bool flag.

## ◆ m_x_pos_offset

int SvgLabel::m_x_pos_offset

Offset.x of the rotated image with regards to the non-rotated.

## ◆ m_XML_attributes

std::vector< QString > SvgLabel::m_XML_attributes = {"rect", "circle", "ellipse", "line", "polyline", "polygon", "path"}
| static private

## ◆ m_y_pos_offset

int SvgLabel::m_y_pos_offset

Offset.y of the rotated image with regards to the non-rotated.

## ◆ pathToImg

QString SvgLabel::pathToImg

Holds the absolute path to the image. Used in the XML_edit() method to edit the SVG file.

## ◆ startPos

enum startPositions SvgLabel::startPos
| private

## ◆ startPositions

enum SvgLabel::startPositions SvgLabel::startPositions

The documentation for this class was generated from the following files:

- svglabel.h
- svglabel.cpp