0023634: Eliminate Polyline and Polygon usage in drawers
[occt.git] / src / Graphic3d / Graphic3d_Group.cxx
CommitLineData
b311480e 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
7fd59977 20
7fd59977 21// 11/97 ; CAL : retrait DownCast
22
7fd59977 23
bf75be98 24//-Version
7fd59977 25
81bba717 26//-Design Declaration of variables specific to groups
27// of primitives
7fd59977 28
81bba717 29//-Warning A group is definedv in a structure
30// This is the smallest editable entity
7fd59977 31
bf75be98 32//-References
7fd59977 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
57Graphic3d_Group::Graphic3d_Group (const Handle(Graphic3d_Structure)& AStructure):
58MyListOfPArray()
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//
81bba717 69// A small commentary on the usage of This !
7fd59977 70//
81bba717 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.
7fd59977 76//
81bba717 77// This () is the instance of the class, the current groupe
7fd59977 78//Handle(Graphic3d_Group) me = Handle(Graphic3d_Group)::DownCast (This ());
79
b8ddfc2f 80 MyPtrStructure = (void *) AStructure.operator->();
81 MyStructure->Add (this);
7fd59977 82
b8ddfc2f 83 MyContainsFacet = Standard_False,
84 MyIsEmpty = Standard_True;
7fd59977 85
b8ddfc2f 86 MyCGroup.Struct = MyStructure->CStructure();
87 MyCGroup.Struct->Id = int (MyStructure->Identification ());
88 MyCGroup.ptrGroup = NULL;
7fd59977 89
b8ddfc2f 90 MyCGroup.ContextLine.IsDef = 0,
91 MyCGroup.ContextText.IsDef = 0,
92 MyCGroup.ContextMarker.IsDef = 0,
93 MyCGroup.ContextFillArea.IsDef = 0;
7fd59977 94
b8ddfc2f 95 MyCGroup.ContextLine.IsSet = 0,
96 MyCGroup.ContextText.IsSet = 0,
97 MyCGroup.ContextMarker.IsSet = 0,
98 MyCGroup.ContextFillArea.IsSet = 0;
7fd59977 99
b8ddfc2f 100 MyCGroup.PickId.IsDef = 0,
101 MyCGroup.PickId.IsSet = 0,
102 MyCGroup.PickId.Value = 0;
7fd59977 103
b8ddfc2f 104 Handle(Aspect_GraphicDriver) agd =
105 ((MyStructure->StructureManager ())->GraphicDevice ())->GraphicDriver ();
7fd59977 106
b8ddfc2f 107 MyGraphicDriver = *(Handle(Graphic3d_GraphicDriver) *) &agd;
7fd59977 108
b8ddfc2f 109 MyGraphicDriver->Group (MyCGroup);
7fd59977 110
b8ddfc2f 111 MyMarkWidth = 0;
112 MyMarkHeight = 0;
113 MyMarkArray.Nullify();
7fd59977 114}