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
/////////////////////////////////////////////////////////////////////////////// 
// 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 __ODGIGEOMETRYSIMPLIFIER_H__
#define __ODGIGEOMETRYSIMPLIFIER_H__
 
#include "Gi/GiExport.h"
#include "Gi/GiConveyorGeometry.h"
#include "Ge/GeDoubleArray.h"
#include "Ge/GePoint2dArray.h"
#include "Ge/GePoint3dArray.h"
#include "Ge/GeVector3dArray.h"
#include "Gs/Gs.h"
 
class OdGiDeviation;
 
class OdGeLineSeg2d;
class OdGeLine2d;
class OdGeCircArc2d;
class OdGeCircArc3d;
class OdGeEllipArc3d;
 
#include "TD_PackPush.h"
 
/** \details
    This class provides tessellation functionality for the Teigha vectorization framework.
    
    \remarks
    Tessellation consists of breaking complex entities into sets of simpler entities.  
    
    An instance of this class is used to simplify the geometry produced by the Teigha vectorization
    framework.
 
    <group OdGi_Classes> 
*/
class ODGI_EXPORT OdGiGeometrySimplifier : public OdGiConveyorGeometry
{
  // Old version do not override !!!
  // Overide shellFaceOut() or triangleOut() instead
  virtual int polygonWithHolesOut(OdUInt32, const OdGePoint3d*, OdUInt32 , OdUInt32*);
protected:
  /** \details
    Draws an arc of the specified type.
    \param arcType [in]  Arc type.
    \param center [in]  Center of arc.
    \param points [out]  Receives an array of points comprising the arc.
    \param pNormal [in]  Pointer to the normal to the arc.
    \param pExtrusion [in]  Pointer to the extrusion direction of the arc.
  */
  void drawTypedArc(OdGiArcType arcType, const OdGePoint3d& center,
    OdGePoint3dArray& points, const OdGeVector3d* pNormal, const OdGeVector3d* pExtrusion);
protected:
  OdGiConveyorContext*  m_pDrawCtx;
  OdGiSubEntityTraits*  m_pTraits;
  OdGsMarker            m_baseSubEntMarker;
 
  enum SimplifierFlags
  {
    kSimplProcessingText   = (1 << 0),
    kSimplFillModeDisabled = (1 << 1),
    kSimplLastFlag         = kSimplFillModeDisabled
  };
  OdUInt32              m_simplFlags;
private:
  OdInt32               m_nVertexCount;
  const OdGePoint3d*    m_pVertexList;
  const OdGiVertexData* m_pVertexData;
  OdGePoint2dArray      m_loopsPnts;
  OdGePoint3dArray      m_points3d1; // for shellProc/plineProc level
  OdGePoint3dArray      m_points3d2; // for triangleOut/polylineOut level
protected:
  const OdGiDeviation*  m_pDeviation;
  OdGeDoubleArray       m_deviations;
  OdGsView::RenderMode  m_renderMode;
 
  /** \details
    Returns the recommended maximum deviation of the current vectorization 
    for the specified point on the curve or surface being tesselated.
    \param deviationType [in]  Deviation type.
    \param pointOnCurve [in]  Point on the curve.
  */
  double deviation(const OdGiDeviationType deviationType, const OdGePoint3d& pointOnCurve) const;
 
  /** \details
    Returns the FillMode and DrawEdges for this Vectorizer object.
    \param drawEdges [out]  Receives the DrawEdges value.
    \note
    As implemented, this function returns false if called without arguments:
  */
  bool fillMode();
  bool fillMode(bool& drawEdges);
  bool fillMode(bool& drawEdges, bool& secColor);
  bool circleArcFillMode();
  bool shmFillMode(bool& drawEdges);
  bool shmFillMode(bool& drawEdges, bool& secColor);
  /** \details
    Returns true if and only if this Vectorizer object is processing text.
  */
  bool processingText() const { return GETBIT(m_simplFlags, kSimplProcessingText); }
  /** \details
    Returns the OdGiContext for this Vectorizer object.
  */
  OdGiContext& giCtx() const { return const_cast<OdGiContext&>(m_pDrawCtx->giContext()); }
 
