42cf5bc1 |
1 | // Created on: 1993-04-26 |
2 | // Created by: Jean-Louis Frenkel |
3 | // Copyright (c) 1993-1999 Matra Datavision |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
5 | // |
6 | // This file is part of Open CASCADE Technology software library. |
7 | // |
8 | // This library is free software; you can redistribute it and/or modify it under |
9 | // the terms of the GNU Lesser General Public License version 2.1 as published |
10 | // by the Free Software Foundation, with special exception defined in the file |
11 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
12 | // distribution for complete text of the license and disclaimer of any warranty. |
13 | // |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
16 | |
17 | #ifndef _Prs3d_LineAspect_HeaderFile |
18 | #define _Prs3d_LineAspect_HeaderFile |
19 | |
42cf5bc1 |
20 | #include <Aspect_TypeOfLine.hxx> |
5b111128 |
21 | #include <Graphic3d_AspectLine3d.hxx> |
4e1bc39a |
22 | #include <Prs3d_BasicAspect.hxx> |
23 | #include <Quantity_Color.hxx> |
42cf5bc1 |
24 | |
25 | //! A framework for defining how a line will be displayed |
26 | //! in a presentation. Aspects of line display include |
27 | //! width, color and type of line. |
28 | //! The definition set by this class is then passed to the |
29 | //! attribute manager Prs3d_Drawer. |
30 | //! Any object which requires a value for line aspect as |
31 | //! an argument may then be given the attribute manager |
32 | //! as a substitute argument in the form of a field such as myDrawer for example. |
33 | class Prs3d_LineAspect : public Prs3d_BasicAspect |
34 | { |
4e1bc39a |
35 | DEFINE_STANDARD_RTTIEXT(Prs3d_LineAspect, Prs3d_BasicAspect) |
42cf5bc1 |
36 | public: |
42cf5bc1 |
37 | |
38 | //! Constructs a framework for line aspect defined by |
39 | //! - the color aColor |
40 | //! - the type of line aType and |
41 | //! - the line thickness aWidth. |
42 | //! Type of line refers to whether the line is solid or dotted, for example. |
4e1bc39a |
43 | Standard_EXPORT Prs3d_LineAspect (const Quantity_NameOfColor theColor, const Aspect_TypeOfLine theType, const Standard_Real theWidth); |
42cf5bc1 |
44 | |
4e1bc39a |
45 | Standard_EXPORT Prs3d_LineAspect (const Quantity_Color& theColor, const Aspect_TypeOfLine theType, const Standard_Real theWidth); |
42cf5bc1 |
46 | |
4e1bc39a |
47 | Prs3d_LineAspect(const Handle(Graphic3d_AspectLine3d)& theAspect) : myAspect (theAspect) {} |
48 | |
49 | void SetColor (const Quantity_Color& theColor) { myAspect->SetColor (theColor); } |
42cf5bc1 |
50 | |
51 | //! Sets the line color defined at the time of construction. |
52 | //! Default value: Quantity_NOC_YELLOW |
4e1bc39a |
53 | void SetColor (const Quantity_NameOfColor theColor) { myAspect->SetColor (Quantity_Color (theColor)); } |
42cf5bc1 |
54 | |
55 | //! Sets the type of line defined at the time of construction. |
56 | //! This could, for example, be solid, dotted or made up of dashes. |
57 | //! Default value: Aspect_TOL_SOLID |
4e1bc39a |
58 | void SetTypeOfLine (const Aspect_TypeOfLine theType) { myAspect->SetType (theType); } |
42cf5bc1 |
59 | |
60 | //! Sets the line width defined at the time of construction. |
61 | //! Default value: 1. |
4e1bc39a |
62 | void SetWidth (const Standard_Real theWidth) { myAspect->SetWidth (theWidth); } |
63 | |
42cf5bc1 |
64 | //! Returns the line aspect. This is defined as the set of |
65 | //! color, type and thickness attributes. |
4e1bc39a |
66 | const Handle(Graphic3d_AspectLine3d)& Aspect() const { return myAspect; } |
42cf5bc1 |
67 | |
4e1bc39a |
68 | void SetAspect (const Handle(Graphic3d_AspectLine3d)& theAspect) { myAspect = theAspect; } |
42cf5bc1 |
69 | |
70 | protected: |
71 | |
42cf5bc1 |
72 | Handle(Graphic3d_AspectLine3d) myAspect; |
73 | |
42cf5bc1 |
74 | }; |
75 | |
4e1bc39a |
76 | DEFINE_STANDARD_HANDLE(Prs3d_LineAspect, Prs3d_BasicAspect) |
42cf5bc1 |
77 | |
78 | #endif // _Prs3d_LineAspect_HeaderFile |