| 1 | // Created on: 2007-01-24 |
| 2 | // Created by: Sergey Kochetkov |
| 3 | // Copyright (c) 2007-2014 OPEN CASCADE SAS |
| 4 | // |
| 5 | // This file is part of Open CASCADE Technology software library. |
| 6 | // |
| 7 | // This library is free software; you can redistribute it and/or modify it under |
| 8 | // the terms of the GNU Lesser General Public License version 2.1 as published |
| 9 | // by the Free Software Foundation, with special exception defined in the file |
| 10 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
| 11 | // distribution for complete text of the license and disclaimer of any warranty. |
| 12 | // |
| 13 | // Alternatively, this file may be used under the terms of Open CASCADE |
| 14 | // commercial license or contractual agreement. |
| 15 | |
| 16 | #ifndef _MeshVS_MeshOwner_HeaderFile |
| 17 | #define _MeshVS_MeshOwner_HeaderFile |
| 18 | |
| 19 | #include <Standard.hxx> |
| 20 | #include <Standard_Type.hxx> |
| 21 | |
| 22 | #include <Standard_Integer.hxx> |
| 23 | #include <SelectMgr_EntityOwner.hxx> |
| 24 | #include <SelectMgr_SOPtr.hxx> |
| 25 | #include <PrsMgr_PresentationManager3d.hxx> |
| 26 | #include <Quantity_NameOfColor.hxx> |
| 27 | #include <Standard_Boolean.hxx> |
| 28 | class MeshVS_DataSource; |
| 29 | class TColStd_HPackedMapOfInteger; |
| 30 | class PrsMgr_PresentationManager; |
| 31 | |
| 32 | |
| 33 | class MeshVS_MeshOwner; |
| 34 | DEFINE_STANDARD_HANDLE(MeshVS_MeshOwner, SelectMgr_EntityOwner) |
| 35 | |
| 36 | //! The custom mesh owner used for advanced mesh selection. This class provides methods to store information: |
| 37 | //! 1) IDs of hilighted mesh nodes and elements |
| 38 | //! 2) IDs of mesh nodes and elements selected on the mesh |
| 39 | class MeshVS_MeshOwner : public SelectMgr_EntityOwner |
| 40 | { |
| 41 | |
| 42 | public: |
| 43 | |
| 44 | |
| 45 | Standard_EXPORT MeshVS_MeshOwner(const SelectMgr_SOPtr& theSelObj, const Handle(MeshVS_DataSource)& theDS, const Standard_Integer thePriority = 0); |
| 46 | |
| 47 | Standard_EXPORT const Handle(MeshVS_DataSource)& GetDataSource() const; |
| 48 | |
| 49 | //! Returns ids of selected mesh nodes |
| 50 | Standard_EXPORT const Handle(TColStd_HPackedMapOfInteger)& GetSelectedNodes() const; |
| 51 | |
| 52 | //! Returns ids of selected mesh elements |
| 53 | Standard_EXPORT const Handle(TColStd_HPackedMapOfInteger)& GetSelectedElements() const; |
| 54 | |
| 55 | //! Saves ids of selected mesh entities |
| 56 | Standard_EXPORT virtual void AddSelectedEntities (const Handle(TColStd_HPackedMapOfInteger)& Nodes, const Handle(TColStd_HPackedMapOfInteger)& Elems); |
| 57 | |
| 58 | //! Clears ids of selected mesh entities |
| 59 | Standard_EXPORT virtual void ClearSelectedEntities(); |
| 60 | |
| 61 | //! Returns ids of hilighted mesh nodes |
| 62 | Standard_EXPORT const Handle(TColStd_HPackedMapOfInteger)& GetDetectedNodes() const; |
| 63 | |
| 64 | //! Returns ids of hilighted mesh elements |
| 65 | Standard_EXPORT const Handle(TColStd_HPackedMapOfInteger)& GetDetectedElements() const; |
| 66 | |
| 67 | //! Saves ids of hilighted mesh entities |
| 68 | Standard_EXPORT void SetDetectedEntities (const Handle(TColStd_HPackedMapOfInteger)& Nodes, const Handle(TColStd_HPackedMapOfInteger)& Elems); |
| 69 | |
| 70 | Standard_EXPORT virtual void HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM, |
| 71 | const Handle(Prs3d_Drawer)& theColor, |
| 72 | const Standard_Integer theMode = 0) Standard_OVERRIDE; |
| 73 | |
| 74 | Standard_EXPORT virtual void Unhilight (const Handle(PrsMgr_PresentationManager)& PM, const Standard_Integer Mode = 0) Standard_OVERRIDE; |
| 75 | |
| 76 | Standard_EXPORT virtual Standard_Boolean IsForcedHilight() const Standard_OVERRIDE; |
| 77 | |
| 78 | |
| 79 | |
| 80 | |
| 81 | DEFINE_STANDARD_RTTIEXT(MeshVS_MeshOwner,SelectMgr_EntityOwner) |
| 82 | |
| 83 | protected: |
| 84 | |
| 85 | |
| 86 | Handle(TColStd_HPackedMapOfInteger) mySelectedNodes; |
| 87 | Handle(TColStd_HPackedMapOfInteger) mySelectedElems; |
| 88 | |
| 89 | |
| 90 | private: |
| 91 | |
| 92 | |
| 93 | Handle(MeshVS_DataSource) myDataSource; |
| 94 | Handle(TColStd_HPackedMapOfInteger) myDetectedNodes; |
| 95 | Handle(TColStd_HPackedMapOfInteger) myDetectedElems; |
| 96 | Standard_Integer myLastID; |
| 97 | |
| 98 | |
| 99 | }; |
| 100 | |
| 101 | |
| 102 | |
| 103 | |
| 104 | |
| 105 | |
| 106 | |
| 107 | #endif // _MeshVS_MeshOwner_HeaderFile |