  /** \details
    Controls plineProc arc segment output.
    \param drawContextFlags [in]  Input conveyor context draw flags.
    \remarks
    Returns true if plineProc arc segments as arc output enabled.
    Returns false to output plineProc arc segments as polyline segments chain.
  */
  virtual bool plineArcSegmentsAsArcProc(OdUInt32 drawContextFlags) const;
public:
  OdGiGeometrySimplifier();
  ~OdGiGeometrySimplifier();
 
  /** \details
      Specifies the maximum deviation allowed during the 
      tessellation process.  
      \remarks
      This value sets the limit for the maximum difference 
      between the actual curve or surface, and the tessellated curve or surface.
 
      \param deviations [in]  Array of deviation values.
      \remarks
      The deviation values (in isotropic world space) are  
      the deviation types defined by the OdGiDeviationType enum.
 
      Each OdGiDeviationType value is used as an index into this array.
  */
  void setDeviation(const OdGeDoubleArray& deviations);
 
  /** \param pDeviation [in]  Deviation to be used for anisotropic space (perspective view).
  */
  void setDeviation(const OdGiDeviation* pDeviation);
 
  /** \details
    Returns the render mode for this object.
       
    \remarks
    renderMode() returns one of the following:
    
    <table>
    Name                            Value      Description
    kBoundingBox                    -1         Bounding box. For internal use only.
    k2DOptimized                    0          Standard display. Optimized for 2D.
    kWireframe                      1          Standard display. Uses 3D pipeline.
    kHiddenLine                     2          Wireframe display. Hidden lines removed.
    kFlatShaded                     3          Faceted display. One color per face.
    kGouraudShaded                  4          Smooth shaded display. Colors interpolated between vertices.
    kFlatShadedWithWireframe        5          Faceted display with wireframe overlay.
    kGouraudShadedWithWireframe     6          Smooth shaded display with wireframe overlay.
    </table>
  */
  OdGsView::RenderMode renderMode() { return m_renderMode; }
 
  /** \details
     Sets the OdGiConveyorContext for this object.  
     \param pDrawCtx [in]  Pointer to the draw context.
     \note
     The draw context must be set before 
     calling any of the tessellation functions.
  */
  void setDrawContext(OdGiConveyorContext* pDrawCtx);
 
  /** \details
    Returns the OdGiConveyorContext associated with this Vectorizer object.
  */
  OdGiConveyorContext* drawContext( ) { return m_pDrawCtx; }
  const OdGiConveyorContext* drawContext( ) const { return m_pDrawCtx; }
 
  /** \details
    Passes polyline data to this Vectorizer object.
    \note
    This function is called by the OdGiGeometrySimplifier class to 
    pass polyline data generated during tessellation, to a client application.
 
    Client applications have the option of overriding this function to process 
    the data themselves.  If the function is not overridden, 
    the default implementation of this function calls polylineOut with the vertex list.
 
    \param numPoints [in]  Number of points in the polyline.
    \param vertexList [in]  Array of vertices that make up the polyline.
  */
  virtual void polylineOut(OdInt32 numPoints, const OdGePoint3d* vertexList);
 
  /** \details
      Passes polygon data to this Vectorizer object.
      \note
      This function is called by the OdGiGeometrySimplifier class to 
      pass polygon data generated during tessellation, to a client application.
      Clients should override this function.
 
      \param numPoints [in]  Number of points in the polygon.
      \param vertexList [in]  Array of vertices that make up the polygon.
      \param pNormal [in]  Normal vector for the polygon.
  */
  virtual void polygonOut(OdInt32 numPoints, 
    const OdGePoint3d* vertexList, 
    const OdGeVector3d* pNormal = 0);
 
