b311480e |
1 | // Created on: 1996-03-19 |
2 | // Created by: Flore Lantheaume |
3 | // Copyright (c) 1996-1999 Matra Datavision |
4 | // Copyright (c) 1999-2012 OPEN CASCADE SAS |
5 | // |
6 | // The content of this file is subject to the Open CASCADE Technology Public |
7 | // License Version 6.5 (the "License"). You may not use the content of this file |
8 | // except in compliance with the License. Please obtain a copy of the License |
9 | // at http://www.opencascade.org and read it completely before using this file. |
10 | // |
11 | // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its |
12 | // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. |
13 | // |
14 | // The Original Code and all software distributed under the License is |
15 | // distributed on an "AS IS" basis, without warranty of any kind, and the |
16 | // Initial Developer hereby disclaims all such warranties, including without |
17 | // limitation, any warranties of merchantability, fitness for a particular |
18 | // purpose or non-infringement. Please see the License for the specific terms |
19 | // and conditions governing the rights and limitations under the License. |
20 | |
7fd59977 |
21 | |
22 | |
23 | #include <DsgPrs_Chamf2dPresentation.ixx> |
24 | |
25 | #include <Graphic3d_Group.hxx> |
b8ddfc2f |
26 | #include <Graphic3d_ArrayOfSegments.hxx> |
7fd59977 |
27 | #include <Prs3d_Arrow.hxx> |
28 | #include <Prs3d_ArrowAspect.hxx> |
29 | #include <Prs3d_LineAspect.hxx> |
30 | #include <Prs3d_LengthAspect.hxx> |
31 | #include <Prs3d_Text.hxx> |
32 | |
33 | #include <gp_Dir.hxx> |
34 | #include <gp_Pnt.hxx> |
35 | |
36 | #include <DsgPrs.hxx> |
37 | |
38 | void DsgPrs_Chamf2dPresentation::Add( |
39 | const Handle(Prs3d_Presentation)& aPresentation, |
40 | const Handle(Prs3d_Drawer)& aDrawer, |
41 | const gp_Pnt& aPntAttach, |
42 | const gp_Pnt& aPntEnd, |
43 | const TCollection_ExtendedString& aText) |
44 | { |
45 | Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect(); |
46 | |
b8ddfc2f |
47 | Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect()); |
7fd59977 |
48 | |
b8ddfc2f |
49 | Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(2); |
50 | aPrims->AddVertex(aPntAttach); |
51 | aPrims->AddVertex(aPntEnd); |
52 | Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims); |
7fd59977 |
53 | |
54 | gp_Dir ArrowDir(aPntAttach.XYZ()-aPntEnd.XYZ()); |
b8ddfc2f |
55 | Prs3d_Arrow::Draw(aPresentation,aPntAttach,ArrowDir,LA->Arrow1Aspect()->Angle(),LA->Arrow1Aspect()->Length()); |
7fd59977 |
56 | |
57 | Prs3d_Text::Draw(aPresentation,LA->TextAspect(),aText,aPntEnd); |
7fd59977 |
58 | } |
59 | |
60 | |
61 | //========================================================================== |
62 | // function : DsgPrs_Chamf2dPresentation::Add |
81bba717 |
63 | // purpose : it is possible to choose the symbol of extremities of the face (arrow, point ...) |
7fd59977 |
64 | //========================================================================== |
65 | |
66 | void DsgPrs_Chamf2dPresentation::Add( |
67 | const Handle(Prs3d_Presentation)& aPresentation, |
68 | const Handle(Prs3d_Drawer)& aDrawer, |
69 | const gp_Pnt& aPntAttach, |
70 | const gp_Pnt& aPntEnd, |
71 | const TCollection_ExtendedString& aText, |
72 | const DsgPrs_ArrowSide ArrowPrs) |
73 | { |
74 | Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect(); |
75 | |
b8ddfc2f |
76 | Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect()); |
7fd59977 |
77 | |
b8ddfc2f |
78 | Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(2); |
79 | aPrims->AddVertex(aPntAttach); |
80 | aPrims->AddVertex(aPntEnd); |
81 | Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims); |
7fd59977 |
82 | |
83 | Prs3d_Text::Draw(aPresentation,LA->TextAspect(),aText,aPntEnd); |
84 | |
85 | gp_Dir ArrowDir(aPntAttach.XYZ()-aPntEnd.XYZ()); |
7fd59977 |
86 | gp_Dir ArrowDir1 = ArrowDir; |
87 | ArrowDir1.Reverse(); |
88 | |
89 | DsgPrs::ComputeSymbol(aPresentation,LA,aPntEnd,aPntAttach,ArrowDir1,ArrowDir,ArrowPrs); |
7fd59977 |
90 | } |