1 // Created on: 1997-04-22
2 // Created by: Guest Design
3 // Copyright (c) 1997-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
20 #include <Standard_NotImplemented.hxx>
22 #include <AIS_MultipleConnectedInteractive.ixx>
24 #include <PrsMgr_ModedPresentation.hxx>
25 #include <PrsMgr_Presentation.hxx>
27 static Standard_Boolean IsInSeq (const AIS_SequenceOfInteractive& theSeq,
28 const Handle(AIS_InteractiveObject)& theItem)
30 Standard_Integer I = theSeq.Length();
31 while ( I>0 && theSeq.Value(I) != theItem) {
37 static Standard_Integer RangeInSeq (const AIS_SequenceOfInteractive& theSeq ,
38 const Handle(AIS_InteractiveObject)& theItem)
40 Standard_Integer I = theSeq.Length();
41 while ( I>0 && theSeq.Value(I) != theItem) {
48 //=======================================================================
49 //function : AIS_MultipleConnectedInteractive
51 //=======================================================================
53 AIS_MultipleConnectedInteractive::AIS_MultipleConnectedInteractive
54 (const PrsMgr_TypeOfPresentation3d aTypeOfPresentation3d):
55 AIS_InteractiveObject(aTypeOfPresentation3d)
60 //=======================================================================
63 //=======================================================================
64 AIS_KindOfInteractive AIS_MultipleConnectedInteractive::Type() const
65 {return AIS_KOI_Object;}
67 //=======================================================================
68 //function : Signature
70 //=======================================================================
71 Standard_Integer AIS_MultipleConnectedInteractive::Signature() const
74 //=======================================================================
77 //=======================================================================
78 void AIS_MultipleConnectedInteractive::Connect(const Handle(AIS_InteractiveObject)& anotherIObj)
81 if (!IsInSeq (myReferences, anotherIObj)) {
82 myReferences.Append(anotherIObj);
86 //=======================================================================
87 //function : HasConnection
89 //=======================================================================
90 Standard_Boolean AIS_MultipleConnectedInteractive::HasConnection() const
92 return (myReferences.Length() != 0);
95 //=======================================================================
96 //function : Disconnect
98 //=======================================================================
100 void AIS_MultipleConnectedInteractive::Disconnect(const Handle(AIS_InteractiveObject)& anotherIObj)
102 Standard_Integer I = RangeInSeq (myReferences, anotherIObj);
104 myReferences.Remove(I);
109 //=======================================================================
110 //function : DisconnectAll
112 //=======================================================================
114 void AIS_MultipleConnectedInteractive::DisconnectAll ()
116 /* for (Standard_Integer aPrsIter = 1; aPrsIter <= myPresentations.Length(); ++aPrsIter)
118 const Handle(PrsMgr_Presentation)& aPrs = myPresentations (aPrsIter).Presentation();
121 aPrs->Presentation()->DisconnectAll (Graphic3d_TOC_DESCENDANT);
124 myPreviousReferences = myReferences; // pour garder les poignees au chaud!!!!
125 myReferences.Clear();
128 //=======================================================================
131 //=======================================================================
132 void AIS_MultipleConnectedInteractive::Compute (const Handle(PrsMgr_PresentationManager3d)& thePrsMgr,
133 const Handle(Prs3d_Presentation)& thePrs,
134 const Standard_Integer theMode)
136 thePrs->Clear (Standard_False);
140 for (Standard_Integer aRefIter = 1; aRefIter <= myReferences.Length(); ++aRefIter)
142 const Handle (AIS_InteractiveObject)& aRef = myReferences.Value (aRefIter);
143 if (!aRef->HasInteractiveContext())
145 aRef->SetContext (GetContext());
148 thePrsMgr->Connect (this, aRef, theMode, theMode);
149 if (thePrsMgr->Presentation (aRef, theMode)->MustBeUpdated())
151 thePrsMgr->Update (aRef, theMode);
159 //=======================================================================
162 //=======================================================================
164 void AIS_MultipleConnectedInteractive::Compute(const Handle(Prs3d_Projector)& aProjector,
165 const Handle(Prs3d_Presentation)& aPresentation)
167 // Standard_NotImplemented::Raise("AIS_MultipleConnectedInteractive::Compute(const Handle(Prs3d_Projector)&, const Handle(Prs3d_Presentation)&)");
168 PrsMgr_PresentableObject::Compute( aProjector , aPresentation ) ;
171 //=======================================================================
174 //=======================================================================
176 void AIS_MultipleConnectedInteractive::Compute(const Handle(Prs3d_Projector)& aProjector,
177 const Handle(Geom_Transformation)& aTransformation,
178 const Handle(Prs3d_Presentation)& aPresentation)
180 // Standard_NotImplemented::Raise("AIS_MultipleConnectedInteractive::Compute(const Handle(Prs3d_Projector)&, const Handle(Geom_Transformation)&, const Handle(Prs3d_Presentation)&)");
181 PrsMgr_PresentableObject::Compute( aProjector , aTransformation , aPresentation ) ;
184 //=======================================================================
185 //function : ComputeSelection
187 //=======================================================================
188 void AIS_MultipleConnectedInteractive::ComputeSelection(const Handle(SelectMgr_Selection)& /*aSel*/,
189 const Standard_Integer /*aMode*/)