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
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
/////////////////////////////////////////////////////////////////////////////// 
// 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 __ODGIGEOMETRY_H__
#define __ODGIGEOMETRY_H__
 
#include "TD_PackPush.h"
#include "RxObject.h"
 
#include "Ge/GePoint3d.h"
#include "Ge/GeMatrix3d.h"
 
#include "Gi/GiRasterImage.h"
#include "Gi/GiMaterial.h"
 
class OdDbStub;
class OdCmEntityColor;
class OdGeMatrix3d;
class OdGeVector3d;
class OdGePoint2d;
class OdGeCurve2d;
class OdGiPathNode;
class OdGiMapper;
class OdCmTransparency;
class OdGiImageBGRA32;
 
typedef OdArray<OdGeCurve2d*, OdMemoryAllocator<OdGeCurve2d*> > OdGiEdge2dArray;
 
/** \details
    This class represents arrays of edge attributes for meshes and shells.
    
    \remarks
    EdgeData objects are optional; they can be optionally passed 
    to OdGiWorldGeometry and OdGiViewportGeometry when using their 
    mesh and shell methods. 
    
    \note 
    Setting an 'improper' size of any array will cause
    unpredictable or fatal results.
 
    \sa
    TD_Gi
 
    <group OdGi_Classes> 
*/
class OdGiEdgeData
{
  const OdUInt16*         m_pColors;
  const OdCmEntityColor*  m_pTrueColors;
        OdDbStub**        m_pLayerIds;
        OdDbStub**        m_pLinetypeIds;
  const OdGsMarker*       m_pSelectionMarkers;
  const OdUInt8*          m_pVisibilities;
public:
  OdGiEdgeData()
    : m_pColors(NULL)
    , m_pTrueColors(NULL)
    , m_pLayerIds(NULL)
    , m_pLinetypeIds(NULL)
    , m_pSelectionMarkers(NULL)
    , m_pVisibilities(NULL)
  {}
 
  /** \details
    Sets the edge colors to be used by this object.
 
    \param colors [in]  Array of color indices.
        
    \note
    You cannot call both setColors() and setTrueColors().
    
    This function does not make a copy of the array, which should have the same number of elements as the 
    mesh or shell with which it is used. An incorrect number of elements will have unpredictable or fatal consequences.
  */
  void setColors(
    const OdUInt16 *colors)                    { m_pColors = colors; }
 
  /** \details
    Sets the edge colors to be used by this object.
 
    \param colors [in]  Array of OdCmEntityColor objects.
        
    \note
    You cannot call both setColors() and setTrueColors().
 
    This function does not make a copy of the array, which should have the same number of elements as the 
    mesh or shell with which it is used. An incorrect number of elements will have unpredictable or fatal consequences.
  */
  void setTrueColors(
    const OdCmEntityColor *colors)         { m_pTrueColors = colors; }
 
  /** \details
    Sets the edge Layer Table Records to be used by this object.
 
    \param layerIds [in]  Array of LayerTableRecord Object IDs.
        
    \note
    This function does not make a copy of the array, which should have the same number of elements as the 
    mesh or shell with which it is used. An incorrect number of elements will have unpredictable or fatal consequences.
  */
  void setLayers(
    OdDbStub* *layerIds)                       { m_pLayerIds = layerIds; }
 
  /** \details
    Sets the edge Linetype Table Records to be used by this object.
 
    \param linetypeIds [in]  Array of LinetypeTableRecord Object IDs.
        
    \note
    This function does not make a copy of the array, which should have the same number of elements as the 
    mesh or shell with which it is used. An incorrect number of elements will have unpredictable or fatal consequences.
  */
  void setLinetypes(
    OdDbStub* *linetypeIds)                 { m_pLinetypeIds = linetypeIds; }
 
  /** \details
    Sets the edge graphics system selection markers to be used by this object.
 
    \param selectionMarkers [in]  Array of graphics system selection markers.
        
    \note
    This function does not make a copy of the array, which should have the same number of elements as the 
    mesh or shell with which it is used. An incorrect number of elements will have unpredictable or fatal consequences.
  */
  void setSelectionMarkers(
    const OdGsMarker* selectionMarkers) { m_pSelectionMarkers = selectionMarkers; }
 
  /** \details
    Sets the edge visibilities to be used by this object.
 
    \param visibilities [in]  Array of visibility values.
 
    \remarks
    Each visibility must be one of the following:
     
    <table>
    Name              Value   Description
    kOdGiInvisible    0       Invisible 
    kOdGiVisible      1       Visible 
    kOdGiSilhouette   2       Silhouette edge 
    </table>
        
    \note
    This function does not make a copy of the array, which should have the same number of elements as the 
    mesh or shell with which it is used. An incorrect number of elements will have unpredictable or fatal consequences.
  */
  void setVisibility(
    const OdUInt8* visibilities)           { m_pVisibilities = visibilities; }
  
  /** \details
    Returns the array of edge colors used by this object.
 
    \note
    This function does not make a copy of the array, which should have the same number of elements as the 
    mesh or shell with which it is used. Writing beyond the array bounds will have unpredictable or fatal consequences.
  */
  const OdUInt16* colors() const           { return m_pColors; }
 
  /** \details
    Returns the array of edge colors used by this object.
 
    \note
    This function does not make a copy of the array, which should have the same number of elements as the 
    mesh or shell with which it is used. Writing beyond the array bounds will have unpredictable or fatal consequences.
  */
  const OdCmEntityColor* trueColors() const       { return m_pTrueColors; }
 
