|
||||
File indexing completed on 2025-01-18 10:02:54
0001 // Created on: 1997-01-08 0002 // Created by: Robert COUBLANC 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_ConnectedInteractive_HeaderFile 0018 #define _AIS_ConnectedInteractive_HeaderFile 0019 0020 #include <AIS_InteractiveObject.hxx> 0021 #include <AIS_KindOfInteractive.hxx> 0022 #include <TopoDS_Shape.hxx> 0023 0024 //! Creates an arbitrary located instance of another Interactive Object, 0025 //! which serves as a reference. 0026 //! This allows you to use the Connected Interactive 0027 //! Object without having to recalculate presentation, 0028 //! selection or graphic structure. These are deduced 0029 //! from your reference object. 0030 //! The relation between the connected interactive object 0031 //! and its source is generally one of geometric transformation. 0032 //! AIS_ConnectedInteractive class supports selection mode 0 for any InteractiveObject and 0033 //! all standard modes if its reference based on AIS_Shape. 0034 //! Descendants may redefine ComputeSelection() though. 0035 //! Also ConnectedInteractive will handle HLR if its reference based on AIS_Shape. 0036 class AIS_ConnectedInteractive : public AIS_InteractiveObject 0037 { 0038 DEFINE_STANDARD_RTTIEXT(AIS_ConnectedInteractive, AIS_InteractiveObject) 0039 public: 0040 0041 //! Disconnects the previous view and sets highlight 0042 //! mode to 0. This highlights the wireframe presentation 0043 //! aTypeOfPresentation3d. 0044 //! Top_AllView deactivates hidden line removal. 0045 Standard_EXPORT AIS_ConnectedInteractive(const PrsMgr_TypeOfPresentation3d aTypeOfPresentation3d = PrsMgr_TOP_AllView); 0046 0047 //! Returns KOI_Object 0048 virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE { return AIS_KindOfInteractive_Object; } 0049 0050 //! Returns 0 0051 virtual Standard_Integer Signature() const Standard_OVERRIDE { return 0; } 0052 0053 //! Establishes the connection between the Connected 0054 //! Interactive Object, anotherIobj, and its reference. 0055 void Connect (const Handle(AIS_InteractiveObject)& theAnotherObj) { connect (theAnotherObj, Handle(TopLoc_Datum3D)()); } 0056 0057 //! Establishes the connection between the Connected 0058 //! Interactive Object, anotherIobj, and its reference. 0059 //! Locates instance in aLocation. 0060 void Connect (const Handle(AIS_InteractiveObject)& theAnotherObj, 0061 const gp_Trsf& theLocation) { connect (theAnotherObj, new TopLoc_Datum3D (theLocation)); } 0062 0063 //! Establishes the connection between the Connected 0064 //! Interactive Object, anotherIobj, and its reference. 0065 //! Locates instance in aLocation. 0066 void Connect (const Handle(AIS_InteractiveObject)& theAnotherObj, 0067 const Handle(TopLoc_Datum3D)& theLocation) { connect (theAnotherObj, theLocation); } 0068 0069 //! Returns true if there is a connection established 0070 //! between the presentation and its source reference. 0071 Standard_Boolean HasConnection() const { return !myReference.IsNull(); } 0072 0073 //! Returns the connection with the reference Interactive Object. 0074 const Handle(AIS_InteractiveObject)& ConnectedTo() const { return myReference; } 0075 0076 //! Clears the connection with a source reference. The 0077 //! presentation will no longer be displayed. 0078 //! Warning Must be done before deleting the presentation. 0079 Standard_EXPORT void Disconnect(); 0080 0081 //! Informs the graphic context that the interactive Object 0082 //! may be decomposed into sub-shapes for dynamic selection. 0083 virtual Standard_Boolean AcceptShapeDecomposition() const Standard_OVERRIDE 0084 { 0085 return !myReference.IsNull() && myReference->AcceptShapeDecomposition(); 0086 } 0087 0088 //! Return true if reference presentation accepts specified display mode. 0089 virtual Standard_Boolean AcceptDisplayMode (const Standard_Integer theMode) const Standard_OVERRIDE 0090 { 0091 return myReference.IsNull() 0092 || myReference->AcceptDisplayMode (theMode); 0093 } 0094 0095 protected: 0096 0097 //! Calculates the view aPresentation and its updates. 0098 //! The latter are managed by aPresentationManager. 0099 //! The display mode aMode is 0 by default. 0100 //! this method is redefined virtual; 0101 //! when the instance is connected to another 0102 //! InteractiveObject,this method doesn't 0103 //! compute anything, but just uses the 0104 //! presentation of this last object, with 0105 //! a transformation if there's one stored. 0106 Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr, 0107 const Handle(Prs3d_Presentation)& theprs, 0108 const Standard_Integer theMode) Standard_OVERRIDE; 0109 0110 //! Computes the presentation according to a point of view. 0111 Standard_EXPORT virtual void computeHLR (const Handle(Graphic3d_Camera)& theProjector, 0112 const Handle(TopLoc_Datum3D)& theTrsf, 0113 const Handle(Prs3d_Presentation)& thePrs) Standard_OVERRIDE; 0114 0115 //! Generates sensitive entities by copying 0116 //! them from myReference selection, creates and sets an entity 0117 //! owner for this entities and adds them to theSelection 0118 Standard_EXPORT virtual void ComputeSelection (const Handle(SelectMgr_Selection)& theSelection, const Standard_Integer theMode) Standard_OVERRIDE; 0119 0120 //! Generates sensitive entities by copying 0121 //! them from myReference sub shapes selection, creates and sets an entity 0122 //! owner for this entities and adds them to theSelection 0123 Standard_EXPORT void computeSubShapeSelection (const Handle(SelectMgr_Selection)& theSelection, const Standard_Integer theMode); 0124 0125 Standard_EXPORT void updateShape (const Standard_Boolean WithLocation = Standard_True); 0126 0127 Standard_EXPORT void connect (const Handle(AIS_InteractiveObject)& theAnotherObj, 0128 const Handle(TopLoc_Datum3D)& theLocation); 0129 0130 protected: 0131 0132 Handle(AIS_InteractiveObject) myReference; 0133 TopoDS_Shape myShape; 0134 0135 }; 0136 0137 DEFINE_STANDARD_HANDLE(AIS_ConnectedInteractive, AIS_InteractiveObject) 0138 0139 #endif // _AIS_ConnectedInteractive_HeaderFile
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |