1 // Copyright (c) 1998-1999 Matra Datavision
2 // Copyright (c) 1999-2014 OPEN CASCADE SAS
4 // This file is part of Open CASCADE Technology software library.
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.
12 // Alternatively, this file may be used under the terms of Open CASCADE
13 // commercial license or contractual agreement.
15 #include <Prs3d_DimensionAspect.hxx>
17 #include <Aspect_TypeOfLine.hxx>
18 #include <Graphic3d_AspectText3d.hxx>
20 IMPLEMENT_STANDARD_RTTIEXT(Prs3d_DimensionAspect, Prs3d_BasicAspect)
22 //=======================================================================
23 //function : Constructor
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)
41 myTextAspect->Aspect()->SetTextZoomable (Standard_False);
42 myTextAspect->SetColor (Quantity_NOC_LAWNGREEN);
43 myTextAspect->SetHorizontalJustification (Graphic3d_HTA_CENTER);
44 myTextAspect->SetVerticalJustification (Graphic3d_VTA_CENTER);
46 myArrowAspect->SetColor (Quantity_NOC_LAWNGREEN);
47 myArrowAspect->SetAngle (M_PI * 12.0 / 180.0);
48 myArrowAspect->SetLength (6.0);
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)
58 myLineAspect->SetColor (theColor);
59 myTextAspect->SetColor (theColor);
60 myArrowAspect->SetColor (theColor);