0022650: Exception in Primitive Array during Redisplay of Presentable Object
[occt.git] / src / Graphic3d / Graphic3d_Group_1.cxx
CommitLineData
7fd59977 1
2#define XDESTROY
3
4// File Graphic3d_Group_1.cxx (Clear Remove Open Close)
5// Created Fevrier 1992
6// Author NW,JPB,CAL
7
8//-Copyright MatraDatavision 1991,1992
9
10//-Version
11
12//-Design Declaration des variables specifiques aux groupes
13// de primitives
14
15//-Warning Un groupe est defini dans une structure
16// Il s'agit de la plus petite entite editable
17
18//-References
19
20//-Language C++ 2.0
21
22//-Declarations
23
24// for the class
25#include <Graphic3d_Group.jxx>
26#include <Graphic3d_Group.pxx>
27
28//-Methods, in order
29
30void Graphic3d_Group::Clear () {
31
32 if (IsDeleted ()) return;
33
34 MyCGroup.ContextLine.IsSet = 0,
35 MyCGroup.ContextText.IsSet = 0,
36 MyCGroup.ContextMarker.IsSet = 0,
37 MyCGroup.ContextFillArea.IsSet = 0;
38
39 MyCGroup.ContextLine.IsDef = 0,
40 MyCGroup.ContextText.IsDef = 0,
41 MyCGroup.ContextMarker.IsDef = 0,
42 MyCGroup.ContextFillArea.IsDef = 0;
43
44 MyCGroup.PickId.IsDef = 0,
45 MyCGroup.PickId.IsSet = 0,
46 MyCGroup.PickId.Value = 0;
47
48 MyBounds.XMin = ShortRealLast (),
49 MyBounds.YMin = ShortRealLast (),
50 MyBounds.ZMin = ShortRealLast ();
51
52 MyBounds.XMax = ShortRealFirst (),
53 MyBounds.YMax = ShortRealFirst (),
54 MyBounds.ZMax = ShortRealFirst ();
55
56 if (MyContainsFacet) MyStructure->GroupsWithFacet (-1);
57 MyContainsFacet = Standard_False,
58 MyIsEmpty = Standard_True;
59
60 MyGraphicDriver->ClearGroup (MyCGroup);
61
62 Update ();
63
64}
65
66void Graphic3d_Group::Destroy () {
67
68#ifdef DESTROY
69 cout << "Graphic3d_Group::Destroy ()\n";
70#endif
71
98178592
A
72 // tell graphics driver to clear internal resources of the group
73 if (!IsEmpty () && !MyGraphicDriver.IsNull ())
74 MyGraphicDriver->ClearGroup (MyCGroup);
75
7fd59977 76}
77
78void Graphic3d_Group::Remove () {
79
80 if (IsDeleted ()) return;
81
82 MyCGroup.IsDeleted = 1;
83 MyGraphicDriver->RemoveGroup (MyCGroup);
84 MyStructure->Remove (this);
85 Update ();
86
87 MyBounds.XMin = ShortRealLast (),
88 MyBounds.YMin = ShortRealLast (),
89 MyBounds.ZMin = ShortRealLast ();
90
91 MyBounds.XMax = ShortRealFirst (),
92 MyBounds.YMax = ShortRealFirst (),
93 MyBounds.ZMax = ShortRealFirst ();
94
95 if (MyContainsFacet) MyStructure->GroupsWithFacet (-1);
96 MyContainsFacet = Standard_False,
97 MyIsEmpty = Standard_True;
98
99}
100
101void Graphic3d_Group::BeginPrimitives () {
102
103 if (IsDeleted ()) return;
104 if (MyCGroup.IsOpen) return;
105
106 MyCGroup.IsOpen = 1;
107
108 MyGraphicDriver->OpenGroup (MyCGroup);
109
110}
111
112void Graphic3d_Group::EndPrimitives () {
113
114 if (IsDeleted ()) return;
115 if (! MyCGroup.IsOpen) return;
116
117 MyCGroup.IsOpen = 0;
118
119 MyGraphicDriver->CloseGroup (MyCGroup);
120
121}
122
123/*void Graphic3d_Group::SetTransformPersistence( const Graphic3d_TransModeFlags& AFlag )
124{
125 //MyCGroup.TransformPersistenceFlag = AFlag;
126}
127
128Graphic3d_TransModeFlags Graphic3d_Group::TransformPersistence() const
129{
130 //return MyCGroup.TransformPersistenceFlag;
131}*/