0027958: Visualization, AIS_Trihedron - add shaded presentation option
[occt.git] / src / Prs3d / Prs3d_DimensionAspect.cxx
1 // Copyright (c) 1998-1999 Matra Datavision
2 // Copyright (c) 1999-2014 OPEN CASCADE SAS
3 //
4 // This file is part of Open CASCADE Technology software library.
5 //
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License version 2.1 as published
8 // by the Free Software Foundation, with special exception defined in the file
9 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10 // distribution for complete text of the license and disclaimer of any warranty.
11 //
12 // Alternatively, this file may be used under the terms of Open CASCADE
13 // commercial license or contractual agreement.
14
15 #include <Prs3d_DimensionAspect.hxx>
16
17 #include <Aspect_TypeOfLine.hxx>
18 #include <Graphic3d_AspectText3d.hxx>
19
20 IMPLEMENT_STANDARD_RTTIEXT(Prs3d_DimensionAspect, Prs3d_BasicAspect)
21
22 //=======================================================================
23 //function : Constructor
24 //purpose  :
25 //=======================================================================
26 Prs3d_DimensionAspect::Prs3d_DimensionAspect()
27 : myLineAspect        (new Prs3d_LineAspect (Quantity_NOC_LAWNGREEN, Aspect_TOL_SOLID, 1.0)),
28   myTextAspect        (new Prs3d_TextAspect()),
29   myArrowAspect       (new Prs3d_ArrowAspect()),
30   myValueStringFormat ("%g"),
31   myExtensionSize     (6.0),
32   myArrowTailSize     (6.0),
33   myArrowOrientation  (Prs3d_DAO_Fit),
34   myTextHPosition     (Prs3d_DTHP_Fit),
35   myTextVPosition     (Prs3d_DTVP_Center),
36   myToDisplayUnits    (Standard_False),
37   myIsText3d          (Standard_False),
38   myIsTextShaded      (Standard_False),
39   myIsArrows3d        (Standard_False)
40 {
41   myTextAspect->Aspect()->SetTextZoomable (Standard_False);
42   myTextAspect->SetColor (Quantity_NOC_LAWNGREEN);
43   myTextAspect->SetHorizontalJustification (Graphic3d_HTA_CENTER);
44   myTextAspect->SetVerticalJustification   (Graphic3d_VTA_CENTER);
45   
46   myArrowAspect->SetColor (Quantity_NOC_LAWNGREEN);
47   myArrowAspect->SetAngle (M_PI * 12.0 / 180.0);
48   myArrowAspect->SetLength (6.0);
49 }
50
51 //=======================================================================
52 //function : SetCommonColor
53 //purpose  : Sets the same color for all parts of dimension:
54 //           lines, arrows and text.
55 //=======================================================================
56 void Prs3d_DimensionAspect::SetCommonColor (const Quantity_Color& theColor)
57 {
58   myLineAspect->SetColor (theColor);
59   myTextAspect->SetColor (theColor);
60   myArrowAspect->SetColor (theColor);
61 }