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> |
0904aa63 |
19 | #include <Standard_Dump.hxx> |
a6eb515f |
20 | |
4e1bc39a |
21 | IMPLEMENT_STANDARD_RTTIEXT(Prs3d_DimensionAspect, Prs3d_BasicAspect) |
92efcf78 |
22 | |
a6eb515f |
23 | //======================================================================= |
24 | //function : Constructor |
4e1bc39a |
25 | //purpose : |
a6eb515f |
26 | //======================================================================= |
d7bffd44 |
27 | Prs3d_DimensionAspect::Prs3d_DimensionAspect() |
4e1bc39a |
28 | : myLineAspect (new Prs3d_LineAspect (Quantity_NOC_LAWNGREEN, Aspect_TOL_SOLID, 1.0)), |
29 | myTextAspect (new Prs3d_TextAspect()), |
30 | myArrowAspect (new Prs3d_ArrowAspect()), |
31 | myValueStringFormat ("%g"), |
32 | myExtensionSize (6.0), |
33 | myArrowTailSize (6.0), |
34 | myArrowOrientation (Prs3d_DAO_Fit), |
35 | myTextHPosition (Prs3d_DTHP_Fit), |
36 | myTextVPosition (Prs3d_DTVP_Center), |
37 | myToDisplayUnits (Standard_False), |
38 | myIsText3d (Standard_False), |
39 | myIsTextShaded (Standard_False), |
40 | myIsArrows3d (Standard_False) |
a6eb515f |
41 | { |
a6eb515f |
42 | myTextAspect->Aspect()->SetTextZoomable (Standard_False); |
43 | myTextAspect->SetColor (Quantity_NOC_LAWNGREEN); |
44 | myTextAspect->SetHorizontalJustification (Graphic3d_HTA_CENTER); |
4e1bc39a |
45 | myTextAspect->SetVerticalJustification (Graphic3d_VTA_CENTER); |
46 | |
a6eb515f |
47 | myArrowAspect->SetColor (Quantity_NOC_LAWNGREEN); |
0499eb06 |
48 | myArrowAspect->SetAngle (M_PI * 12.0 / 180.0); |
d7bffd44 |
49 | myArrowAspect->SetLength (6.0); |
a6eb515f |
50 | } |
51 | |
52 | //======================================================================= |
53 | //function : SetCommonColor |
54 | //purpose : Sets the same color for all parts of dimension: |
55 | // lines, arrows and text. |
56 | //======================================================================= |
a6eb515f |
57 | void Prs3d_DimensionAspect::SetCommonColor (const Quantity_Color& theColor) |
58 | { |
59 | myLineAspect->SetColor (theColor); |
60 | myTextAspect->SetColor (theColor); |
61 | myArrowAspect->SetColor (theColor); |
62 | } |
0904aa63 |
63 | |
64 | // ======================================================================= |
65 | // function : DumpJson |
66 | // purpose : |
67 | // ======================================================================= |
68 | void Prs3d_DimensionAspect::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const |
69 | { |
3de0f784 |
70 | OCCT_DUMP_CLASS_BEGIN (theOStream, Prs3d_DimensionAspect); |
0904aa63 |
71 | |
3de0f784 |
72 | OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myLineAspect.get()); |
73 | OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myTextAspect.get()); |
74 | OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myArrowAspect.get()); |
0904aa63 |
75 | |
3de0f784 |
76 | OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myValueStringFormat); |
77 | OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myExtensionSize); |
78 | OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myArrowTailSize); |
79 | OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myArrowOrientation); |
80 | OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myTextHPosition); |
81 | OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myTextVPosition); |
82 | OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myToDisplayUnits); |
83 | OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsText3d); |
84 | OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsTextShaded); |
85 | OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsArrows3d); |
0904aa63 |
86 | } |
87 | |