  /** \details
    Returns the array of edge LayerTableRecord Object IDs used by this object.
 
    \note
    This function does not make a copy of the array, which should have the same number of elements as the 
    mesh or shell with which it is used. Writing beyond the array bounds will have unpredictable or fatal consequences.
  */
  OdDbStub** layerIds() const         { return m_pLayerIds; }
 
  /** \details
    Returns the array of edge LinetypeTableRecord Object IDs used by this object.
 
    \note
    This function does not make a copy of the array, which should have the same number of elements as the 
    mesh or shell with which it is used. Writing beyond the array bounds will have unpredictable or fatal consequences.
  */
  OdDbStub** linetypeIds() const      { return m_pLinetypeIds; }
 
  /** \details
    Returns the array of edge graphics system selection markers used by this object.
 
    \note
    This function does not make a copy of the array, which should have the same number of elements as the 
    mesh or shell with which it is used. Writing beyond the array bounds will have unpredictable or fatal consequences.
  */
  const OdGsMarker* selectionMarkers() const { return m_pSelectionMarkers; }
 
  /** \details
    Returns the array of edge visibilities used by this object.
 
    \remarks
    Each visibility must be one of the following:
     
    <table>
    Name              Value   Description
    kOdGiInvisible    0       Invisible 
    kOdGiVisible      1       Visible 
    kOdGiSilhouette   2       Silhouette edge 
    </table>
 
    \note
    This function does not make a copy of the array, which should have the same number of elements as the 
    mesh or shell with which it is used. Writing beyond the array bounds will have unpredictable or fatal consequences.
  */
  const OdUInt8* visibility() const       { return m_pVisibilities; }
};
 
 
/** \details
    This class contains arrays of face attributes for meshes and shells.
 
    \sa
    TD_Gi
 
    <group OdGi_Classes> 
*/
class OdGiFaceData
{
  const OdUInt16*         m_pColors;
  const OdCmEntityColor*  m_pTrueColors;
        OdDbStub**        m_pLayerIds;
  const OdGsMarker*       m_pSelectionMarkers;
  const OdUInt8*          m_pVisibilities;
  const OdGeVector3d*     m_pNormals;
        OdDbStub**        m_pMaterialIds;
  const OdGiMapper*       m_pMappers;
  const OdCmTransparency* m_pTransparency;
public:
  OdGiFaceData()
    : m_pColors(NULL)
    , m_pTrueColors(NULL)
    , m_pLayerIds(NULL)
    , m_pSelectionMarkers(NULL)
    , m_pVisibilities(NULL)
    , m_pNormals(NULL)
    , m_pMaterialIds(NULL)
    , m_pMappers(NULL)
    , m_pTransparency(NULL)
  {}
 
  /** \details
    Sets the face colors to be used by this object.
 
    \param colors [in]  Array of color indices.
        
    \note
    You cannot call both setColors() and setTrueColors().
 
    This function does not make a copy of the array, which should have the same number of elements as the 
    mesh or shell with which it is used. An incorrect number of elements will have unpredictable or fatal consequences.
  */
  void setColors(
    const OdUInt16 *colors)                    { m_pColors = colors; }
 
  /** \details
    Sets the face colors to be used by this object.
 
    \param colors [in]  Array of OdCmEntityColor objects.
        
    \note
    You cannot call both setColors() and setTrueColors().
 
    This function does not make a copy of the array, which should have the same number of elements as the 
    mesh or shell with which it is used. An incorrect number of elements will have unpredictable or fatal consequences.
  */
  void setTrueColors(
    const OdCmEntityColor *colors)         { m_pTrueColors = colors; }
 
  /** \details
    Sets the face Layer Table Records to be used by this object.
 
    \param layerIds [in]  Array of LayerTableRecord Object IDs.
        
    \note
    This function does not make a copy of the array, which should have the same number of elements as the 
    mesh or shell with which it is used. An incorrect number of elements will have unpredictable or fatal consequences.
  */
  void setLayers(
    OdDbStub* *layerIds)                       { m_pLayerIds = layerIds; }
 
  /** \details
    Sets the face graphics system selection markers to be used by this object.
 
    \param selectionMarkers [in]  Array of graphics system selection markers.
        
    \note
    This function does not make a copy of the array, which should have the same number of elements as the 
    mesh or shell with which it is used. An incorrect number of elements will have unpredictable or fatal consequences.
  */
  void setSelectionMarkers(
    const OdGsMarker* selectionMarkers) { m_pSelectionMarkers = selectionMarkers; }
 
  /** \details
    Sets the face normal vectors to be used by this object.
 
    \param normals [in]  Array of normal vectors.
        
    \note
    This function does not make a copy of the array, which should have the same number of elements as the 
    mesh or shell with which it is used. An incorrect number of elements will have unpredictable or fatal consequences.
  */
  void setNormals(
    const OdGeVector3d* normals)              { m_pNormals = normals; }
 
  /** \details
    Sets the face visibilities to be used by this object.
 
    \param visibilities [in]  Array of visibility values.
 
    \remarks
    Each visibility must be one of the following:
     
    <table>
    Name              Value   Description
    kOdGiInvisible    0       Invisible 
    kOdGiVisible      1       Visible 
    </table>
        
    \note
    This function does not make a copy of the array, which should have the same number of elements as the 
    mesh or shell with which it is used. An incorrect number of elements will have unpredictable or fatal consequences.
  */
  void setVisibility(
    const OdUInt8* visibilities)           { m_pVisibilities = visibilities; }
 
