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
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
/////////////////////////////////////////////////////////////////////////////// 
// 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.
///////////////////////////////////////////////////////////////////////////////
 
// GiBaseVectorizer.h: interface for the OdGiBaseVectorizer class.
//
//////////////////////////////////////////////////////////////////////
 
#ifndef _ODGIBASEVECTORIZER_INCLUDED_
#define _ODGIBASEVECTORIZER_INCLUDED_
 
#include "Gi/GiDrawImpl.h"
#include "Gs/Gs.h"
#include "Ge/GeExtents3d.h"
#include "Gi/GiViewport.h"
#include "Gi/GiXform.h"
#include "Gi/GiModelToViewProc.h"
#include "Gi/GiConveyorEntryPoint.h"
#include "Gi/GiConveyorConnector.h"
#include "Gi/GiDeviation.h"
#include "Ge/GePlane.h"
#include "Gi/GiDgLinetype.h"
#include "Gi/GiOrthoClipper.h"
#include "Gi/GiExtAccum.h"
#include "Gi/GiSubEntityTraitsData.h"
#include "Gi/GiTextStyle.h"
#include "Gi/GiLayerTraitsData.h"
#include "Gi/GiMaterialTraitsData.h"
#include "Gi/GiTraitsCache.h"
 
class OdGiVisualStyle;
 
class OdGiBaseVectorizer;
 
class OdDbStub;
 
typedef OdSmartPtr<OdGiFill> OdGiFillPtr;
 
#include "TD_PackPush.h"
 
// Enable traits optimization
#define ENABLE_GITRAITSOPTIMIZATION
 
/** \details
    This class provides an implementation of the OdGiWorldDraw::geometry() function.
 
    \sa
    TD_Gi
 
    <group OdGi_Classes>
*/
class ODGI_EXPORT ODRX_ABSTRACT OdGiWorldDrawImpl : public OdGiWorldDraw_
                                                  , public OdGiSubEntityTraits
{
protected:
  ODRX_USING_HEAP_OPERATORS(OdGiWorldDraw_);
 
  OdGiSubEntityTraitsData m_entityTraitsData;
  OdGiContext*            m_pContext;
 
  OdGiWorldDrawImpl();
public:
  /** \details
    Sets the OdGiContext instance associated with this object.
 
    \param pUserContext [in]  Pointer to the user context.
  */
  virtual void setContext(OdGiContext* pUserContext);
  static OdGiContext* dummyGiContext();
 
  OdUInt16 color() const;
  OdCmEntityColor trueColor() const;
  OdDbStub* layer() const;
  OdDbStub* lineType() const;
  OdGiFillType fillType() const;
  OdDb::LineWeight lineWeight() const;
  double lineTypeScale() const;
  double thickness() const;
  OdDb::PlotStyleNameType plotStyleNameType() const;
  OdDbStub* plotStyleNameId() const;
  OdDbStub* material() const;
  const OdGiMapper* mapper() const;
  OdDbStub* visualStyle() const;
  OdCmTransparency transparency() const;
  OdUInt32 drawFlags() const;
  bool selectionGeom() const;
  ShadowFlags shadowFlags() const;
  bool sectionable() const;
  SelectionFlags selectionFlags() const;
  OdCmEntityColor secondaryTrueColor() const;
  const OdGiDgLinetypeModifiers* lineStyleModifiers() const;
  const OdGiFill* fill() const;
 
  void setTrueColor(const OdCmEntityColor& color);
  void setPlotStyleName(OdDb::PlotStyleNameType plotStyleNameType, OdDbStub* pPlotStyleNameId = 0);
  void setColor(OdUInt16 color);
  void setLayer(OdDbStub* layerId);
  void setLineType(OdDbStub* lineTypeId);
  void setFillType(OdGiFillType fillType);
  void setLineWeight(OdDb::LineWeight lineWeight);
  void setLineTypeScale(double lineTypeScale);
  void setThickness(double thickness);
  void setSelectionMarker(OdGsMarker selectionMarker);
  void setMaterial(OdDbStub* pMaterialId);
  void setMapper(const OdGiMapper *pMapper);
  void setVisualStyle(const OdDbStub* visualStyleId);
  void setTransparency(const OdCmTransparency &transparency);
  void setDrawFlags(OdUInt32 drawFlags);
  void setSelectionGeom(bool bSelectionFlag);
  void setShadowFlags(ShadowFlags shadowFlags);
  void setSectionable(bool bSectionableFlag);
  void setSelectionFlags(SelectionFlags selectionFlags);
  void setSecondaryTrueColor(const OdCmEntityColor& color);
  void setLineStyleModifiers(const OdGiDgLinetypeModifiers* pLSMod);
  void setFill(const OdGiFill* pFill);
 
  /////////////////////////////////////////////////////////////////////////////
  // OdGiCommonDraw Overrides
 
  OdGiContext* context() const;
 
  bool isDragging() const;
 
  OdGiSubEntityTraits& subEntityTraits() const;
 
  OdGiGeometry& rawGeometry() const;
 
  OdUInt32 numberOfIsolines() const;
};
 
