CFx SDK Documentation 2026 SP0
Loading...
Searching...
No Matches
GiLineweightOverride.h
Go to the documentation of this file.
1
2// Copyright (C) 2002-2024, 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 Open Design Alliance software pursuant to a license
16// agreement with Open Design Alliance.
17// Open Design Alliance Copyright (C) 2002-2024 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 _ODGILINEWEIGHTOVERRIDE_INCLUDED_
25#define _ODGILINEWEIGHTOVERRIDE_INCLUDED_
26
27#include "Gi/Gi.h"
28#include "Ps/PlotStyles.h"
29
30#include "TD_PackPush.h"
31
41{
42 protected:
43 //DOM-IGNORE-BEGIN
44 enum Flags
45 {
48 };
54 //DOM-IGNORE-END
55 public:
68 : m_uFlags(0)
69 , m_dLwdScale(1.0)
70 , m_dPixScale(1.0)
71 , m_lineCapStyle(OdPs::kLesRound)
72 , m_lineJoinStyle(OdPs::kLjsRound)
73 { }
74
79 void setScaleOverride(double dLwdScale)
80 {
82 m_dLwdScale = m_dPixScale = dLwdScale;
83 }
84
93
100 bool hasScaleOverride() const
101 {
103 }
104
111 double scaleOverride() const
112 {
113 return m_dLwdScale;
114 }
115 // Helpers
121 void setPixelScale(double dPixScale)
122 {
123 m_dPixScale = dPixScale;
124 }
125
132 double pixelScale() const
133 {
134 return m_dPixScale;
135 }
136 // Style override
144 {
146 m_lineCapStyle = lineCapStyle;
147 m_lineJoinStyle = lineJoinStyle;
148 }
149
158
164 bool hasStyleOverride() const
165 {
167 }
168
175 {
176 return m_lineCapStyle;
177 }
178
188 // Helpers
189
196 bool hasOverrides() const
197 {
198 return m_uFlags != 0;
199 }
200
214 bool operator ==(const OdGiLineweightOverride &lwdO2) const
215 {
216 if (lwdO2.m_uFlags != m_uFlags)
217 return false;
218 if (hasScaleOverride())
219 {
220 if (!OdEqual(lwdO2.m_dLwdScale, m_dLwdScale))
221 return false;
222 }
223 if (hasStyleOverride())
224 {
225 if (lwdO2.m_lineCapStyle != m_lineCapStyle ||
227 return false;
228 }
229 return true;
230 }
231
244 bool operator !=(const OdGiLineweightOverride &lwdO2) const
245 {
246 if (lwdO2.m_uFlags != m_uFlags)
247 return true;
248 if (hasScaleOverride())
249 {
250 if (!OdEqual(lwdO2.m_dLwdScale, m_dLwdScale))
251 return true;
252 }
253 if (hasStyleOverride())
254 {
255 if (lwdO2.m_lineCapStyle != m_lineCapStyle ||
257 return true;
258 }
259 return false;
260 }
261};
262
272{
273 protected:
275 public:
280
287 { setLineweightOverride(pTraits, pOverride); }
288
293 {
294 if (m_pTraits)
295 m_pTraits->popLineweightOverride();
296 }
297
304 {
305 m_pTraits = &pTraits;
306 m_pTraits->pushLineweightOverride(&pOverride);
307 }
308};
309
310#include "TD_PackPop.h"
311
312#endif //_ODGILINEWEIGHTOVERRIDE_INCLUDED_
#define ODGI_EXPORT
Definition GiExport.h:35
unsigned int OdUInt32
bool OdEqual(double x, double y, double tol=1.e-10)
Definition OdaDefs.h:542
#define SETBIT_0(flags, bit)
Definition OdaDefs.h:519
#define GETBIT(flags, bit)
Definition OdaDefs.h:517
#define SETBIT_1(flags, bit)
Definition OdaDefs.h:520
void setLineweightOverride(OdGiSubEntityTraits &pTraits, const OdGiLineweightOverride &pOverride)
OdGiLineweightOverrideHelper(OdGiSubEntityTraits &pTraits, const OdGiLineweightOverride &pOverride)
LineJoinStyle
Definition PlotStyles.h:78
@ kLjsRound
Definition PlotStyles.h:81
LineEndStyle
Definition PlotStyles.h:69
@ kLesRound
Definition PlotStyles.h:72
OdPs::LineJoinStyle m_lineJoinStyle
OdPs::LineJoinStyle joinStyleOverride() const
bool operator==(const OdGiLineweightOverride &lwdO2) const
OdPs::LineEndStyle m_lineCapStyle
OdPs::LineEndStyle endStyleOverride() const
void setPixelScale(double dPixScale)
void setStyleOverride(OdPs::LineEndStyle lineCapStyle, OdPs::LineJoinStyle lineJoinStyle)
bool operator!=(const OdGiLineweightOverride &lwdO2) const
void setScaleOverride(double dLwdScale)