0022627: Change OCCT memory management defaults
[occt.git] / src / AIS / AIS_MultipleConnectedInteractive.cxx
CommitLineData
7fd59977 1// File: AIS_MultipleConnectedInteractive.cxx
2// Created: Tue Apr 22 17:15:05 1997
3// Author: Guest Design
4// <g_design>
5
6
7#include <Standard_NotImplemented.hxx>
8
9#include <AIS_MultipleConnectedInteractive.ixx>
10
11#include <PrsMgr_ModedPresentation.hxx>
12#include <PrsMgr_Presentation3d.hxx>
13
14static Standard_Boolean IsInSeq (const AIS_SequenceOfInteractive& theSeq,
15 const Handle(AIS_InteractiveObject)& theItem)
16{
17 Standard_Integer I = theSeq.Length();
18 while ( I>0 && theSeq.Value(I) != theItem) {
19 I--;
20 }
21 return (I>0);
22}
23
24static Standard_Integer RangeInSeq (const AIS_SequenceOfInteractive& theSeq ,
25 const Handle(AIS_InteractiveObject)& theItem)
26{
27 Standard_Integer I = theSeq.Length();
28 while ( I>0 && theSeq.Value(I) != theItem) {
29 I--;
30 }
31 return I;
32}
33
34
35//=======================================================================
36//function : AIS_MultipleConnectedInteractive
37//purpose :
38//=======================================================================
39
40AIS_MultipleConnectedInteractive::AIS_MultipleConnectedInteractive
41(const PrsMgr_TypeOfPresentation3d aTypeOfPresentation3d):
42AIS_InteractiveObject(aTypeOfPresentation3d)
43{
44 SetHilightMode(0);
45}
46
47//=======================================================================
48//function : Type
49//purpose :
50//=======================================================================
51AIS_KindOfInteractive AIS_MultipleConnectedInteractive::Type() const
52{return AIS_KOI_Object;}
53
54//=======================================================================
55//function : Signature
56//purpose :
57//=======================================================================
58Standard_Integer AIS_MultipleConnectedInteractive::Signature() const
59{return 1;}
60
61//=======================================================================
62//function : Connect
63//purpose :
64//=======================================================================
65void AIS_MultipleConnectedInteractive::Connect(const Handle(AIS_InteractiveObject)& anotherIObj)
66{
67
68 if (!IsInSeq (myReferences, anotherIObj)) {
69 myReferences.Append(anotherIObj);
70 }
71}
72
73//=======================================================================
74//function : HasConnection
75//purpose :
76//=======================================================================
77Standard_Boolean AIS_MultipleConnectedInteractive::HasConnection() const
78{
79 return (!myReferences.Length()==0);
80}
81
82//=======================================================================
83//function : Disconnect
84//purpose :
85//=======================================================================
86
87void AIS_MultipleConnectedInteractive::Disconnect(const Handle(AIS_InteractiveObject)& anotherIObj)
88{
89 Standard_Integer I = RangeInSeq (myReferences, anotherIObj);
90 if (I != 0) {
91 myReferences.Remove(I);
92
93 }
94}
95
96//=======================================================================
97//function : DisconnectAll
98//purpose :
99//=======================================================================
100
101void AIS_MultipleConnectedInteractive::DisconnectAll ()
102{
103/* for(Standard_Integer i =1;i<=myPresentations.Length();i++)
104 {
105 Handle(PrsMgr_Presentation3d) P = Handle(PrsMgr_Presentation3d)::DownCast(myPresentations(i).Presentation());
106 if(!P.IsNull()) {
107 P->Presentation()->DisconnectAll(Graphic3d_TOC_DESCENDANT);
108 }
109 }*/
110 myPreviousReferences = myReferences; // pour garder les poignees au chaud!!!!
111 myReferences.Clear();
112}
113
114//=======================================================================
115//function : Compute
116//purpose :
117//=======================================================================
118
119void AIS_MultipleConnectedInteractive::Compute
120(const Handle(PrsMgr_PresentationManager3d)& aPresentationManager,
121 const Handle(Prs3d_Presentation)& aPresentation,
122 const Standard_Integer aMode)
123
124{
125 //cout<<"AIS_MultipleConnectedInteractive::Compute"<<endl;
126
127 aPresentation->Clear(Standard_False);
128 aPresentation->RemoveAll();
129 if(HasConnection()) {
130 for (Standard_Integer I=1 ; I<= myReferences.Length(); I++) {
131 const Handle (AIS_InteractiveObject)& aReference = myReferences.Value (I);
132 aPresentationManager->Connect( this, aReference, aMode, aMode);
133 if(aPresentationManager->Presentation(aReference,aMode)->MustBeUpdated())
134 aPresentationManager->Update(aReference,aMode);
135 }
136 }
137
138 aPresentation->ReCompute();
139
140}
141
142//=======================================================================
143//function : Compute
144//purpose :
145//=======================================================================
146
147void AIS_MultipleConnectedInteractive::Compute(const Handle_Prs3d_Projector& aProjector,
148 const Handle_Prs3d_Presentation& aPresentation)
149{
150// Standard_NotImplemented::Raise("AIS_MultipleConnectedInteractive::Compute(const Handle_Prs3d_Projector&, const Handle_Prs3d_Presentation&)");
151 PrsMgr_PresentableObject::Compute( aProjector , aPresentation ) ;
152}
153
154//=======================================================================
155//function : Compute
156//purpose :
157//=======================================================================
158
159void AIS_MultipleConnectedInteractive::Compute(const Handle_PrsMgr_PresentationManager2d& aPresentationManager2d,
160 const Handle_Graphic2d_GraphicObject& aGraphicObject,
161 const int anInteger)
162{
163// Standard_NotImplemented::Raise("AIS_MultipleConnectedInteractive::Compute(const Handle_PrsMgr_PresentationManager2d&, const Handle_Graphic2d_GraphicObject&, const int)");
164 PrsMgr_PresentableObject::Compute( aPresentationManager2d ,aGraphicObject,anInteger) ;
165}
166
167//=======================================================================
168//function : Compute
169//purpose :
170//=======================================================================
171
172void AIS_MultipleConnectedInteractive::Compute(const Handle_Prs3d_Projector& aProjector,
173 const Handle_Geom_Transformation& aTransformation,
174 const Handle_Prs3d_Presentation& aPresentation)
175{
176// Standard_NotImplemented::Raise("AIS_MultipleConnectedInteractive::Compute(const Handle_Prs3d_Projector&, const Handle_Geom_Transformation&, const Handle_Prs3d_Presentation&)");
177 PrsMgr_PresentableObject::Compute( aProjector , aTransformation , aPresentation ) ;
178}
179
180//=======================================================================
181//function : ComputeSelection
182//purpose :
183//=======================================================================
184void AIS_MultipleConnectedInteractive::ComputeSelection(const Handle(SelectMgr_Selection)& /*aSel*/,
185 const Standard_Integer /*aMode*/)
186{
187}