#include <dxflinepattern.h>
Definition at line 35 of file dxflinepattern.h.
lc::DxfLinePatternByValue::DxfLinePatternByValue |
( |
| ) |
|
|
inline |
DxfLinePatternByValue::DxfLinePatternByValue |
( |
const std::string & |
_name, |
|
|
const std::string & |
_description, |
|
|
const std::vector< double > & |
_path, |
|
|
const double |
length |
|
) |
| |
Definition at line 16 of file dxflinepattern.cpp.
const std::vector< double > & path() const
const std::string name() const override
std::string description() const override
std::vector< double > _path
static bool isBlank(const std::string str)
virtual lc::DxfLinePatternByValue::~DxfLinePatternByValue |
( |
| ) |
|
|
virtualdefault |
Definition at line 22 of file dxflinepattern.cpp.
static double calculatePathLength(const std::vector< double > &_path)
const std::vector< double > & path() const
const std::string & description() const
std::vector< double > _path
const std::string & name() const
double DxfLinePatternByValue::calculatePathLength |
( |
const std::vector< double > & |
_path | ) |
|
|
static |
Calculates the total length of a path
Definition at line 30 of file dxflinepattern.cpp.
31 return std::fabs(std::accumulate(
_path.begin(),
_path.end(), 0.));
std::vector< double > _path
std::string DxfLinePatternByValue::description |
( |
| ) |
const |
|
overridevirtual |
std::vector< double > DxfLinePatternByValue::generatePattern |
( |
const std::vector< double > & |
dxfPattern, |
|
|
const double |
length, |
|
|
const double |
lineWidth |
|
) |
| const |
Generate new LibreCAD compatible pattern.
- Parameters
-
dxfPattern | Pattern from DXF file |
length | Length of DXF pattern |
lineWidth | Width of the line (for dots size) |
- Returns
- New line pattern Generate a new pattern compatible with LibreCAD from a DXF pattern.
Definition at line 34 of file dxflinepattern.cpp.
43 std::vector<double> dxfPat;
45 if (dxfPattern.size() == 0) {
49 double last = dxfPattern.at(0);
51 for (
auto d : dxfPattern) {
54 dxfPat.push_back(lineWidth);
57 dxfPat.push_back(lineWidth);
64 dxfPat.push_back(std::fabs(d));
67 dxfPat.push_back(std::fabs(d));
78 last = last + std::fabs(d);
83 double mul =
length / last;
84 for (
unsigned int i = 0; i < dxfPat.size(); i++) {
85 dxfPat[i] = dxfPat[i] * mul;
const std::vector< double > DxfLinePatternByValue::lcPattern |
( |
double |
lineWidth = 1 | ) |
const |
Get cached LibreCAD compatible pattern.
- Parameters
-
lineWidth | Width of the line (for dots size) |
- Returns
- New or cached line pattern Get LibreCAD compatible pattern from cache and generate it if needed.
Definition at line 91 of file dxflinepattern.cpp.
95 catch (std::out_of_range &e) {
std::map< double, std::vector< double > > _lcPatterns
std::vector< double > _path
std::vector< double > generatePattern(const std::vector< double > &dxfPattern, const double length, const double lineWidth) const
Generate new LibreCAD compatible pattern.
double lc::DxfLinePatternByValue::length |
( |
| ) |
const |
const std::string DxfLinePatternByValue::name |
( |
| ) |
const |
|
overridevirtual |
const std::vector< double > & DxfLinePatternByValue::path |
( |
| ) |
const |
std::string lc::DxfLinePatternByValue::_description |
|
private |
std::map<double, std::vector<double> > lc::DxfLinePatternByValue::_lcPatterns |
|
mutableprivate |
double lc::DxfLinePatternByValue::_length |
|
private |
std::string lc::DxfLinePatternByValue::_name |
|
private |
std::vector<double> lc::DxfLinePatternByValue::_path |
|
private |
The documentation for this class was generated from the following files: