Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-10-26 09:45:05

0001 // Created on: 1997-04-22
0002 // Created by: Guest Design
0003 // Copyright (c) 1997-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _AIS_MultipleConnectedInteractive_HeaderFile
0018 #define _AIS_MultipleConnectedInteractive_HeaderFile
0019 
0020 #include <AIS_InteractiveObject.hxx>
0021 #include <AIS_KindOfInteractive.hxx>
0022 
0023 //! Defines an Interactive Object by gathering together
0024 //! several object presentations. This is done through a
0025 //! list of interactive objects. These can also be
0026 //! Connected objects. That way memory-costly
0027 //! calculations of presentation are avoided.
0028 class AIS_MultipleConnectedInteractive : public AIS_InteractiveObject
0029 {
0030   DEFINE_STANDARD_RTTIEXT(AIS_MultipleConnectedInteractive, AIS_InteractiveObject)
0031 public:
0032   //! Initializes the Interactive Object with multiple
0033   //! connections to AIS_Interactive objects.
0034   Standard_EXPORT AIS_MultipleConnectedInteractive();
0035 
0036   //! Establishes the connection between the Connected Interactive Object, theInteractive, and its
0037   //! reference. Locates instance in theLocation and applies specified transformation persistence
0038   //! mode.
0039   //! @return created instance object (AIS_ConnectedInteractive or AIS_MultipleConnectedInteractive)
0040   occ::handle<AIS_InteractiveObject> Connect(
0041     const occ::handle<AIS_InteractiveObject>&   theAnotherObj,
0042     const occ::handle<TopLoc_Datum3D>&          theLocation,
0043     const occ::handle<Graphic3d_TransformPers>& theTrsfPers)
0044   {
0045     return connect(theAnotherObj, theLocation, theTrsfPers);
0046   }
0047 
0048   AIS_KindOfInteractive Type() const override { return AIS_KindOfInteractive_Object; }
0049 
0050   int Signature() const override { return 1; }
0051 
0052   //! Returns true if the object is connected to others.
0053   Standard_EXPORT bool HasConnection() const;
0054 
0055   //! Removes the connection with theInteractive.
0056   Standard_EXPORT void Disconnect(const occ::handle<AIS_InteractiveObject>& theInteractive);
0057 
0058   //! Clears all the connections to objects.
0059   Standard_EXPORT void DisconnectAll();
0060 
0061   //! Informs the graphic context that the interactive Object
0062   //! may be decomposed into sub-shapes for dynamic selection.
0063   Standard_EXPORT bool AcceptShapeDecomposition() const override;
0064 
0065   //! Returns common entity owner if the object is an assembly
0066   const occ::handle<SelectMgr_EntityOwner>& GetAssemblyOwner() const override
0067   {
0068     return myAssemblyOwner;
0069   }
0070 
0071   //! Returns the owner of mode for selection of object as a whole
0072   occ::handle<SelectMgr_EntityOwner> GlobalSelOwner() const override { return myAssemblyOwner; }
0073 
0074   //! Assigns interactive context.
0075   Standard_EXPORT void SetContext(const occ::handle<AIS_InteractiveContext>& theCtx) override;
0076 
0077 public: // short aliases to Connect() method
0078   //! Establishes the connection between the Connected Interactive Object, theInteractive, and its
0079   //! reference. Copies local transformation and transformation persistence mode from
0080   //! theInteractive.
0081   //! @return created instance object (AIS_ConnectedInteractive or AIS_MultipleConnectedInteractive)
0082   occ::handle<AIS_InteractiveObject> Connect(
0083     const occ::handle<AIS_InteractiveObject>& theAnotherObj)
0084   {
0085     return connect(theAnotherObj,
0086                    theAnotherObj->LocalTransformationGeom(),
0087                    theAnotherObj->TransformPersistence());
0088   }
0089 
0090   //! Establishes the connection between the Connected Interactive Object, theInteractive, and its
0091   //! reference. Locates instance in theLocation and copies transformation persistence mode from
0092   //! theInteractive.
0093   //! @return created instance object (AIS_ConnectedInteractive or AIS_MultipleConnectedInteractive)
0094   occ::handle<AIS_InteractiveObject> Connect(
0095     const occ::handle<AIS_InteractiveObject>& theAnotherObj,
0096     const gp_Trsf&                            theLocation)
0097   {
0098     return connect(theAnotherObj,
0099                    new TopLoc_Datum3D(theLocation),
0100                    theAnotherObj->TransformPersistence());
0101   }
0102 
0103   //! Establishes the connection between the Connected Interactive Object, theInteractive, and its
0104   //! reference. Locates instance in theLocation and applies specified transformation persistence
0105   //! mode.
0106   //! @return created instance object (AIS_ConnectedInteractive or AIS_MultipleConnectedInteractive)
0107   occ::handle<AIS_InteractiveObject> Connect(
0108     const occ::handle<AIS_InteractiveObject>&   theAnotherObj,
0109     const gp_Trsf&                              theLocation,
0110     const occ::handle<Graphic3d_TransformPers>& theTrsfPers)
0111   {
0112     return connect(theAnotherObj, new TopLoc_Datum3D(theLocation), theTrsfPers);
0113   }
0114 
0115 protected:
0116   //! this method is redefined virtual;
0117   //! when the instance is connected to another
0118   //! InteractiveObject,this method doesn't
0119   //! compute anything, but just uses the
0120   //! presentation of this last object, with
0121   //! a transformation if there's one stored.
0122   Standard_EXPORT void Compute(const occ::handle<PrsMgr_PresentationManager>& thePrsMgr,
0123                                const occ::handle<Prs3d_Presentation>&         thePrs,
0124                                const int                                      theMode) override;
0125 
0126   //! Establishes the connection between the Connected Interactive Object, theInteractive, and its
0127   //! reference. Locates instance in theLocation and applies specified transformation persistence
0128   //! mode.
0129   //! @return created instance object (AIS_ConnectedInteractive or AIS_MultipleConnectedInteractive)
0130   Standard_EXPORT virtual occ::handle<AIS_InteractiveObject> connect(
0131     const occ::handle<AIS_InteractiveObject>&   theInteractive,
0132     const occ::handle<TopLoc_Datum3D>&          theLocation,
0133     const occ::handle<Graphic3d_TransformPers>& theTrsfPers);
0134 
0135 private:
0136   //! Computes the selection for whole subtree in scene hierarchy.
0137   Standard_EXPORT void ComputeSelection(const occ::handle<SelectMgr_Selection>& aSelection,
0138                                         const int                               aMode) override;
0139 
0140 protected:
0141   occ::handle<SelectMgr_EntityOwner> myAssemblyOwner;
0142 };
0143 
0144 #endif // _AIS_MultipleConnectedInteractive_HeaderFile