0032161: Coding Rules - deprecate obsolete alias PrsMgr_PresentationManager3d
[occt.git] / src / PrsDim / PrsDim_DimensionOwner.cxx
1 // Created on: 1996-12-05
2 // Created by: Odile Olivier
3 // Copyright (c) 1996-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17 #include <PrsDim_DimensionOwner.hxx>
18
19 #include <PrsDim_Dimension.hxx>
20 #include <PrsMgr_PresentationManager.hxx>
21 #include <SelectMgr_SelectableObject.hxx>
22 #include <Standard_Type.hxx>
23 #include <TopoDS.hxx>
24 #include <TopoDS_Vertex.hxx>
25
26 IMPLEMENT_STANDARD_RTTIEXT(PrsDim_DimensionOwner, SelectMgr_EntityOwner)
27
28 namespace
29 {
30   //=======================================================================
31   //function : HighlightMode
32   //purpose  : Return corresponding compute mode for selection type.
33   //=======================================================================
34   static PrsDim_Dimension::ComputeMode HighlightMode (const Standard_Integer theSelMode)
35   {
36     switch (theSelMode)
37     {
38       case PrsDim_DimensionSelectionMode_Line: return PrsDim_Dimension::ComputeMode_Line;
39       case PrsDim_DimensionSelectionMode_Text: return PrsDim_Dimension::ComputeMode_Text;
40       default:
41         return PrsDim_Dimension::ComputeMode_All;
42     }
43   }
44 }
45
46 //=======================================================================
47 //function : Constructor
48 //purpose  : 
49 //=======================================================================
50 PrsDim_DimensionOwner::PrsDim_DimensionOwner (const Handle(SelectMgr_SelectableObject)& theSelObject,
51                                               const PrsDim_DimensionSelectionMode theMode,
52                                               const Standard_Integer thePriority)
53 : SelectMgr_EntityOwner(theSelObject, thePriority),
54   mySelectionMode (theMode)
55 {
56 }
57
58 //=======================================================================
59 //function : IsHilighted
60 //purpose  : 
61 //=======================================================================
62 Standard_Boolean PrsDim_DimensionOwner::IsHilighted (const Handle(PrsMgr_PresentationManager)& thePM,
63                                                      const Standard_Integer /*theMode*/) const
64 {
65   if (!HasSelectable())
66   {
67     return Standard_False;
68   }
69
70   return thePM->IsHighlighted (Selectable(), HighlightMode (mySelectionMode));
71 }
72
73 //=======================================================================
74 //function : Unhilight
75 //purpose  : 
76 //=======================================================================
77 void PrsDim_DimensionOwner::Unhilight (const Handle(PrsMgr_PresentationManager)& thePM,
78                                        const Standard_Integer /*theMode*/)
79 {
80   if (!HasSelectable())
81   {
82     return;
83   }
84
85   thePM->Unhighlight (Selectable());
86 }
87
88 //=======================================================================
89 //function : HilightWithColor
90 //purpose  : 
91 //=======================================================================
92 void PrsDim_DimensionOwner::HilightWithColor (const Handle(PrsMgr_PresentationManager)& thePM,
93                                               const Handle(Prs3d_Drawer)& theStyle,
94                                               const Standard_Integer /*theMode*/)
95 {
96   thePM->Color (Selectable(), theStyle, HighlightMode (mySelectionMode));
97 }