zjf
2023-03-06 392b76515f40376b6d36f40a114850ef63650384
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
/////////////////////////////////////////////////////////////////////////////// 
// Copyright (C) 2002-2016, Open Design Alliance (the "Alliance"). 
// All rights reserved. 
// 
// This software and its documentation and related materials are owned by 
// the Alliance. The software may only be incorporated into application 
// programs owned by members of the Alliance, subject to a signed 
// Membership Agreement and Supplemental Software License Agreement with the
// Alliance. The structure and organization of this software are the valuable  
// trade secrets of the Alliance and its suppliers. The software is also 
// protected by copyright law and international treaty provisions. Application  
// programs incorporating this software must include the following statement 
// with their copyright notices:
//   
//   This application incorporates Teigha(R) software pursuant to a license 
//   agreement with Open Design Alliance.
//   Teigha(R) Copyright (C) 2002-2016 by Open Design Alliance. 
//   All rights reserved.
//
// By use of this software, its documentation or related materials, you 
// acknowledge and accept the above terms.
///////////////////////////////////////////////////////////////////////////////
 
#ifndef _OD_GI_H_
#define _OD_GI_H_
 
#include "RxObject.h"
 
class OdDbStub;
class OdCmEntityColor;
class OdGeVector3d;
class OdGiMapper;
class OdCmTransparency;
struct OdGiDgLinetypeModifiers;
class OdGiFill;
class OdGiDrawStream;
 
typedef enum
{
  kOdGiFillAlways = 1,  // Always fill closed graphic primitives.
  kOdGiFillNever  = 2   // Never fill closed graphic primitives.
} OdGiFillType;
 
typedef enum
{
  kOdGiInvisible      = 0, // Invisible
  kOdGiVisible        = 1, // Visible
  kOdGiSilhouette     = 2  // Silhouette edge
} OdGiVisibility;
 
#include "TD_PackPush.h"
 
/** \details
    This class provides an interface to the graphical attributes of graphic
    primitives.
  
    \remarks
    OdGiDrawableTraits is a superset of OdGiSubEntityTraits, and exposes
    additional traits that are consistant for the entire OdGiDrawable.
    
    An OdGiDrawableTraits instance is available during calls to subSetAttributes.
    Graphical attribute settings are used for all graphical primitives until they are changed.
    
    \sa
    TD_Gi
    
    <group OdGi_Classes> 
*/
class FIRSTDLL_EXPORT OdGiDrawableTraits : public OdRxObject
public:
  ODRX_DECLARE_MEMBERS(OdGiDrawableTraits);
};
 
/** \details
    This class provides an interface to the graphical attributes of graphic
    primitives.
  
    \remarks
    An OdGiSubEntityTraits instance is available during calls to subWorldDraw and subViewportDraw,
    so that drawable classes can control attributes during the vectorization process. 
    Graphical attribute settings are used for all graphical primitives until they are changed.
    
    The functions in this class are implemented by the OdGiAbstractVectorizer
    class.
 
    \sa
    TD_Gi
    
    <group OdGi_Classes> 
*/
class FIRSTDLL_EXPORT OdGiSubEntityTraits : public OdGiDrawableTraits
{
public:
  enum DrawFlags
  {
    kNoDrawFlags        = 0x0000,   // Default value. No DrawFlags specified.
    kDrawBackfaces      = 0x0001,   // Forces backfaces vectorization.
    kDrawHatchGroup     = 0x0002,   // Next shells and meshes should draw hatches.
    kDrawFrontfacesOnly = 0x0004,   // Forces discard backfaces mode.
    kDrawGradientFill   = 0x0008,   // Draws with gradient fill.
    kDrawSolidFill      = 0x0010,   // Draws with solid fill.
    kDrawNoLineWeight   = 0x0020,   // Disables lineweight.
    kDrawNoPlotstyle    = 0x0080,   // Disables plotstyles.
    // the range before 0x8000 is reserved.
    kDrawContourFill            = 0x08000, // Teigha(R) for .dgn files specific.
    kDisableLayoutCache         = 0x10000, // Disable metafile caching for layout switching.
    kDrawBoundaryForClipping    = 0x20000, // Draw (rough) boundary of object to be checked
                                           // when clipping is performed, set by vectorizer.
    kDrawBoundaryForClippingDrw = 0x40000, // Draw (rough) boundary of object to be checked
                                           // when clipping is performed, set by a drawable.
    kClipSetIsEmpty             = 0x80000,
    kInternalDrawFlags          = kDisableLayoutCache | kClipSetIsEmpty,
    kDrawPolygonFill            = 0x100000, // Fill in all modes if FillAlways mode enabled.
    kExcludeFromViewExt         = 0x200000, // Don't use extents of the entity when calculating total extents.
    kDrawDgLsPolyWithoutBreaks  = 0x400000, // Draw polylines/polygons with Dgn Line Style without segmentation.
    kPolygonProcessing          = 0x800000, // Polygon filling logic must be applied for shell primitive.
    kDisableAutoGenerateNormals = 0x1000000, // Avoid automatic generation of normals for mesh/shell primitives.
    kDisableFillModeCheck       = 0x2000000, // Avoid checking of OdGiContext::fillMode during filling of geometry primitives.
    kDrawUnderlayReference      = 0x4000000, // Draw underlay reference object.
    // Flags which can be inherited by nested drawables.
    kInheritableDrawFlags       = kDrawNoLineWeight | kDrawNoPlotstyle | kDrawBoundaryForClipping | kDrawBoundaryForClippingDrw |
                                  kInternalDrawFlags | kExcludeFromViewExt | kDrawBackfaces | kDrawFrontfacesOnly
  };
 