  /** \details
      Sets vertex data for tessilation of meshes and shells.
      \remarks
      Called by the default implementations of meshProc and shellProc, to 
      set vertex data that will be used in the tessellation of these objects.
 
      \param numVertices [in]  Number of vertices in the mesh or shell.
      \param vertexList [in]  Array of vertices that make up the mesh or shell.
      \param pVertexData [in]  Pointer to additional vertex data. 
          
      \sa
      OdGiVertexData, Vectorization Primatives
  */
  void setVertexData(OdInt32 numVertices,
    const OdGePoint3d* vertexList,
    const OdGiVertexData* pVertexData = 0);
 
  /** \details
      Returns the vertex count set in the most recent call to setVertexData.
  */
  OdInt32 vertexDataCount() const
  {
    return m_nVertexCount;
  }
 
  /** \details
      Returns the vertex list set in the most recent call to setVertexData.
  */
  const OdGePoint3d* vertexDataList() const
  {
    return m_pVertexList;
  }
 
  /** \details
      Returns the vertex attribute data set in the most recent call to setVertexData.
  */
  const OdGiVertexData* vertexData() const
  {
    return m_pVertexData;
  }
 
  /** \details
      Returns base subentity selection marker for polylineOut().
  */
  OdGsMarker baseSubEntMarker() const
  {
    return m_baseSubEntMarker;
  }
 
  /** \note
      Client applications have the option of overriding this function to process the polyline
      data themselves.  If the function is not overridden, the default implementation of 
      this function processes the polyline, taking into account the following:
 
        * The pXfm transformation (if any) that must be applied to the polyline.
        * Extrusion of the polyline (if it has a non-zero thickness).
        * Creating the closing segment if the polyline is closed.
        * Start and end widths for each segment, or constant width, if applicable.
        * Arc segments (if bulge values are present).
 
      In the default implementation of this function, line segments with a non-zero width 
      will be converted into calls to shellProc, and segments with no width will generate
      calls to polylineProc.  Arc segments with non-zero width will be converted into 
      calls to polygonProc, and arc segments with no width will generate calls to 
      polylineProc.      
 
      OdGiGeometrySimplifier::plineProc is only called for polylines with a continuous
      linetype. 
  */
  virtual void plineProc(const OdGiPolyline& polyline,
    const OdGeMatrix3d* pXfm = 0,
    OdUInt32 fromIndex = 0,
    OdUInt32 numSegs = 0);
 
  /** \note
      Client applications have the option of overriding this function to process the polyline
      data themselves.  If the function is not overridden, the default implementation
      of this function processes the polyline, calling polylineOut if the data is not 
      extruded, or meshProc if an extrusion value is present.
 
      OdGiGeometrySimplifier::polylineProc is only called for polylines with a continuous
      linetype. 
  */
  virtual void polylineProc(OdInt32 numPoints, 
    const OdGePoint3d* vertexList,
    const OdGeVector3d* pNormal = 0, 
    const OdGeVector3d* pExtrusion = 0,
    OdGsMarker baseSubEntMarker = -1);
 
  /** \note
      Client applications have the option of overriding this function to process the polygon
      data themselves.  If the function is not overridden, the default implementation
      of this function processes the polygon, calling polygonOut if the data is not 
      extruded, or shellProc if an extrusion value is present.
  */
  virtual void polygonProc(OdInt32 numPoints, 
    const OdGePoint3d* vertexList,
    const OdGeVector3d* pNormal = 0, 
    const OdGeVector3d* pExtrusion = 0);
 
  /** \note
     This function should not be overridden by clients. 
  */
  virtual void xlineProc(const OdGePoint3d& firstPoint, const OdGePoint3d& secondPoint);
 
  /** \note
      This function should not be overridden by clients. 
  */
  virtual void rayProc(const OdGePoint3d& basePoint, const OdGePoint3d& throughPoint);
 
