Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-07-28 09:17:35

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   Handle(AIS_InteractiveObject) Connect(const Handle(AIS_InteractiveObject)&   theAnotherObj,
0041                                         const Handle(TopLoc_Datum3D)&          theLocation,
0042                                         const Handle(Graphic3d_TransformPers)& theTrsfPers)
0043   {
0044     return connect(theAnotherObj, theLocation, theTrsfPers);
0045   }
0046 
0047   virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE
0048   {
0049     return AIS_KindOfInteractive_Object;
0050   }
0051 
0052   virtual Standard_Integer Signature() const Standard_OVERRIDE { return 1; }
0053 
0054   //! Returns true if the object is connected to others.
0055   Standard_EXPORT Standard_Boolean HasConnection() const;
0056 
0057   //! Removes the connection with theInteractive.
0058   Standard_EXPORT void Disconnect(const Handle(AIS_InteractiveObject)& theInteractive);
0059 
0060   //! Clears all the connections to objects.
0061   Standard_EXPORT void DisconnectAll();
0062 
0063   //! Informs the graphic context that the interactive Object
0064   //! may be decomposed into sub-shapes for dynamic selection.
0065   Standard_EXPORT virtual Standard_Boolean AcceptShapeDecomposition() const Standard_OVERRIDE;
0066 
0067   //! Returns common entity owner if the object is an assembly
0068   virtual const Handle(SelectMgr_EntityOwner)& GetAssemblyOwner() const Standard_OVERRIDE
0069   {
0070     return myAssemblyOwner;
0071   }
0072 
0073   //! Returns the owner of mode for selection of object as a whole
0074   virtual Handle(SelectMgr_EntityOwner) GlobalSelOwner() const Standard_OVERRIDE
0075   {
0076     return myAssemblyOwner;
0077   }
0078 
0079   //! Assigns interactive context.
0080   Standard_EXPORT virtual void SetContext(const Handle(AIS_InteractiveContext)& theCtx)
0081     Standard_OVERRIDE;
0082 
0083 public: // short aliases to Connect() method
0084   //! Establishes the connection between the Connected Interactive Object, theInteractive, and its
0085   //! reference. Copies local transformation and transformation persistence mode from
0086   //! theInteractive.
0087   //! @return created instance object (AIS_ConnectedInteractive or AIS_MultipleConnectedInteractive)
0088   Handle(AIS_InteractiveObject) Connect(const Handle(AIS_InteractiveObject)& theAnotherObj)
0089   {
0090     return connect(theAnotherObj,
0091                    theAnotherObj->LocalTransformationGeom(),
0092                    theAnotherObj->TransformPersistence());
0093   }
0094 
0095   //! Establishes the connection between the Connected Interactive Object, theInteractive, and its
0096   //! reference. Locates instance in theLocation and copies transformation persistence mode from
0097   //! theInteractive.
0098   //! @return created instance object (AIS_ConnectedInteractive or AIS_MultipleConnectedInteractive)
0099   Handle(AIS_InteractiveObject) Connect(const Handle(AIS_InteractiveObject)& theAnotherObj,
0100                                         const gp_Trsf&                       theLocation)
0101   {
0102     return connect(theAnotherObj,
0103                    new TopLoc_Datum3D(theLocation),
0104                    theAnotherObj->TransformPersistence());
0105   }
0106 
0107   //! Establishes the connection between the Connected Interactive Object, theInteractive, and its
0108   //! reference. Locates instance in theLocation and applies specified transformation persistence
0109   //! mode.
0110   //! @return created instance object (AIS_ConnectedInteractive or AIS_MultipleConnectedInteractive)
0111   Handle(AIS_InteractiveObject) Connect(const Handle(AIS_InteractiveObject)&   theAnotherObj,
0112                                         const gp_Trsf&                         theLocation,
0113                                         const Handle(Graphic3d_TransformPers)& theTrsfPers)
0114   {
0115     return connect(theAnotherObj, new TopLoc_Datum3D(theLocation), theTrsfPers);
0116   }
0117 
0118 protected:
0119   //! this method is redefined virtual;
0120   //! when the instance is connected to another
0121   //! InteractiveObject,this method doesn't
0122   //! compute anything, but just uses the
0123   //! presentation of this last object, with
0124   //! a transformation if there's one stored.
0125   Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager)& thePrsMgr,
0126                                        const Handle(Prs3d_Presentation)&         thePrs,
0127                                        const Standard_Integer theMode) Standard_OVERRIDE;
0128 
0129   //! Establishes the connection between the Connected Interactive Object, theInteractive, and its
0130   //! reference. Locates instance in theLocation and applies specified transformation persistence
0131   //! mode.
0132   //! @return created instance object (AIS_ConnectedInteractive or AIS_MultipleConnectedInteractive)
0133   Standard_EXPORT virtual Handle(AIS_InteractiveObject) connect(
0134     const Handle(AIS_InteractiveObject)&   theInteractive,
0135     const Handle(TopLoc_Datum3D)&          theLocation,
0136     const Handle(Graphic3d_TransformPers)& theTrsfPers);
0137 
0138 private:
0139   //! Computes the selection for whole subtree in scene hierarchy.
0140   Standard_EXPORT virtual void ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
0141                                                 const Standard_Integer aMode) Standard_OVERRIDE;
0142 
0143 protected:
0144   Handle(SelectMgr_EntityOwner) myAssemblyOwner;
0145 };
0146 
0147 DEFINE_STANDARD_HANDLE(AIS_MultipleConnectedInteractive, AIS_InteractiveObject)
0148 
0149 #endif // _AIS_MultipleConnectedInteractive_HeaderFile