  enum ShadowFlags
  {
    kShadowsCastAndReceive = 0,   // Geometry could cast and receive shadows.
    kShadowsDoesNotCast    = 1,   // Geometry doesn't cast shadows.
    kShadowsDoesNotReceive = 2,   // Geometry doesn't receive shadows.
    kShadowsIgnore         = kShadowsDoesNotCast | kShadowsDoesNotReceive
  };
 
  enum SelectionFlags
  {
    kNoSelectionFlags = 0,   // No selection flags set.
    kSelectionIgnore  = 1    // Avoid geometry selection.
  };
 
  enum SubEntityHints
  {
    kHint2DAttributes  = 1,  // Setup attributes only available in 2DWireframe mode (plotStyles and etc.)
    kHint3DAttributes  = 2,  // Setup attributes only available in shaded modes (materials and etc.)
    kHintAllAttributes = kHint2DAttributes | kHint3DAttributes,
    kHintDefaultState  = kHintAllAttributes
  };
public:
  ODRX_DECLARE_MEMBERS(OdGiSubEntityTraits);
 
  /** \details
    Sets the current color index (ACI).
 
    \param color [in]  Color index.
    
    \remarks
    color must be one of the following:
    
    <table>
    Name              Value   Description
    kACIbyBlock       0       ByBlock.
    kACIforeground    7       Foreground color.
    kACIbyLayer       256     ByLayer. 
    kACIRed           1       Red. 
    kACIYellow        2       Yellow. 
    kACIGreen         3       Green. 
    kACICyan          4       Cyan. 
    kACIBlue          5       Blue. 
    kACIMagenta       6       Magenta. 
    ..                8-255   Defined by AcadPalette.h
    </table>
  */
  virtual void setColor(
    OdUInt16 color) = 0;
 
  /** \details
    Sets the current color from an OdCmEntityColor instance.
    
    \param color [in]  OdCmEntityColor object.
  */
  virtual void setTrueColor(
    const OdCmEntityColor& color) = 0;
 
  /** \details
    Sets the current layer.
    \param layerId [in]  Object ID of the LayerTableRecord.  
  */
  virtual void setLayer(
    OdDbStub* layerId) = 0;
 
  /** \details
    Sets the current linetype.
    \param lineTypeId [in]  Object ID of the LinetypeTableRecord.  
  */
  virtual void setLineType(
    OdDbStub* lineTypeId) = 0;
 
  /** \details
    Sets the current selection marker.
    \param marker [in]  Selection marker.
  */
  virtual void setSelectionMarker(
    OdGsMarker selectionMarker) = 0;
 
  /** \details
    Sets the current fill type.
    \param fillType [in]  Fill type.
    
    \remarks
    fillType must be one of the following:
    
    <table>
    Name              Value   Description
    kOdGiFillAlways   1       Fill closed graphic primitives.
    kOdGiFillNever    2       Don't fill closed graphic primitives.
    </table>
       
    Closed graphic primitives consist of the following:
    * arcs with (OdGiArcType == kOdGiArcSector) || (OdGiArcType == kOdGiArcChord) 
    * circles 
    * meshes 
    * polygons 
    * shells 
 
  */
  virtual void setFillType(
    OdGiFillType fillType) = 0;
 
  /** \details
    Sets the current fill plane.
    
    \param pNormal [in]  Pointer to the normal to the plane.
    
    \note
    As implemented, this function does nothing but return.
    It will be fully implemented in a future release.
  */
  virtual void setFillPlane(
    const OdGeVector3d* pNormal = 0);
 
