Laser Cutter application v1.0

Functions
FileHandler Namespace Reference

Namespace for file handling of the application. More...

## Functions
void | MakeTempDir (const QString &path)
| Creates a temporary directory. More...
void | RemoveTempDir (const QString &path)
| Removes a temporary directory. More...
QString | MakeSvgCopy (const QString &path, size_t &image_counter)
| Creates a copy of an Svg file. More...
bool | CreateSurfaceSVG (const std::vector< double > &aCutter_area)
| Creates the LaserCutter surface SVG. More...
void | ClearPathDir (const QString &aPath)
| Clears the directory. More...
std::vector< QString > | CopySvgsFromDir (size_t &image_counter, const QDir &aDir)
| Creates copies of Svgs in the given directory. More...
bool | SetConfig (const QString &aPath, const double &aWidth, const double &aHeight)
| Sets the path to the config file. More...

## Detailed Description

Namespace for file handling of the application.

## Function Documentation

## ◆ ClearPathDir()

void FileHandler::ClearPathDir | ( | const QString & | aPath | ) |

Clears the directory.

Clears the contents of the given directory

Parameters

  aPath | Path to the directory to be cleared

## ◆ CopySvgsFromDir()

std::vector< QString > FileHandler::CopySvgsFromDir | ( | size_t & | image_counter,
|  | const QDir & | aDir
| ) |  |

Creates copies of Svgs in the given directory.

Copies all svg files from the given directory into a temporary folder, which is used as a source

Parameters

  image_counter | Counter that assigns the copies incremental names (0.svg ; 1.svg; ...)
  aDir | Directory to be copied from

Returns
  Returns a vector of absolute paths of each of the copied Svg files (including the names of the copies of the Svg files)

## ◆ CreateSurfaceSVG()

bool FileHandler::CreateSurfaceSVG | ( | const std::vector< double > & | aCutter_area | ) |

Creates the LaserCutter surface SVG.

Creates the LaserCutter surface SVG with all the images placed correctly placed. Function creates a copy of the reference surface file and copies all the vector properties (rect, circle etc.) of the placed images to the final SVG file, which is later used as a source for G-Code generation.

Parameters

  aCutter_area | Defines the width and height of the final_surface SVG file

Returns
  Returns false if the process failed, otherwise true

## ◆ MakeSvgCopy()

QString FileHandler::MakeSvgCopy | ( | const QString & | path,
|  | size_t & | image_counter
| ) |  |

Creates a copy of an Svg file.

Creates a copy of an Svg file, used in the application as the image source

Parameters

  path | Path to the image
  image_counter | Serves as a filename for each instance of a copied image

Returns
  Returns the path to the copied image

## ◆ MakeTempDir()

void FileHandler::MakeTempDir | ( | const QString & | path | ) |

Creates a temporary directory.

Creates a temporary directory, which is used temporarily for storing copies of images

Parameters

  path | Path for the to-be-created directory

## ◆ RemoveTempDir()

void FileHandler::RemoveTempDir | ( | const QString & | path | ) |

Removes a temporary directory.

Removes a temporary directory recursivaly (all children)

Parameters

  path | Path to the to-be-destroyed directory

## ◆ SetConfig()

bool FileHandler::SetConfig | ( | const QString & | aPath,
|  | const double & | aWidth,
|  | const double & | aHeight
| ) |  |

Sets the path to the config file.

Sets the image source path to the config.xml file, which is used to initialize the application.

Parameters

  aPath | Path to be set
  aWidth | Width to be set
  aHeight | Height to be set

Returns
  Returns False if it has failed, otherwise true