Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:05:01

0001 // Created on: 1995-03-08
0002 // Created by: Mister rmi
0003 // Copyright (c) 1995-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 _StdSelect_BRepOwner_HeaderFile
0018 #define _StdSelect_BRepOwner_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 
0022 #include <Standard_Integer.hxx>
0023 #include <Standard_Boolean.hxx>
0024 #include <TopoDS_Shape.hxx>
0025 #include <SelectMgr_EntityOwner.hxx>
0026 #include <PrsMgr_PresentationManager.hxx>
0027 class StdSelect_Shape;
0028 class SelectMgr_SelectableObject;
0029 class PrsMgr_PresentationManager;
0030 class TopLoc_Location;
0031 
0032 DEFINE_STANDARD_HANDLE(StdSelect_BRepOwner, SelectMgr_EntityOwner)
0033 
0034 //! Defines Specific Owners for Sensitive Primitives
0035 //! (Sensitive Segments,Circles...).
0036 //! Used in Dynamic Selection Mechanism.
0037 //! A BRepOwner has an Owner (the shape it represents)
0038 //! and Users (One or More Transient entities).
0039 //! The highlight-unhighlight methods are empty and
0040 //! must be redefined by each User.
0041 class StdSelect_BRepOwner : public SelectMgr_EntityOwner
0042 {
0043   DEFINE_STANDARD_RTTIEXT(StdSelect_BRepOwner, SelectMgr_EntityOwner)
0044 public:
0045 
0046   //! Constructs an owner specification framework defined
0047   //! by the priority aPriority.
0048   Standard_EXPORT StdSelect_BRepOwner(const Standard_Integer aPriority);
0049   
0050   //! Constructs an owner specification framework defined
0051   //! by the shape aShape and the priority aPriority.
0052   //! aShape and aPriority are stored in this framework. If
0053   //! more than one owner are detected during dynamic
0054   //! selection, the one with the highest priority is the one stored.
0055   Standard_EXPORT StdSelect_BRepOwner(const TopoDS_Shape& aShape, const Standard_Integer aPriority = 0, const Standard_Boolean ComesFromDecomposition = Standard_False);
0056   
0057   //! Constructs an owner specification framework defined
0058   //! by the shape aShape, the selectable object theOrigin
0059   //! and the priority aPriority.
0060   //! aShape, theOrigin and aPriority are stored in this
0061   //! framework. If more than one owner are detected
0062   //! during dynamic selection, the one with the highest
0063   //! priority is the one stored.
0064   Standard_EXPORT StdSelect_BRepOwner(const TopoDS_Shape& aShape, const Handle(SelectMgr_SelectableObject)& theOrigin, const Standard_Integer aPriority = 0, const Standard_Boolean FromDecomposition = Standard_False);
0065   
0066   //! returns False if no shape was set
0067   Standard_Boolean HasShape() const { return !myShape.IsNull(); }
0068 
0069   //! Returns the shape.
0070   const TopoDS_Shape& Shape() const { return myShape; }
0071 
0072   //! Returns true if this framework has a highlight mode defined for it.
0073   Standard_Boolean HasHilightMode() const { return myCurMode == -1; }
0074   
0075   //! Sets the highlight mode for this framework.
0076   //! This defines the type of display used to highlight the
0077   //! owner of the shape when it is detected by the selector.
0078   //! The default type of display is wireframe, defined by the index 0.
0079   void SetHilightMode (const Standard_Integer theMode) { myCurMode = theMode; }
0080 
0081   //! Resets the higlight mode for this framework.
0082   //! This defines the type of display used to highlight the
0083   //! owner of the shape when it is detected by the selector.
0084   //! The default type of display is wireframe, defined by the index 0.
0085   void ResetHilightMode() { myCurMode = -1; }
0086 
0087   //! Returns the highlight mode for this framework.
0088   //! This defines the type of display used to highlight the
0089   //! owner of the shape when it is detected by the selector.
0090   //! The default type of display is wireframe, defined by the index 0.
0091   Standard_Integer HilightMode() const { return myCurMode; }
0092 
0093   //! Returns true if an object with the selection mode
0094   //! aMode is highlighted in the presentation manager aPM.
0095   Standard_EXPORT virtual Standard_Boolean IsHilighted (const Handle(PrsMgr_PresentationManager)& aPM, const Standard_Integer aMode = 0) const Standard_OVERRIDE;
0096   
0097   Standard_EXPORT virtual void HilightWithColor (const Handle(PrsMgr_PresentationManager)& thePM,
0098                                                  const Handle(Prs3d_Drawer)& theStyle,
0099                                                  const Standard_Integer theMode) Standard_OVERRIDE;
0100   
0101   //! Removes highlighting from the type of shape
0102   //! identified the selection mode aMode in the presentation manager aPM.
0103   Standard_EXPORT virtual void Unhilight (const Handle(PrsMgr_PresentationManager)& aPM, const Standard_Integer aMode = 0) Standard_OVERRIDE;
0104   
0105   //! Clears the presentation manager object aPM of all
0106   //! shapes with the selection mode aMode.
0107   Standard_EXPORT virtual void Clear (const Handle(PrsMgr_PresentationManager)& aPM, const Standard_Integer aMode = 0) Standard_OVERRIDE;
0108   
0109   Standard_EXPORT virtual void SetLocation (const TopLoc_Location& aLoc) Standard_OVERRIDE;
0110 
0111   //! Implements immediate application of location transformation of parent object to dynamic highlight structure
0112   Standard_EXPORT virtual void UpdateHighlightTrsf (const Handle(V3d_Viewer)& theViewer,
0113                                                     const Handle(PrsMgr_PresentationManager)& theManager,
0114                                                     const Standard_Integer theDispMode) Standard_OVERRIDE;
0115 
0116   //! Dumps the content of me into the stream
0117   Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
0118 
0119 protected:
0120 
0121   TopoDS_Shape myShape;
0122   Handle(StdSelect_Shape) myPrsSh;
0123   Standard_Integer myCurMode;
0124 
0125 };
0126 
0127 #endif // _StdSelect_BRepOwner_HeaderFile