1 // Created on: 1997-02-10
2 // Created by: Robert COUBLANC
3 // Copyright (c) 1997-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.
18 #include <AIS_GraphicTool.hxx>
19 #include <Aspect_InteriorStyle.hxx>
20 #include <Graphic3d_AspectFillArea3d.hxx>
21 #include <Graphic3d_AspectLine3d.hxx>
22 #include <Graphic3d_MaterialAspect.hxx>
23 #include <Prs3d_DatumAspect.hxx>
24 #include <Prs3d_DimensionAspect.hxx>
25 #include <Prs3d_IsoAspect.hxx>
26 #include <Prs3d_LineAspect.hxx>
27 #include <Prs3d_PlaneAspect.hxx>
28 #include <Prs3d_ShadingAspect.hxx>
29 #include <Quantity_Color.hxx>
31 static Handle(Prs3d_LineAspect) GetLineAspect(const Handle(Prs3d_Drawer)& Dr,
32 const AIS_TypeOfAttribute Att)
37 return Dr->LineAspect();
38 case AIS_TOA_Dimension:
39 return Dr->DimensionAspect()->LineAspect();
41 return Dr->WireAspect();
43 return Dr->PlaneAspect()->EdgesAspect();
45 return Dr->VectorAspect();
47 return Handle(Prs3d_LineAspect) (Dr->UIsoAspect());
49 return Handle(Prs3d_LineAspect) (Dr->VIsoAspect());
51 return Dr->FreeBoundaryAspect();
53 return Dr->UnFreeBoundaryAspect();
55 return Dr->SectionAspect();
57 return Dr->HiddenLineAspect();
59 return Dr->SeenLineAspect();
60 case AIS_TOA_FaceBoundary:
61 return Dr->FaceBoundaryAspect();
62 case AIS_TOA_FirstAxis:
63 return Dr->DatumAspect()->LineAspect(Prs3d_DP_XAxis);
64 case AIS_TOA_SecondAxis:
65 return Dr->DatumAspect()->LineAspect(Prs3d_DP_YAxis);
66 case AIS_TOA_ThirdAxis:
67 return Dr->DatumAspect()->LineAspect(Prs3d_DP_ZAxis);
69 Handle(Prs3d_LineAspect) bid;
73 Quantity_NameOfColor AIS_GraphicTool::GetLineColor (const Handle(Prs3d_Drawer)& Dr, const AIS_TypeOfAttribute Att)
76 GetLineColor(Dr,Att,color);
80 void AIS_GraphicTool::GetLineColor (const Handle(Prs3d_Drawer)& Dr, const AIS_TypeOfAttribute Att, Quantity_Color &aColor)
82 aColor = GetLineAspect(Dr,Att)->Aspect()->Color();
85 Standard_Real AIS_GraphicTool::GetLineWidth (const Handle(Prs3d_Drawer)& Dr,
86 const AIS_TypeOfAttribute Att)
88 Handle(Prs3d_LineAspect) LA = GetLineAspect(Dr,Att);
89 return LA->Aspect()->Width();
91 Aspect_TypeOfLine AIS_GraphicTool::GetLineType (const Handle(Prs3d_Drawer)& Dr,
92 const AIS_TypeOfAttribute Att)
94 Handle(Prs3d_LineAspect) LA = GetLineAspect(Dr,Att);
95 return LA->Aspect()->Type();;
99 void AIS_GraphicTool::GetLineAtt(const Handle(Prs3d_Drawer)& Dr,
100 const AIS_TypeOfAttribute Att,
101 Quantity_NameOfColor& Col,
103 Aspect_TypeOfLine& TYP)
105 Handle(Prs3d_LineAspect) LA = GetLineAspect(Dr,Att);
106 Col = LA->Aspect()->Color().Name();
107 W = LA->Aspect()->Width();
108 TYP = LA->Aspect()->Type();
111 Quantity_NameOfColor AIS_GraphicTool::GetInteriorColor(const Handle(Prs3d_Drawer)& Dr)
113 Quantity_Color color;
114 GetInteriorColor(Dr,color);
118 void AIS_GraphicTool::GetInteriorColor(const Handle(Prs3d_Drawer)& Dr, Quantity_Color &aColor)
120 Handle(Graphic3d_AspectFillArea3d) AFA = Dr->ShadingAspect()->Aspect();
121 aColor = AFA->InteriorColor();
124 Graphic3d_MaterialAspect AIS_GraphicTool::GetMaterial(const Handle(Prs3d_Drawer)& Dr)
126 return Dr->ShadingAspect()->Aspect()->BackMaterial();