  /** \note
      Client applications have the option of overriding this function to process the mesh
      data themselves.  If the function is not overridden, the default implementation
      of this function processes the mesh into a set of facets.  More specifically,
      the default meshProc function calls setVertexData, and the calls either
      generateMeshFaces for filled facets, or generateMeshWires for a wireframe.
  */
  virtual void meshProc(OdInt32 numRows,
    OdInt32 numColumns,
    const OdGePoint3d* vertexList,
    const OdGiEdgeData* pEdgeData = 0,
    const OdGiFaceData* pFaceData = 0,
    const OdGiVertexData* pVertexData = 0);
 
  /** \details
    Tessellates a wireframe mesh.
    \note
    This function is called from the default implementation of meshProc
    to tessellate a wireframe mesh. Vertex data needed for this function
    can be obtained by calling vertexDataList and vertexData.
 
    Client applications have the option of overriding this function to process the mesh
    data themselves.  If the function is not overridden, the default implementation
    of this function processes the mesh into a set of facets.  More specifically,
    the default generateMeshWires function processes mesh attributes, and calls
    polylineOut with the tessellated mesh data.
 
    \param numRows [in]  Number of rows in the mesh.
    \param numColumns [in]  Number of columns in the mesh.
    \param pEdgeData [in]  Pointer to additional edge data.
    \param pFaceData [in]  Pointer to additional face data.
 
    \sa
    OdGiEdgeData, OdGiFaceData
  */
  virtual void generateMeshWires(OdInt32 numRows, 
    OdInt32 numColumns,
    const OdGiEdgeData* pEdgeData,
    const OdGiFaceData* pFaceData);
 
  /** \details
    Tessellates a filled mesh.
    \note
    This function is called from the default implementation of meshProc
    to tessellate a filled mesh. Vertex data needed for this function
    can be obtained by calling vertexDataList and vertexData.
 
    Client applications have the option of overriding this function to process the mesh
    data themselves.  If the function is not overridden, the default implementation
    of this function processes the mesh into a set of facets.  More specifically,
    the default generateMeshFaces function processes mesh attributes, and calls
    triangleOut function with the tessellated mesh data.
 
      \param numRows [in]  Number of rows in the mesh.
      \param numColumns [in]  Number of columns in the mesh.
      \param pFaceData [in]  Pointer to additional face data.
 
    \sa
      OdGiEdgeData, OdGiFaceData
  */
  virtual void generateMeshFaces(OdInt32 numRows, OdInt32 numColumns,
                                 const OdGiFaceData* pFaceData);
 
  /** \details
    Outputs a face of a tessilated mesh.
    \param faceList [in]  Array of numbers that define the face.
    \param pNormal [in]  Pointer to the normal to the face.
    \sa
    Vectorization Primitives
  */
  virtual void meshFaceOut(const OdInt32* faceList, const OdGeVector3d* pNormal);
 
  /** \note
      Client applications have the option of overriding this function to process the shell
      data themselves.  If the function is not overridden, the default implementation
      of this function processes the shell into a set of facets.  More specifically,
      the default shellProc function calls setVertexData, and the calls either
      generateShellFaces for filled facets, or generateShellWires for a wireframe.
  */
  virtual void shellProc(OdInt32 numVertices,
                 const OdGePoint3d* vertexList,
                 OdInt32 faceListSize,
                 const OdInt32* faceList,
                 const OdGiEdgeData* pEdgeData = 0,
                 const OdGiFaceData* pFaceData = 0,
                 const OdGiVertexData* pVertexData = 0);
 
  /** \details
    Tessellates a wireframe shell
    \note
    This function is called from the default implementation of shellProc
    to tessellate a wireframe shell. Vertex data needed for this function
    can be obtained by calling vertexDataList and vertexData.
 
    Client applications have the option of overriding this function to process the shell
    data themselves.  If the function is not overridden, the default implementation
    of this function processes the shell into a set of facets.  More specifically,
    the default generateShellWires function processes shell attributes, and calls
    polylineOut with the tessellated shell data.
 
    \param faceListSize [in]  Number of entries in faceList.
    \param faceList [in]  List of numbers that define the faces in the shell.
    \param pEdgeData [in]  Pointer to additional edge data.
    \param pFaceData [in]  Pointer to additional face data.
 
    \sa
    OdGiEdgeData, OdGiFaceData, Vectorization Primitives
  */
   virtual void generateShellWires(OdInt32 faceListSize,
                                   const OdInt32* faceList,
                                   const OdGiEdgeData* pEdgeData = 0,
                                   const OdGiFaceData* pFaceData = 0);
 
