Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:02:55

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