0031642: Visualization - crash in Graphic3d_Structure::SetVisual() on redisplaying...
[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 <SelectMgr_SelectableObject.hxx>
24#include <Standard_Type.hxx>
25#include <TColStd_ListIteratorOfListOfReal.hxx>
7fd59977 26
92efcf78 27IMPLEMENT_STANDARD_RTTIEXT(MeshVS_MeshEntityOwner,SelectMgr_EntityOwner)
28
7fd59977 29#ifndef MeshVS_PRSBUILDERHXX
30#include <MeshVS_PrsBuilder.hxx>
31#endif
32
33
34//================================================================
35// Function : Constructor MeshVS_MeshEntityOwner
36// Purpose :
37//================================================================
38MeshVS_MeshEntityOwner::MeshVS_MeshEntityOwner
7f24b768 39 ( const SelectMgr_SelectableObject* SelObj,
7fd59977 40 const Standard_Integer ID,
41 const Standard_Address MeshEntity,
42 const MeshVS_EntityType& Type,
43 const Standard_Integer Priority,
44 const Standard_Boolean IsGroup )
45: SelectMgr_EntityOwner ( SelObj, Priority ),
46 myAddr ( MeshEntity ),
47 myType ( Type ),
48 myID ( ID ),
49 myIsGroup ( IsGroup )
50{
0ef04197 51 //
7fd59977 52}
53
54//================================================================
55// Function : Owner
56// Purpose :
57//================================================================
58Standard_Address MeshVS_MeshEntityOwner::Owner() const
59{
60 return myAddr;
61}
62
63//================================================================
64// Function : Type
65// Purpose :
66//================================================================
67MeshVS_EntityType MeshVS_MeshEntityOwner::Type() const
68{
69 return myType;
70}
71
72//================================================================
73// Function : IsGroup
74// Purpose :
75//================================================================
76Standard_Boolean MeshVS_MeshEntityOwner::IsGroup() const
77{
78 return myIsGroup;
79}
80
81//================================================================
82// Function : IsHilighted
83// Purpose :
84//================================================================
85Standard_Boolean MeshVS_MeshEntityOwner::IsHilighted ( const Handle(PrsMgr_PresentationManager)&,
86 const Standard_Integer ) const
87{
88 return Standard_False;
89}
90
7fd59977 91//================================================================
92// Function : HilightWithColor
93// Purpose :
94//================================================================
8e5fb5ea 95void MeshVS_MeshEntityOwner::HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM,
f838dac4 96 const Handle(Prs3d_Drawer)& theStyle,
8e5fb5ea 97 const Standard_Integer /*theMode*/ )
7fd59977 98{
99 Handle( SelectMgr_SelectableObject ) aSelObj;
100 if ( HasSelectable() )
101 aSelObj = Selectable();
102
103 if ( thePM->IsImmediateModeOn() && aSelObj->IsKind( STANDARD_TYPE( MeshVS_Mesh ) ) )
104 {
105 Handle( MeshVS_Mesh ) aMesh = Handle( MeshVS_Mesh )::DownCast ( aSelObj );
8e5fb5ea 106 aMesh->HilightOwnerWithColor ( thePM, theStyle, this );
7fd59977 107 }
108}
109
110//================================================================
111// Function : Unhilight
112// Purpose :
113//================================================================
114void MeshVS_MeshEntityOwner::Unhilight ( const Handle(PrsMgr_PresentationManager)&,
115 const Standard_Integer )
116{
117}
118
119//================================================================
120// Function : Clear
121// Purpose :
122//================================================================
123void MeshVS_MeshEntityOwner::Clear ( const Handle(PrsMgr_PresentationManager)&,
124 const Standard_Integer )
125{
126}
127
128//================================================================
129// Function : ID
130// Purpose :
131//================================================================
132Standard_Integer MeshVS_MeshEntityOwner::ID () const
133{
134 return myID;
135}