/** \details
    This class is a base implementation of the OdGiWorldDraw and OdGiViewportDraw interfaces.
    Library: TD_Gi    
  
    \remarks
    This class takes a drawable graphics and passes it into OdGiConveyorGeometry.
    
    It is the base class for specialized frameworks such as OdGiExtCalc.
    <group OdGi_Classes>
*/
class ODGI_EXPORT OdGiBaseVectorizer : public OdGiWorldDrawImpl
                                     , public OdGiViewportDraw_
                                     , public OdGiConveyorContext
                                     , public OdGiDeviation 
{
protected:
  ODRX_HEAP_OPERATORS();
 
  mutable OdGiSubEntityTraitsData m_effectiveEntityTraitsData;
 
  ODGI_EXPORT_STATIC static const OdGiSubEntityTraitsData g_entityTraitsDataReset;
 
  mutable OdDbStub*               m_layerId;
  mutable OdGiLayerTraitsTaker    m_effectiveLayerTraits;
 
  typedef OdGiTraitsCache<OdGiMaterialTraitsData, OdGiMaterialTraitsTaker, OdGiMaterialTraits::kByBlock | OdGiMaterialTraits::kByLayer> OdGiMaterialTraitsCache;
  mutable OdDbStub*               m_materialId;
  mutable OdDbStub*               m_byLayerMaterialId;
  mutable OdDbStub*               m_byBlockMaterialId;
  mutable OdUInt32                m_materialAttributes;
  mutable OdGiMaterialTraitsCache m_effectiveMaterialTraitsData;
  mutable OdDbStub*               m_effectiveMaterialId;
  void actualizeMaterialAttributes(OdDbStub* materialId) const;
 
  virtual OdDbStub*               switchLayer(OdDbStub* layerId) const;
  virtual const OdGiLayerTraitsData& effectiveLayerTraits() const;
  mutable OdDbStub*               m_effectiveLayerId;
 
  OdGsMarker                      m_nSelectionMarker;
  OdGsMarker                      m_nPrevSelectionMarker;
 
  OdGiMapper                      m_materialMapper;
  OdGiMapper*                     m_pCurMaterialMapper;
 
  OdGiDgLinetypeModifiers         m_lsModifiers;
  OdGiDgLinetypeModifiers*        m_pCurLSModifiers;
 
  OdGiFillPtr                     m_pFill;
  OdGiDrawStream*                 m_pDrawStream;
 
  virtual bool layerVisible(OdDbStub* layerId) const;
  /** \details
    Updates the layer traits for this Vectorizer object from the specified subentity traits.
    \param subEntityTraits [in]  Subentity traits.
  */
  void updateLayerTraits(OdGiSubEntityTraitsData& subEntityTraits) const;
  
public:
  enum ChangedTraits
  {
    kFirstChangedFlag      = 1,
    kColorChanged          = kFirstChangedFlag <<  0,
    kLayerChanged          = kFirstChangedFlag <<  1,
    kLineTypeChanged       = kFirstChangedFlag <<  2,
    kFillTypeChanged       = kFirstChangedFlag <<  3,
    kLineWeightChanged     = kFirstChangedFlag <<  4,
    kLineTypeScaleChanged  = kFirstChangedFlag <<  5,
    kThicknessChanged      = kFirstChangedFlag <<  6,
    kPlotStyleChanged      = kFirstChangedFlag <<  7,
    kMaterialChanged       = kFirstChangedFlag <<  8,
    kMapperChanged         = kFirstChangedFlag <<  9,
    kVisualStyleChanged    = kFirstChangedFlag << 10,
    kTransparencyChanged   = kFirstChangedFlag << 11,
    kDrawFlagsChanged      = kFirstChangedFlag << 12,
    kSelectionGeomChanged  = kFirstChangedFlag << 13,
    kShadowFlagsChanged    = kFirstChangedFlag << 14,
    kSectionableChanged    = kFirstChangedFlag << 15,
    kSelectionFlagsChanged = kFirstChangedFlag << 16,
    kSecColorChanged       = kFirstChangedFlag << 17,
    kLSModifiersChanged    = kFirstChangedFlag << 18,
    kFillChanged           = kFirstChangedFlag << 19,
    kAwareFlagChanged      = kFirstChangedFlag << 20,
    kAllChanged            = 0x1FFFFF, // bin: 111111111111111111111
    kSomeChanged           = kAllChanged
  };
 
  /** \details
    Returns true if and only if the EntityTraitsData for this Vectorizer object have been changed.
  */
  bool isEntityTraitsDataChanged(int bit = kSomeChanged) const { return GETBIT(m_entityTraitsDataChanged, bit); }
 
  /** \details
    Marks as changed the EntityTraitsData data for this Vectorizer object.
  */
  virtual void setEntityTraitsDataChanged() { m_entityTraitsDataChanged = kAllChanged; }
  /** \details
    Marks as changed the EntityTraitsData data for this Vectorizer object.
  */
  virtual void setEntityTraitsDataChanged(int bit, bool value = true) { SETBIT(m_entityTraitsDataChanged, bit, value); }
  
  /** \details
    Marks as unchanged the EntityTraitsData data for this Vectorizer object.
  */
  void clearEntityTraitsDataChanged() const { m_entityTraitsDataChanged = 0; }
 
  /** \details
    Returns true if and only if the layer of this Vectorizer object is effectively visible.
    
    \remarks
    This function returns:
    
                    (GETBIT(m_flags, kDrawLayerOff   ) || !traits.isLayerOff()) &&
                    (GETBIT(m_flags, kDrawLayerFrozen) || !traits.isLayerFrozen())
  */
  bool effectivelyVisible() const
  {
    const OdGiSubEntityTraitsData& traits = effectiveTraits();
    return (
      (GETBIT(m_flags, kDrawLayerOff   ) || !traits.isLayerOff()) &&
      (GETBIT(m_flags, kDrawLayerFrozen) || !traits.isLayerFrozen())
    );
  }  
 
public:
  /////////////////////////////////////////////////////////////////////////////
  // OdGiConveyorContext Overrides
 
  OdGiContext& giContext() const;
  const OdGiDrawableDesc* currentDrawableDesc() const;
  const OdGiDrawable* currentDrawable() const;
  const OdGiViewport* giViewport() const;
  const OdGsView* gsView() const;
 
  /////////////////////////////////////////////////////////////////////////////
 
private:
  // Data Members
 
  OdGiConveyorEntryPoint          m_dcEntryPoint;
  OdGiTextStyle                   m_textStyle;
  OdGePlane                       m_primitivePlane;
  OdGeVector3d                    m_extrusion;
  OdGiXformPtr                    m_pDcInputToOutput;
#ifdef ENABLE_GITRAITSOPTIMIZATION
  bool                            m_bResetEntityTraitsData; //reset them before setAttributes()
#endif
protected:
  OdRxObjectPtr                   m_pGiReserved;
  mutable OdUInt32                m_entityTraitsDataChanged;
  OdGiConveyorConnector           m_eyeEntryPoint;
 
  /** \details
    Returns an extrusion vector normal to the specified plane.
    
    \param firstPoint [in]  First point in the plane.
    \param secondPoint [in]  Second point in the plane.
    \param thirdPoint [in]  Third point in the plane.
    \param origin [in]  Origin of the plane.
    \param u [in]  U-vector in the plane.
    \param v [in]  V-vector in the plane.
    \param normal [in]  Normal to the plane.
    \param pNormal [in]  Pointer to the normal to the plane.
    \remarks
    The magnitude of the extrusion vector is effectiveTraits().thickness().
  */
  const OdGeVector3d* extrusion(const OdGePoint3d& firstPoint, const OdGePoint3d& secondPoint, const OdGePoint3d& thirdPoint);
  const OdGeVector3d* extrusion(const OdGeVector3d& normal);
  const OdGeVector3d* extrusion(const OdGeVector3d* pNormal)
  {
    if(pNormal)
      return extrusion(*pNormal);
    return 0;
  }
  const OdGeVector3d* extrusion(const OdGePoint3d& origin, const OdGeVector3d& u, const OdGeVector3d& v);
 
  OdGiConveyorConnector           m_modelEntryPoint;
  OdGiConveyorConnector*          m_pActiveEntryPoint;
 
  OdGiModelToViewProcPtr          m_pModelToEyeProc;
  OdGiConveyorConnector           m_output;
 
public:
  OdGiDrawableDesc*               m_pDrawableDesc;
  OdUInt32                        m_nDrawableAttributes;
  const OdGiDrawableDesc *drawableDesc() const { return m_pDrawableDesc; }
protected:
 
  enum Flags
  {
    kFirstFlag            = 1,
 
    kSuppressViewportDraw = kFirstFlag << 0,
    kDrawInvisibleEnts    = kFirstFlag << 1,
    kDrawLayerOff         = kFirstFlag << 2,
    kDrawLayerFrozen      = kFirstFlag << 3,
    kIgnoreFillPlane      = kFirstFlag << 4,
    kSelectionMode        = kFirstFlag << 5,
    kAttributesSegment    = kFirstFlag << 6,
    kXrefOverride         = kFirstFlag << 7,
 
    kLastFlag             = kXrefOverride
  };
  mutable OdUInt32                m_flags;
  OdUInt32                        m_drawContextFlags;
 
  const OdGiSubEntityTraitsData*  m_pByBlock;
 
  /** \details
    Sets the specfied EntityTraitsData data from the specified EntityTraitsData.
    
    \param pSource [in]  Pointer to the source SubEntityTraitsData.
    \param destination [out]  Receives the SubEntityTraitsData.
    
    \remarks
    If pSource is NULL, default SubEntityTraitsData is used.
    
  */
  virtual void affectTraits(const OdGiSubEntityTraitsData* pSource, OdGiSubEntityTraitsData& destination) const;
 
  /** \details
    Returns the dash length below which linetypes are not generated by this Vectorizer object.
  */
  virtual double linetypeGenerationCriteria() const;
 
#ifdef ENABLE_GITRAITSOPTIMIZATION
  inline void resetEntityTraitsData();
#endif
public:
  /////////////////////////////////////////////////////////////////////////////
  // OdGiConveyorContext Override
 
  /** \details
    Returns the EntityTraitsData in effect for this Vectorization object.
  */
  virtual const OdGiSubEntityTraitsData& effectiveTraits() const;
 
  virtual void setEffectiveTraits(const OdGiSubEntityTraitsData& traits,
                                  const OdGeVector3d* fillNormal = NULL);
 
  /////////////////////////////////////////////////////////////////////////////
protected:
 
  /** \details
    Returns the a pointer to the OdRxClass object that contains a description
    of this object type, for objects of known class type.
 
    \note
    This function is for use only when the class type of this object is known.
    If the class type of this object is unknown, use instead isA().
  */
  static OdRxClass* desc() { return ::OdRxObject::desc(); }
 
  /** \details
    Called when selection marker is being to be changed.
 
    \param nSelectionMarker [in]  New selection marker.
 
    \remarks
    Previous selection marker accessible through selectionMarker method inside override.
    This method should be called for base class from override to change selection marker.
  */
  virtual void selectionMarkerOnChange(OdGsMarker nSelectionMarker);
 
public:
  OdGiBaseVectorizer();
  virtual ~OdGiBaseVectorizer();
 
  /** \details
    Returns the a pointer to the OdRxClass object that contains a description
    of this object type, for objects of unknown class type.
    
    \note
    This function may be used only when the class type of this object is unknown. 
    If the class type of this object is known, use instead desc().
  */
  OdRxClass* isA() const;
 
  /** \details
     Returns the Protocol Extension object for this object.
     \remarks
     Returns NULL if no protocol extension class exists.
  */
  OdRxObject* queryX(const OdRxClass* pProtocolClass) const;
 
  /** \details
    Returns a reference to the output of this Vectorizer object.
  */
  virtual OdGiConveyorOutput& output();
 
  /** \details
    Sets the Eye to Output transformation matrix for this Vectorizer object.
    \param xfm [in]  Transformation matrix.
  */
  void setEyeToOutputTransform(const OdGeMatrix3d& xfm);
 
  /** \details
    Returns the Eye to Output transformation matrix for this Vectorizer object.
    \param xfm [in]  Receives the transformation matrix.
  */
  const OdGeMatrix3d& eyeToOutputTransform() const;
  void eyeToOutputTransform(OdGeMatrix3d& xfm) const;
 
  /** \details
    Returns the OdGiConveyorContext associated with this object.
 
    \remarks
    Since OdGiConveyorContext is a parent class, this function always returns "this".
  */
  OdGiConveyorContext* drawContext() { return this; }
 
  const OdGiConveyorContext* drawContext() const { return this; }
 
  /** \details
    Begins the ViewVectorization process for this Vectorizer object.
  */
  virtual void beginViewVectorization();
 
  /** \details
    Ends the ViewVectorization process for this Vectorizer object.
  */
  virtual void endViewVectorization();
 
  /////////////////////////////////////////////////////////////////////////////
  // OdGiSubEntityTraits Overrides
 
  void setTrueColor(const OdCmEntityColor& trueColor);
  /** \details
    Sets the Plot Style Name Type for this Vectorizer object.
    \param plotStyleNameType [in]  Plot Style Name Type.
    
    \remarks
    plotStyleNameType must be one of the following:
    
    <table>
    Name                                 Value                         
    OdDb::kPlotStyleNameByLayer          0
    OdDb::kPlotStyleNameByBlock          1
    OdDb::kPlotStyleNameIsDictDefault    2
    OdDb::kPlotStyleNameById             3
    </table>
  */
  void setPlotStyleNameType(OdDb::PlotStyleNameType plotStyleNameType);
  /** \details
    Sets the PlotStyleName for this Vectorizer object.
    \param plotStyleNameId [in]  Pointer to the Object ID of the plot style name.
  */
  void setPlotStyleNameId(OdDbStub* plotStyleNameId);
  void setColor(OdUInt16 color);
  void setLayer(OdDbStub* layerId);
  void setLineType(OdDbStub* lineTypeId);
  void setFillType(OdGiFillType fillType);
  void setLineWeight(OdDb::LineWeight lineWeight);
  void setLineTypeScale(double lineTypeScale);
  void setThickness(double thickness);
 
  void setPlotStyleName(OdDb::PlotStyleNameType plotStyleNameType, OdDbStub* pPlotStyleNameId= 0);
  void setSelectionMarker(OdGsMarker selectionMarker);
  void setMaterial(OdDbStub* pMaterialId);
  void setMapper(const OdGiMapper *pMapper);
  void setVisualStyle(const OdDbStub* pVisualStyleId);
  void setTransparency(const OdCmTransparency& transparency);
  void setDrawFlags(OdUInt32 drawFlags);
  void setSelectionGeom(bool bSelectionFlag);
  void setShadowFlags(ShadowFlags shadowFlags);
  void setSectionable(bool bSectionableFlag);
  void setSelectionFlags(SelectionFlags selectionFlags);
 
  void setSecondaryTrueColor(const OdCmEntityColor& color);
  void setLineStyleModifiers(const OdGiDgLinetypeModifiers* pLSMod);
 
  void setFill(const OdGiFill* pFill);
 
  virtual void setVisualStyle(const OdGiVisualStyle &visualStyle);
  virtual bool visualStyle(OdGiVisualStyle &visualStyle) const;
  virtual OdDbStub* visualStyle() const;
 
  virtual void addDrawStream(OdGiDrawStream *pDrawStream);
  OdGiDrawStream *getDrawStream() const { return m_pDrawStream; }
 
  /////////////////////////////////////////////////////////////////////////////
 
  /////////////////////////////////////////////////////////////////////////////
  // OdGiCommonDraw Overrides
 
  OdGiContext* context() const;
  bool regenAbort() const;
  OdGiSubEntityTraits& subEntityTraits() const;
  double deviation(const OdGiDeviationType deviationType, const OdGePoint3d& pointOnCurve) const;
  OdGiRegenType regenType() const;
  OdUInt32 numberOfIsolines() const;
  OdGiGeometry& rawGeometry() const;
  bool isDragging() const;
 
  /////////////////////////////////////////////////////////////////////////////
 
  OdUInt32 drawContextFlags() const;
  void setDrawContextFlags(OdUInt32 flags, bool bFlag);
 
  /////////////////////////////////////////////////////////////////////////////
  // OdGiViewportDraw Override
  //
 
  /** \note
      The default implementation of this function always returns 0.
  */
  OdUInt32  sequenceNumber() const;
 
  /** \note
      The default implementation of this function always returns false.
  */
  bool isValidId(const OdUInt32 viewportId) const;
 
  /** \note
      The default implementation of this function always returns 0.
  */
  OdDbStub* viewportObjectId() const;
 
  OdGiViewport& viewport() const;
 
  /////////////////////////////////////////////////////////////////////////////
 
 
  /////////////////////////////////////////////////////////////////////////////
  // OdGiGeometry Overrides
 
  void circle(const OdGePoint3d& center, double radius, const OdGeVector3d& normal);
 
  void circle(const OdGePoint3d& firstPoint, const OdGePoint3d& secondPoint, const OdGePoint3d& thirdPoint);
 
  void circularArc(const OdGePoint3d& center,
    double radius,
    const OdGeVector3d& normal,
    const OdGeVector3d& startVector,
    double sweepAngle,
    OdGiArcType arcType = kOdGiArcSimple);
 
  void circularArc(const OdGePoint3d& firstPoint,
    const OdGePoint3d& secondPoint,
    const OdGePoint3d& thirdPoint,
    OdGiArcType arcType = kOdGiArcSimple);
 
  void polyline(OdInt32 numVertices,
    const OdGePoint3d* vertexList,
    const OdGeVector3d* pNormal = 0,
    OdGsMarker baseSubEntMarker = -1);
 
  void polygon(OdInt32 numVertices, const OdGePoint3d* vertexList);
 
  void pline(const OdGiPolyline& polyline, OdUInt32 fromIndex = 0, OdUInt32 numSegs = 0);
 
  /** \details
    Introduces a shape into this vectorization context.
    
    \param position [in]  Position of the shape.
    \param shapeNumber [in]  Shape number.
    \param pTextStyle [in]  Pointer to the TextStyle for the shape.
    \param direction [in]  Baseline direction for the shape.
    \param normal [in]  Normal vector.
  */
  void shape(const OdGePoint3d& position,
    const OdGeVector3d& normal, const OdGeVector3d& direction,
    int shapeNumber, const OdGiTextStyle* pTextStyle);
 
  void text(const OdGePoint3d& position,
    const OdGeVector3d& normal, const OdGeVector3d& direction,
    double height, double width, double oblique, const OdString& msg);
 
  void text(const OdGePoint3d& position,
    const OdGeVector3d& normal, const OdGeVector3d& direction,
    const OdChar* msg, OdInt32 length, bool raw, const OdGiTextStyle* pTextStyle);
 
  void xline(const OdGePoint3d& firstPoint, const OdGePoint3d& secondPoint);
 
  void ray(const OdGePoint3d& basePoint, const OdGePoint3d& throughPoint );
 
  void nurbs(const OdGeNurbCurve3d& nurbsCurve);
 
  void ellipArc(const OdGeEllipArc3d& ellipArc,
    const OdGePoint3d* endPointsOverrides = 0,
    OdGiArcType arcType = kOdGiArcSimple);
 
  void mesh(OdInt32 numRows,
    OdInt32 numColumns,
    const OdGePoint3d* vertexList,
    const OdGiEdgeData* pEdgeData = 0,
    const OdGiFaceData* pFaceData = 0,
    const OdGiVertexData* pVertexData = 0);
 
  void shell(OdInt32 numVertices,
    const OdGePoint3d* vertexList,
    OdInt32 faceListSize,
    const OdInt32* faceList,
    const OdGiEdgeData* pEdgeData = 0,
    const OdGiFaceData* pFaceData = 0,
    const OdGiVertexData* pVertexData = 0);
 
  void worldLine(const OdGePoint3d points[2]);
 
  void image(const OdGiImageBGRA32& img,
    const OdGePoint3d& origin,
    const OdGeVector3d& uVec,
    const OdGeVector3d& vVec,
    OdGiRasterImage::TransparencyMode trpMode = OdGiRasterImage::kTransparency8Bit);
 
  void edge(const OdGiEdge2dArray& edges);
 
  void polypoint(OdInt32 numPoints, const OdGePoint3d* vertexList, const OdCmEntityColor* pColors, const OdCmTransparency* pTransparency,
                 const OdGeVector3d* pNormals, const OdGsMarker* pSubEntMarkers, OdInt32 nPointSize);
 
  void rowOfDots(OdInt32 numPoints, const OdGePoint3d& startPoint, const OdGeVector3d& dirToNextPoint);
 
  void pushClipBoundary(OdGiClipBoundary* pBoundary);
  void pushClipBoundary(OdGiClipBoundary* pBoundary, OdGiAbstractClipBoundary* pClipInfo);
  void drawClipBoundary(OdGiClipBoundary* pBoundary, OdGiAbstractClipBoundary* pClipInfo);
  void popClipBoundary();
  bool isClipping() const;
 
  void pushModelTransform(const OdGeMatrix3d& xfm);
  void pushModelTransform(const OdGeVector3d& normal);
  void popModelTransform();
 
  OdGeMatrix3d getModelToWorldTransform() const;
  OdGeMatrix3d getWorldToModelTransform() const;
 
  void draw(const OdGiDrawable* pDrawable);
 
  const OdGiPathNode* currentGiPath() const;
 
  /////////////////////////////////////////////////////////////////////////////
 
  /** \details
    Sets the default drawable traits for this Vectorizer object,
    and sets the drawable flags for the specified OdGiDrawable object.
    
    \param pDrawable [in]  Pointer to the Drawable object.
  */
  virtual OdUInt32 setAttributes(const OdGiDrawable* pDrawable);
 
  /** \details
    Returns the  drawable flags of the last vectorized OdGiDrawable object.
  */
  OdUInt32 drawableAttributes() const { return m_nDrawableAttributes; }
 
  /** \details
    Returnes true if and only the Drawable object associated with
    this Vectorizer is visible.
    \param drawableFlags [in]  Drawable flags.
    \remarks
    Called by draw().
  */
  bool needDraw(OdUInt32 drawableFlags);
 
  /** \details
    Vectorizes the specified OdGiDrawable object.
    \param drawableFlags [in]  Drawable flags.
    \param pDrawable [in]  Pointer to the Drawable object.
    
    \remarks
    Called by draw() after subSetAttributes().
    
    Returns pDrawable->subWorldDraw(this). If pDrawable->subWorldDraw returns false, 
    and kSuppressViewportDraw is not set, this function evokes pDrawable->subViewportDraw(this).
  */
  virtual bool doDraw(OdUInt32 drawableFlags, const OdGiDrawable* pDrawable);
 
  /////////////////////////////////////////////////////////////////////////////
  // OdGiWorldGeometry Override
 
  void setExtents(const OdGePoint3d *newExtents);
  void startAttributesSegment();
  bool isAttributesSegmentEnabled();
 
  /////////////////////////////////////////////////////////////////////////////
 
  /////////////////////////////////////////////////////////////////////////////
  // OdGiViewportGeometry
 
  void rasterImageDc(
    const OdGePoint3d& origin,
    const OdGeVector3d& u,
    const OdGeVector3d& v,
    const OdGiRasterImage* pImage,
    const OdGePoint2d* uvBoundary,
    OdUInt32 numBoundPts,
    bool transparency = false,
    double brightness = 50.0,
    double contrast = 50.0,
    double fade = 0.0);
 
  void metafileDc(
    const OdGePoint3d& origin,
    const OdGeVector3d& u,
    const OdGeVector3d& v,
    const OdGiMetafile* pMetafile,
    bool bDcAligned = true,
    bool bAllowClipping = false);
 
  void polylineEye(OdUInt32 numVertices, const OdGePoint3d* vertexList);
  void polygonEye(OdUInt32 numVertices, const OdGePoint3d* vertexList);
 
  void polylineDc(OdUInt32 numVertices, const OdGePoint3d* vertexList);
  void polygonDc(OdUInt32 numVertices, const OdGePoint3d* vertexList);
 
 
  /////////////////////////////////////////////////////////////////////////////
  // OdGiConveyorContext Overrides
 
  virtual void onTraitsModified();
 
  /////////////////////////////////////////////////////////////////////////////
 
  /** \details
    Returns the maximum ModelSpace (UCS) deviation for this VectorizeView object.
  */
  const OdGiDeviation& modelDeviation() const;
  /** \details
    Returns the maximum world (WCS) deviation for this VectorizeView object.
  */
  const OdGiDeviation& worldDeviation() const;
  /** \details
    Returns the maximum EyeSpace (ECS) deviation for this VectorizeView object.
  */
  const OdGiDeviation& eyeDeviation() const;
 
  // materials
  const OdGiMaterialTraitsData &effectiveMaterialTraitsData() const;
  void effectiveMaterialTraitsData(OdGiMaterialTraitsData &data) const;
  void setEffectiveMaterialTraitsData(OdDbStub *materialId, const OdGiMaterialTraitsData &data, bool bForce = false);
 
  /** \details
    Returns current selection marker state.
  */
  OdGsMarker selectionMarker() const;
 
  const OdGiSubEntityTraitsData *byBlockTraits() const { return m_pByBlock; }
  void setByBlockTraits(const OdGiSubEntityTraitsData *pByBlock) { m_pByBlock = pByBlock; }
  OdRxObjectPtr saveByBlockTraits();
};
 