  /** \details
    Sets the face material object IDs to be used by this object.
 
    \param materialIds [in]  Array of material object IDs.
        
    \note
    This function does not make a copy of the array, which should have the same number of elements as the 
    mesh or shell with which it is used. An incorrect number of elements will have unpredictable or fatal consequences.
  */
  void setMaterials(
    OdDbStub* *materialIds)                { m_pMaterialIds = materialIds; }
 
  /** \details
    Sets the face material mappers to be used by this object.
 
    \param mappers [in]  Array of material mappers.
        
    \note
    This function does not make a copy of the array, which should have the same number of elements as the 
    mesh or shell with which it is used. An incorrect number of elements will have unpredictable or fatal consequences.
  */
  void setMappers(
    const OdGiMapper* mappers)             { m_pMappers = mappers; }
 
  /** \details
    Sets the face transparency to be used by this object.
 
    \param transparencies [in]  Array of OdCmTransparency objects.
        
    This function does not make a copy of the array, which should have the same number of elements as the 
    mesh or shell with which it is used. An incorrect number of elements will have unpredictable or fatal consequences.
  */
  void setTransparency(
    const OdCmTransparency *transparencies) { m_pTransparency = transparencies; }
 
  /** \details
    Returns the array of face colors used by this object.
 
    \note
    This function does not make a copy of the array, which should have the same number of elements as the 
    mesh or shell with which it is used. Writing beyond the array bounds will have unpredictable or fatal consequences.
  */
  const OdUInt16* colors() const           { return m_pColors; }
 
  /** \details
    Returns the array of face colors used by this object.
 
    \note
    This function does not make a copy of the array, which should have the same number of elements as the 
    mesh or shell with which it is used. Writing beyond the array bounds will have unpredictable or fatal consequences.
  */
  const OdCmEntityColor* trueColors() const       { return m_pTrueColors; }
 
  /** \details
    Returns the array of face LayerTableRecord Object IDs used by this object.
 
    \note
    This function does not make a copy of the array, which should have the same number of elements as the 
    mesh or shell with which it is used. Writing beyond the array bounds will have unpredictable or fatal consequences.
  */
  OdDbStub** layerIds() const         { return m_pLayerIds; }
 
  /** \details
    Returns the array of face graphics system selection markers used by this object.
 
    \note
    This function does not make a copy of the array, which should have the same number of elements as the 
    mesh or shell with which it is used. Writing beyond the array bounds will have unpredictable or fatal consequences.
  */
  const OdGsMarker* selectionMarkers() const { return m_pSelectionMarkers; }
 
  /** \details
    Returns the array of face normal vectors used by this object.
 
    \note
    This function does not make a copy of the array, which should have the same number of elements as the 
    mesh or shell with which it is used. Writing beyond the array bounds will have unpredictable or fatal consequences.
  */
  const OdGeVector3d* normals() const          { return m_pNormals; }
 
  /** \details
    Returns the array of edge visibilities used by this object.
 
    \remarks
    Each visibility must be one of the following:
     
    <table>
    Name              Value   Description
    kOdGiInvisible    0       Invisible 
    kOdGiVisible      1       Visible 
    </table>
 
    \note
    This function does not make a copy of the array, which should have the same number of elements as the 
    mesh or shell with which it is used. Writing beyond the array bounds will have unpredictable or fatal consequences.
  */
  const OdUInt8* visibility() const       { return m_pVisibilities; }
 
  /** \details
    Returns the array of face material object IDs used by this object.
 
    \note
    This function does not make a copy of the array, which should have the same number of elements as the 
    mesh or shell with which it is used. Writing beyond the array bounds will have unpredictable or fatal consequences.
  */
  OdDbStub** materials() const            { return m_pMaterialIds; }
 
  /** \details
    Returns the array of face material mappers used by this object.
 
    \note
    This function does not make a copy of the array, which should have the same number of elements as the 
    mesh or shell with which it is used. Writing beyond the array bounds will have unpredictable or fatal consequences.
  */
  const OdGiMapper* mappers() const       { return m_pMappers; }
 
  /** \details
    Returns the array of face transparency used by this object.
 
    \note
    This function does not make a copy of the array, which should have the same number of elements as the 
    mesh or shell with which it is used. Writing beyond the array bounds will have unpredictable or fatal consequences.
  */
  const OdCmTransparency* transparency() const { return m_pTransparency; }
};
 
typedef enum
{
  kOdGiCounterClockwise = -1,
  kOdGiNoOrientation    = 0,
  kOdGiClockwise        = 1
} OdGiOrientationType;
 
 
/** \details
    This class contains arrays of vertex attributes for meshes and shells.
    
    \remarks
    VertexData objects are optional; they can be optionally passed 
    to OdGiWorldGeometry and OdGiViewportGeometry when using their 
    mesh and shell methods.
    
     Setting an 'improper' size of any array will cause unpredictable or fatal results.
 
    \sa
    TD_Gi
 
    <group OdGi_Classes> 
*/
class OdGiVertexData
{
  const OdGeVector3d*    m_pNormals;
  OdGiOrientationType    m_orientationFlag;
  const OdCmEntityColor* m_pTrueColors;
  const OdGePoint3d*     m_pMappingCoords;
public:
  OdGiVertexData()
    : m_pNormals(NULL)
    , m_orientationFlag(kOdGiNoOrientation)
    , m_pTrueColors(NULL)
    , m_pMappingCoords(NULL)
  {}
 
  enum MapChannel { kAllChannels = 0 };
 
