Back to home page

EIC code displayed by LXR

 
 

    


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