0024704: Visualization - inherit OpenGl_Structure from Graphic3d_CStructure
[occt.git] / src / Graphic3d / Graphic3d_Group_2.cxx
CommitLineData
b311480e 1// Created by: NW,JPB,CAL
2// Copyright (c) 1991-1999 Matra Datavision
973c2be1 3// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 4//
973c2be1 5// This file is part of Open CASCADE Technology software library.
b311480e 6//
d5f74e42 7// This library is free software; you can redistribute it and/or modify it under
8// the terms of the GNU Lesser General Public License version 2.1 as published
973c2be1 9// by the Free Software Foundation, with special exception defined in the file
10// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11// distribution for complete text of the license and disclaimer of any warranty.
b311480e 12//
973c2be1 13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
7fd59977 15
16//-Version
17
81bba717 18//-Design Declaration of variables specific to groups
19// of primitives
7fd59977 20
81bba717 21//-Warning A group is defined in a structure
22// This is the smallest editable entity
7fd59977 23
24//-References
25
26//-Language C++ 2.0
27
28//-Declarations
29
30// for the class
31#include <Graphic3d_Group.jxx>
32#include <Graphic3d_Group.pxx>
33
34#include <Graphic3d_StructureManager.hxx>
35
81bba717 36// Structures are necessairy for interfacing with routines c
37// Routines C should be declared externally
7fd59977 38//-Methods, in order
39
40Standard_Boolean Graphic3d_Group::IsDeleted () const {
41
b8ddfc2f 42 return ( (MyCGroup.ptrGroup == NULL) || (MyStructure->IsDeleted ()) );
7fd59977 43
44}
45
46Standard_Boolean Graphic3d_Group::ContainsFacet () const {
47
48 return (MyContainsFacet);
49
50}
51
52Standard_Boolean Graphic3d_Group::IsEmpty () const {
53
54 if (IsDeleted ()) return (Standard_True);
55
56 Standard_ShortReal RL = ShortRealLast ();
57 Standard_ShortReal RF = ShortRealFirst ();
58 Standard_Boolean Result = ((MyBounds.XMin == RL) && (MyBounds.YMin == RL) &&
59 (MyBounds.ZMin == RL) && (MyBounds.XMax == RF) &&
60 (MyBounds.YMax == RF) && (MyBounds.ZMax == RF));
61
62 if (Result != MyIsEmpty)
63 cout << "MyIsEmpty != IsEmpty ()\n" << flush;
64
65 return (Result);
66
67}
68
69void 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) {
70
71 MyBounds.XMin = Standard_ShortReal (XMin);
72 MyBounds.YMin = Standard_ShortReal (YMin);
73 MyBounds.ZMin = Standard_ShortReal (ZMin);
74 MyBounds.XMax = Standard_ShortReal (XMax);
75 MyBounds.YMax = Standard_ShortReal (YMax);
76 MyBounds.ZMax = Standard_ShortReal (ZMax);
77
78}
79
80void Graphic3d_Group::MinMaxValues (Standard_Real& XMin, Standard_Real& YMin, Standard_Real& ZMin, Standard_Real& XMax, Standard_Real& YMax, Standard_Real& ZMax) const {
81
82 MinMaxCoord (XMin, YMin, ZMin, XMax, YMax, ZMax);
83
84}
85
86Handle(Graphic3d_Structure) Graphic3d_Group::Structure () const {
87
88 return MyStructure;
89
90}
91
92void Graphic3d_Group::MinMaxCoord (Standard_Real& XMin, Standard_Real& YMin, Standard_Real& ZMin, Standard_Real& XMax, Standard_Real& YMax, Standard_Real& ZMax) const {
93
94 if (IsEmpty ()) {
81bba717 95 // Empty Group
7fd59977 96 XMin = YMin = ZMin = ShortRealFirst ();
97 XMax = YMax = ZMax = ShortRealLast ();
98 }
99 else {
100 XMin = Standard_Real (MyBounds.XMin);
101 YMin = Standard_Real (MyBounds.YMin);
102 ZMin = Standard_Real (MyBounds.ZMin);
103 XMax = Standard_Real (MyBounds.XMax);
104 YMax = Standard_Real (MyBounds.YMax);
105 ZMax = Standard_Real (MyBounds.ZMax);
106 }
107
108}
109
7fd59977 110void Graphic3d_Group::Update () const {
111
112 if (IsDeleted ()) return;
113
114 if ( (MyStructure->StructureManager ())->UpdateMode () == Aspect_TOU_ASAP )
115 (MyStructure->StructureManager ())->Update ();
116
117}