1 // Created on: 1997-02-10
2 // Created by: Robert COUBLANC
3 // Copyright (c) 1997-1999 Matra Datavision
4 // Copyright (c) 1999-2012 OPEN CASCADE SAS
6 // The content of this file is subject to the Open CASCADE Technology Public
7 // License Version 6.5 (the "License"). You may not use the content of this file
8 // except in compliance with the License. Please obtain a copy of the License
9 // at http://www.opencascade.org and read it completely before using this file.
11 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
14 // The Original Code and all software distributed under the License is
15 // distributed on an "AS IS" basis, without warranty of any kind, and the
16 // Initial Developer hereby disclaims all such warranties, including without
17 // limitation, any warranties of merchantability, fitness for a particular
18 // purpose or non-infringement. Please see the License for the specific terms
19 // and conditions governing the rights and limitations under the License.
22 #define GER61351 //GG_171199 Enable to get an object RGB color
23 // instead a restricted object NameOfColor.
27 #include <AIS_GraphicTool.ixx>
30 #include <Quantity_Color.hxx>
31 #include <Prs3d_LineAspect.hxx>
32 #include <Aspect_AspectLine.hxx>
33 #include <Graphic3d_AspectLine3d.hxx>
34 #include <Prs3d_AngleAspect.hxx>
35 #include <Prs3d_PlaneAspect.hxx>
36 #include <Prs3d_DatumAspect.hxx>
37 #include <Graphic3d_AspectFillArea3d.hxx>
38 #include <Aspect_InteriorStyle.hxx>
40 #include <Prs3d_ShadingAspect.hxx>
43 static Handle(Prs3d_LineAspect) GetLineAspect(const Handle(Prs3d_Drawer)& Dr,
44 const AIS_TypeOfAttribute Att)
48 return Dr->LineAspect();
51 return Dr->AngleAspect()->LineAspect();
54 return Dr->WireAspect();
57 return Dr->PlaneAspect()->EdgesAspect();
60 return Dr->VectorAspect();
63 return Dr->UIsoAspect();
66 return Dr->VIsoAspect();
69 return Dr->FreeBoundaryAspect();
72 return Dr->UnFreeBoundaryAspect();
75 return Dr->SectionAspect();
78 return Dr->HiddenLineAspect();
81 return Dr->SeenLineAspect();
83 case AIS_TOA_FirstAxis:
84 return Dr->DatumAspect()->FirstAxisAspect();
85 case AIS_TOA_SecondAxis:
86 return Dr->DatumAspect()->SecondAxisAspect();
87 case AIS_TOA_ThirdAxis:
88 return Dr->DatumAspect()->SecondAxisAspect();
90 Handle(Prs3d_LineAspect) bid;
94 Quantity_NameOfColor AIS_GraphicTool::GetLineColor (const Handle(Prs3d_Drawer)& Dr, const AIS_TypeOfAttribute Att)
98 GetLineColor(Dr,Att,color);
102 void AIS_GraphicTool::GetLineColor (const Handle(Prs3d_Drawer)& Dr, const AIS_TypeOfAttribute Att, Quantity_Color &aColor)
106 Aspect_TypeOfLine TYP;
108 Handle(Prs3d_LineAspect) LA = GetLineAspect(Dr,Att);
111 LA->Aspect()->Values(aColor,TYP,W);
114 LA->Aspect()->Values(QCol,TYP,W);
119 Standard_Real AIS_GraphicTool::GetLineWidth (const Handle(Prs3d_Drawer)& Dr,
120 const AIS_TypeOfAttribute Att)
122 // Quantity_NameOfColor Col;
124 Aspect_TypeOfLine TYP;
126 Handle(Prs3d_LineAspect) LA = GetLineAspect(Dr,Att);
129 LA->Aspect()->Values(QCol,TYP,W);
132 Aspect_TypeOfLine AIS_GraphicTool::GetLineType (const Handle(Prs3d_Drawer)& Dr,
133 const AIS_TypeOfAttribute Att)
135 // Quantity_NameOfColor Col;
137 Aspect_TypeOfLine TYP;
139 Handle(Prs3d_LineAspect) LA = GetLineAspect(Dr,Att);
142 LA->Aspect()->Values(QCol,TYP,W);
147 void AIS_GraphicTool::GetLineAtt(const Handle(Prs3d_Drawer)& Dr,
148 const AIS_TypeOfAttribute Att,
149 Quantity_NameOfColor& Col,
151 Aspect_TypeOfLine& TYP)
154 Handle(Prs3d_LineAspect) LA = GetLineAspect(Dr,Att);
157 LA->Aspect()->Values(QCol,TYP,W);
161 Quantity_NameOfColor AIS_GraphicTool::GetInteriorColor(const Handle(Prs3d_Drawer)& Dr)
164 Quantity_Color color;
165 GetInteriorColor(Dr,color);
169 void AIS_GraphicTool::GetInteriorColor(const Handle(Prs3d_Drawer)& Dr, Quantity_Color &aColor)
172 Handle(Graphic3d_AspectFillArea3d) AFA = Dr->ShadingAspect()->Aspect();
173 Aspect_InteriorStyle IS;
178 AFA->Values(IS,aColor,EC,T,W);
180 Quantity_Color IC,EC;
181 AFA->Values(IS,IC,EC,T,W);
186 Graphic3d_MaterialAspect AIS_GraphicTool::GetMaterial(const Handle(Prs3d_Drawer)& Dr)
188 return Dr->ShadingAspect()->Aspect()->BackMaterial();