  /** \details
    Sets the vertex normal vectors to be used by this object.
 
    \param normals [in]  Array of normal vectors.
 
    \note
    This function does not make a copy of the array, which should have the same number of elements as the 
    mesh or shell with which it is used. An incorrect number of elements will have unpredictable or fatal consequences.
  */
  void setNormals(
    const OdGeVector3d* normals)              { m_pNormals = normals; }
 
  /** \details
    Sets the orientation type to be used by this object.
 
    \param orientationFlag [in]  Orientation type.
 
    \remarks
    The orientation type defines the positive direction of the normal at the vertices.
 
    orientationFlag must be one of the following:
 
    <table>
    Name                      Value 
    kOdGiCounterClockwise     -1
    kOdGiNoOrientation        0
    kOdGiClockwise            1
    </table>
  */
  void setOrientationFlag(
    const OdGiOrientationType orientationType) { m_orientationFlag = orientationType; }
 
  /** \details
    Sets the vertex colors to be used by this object.
 
    \param colors [in]  Array of OdCmEntityColor objects.
 
    \note
    This function does not make a copy of the array, which should have the same number of elements as the 
    mesh or shell with which it is used. An incorrect number of elements will have unpredictable or fatal consequences.
  */
  void setTrueColors(
    const OdCmEntityColor *colors)         { m_pTrueColors = colors; }
 
  /** \details
    Sets the mapping coordinates to be used by this object.
 
    \param channel [in]  Specifies mapping channel.
    \param coords [in]  Array of OdGePoint3d objects.
 
    \note
    This function does not make a copy of the array, which should have the same number of elements as the 
    mesh or shell with which it is used. An incorrect number of elements will have unpredictable or fatal consequences.
  */
  void setMappingCoords(
    MapChannel channel,
    const OdGePoint3d *coords)             { ODA_ASSERT(channel == kAllChannels); m_pMappingCoords = coords; }
 
  /** \details
    Returns the array of vertex normal vectors used by this object.
 
    \note
    This function does not make a copy of the array, which should have the same number of elements as the 
    mesh or shell with which it is used. Writing beyond the array bounds will have unpredictable or fatal consequences.
  */
  const OdGeVector3d* normals() const         { return m_pNormals; }
 
  /** \details
    Returns the direction of the normal at the vertices that is used by this object.
 
    \remarks
    orientationFlag must be one of the following:
 
    <table>
    Name                      Value 
    kOdGiCounterClockwise     -1
    kOdGiNoOrientation        0
    kOdGiClockwise            1
    </table>
  */
  OdGiOrientationType orientationFlag() const { return m_orientationFlag; }
 
  /** \details
    Returns the array of vertex colors used by this object.
 
    \note
    This function does not make a copy of the array, which should have the same number of elements as the 
    mesh or shell with which it is used. Writing beyond the array bounds will have unpredictable or fatal consequences.
  */
  const OdCmEntityColor* trueColors() const   { return m_pTrueColors; }
 
  /** \details
    Returns the array of mapping coordinates used by this object.
 
    \param channel [in]  Specifies mapping channel.
 
    \note
    This function does not make a copy of the array, which should have the same number of elements as the 
    mesh or shell with which it is used. Writing beyond the array bounds will have unpredictable or fatal consequences.
  */
  const OdGePoint3d* mappingCoords(MapChannel channel) const { ODA_ASSERT(channel == kAllChannels); return m_pMappingCoords; }
};
 
class OdGiDrawable;
struct OdGiClipBoundary;
class OdGiAbstractClipBoundary;
 
class OdDbPolyline;
class OdPolyPolygon3d;
class OdGeNurbCurve3d;
class OdGiTextStyle;
class OdDbBody;
class OdGeEllipArc3d;
class OdGiPolyline;
 
/** \details
    Arc types.
*/
typedef enum
{
  kOdGiArcSimple = 0,   // Unfilled.
  kOdGiArcSector = 1,   // Filled area bounded by the arc and its center.
  kOdGiArcChord  = 2    // Filled area bounded by the arc and its end points
} OdGiArcType;
 
/** \details
    This class defines functions that allow entities to vectorize themselves.
 
    \sa
    TD_Gi
 
    <group OdGi_Classes> 
*/
class FIRSTDLL_EXPORT OdGiGeometry : public OdRxObject
{
public:
  ODRX_DECLARE_MEMBERS(OdGiGeometry);
 
  /** \details
    Returns the model-to-world coordinate transform matrix for the entity being vectorized.
    
    \remarks
    This is the inverse of the matrix returned by getWorldToModelTransform(). 
 
    If an entity is in one or more blocks, this matrix can be used to
    determine the WCS coordinates of the entity.  
  */
  virtual OdGeMatrix3d getModelToWorldTransform() const = 0;
 
  /** \details
    Returns the world-to-model coordinate transform matrix for the entity being vectorized.
    
    \remarks
    This is the inverse of the matrix returned by getModelToWorldTransform(). 
  */
  virtual OdGeMatrix3d getWorldToModelTransform() const = 0;
  
  /** \details
    Specifies a model transformation matrix for the current transformation stack.  
    
    \remarks
    When a vector is specified, the transformation is created using the arbitrary axis algorithm 
    on the vector. 
 
    The specified transformation is concatenated to the current model transformation 
    (which is initially the identity transform). The resulting model transformation 
    is subsequently applied to all geometry introduced into this vectorization context, 
    until popModelTransform() is called.
    
    \param normal [in]  Normal vector.
    \param xfm [in]  Transformation matrix.
    
  */
  virtual void pushModelTransform(
    const OdGeVector3d& normal) = 0;
 
  virtual void pushModelTransform(
    const OdGeMatrix3d& xfm) = 0;
 