/** \details
    This class is an implementation of the subWorldDraw() framework to calculate the WCS extents of an OdGiDrawable object.
    Library: TD_Gi
    <group OdGi_Classes>
*/
class ODGI_EXPORT OdGiExtCalc : public OdGiBaseVectorizer
{
protected:
  bool            m_BBoxSet;
  OdGiExtAccumPtr m_pExtAccum;
 
public:
 
  OdGiExtCalc();
  virtual ~OdGiExtCalc();
 
  OdGiRegenType regenType() const;
  bool regenAbort() const;
  void draw(const OdGiDrawable* pDrawable);
  void setExtents(const OdGePoint3d *newExtents);
  /** \details
    Resets the accumulated extents for the OdGiDrawable object associated with this Vectorization object.
  */
  void resetExtents();
 
  /** \details
    Returns the accumulated extents for the OdGiDrawable object associated with this Vectorization object.
    \param extents [out]  Receives the extents.
  */
  void getExtents(OdGeExtents3d& extents) const;
 
  void setContext(OdGiContext* pUserContext);
 
  // optimization
 
  const OdGiSubEntityTraitsData& effectiveTraits() const;
  void affectTraits(const OdGiSubEntityTraitsData* pSource, OdGiSubEntityTraitsData& destination) const;
};
 
#ifdef ENABLE_GITRAITSOPTIMIZATION
inline void OdGiBaseVectorizer::resetEntityTraitsData()
{
  m_bResetEntityTraitsData = false;
  m_entityTraitsData = g_entityTraitsDataReset;
  setEntityTraitsDataChanged();
}
#endif
 
ODGI_EXPORT void odgiCalculateTextBasis(OdGeVector3d& u, OdGeVector3d& v,
                                        const OdGeVector3d& normal,
                                        const OdGeVector3d& direction,
                                        double height,
                                        double width,
                                        double oblique,
                                        bool bMirrorX = false,
                                        bool bMirrorY = false);
ODGI_EXPORT const OdGiTextStyle* odgiPrepareTextStyle(const OdGiTextStyle* pStyle, OdGiTextStyle& res);
 
#include "TD_PackPop.h"
 
#endif // #ifndef _ODGIBASEVECTORIZER_INCLUDED_