a6eb515f |
1 | // Copyright (c) 1998-1999 Matra Datavision |
973c2be1 |
2 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
a6eb515f |
3 | // |
973c2be1 |
4 | // This file is part of Open CASCADE Technology software library. |
a6eb515f |
5 | // |
d5f74e42 |
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 |
973c2be1 |
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. |
a6eb515f |
11 | // |
973c2be1 |
12 | // Alternatively, this file may be used under the terms of Open CASCADE |
13 | // commercial license or contractual agreement. |
a6eb515f |
14 | |
15 | #include <Prs3d_DimensionAspect.hxx> |
16 | |
17 | #include <Aspect_TypeOfLine.hxx> |
18 | #include <Graphic3d_AspectText3d.hxx> |
a6eb515f |
19 | |
4e1bc39a |
20 | IMPLEMENT_STANDARD_RTTIEXT(Prs3d_DimensionAspect, Prs3d_BasicAspect) |
92efcf78 |
21 | |
a6eb515f |
22 | //======================================================================= |
23 | //function : Constructor |
4e1bc39a |
24 | //purpose : |
a6eb515f |
25 | //======================================================================= |
d7bffd44 |
26 | Prs3d_DimensionAspect::Prs3d_DimensionAspect() |
4e1bc39a |
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) |
a6eb515f |
40 | { |
a6eb515f |
41 | myTextAspect->Aspect()->SetTextZoomable (Standard_False); |
42 | myTextAspect->SetColor (Quantity_NOC_LAWNGREEN); |
43 | myTextAspect->SetHorizontalJustification (Graphic3d_HTA_CENTER); |
4e1bc39a |
44 | myTextAspect->SetVerticalJustification (Graphic3d_VTA_CENTER); |
45 | |
a6eb515f |
46 | myArrowAspect->SetColor (Quantity_NOC_LAWNGREEN); |
0499eb06 |
47 | myArrowAspect->SetAngle (M_PI * 12.0 / 180.0); |
d7bffd44 |
48 | myArrowAspect->SetLength (6.0); |
a6eb515f |
49 | } |
50 | |
51 | //======================================================================= |
52 | //function : SetCommonColor |
53 | //purpose : Sets the same color for all parts of dimension: |
54 | // lines, arrows and text. |
55 | //======================================================================= |
a6eb515f |
56 | void Prs3d_DimensionAspect::SetCommonColor (const Quantity_Color& theColor) |
57 | { |
58 | myLineAspect->SetColor (theColor); |
59 | myTextAspect->SetColor (theColor); |
60 | myArrowAspect->SetColor (theColor); |
61 | } |