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