zjf
2023-03-06 392b76515f40376b6d36f40a114850ef63650384
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
/////////////////////////////////////////////////////////////////////////////// 
// Copyright (C) 2002-2016, Open Design Alliance (the "Alliance"). 
// All rights reserved. 
// 
// This software and its documentation and related materials are owned by 
// the Alliance. The software may only be incorporated into application 
// programs owned by members of the Alliance, subject to a signed 
// Membership Agreement and Supplemental Software License Agreement with the
// Alliance. The structure and organization of this software are the valuable  
// trade secrets of the Alliance and its suppliers. The software is also 
// protected by copyright law and international treaty provisions. Application  
// programs incorporating this software must include the following statement 
// with their copyright notices:
//   
//   This application incorporates Teigha(R) software pursuant to a license 
//   agreement with Open Design Alliance.
//   Teigha(R) Copyright (C) 2002-2016 by Open Design Alliance. 
//   All rights reserved.
//
// By use of this software, its documentation or related materials, you 
// acknowledge and accept the above terms.
///////////////////////////////////////////////////////////////////////////////
 
#ifndef ODDGNLS_DBLSSYMBOLREFERENCE_H
#define ODDGNLS_DBLSSYMBOLREFERENCE_H
 
#include "OdaCommon.h"
#include "DbFiler.h"
 
#include "TD_PackPush.h"
 
/** \details
    Dgn Line Style Symbol Reference.
    \sa
    TD_Db
    <group OdDbLS_Classes> 
*/
struct OdDbLSSymbolReference
{
  enum VertexMask
  {
    kLSAtStroke    = 0,  // No vertex mask.
    kLSAtOrigin    = 4,  // Symbol at element origin.
    kLSAtEnd       = 8,  // Symbol at element end.
    kLSAtVertex    = 16  // Symbol on each element vertex.
  };
  enum Justify
  {
    kLSNoJustify     = 0, // No symbol justification (symbol on stroke)
    kLSJustifyLeft   = 1, // Symbol at left stroke side.
    kLSJustifyRight  = 2, // Symbol at right stroke side.
    kLSJustifyCenter = 3  // Symbol at center of stroke.
  };
  enum RotationType
  {
    kLSRelative    = 0, // Rotation relative to curve direction.
    kLSAbsolute    = 1, // Rotation in absolute coordinates of drawing.
    kLSAdjusted    = 2  // Rotation is adjusted left to right; mirror symbols if line is reversed.
  };
 
protected:
  bool m_bPartialStrokes; // Partial: Origin: true (projected: false), Projected: true (projected: true), None: false (projected: false)
  bool m_bClipPartial;
  bool m_bAllowStretch;
  bool m_bPartialProjected; // Look for m_bPartialStrokes
  bool m_bSymbolColor; // false - use line color, true - use element color
  bool m_bSymbolWeight; // false - use line lineweight, true - use element lineweight
  Justify m_Justify; // 0 for vertex symbols
  RotationType m_RotationType;
  OdInt16 m_nVertexMask; // 0 for stroke symbols
  double m_fXOffset;
  double m_fYOffset;
  double m_fAngle; // in radians
  OdInt32 m_nStroke; // -1 for vertex symbols
  OdDbHardPointerId m_SymbolComponent;
 
public:
  OdDbLSSymbolReference()
    : m_bPartialStrokes(true)
    , m_bClipPartial(false)
    , m_bAllowStretch(false)
    , m_bPartialProjected(false)
    , m_bSymbolColor(false)
    , m_bSymbolWeight(false)
    , m_Justify(kLSNoJustify)
    , m_RotationType(kLSRelative)
    , m_nVertexMask((OdInt16)kLSAtStroke)
    , m_fXOffset(0.0)
    , m_fYOffset(0.0)
    , m_fAngle(0.0)
    , m_nStroke(-1)
  {
  }
  
  /** \details
    Returns true if partial strokes mode is enabled.
 
    \remarks
    If this mode is disabled: display whole symbol or none.
  */
  bool partialStrokes() const { return m_bPartialStrokes; }
  /** \details
    Sets partial stroke mode.
 
    \param bSet [in]  New value to set.
  */
  void setPartialStrokes(bool bSet) { m_bPartialStrokes = bSet; }
 
  /** \details
    Returns true if symbol clipping on partial strokes enabled.
  */
  bool clipPartial() const { return m_bClipPartial; }
  /** \details
    Enables symbol clipping on partial strokes mode.
 
    \param bSet [in]  New value to set.
  */
  void setClipPartial(bool bSet) { m_bClipPartial = bSet; }
 
