0020716: Eliminate usage of "config.h" header file
[occt.git] / src / DrawTrSurf / DrawTrSurf_Polygon3D.cxx
1 // Created on: 1995-03-10
2 // Created by: Laurent PAINNOT
3 // Copyright (c) 1995-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 #include <DrawTrSurf_Polygon3D.ixx>
18 #include <Poly.hxx>
19 #include <Draw_Color.hxx>
20 #include <Draw_MarkerShape.hxx>
21
22
23 //=======================================================================
24 //function : DrawTrSurf_Polygon3D
25 //purpose  : 
26 //=======================================================================
27
28 DrawTrSurf_Polygon3D::DrawTrSurf_Polygon3D(const Handle(Poly_Polygon3D)& P):
29    myPolygon3D(P),
30    myNodes(Standard_False)
31 {
32   
33 }
34
35 //=======================================================================
36 //function : Polygon3D
37 //purpose  : 
38 //=======================================================================
39
40 Handle(Poly_Polygon3D) DrawTrSurf_Polygon3D::Polygon3D() const 
41 {
42   return myPolygon3D;
43 }
44
45 //=======================================================================
46 //function : ShowNodes
47 //purpose  : 
48 //=======================================================================
49
50 void DrawTrSurf_Polygon3D::ShowNodes(const Standard_Boolean B)
51 {
52   myNodes = B;
53 }
54
55 //=======================================================================
56 //function : ShowNodes
57 //purpose  : 
58 //=======================================================================
59
60 Standard_Boolean DrawTrSurf_Polygon3D::ShowNodes() const 
61 {
62   return myNodes;
63 }
64
65 //=======================================================================
66 //function : DrawOn
67 //purpose  : 
68 //=======================================================================
69
70 void DrawTrSurf_Polygon3D::DrawOn(Draw_Display& dis) const 
71 {
72   dis.SetColor(Draw_jaune);
73   
74   const TColgp_Array1OfPnt& Points = myPolygon3D->Nodes();
75
76   for (Standard_Integer i = Points.Lower(); i <= Points.Upper()-1; i++) {
77     dis.Draw(Points(i), Points(i+1));
78   }
79   
80
81   if (myNodes) {
82     for (Standard_Integer i = Points.Lower(); i <= Points.Upper(); i++) {
83       dis.DrawMarker(Points(i), Draw_X);
84     }
85   }
86
87 }
88
89 //=======================================================================
90 //function : Copy
91 //purpose  : 
92 //=======================================================================
93
94 Handle(Draw_Drawable3D) DrawTrSurf_Polygon3D::Copy() const 
95 {
96   return new DrawTrSurf_Polygon3D(myPolygon3D);
97 }
98
99 //=======================================================================
100 //function : Dump
101 //purpose  : 
102 //=======================================================================
103
104 void DrawTrSurf_Polygon3D::Dump(Standard_OStream& S) const 
105 {
106   Poly::Dump(myPolygon3D, S);
107 }
108
109 //=======================================================================
110 //function : Whatis
111 //purpose  : 
112 //=======================================================================
113
114 void DrawTrSurf_Polygon3D::Whatis(Draw_Interpretor& I) const 
115 {
116   I << "polygon3D";
117 }
118