summaryrefslogtreecommitdiff
path: root/src/Graphic3d/Graphic3d_Group_2.cxx
blob: e1b2f9b172df6589be7f39f31da251408b76cfc6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127

// File   Graphic3d_Group_2.cxx (Inquire)
// Created  Fevrier 1992
// Author NW,JPB,CAL

//-Copyright  MatraDatavision 1991,1992

//-Version  

//-Design Declaration of variables specific to groups
//    of primitives

//-Warning  A group is defined in a structure
// This is the smallest editable entity

//-References 

//-Language C++ 2.0

//-Declarations

// for the class
#include <Graphic3d_Group.jxx>
#include <Graphic3d_Group.pxx>

#include <Graphic3d_StructureManager.hxx>

// Structures are necessairy for interfacing with routines c
// Routines C should be declared externally
//-Methods, in order

Standard_Boolean Graphic3d_Group::IsDeleted () const {

  if ( (MyCGroup.IsDeleted) || (MyStructure->IsDeleted ()) )
    return (Standard_True);
  else
    return (Standard_False);

}

Standard_Boolean Graphic3d_Group::ContainsFacet () const {

  return (MyContainsFacet);

}

Standard_Boolean Graphic3d_Group::IsEmpty () const {

  if (IsDeleted ()) return (Standard_True);

  Standard_ShortReal RL = ShortRealLast ();
  Standard_ShortReal RF = ShortRealFirst ();
  Standard_Boolean Result = ((MyBounds.XMin == RL) && (MyBounds.YMin == RL) &&
    (MyBounds.ZMin == RL) && (MyBounds.XMax == RF) &&
    (MyBounds.YMax == RF) && (MyBounds.ZMax == RF));

  if (Result != MyIsEmpty)
    cout << "MyIsEmpty != IsEmpty ()\n" << flush;

  return (Result);

}

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) {

  MyBounds.XMin = Standard_ShortReal (XMin);
  MyBounds.YMin = Standard_ShortReal (YMin);
  MyBounds.ZMin = Standard_ShortReal (ZMin);
  MyBounds.XMax = Standard_ShortReal (XMax);
  MyBounds.YMax = Standard_ShortReal (YMax);
  MyBounds.ZMax = Standard_ShortReal (ZMax);

}

void Graphic3d_Group::MinMaxValues (Standard_Real& XMin, Standard_Real& YMin, Standard_Real& ZMin, Standard_Real& XMax, Standard_Real& YMax, Standard_Real& ZMax) const {

  MinMaxCoord (XMin, YMin, ZMin, XMax, YMax, ZMax);

}

Handle(Graphic3d_Structure) Graphic3d_Group::Structure () const {

  return MyStructure;

}

void Graphic3d_Group::MinMaxCoord (Standard_Real& XMin, Standard_Real& YMin, Standard_Real& ZMin, Standard_Real& XMax, Standard_Real& YMax, Standard_Real& ZMax) const {

  if (IsEmpty ()) {
    // Empty Group
    XMin  = YMin  = ZMin  = ShortRealFirst ();
    XMax  = YMax  = ZMax  = ShortRealLast ();
  }
  else {
    XMin  = Standard_Real (MyBounds.XMin);
    YMin  = Standard_Real (MyBounds.YMin);
    ZMin  = Standard_Real (MyBounds.ZMin);
    XMax  = Standard_Real (MyBounds.XMax);
    YMax  = Standard_Real (MyBounds.YMax);
    ZMax  = Standard_Real (MyBounds.ZMax);
  }

}

void Graphic3d_Group::Labels (Standard_Integer& LB, Standard_Integer& LE) const {

  LB  = Standard_Integer (MyCGroup.LabelBegin);
  LE  = Standard_Integer (MyCGroup.LabelEnd);

}

void Graphic3d_Group::Exploration () const {

  if (IsDeleted ()) return;

  MyGraphicDriver->DumpGroup (MyCGroup);

}

void Graphic3d_Group::Update () const {

  if (IsDeleted ()) return;

  if ( (MyStructure->StructureManager ())->UpdateMode () == Aspect_TOU_ASAP )
    (MyStructure->StructureManager ())->Update ();

}