  /** \details
    Tessellates a filled wireframe shell.
    \note
    This function is called from the default implementation of shellProc
    to tessellate a filled wireframe shell. Vertex data needed for this function
    can be obtained by calling vertexDataList and vertexData.
 
    Client applications have the option of overriding this function to process the shell
    data themselves.  If the function is not overridden, the default implementation
    of this function processes the shell into a set of facets.  More specifically,
    the default generateShellFaces function processes shell attributes, and calls
    shellFaceOut with the tessellated shell data.
 
    \param faceListSize [in]  Number of entries in faceList.
    \param faceList [in]  List of numbers that define the faces in the shell.
    \param pEdgeData [in]  Pointer to additional edge data.
    \param pFaceData [in]  Pointer to additional face data.
 
    \sa
    OdGiEdgeData, OdGiFaceData, Vectorization Primitives
  */
  virtual void generateShellFaces(OdInt32 faceListSize,
                                  const OdInt32* faceList,
                                  const OdGiEdgeData* pEdgeData = 0,
                                  const OdGiFaceData* pFaceData = 0);
 
  /** \details
    Outputs the face of a tessilated shell.
 
    \note
    This function is called from the default implementation of generateShellFaces,
    to process a single face in a shell along with the holes in that face.
    Vertex data needed for this function can be obtained by calling 
    vertexDataList and vertexData.
 
    Client applications have the option of overriding this function to process the face
    data themselves.  If the function is not overridden, the default implementation
    of this function processes the face information calls
    triangleOut with the resulting triangle data.
 
    \param faceListSize [in]  Number of entries in faceList.
    \param faceList [in]  List of numbers that define the face.
    \param pNormal [in]  Normal vector for this face.    
    \sa
    Vectorization Primitives
  */
    virtual void shellFaceOut(OdInt32 faceListSize,
                        const OdInt32* faceList,
                        const OdGeVector3d* pNormal);
 
  /** \details
    Output a triangle.
    \note
    This function is called from the default implementations of shellFaceOut
    and generateMeshFaces.  Vertex data needed for this function
    can be obtained by calling vertexDataList and vertexData.
    
    Client applications have the option of overriding this function to process 
    the triangle data themselves.  If the function is not overridden, 
    the default implementation of this function processes the color 
    attributes for the triangle, and calls polygonOut.
 
    \param vertices [in]  List of 3 numbers that define the vertices in the triangle.
    \param pNormal [in]  Normal vector for this triangle.
 
  */
  virtual void triangleOut(const OdInt32* vertices,
                           const OdGeVector3d* pNormal);
 
  /** \details
    Tessilates a shell.
    \note
    This auxiliary function that can be used to tessilate a shell up into a set of faces, 
    each with a maximum number of edges.
    
    Vertex data needed for this function is obtained by calling 
    vertexDataList and vertexData (so the caller of this function is responsible for 
    setting this data).  Face data is passed to the facetOut function, which 
    can be overridden by client applications to capture the tessellated data.
 
    \param faceListSize [in]  Number of entries in faceList.
    \param faceList [in]  List of numbers that define the faces in the shell.
    \param pFaceData [in]  Pointer to additional face data.
    \param maxFacetSize [in]  Maximum number of edges in the tessellated faces produced
      by this function.
 
    \sa
    OdGiFaceData, Vectorization Primitives
  */
  virtual void generateShellFacets(OdInt32 faceListSize,
    const OdInt32* faceList,
    const OdGiFaceData* pFaceData = 0,
    OdInt32 maxFacetSize = 3);
 
