7fd59977 |
1 | |
2 | // File Graphic3d_Group_2.cxx (Inquire) |
3 | // Created Fevrier 1992 |
4 | // Author NW,JPB,CAL |
5 | |
6 | //-Copyright MatraDatavision 1991,1992 |
7 | |
8 | //-Version |
9 | |
81bba717 |
10 | //-Design Declaration of variables specific to groups |
11 | // of primitives |
7fd59977 |
12 | |
81bba717 |
13 | //-Warning A group is defined in a structure |
14 | // This is the smallest editable entity |
7fd59977 |
15 | |
16 | //-References |
17 | |
18 | //-Language C++ 2.0 |
19 | |
20 | //-Declarations |
21 | |
22 | // for the class |
23 | #include <Graphic3d_Group.jxx> |
24 | #include <Graphic3d_Group.pxx> |
25 | |
26 | #include <Graphic3d_StructureManager.hxx> |
27 | |
81bba717 |
28 | // Structures are necessairy for interfacing with routines c |
29 | // Routines C should be declared externally |
7fd59977 |
30 | //-Methods, in order |
31 | |
32 | Standard_Boolean Graphic3d_Group::IsDeleted () const { |
33 | |
34 | if ( (MyCGroup.IsDeleted) || (MyStructure->IsDeleted ()) ) |
35 | return (Standard_True); |
36 | else |
37 | return (Standard_False); |
38 | |
39 | } |
40 | |
41 | Standard_Boolean Graphic3d_Group::ContainsFacet () const { |
42 | |
43 | return (MyContainsFacet); |
44 | |
45 | } |
46 | |
47 | Standard_Boolean Graphic3d_Group::IsEmpty () const { |
48 | |
49 | if (IsDeleted ()) return (Standard_True); |
50 | |
51 | Standard_ShortReal RL = ShortRealLast (); |
52 | Standard_ShortReal RF = ShortRealFirst (); |
53 | Standard_Boolean Result = ((MyBounds.XMin == RL) && (MyBounds.YMin == RL) && |
54 | (MyBounds.ZMin == RL) && (MyBounds.XMax == RF) && |
55 | (MyBounds.YMax == RF) && (MyBounds.ZMax == RF)); |
56 | |
57 | if (Result != MyIsEmpty) |
58 | cout << "MyIsEmpty != IsEmpty ()\n" << flush; |
59 | |
60 | return (Result); |
61 | |
62 | } |
63 | |
64 | void Graphic3d_Group::SetMinMaxValues (const Standard_Real XMin, const Standard_Real YMin, const Standard_Real ZMin, const Standard_Real XMax, const Standard_Real YMax, const Standard_Real ZMax) { |
65 | |
66 | MyBounds.XMin = Standard_ShortReal (XMin); |
67 | MyBounds.YMin = Standard_ShortReal (YMin); |
68 | MyBounds.ZMin = Standard_ShortReal (ZMin); |
69 | MyBounds.XMax = Standard_ShortReal (XMax); |
70 | MyBounds.YMax = Standard_ShortReal (YMax); |
71 | MyBounds.ZMax = Standard_ShortReal (ZMax); |
72 | |
73 | } |
74 | |
75 | void Graphic3d_Group::MinMaxValues (Standard_Real& XMin, Standard_Real& YMin, Standard_Real& ZMin, Standard_Real& XMax, Standard_Real& YMax, Standard_Real& ZMax) const { |
76 | |
77 | MinMaxCoord (XMin, YMin, ZMin, XMax, YMax, ZMax); |
78 | |
79 | } |
80 | |
81 | Handle(Graphic3d_Structure) Graphic3d_Group::Structure () const { |
82 | |
83 | return MyStructure; |
84 | |
85 | } |
86 | |
87 | void Graphic3d_Group::MinMaxCoord (Standard_Real& XMin, Standard_Real& YMin, Standard_Real& ZMin, Standard_Real& XMax, Standard_Real& YMax, Standard_Real& ZMax) const { |
88 | |
89 | if (IsEmpty ()) { |
81bba717 |
90 | // Empty Group |
7fd59977 |
91 | XMin = YMin = ZMin = ShortRealFirst (); |
92 | XMax = YMax = ZMax = ShortRealLast (); |
93 | } |
94 | else { |
95 | XMin = Standard_Real (MyBounds.XMin); |
96 | YMin = Standard_Real (MyBounds.YMin); |
97 | ZMin = Standard_Real (MyBounds.ZMin); |
98 | XMax = Standard_Real (MyBounds.XMax); |
99 | YMax = Standard_Real (MyBounds.YMax); |
100 | ZMax = Standard_Real (MyBounds.ZMax); |
101 | } |
102 | |
103 | } |
104 | |
105 | void Graphic3d_Group::Labels (Standard_Integer& LB, Standard_Integer& LE) const { |
106 | |
107 | LB = Standard_Integer (MyCGroup.LabelBegin); |
108 | LE = Standard_Integer (MyCGroup.LabelEnd); |
109 | |
110 | } |
111 | |
112 | void Graphic3d_Group::Exploration () const { |
113 | |
114 | if (IsDeleted ()) return; |
115 | |
116 | MyGraphicDriver->DumpGroup (MyCGroup); |
117 | |
118 | } |
119 | |
120 | void Graphic3d_Group::Update () const { |
121 | |
122 | if (IsDeleted ()) return; |
123 | |
124 | if ( (MyStructure->StructureManager ())->UpdateMode () == Aspect_TOU_ASAP ) |
125 | (MyStructure->StructureManager ())->Update (); |
126 | |
127 | } |