0023634: Eliminate Polyline and Polygon usage in drawers
[occt.git] / src / Graphic3d / Graphic3d_Group_2.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
7fd59977 22
23//-Version
24
81bba717 25//-Design Declaration of variables specific to groups
26// of primitives
7fd59977 27
81bba717 28//-Warning A group is defined in a structure
29// This is the smallest editable entity
7fd59977 30
31//-References
32
33//-Language C++ 2.0
34
35//-Declarations
36
37// for the class
38#include <Graphic3d_Group.jxx>
39#include <Graphic3d_Group.pxx>
40
41#include <Graphic3d_StructureManager.hxx>
42
81bba717 43// Structures are necessairy for interfacing with routines c
44// Routines C should be declared externally
7fd59977 45//-Methods, in order
46
47Standard_Boolean Graphic3d_Group::IsDeleted () const {
48
b8ddfc2f 49 return ( (MyCGroup.ptrGroup == NULL) || (MyStructure->IsDeleted ()) );
7fd59977 50
51}
52
53Standard_Boolean Graphic3d_Group::ContainsFacet () const {
54
55 return (MyContainsFacet);
56
57}
58
59Standard_Boolean Graphic3d_Group::IsEmpty () const {
60
61 if (IsDeleted ()) return (Standard_True);
62
63 Standard_ShortReal RL = ShortRealLast ();
64 Standard_ShortReal RF = ShortRealFirst ();
65 Standard_Boolean Result = ((MyBounds.XMin == RL) && (MyBounds.YMin == RL) &&
66 (MyBounds.ZMin == RL) && (MyBounds.XMax == RF) &&
67 (MyBounds.YMax == RF) && (MyBounds.ZMax == RF));
68
69 if (Result != MyIsEmpty)
70 cout << "MyIsEmpty != IsEmpty ()\n" << flush;
71
72 return (Result);
73
74}
75
76void 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) {
77
78 MyBounds.XMin = Standard_ShortReal (XMin);
79 MyBounds.YMin = Standard_ShortReal (YMin);
80 MyBounds.ZMin = Standard_ShortReal (ZMin);
81 MyBounds.XMax = Standard_ShortReal (XMax);
82 MyBounds.YMax = Standard_ShortReal (YMax);
83 MyBounds.ZMax = Standard_ShortReal (ZMax);
84
85}
86
87void Graphic3d_Group::MinMaxValues (Standard_Real& XMin, Standard_Real& YMin, Standard_Real& ZMin, Standard_Real& XMax, Standard_Real& YMax, Standard_Real& ZMax) const {
88
89 MinMaxCoord (XMin, YMin, ZMin, XMax, YMax, ZMax);
90
91}
92
93Handle(Graphic3d_Structure) Graphic3d_Group::Structure () const {
94
95 return MyStructure;
96
97}
98
99void Graphic3d_Group::MinMaxCoord (Standard_Real& XMin, Standard_Real& YMin, Standard_Real& ZMin, Standard_Real& XMax, Standard_Real& YMax, Standard_Real& ZMax) const {
100
101 if (IsEmpty ()) {
81bba717 102 // Empty Group
7fd59977 103 XMin = YMin = ZMin = ShortRealFirst ();
104 XMax = YMax = ZMax = ShortRealLast ();
105 }
106 else {
107 XMin = Standard_Real (MyBounds.XMin);
108 YMin = Standard_Real (MyBounds.YMin);
109 ZMin = Standard_Real (MyBounds.ZMin);
110 XMax = Standard_Real (MyBounds.XMax);
111 YMax = Standard_Real (MyBounds.YMax);
112 ZMax = Standard_Real (MyBounds.ZMax);
113 }
114
115}
116
7fd59977 117void Graphic3d_Group::Update () const {
118
119 if (IsDeleted ()) return;
120
121 if ( (MyStructure->StructureManager ())->UpdateMode () == Aspect_TOU_ASAP )
122 (MyStructure->StructureManager ())->Update ();
123
124}