  /** \details
    Removes the top transformation off the current transformation stack.
  */
  virtual void popModelTransform() = 0;
  
  /** \details
    Introduces a circle to this vectorization context.  
    
    \remarks
    The circle is not filled and takes on the current color.
    
    If firstPoint, secondPoint, and thirdPoint are specified, they
    cannot be colinear and no two can be coincident.
 
    \param center [in]  Center point.
    \param radius [in]  Radius.
    \param normal [in]  Normal.
  */
  virtual void circle(
    const OdGePoint3d& center, 
    double radius, 
    const OdGeVector3d& normal) = 0;
  
  /** \param firstPoint [in]  First point of a 3-point circle.
    \param secondPoint [in]  Second point of a 3-point circle.
    \param thirdPoint [in]  Third point of a 3-point circle.
  */
  virtual void circle(
    const OdGePoint3d& firstPoint, 
    const OdGePoint3d& secondPoint, 
    const OdGePoint3d& thirdPoint) = 0;
  
/** \details
    Introduces a circular arc to this vectorization context.  
    
    \param center [in]  Center point.
    \param radius [in]  Radius.
    \param normal [in]  Normal vector.
    \param startVector [in]  Start of the arc.
    \param sweepAngle [in]  Angle that defines the arc.
    \param arcType [in]  Arc type.
    
    \remarks
    The arc takes on the current color.      
 
    If firstPoint, secondPoint, and thirdPoint are specified, they
    cannot be colinear and no two can be coincident.
    
    arcType must be one of the following:
    
    <table>
    Name              Value     Description
    kOdGiArcSimple    0         Unfilled.
    kOdGiArcSector    1         Filled area bounded by the arc and its center.
    kOdGiArcChord     2         Filled area bounded by the arc and its end points
    </table>
    
    \note
    All angles are expressed in radians.
*/
  virtual void circularArc(
    const OdGePoint3d& center,
    double radius,
    const OdGeVector3d& normal,
    const OdGeVector3d& startVector,
    double sweepAngle,
    OdGiArcType arcType = kOdGiArcSimple) = 0;
  
  /** \param firstPoint [in]  First point of a 3-point arc.
    \param secondPoint [in]  Second point of a 3-point arc.
    \param thirdPoint [in]  Third point of a 3-point arc.
  */
  virtual void circularArc(
    const OdGePoint3d& firstPoint,
    const OdGePoint3d& secondPoint,
    const OdGePoint3d& thirdPoint,
    OdGiArcType arcType = kOdGiArcSimple) = 0;
 
  /** \details
    Introduces a polyline to this vectorization context.  
    
    \remarks
    The polyline is unfilled and takes on the current color and thickness. Use polygon() to render filled areas.
    
    The polyline is rendered as a series of lines connecting the first point
    in vertexList to the second, the second to the third, etc.
    All points must be coplanar.
 
    Use polygon() to render closed areas.
 
    \param numVertices [in]  Number of vertices.
    \param vertexList [in]  Array of vertices.
    \param pNormal [in]  Pointer to the normal vector.
    \param baseSubEntMarker [in]  Not used.
  */
  virtual void polyline(
    OdInt32 numVertices,
    const OdGePoint3d* vertexList,
    const OdGeVector3d* pNormal = 0,
    OdGsMarker baseSubEntMarker = -1) = 0;
  
  /** \details
    Introduces a polygon to this vectorization context.  
    
    \remarks
    The polygon is filled and takes on the current color. Use polyline() to render unfilled areas.
 
    The polygon is rendered as a series of lines connecting the first point
    in vertexList to the second, the second to the third, etc.
    All points must be coplanar.
 
    \param numVertices [in]  Number of vertices.
    \param vertexList [in]  Array of vertices.
  */
  virtual void polygon(
    OdInt32 numVertices, 
    const OdGePoint3d* vertexList) = 0;
 
  /** \details
    Introduces a lightweight polyline into this vectorization context.
    
    \remarks
    The polyline may contain varying segment widths, straight segments
    and arc segments.    
 
    The polyline takes on the current color.
    
    All points must be coplanar.
 
    \param polyline [in]  Polyline.
    \param fromIndex [in]  Index of the first segment to be processed.
    \param numSegs [in]  Number of segments to be processed (0 indicates all segments).
  */
  virtual void pline(
    const OdGiPolyline& polyline, 
    OdUInt32 fromIndex = 0, 
    OdUInt32 numSegs = 0) = 0;
 
  /** \details
    Introduces a mesh into this vectorization context.  
    
    \param numRows [in]  Number of rows.
    \param numColumns [in]  Number of columns.
    \param vertexList [in]  Array of vertices.
    \param pEdgeData [in]  Pointer to additional edge data.
    \param pFaceData [in]  Pointer to additional face data.
    \param pVertexData [in]  Pointer to additional vertex data. 
 
    \remarks
    A mesh is a surface defined by a grid of vertices, and corresponds to a Polygon Mesh.
    By default, a mesh takes on the current color. Color, linetype, and
    and other properties can be controlled supplying the appropriate
    data for the pEdgeData, pFaceData, and pVertexData arguments.
 
    \note
    * vertexList must have numRows × numColumns elements.
    * The arrays in *pEdgeData must be NULL or contain (numRows - 1) × numColumns + numRows × (numColumns -1) elements.
    * The arrays in *pFaceData must be NULL or contain (numRows - 1) × (numColumns - 1) elements.
    * The arrays in *pVertexData must be NULL or contain numRows × numColumns elements. 
  */
  virtual void mesh(
    OdInt32 numRows,
    OdInt32 numColumns,
    const OdGePoint3d* vertexList,
    const OdGiEdgeData* pEdgeData = 0,
    const OdGiFaceData* pFaceData = 0,
    const OdGiVertexData* pVertexData = 0) = 0;
  
