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