CFx SDK Documentation 2024 SP0
Loading...
Searching...
No Matches
GiLineweightOverride.h
Go to the documentation of this file.
1
2// Copyright (C) 2002-2022, 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-2022 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 enum Flags
44 {
46 kLwdOverrideStyle = (1 << 1)
47 };
53 public:
66 : m_uFlags(0)
67 , m_dLwdScale(1.0)
68 , m_dPixScale(1.0)
69 , m_lineCapStyle(OdPs::kLesRound)
70 , m_lineJoinStyle(OdPs::kLjsRound)
71 { }
77 void setScaleOverride(double dLwdScale)
78 {
80 m_dLwdScale = m_dPixScale = dLwdScale;
81 }
82
87 {
90 }
91
98 bool hasScaleOverride() const
99 {
101 }
102
109 double scaleOverride() const
110 {
111 return m_dLwdScale;
112 }
113 // Helpers
119 void setPixelScale(double dPixScale)
120 {
121 m_dPixScale = dPixScale;
122 }
123
130 double pixelScale() const
131 {
132 return m_dPixScale;
133 }
134 // Style override
142 {
144 m_lineCapStyle = lineCapStyle;
145 m_lineJoinStyle = lineJoinStyle;
146 }
151 {
155 }
162 bool hasStyleOverride() const
163 {
165 }
173 {
174 return m_lineCapStyle;
175 }
183 {
184 return m_lineJoinStyle;
185 }
186 // Helpers
187
194 bool hasOverrides() const
195 {
196 return m_uFlags != 0;
197 }
198
212 bool operator ==(const OdGiLineweightOverride &lwdO2) const
213 {
214 if (lwdO2.m_uFlags != m_uFlags)
215 return false;
216 if (hasScaleOverride())
217 {
218 if (!OdEqual(lwdO2.m_dLwdScale, m_dLwdScale))
219 return false;
220 }
221 if (hasStyleOverride())
222 {
223 if (lwdO2.m_lineCapStyle != m_lineCapStyle ||
225 return false;
226 }
227 return true;
228 }
242 bool operator !=(const OdGiLineweightOverride &lwdO2) const
243 {
244 if (lwdO2.m_uFlags != m_uFlags)
245 return true;
246 if (hasScaleOverride())
247 {
248 if (!OdEqual(lwdO2.m_dLwdScale, m_dLwdScale))
249 return true;
250 }
251 if (hasStyleOverride())
252 {
253 if (lwdO2.m_lineCapStyle != m_lineCapStyle ||
255 return true;
256 }
257 return false;
258 }
259};
260
270{
271 protected:
273 public:
277 OdGiLineweightOverrideHelper() : m_pTraits(NULL) {}
278
284 OdGiLineweightOverrideHelper(OdGiSubEntityTraits &pTraits, const OdGiLineweightOverride &pOverride) : m_pTraits(NULL)
285 { setLineweightOverride(pTraits, pOverride); }
286
291 {
292 if (m_pTraits)
293 m_pTraits->popLineweightOverride();
294 }
295
302 {
303 m_pTraits = &pTraits;
304 m_pTraits->pushLineweightOverride(&pOverride);
305 }
306};
307
308#include "TD_PackPop.h"
309
310#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)
virtual void popLineweightOverride()
virtual bool pushLineweightOverride(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)