0027957: Visualization, AIS_InteractiveContext - protect from displaying the same...
[occt.git] / src / AIS / AIS_MultipleConnectedInteractive.hxx
CommitLineData
42cf5bc1 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
5//
6// This file is part of Open CASCADE Technology software library.
7//
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.
13//
14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
16
17#ifndef _AIS_MultipleConnectedInteractive_HeaderFile
18#define _AIS_MultipleConnectedInteractive_HeaderFile
19
42cf5bc1 20#include <AIS_InteractiveObject.hxx>
42cf5bc1 21#include <AIS_KindOfInteractive.hxx>
42cf5bc1 22
23//! Defines an Interactive Object by gathering together
24//! several object presentations. This is done through a
25//! list of interactive objects. These can also be
26//! Connected objects. That way memory-costly
27//! calculations of presentation are avoided.
28class AIS_MultipleConnectedInteractive : public AIS_InteractiveObject
29{
1f7f5a90 30 DEFINE_STANDARD_RTTIEXT(AIS_MultipleConnectedInteractive, AIS_InteractiveObject)
42cf5bc1 31public:
32
42cf5bc1 33 //! Initializes the Interactive Object with multiple
34 //! connections to AIS_Interactive objects.
35 Standard_EXPORT AIS_MultipleConnectedInteractive();
1f7f5a90 36
42cf5bc1 37 //! Establishes the connection between the Connected Interactive Object, theInteractive, and its reference.
38 //! Locates instance in theLocation and applies specified transformation persistence mode.
39 //! @return created instance object (AIS_ConnectedInteractive or AIS_MultipleConnectedInteractive)
1f7f5a90 40 Handle(AIS_InteractiveObject) Connect (const Handle(AIS_InteractiveObject)& theAnotherObj,
41 const Handle(Geom_Transformation)& theLocation,
42 const Handle(Graphic3d_TransformPers)& theTrsfPers)
778cd667 43 {
1f7f5a90 44 return connect (theAnotherObj, theLocation, theTrsfPers);
778cd667 45 }
1f7f5a90 46
42cf5bc1 47 Standard_EXPORT virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE;
48
49 Standard_EXPORT virtual Standard_Integer Signature() const Standard_OVERRIDE;
50
51 //! Returns true if the object is connected to others.
52 Standard_EXPORT Standard_Boolean HasConnection() const;
53
54 //! Removes the connection with theInteractive.
55 Standard_EXPORT void Disconnect (const Handle(AIS_InteractiveObject)& theInteractive);
56
57 //! Clears all the connections to objects.
58 Standard_EXPORT void DisconnectAll();
59
60 //! computes the presentation according to a point of view
61 //! given by <aProjector>.
62 //! To be Used when the associated degenerated Presentations
63 //! have been transformed by <aTrsf> which is not a Pure
64 //! Translation. The HLR Prs can't be deducted automatically
65 //! WARNING :<aTrsf> must be applied
66 //! to the object to display before computation !!!
67 Standard_EXPORT virtual void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Geom_Transformation)& aTrsf, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE;
68
69 Standard_EXPORT virtual void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE;
70
71 //! Informs the graphic context that the interactive Object
72 //! may be decomposed into sub-shapes for dynamic selection.
73 Standard_EXPORT virtual Standard_Boolean AcceptShapeDecomposition() const Standard_OVERRIDE;
74
c3282ec1 75 //! Returns the owner of mode for selection of object as a whole
76 Standard_EXPORT virtual Handle(SelectMgr_EntityOwner) GlobalSelOwner() const Standard_OVERRIDE;
42cf5bc1 77
7411850a 78 //! Returns true if a selection corresponding to the selection mode theMode was computed for all
79 //! children of multiple connected interactive object.
80 Standard_EXPORT virtual Standard_Boolean HasSelection (const Standard_Integer theMode) const Standard_OVERRIDE;
42cf5bc1 81
2ec85268 82 //! Assigns interactive context.
83 Standard_EXPORT virtual void SetContext (const Handle(AIS_InteractiveContext)& theCtx) Standard_OVERRIDE;
84
1f7f5a90 85public: // short aliases to Connect() method
42cf5bc1 86
1f7f5a90 87 //! Establishes the connection between the Connected Interactive Object, theInteractive, and its reference.
88 //! Copies local transformation and transformation persistence mode from theInteractive.
89 //! @return created instance object (AIS_ConnectedInteractive or AIS_MultipleConnectedInteractive)
90 Handle(AIS_InteractiveObject) Connect (const Handle(AIS_InteractiveObject)& theAnotherObj)
91 {
92 return connect (theAnotherObj, theAnotherObj->LocalTransformationGeom(), theAnotherObj->TransformPersistence());
93 }
42cf5bc1 94
1f7f5a90 95 //! Establishes the connection between the Connected Interactive Object, theInteractive, and its reference.
96 //! Locates instance in theLocation and copies transformation persistence mode from theInteractive.
97 //! @return created instance object (AIS_ConnectedInteractive or AIS_MultipleConnectedInteractive)
98 Handle(AIS_InteractiveObject) Connect (const Handle(AIS_InteractiveObject)& theAnotherObj,
99 const gp_Trsf& theLocation)
100 {
101 return connect (theAnotherObj, new Geom_Transformation (theLocation), theAnotherObj->TransformPersistence());
102 }
103
104 //! Establishes the connection between the Connected Interactive Object, theInteractive, and its reference.
105 //! Locates instance in theLocation and applies specified transformation persistence mode.
106 //! @return created instance object (AIS_ConnectedInteractive or AIS_MultipleConnectedInteractive)
107 Handle(AIS_InteractiveObject) Connect (const Handle(AIS_InteractiveObject)& theAnotherObj,
108 const gp_Trsf& theLocation,
109 const Handle(Graphic3d_TransformPers)& theTrsfPers)
110 {
111 return connect (theAnotherObj, new Geom_Transformation (theLocation), theTrsfPers);
112 }
113
114 Standard_DEPRECATED("This method is deprecated - Connect() taking Graphic3d_TransformPers should be called instead")
115 Handle(AIS_InteractiveObject) Connect (const Handle(AIS_InteractiveObject)& theInteractive,
116 const gp_Trsf& theLocation,
117 const Graphic3d_TransModeFlags& theTrsfPersFlag,
118 const gp_Pnt& theTrsfPersPoint)
119 {
120 return connect (theInteractive, new Geom_Transformation (theLocation), Graphic3d_TransformPers::FromDeprecatedParams (theTrsfPersFlag, theTrsfPersPoint));
121 }
122
123protected:
42cf5bc1 124
125 //! this method is redefined virtual;
126 //! when the instance is connected to another
127 //! InteractiveObject,this method doesn't
128 //! compute anything, but just uses the
129 //! presentation of this last object, with
130 //! a transformation if there's one stored.
131 Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, const Handle(Prs3d_Presentation)& aPresentation, const Standard_Integer aMode = 0) Standard_OVERRIDE;
132
1f7f5a90 133 //! Establishes the connection between the Connected Interactive Object, theInteractive, and its reference.
134 //! Locates instance in theLocation and applies specified transformation persistence mode.
135 //! @return created instance object (AIS_ConnectedInteractive or AIS_MultipleConnectedInteractive)
136 Standard_EXPORT virtual Handle(AIS_InteractiveObject) connect (const Handle(AIS_InteractiveObject)& theInteractive,
137 const Handle(Geom_Transformation)& theLocation,
138 const Handle(Graphic3d_TransformPers)& theTrsfPers);
42cf5bc1 139
140private:
42cf5bc1 141
142 //! Computes the selection for whole subtree in scene hierarchy.
143 Standard_EXPORT virtual void ComputeSelection (const Handle(SelectMgr_Selection)& aSelection, const Standard_Integer aMode) Standard_OVERRIDE;
144
42cf5bc1 145};
146
1f7f5a90 147DEFINE_STANDARD_HANDLE(AIS_MultipleConnectedInteractive, AIS_InteractiveObject)
42cf5bc1 148
149#endif // _AIS_MultipleConnectedInteractive_HeaderFile