CFx SDK Documentation  2023 SP0
DbLSStroke.h
Go to the documentation of this file.
1 // Copyright (C) 2002-2017, Open Design Alliance (the "Alliance").
3 // All rights reserved.
4 //
5 // This software and its documentation and related materials are owned by
6 // the Alliance. The software may only be incorporated into application
7 // programs owned by members of the Alliance, subject to a signed
8 // Membership Agreement and Supplemental Software License Agreement with the
9 // Alliance. The structure and organization of this software are the valuable
10 // trade secrets of the Alliance and its suppliers. The software is also
11 // protected by copyright law and international treaty provisions. Application
12 // programs incorporating this software must include the following statement
13 // with their copyright notices:
14 //
15 // This application incorporates Teigha(R) software pursuant to a license
16 // agreement with Open Design Alliance.
17 // Teigha(R) Copyright (C) 2002-2017 by Open Design Alliance.
18 // All rights reserved.
19 //
20 // By use of this software, its documentation or related materials, you
21 // acknowledge and accept the above terms.
23 
24 #ifndef ODDGNLS_DBLSSTROKE_H
25 #define ODDGNLS_DBLSSTROKE_H
26 
27 #include "OdaCommon.h"
28 #include "DbFiler.h"
29 
30 #include "TD_PackPush.h"
31 
39 {
40  enum WidthMode
41  {
42  kLSNoWidth = 0, // Stroke haven't width.
43  kLSWidthLeft = 1, // Stroke have width only for left side.
44  kLSWidthRight = 2, // Stroke have width only for right side.
45  kLSWidthFull = 3 // Stroke have width only for left and right sides.
46  };
47  enum CapMode
48  {
49  kLSCapsClosed = 0, // Closed stroke caps.
50  kLSCapsOpen = 1, // Open stroke caps.
51  kLSCapsExtended = 2, // Extended stroke caps.
52  kLSCapsHexagon = 3, // Hexagonal stroke caps.
53  kLSCapsOctagon = 4, // Octagonal stroke caps.
54  kLSCapsDecagon = 5, // Decagonal stroke caps.
55  kLSCapsArc = 30 // Round stroke caps.
56  };
57 
58 protected:
59  bool m_bIsDash; // true - dash; false - gap
61  bool m_bCanBeScaled; // Variable length
62  /* InvertAt boolean flags:
63  - Invert at: None: true, true.
64  - Invert at: Origin: false, true.
65  - Invert at: End: true, false.
66  - Invert at: Both: false, false.
67  - for non-RSC LineStyles (( Border ), ( Center ) and etc.) them always false.
68  - them always false for internal components.
69  */
72  double m_fLength;
73  double m_fStartWidth;
74  double m_fEndWidth;
77 
78 public:
80  : m_bIsDash(false)
85  , m_fLength(1.0)
86  , m_fStartWidth(0.0)
87  , m_fEndWidth(0.0)
90  {
91  }
92 
96  bool isDash() const { return m_bIsDash; }
100  bool isGap() const { return !m_bIsDash; }
104  void setDash() { m_bIsDash = true; }
108  void setGap() { m_bIsDash = false; }
114  void setIsDash(bool bSet) { m_bIsDash = bSet; }
115 
119  bool bypassCorner() const { return m_bBypassCorner; }
125  void setBypassCorner(bool bSet) { m_bBypassCorner = bSet; }
126 
130  bool canBeScaled() const { return m_bCanBeScaled; }
136  void setCanBeScaled(bool bSet) { m_bCanBeScaled = bSet; }
137 
141  bool invertAtOrigin() const { return !m_bDontInvertAtOrigin; }
147  void setInvertAtOrigin(bool bSet) { m_bDontInvertAtOrigin = !bSet; }
148 
152  bool invertAtEnd() const { return !m_bDontInvertAtEnd; }
158  void setInvertAtEnd(bool bSet) { m_bDontInvertAtEnd = !bSet; }
159 
163  double length() const { return m_fLength; }
169  void setLength(double fLen) { m_fLength = fLen; }
170 
174  double startWidth() const { return m_fStartWidth; }
180  void setStartWidth(double fWidth) { m_fStartWidth = fWidth; }
181 
185  double endWidth() const { return m_fEndWidth; }
191  void setEndWidth(double fWidth) { m_fEndWidth = fWidth; }
192 
196  WidthMode widthMode() const { return m_WidthMode; }
202  void setWidthMode(WidthMode mode) { m_WidthMode = mode; }
203 
207  CapMode capMode() const { return m_CapMode; }
213  void setCapMode(CapMode mode) { m_CapMode = mode; }
214 
215 private:
217 
218  OdResult dwgInFields(OdDbDwgFiler *pFiler);
219  void dwgOutFields(OdDbDwgFiler *pFiler) const;
220  OdResult dxfInFields(OdDbDxfFiler *pFiler);
221  void dxfOutFields(OdDbDxfFiler *pFiler) const;
222 
223 #ifdef ODA_DIAGNOSTICS
224  void trace(OdUInt32 nStroke) const;
225 #endif
226 };
227 
228 #include "TD_PackPop.h"
229 
230 #endif // ODDGNLS_DBLSSTROKE_H
false
Definition: DimVarDefs.h:165
unsigned int OdUInt32
OdResult
Definition: OdResult.h:29
bool m_bIsDash
Definition: DbLSStroke.h:59
bool invertAtOrigin() const
Definition: DbLSStroke.h:141
double endWidth() const
Definition: DbLSStroke.h:185
bool m_bCanBeScaled
Definition: DbLSStroke.h:61
bool m_bDontInvertAtEnd
Definition: DbLSStroke.h:71
bool canBeScaled() const
Definition: DbLSStroke.h:130
double m_fEndWidth
Definition: DbLSStroke.h:74
void setDash()
Definition: DbLSStroke.h:104
double m_fLength
Definition: DbLSStroke.h:72
void setCanBeScaled(bool bSet)
Definition: DbLSStroke.h:136
void setBypassCorner(bool bSet)
Definition: DbLSStroke.h:125
void setWidthMode(WidthMode mode)
Definition: DbLSStroke.h:202
void setGap()
Definition: DbLSStroke.h:108
double m_fStartWidth
Definition: DbLSStroke.h:73
double length() const
Definition: DbLSStroke.h:163
bool isDash() const
Definition: DbLSStroke.h:96
CapMode capMode() const
Definition: DbLSStroke.h:207
friend class OdDbLSStrokePatternComponentImpl
Definition: DbLSStroke.h:216
WidthMode widthMode() const
Definition: DbLSStroke.h:196
WidthMode m_WidthMode
Definition: DbLSStroke.h:75
CapMode m_CapMode
Definition: DbLSStroke.h:76
void setIsDash(bool bSet)
Definition: DbLSStroke.h:114
void setStartWidth(double fWidth)
Definition: DbLSStroke.h:180
bool invertAtEnd() const
Definition: DbLSStroke.h:152
void setCapMode(CapMode mode)
Definition: DbLSStroke.h:213
void setInvertAtOrigin(bool bSet)
Definition: DbLSStroke.h:147
double startWidth() const
Definition: DbLSStroke.h:174
bool m_bBypassCorner
Definition: DbLSStroke.h:60
void setInvertAtEnd(bool bSet)
Definition: DbLSStroke.h:158
void setEndWidth(double fWidth)
Definition: DbLSStroke.h:191
bool bypassCorner() const
Definition: DbLSStroke.h:119
bool isGap() const
Definition: DbLSStroke.h:100
void setLength(double fLen)
Definition: DbLSStroke.h:169
bool m_bDontInvertAtOrigin
Definition: DbLSStroke.h:70