24#ifndef __ODGISELECTIONSTYLE_H__
25#define __ODGISELECTIONSTYLE_H__
80 bool isVisible()
const {
return m_transparency < 255; }
84 bool isOpaque()
const {
return !m_transparency; }
92 {
return (transparency() == cm2.
transparency()) && (!isVisible() || color() == cm2.
color()); }
94 {
return (transparency() != cm2.
transparency()) || (isVisible() && color() != cm2.
color()); }
104 kDrawElement = (1 << 0),
105 kPatternElement = (1 << 1),
106 kMaskElement = (1 << 2),
108 kGOnTopOfDepth = (1 << 3),
109 kGlobalFlags = kGOnTopOfDepth,
111 kLastElementStyleFlag = kGOnTopOfDepth
166 bool hasEffect()
const {
return isPatternEnabled() || (isColorMaskingEnabled() && colorMask().isVisible()); }
186 {
return ((m_nFlags & ~kGlobalFlags) == (secStyle.
m_nFlags & ~kGlobalFlags)) && (m_colorMask == secStyle.
m_colorMask); }
188 {
return ((m_nFlags & ~kGlobalFlags) != (secStyle.
m_nFlags & ~kGlobalFlags)) || (m_colorMask != secStyle.
m_colorMask); }
212 kDrawIsolines = (kLastElementStyleFlag << 1),
213 kDrawContours = (kLastElementStyleFlag << 2)
224 {
switch (edgeMode) {
225 case kIsolineEdges:
SETBIT_1(m_nFlags, kDrawIsolines);
SETBIT_0(m_nFlags, kDrawContours);
break;
226 case kContourEdges:
SETBIT_0(m_nFlags, kDrawIsolines);
SETBIT_1(m_nFlags, kDrawContours);
break;
227 default:
SETBIT_0(m_nFlags, kDrawIsolines | kDrawContours);
234 {
if (
GETBIT(m_nFlags, kDrawIsolines))
return kIsolineEdges;
235 if (
GETBIT(m_nFlags, kDrawContours))
return kContourEdges;
257 bool hasEffect()
const {
return ElementStyle::hasEffect() || hasLineWeightExtension() || (mode() != kExistEdges); }
262 void setByDefault() { ElementStyle::setByDefault(); m_lineWeightExtension = 0; }
266 void setAsDisabled() { ElementStyle::setAsDisabled(); m_lineWeightExtension = 0; }
270 void setForStippling() { ElementStyle::setForStippling(); m_lineWeightExtension = 0; }
276 m_nFlags |= kDrawIsolines; m_lineWeightExtension = 5; }
279 {
return ElementStyle::operator ==(secStyle) && (m_lineWeightExtension == secStyle.
m_lineWeightExtension); }
281 {
return ElementStyle::operator !=(secStyle) || (m_lineWeightExtension != secStyle.
m_lineWeightExtension); }
365 {
return static_cast<const GIntAccessor &
>(elemStyle).m_nFlags; }
378 {
if (m_pStyle) { m_flags[0] = GIntAccessor::extractIntFlags(style.
edgeStyle());
379 m_flags[1] = GIntAccessor::extractIntFlags(style.
faceStyle()); } }
381 GIntAccessor::installIntFlags(m_pStyle->
faceStyle(), m_flags[1]); } }
383 int makeEntryId(
bool bDrawOnTop,
bool bDrawIn3d)
const {
return ((bDrawOnTop) ? 1 : 0) | ((bDrawIn3d) ? 2 : 0); }
393 {
return m_styleEntry[makeEntryId(bDrawOnTop, bDrawIn3d)]; }
400 {
return m_styleEntry[makeEntryId(bDrawOnTop, bDrawIn3d)]; }
406 styleFor(
false,
true) = styleFor(
false,
false); styleFor(
true,
true) = styleFor(
true,
false); }
411 styleFor(
false,
false) = styleFor(
false,
true); styleFor(
true,
false) = styleFor(
true,
true); }
420 if (bFor2d) { tmpEntry = styleFor(
false,
false); styleFor(
false,
false) = styleFor(
true,
false); styleFor(
true,
false) = tmpEntry; }
421 if (bFor3d) { tmpEntry = styleFor(
false,
true); styleFor(
false,
true) = styleFor(
true,
true); styleFor(
true,
true) = tmpEntry; }
429 OdUInt32 flags = GIntAccessor::getIntFlags(ent.
edgeStyle()); GIntAccessor::setOnTopOfDepth(flags, bSet); GIntAccessor::installIntFlags(ent.
edgeStyle(), flags);
430 flags = GIntAccessor::getIntFlags(ent.
faceStyle()); GIntAccessor::setOnTopOfDepth(flags, bSet); GIntAccessor::installIntFlags(ent.
faceStyle(), flags);
440 void setByDefault() { styleFor(
false).setByDefault(); styleFor(
true).setAsDisabled(); sync3d(); }
444 void setAsDisabled() { styleFor(
false).setAsDisabled(); styleFor(
true).setAsDisabled(); sync3d(); }
449 void setForStippling() { styleFor(
false).setForStippling(); styleFor(
true).setAsDisabled(); sync3d(); }
454 void setForColorMasking() { styleFor(
false).setByDefault(); styleFor(
false).edgeStyle().setMode(EdgeStyle::kIsolineEdges);
455 styleFor(
true).setForColorMasking(); sync3d(); }
bool operator!=(T left, const OdGiVariant::EnumType right)
bool operator==(T left, const OdGiVariant::EnumType right)
#define SETBIT(flags, bit, value)
#define SETBIT_0(flags, bit)
#define GETBIT(flags, bit)
#define SETBIT_1(flags, bit)
const OdCmEntityColor & color() const
OdUInt8 transparency() const
void setTransparency(OdUInt8 transparency)
void setColor(const OdCmEntityColor &color)
void setColor(const OdCmEntityColor &color, OdUInt8 transparency)
void setMode(Mode edgeMode)
void setLineWeightExtension(OdInt32 nLwdExtension)
bool hasLineWeightExtension() const
void setForColorMasking()
OdInt32 m_lineWeightExtension
OdInt32 lineWeightExtension() const
const ColorMask & colorMask() const
void setVisible(bool bVisible)
void setForColorMasking()
void enablePattern(bool bEnable)
bool isColorMaskingEnabled() const
void enableColorMasking(bool bEnable)
bool isOnTopOfDepth() const
bool isPatternEnabled() const
const FaceStyle & faceStyle() const
bool isOnTopOfDepth() const
const EdgeStyle & edgeStyle() const
void setForColorMasking()
void setForColorMasking(const OdCmEntityColor &color, OdUInt8 transparency)
WrapGIntFlags(StyleEntry &style, bool bWrap=true)
void setForColorMasking()
void setOnTopOfDepth(bool bSet)
bool isOnTopOfDepth() const
int makeEntryId(bool bDrawOnTop, bool bDrawIn3d) const
void exchangeTopBottom(bool bFor2d=true, bool bFor3d=true)
const StyleEntry & styleFor(bool bDrawOnTop=false, bool bDrawIn3d=false) const
StyleEntry & styleFor(bool bDrawOnTop=false, bool bDrawIn3d=false)
static void installIntFlags(ElementStyle &elemStyle, OdUInt32 flags)
static void setOnTopOfDepth(OdUInt32 &flags, bool bSet)
static OdUInt32 getIntFlags(const ElementStyle &elemStyle)
static OdUInt32 extractIntFlags(ElementStyle &elemStyle)
static bool isOnTopOfDepth(OdUInt32 flags)