  /** \details
    Introduces a shell into this vectorization context.  
    
    \param numVertices [in]  Number of vertices.
    \param vertexList [in]  Array of vertices.
    \param faceListSize [in]  Number of entries in facesList.
    \param faceList [in]  Array of integers defining faces.
    \param pEdgeData [in]  Pointer to additional edge data.
    \param pFaceData [in]  Pointer to additional face data.
    \param pVertexData [in]  Pointer to additional vertex data.
    
    \remarks
    A shell is a set of faces that can contain holes, and corresponds to a Polyface mesh.
 
    By default, a mesh takes on the current color. Color, linetype, and
    and other properties can be controlled supplying the appropriate
    data for the pEdgeData, pFaceData, and pVertexData arguments.
    
    \remarks
    * The arrays in *pEdgeData must be NULL or contain the same number of elements as there are edges.
    * The arrays in *pFaceData must be NULL or contain the same number of elements as there are faces.
    * The arrays in *pVertexData must be NULL or contain numVertices elements. 
    
    \sa
    Faces
  */
  virtual void shell(
    OdInt32 numVertices,
    const OdGePoint3d* vertexList,
    OdInt32 faceListSize,
    const OdInt32* faceList,
    const OdGiEdgeData* pEdgeData = 0,
    const OdGiFaceData* pFaceData = 0,
    const OdGiVertexData* pVertexData = 0) = 0;
  
  /** \details
    Introduces text into this vectorization context.
    
    \param position [in]  Position of the text string.
    \param normal [in]  Normal vector of the text.
    \param direction [in]  Baseline direction of the text.
    \param height [in]  Height of the text.
    \param width [in]  Width factor of the text.
    \param oblique [in]  Oblique angle.
    \param msg [in]  Text string.
 
    \remarks
    The text takes on the current color.
 
    If numBytes is not specified, msg must be null terminated.
    
    \note
    All angles are expressed in radians.
 
    As currently implemented, this function ignores width and oblique.
    They will be fully implemented in a future release.
  */
  virtual void text(
    const OdGePoint3d& position,
    const OdGeVector3d& normal, 
    const OdGeVector3d& direction,
    double height, 
    double width, 
    double oblique, 
    const OdString& msg) = 0;
  
  /** \param length [in]  Number of characters in msg (not including the optional null character).
    \param raw [in]  If and only if true, escape sequences, such as %%P, will not be converted to special characters.
    \param pTextStyle [in]  Pointer to the TextStyle for the text.
  */
  virtual void text(
    const OdGePoint3d& position,
    const OdGeVector3d& normal, 
    const OdGeVector3d& direction,
    const OdChar* msg, 
    OdInt32 length, 
    bool raw, 
    const OdGiTextStyle* pTextStyle) = 0;
  
  /** \details
    Introduces an Xline into this vectorization context.  
      
    \remarks
    Xlines are infinite lines passing through two points.
 
    The xline takes on the current color.
    
    \param firstPoint [in]  First point.
    \param secondPoint [in]  Second point.
  */
  virtual void xline(
    const OdGePoint3d& firstPoint, 
    const OdGePoint3d& secondPoint) = 0;
 
  /** \details
    Introduces a Ray into this vectorization context.  
    
    \remarks
    A Ray is a semi-infinite line that starts at the basePoint, and passes 
    through the throughPoint.
 
    The ray takes on the current color.
 
    \param basePoint [in]  Base point.
    \param throughPoint [in]  Through point
  */
  virtual void ray(
    const OdGePoint3d& basePoint, 
    const OdGePoint3d& throughPoint) = 0;
  
  /** \details
    Introduces a NURBS curve into this vectorization context.
      
    \remarks
    The curve takes on the current color.
    
    \param nurbsCurve [in]  NURBS curve data.
  */
  virtual void nurbs(
    const OdGeNurbCurve3d& nurbsCurve) = 0;
 
  /** \details
    Introduces an elliptical arc into this vectorization context.
        
    \param ellipArc [in]  Elliptical arc.
    \param endPointsOverrides [in]  Array of points to be used as the first and last points of the vectorized arc.
    \param arcType [in]  Arc type.
        
    \remarks
    arcType must be one of the following:
    
    <table>
    Name              Value     Description
    kOdGiArcSimple    0         Unfilled.
    kOdGiArcSector    1         Filled area bounded by the arc and its center.
    kOdGiArcChord     3         Filled area bounded by the arc and its end points
    </table>
  */
  virtual void ellipArc(
    const OdGeEllipArc3d& ellipArc,
    const OdGePoint3d* endPointsOverrides = 0,
    OdGiArcType arcType = kOdGiArcSimple) = 0;
 
  /** \details
    Introduces the specified object into this vectorization context.
    
    \param pDrawable [in]  Pointer to the Drawable object.
 
    \remarks
    Implementations of this method are expected to do the following:
    * Call OdGiDrawable::subSetAttributes to set attribute information for the object.
    * Call subWorldDraw on the drawable object  to vectorize it into this context.
    * If subWorldDraw returns false, call subViewportDraw each viewport.
  */
  virtual void draw(
    const OdGiDrawable* pDrawable) = 0;
 
