API Documentation
Loading...
Searching...
No Matches
CADEntityStreamer.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: CADEntityStreamer
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include "CADEntities.h"
34#include "DXFAttributes.h"
35#include "Base/Headers/Log.h"
37
38namespace NDEVR
39{
40 class DXFValueManager;
41 /**--------------------------------------------------------------------------------------------------
42 \brief A base-class for streaming out CAD entities from a file or CAD program memory.
43 **/
45 {
46 public:
48 : m_log_features(false)
49 , m_logger(*logger)
50 {}
51 virtual ~CADEntityStreamer() = default;
52 virtual void processCodeValuePair(unsigned int, const String&) {/*if(m_log_features) m_logger.addMessage("Code Value Pair");*/ }
53 virtual void endSection() { if (m_log_features)m_logger.addMessage(_t("End Section")); }
54 virtual void addLayer(const LayerData&) { if (m_log_features)m_logger.addMessage(_t("Add Layer")); }
55 virtual void addLinetype(const LineTypeData&) { if (m_log_features)m_logger.addMessage(_t("Add Line Type")); }
56 virtual void addLinetypeDash(double) { if (m_log_features)m_logger.addMessage(_t("Add Line Type Dash")); }
57 virtual void addBlock(const BlockData&) { if (m_log_features)m_logger.addMessage(_t("Add Block")); }
58 virtual void addGroup(const DXFGroup&) { if (m_log_features)m_logger.addMessage(_t("Add Group")); }
59 virtual void endBlock(const uint04&) { if (m_log_features) m_logger.addMessage(_t("End Block")); }
60 virtual void addTextStyle(const StyleData&) { if (m_log_features)m_logger.addMessage(_t("Add Text Style")); }
61 virtual void addPoint(const PointData&) { if (m_log_features)m_logger.addMessage(_t("Add Point")); }
62 virtual void addLine(const LineData&) { if (m_log_features)m_logger.addMessage(_t("Add Line")); }
63 virtual void addXLine(const LineData&) { if (m_log_features)m_logger.addMessage(_t("Add X Line")); }
64 virtual void addDXFMaterial(DXFMaterial&) { if (m_log_features)m_logger.addMessage(_t("Add Material")); }
65 virtual void addRay(const LineData&) { if (m_log_features)m_logger.addMessage(_t("Add Ray")); }
66 virtual void addAttribute(const Attrib&) { if (m_log_features)m_logger.addMessage(_t("Add Attribute")); }
67 virtual void addAttributeDefintion(const Attrib&) { if (m_log_features)m_logger.addMessage(_t("Add Attribute Defintion")); }
68
69 virtual void addArc(const ArcData&) { if (m_log_features)m_logger.addMessage(_t("Add Arc")); }
70 virtual void addCircle(const CircleData&) { if (m_log_features)m_logger.addMessage(_t("Add Circle")); }
71 virtual void addEllipse(const EllipseData&) { if (m_log_features)m_logger.addMessage(_t("Add Ellipse")); }
72
73 virtual void addPolyline(const PolylineData&) { if (m_log_features)m_logger.addMessage(_t("Add Polyline")); }
74 virtual void addVertex(const Vector<4, fltp08>&) { if (m_log_features)m_logger.addMessage(_t("Add Vertex")); }
75 virtual void setVertex(uint04, const Vector<4, fltp08>&) { if (m_log_features)m_logger.addMessage(_t("Set Vertex")); }
76 virtual void addIndex(const Vector<4, sint04>&) { if (m_log_features)m_logger.addMessage(_t("Add Index")); }
77
78 virtual void addSpline(const SplineData&) { if (m_log_features)m_logger.addMessage(_t("Add Spline")); }
79 virtual void addControlPoint(const Vector<4, fltp08>&) { if (m_log_features)m_logger.addMessage(_t("Add Control Point")); }
80 virtual void addFitPoint(const Vector<3, fltp08>&) { if (m_log_features)m_logger.addMessage(_t("Add Fit Point")); }
81 virtual void addKnot(fltp08) { if (m_log_features)m_logger.addMessage(_t("Add Knot")); }
82 virtual void addInsert(const BlockInsert&) { m_logger.addMessage(_t("Add Insert")); }
83
84 virtual void addText(const TextData&) { if (m_log_features) m_logger.addMessage(_t("Add Text")); }
85 virtual void addDimAlign(const DimAlignedData&) { if (m_log_features) m_logger.addMessage(_t("Add Dim Align")); }
86 virtual void addDimLinear(const LinearDimension&) { if (m_log_features) m_logger.addMessage(_t("Add Dim Linear")); }
87 virtual void addDimRadial(const RadialDimension&) { if (m_log_features) m_logger.addMessage(_t("Add Dim Radial")); }
88 virtual void addDimDiametric(const DiametricDimension&) { if (m_log_features) m_logger.addMessage(_t("Add Dim Diametric")); }
89 virtual void addDimAngular(const AngularDimensionData<3>&) { if (m_log_features) m_logger.addMessage(_t("Add Dim Angular")); }
90 virtual void addDimAngular(const AngularDimensionData<4>&) { if (m_log_features) m_logger.addMessage(_t("Add Dim Angular 3P")); }
91 virtual void addDimOrdinate(const DimOrdinateData&) { if (m_log_features) m_logger.addMessage(_t("Add Dim Ordinate")); }
92 virtual void addMesh(CADMeshData&) { if (m_log_features) m_logger.addMessage(_t("Add MESH")); }
93 virtual void addLeader(const LeaderData&) { if (m_log_features) m_logger.addMessage(_t("Add Leader")); }
94 virtual void addLeaderVertex(const Vector<2, fltp08>&) { if (m_log_features) m_logger.addMessage(_t("Add Leader Vertex")); }
95
96 virtual void addHatch(const HatchData&) { if (m_log_features) m_logger.addMessage(_t("Add Hatch")); }
97
98 virtual void addTrace(const TraceData&) { if (m_log_features) m_logger.addMessage(_t("Add Trace")); }
99 virtual void add3dFace(const TraceData&) { if (m_log_features) m_logger.addMessage(_t("Add 3D Face")); }
100 virtual void add3dFace(const Triangle<3, fltp08>&) { if (m_log_features) m_logger.addMessage(_t("Add 3D Face")); }
101
102 virtual void addImage(const CADImageData&) { if (m_log_features) m_logger.addMessage(_t("Add Image")); }
103 virtual void linkImage(const ImageDefData&) { if (m_log_features) m_logger.addMessage(_t("Link Image")); }
104 virtual void addHatchLoop(const HatchLoopData&) { if (m_log_features) m_logger.addMessage(_t("Add Hatch Loop")); }
105 virtual void addHatchEdge(const HatchEdgeData&) { if (m_log_features) m_logger.addMessage(_t("Add Hatch Edge")); }
106
107 virtual void addXRecord(const HandleData&) { if (m_log_features) m_logger.addMessage(_t("Add XRecord")); }
108 virtual void addXRecordData(uint04, DXFValueManager*) { if (m_log_features) m_logger.addMessage(_t("Add X Data")); };
109
110 virtual void addDictionary(const CADDictionaryObject&) { if (m_log_features) m_logger.addMessage(_t("Add Dictionary")); }
111 virtual void addDictionaryEntry(const String&, const String&) { if (m_log_features) m_logger.addMessage(_t("Add Dictionary")); }
112
113 virtual void endEntity() { if (m_log_features) m_logger.addMessage(_t("End Sequence")); }
114
115 virtual void addComment(const String&) { if (m_log_features) m_logger.addMessage(_t("End Sequence")); }
116
117 virtual void setVariableVector(const String&, Vector<3, fltp08>, int) { if (m_log_features) m_logger.addMessage(_t("End Sequence")); }
118 virtual void setVariableString(const String&, const String&, int) { if (m_log_features) m_logger.addMessage(_t("End Sequence")); }
119 virtual void setVariableInt(const String&, int, int) { if (m_log_features) m_logger.addMessage(_t("End Sequence")); }
120 virtual void setVariableDouble(const String&, double, int) { if (m_log_features) m_logger.addMessage(_t("End Sequence")); }
121 virtual void endSequence() { if (m_log_features) m_logger.addMessage(_t("End Sequence")); }
122
123 virtual void setAttributes(const DXFAttributes&) {
124 //m_attributes = attrib;
125 }
126
127
128
129 virtual void setExtrusion(fltp08 dx, fltp08 dy, fltp08 dz, fltp08 elevation) {
130 m_extrusion.setDirection(dx, dy, dz);
131 m_extrusion.setElevation(elevation);
132 }
133
135 return m_extrusion;
136 }
137
138 protected:
142 };
143}
144
#define _t(english_string)
Definition Translator.h:90
A base-class for streaming out CAD entities from a file or CAD program memory.
Definition CADEntityStreamer.h:45
virtual void addDimAngular(const AngularDimensionData< 4 > &)
Definition CADEntityStreamer.h:90
virtual void setVariableVector(const String &, Vector< 3, fltp08 >, int)
Definition CADEntityStreamer.h:117
virtual void addHatchLoop(const HatchLoopData &)
Definition CADEntityStreamer.h:104
virtual void addDictionaryEntry(const String &, const String &)
Definition CADEntityStreamer.h:111
virtual void addDXFMaterial(DXFMaterial &)
Definition CADEntityStreamer.h:64
virtual void endSection()
Definition CADEntityStreamer.h:53
virtual void addDimOrdinate(const DimOrdinateData &)
Definition CADEntityStreamer.h:91
virtual void addLinetypeDash(double)
Definition CADEntityStreamer.h:56
virtual void addKnot(fltp08)
Definition CADEntityStreamer.h:81
virtual void add3dFace(const TraceData &)
Definition CADEntityStreamer.h:99
CADEntityStreamer(ProgressInfo *logger)
Definition CADEntityStreamer.h:47
virtual void linkImage(const ImageDefData &)
Definition CADEntityStreamer.h:103
virtual void addBlock(const BlockData &)
Definition CADEntityStreamer.h:57
virtual void addGroup(const DXFGroup &)
Definition CADEntityStreamer.h:58
virtual void addHatchEdge(const HatchEdgeData &)
Definition CADEntityStreamer.h:105
virtual void addVertex(const Vector< 4, fltp08 > &)
Definition CADEntityStreamer.h:74
virtual void setVariableDouble(const String &, double, int)
Definition CADEntityStreamer.h:120
virtual void addLayer(const LayerData &)
Definition CADEntityStreamer.h:54
virtual void addDimRadial(const RadialDimension &)
Definition CADEntityStreamer.h:87
virtual void addDimAlign(const DimAlignedData &)
Definition CADEntityStreamer.h:85
virtual void addLine(const LineData &)
Definition CADEntityStreamer.h:62
Extrusion m_extrusion
Definition CADEntityStreamer.h:140
virtual void addDimAngular(const AngularDimensionData< 3 > &)
Definition CADEntityStreamer.h:89
virtual void endBlock(const uint04 &)
Definition CADEntityStreamer.h:59
virtual void addDictionary(const CADDictionaryObject &)
Definition CADEntityStreamer.h:110
virtual void addFitPoint(const Vector< 3, fltp08 > &)
Definition CADEntityStreamer.h:80
virtual void addLeader(const LeaderData &)
Definition CADEntityStreamer.h:93
virtual void setExtrusion(fltp08 dx, fltp08 dy, fltp08 dz, fltp08 elevation)
Definition CADEntityStreamer.h:129
virtual void addPolyline(const PolylineData &)
Definition CADEntityStreamer.h:73
virtual void addTextStyle(const StyleData &)
Definition CADEntityStreamer.h:60
virtual void addXLine(const LineData &)
Definition CADEntityStreamer.h:63
virtual ~CADEntityStreamer()=default
virtual void addComment(const String &)
Definition CADEntityStreamer.h:115
virtual void setVariableString(const String &, const String &, int)
Definition CADEntityStreamer.h:118
ProgressInfo & m_logger
Definition CADEntityStreamer.h:141
virtual void addXRecordData(uint04, DXFValueManager *)
Definition CADEntityStreamer.h:108
virtual void addMesh(CADMeshData &)
Definition CADEntityStreamer.h:92
virtual void endEntity()
Definition CADEntityStreamer.h:113
Extrusion & getExtrusion()
Definition CADEntityStreamer.h:134
virtual void addHatch(const HatchData &)
Definition CADEntityStreamer.h:96
virtual void addLeaderVertex(const Vector< 2, fltp08 > &)
Definition CADEntityStreamer.h:94
virtual void addControlPoint(const Vector< 4, fltp08 > &)
Definition CADEntityStreamer.h:79
bool m_log_features
Definition CADEntityStreamer.h:139
virtual void addDimLinear(const LinearDimension &)
Definition CADEntityStreamer.h:86
virtual void addAttribute(const Attrib &)
Definition CADEntityStreamer.h:66
virtual void addText(const TextData &)
Definition CADEntityStreamer.h:84
virtual void addXRecord(const HandleData &)
Definition CADEntityStreamer.h:107
virtual void addSpline(const SplineData &)
Definition CADEntityStreamer.h:78
virtual void addAttributeDefintion(const Attrib &)
Definition CADEntityStreamer.h:67
virtual void add3dFace(const Triangle< 3, fltp08 > &)
Definition CADEntityStreamer.h:100
virtual void setVertex(uint04, const Vector< 4, fltp08 > &)
Definition CADEntityStreamer.h:75
virtual void addLinetype(const LineTypeData &)
Definition CADEntityStreamer.h:55
virtual void addInsert(const BlockInsert &)
Definition CADEntityStreamer.h:82
virtual void endSequence()
Definition CADEntityStreamer.h:121
virtual void processCodeValuePair(unsigned int, const String &)
Definition CADEntityStreamer.h:52
virtual void addTrace(const TraceData &)
Definition CADEntityStreamer.h:98
virtual void addCircle(const CircleData &)
Definition CADEntityStreamer.h:70
virtual void addIndex(const Vector< 4, sint04 > &)
Definition CADEntityStreamer.h:76
virtual void addImage(const CADImageData &)
Definition CADEntityStreamer.h:102
virtual void setVariableInt(const String &, int, int)
Definition CADEntityStreamer.h:119
virtual void setAttributes(const DXFAttributes &)
Definition CADEntityStreamer.h:123
virtual void addArc(const ArcData &)
Definition CADEntityStreamer.h:69
virtual void addRay(const LineData &)
Definition CADEntityStreamer.h:65
virtual void addPoint(const PointData &)
Definition CADEntityStreamer.h:61
virtual void addEllipse(const EllipseData &)
Definition CADEntityStreamer.h:71
virtual void addDimDiametric(const DiametricDimension &)
Definition CADEntityStreamer.h:88
DXF Style attributes that can be applied to CAD Entity objects.
Definition DXFAttributes.h:42
DXF streams store data in a large numbered index structure. This class optimally stores this data so ...
Definition DXFValueManager.h:46
logic for storing a extrusion data in a CAD-friendly way for exporting and importing.
Definition CADEntities.h:1055
void setDirection(fltp08 dx, fltp08 dy, fltp08 dz)
Definition CADEntities.h:1067
void setElevation(double elevation)
Definition CADEntities.h:1075
A light-weight base class for Log that allows processes to update, without the need for additional in...
Definition ProgressInfo.hpp:48
virtual bool addMessage(const LogMessage &message)=0
The core String class for the NDEVR API.
Definition String.h:69
A triangle is a polygon with three edges and three vertices. It is one of the basic shapes in geometr...
Definition Triangle.hpp:138
A fixed-size array with better performance compared to dynamic containers.
Definition Vector.hpp:60
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:96
double fltp08
Defines an alias representing an 8 byte floating-point number.
Definition BaseValues.hpp:149
logic for storing an angular dimension in a CAD-friendly way for exporting and importing.
Definition CADEntities.h:657
logic for storing a arc data in a CAD-friendly way for exporting and importing.
Definition CADEntities.h:297
logic for storing a attribue data in a CAD-friendly way for exporting and importing.
Definition CADEntities.h:470
A block structure (Similar to a Model) used to share data with CAD.
Definition CADEntities.h:196
Information for how to place a CAD block within a scene (Similar to Model).
Definition CADEntities.h:528
A container for information pointing to a CAD dictionary in CAD memory.
Definition CADEntities.h:614
logic for storing a image data in a CAD-friendly way for exporting and importing.
Definition CADEntities.h:967
Stores mesh data in a way optimized for CAD.
Definition CADEntities.h:379
logic for storing a circle data in a CAD-friendly way for exporting and importing.
Definition CADEntities.h:487
A type of entity in CAD representing several entities grouped together.
Definition CADEntities.h:1031
A DXF friendly material class which contains UV properties similar to a Material object.
Definition CADEntities.h:1015
logic for storing an diametric dimension in a CAD-friendly way for exporting and importing.
Definition CADEntities.h:643
A CAD measurement similar to AngleMeasurementModel.
Definition CADEntities.h:589
logic for storing an ordinate dimension in a CAD-friendly way for exporting and importing.
Definition CADEntities.h:680
Stores Ellipse information for interfacing with CAD.
Definition CADEntities.h:496
A handle used to reference an object in CAD.
Definition CADEntities.h:148
logic for storing a hatch-data in a CAD-friendly way for exporting and importing.
Definition CADEntities.h:735
Stores information about the edge of a CAD hatch pattern.
Definition CADEntities.h:775
Provides loops of data for the CAD hatch pattern.
Definition CADEntities.h:762
Stores the definition of an Image for easy interface with CAD.
Definition CADEntities.h:1043
Layer information shared with CAD.
Definition CADEntities.h:175
logic for storing a leader in a CAD-friendly way for exporting and importing.
Definition CADEntities.h:696
A CAD-friendly way to store line segment information.
Definition CADEntities.h:509
information for a type of line in CAD
Definition CADEntities.h:218
A CAD measurement similar to DistanceMeasurementModel.
Definition CADEntities.h:600
Point data stored in a friendly way for interfacing with CAD.
Definition CADEntities.h:539
logic for storing a polyline data in a CAD-friendly way for exporting and importing.
Definition CADEntities.h:317
logic for storing a radial dimension in a CAD-friendly way for exporting and importing.
Definition CADEntities.h:630
logic for storing a spline data in a CAD-friendly way for exporting and importing.
Definition CADEntities.h:362
logic for storing a style data in a CAD-friendly way for exporting and importing.
Definition CADEntities.h:245
logic for storing a text data in a CAD-friendly way for exporting and importing.
Definition CADEntities.h:451
logic for storing a trace data in a CAD-friendly way for exporting and importing.
Definition CADEntities.h:349