b311480e |
1 | // Created on: 1996-03-19 |
2 | // Created by: Flore Lantheaume |
3 | // Copyright (c) 1996-1999 Matra Datavision |
973c2be1 |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
5 | // |
973c2be1 |
6 | // This file is part of Open CASCADE Technology software library. |
b311480e |
7 | // |
d5f74e42 |
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 |
973c2be1 |
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. |
b311480e |
13 | // |
973c2be1 |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
7fd59977 |
16 | |
7fd59977 |
17 | |
42cf5bc1 |
18 | #include <DsgPrs.hxx> |
19 | #include <DsgPrs_Chamf2dPresentation.hxx> |
20 | #include <gp_Dir.hxx> |
21 | #include <gp_Pnt.hxx> |
b8ddfc2f |
22 | #include <Graphic3d_ArrayOfSegments.hxx> |
42cf5bc1 |
23 | #include <Graphic3d_Group.hxx> |
7fd59977 |
24 | #include <Prs3d_Arrow.hxx> |
25 | #include <Prs3d_ArrowAspect.hxx> |
a6eb515f |
26 | #include <Prs3d_DimensionAspect.hxx> |
42cf5bc1 |
27 | #include <Prs3d_LineAspect.hxx> |
28 | #include <Prs3d_Presentation.hxx> |
7fd59977 |
29 | #include <Prs3d_Text.hxx> |
42cf5bc1 |
30 | #include <TCollection_ExtendedString.hxx> |
7fd59977 |
31 | |
32 | void DsgPrs_Chamf2dPresentation::Add( |
33 | const Handle(Prs3d_Presentation)& aPresentation, |
34 | const Handle(Prs3d_Drawer)& aDrawer, |
35 | const gp_Pnt& aPntAttach, |
36 | const gp_Pnt& aPntEnd, |
37 | const TCollection_ExtendedString& aText) |
38 | { |
a6eb515f |
39 | Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect(); |
7fd59977 |
40 | |
b8ddfc2f |
41 | Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect()); |
7fd59977 |
42 | |
b8ddfc2f |
43 | Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(2); |
44 | aPrims->AddVertex(aPntAttach); |
45 | aPrims->AddVertex(aPntEnd); |
46 | Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims); |
7fd59977 |
47 | |
48 | gp_Dir ArrowDir(aPntAttach.XYZ()-aPntEnd.XYZ()); |
4ad142d9 |
49 | Prs3d_Arrow::Draw (Prs3d_Root::CurrentGroup (aPresentation), aPntAttach, ArrowDir, LA->ArrowAspect()->Angle(), LA->ArrowAspect()->Length()); |
7fd59977 |
50 | |
4ad142d9 |
51 | Prs3d_Text::Draw (Prs3d_Root::CurrentGroup (aPresentation), LA->TextAspect(), aText, aPntEnd); |
7fd59977 |
52 | } |
53 | |
54 | |
55 | //========================================================================== |
56 | // function : DsgPrs_Chamf2dPresentation::Add |
81bba717 |
57 | // purpose : it is possible to choose the symbol of extremities of the face (arrow, point ...) |
7fd59977 |
58 | //========================================================================== |
59 | |
60 | void DsgPrs_Chamf2dPresentation::Add( |
61 | const Handle(Prs3d_Presentation)& aPresentation, |
62 | const Handle(Prs3d_Drawer)& aDrawer, |
63 | const gp_Pnt& aPntAttach, |
64 | const gp_Pnt& aPntEnd, |
65 | const TCollection_ExtendedString& aText, |
66 | const DsgPrs_ArrowSide ArrowPrs) |
67 | { |
a6eb515f |
68 | Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect(); |
7fd59977 |
69 | |
b8ddfc2f |
70 | Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect()); |
7fd59977 |
71 | |
b8ddfc2f |
72 | Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(2); |
73 | aPrims->AddVertex(aPntAttach); |
74 | aPrims->AddVertex(aPntEnd); |
75 | Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims); |
7fd59977 |
76 | |
4ad142d9 |
77 | Prs3d_Text::Draw (Prs3d_Root::CurrentGroup (aPresentation), LA->TextAspect(), aText, aPntEnd); |
7fd59977 |
78 | |
79 | gp_Dir ArrowDir(aPntAttach.XYZ()-aPntEnd.XYZ()); |
7fd59977 |
80 | gp_Dir ArrowDir1 = ArrowDir; |
81 | ArrowDir1.Reverse(); |
82 | |
83 | DsgPrs::ComputeSymbol(aPresentation,LA,aPntEnd,aPntAttach,ArrowDir1,ArrowDir,ArrowPrs); |
7fd59977 |
84 | } |