0024002: Overall code and build procedure refactoring -- automatic
[occt.git] / src / Prs3d / Prs3d_ArrowAspect.cxx
1 // Copyright (c) 1995-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
16 #include <Graphic3d_AspectLine3d.hxx>
17 #include <Prs3d_ArrowAspect.hxx>
18 #include <Prs3d_InvalidAngle.hxx>
19 #include <Quantity_Color.hxx>
20 #include <Standard_Type.hxx>
21
22 Prs3d_ArrowAspect::Prs3d_ArrowAspect () 
23      : myAngle(M_PI/180.*10), myLength(1.) {
24   myArrowAspect = 
25         new Graphic3d_AspectLine3d (
26                 Quantity_Color(Quantity_NOC_WHITE), Aspect_TOL_SOLID, 1.0);
27 }
28
29
30 Prs3d_ArrowAspect::Prs3d_ArrowAspect (const Quantity_PlaneAngle anAngle,
31                                       const Quantity_Length aLength) 
32      : myAngle(anAngle), myLength(aLength) {
33   myArrowAspect = 
34         new Graphic3d_AspectLine3d (
35                 Quantity_Color(Quantity_NOC_WHITE), Aspect_TOL_SOLID, 1.0);
36 }
37
38 Prs3d_ArrowAspect::Prs3d_ArrowAspect( const Handle( Graphic3d_AspectLine3d )& theAspect )
39   : myAngle(M_PI/180.*10), myLength(1.)
40 {
41   myArrowAspect = theAspect;
42 }
43
44 void Prs3d_ArrowAspect::SetAngle ( const Quantity_PlaneAngle anAngle) {
45   Prs3d_InvalidAngle_Raise_if ( anAngle <= 0.  ||
46                               anAngle >= M_PI /2. , "");
47   myAngle = anAngle;
48 }
49 Quantity_PlaneAngle Prs3d_ArrowAspect::Angle () const
50 {
51 return myAngle;
52 }
53
54 void Prs3d_ArrowAspect::SetLength ( const Quantity_Length aLength)
55 {
56   myLength = aLength;
57 }
58 Quantity_Length Prs3d_ArrowAspect::Length () const
59 {
60 return myLength;
61 }
62
63
64 void Prs3d_ArrowAspect::SetColor(const Quantity_Color &aColor) {
65   myArrowAspect->SetColor(aColor);
66 }
67
68 void Prs3d_ArrowAspect::SetColor(const Quantity_NameOfColor aColor) {
69   SetColor(Quantity_Color(aColor));
70 }
71
72 Handle(Graphic3d_AspectLine3d) Prs3d_ArrowAspect::Aspect() const {
73   return myArrowAspect;
74 }
75
76
77 void Prs3d_ArrowAspect::SetAspect( const Handle( Graphic3d_AspectLine3d )& theAspect )
78 {
79   myArrowAspect = theAspect;
80 }
81