  /** \details
    Outputs a facet.
    \note
    This function is called from the default implementations of generateShellFacets.  
    Vertex data needed for this function is obtained by calling 
    vertexDataList and vertexData.
 
    Client applications have the option of overriding this function to process 
    the face data themselves.  If the function is not overridden, 
    the default implementation of this function calls polygonOut with the face data.
 
    \param faceList [in]  List of numbers that define the vertices in the facet.  
    \param edgeIndices [in]  Currently not used.
    \param pNormal [in]  Pointer to the normal vector for this face.
    \sa
    Vectorization Primitives
  */
  virtual void facetOut(const OdInt32* faceList,
        const OdInt32* edgeIndices,
        const OdGeVector3d* pNormal);
 
  /** \note
    Client applications have the option of overriding these function to process the circle
    data themselves.  If the function is not overridden, the default implementation
    tessellates the passed in circle using the current kOdGiMaxDevForCircle deviation,
    and calls polylineProc with the resulting data.
  */
  virtual void circleProc(const OdGePoint3d& center,
    double radius, 
    const OdGeVector3d& normal,
    const OdGeVector3d* pExtrusion = 0);
 
  virtual void circleProc(const OdGePoint3d& firstPoint,
    const OdGePoint3d& secondPoint, 
    const OdGePoint3d& thirdPoint,
    const OdGeVector3d* pExtrusion = 0);
 
  /** \note
    Client applications have the option of overriding this function to process the circular arc
    data themselves.  If the function is not overridden, the default implementation
    tessellates the passed in circular arc using the current kOdGiMaxDevForCircle deviation,
    and calls polylineProc with the resulting data (for kOdGiArcSimple type arcs).  For 
    kOdGiArcSector and kOdGiArcChord arc types, polygonOut is called.
  */
  virtual void circularArcProc(const OdGePoint3d& center,
    double radius,
    const OdGeVector3d& normal,
    const OdGeVector3d& startVector,
    double sweepAngle,
    OdGiArcType arcType = kOdGiArcSimple,
    const OdGeVector3d* pExtrusion = 0);
 
  virtual void circularArcProc(const OdGePoint3d& firstPoint,
    const OdGePoint3d& secondPoint,
    const OdGePoint3d& thirdPoint,
    OdGiArcType arcType = kOdGiArcSimple,
    const OdGeVector3d* pExtrusion = 0);
 
  /** \note
    Client applications have the option of overriding this function to process the text
    data themselves.  If the function is not overridden, the default implementation
    tessellates the passed in text string, by calling the textProc function
    on the associated OdGiContext object.  TrueType text will result in calls to 
    shellProc, and SHX text will get sent to polylineProc and polygonProc.
  */
  virtual void textProc(const OdGePoint3d& position,
    const OdGeVector3d& u, 
    const OdGeVector3d& v,
    const OdChar* msg, 
    OdInt32 length, 
    bool raw,
    const OdGiTextStyle* pTextStyle,
    const OdGeVector3d* pExtrusion = 0);
  virtual void textProc2(const OdGePoint3d& position,
    const OdGeVector3d& u, const OdGeVector3d& v,
    const OdChar* msg, OdInt32 length, bool raw, const OdGiTextStyle* pTextStyle,
    const OdGeVector3d* pExtrusion = 0, const OdGeExtents3d* extentsBox = 0);
 
  /** \note
    Client applications have the option of overriding this function to process the shape
    data themselves.  If the function is not overridden, the default implementation
    tessellates the passed in shape, by calling the shapeProc function
    on the associated OdGiContext object.  The resulting geometry 
    will get sent to polylineProc and polygonProc.
  */
  virtual void shapeProc(const OdGePoint3d& position,
    const OdGeVector3d& direction, 
    const OdGeVector3d& upVector,
    int shapeNumber, 
    const OdGiTextStyle* pTextStyle,
    const OdGeVector3d* pExtrusion = 0);
 
