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
6 // This file is part of Open CASCADE Technology software library.
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #include <AIS_DimensionOwner.ixx>
18 #include <AIS_Dimension.hxx>
20 #include <StdSelect_Shape.hxx>
23 #include <TopoDS_Vertex.hxx>
27 //=======================================================================
28 //function : HighlightMode
29 //purpose : Return corresponding compute mode for selection type.
30 //=======================================================================
31 static AIS_Dimension::ComputeMode HighlightMode (const Standard_Integer theSelMode)
35 case AIS_DSM_Line : return AIS_Dimension::ComputeMode_Line;
36 case AIS_DSM_Text : return AIS_Dimension::ComputeMode_Text;
38 return AIS_Dimension::ComputeMode_All;
43 //=======================================================================
44 //function : Constructor
46 //=======================================================================
47 AIS_DimensionOwner::AIS_DimensionOwner (const Handle(SelectMgr_SelectableObject)& theSelObject,
48 const AIS_DimensionSelectionMode theMode,
49 const Standard_Integer thePriority)
50 : SelectMgr_EntityOwner(theSelObject, thePriority),
51 mySelectionMode (theMode)
55 //=======================================================================
56 //function : AIS_DimensionSelectionMode
58 //=======================================================================
59 AIS_DimensionSelectionMode AIS_DimensionOwner::SelectionMode () const
61 return mySelectionMode;
64 //=======================================================================
65 //function : IsHilighted
67 //=======================================================================
68 Standard_Boolean AIS_DimensionOwner::IsHilighted (const Handle(PrsMgr_PresentationManager)& thePM,
69 const Standard_Integer /*theMode*/) const
73 return Standard_False;
76 return thePM->IsHighlighted (Selectable(), HighlightMode (mySelectionMode));
79 //=======================================================================
82 //=======================================================================
83 void AIS_DimensionOwner::Hilight (const Handle(PrsMgr_PresentationManager)& thePM,
84 const Standard_Integer /*theMode*/)
91 thePM->Highlight (Selectable(), HighlightMode (mySelectionMode));
94 //=======================================================================
95 //function : Unhilight
97 //=======================================================================
98 void AIS_DimensionOwner::Unhilight (const Handle(PrsMgr_PresentationManager)& thePM,
99 const Standard_Integer /*theMode*/)
101 if (!HasSelectable())
106 thePM->Unhighlight (Selectable(), HighlightMode (mySelectionMode));
109 //=======================================================================
110 //function : HilightWithColor
112 //=======================================================================
113 void AIS_DimensionOwner::HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM,
114 const Quantity_NameOfColor theColor,
115 const Standard_Integer /*theMode*/)
117 thePM->Color (Selectable(), theColor, HighlightMode (mySelectionMode));