Test for 0022778: Bug in BRepMesh
[occt.git] / src / Graphic3d / Graphic3d_Group.cxx
1 // Created by: NW,JPB,CAL
2 // Copyright (c) 1991-1999 Matra Datavision
3 // Copyright (c) 1999-2012 OPEN CASCADE SAS
4 //
5 // The content of this file is subject to the Open CASCADE Technology Public
6 // License Version 6.5 (the "License"). You may not use the content of this file
7 // except in compliance with the License. Please obtain a copy of the License
8 // at http://www.opencascade.org and read it completely before using this file.
9 //
10 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
11 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
12 //
13 // The Original Code and all software distributed under the License is
14 // distributed on an "AS IS" basis, without warranty of any kind, and the
15 // Initial Developer hereby disclaims all such warranties, including without
16 // limitation, any warranties of merchantability, fitness for a particular
17 // purpose or non-infringement. Please see the License for the specific terms
18 // and conditions governing the rights and limitations under the License.
19
20
21 //              11/97 ; CAL : retrait DownCast
22
23
24 //-Version
25
26 //-Design       Declaration of variables specific to groups
27 //              of primitives
28
29 //-Warning      A group is definedv in a structure
30 //              This is the smallest editable entity
31
32 //-References
33
34 //-Language     C++ 2.0
35
36 //-Declarations
37
38 // for the class
39 #include <Graphic3d_Group.ixx>
40 #include <Graphic3d_Group.pxx>
41
42 #include <Graphic3d_GraphicDevice.hxx>
43 #include <Graphic3d_GraphicDriver.hxx>
44 #include <Graphic3d_StructureManager.hxx>
45 #include <Graphic3d_TransModeFlags.hxx>
46
47 //-Aliases
48
49 //-Global data definitions
50
51 //-Constructors
52
53 //-Destructors
54
55 //-Methods, in order
56
57 Graphic3d_Group::Graphic3d_Group (const Handle(Graphic3d_Structure)& AStructure):
58 MyListOfPArray()
59 {
60   MyBounds.XMin = ShortRealLast (),
61   MyBounds.YMin = ShortRealLast (),
62   MyBounds.ZMin = ShortRealLast ();
63
64   MyBounds.XMax = ShortRealFirst (),
65   MyBounds.YMax = ShortRealFirst (),
66   MyBounds.ZMax = ShortRealFirst ();
67
68 //
69 // A small commentary on the usage of This !
70 //
71 // Graphic3d_Group is created in a structure. Graphic3d_Structure is a
72 // manager of Graphic3d_Group. In the constructor of Graphic3d_Group
73 // a method Add of Graphic3d_Structure is called. It allows adding
74 // the instance of Graphic3d_Group in its manager. So there are 2 references
75 // to <me> and everything works well.
76 //
77 // This () is the instance of the class, the current groupe
78 //Handle(Graphic3d_Group) me    = Handle(Graphic3d_Group)::DownCast (This ());
79
80 Standard_Integer TheLabelBegin, TheLabelEnd;
81
82         // MyStructure  = AStructure;
83         MyPtrStructure  = (void *) AStructure.operator->();
84         MyStructure->GroupLabels (TheLabelBegin, TheLabelEnd);
85         MyStructure->Add (this);
86
87         MyContainsFacet                 = Standard_False,
88         MyIsEmpty                       = Standard_True;
89
90         MyCGroup.Struct     = MyStructure->CStructure();
91         MyCGroup.Struct->Id     = int (MyStructure->Identification ());
92         MyCGroup.IsDeleted      = 0;
93         MyCGroup.IsOpen         = 0;
94         MyCGroup.LabelBegin     = int (TheLabelBegin);
95         MyCGroup.LabelEnd       = int (TheLabelEnd);
96
97         MyCGroup.StructureEnd   = Structure_END;
98
99         MyCGroup.ContextLine.IsDef      = 0,
100         MyCGroup.ContextText.IsDef      = 0,
101         MyCGroup.ContextMarker.IsDef    = 0,
102         MyCGroup.ContextFillArea.IsDef  = 0;
103
104         MyCGroup.ContextLine.IsSet      = 0,
105         MyCGroup.ContextText.IsSet      = 0,
106         MyCGroup.ContextMarker.IsSet    = 0,
107         MyCGroup.ContextFillArea.IsSet  = 0;
108
109         MyCGroup.PickId.IsDef   = 0,
110         MyCGroup.PickId.IsSet   = 0,
111         MyCGroup.PickId.Value   = 0;
112
113 Handle(Aspect_GraphicDriver) agd =
114 ((MyStructure->StructureManager ())->GraphicDevice ())->GraphicDriver ();
115
116         MyGraphicDriver = *(Handle(Graphic3d_GraphicDriver) *) &agd;
117
118         MyGraphicDriver->Group (MyCGroup);
119
120         //MyCGroup.TransformPersistenceFlag = Graphic3d_TMF_None;
121         //MyCGroup.Struct->TransformPersistenceFlag = Graphic3d_TMF_None;
122         MyMarkWidth = 0;
123         MyMarkHeight = 0;
124         MyMarkArray.Nullify();
125 }