API Documentation
Loading...
Searching...
No Matches
DXFAttributes.h
Go to the documentation of this file.
1/**--------------------------------------------------------------------------------------------
2Copyright (c) 2019, NDEVR LLC
3tyler.parke@ndevr.org
4 __ __ ____ _____ __ __ _______
5 | \ | | | __ \ | ___|\ \ / / | __ \
6 | \ | | | | \ \ | |___ \ \ / / | |__) |
7 | . \| | | |__/ / | |___ \ V / | _ /
8 | |\ |_|_____/__|_____|___\_/____| | \ \
9 |__| \__________________________________| \__\
10
11Subject to the terms of the Enterprise+ Agreement, NDEVR hereby grants
12Licensee a limited, non-exclusive, non-transferable, royalty-free license
13(without the right to sublicense) to use the API solely for the purpose of
14Licensee's internal development efforts to develop applications for which
15the API was provided.
16
17The above copyright notice and this permission notice shall be included in all
18copies or substantial portions of the Software.
19
20THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
21INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
22PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
23FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
24OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25DEALINGS IN THE SOFTWARE.
26
27Library: CAD
28File: DXFAttributes
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include "Base/Headers/String.h"
35
36namespace NDEVR
37{
39 {
40 public:
42 : m_color(Constant<RGBColor>::NaN)
43 , m_line_type_scale(1.0)
44 , m_width(0)
45 , m_in_paper_space(false)
46 {}
47
48 DXFAttributes(const String& layer, const RGBColor& color, int width, String linetype, double linetypeScale)
49 : m_layer(layer)
50 , m_color(color)
51 , m_line_type(std::move(linetype))
52 , m_line_type_scale(linetypeScale)
53 , m_width(width)
54 , m_in_paper_space(false)
55 {}
56
57 DXFAttributes(String layer, const RGBColor& color, int width, String linetype, uint04 handle)
58 : m_layer(std::move(layer))
59 , m_color(color)
60 , m_line_type(std::move(linetype))
61 , m_line_type_scale(1.0)
62 , m_handle(std::move(handle))
63 , m_width(width)
64 , m_in_paper_space(false)
65 {}
66
67 bool operator==(const DXFAttributes& attributes) const
68 {
69 return m_layer == attributes.m_layer
70 && m_color == attributes.m_color
71 && m_block == attributes.m_block
72 && m_line_type == attributes.m_line_type
73 && m_line_type_scale == attributes.m_line_type_scale
74 && m_handle == attributes.m_handle
75 && m_width == attributes.m_width
76 && m_in_paper_space == attributes.m_in_paper_space;
77 }
78 bool operator!=(const DXFAttributes& attributes) const
79 {
80 return m_layer != attributes.m_layer
81 || m_color != attributes.m_color
82 || m_block != attributes.m_block
83 || m_line_type != attributes.m_line_type
84 || m_line_type_scale != attributes.m_line_type_scale
85 || m_handle != attributes.m_handle
86 || m_width != attributes.m_width
87 || m_in_paper_space != attributes.m_in_paper_space;
88 }
89
90 void setLayer(const String& layer) { m_layer = layer; }
91 [[nodiscard]] const String& getLayer() const { return m_layer; }
92
93 void setBlock(const String& block) { m_block = block; }
94 [[nodiscard]] const String& block() const { return m_block; }
95
96 void setColor(const RGBColor& color) { m_color = color; }
97
98 const RGBColor& getColor() const { return m_color; }
99
100 void setWidth(int width) { m_width = width; }
101
102 int getWidth() const { return m_width; }
103
104 void setLinetype(const String& linetype) { m_line_type = linetype; }
105
106 void setLinetypeScale(double linetypeScale) { m_line_type_scale = linetypeScale; }
107
108 double getLinetypeScale() const { return m_line_type_scale; }
109 const String& getLinetype() const
110 {
111 static const String by_layer("BYLAYER");
112 return m_line_type.size() == 0 ? by_layer : m_line_type;
113 }
114
115 void setHandle(const String& h) { m_handle = h; }
116 [[nodiscard]] const String& handle() const { return m_handle; }
117
118 void setInPaperSpace(bool on) { m_in_paper_space = on; }
119 bool isInPaperSpace() const { return m_in_paper_space; }
120
121 void setSection(const String& h) { m_section = h; }
122 const String& section() const { return m_section; }
123
124 private:
125 String m_section;
126 String m_layer;
127 String m_block;
128 RGBColor m_color;
129 String m_line_type;
130 fltp08 m_line_type_scale;
131 String m_handle;
132 int m_width;
133 // DXF code 67 (true: entity in paper space, false: entity in model space (default):
134 bool m_in_paper_space;
135 };
136
137}
constexpr t_index_type size() const
Definition Buffer.hpp:1461
Definition DXFAttributes.h:39
bool isInPaperSpace() const
Definition DXFAttributes.h:119
void setInPaperSpace(bool on)
Definition DXFAttributes.h:118
void setSection(const String &h)
Definition DXFAttributes.h:121
DXFAttributes(String layer, const RGBColor &color, int width, String linetype, uint04 handle)
Definition DXFAttributes.h:57
const String & getLayer() const
Definition DXFAttributes.h:91
void setColor(const RGBColor &color)
Definition DXFAttributes.h:96
const String & section() const
Definition DXFAttributes.h:122
DXFAttributes(const String &layer, const RGBColor &color, int width, String linetype, double linetypeScale)
Definition DXFAttributes.h:48
void setLinetypeScale(double linetypeScale)
Definition DXFAttributes.h:106
DXFAttributes()
Definition DXFAttributes.h:41
void setLayer(const String &layer)
Definition DXFAttributes.h:90
void setLinetype(const String &linetype)
Definition DXFAttributes.h:104
const String & getLinetype() const
Definition DXFAttributes.h:109
void setWidth(int width)
Definition DXFAttributes.h:100
const String & block() const
Definition DXFAttributes.h:94
bool operator==(const DXFAttributes &attributes) const
Definition DXFAttributes.h:67
double getLinetypeScale() const
Definition DXFAttributes.h:108
const RGBColor & getColor() const
Definition DXFAttributes.h:98
int getWidth() const
Definition DXFAttributes.h:102
void setBlock(const String &block)
Definition DXFAttributes.h:93
void setHandle(const String &h)
Definition DXFAttributes.h:115
const String & handle() const
Definition DXFAttributes.h:116
bool operator!=(const DXFAttributes &attributes) const
Definition DXFAttributes.h:78
Represents a color in the RGB space with optional alpha transparency.
Definition RGBColor.h:53
Definition String.h:40
Definition ACIColor.h:37
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:120
double fltp08
Defines an alias representing an 8 byte floating-point number.
Definition BaseValues.hpp:181
Definition File.h:213
Definition BaseValues.hpp:272