  /** \note
    Client applications have the option of overriding this function to process the NURBS
    data themselves.  If the function is not overridden, the default implementation
    tessellates the passed in NURBS curve using the current kOdGiMaxDevForCurve deviation,
    and calls polylineProc with the resulting data.
  */
  virtual void nurbsProc(const OdGeNurbCurve3d& nurbsCurve);
 
  /** \note
    Client applications have the option of overriding this function to process the elliptical arc
    data themselves.  If the function is not overridden, the default implementation
    tessellates the passed in elliptical arc using the current kOdGiMaxDevForCurve deviation,
    and calls polylineProc with the resulting data.
  */
  virtual void ellipArcProc(
    const OdGeEllipArc3d& ellipArc,
    const OdGePoint3d* endPointOverrides = 0,
    OdGiArcType arcType = kOdGiArcSimple,
    const OdGeVector3d* pExtrusion = 0);
 
  virtual bool ellipArcProc(const OdGeEllipArc3d& ellipArc, double width);
 
  /** \note
      The default implementation of this function does nothing but return.
  */
  virtual void rasterImageProc(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);
 
  /** \details
    Initializes a texture map for this Vectorizer object.
 
    \param origin [in]  Lower-left corner. 
    \param u [in]  Image width vector.
    \param v [in]  Image height vector.
    \param pImage [in]  Pointer to the RasterImage object.
    \param transparency [in]  True if and only if image transparency is on.
    \param brightness [in]  Image brightness [0.0 .. 100.0].
    \param contrast [in]  Image contrast [0.0 .. 100.0].
    \param fade [in]  Image fade value [0.0 .. 100.0].
  */
  virtual void initTexture(const OdGePoint3d& origin,
    const OdGeVector3d& u,
    const OdGeVector3d& v,
    const OdGiRasterImage* pImage,
    bool transparency,
    double brightness,
    double contrast,
    double fade);
 
  /** \details
    Releases a texture map for this Vectorizer object.
  */
  virtual void uninitTexture();
 
  /** \note
      The default implementation of this function does nothing but return.
  */
  virtual void metafileProc(const OdGePoint3d& origin,
    const OdGeVector3d& u,
    const OdGeVector3d& v,
    const OdGiMetafile* pMetafile,
    bool dcAligned = true,        
    bool allowClipping = false); 
 
  /** \note
      Client applications have the option of overriding this function to process the polypoint
      data themselves. If the function is not overridden, the default implementation
      of this function processes the polypoint, calling polylineProc for each point.
  */
  virtual void polypointProc(OdInt32 numPoints,
    const OdGePoint3d* vertexList,
    const OdCmEntityColor* pColors,
    const OdCmTransparency* pTransparency = 0,
    const OdGeVector3d* pNormals = 0,
    const OdGeVector3d* pExtrusions = 0,
    const OdGsMarker* pSubEntMarkers = 0,
    OdInt32 nPointSize = 0);
 
  /** \note
      Client applications have the option of overriding this function to process the rowOfDots
      data themselves. If the function is not overridden, the default implementation
      of this function processes the rowOfDots, calling polylineProc for each point.
  */
  virtual void rowOfDotsProc(OdInt32 numPoints, const OdGePoint3d& startPoint, const OdGeVector3d& dirToNextPoint);
 
  /** \note
      Client applications have the option of overriding this function to process the edge
      data themselves. If the function is not overridden, the default implementation
      of this function processes the edge, calling polylineProc for each hatch line or
      shellProc for solid and gradient filling.
  */
  virtual void edgeProc(const OdGiEdge2dArray& edges, const OdGeMatrix3d* pXform = 0);
 
  /** \note
    This function is called by the OdGiGeometrySimplifier class to 
    pass polyline data generated during tessellation, to a client application.
 
    Client applications have the option of overriding this function to process 
    the data themselves.  If the function is not overridden, 
    the default implementation of this function calls polylineOut with the vertex list.
 
    \param vertexIndexList [in]  Array of vertex indices in vertexDataList().
  */
  virtual void polylineOut(OdInt32 numPoints, const OdInt32* vertexIndexList);
 