  /** \details
    Returns true if symbol can be scaled.
  */
  bool allowStretch() const { return m_bAllowStretch; }
  /** \details
    Enables symbol scalability.
 
    \param bSet [in]  New value to set.
  */
  void setAllowStretch(bool bSet) { m_bAllowStretch = bSet; }
 
  /** \details
    Returns true if project partial origin if it is beyond the end of line mode is enabled.
  */
  bool partialProjected() const { return m_bPartialProjected; }
  /** \details
    Sets project partial origin if it is beyond the end of line mode.
 
    \param bSet [in]  New mode to set.
  */
  void setPartialProjected(bool bSet) { m_bPartialProjected = bSet; }
 
  /** \details
    Returns true if symbol color usage enabled.
 
    \remarks
    Elsewhere line color will be used.
  */
  bool useSymbolColor() const { return m_bSymbolColor; }
  /** \details
    Sets symbol color usage mode.
 
    \param bSet [in]  New mode to set.
  */
  void setUseSymbolColor(bool bSet) { m_bSymbolColor = bSet; }
 
  /** \details
    Returns true if symbol lineweight usage enabled.
 
    \remarks
    Elsewhere line lineweight will be used.
  */
  bool useSymbolLineweight() const { return m_bSymbolWeight; }
  /** \details
    Sets symbol lineweight usage mode.
 
    \param bSet [in]  New mode to set.
  */
  void setUseSymbolLineweight(bool bSet) { m_bSymbolWeight = bSet; }
 
  /** \details
    Returns symbol justification on stroke.
  */
  Justify justify() const { return m_Justify; }
  /** \details
    Sets symbol justification on stroke.
 
    \param nSet [in]  New justification value to set.
  */
  void setJustify(Justify nSet) { m_Justify = nSet; }
 
  /** \details
    Returns symbol rotation mode.
  */
  RotationType rotationType() const { return m_RotationType; }
  /** \details
    Sets symbol rotation mode.
 
    \param nSet [in]  New rotation mode to set.
  */
  void setRotationType(RotationType nSet) { m_RotationType = nSet; }
 
  /** \details
    Returns vertex type for this symbol.
  */
  OdUInt32 vertexMask() const { return (OdUInt32)m_nVertexMask; }
  /** \details
    Sets vertex type for this symbol.
 
    \param nVertexMask [in]  Vertex type to set.
    \remarks
    Must be set to 0 if symbol is associated with stroke.
  */
  void setVertexMask(OdUInt32 nVertexMask) { m_nVertexMask = (OdInt16)nVertexMask; }
 
  /** \details
    Returns symbol offset in X direction.
  */
  double xOffset() const { return m_fXOffset; }
  /** \details
    Sets symbol offset in X direction.
 
    \param fOffset [in]  New offset to set.
  */
  void setXOffset(double fOffset) { m_fXOffset = fOffset; }
 
  /** \details
    Returns symbol offset in Y direction.
  */
  double yOffset() const { return m_fYOffset; }
  /** \details
    Sets symbol offset in Y direction.
 
    \param fOffset [in]  New offset to set.
  */
  void setYOffset(double fOffset) { m_fYOffset = fOffset; }
 
  /** \details
    Returns symbol rotation angle.
  */
  double angle() const { return m_fAngle; }
  /** \details
    Sets symbol rotation angle.
 
    \param fAngle [in]  Rotation angle in radians.
  */
  void setAngle(double fAngle) { m_fAngle = fAngle; }
 
  /** \details
    Returns stroke index with which this symbol is associated.
  */
  OdInt32 strokeNumber() const { return m_nStroke; }
  /** \details
    Associate symbol with stroke.
 
    \param nStroke [in]  Stroke index.
    \remarks
    Must be set to -1 if symbol is configured for vertex symbol usage.
  */
  void setStrokeNumber(OdInt32 nStroke) { m_nStroke = nStroke; }
 
  /** \details
    Returns symbol component identifier with which this symbol reference is associated.
  */
  OdDbObjectId symbolComponent() const { return m_SymbolComponent; }
  /** \details
    Sets symbol component identifier with which this symbol reference will be associated.
 
    \param id [in]  Symbol component identifier.
  */
  void setSymbolComponent(const OdDbObjectId &id) { m_SymbolComponent = id; }
 
private:
  friend class OdDbLSPointComponentImpl;
 
  OdResult dwgInFields(OdDbDwgFiler *pFiler);
  void dwgOutFields(OdDbDwgFiler *pFiler) const;
  OdResult dxfInFields(OdDbDxfFiler *pFiler);
  void dxfOutFields(OdDbDxfFiler *pFiler) const;
 
#ifdef ODA_DIAGNOSTICS
  void trace(OdUInt32 nSymbol) const;
#endif
};
 
#include "TD_PackPop.h"
 
#endif // ODDGNLS_DBLSSYMBOLREFERENCE_H