  /** \details
    Specifies a clip boundary for the current clip stack.
 
    \param pBoundary [in]  Pointer to the boundary.
 
    \remarks
    Subsequent objects are clipped until popClipBoundary() is called.
  */
  virtual void pushClipBoundary(
    OdGiClipBoundary* pBoundary) = 0;
 
  /** \details
    Removes the top clip boundary from the clip stack.
  */
  virtual void popClipBoundary() = 0;
 
  /** \details
    Introduces a line into this vectorization context.  
 
    \param points [in]  Array of WCS start and end points.
 
      \remarks
    The current model transformation is not applied to the line.
  */
  virtual void worldLine(
    const OdGePoint3d points[2]) = 0;
 
  /** \details
    Inroduces a image in BGRA format into this vectorization context.
    
    \param img [in]  Image in BGRA format.
    \param origin [in]  Image position in WCS.
    \param uVec [in]  Image width and X-axis orientation.
    \param vVec [in]  Image height and Y-axis orientation.
    \param trpMode [in]  Image transparency processing mode.
  */
  virtual void image(
    const OdGiImageBGRA32& img,
    const OdGePoint3d& origin,
    const OdGeVector3d& uVec,
    const OdGeVector3d& vVec,
    OdGiRasterImage::TransparencyMode trpMode = OdGiRasterImage::kTransparency8Bit) = 0;
 
  /** \details
    Inroduces a boundary for hatch filling.
    
    \param edges [in]  Array of 2d curves which represents filling boundary.
  */
  virtual void edge(
    const OdGiEdge2dArray& edges) = 0;
 
  /** \details
    Returns currently processing GiDrawable objects graph.
  */
  virtual const OdGiPathNode* currentGiPath() const;
 
  /** \details
    Specifies a clip boundary with additional clipping information for the current clip stack.
 
    \param pBoundary [in]  Pointer to the boundary.
    \param pClipInfo [in]  Additional clipping information.
 
    \remarks
    Subsequent objects are clipped until popClipBoundary() is called.
  */
  virtual void pushClipBoundary(
    OdGiClipBoundary* pBoundary, OdGiAbstractClipBoundary* pClipInfo);
 
  /** \details
    Introduces an array of points to this vectorization context.
 
    \param numPoints [in]  Number of point in array.
    \param vertexList [in]  Array of points.
    \param pColors [in]  Array of colors.
    \param pTransparency [in]  Array of transparencies.
    \param pNormals [in]  Optional array of normal vectors.
    \param pSubEntMarkers [in]  Optional array of subentity markers.
    \param nPointSize [in]  Size of points in pixels.
 
    \remarks
    The points takes on the current color if pColors array doesn't specified.
 
    Lengths of pColors, pTransparency, pNormals and pSubEntMarkers arrays if them set must be equal to numPoints.
  */
  virtual void polypoint(
    OdInt32 numPoints,
    const OdGePoint3d* vertexList,
    const OdCmEntityColor* pColors,
    const OdCmTransparency* pTransparency,
    const OdGeVector3d* pNormals = NULL,
    const OdGsMarker* pSubEntMarkers = NULL,
    OdInt32 nPointSize = 0);
  ODRX_SEALED_VIRTUAL void polypoint(
    OdInt32 numPoints,
    const OdGePoint3d* vertexList,
    const OdCmEntityColor* pColors,
    const OdGeVector3d* pNormals = NULL,
    const OdGsMarker* pSubEntMarkers = NULL) ODRX_SEALED;
  ODRX_SEALED_VIRTUAL void polypoint(
    OdInt32 numPoints,
    const OdGePoint3d* vertexList,
    const OdGeVector3d* pNormals = NULL,
    const OdGsMarker* pSubEntMarkers = NULL) ODRX_SEALED;
 
  /** \details
    Introduces a row of points to this vectorization context.
 
    \param numPoints [in]  Number of points to draw.
    \param startPoint [in]  First point to draw.
    \param dirToNextPoint [in]  Offset and direction between next points.
 
    \remarks
    The points takes on the current color.
  */
  virtual void rowOfDots(
    OdInt32 numPoints, const OdGePoint3d& startPoint, const OdGeVector3d& dirToNextPoint);
};
 
inline const OdGiPathNode* OdGiGeometry::currentGiPath() const
{
  return 0;
}
 
inline void OdGiGeometry::pushClipBoundary(OdGiClipBoundary* pBoundary, OdGiAbstractClipBoundary* /*pClipInfo*/)
{
  // Some implementations could not support additional clipping styles, so redirect to old style clipping method by default.
  pushClipBoundary(pBoundary);
}
 
inline void OdGiGeometry::polypoint(OdInt32 numPoints, const OdGePoint3d* vertexList, const OdCmEntityColor* /*pColors*/,
                                    const OdCmTransparency* /*pTransparency*/, const OdGeVector3d* pNormals, const OdGsMarker* pSubEntMarkers,
                                    OdInt32 /*nPointSize*/)
{
  OdGePoint3d tmpVerts[2];
  for (OdInt32 nPoint = 0; nPoint < numPoints; nPoint++)
  {
    const OdGeVector3d *pNormal = (pNormals) ? (pNormals + nPoint) : NULL;
    const OdGsMarker baseSubEntMarker = (pSubEntMarkers) ? pSubEntMarkers[nPoint] : -1;
    tmpVerts[1] = tmpVerts[0] = vertexList[nPoint];
    polyline(2, tmpVerts, pNormal, baseSubEntMarker);
  }
}
 
inline void OdGiGeometry::polypoint(OdInt32 numPoints, const OdGePoint3d* vertexList, const OdCmEntityColor* pColors,
                                    const OdGeVector3d* pNormals, const OdGsMarker* pSubEntMarkers)
{
  polypoint(numPoints, vertexList, pColors, NULL, pNormals, pSubEntMarkers);
}
 
