0024162: Eliminate CLang compiler warning
[occt.git] / src / DsgPrs / DsgPrs_XYZAxisPresentation.cxx
1 // Created on: 1997-02-10
2 // Created by: Odile Olivier
3 // Copyright (c) 1997-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
21 #include <DsgPrs_XYZAxisPresentation.ixx>
22 #include <Prs3d_Root.hxx>
23 #include <Prs3d_Arrow.hxx>
24 #include <Graphic3d_Group.hxx>
25 #include <Graphic3d_ArrayOfSegments.hxx>
26
27
28 //=======================================================================
29 //function : Add
30 //purpose  : 
31 //=======================================================================
32
33 void DsgPrs_XYZAxisPresentation::Add(
34                        const Handle(Prs3d_Presentation)& aPresentation,
35                        const Handle(Prs3d_LineAspect)& aLineAspect,          
36                        const gp_Dir & aDir, 
37                        const Standard_Real aVal,
38                        const Standard_CString aText,
39                        const gp_Pnt& aPfirst,
40                        const gp_Pnt& aPlast)
41 {
42   Handle(Graphic3d_Group) G = Prs3d_Root::CurrentGroup(aPresentation);
43   G->SetPrimitivesAspect(aLineAspect->Aspect());
44
45   Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(2);
46   aPrims->AddVertex(aPfirst);
47   aPrims->AddVertex(aPlast);
48   G->AddPrimitiveArray(aPrims);
49  
50   Prs3d_Arrow::Draw(aPresentation,aPlast,aDir,M_PI/180.*10.,aVal/10.);
51
52   Graphic3d_Vertex a2(aPlast.X(),aPlast.Y(),aPlast.Z());
53   Prs3d_Root::CurrentGroup(aPresentation)->Text(aText,a2,1./81.);
54 }
55
56
57 void DsgPrs_XYZAxisPresentation::Add(const Handle(Prs3d_Presentation)& aPresentation,
58                                      const Handle(Prs3d_LineAspect)& aLineAspect,
59                                      const Handle(Prs3d_ArrowAspect)& anArrowAspect,
60                                      const Handle(Prs3d_TextAspect)& aTextAspect,
61                                      const gp_Dir & aDir, 
62                                      const Standard_Real aVal,
63                                      const Standard_CString aText,
64                                      const gp_Pnt& aPfirst,
65                                      const gp_Pnt& aPlast)
66 {
67   Handle(Graphic3d_Group) G = Prs3d_Root::CurrentGroup(aPresentation);
68   G->SetPrimitivesAspect(aLineAspect->Aspect());
69
70   Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(2);
71   aPrims->AddVertex(aPfirst);
72   aPrims->AddVertex(aPlast);
73   G->AddPrimitiveArray(aPrims);
74
75   G->SetPrimitivesAspect( anArrowAspect->Aspect() );
76   Prs3d_Arrow::Draw(aPresentation,aPlast,aDir,M_PI/180.*10.,aVal/10.);
77
78   G->SetPrimitivesAspect(aTextAspect->Aspect());
79   Graphic3d_Vertex a2(aPlast.X(),aPlast.Y(),aPlast.Z());
80   Prs3d_Root::CurrentGroup(aPresentation)->Text(aText,a2,1./81.);
81 }