  /** \details
    Sets the current lineweight.
 
    \param lineWeight [in]  Lineweight.
  */
  virtual void setLineWeight(
    OdDb::LineWeight lineWeight) = 0;
 
  /** \details
    Sets the current linetype scale.
    \param lineTypeScale [in]  Linetype scale factor.
  */
  virtual void setLineTypeScale(
    double lineTypeScale = 1.0) = 0;
 
  /** \details
    Sets the current thickness.
    \param thickness [in]  Thickness.
  */
  virtual void setThickness(
    double thickness) = 0;
 
  /** \details
    Sets the current PlotStyleName.
 
    \param plotStyleNameType [in]  Plot Style Name Type.
    \param plotStyleNameId [in]  Object ID of the Plot Style Name.
    
    \remarks
    plotStyleNameId is used only when plotStyleNameType == kPlotStyleNameById.
    
    plotStyleNameType must be one of the following:
    
    <table>
    Name                           Value                         
    kPlotStyleNameByLayer          0
    kPlotStyleNameByBlock          1
    kPlotStyleNameIsDictDefault    2
    kPlotStyleNameById             3
    </table>
  */
  virtual void setPlotStyleName(
    OdDb::PlotStyleNameType plotStyleNameType, 
    OdDbStub* plotStyleNameId = 0) = 0;
 
  /** \details
    Sets the current material.
    \param materialId [in]  Object ID of the material.
  */
  virtual void setMaterial(
    OdDbStub* materialId) = 0;
 
  /** \details
    Sets the current material mapper.
    \param pMapper [in]  Pointer to the GI mapper object.
  */
  virtual void setMapper(
    const OdGiMapper *pMapper) = 0;
 
  /** \details
    Sets the current visual style.
    \param visualStyleId [in]  Object ID of the visual style.
  */
  virtual void setVisualStyle(
    const OdDbStub* visualStyleId);
 
  /** \details
    Sets the current transparency.
    
    \param transparency [in]  OdCmTransparency object.
  */
  virtual void setTransparency(
    const OdCmTransparency &transparency);
 
  /** \details
    Sets the drawing flags.
    
    \param drawFlags [in]  Input bitmask with DrawFlags.
  */
  virtual void setDrawFlags(
    OdUInt32 drawFlags);
 
  /** \details
    Sets selection geometry flag.
    
    \param bSelectionFlag [in]  New selection geometry flag.
  */
  virtual void setSelectionGeom(
    bool bSelectionFlag);
 
  /** \details
    Sets the shadow flags.
    
    \param shadowFlags [in]  Input ShadowFlags.
  */
  virtual void setShadowFlags(
    ShadowFlags shadowFlags);
 
  /** \details
    Sets sectionable flag.
    
    \param bSectionableFlag [in]  New sectionable flag.
  */
  virtual void setSectionable(
    bool bSectionableFlag);
 
  /** \details
    Sets the selection flags.
    
    \param selectionFlags [in]  Input SelectionFlags.
  */
  virtual void setSelectionFlags(
    SelectionFlags selectionFlags);
 
  /** \details
    Returns the current color index (ACI).
 
    \remarks
    color() returns one of the following:
    
    <table>
    Name              Value   Description
    kACIbyBlock       0       ByBlock.
    kACIforeground    7       Foreground color.
    kACIbyLayer       256     ByLayer. 
    kACIRed           1       Red. 
    kACIYellow        2       Yellow. 
    kACIGreen         3       Green. 
    kACICyan          4       Cyan. 
    kACIBlue          5       Blue. 
    kACIMagenta       6       Magenta. 
    ..                8-255   Defined by AcadPalette.h
    </table>
  */
  virtual OdUInt16 color() const = 0;
 
  /** \details
    Returns the current color as an OdCmEntityColor instance.
  */
  virtual OdCmEntityColor trueColor() const = 0;
 
  /** \details
      Returns the current layer.
  */
  virtual OdDbStub* layer() const = 0;
 
  /** \details
      Returns the current linetype.
  */
  virtual OdDbStub* lineType() const = 0;
 
  /** \details
    Returns the current fill type.
      
    \returns
    fillType() returns one of the following:
    
    <table>
    Name              Value   Description
    kOdGiFillAlways   1       Fill closed graphic primitives.
    kOdGiFillNever    2       Don't fill closed graphic primitives.
    </table>
       
    Closed graphic primitives consist of the following:
    * arcs with (OdGiArcType == kOdGiArcSector) || (OdGiArcType == kOdGiArcChord) 
    * circles 
    * meshes 
    * polygons 
    * shells 
  */
  virtual OdGiFillType fillType() const = 0;
 