  /** \note
      Utility function to be called from client implementation of meshProc()
      to unify mesh primitives processing. 
  */
  void convertMeshToShell(
    OdInt32 rows, OdInt32 columns,
    const OdGePoint3d* pVertexList,
    const OdGiEdgeData* pEdgeData,
    const OdGiFaceData* pFaceData,
    const OdGiVertexData* pVertexData);
 
  /** \note
    Client applications have the option of overriding this function to process the PolyDraw
    data themselves. If the function is not overridden, the default implementation
    tesselates the passed in PolyDraw contours using the current kOdGiMaxDevForCurve deviation,
    and calls shellProc with the resulting data.
  */
  virtual void ttfPolyDrawProc(
    OdInt32 numVertices, const OdGePoint3d* vertexList,
    OdInt32 faceListSize, const OdInt32* faceList,
    const OdUInt8* pBezierTypes, const OdGiFaceData* pFaceData = 0);
 
protected:
  // Pline primitive generation helpers
  bool jointLineWithArc(const OdGiPolyline& lwBuf, OdInt32 LineSegNo, OdInt32  ArcSegNo, OdGePoint3dArray& points);
  bool jointLineWithLine(const OdGiPolyline& lwBuf, OdInt32 LineSegNo1, OdInt32 LineSegNo2, OdGePoint3dArray& points);
  bool jointArcWithLine(const OdGiPolyline& lwBuf, OdGeCircArc2d& arc, OdInt32 arcSegNo, OdInt32 lineSegNo,
                        OdGePoint3d& point1, OdGePoint3d& point2);
  // Mesh primitive generation helpers
  bool isMeshRequireVertexNormals(const OdGiVertexData *pVertexData);
  void generateMeshVertexNormals(OdInt32 numRows, OdInt32 numCols, const OdGePoint3d *pVertexList, const OdGiVertexData *pVertexData,
                                 OdGiVertexData &vertexData, OdGeVector3dArray &normals);
  // Block of internal optimizations
  OdGeLineSeg2d *m_pLineSeg2d; OdGeLineSeg2d &tmpLineSeg2d();
  OdGeLineSeg2d *m_pLineSeg2dEx[2]; OdGeLineSeg2d &tmpLineSeg2dEx(int n);
  OdGeLine2d *m_pLine2dEx[4]; OdGeLine2d &tmpLine2dEx(int n);
  OdGeCircArc2d *m_pCircArc2d; OdGeCircArc2d &tmpCircArc2d();
  OdGeCircArc3d *m_pCircArc3d; OdGeCircArc3d &tmpCircArc3d();
  OdGeEllipArc3d *m_pEllipArc3d; OdGeEllipArc3d &tmpEllipArc3d();
  OdGePoint3dArray &tmpPoints3d(int nLevel) { return (!nLevel) ? m_points3d1 : m_points3d2; }
};
 
/** \details
 
    \sa
    TD_Gi 
    <group OdGi_Classes> 
*/
struct ODGI_EXPORT OdGiFillData
{
  OdGiFillData(OdGiConveyorContext* pDrawCtx, OdGiSubEntityTraits* pTraits,
    OdDb::LineWeight lweight = OdDb::kLnWt000,
    OdGiFillType fillType = kOdGiFillNever);
  void set(OdDb::LineWeight lweight, OdGiFillType fillType, const OdGeVector3d* fillNormal);
  ~OdGiFillData();
 
  OdDb::LineWeight m_lweight;
  OdGiFillType m_fillType;
  OdGeVector3d m_fillNormal;
  OdGeVector3d* m_pFillNormal;
  OdGiSubEntityTraits* m_pTraits;
  OdGiConveyorContext* m_pDrawCtx;
};
 
#include "TD_PackPop.h"
 
#endif //#ifndef __ODGIGEOMETRYSIMPLIFIER_H__