1 // Created on: 1997-04-22
2 // Created by: Guest Design
3 // Copyright (c) 1997-1999 Matra Datavision
4 // Copyright (c) 1999-2012 OPEN CASCADE SAS
6 // The content of this file is subject to the Open CASCADE Technology Public
7 // License Version 6.5 (the "License"). You may not use the content of this file
8 // except in compliance with the License. Please obtain a copy of the License
9 // at http://www.opencascade.org and read it completely before using this file.
11 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
14 // The Original Code and all software distributed under the License is
15 // distributed on an "AS IS" basis, without warranty of any kind, and the
16 // Initial Developer hereby disclaims all such warranties, including without
17 // limitation, any warranties of merchantability, fitness for a particular
18 // purpose or non-infringement. Please see the License for the specific terms
19 // and conditions governing the rights and limitations under the License.
24 #include <Standard_NotImplemented.hxx>
26 #include <AIS_MultipleConnectedInteractive.ixx>
28 #include <PrsMgr_ModedPresentation.hxx>
29 #include <PrsMgr_Presentation3d.hxx>
31 static Standard_Boolean IsInSeq (const AIS_SequenceOfInteractive& theSeq,
32 const Handle(AIS_InteractiveObject)& theItem)
34 Standard_Integer I = theSeq.Length();
35 while ( I>0 && theSeq.Value(I) != theItem) {
41 static Standard_Integer RangeInSeq (const AIS_SequenceOfInteractive& theSeq ,
42 const Handle(AIS_InteractiveObject)& theItem)
44 Standard_Integer I = theSeq.Length();
45 while ( I>0 && theSeq.Value(I) != theItem) {
52 //=======================================================================
53 //function : AIS_MultipleConnectedInteractive
55 //=======================================================================
57 AIS_MultipleConnectedInteractive::AIS_MultipleConnectedInteractive
58 (const PrsMgr_TypeOfPresentation3d aTypeOfPresentation3d):
59 AIS_InteractiveObject(aTypeOfPresentation3d)
64 //=======================================================================
67 //=======================================================================
68 AIS_KindOfInteractive AIS_MultipleConnectedInteractive::Type() const
69 {return AIS_KOI_Object;}
71 //=======================================================================
72 //function : Signature
74 //=======================================================================
75 Standard_Integer AIS_MultipleConnectedInteractive::Signature() const
78 //=======================================================================
81 //=======================================================================
82 void AIS_MultipleConnectedInteractive::Connect(const Handle(AIS_InteractiveObject)& anotherIObj)
85 if (!IsInSeq (myReferences, anotherIObj)) {
86 myReferences.Append(anotherIObj);
90 //=======================================================================
91 //function : HasConnection
93 //=======================================================================
94 Standard_Boolean AIS_MultipleConnectedInteractive::HasConnection() const
96 return (!myReferences.Length()==0);
99 //=======================================================================
100 //function : Disconnect
102 //=======================================================================
104 void AIS_MultipleConnectedInteractive::Disconnect(const Handle(AIS_InteractiveObject)& anotherIObj)
106 Standard_Integer I = RangeInSeq (myReferences, anotherIObj);
108 myReferences.Remove(I);
113 //=======================================================================
114 //function : DisconnectAll
116 //=======================================================================
118 void AIS_MultipleConnectedInteractive::DisconnectAll ()
120 /* for(Standard_Integer i =1;i<=myPresentations.Length();i++)
122 Handle(PrsMgr_Presentation3d) P = Handle(PrsMgr_Presentation3d)::DownCast(myPresentations(i).Presentation());
124 P->Presentation()->DisconnectAll(Graphic3d_TOC_DESCENDANT);
127 myPreviousReferences = myReferences; // pour garder les poignees au chaud!!!!
128 myReferences.Clear();
131 //=======================================================================
134 //=======================================================================
135 void AIS_MultipleConnectedInteractive::Compute (const Handle(PrsMgr_PresentationManager3d)& thePrsMgr,
136 const Handle(Prs3d_Presentation)& thePrs,
137 const Standard_Integer theMode)
139 thePrs->Clear (Standard_False);
143 for (Standard_Integer aRefIter = 1; aRefIter <= myReferences.Length(); ++aRefIter)
145 const Handle (AIS_InteractiveObject)& aRef = myReferences.Value (aRefIter);
146 if (!aRef->HasInteractiveContext())
148 aRef->SetContext (GetContext());
151 thePrsMgr->Connect (this, aRef, theMode, theMode);
152 if (thePrsMgr->Presentation (aRef, theMode)->MustBeUpdated())
154 thePrsMgr->Update (aRef, theMode);
162 //=======================================================================
165 //=======================================================================
167 void AIS_MultipleConnectedInteractive::Compute(const Handle_Prs3d_Projector& aProjector,
168 const Handle_Prs3d_Presentation& aPresentation)
170 // Standard_NotImplemented::Raise("AIS_MultipleConnectedInteractive::Compute(const Handle_Prs3d_Projector&, const Handle_Prs3d_Presentation&)");
171 PrsMgr_PresentableObject::Compute( aProjector , aPresentation ) ;
174 //=======================================================================
177 //=======================================================================
179 void AIS_MultipleConnectedInteractive::Compute(const Handle_PrsMgr_PresentationManager2d& aPresentationManager2d,
180 const Handle_Graphic2d_GraphicObject& aGraphicObject,
183 // Standard_NotImplemented::Raise("AIS_MultipleConnectedInteractive::Compute(const Handle_PrsMgr_PresentationManager2d&, const Handle_Graphic2d_GraphicObject&, const int)");
184 PrsMgr_PresentableObject::Compute( aPresentationManager2d ,aGraphicObject,anInteger) ;
187 //=======================================================================
190 //=======================================================================
192 void AIS_MultipleConnectedInteractive::Compute(const Handle_Prs3d_Projector& aProjector,
193 const Handle_Geom_Transformation& aTransformation,
194 const Handle_Prs3d_Presentation& aPresentation)
196 // Standard_NotImplemented::Raise("AIS_MultipleConnectedInteractive::Compute(const Handle_Prs3d_Projector&, const Handle_Geom_Transformation&, const Handle_Prs3d_Presentation&)");
197 PrsMgr_PresentableObject::Compute( aProjector , aTransformation , aPresentation ) ;
200 //=======================================================================
201 //function : ComputeSelection
203 //=======================================================================
204 void AIS_MultipleConnectedInteractive::ComputeSelection(const Handle(SelectMgr_Selection)& /*aSel*/,
205 const Standard_Integer /*aMode*/)