  /** \details
    Returns the normal to the current fill plane.
    
    \param normal [out]  Receives the normal.
    
    \remarks
    As implemented, this function does nothing but return false.
    It will be fully implemented in a future release.
  */
  virtual bool fillPlane(
    OdGeVector3d& normal);
 
  /** \details
    Returns the current lineweight.
  */
  virtual OdDb::LineWeight lineWeight() const = 0;
 
  /** \details
    Returns the current linetype scale.
  */
  virtual double lineTypeScale() const = 0;
 
  /** \details
    Returns the current thickness.
  */
  virtual double thickness() const = 0;
 
  /** \details
    Returns the current PlotStyleName type.
    
    \remarks
    plotStyleNameType() returns one of the following:
    
    <table>
    Name                           Value                         
    kPlotStyleNameByLayer          0
    kPlotStyleNameByBlock          1
    kPlotStyleNameIsDictDefault    2
    kPlotStyleNameById             3
    </table>
  */
  virtual OdDb::PlotStyleNameType plotStyleNameType() const = 0;
 
  /** \details
    Returns object ID of the the plot style name.
  */
  virtual OdDbStub* plotStyleNameId() const = 0;
 
  /** \details
    Returns the Object ID of the material.
  */
  virtual OdDbStub* material() const = 0;
  
  /** \details
    Returns pointer to the current material mapper.
  */
  virtual const OdGiMapper* mapper() const = 0;
 
  /** \details
    Returns the Object ID of the visual style.
  */
  virtual OdDbStub* visualStyle() const;
 
  /** \details
    Returns the current transparency.
  */
  virtual OdCmTransparency transparency() const;
 
  /** \details
    Return the current DrawFlags bitmask.
  */
  virtual OdUInt32 drawFlags() const;
 
  /** \details
    Return the current selection geometry flag.
  */
  virtual bool selectionGeom() const;
 
  /** \details
    Return the current ShadowFlags.
  */
  virtual ShadowFlags shadowFlags() const;
 
  /** \details
    Return the current sectionable flag.
  */
  virtual bool sectionable() const;
 
  /** \details
    Return the current SelectionFlags.
  */
  virtual SelectionFlags selectionFlags() const;
 
  // Teigha(R) for .dgn files specific
 
  /** \details
    Sets the current secondary color from an OdCmEntityColor instance.
    
    \param color [in]  OdCmEntityColor object.
  */
  virtual void setSecondaryTrueColor(
    const OdCmEntityColor& color);
 
  /** \details
    Returns the current secondary color as an OdCmEntityColor instance.
  */
  virtual OdCmEntityColor secondaryTrueColor() const;
 
  /** \details
    Sets Dgn Line Style modifiers.
 
    \param pLSMod [in]  Pointer to structure with Dgn Line Style modifiers.
  */
  virtual void setLineStyleModifiers(
    const OdGiDgLinetypeModifiers* pLSMod);
 
  /** \details
    Return pointer to the current Dgn Line Style modifiers structure.
  */
  virtual const OdGiDgLinetypeModifiers* lineStyleModifiers() const;
 
  // eof Teigha(R) for .dgn files specific section
 
  /** \details
    Sets boundary filling.
 
    \param pFill [in]  Boundary filling parameters.
  */
  virtual void setFill(
    const OdGiFill* pFill);
 
  /** \details
    Return boundary filling parameters.
  */
  virtual const OdGiFill* fill() const;
 
  /** \details
    Returns the set of SubEntityHints flags which can be used to provide more flexible tuning of
    subSetAttributes traits processing.
  */
  virtual OdUInt32 setupForEntity() const;
 
  /** \details
    Adds a light object to the model.
 
    \param lightId [in]  Object ID of the light.
 
    \remarks
    Through this interface, drawables that emit light can add light objects to the model. 
  */
  virtual void addLight(
    const OdDbStub* lightId);
 
  /** \details
    Adds interface to directly invoke Gs graphics data.
 
    \param pDrawStream [in]  Pointer onto draw stream interface.
  */
  virtual void addDrawStream(
    OdGiDrawStream *pDrawStream);
};
 
typedef OdSmartPtr<OdGiSubEntityTraits> OdGiSubEntityTraitsPtr;
 
#include "TD_PackPop.h"
 
#endif //_OD_GI_H_