inline void OdGiGeometry::polypoint(OdInt32 numPoints, const OdGePoint3d* vertexList,
                                    const OdGeVector3d* pNormals, const OdGsMarker* pSubEntMarkers)
{
  polypoint(numPoints, vertexList, NULL, pNormals, pSubEntMarkers);
}
 
inline void OdGiGeometry::rowOfDots(OdInt32 numPoints, const OdGePoint3d& startPoint, const OdGeVector3d& dirToNextPoint)
{
  OdGePoint3d tmpVerts[2];
  for (OdInt32 nPoint = 0; nPoint < numPoints; nPoint++)
  {
    tmpVerts[1] = tmpVerts[0] = startPoint + dirToNextPoint * double(nPoint);
    polyline(2, tmpVerts);
  }
}
 
/** \details
This class is used to ensure OdGiGeometry::pushClipBoundary()/OdGiGeometry::popClipBoundary() 
consistency (exception safety).
 
\sa
TD_Gi
 
<group OdGi_Classes> 
*/
class OdGiClipBoundarySaver
{
  bool m_bSave;
  OdGiGeometry& m_geom;
public:
  OdGiClipBoundarySaver(OdGiGeometry& geom, bool bSave) : m_bSave(bSave), m_geom(geom){}
  void setSave(bool bSave){m_bSave = bSave;}
  ~OdGiClipBoundarySaver()
  {
    if (m_bSave)
      m_geom.popClipBoundary();
  }
};
 
/** \details
This class is used to ensure OdGiGeometry::pushModelTransform()/OdGiGeometry::popModelTransform() 
consistency (exception safety).
 
\sa
TD_Gi
 
<group OdGi_Classes> 
*/
class OdGiModelTransformSaver
{
  OdGiGeometry& m_geom;
public:
  OdGiModelTransformSaver(OdGiGeometry& geom, const OdGeMatrix3d& xMat) : m_geom(geom)
  {
    m_geom.pushModelTransform(xMat);
  }
  ~OdGiModelTransformSaver()
  {
    m_geom.popModelTransform();
  }
};
 
/* #11298 info: Matrix identity check was removed from OdGiModelTransformSaver and place into separate OdGiModelTransformSaverOpt class.
                Identity check is also time consuming operation and it is only makes things worse if matrices become identity seldom in
                some case. Following statistics on 10 typical drawing was collected on 18.10.2012:
 
                     Source File                                     : Line     Identity=true      Identity=false     % of identity=true
..\..\..\..\..\TD\Source\Gs\GsBlockReferenceNode.cpp                 : 1263     3202               60838              5%
..\..\..\..\..\TD\Source\Gs\GsBlockReferenceNodeImpl.cpp             : 707      2                  64364              0.003%
..\..\..\..\..\TD\Source\Gs\GsBlockReferenceNodeImpl.cpp             : 868      3                  62                 4.6%
..\..\..\..\..\TD\Source\database\Entities\DbBlockReference.cpp      : 1101     25                 64905              0.038%
..\..\..\..\..\TD\Source\database\Entities\DbDimension.cpp           : 1307     12546              16                 99.87%
..\..\..\..\..\TD\Source\database\Entities\DbHatchRender.cpp         : 714      38566              0                  100%
..\..\..\..\..\TD\Source\database\Entities\DbMInsertBlock.cpp        : 322      1603               30457              5%
..\..\..\..\..\TD\Source\database\Entities\DbModelerGeometryImpl.cpp : 1410     8                  0                  100%
..\..\..\..\..\TD\Source\database\Entities\DbModelerGeometryImpl.cpp : 1545     6                  0                  100%
..\..\..\..\..\TD\Source\database\Entities\DbPoint.cpp               : 264      0                  208                0%
..\..\..\..\TD\Source\database\GiDefaultContext.cpp                  : 454      4405               0                  100%
..\..\..\..\TD\Source\database\GiDefaultContext.cpp                  : 557      124                23626              0.522%
 
All places where percents of identity=true < 10% will use OdGiModelTransformSaver. Places where Identity=true very frequent will use
OdGiModelTransformSaverOpt. Unchecked places isn't principle since them are called very seldom.                                          */
 
/** \details
This class is used to ensure OdGiGeometry::pushModelTransform()/OdGiGeometry::popModelTransform() 
consistency (exception safety) with additional optimization check of matrix identity.
 
\sa
TD_Gi
 
<group OdGi_Classes> 
*/
class OdGiModelTransformSaverOpt
{
  OdGiGeometry& m_geom;
  bool          m_bIdentity;
public:
  OdGiModelTransformSaverOpt(OdGiGeometry& geom, const OdGeMatrix3d& xMat) : m_geom(geom)
  {
    // @@@TODO: check, probably simple memcmp will be more effective here. memcmp is very assembler-optimized in modern crt's. Identity
    //          matrix could be inexact only after some multiplications and etc. But statistics must be collected first for isEqual check
    //          and for memcmp, if it will be faster and precisely enough isEqualTo check with tolerance can be exchanged by memcmp.
    m_bIdentity = xMat.isEqualTo(OdGeMatrix3d::kIdentity);
    if (!m_bIdentity)
      m_geom.pushModelTransform(xMat);
  }
  ~OdGiModelTransformSaverOpt()
  {
    if (!m_bIdentity)
      m_geom.popModelTransform();
  }
};
 
#include "TD_PackPop.h"
 
#endif