0027818: Visualization - provide an interface to define highlight presentation properties
[occt.git] / src / MeshVS / MeshVS_MeshEntityOwner.cxx
CommitLineData
b311480e 1// Created on: 2003-09-09
2// Created by: Alexander SOLOVYOV
973c2be1 3// Copyright (c) 2003-2014 OPEN CASCADE SAS
b311480e 4//
973c2be1 5// This file is part of Open CASCADE Technology software library.
b311480e 6//
d5f74e42 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
973c2be1 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.
b311480e 12//
973c2be1 13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
7fd59977 15
7fd59977 16
7fd59977 17#include <Graphic3d_Group.hxx>
42cf5bc1 18#include <MeshVS_Mesh.hxx>
19#include <MeshVS_MeshEntityOwner.hxx>
7fd59977 20#include <Prs3d_Root.hxx>
7fd59977 21#include <PrsMgr_PresentationManager.hxx>
22#include <PrsMgr_PresentationManager3d.hxx>
42cf5bc1 23#include <SelectBasics_EntityOwner.hxx>
24#include <SelectMgr_SelectableObject.hxx>
25#include <Standard_Type.hxx>
26#include <TColStd_ListIteratorOfListOfReal.hxx>
7fd59977 27
92efcf78 28IMPLEMENT_STANDARD_RTTIEXT(MeshVS_MeshEntityOwner,SelectMgr_EntityOwner)
29
7fd59977 30#ifndef MeshVS_PRSBUILDERHXX
31#include <MeshVS_PrsBuilder.hxx>
32#endif
33
34
35//================================================================
36// Function : Constructor MeshVS_MeshEntityOwner
37// Purpose :
38//================================================================
39MeshVS_MeshEntityOwner::MeshVS_MeshEntityOwner
40 ( const SelectMgr_SOPtr& SelObj,
41 const Standard_Integer ID,
42 const Standard_Address MeshEntity,
43 const MeshVS_EntityType& Type,
44 const Standard_Integer Priority,
45 const Standard_Boolean IsGroup )
46: SelectMgr_EntityOwner ( SelObj, Priority ),
47 myAddr ( MeshEntity ),
48 myType ( Type ),
49 myID ( ID ),
50 myIsGroup ( IsGroup )
51{
52 SelectBasics_EntityOwner::Set ( Priority );
53}
54
55//================================================================
56// Function : Owner
57// Purpose :
58//================================================================
59Standard_Address MeshVS_MeshEntityOwner::Owner() const
60{
61 return myAddr;
62}
63
64//================================================================
65// Function : Type
66// Purpose :
67//================================================================
68MeshVS_EntityType MeshVS_MeshEntityOwner::Type() const
69{
70 return myType;
71}
72
73//================================================================
74// Function : IsGroup
75// Purpose :
76//================================================================
77Standard_Boolean MeshVS_MeshEntityOwner::IsGroup() const
78{
79 return myIsGroup;
80}
81
82//================================================================
83// Function : IsHilighted
84// Purpose :
85//================================================================
86Standard_Boolean MeshVS_MeshEntityOwner::IsHilighted ( const Handle(PrsMgr_PresentationManager)&,
87 const Standard_Integer ) const
88{
89 return Standard_False;
90}
91
92//================================================================
7fd59977 93// Function : HilightWithColor
94// Purpose :
95//================================================================
8e5fb5ea 96void MeshVS_MeshEntityOwner::HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM,
97 const Handle(Graphic3d_HighlightStyle)& theStyle,
98 const Standard_Integer /*theMode*/ )
7fd59977 99{
100 Handle( SelectMgr_SelectableObject ) aSelObj;
101 if ( HasSelectable() )
102 aSelObj = Selectable();
103
104 if ( thePM->IsImmediateModeOn() && aSelObj->IsKind( STANDARD_TYPE( MeshVS_Mesh ) ) )
105 {
106 Handle( MeshVS_Mesh ) aMesh = Handle( MeshVS_Mesh )::DownCast ( aSelObj );
8e5fb5ea 107 aMesh->HilightOwnerWithColor ( thePM, theStyle, this );
7fd59977 108 }
109}
110
111//================================================================
112// Function : Unhilight
113// Purpose :
114//================================================================
115void MeshVS_MeshEntityOwner::Unhilight ( const Handle(PrsMgr_PresentationManager)&,
116 const Standard_Integer )
117{
118}
119
120//================================================================
121// Function : Clear
122// Purpose :
123//================================================================
124void MeshVS_MeshEntityOwner::Clear ( const Handle(PrsMgr_PresentationManager)&,
125 const Standard_Integer )
126{
127}
128
129//================================================================
130// Function : ID
131// Purpose :
132//================================================================
133Standard_Integer MeshVS_MeshEntityOwner::ID () const
134{
135 return myID;
136}