CFx SDK Documentation 2024 SP0
Loading...
Searching...
No Matches
PlotStyles.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
25
26// RxPlotStyle.h -- interfaces for setting up plotstyles support for rendering
27
28#ifndef __OD_RX_PLOT_STYLE__
29#define __OD_RX_PLOT_STYLE__
30
31
32#include "RxObject.h"
33#include "CmColorBase.h"
34#include "RxModule.h"
35#include "Ge/GeDoubleArray.h"
36#include "StringArray.h"
37
38#define STL_USING_MAP
39#define STL_USING_ALGORITHM
40#include "OdaSTL.h"
41
42class OdStreamBuf;
43
44#include "TD_PackPush.h"
45
50namespace OdPs
51{
53 {
64
66 };
67
69 {
75 };
76
78 {
84 };
85
86 // plotstyle's linetype
87
89 {
122
124 };
125
126}
127
135{
136public:
138 {
141 kNotUseObject = 4
142 };
143
144protected:
147 bool m_bAdaptiveLinetype; // not in color policy
157
158public:
159
161 : m_color(255, 255, 255)
162 , m_colorPolicy(0)
164 , m_screening(100)
165 , m_physPenNum(-1)
166 , m_virtPenNum(-1)
167 , m_psLt(OdInt16(OdPs::kLtpUseObject))
168 , m_fillStyle(OdInt16(OdPs::kFsUseObject))
169 , m_lineEndStyle(OdInt16(OdPs::kLesUseObject))
170 , m_lineJoinStyle(OdInt16(OdPs::kLjsUseObject))
171 , m_dLinePatSz(0.0)
172 , m_lineweight(-1)
173 {}
174
176
177 // m_color(255, 255, 255) indicates "UseEntity: in PlotStyles
178
182 bool operator ==(const OdPsPlotStyleData& other) const
183 {
184 return (
185 m_color == other.m_color &&
186 m_colorPolicy == other.m_colorPolicy &&
188 m_screening == other.m_screening &&
189 m_physPenNum == other.m_physPenNum &&
190 m_virtPenNum == other.m_virtPenNum &&
191 m_psLt == other.m_psLt &&
192 m_fillStyle == other.m_fillStyle &&
195 m_dLinePatSz == other.m_dLinePatSz &&
196 m_lineweight == other.m_lineweight
197 );
198 }
199
203 bool operator !=(const OdPsPlotStyleData& other) const { return !operator ==(other); }
204
208 const OdCmEntityColor& color() const { return m_color; }
209
219
228 int screening() const { return m_screening; }
229
233 double linePatternSize() const { return m_dLinePatSz; }
238
246 bool isGrayScaleOn() const { return GETBIT(m_colorPolicy, kGrayScale); }
250 bool isDitherOn() const { return GETBIT(m_colorPolicy, kDither); }
254 double lineweight() const { return m_lineweight; }
267
273 {
274 m_color = color;
275 SETBIT(m_colorPolicy, kNotUseObject, !(color.red()==255 && color.green()==255 && color.blue()==255));
276 // #CORE-11537 : turn off kNotUseObject bit if kGrayScale bit is set
279 }
280
282
315
320 void setAdaptiveLinetype(bool adaptiveLinetype) { m_bAdaptiveLinetype = adaptiveLinetype; }
325 void setGrayScaleOn(bool grayScaleOn)
326 {
327 if (grayScaleOn)
328 {
329 // #CORE-11537 : turn off kNotUseObject bit
331 }
332 else
333 {
334 // #CORE-11537 : turn on kNotUseObject bit if m_color is not white
335 SETBIT(m_colorPolicy, kNotUseObject, !(m_color.red() == 255 && m_color.green() == 255 && m_color.blue() == 255));
336 }
337 SETBIT(m_colorPolicy, kGrayScale, grayScaleOn);
338 }
343 void setDitherOn(bool ditherOn) { SETBIT(m_colorPolicy, kDither, ditherOn); }
358 void setEndStyle(OdPs::LineEndStyle lineEndStyle) { m_lineEndStyle = OdInt16(lineEndStyle); }
364 void setJoinStyle(OdPs::LineJoinStyle lineJoinStyle) { m_lineJoinStyle = OdInt16(lineJoinStyle); }
365};
366
375{
376public:
378
382 virtual OdString name() const = 0;
383
387 virtual OdString description() const = 0;
392 virtual void getData(OdPsPlotStyleData& data) const = 0;
396 virtual OdString localizedName() const = 0;
397
398 virtual void setData(const OdPsPlotStyleData& data) = 0;
399
400 virtual void setDescription(const OdString& desc) = 0;
401
402 virtual void setName(const OdString& name) = 0;
403
404 virtual void setLocalizedName(const OdString& name) = 0;
405
406};
407
412
413typedef std::map<const OdChar*, OdPsPlotStylePtr, OdString::lessnocase> OdPsPlotStylesMap;
415
424{
425public:
427
428 virtual OdRxObjectPtr clone() const = 0;
429
430 virtual void copyFrom(const OdRxObject* pSource) = 0;
431
436 virtual bool isApplyScaleFactor() const = 0;
437
441 virtual OdString description() const = 0;
442
446 virtual double scaleFactor() const = 0;
447
451 virtual bool isDisplayCustomLineweightUnits() const = 0;
452
457 virtual double getLineweightAt(OdUInt32 index) const = 0;
458
463 virtual OdPsPlotStylePtr plotStyleAt(const OdString& name) const = 0;
464
471 virtual OdPsPlotStylePtr plotStyleAt(int index) const = 0;
472
476 virtual unsigned int plotStyleSize() const = 0;
477
478 virtual unsigned int lineweightSize() const = 0;
479
480 virtual bool isAciTableAvailable() const = 0;
481
482 virtual OdPsPlotStylePtr addNewPlotStyle(const OdString& styleName) = 0;
483
485
486 virtual void setDescription(const OdString& desc) = 0;
487
488 virtual void setScaleFactor(double scFac) = 0;
489
490 virtual void setApplyScaleFactor(bool flag) = 0;
491
492 virtual void setDisplayCustomLineweightUnits(bool flag) = 0;
493
494 virtual void setLineweightAt(double value, OdUInt32 index) = 0;
495
496 virtual void setLineweights(const OdGeDoubleArray& lineweights) = 0;
497
498 // Methods added in 2.7.0
499
500 virtual void setAciTableAvailable(bool flag) = 0;
501
502 virtual void setPlotStylesIndexed(const OdPsPlotStylesArray plotStylesIndexed) = 0;
503
504 virtual void setPlotStyles(const OdPsPlotStylesMap plotStyles) = 0;
505
506 virtual void addPlotStyle(OdPsPlotStyle* pPs) = 0;
507
508 virtual void setOrdering(const OdStringArray& order) = 0;
509
510 virtual OdPsPlotStylesMap plotStyles() const = 0;
511
513};
518
526{
527public:
529
539 virtual void savePlotStyleTable(OdStreamBuf* pBuf, OdPsPlotStyleTablePtr pPSTab) = 0;
540
541};
546
547#include "TD_PackPop.h"
548
549#endif // __OD_RX_PLOT_STYLE__
false
Definition: DimVarDefs.h:165
unsigned int OdUInt32
short OdInt16
#define SETBIT(flags, bit, value)
Definition: OdaDefs.h:516
#define SETBIT_0(flags, bit)
Definition: OdaDefs.h:519
#define GETBIT(flags, bit)
Definition: OdaDefs.h:517
std::map< const OdChar *, OdPsPlotStylePtr, OdString::lessnocase > OdPsPlotStylesMap
Definition: PlotStyles.h:413
OdSmartPtr< OdPsPlotStyleTable > OdPsPlotStyleTablePtr
Definition: PlotStyles.h:517
OdSmartPtr< OdPsPlotStyleServices > OdPsPlotStyleServicesPtr
Definition: PlotStyles.h:545
OdSmartPtr< OdPsPlotStyle > OdPsPlotStylePtr
Definition: PlotStyles.h:411
OdArray< OdPsPlotStylePtr > OdPsPlotStylesArray
Definition: PlotStyles.h:414
#define FIRSTDLL_EXPORT
Definition: RootExport.h:39
#define FIRSTDLL_EXPORT_STATIC
Definition: RootExport.h:40
OdUInt8 blue() const
Definition: CmColorBase.h:507
OdUInt8 green() const
Definition: CmColorBase.h:496
OdUInt8 red() const
Definition: CmColorBase.h:485
OdInt16 physicalPenNumber() const
Definition: PlotStyles.h:214
OdInt16 virtualPenNumber() const
Definition: PlotStyles.h:218
double lineweight() const
Definition: PlotStyles.h:254
void setLineweight(double lineweight)
Definition: PlotStyles.h:348
void setAdaptiveLinetype(bool adaptiveLinetype)
Definition: PlotStyles.h:320
FIRSTDLL_EXPORT static FIRSTDLL_EXPORT_STATIC const OdPsPlotStyleData kDefault
Definition: PlotStyles.h:175
OdPs::LineEndStyle endStyle() const
Definition: PlotStyles.h:262
double linePatternSize() const
Definition: PlotStyles.h:233
const OdCmEntityColor & color() const
Definition: PlotStyles.h:208
bool isAdaptiveLinetype() const
Definition: PlotStyles.h:242
OdPs::FillStyle fillStyle() const
Definition: PlotStyles.h:258
bool isGrayScaleOn() const
Definition: PlotStyles.h:246
OdInt16 m_physPenNum
Definition: PlotStyles.h:149
OdPs::LineJoinStyle joinStyle() const
Definition: PlotStyles.h:266
OdInt16 colorPolicy() const
Definition: PlotStyles.h:210
OdInt16 m_lineEndStyle
Definition: PlotStyles.h:153
void setPhysicalPenNumber(OdInt16 physicalPenNumber)
Definition: PlotStyles.h:287
void setColor(const OdCmEntityColor &color)
Definition: PlotStyles.h:272
OdInt16 m_lineJoinStyle
Definition: PlotStyles.h:154
void setColorPolicy(OdInt16 colorPolicy)
Definition: PlotStyles.h:281
bool operator==(const OdPsPlotStyleData &other) const
Definition: PlotStyles.h:182
OdInt16 m_virtPenNum
Definition: PlotStyles.h:150
bool isDitherOn() const
Definition: PlotStyles.h:250
void setLinePatternSize(double linePatternSize)
Definition: PlotStyles.h:309
void setJoinStyle(OdPs::LineJoinStyle lineJoinStyle)
Definition: PlotStyles.h:364
void setEndStyle(OdPs::LineEndStyle lineEndStyle)
Definition: PlotStyles.h:358
void setDitherOn(bool ditherOn)
Definition: PlotStyles.h:343
OdInt16 m_screening
Definition: PlotStyles.h:148
int screening() const
Definition: PlotStyles.h:228
bool operator!=(const OdPsPlotStyleData &other) const
Definition: PlotStyles.h:203
void setLinetype(OdPs::LineType linetype)
Definition: PlotStyles.h:314
void setGrayScaleOn(bool grayScaleOn)
Definition: PlotStyles.h:325
bool m_bAdaptiveLinetype
Definition: PlotStyles.h:147
void setFillStyle(OdPs::FillStyle fillStyle)
Definition: PlotStyles.h:353
OdCmEntityColor m_color
Definition: PlotStyles.h:145
void setVirtualPenNumber(OdInt16 virtualPenNumber)
Definition: PlotStyles.h:292
OdInt16 m_colorPolicy
Definition: PlotStyles.h:146
OdInt16 m_fillStyle
Definition: PlotStyles.h:152
OdPs::LineType linetype() const
Definition: PlotStyles.h:237
void setScreening(int screening)
Definition: PlotStyles.h:303
virtual void setName(const OdString &name)=0
virtual void setData(const OdPsPlotStyleData &data)=0
virtual OdString description() const =0
virtual void getData(OdPsPlotStyleData &data) const =0
virtual OdString name() const =0
virtual void setDescription(const OdString &desc)=0
ODRX_DECLARE_MEMBERS(OdPsPlotStyle)
virtual OdString localizedName() const =0
virtual void setLocalizedName(const OdString &name)=0
ODRX_DECLARE_MEMBERS(OdPsPlotStyleServices)
virtual void savePlotStyleTable(OdStreamBuf *pBuf, OdPsPlotStyleTablePtr pPSTab)=0
virtual OdPsPlotStyleTablePtr createPlotStyleTable()=0
virtual OdPsPlotStyleTablePtr loadPlotStyleTable(OdStreamBuf *pStreamBuf)=0
virtual void setAciTableAvailable(bool flag)=0
virtual unsigned int plotStyleSize() const =0
virtual void setDescription(const OdString &desc)=0
virtual OdPsPlotStylePtr plotStyleAt(const OdString &name) const =0
virtual void setDisplayCustomLineweightUnits(bool flag)=0
virtual double scaleFactor() const =0
virtual void addPlotStyle(OdPsPlotStyle *pPs)=0
virtual void setPlotStylesIndexed(const OdPsPlotStylesArray plotStylesIndexed)=0
virtual OdPsPlotStylesMap plotStyles() const =0
virtual bool isApplyScaleFactor() const =0
virtual OdPsPlotStylesArray plotStylesIndexed() const =0
virtual OdPsPlotStylePtr addNewPlotStyle(const OdString &styleName)=0
virtual unsigned int lineweightSize() const =0
virtual OdString description() const =0
virtual bool isDisplayCustomLineweightUnits() const =0
virtual void setApplyScaleFactor(bool flag)=0
virtual OdPsPlotStylePtr plotStyleAt(int index) const =0
virtual bool isAciTableAvailable() const =0
virtual void copyFrom(const OdRxObject *pSource)=0
virtual void setScaleFactor(double scFac)=0
virtual OdPsPlotStylePtr delPlotStyle(OdPsPlotStylePtr pPsPtr)=0
virtual void setLineweights(const OdGeDoubleArray &lineweights)=0
virtual void setOrdering(const OdStringArray &order)=0
virtual void setLineweightAt(double value, OdUInt32 index)=0
ODRX_DECLARE_MEMBERS(OdPsPlotStyleTable)
virtual void setPlotStyles(const OdPsPlotStylesMap plotStyles)=0
virtual double getLineweightAt(OdUInt32 index) const =0
virtual OdRxObjectPtr clone() const =0
GLint GLenum GLsizei GLsizei GLint GLsizei const void * data
Definition: gles2_ext.h:110
GLuint index
Definition: gles2_ext.h:265
GLuint const GLchar * name
Definition: gles2_ext.h:265
GLsizei const GLfloat * value
Definition: gles2_ext.h:302
LineType
Definition: PlotStyles.h:89
@ kLtpDashed
Definition: PlotStyles.h:91
@ kLtpISODashSpace
Definition: PlotStyles.h:108
@ kLtpShortDashX2
Definition: PlotStyles.h:97
@ kLtpISODash
Definition: PlotStyles.h:107
@ kLtpISODashTripleDot
Definition: PlotStyles.h:119
@ kLtpLongDashDotDot
Definition: PlotStyles.h:103
@ kLtpISOLongDashDoubleDot
Definition: PlotStyles.h:110
@ kLtpLongDashShortDash
Definition: PlotStyles.h:102
@ kLtpSolid
Definition: PlotStyles.h:90
@ kLtpMediumDashShortDashShortDash
Definition: PlotStyles.h:101
@ kLtpDotted
Definition: PlotStyles.h:92
@ kLtpMediumDashDotShortDashDot
Definition: PlotStyles.h:105
@ kLtpISODashDot
Definition: PlotStyles.h:115
@ kLtpMediumLongDash
Definition: PlotStyles.h:100
@ kLtpISODoubleDashDot
Definition: PlotStyles.h:116
@ kLtpISODashDoubleDot
Definition: PlotStyles.h:117
@ kLtpISOLongDashTripleDot
Definition: PlotStyles.h:111
@ kLtpISOLongDashDot
Definition: PlotStyles.h:109
@ kLtpLongDashX2
Definition: PlotStyles.h:99
@ kLtpISOLongDashDoubleShortDash
Definition: PlotStyles.h:114
@ kLtpLongDash
Definition: PlotStyles.h:96
@ kLtpSparseDot
Definition: PlotStyles.h:106
@ kLtpLast
Definition: PlotStyles.h:123
@ kLtpISODoubleDashDoubleDot
Definition: PlotStyles.h:118
@ kLtpISOLongDashShortDash
Definition: PlotStyles.h:113
@ kLtpShortDash
Definition: PlotStyles.h:94
@ kLtpDashDot
Definition: PlotStyles.h:93
@ kLtpMediumDash
Definition: PlotStyles.h:95
@ kLtpISODot
Definition: PlotStyles.h:112
@ kLtpLongDashDot
Definition: PlotStyles.h:104
@ kLtpMediumDashX2
Definition: PlotStyles.h:98
@ kLtpISODoubleDashTripleDot
Definition: PlotStyles.h:120
@ kLtpUseObject
Definition: PlotStyles.h:121
FillStyle
Definition: PlotStyles.h:53
@ kFsLast
Definition: PlotStyles.h:65
@ kFsVerticalBars
Definition: PlotStyles.h:62
@ kFsDiamonds
Definition: PlotStyles.h:57
@ kFsSquareDots
Definition: PlotStyles.h:61
@ kFsSlantLeft
Definition: PlotStyles.h:59
@ kFsHorizontalBars
Definition: PlotStyles.h:58
@ kFsCrosshatch
Definition: PlotStyles.h:56
@ kFsCheckerboard
Definition: PlotStyles.h:55
@ kFsSlantRight
Definition: PlotStyles.h:60
@ kFsUseObject
Definition: PlotStyles.h:63
@ kFsSolid
Definition: PlotStyles.h:54
LineJoinStyle
Definition: PlotStyles.h:78
@ kLjsDiamond
Definition: PlotStyles.h:82
@ kLjsUseObject
Definition: PlotStyles.h:83
@ kLjsBevel
Definition: PlotStyles.h:80
@ kLjsMiter
Definition: PlotStyles.h:79
@ kLjsRound
Definition: PlotStyles.h:81
LineEndStyle
Definition: PlotStyles.h:69
@ kLesDiamond
Definition: PlotStyles.h:73
@ kLesSquare
Definition: PlotStyles.h:71
@ kLesUseObject
Definition: PlotStyles.h:74
@ kLesButt
Definition: PlotStyles.h:70
@ kLesRound
Definition: PlotStyles.h:72