b311480e |
1 | // Created on: 1997-02-10 |
2 | // Created by: Odile Olivier |
3 | // Copyright (c) 1997-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 | // |
973c2be1 |
8 | // This library is free software; you can redistribute it and / or modify it |
9 | // under the terms of the GNU Lesser General Public 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. |
b311480e |
13 | // |
973c2be1 |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
b311480e |
16 | |
7fd59977 |
17 | #include <DsgPrs_XYZAxisPresentation.ixx> |
18 | #include <Prs3d_Root.hxx> |
19 | #include <Prs3d_Arrow.hxx> |
20 | #include <Graphic3d_Group.hxx> |
b8ddfc2f |
21 | #include <Graphic3d_ArrayOfSegments.hxx> |
7fd59977 |
22 | |
23 | |
24 | //======================================================================= |
25 | //function : Add |
26 | //purpose : |
27 | //======================================================================= |
28 | |
29 | void DsgPrs_XYZAxisPresentation::Add( |
30 | const Handle(Prs3d_Presentation)& aPresentation, |
31 | const Handle(Prs3d_LineAspect)& aLineAspect, |
32 | const gp_Dir & aDir, |
33 | const Standard_Real aVal, |
34 | const Standard_CString aText, |
35 | const gp_Pnt& aPfirst, |
36 | const gp_Pnt& aPlast) |
37 | { |
b8ddfc2f |
38 | Handle(Graphic3d_Group) G = Prs3d_Root::CurrentGroup(aPresentation); |
39 | G->SetPrimitivesAspect(aLineAspect->Aspect()); |
7fd59977 |
40 | |
b8ddfc2f |
41 | Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(2); |
42 | aPrims->AddVertex(aPfirst); |
43 | aPrims->AddVertex(aPlast); |
44 | G->AddPrimitiveArray(aPrims); |
7fd59977 |
45 | |
b8ddfc2f |
46 | Prs3d_Arrow::Draw(aPresentation,aPlast,aDir,M_PI/180.*10.,aVal/10.); |
7fd59977 |
47 | |
b8ddfc2f |
48 | Graphic3d_Vertex a2(aPlast.X(),aPlast.Y(),aPlast.Z()); |
49 | Prs3d_Root::CurrentGroup(aPresentation)->Text(aText,a2,1./81.); |
7fd59977 |
50 | } |
51 | |
52 | |
53 | void DsgPrs_XYZAxisPresentation::Add(const Handle(Prs3d_Presentation)& aPresentation, |
54 | const Handle(Prs3d_LineAspect)& aLineAspect, |
55 | const Handle(Prs3d_ArrowAspect)& anArrowAspect, |
56 | const Handle(Prs3d_TextAspect)& aTextAspect, |
57 | const gp_Dir & aDir, |
58 | const Standard_Real aVal, |
59 | const Standard_CString aText, |
60 | const gp_Pnt& aPfirst, |
61 | const gp_Pnt& aPlast) |
62 | { |
7fd59977 |
63 | Handle(Graphic3d_Group) G = Prs3d_Root::CurrentGroup(aPresentation); |
7fd59977 |
64 | G->SetPrimitivesAspect(aLineAspect->Aspect()); |
b8ddfc2f |
65 | |
66 | Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(2); |
67 | aPrims->AddVertex(aPfirst); |
68 | aPrims->AddVertex(aPlast); |
69 | G->AddPrimitiveArray(aPrims); |
70 | |
7fd59977 |
71 | G->SetPrimitivesAspect( anArrowAspect->Aspect() ); |
b8ddfc2f |
72 | Prs3d_Arrow::Draw(aPresentation,aPlast,aDir,M_PI/180.*10.,aVal/10.); |
73 | |
7fd59977 |
74 | G->SetPrimitivesAspect(aTextAspect->Aspect()); |
b8ddfc2f |
75 | Graphic3d_Vertex a2(aPlast.X(),aPlast.Y(),aPlast.Z()); |
76 | Prs3d_Root::CurrentGroup(aPresentation)->Text(aText,a2,1./81.); |
7fd59977 |
77 | } |