0026936: Drawbacks of inlining in new type system in OCCT 7.0 -- manual
[occt.git] / src / AIS / AIS_ConnectedInteractive.hxx
CommitLineData
42cf5bc1 1// Created on: 1997-01-08
2// Created by: Robert COUBLANC
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_ConnectedInteractive_HeaderFile
18#define _AIS_ConnectedInteractive_HeaderFile
19
20#include <Standard.hxx>
21#include <Standard_Type.hxx>
22
23#include <TopoDS_Shape.hxx>
24#include <AIS_InteractiveObject.hxx>
25#include <PrsMgr_TypeOfPresentation3d.hxx>
26#include <AIS_KindOfInteractive.hxx>
27#include <Standard_Integer.hxx>
28#include <Standard_Boolean.hxx>
29#include <PrsMgr_PresentationManager3d.hxx>
30#include <SelectMgr_Selection.hxx>
31class AIS_InteractiveObject;
32class Standard_NotImplemented;
33class gp_Trsf;
34class Prs3d_Presentation;
35class Prs3d_Projector;
36class Geom_Transformation;
37class TopoDS_Shape;
38
39
40class AIS_ConnectedInteractive;
41DEFINE_STANDARD_HANDLE(AIS_ConnectedInteractive, AIS_InteractiveObject)
42
43//! Creates an arbitrary located instance of another Interactive Object,
44//! which serves as a reference.
45//! This allows you to use the Connected Interactive
46//! Object without having to recalculate presentation,
47//! selection or graphic structure. These are deduced
48//! from your reference object.
49//! The relation between the connected interactive object
50//! and its source is generally one of geometric transformation.
51//! AIS_ConnectedInteractive class supports selection mode 0 for any InteractiveObject and
52//! all standard modes if its reference based on AIS_Shape.
53//! Descendants may redefine ComputeSelection() though.
54//! Also ConnectedInteractive will handle HLR if its reference based on AIS_Shape.
55class AIS_ConnectedInteractive : public AIS_InteractiveObject
56{
57
58public:
59
60
61
62 //! Disconnects the previous view and sets highlight
63 //! mode to 0. This highlights the wireframe presentation
64 //! aTypeOfPresentation3d.
65 //! Top_AllView deactivates hidden line removal.
66 Standard_EXPORT AIS_ConnectedInteractive(const PrsMgr_TypeOfPresentation3d aTypeOfPresentation3d = PrsMgr_TOP_AllView);
67
68 //! Returns KOI_Object
69 Standard_EXPORT virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE;
70
71 //! Returns 1
72 Standard_EXPORT virtual Standard_Integer Signature() const Standard_OVERRIDE;
73
74 //! Establishes the connection between the Connected
75 //! Interactive Object, anotherIobj, and its reference.
76 Standard_EXPORT virtual void Connect (const Handle(AIS_InteractiveObject)& anotherIObj);
77
78 //! Establishes the connection between the Connected
79 //! Interactive Object, anotherIobj, and its reference.
80 //! Locates instance in aLocation.
81 Standard_EXPORT virtual void Connect (const Handle(AIS_InteractiveObject)& anotherIobj, const gp_Trsf& aLocation);
82
83
84 //! Returns true if there is a connection established
85 //! between the presentation and its source reference.
86 Standard_Boolean HasConnection() const;
87
88
89 //! Returns the connection with the reference Interactive Object.
90 const Handle(AIS_InteractiveObject)& ConnectedTo() const;
91
92 //! Clears the connection with a source reference. The
93 //! presentation will no longer be displayed.
94 //! Warning Must be done before deleting the presentation.
95 Standard_EXPORT void Disconnect();
96
97 //! Informs the graphic context that the interactive Object
98 //! may be decomposed into sub-shapes for dynamic selection.
99 virtual Standard_Boolean AcceptShapeDecomposition() const Standard_OVERRIDE;
100
101
102
103
104 DEFINE_STANDARD_RTTI(AIS_ConnectedInteractive,AIS_InteractiveObject)
105
106protected:
107
108
109 Handle(AIS_InteractiveObject) myReference;
110
111
112private:
113
114
115 //! Calculates the view aPresentation and its updates.
116 //! The latter are managed by aPresentationManager.
117 //! The display mode aMode is 0 by default.
118 //! this method is redefined virtual;
119 //! when the instance is connected to another
120 //! InteractiveObject,this method doesn't
121 //! compute anything, but just uses the
122 //! presentation of this last object, with
123 //! a transformation if there's one stored.
124 Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, const Handle(Prs3d_Presentation)& aPresentation, const Standard_Integer aMode = 0) Standard_OVERRIDE;
125
126 //! Computes the presentation according to a point of view
127 //! given by <aProjector>.
128 //! To be Used when the associated degenerated Presentations
129 //! have been transformed by <aTrsf> which is not a Pure
130 //! Translation. The HLR Prs can't be deducted automatically
131 //! WARNING :<aTrsf> must be applied
132 //! to the object to display before computation !!!
133 Standard_EXPORT virtual void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Geom_Transformation)& aTrsf, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE;
134
135 //! Computes the presentation according to a point of view
136 //! given by <aProjector>.
137 Standard_EXPORT virtual void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE;
138
139 //! Generates sensitive entities by copying
140 //! them from myReference selection, creates and sets an entity
141 //! owner for this entities and adds them to theSelection
142 Standard_EXPORT virtual void ComputeSelection (const Handle(SelectMgr_Selection)& theSelection, const Standard_Integer theMode) Standard_OVERRIDE;
143
144 //! Generates sensitive entities by copying
145 //! them from myReference sub shapes selection, creates and sets an entity
146 //! owner for this entities and adds them to theSelection
147 Standard_EXPORT void computeSubShapeSelection (const Handle(SelectMgr_Selection)& theSelection, const Standard_Integer theMode);
148
149 Standard_EXPORT void updateShape (const Standard_Boolean WithLocation = Standard_True);
150
151 //! Computes the presentation according to a point of view
152 //! given by <aProjector>.
153 Standard_EXPORT void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Prs3d_Presentation)& aPresentation, const TopoDS_Shape& aShape);
154
155 TopoDS_Shape myShape;
156
157
158};
159
160
161#include <AIS_ConnectedInteractive.lxx>
162
163
164
165
166
167#endif // _AIS_ConnectedInteractive_HeaderFile