0024002: Overall code and build procedure refactoring -- automatic
[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
42cf5bc1 17
7fd59977 18#include <Draw_Color.hxx>
42cf5bc1 19#include <Draw_Display.hxx>
20#include <Draw_Drawable3D.hxx>
7fd59977 21#include <Draw_MarkerShape.hxx>
42cf5bc1 22#include <DrawTrSurf_Polygon2D.hxx>
23#include <Poly.hxx>
24#include <Poly_Polygon2D.hxx>
25#include <Standard_Type.hxx>
7fd59977 26
27//=======================================================================
28//function : DrawTrSurf_Polygon2D
29//purpose :
30//=======================================================================
7fd59977 31DrawTrSurf_Polygon2D::DrawTrSurf_Polygon2D(const Handle(Poly_Polygon2D)& P):
32 myPolygon2D(P),
33 myNodes(Standard_False)
34{
35}
36
37//=======================================================================
38//function : Polygon2D
39//purpose :
40//=======================================================================
41
42Handle(Poly_Polygon2D) DrawTrSurf_Polygon2D::Polygon2D() const
43{
44 return myPolygon2D;
45}
46
47//=======================================================================
48//function : ShowNodes
49//purpose :
50//=======================================================================
51
52void DrawTrSurf_Polygon2D::ShowNodes(const Standard_Boolean B)
53{
54 myNodes = B;
55}
56
57//=======================================================================
58//function : ShowNodes
59//purpose :
60//=======================================================================
61
62Standard_Boolean DrawTrSurf_Polygon2D::ShowNodes() const
63{
64 return myNodes;
65}
66
67//=======================================================================
68//function : DrawOn
69//purpose :
70//=======================================================================
71
72void DrawTrSurf_Polygon2D::DrawOn(Draw_Display& dis) const
73{
74 dis.SetColor(Draw_jaune);
75
76
77 const TColgp_Array1OfPnt2d& Points = myPolygon2D->Nodes();
78
79 for (Standard_Integer i = Points.Lower(); i <= Points.Upper()-1; i++) {
80 dis.Draw(Points(i), Points(i+1));
81 }
82
83
84 if (myNodes) {
85 for (Standard_Integer i = Points.Lower(); i <= Points.Upper(); i++) {
86 dis.DrawMarker(Points(i), Draw_X);
87 }
88 }
89
90}
91
92//=======================================================================
93//function : Copy
94//purpose :
95//=======================================================================
96
97Handle(Draw_Drawable3D) DrawTrSurf_Polygon2D::Copy() const
98{
99 return new DrawTrSurf_Polygon2D(myPolygon2D);
100}
101
102//=======================================================================
103//function : Dump
104//purpose :
105//=======================================================================
106
107void DrawTrSurf_Polygon2D::Dump(Standard_OStream& S) const
108{
109 Poly::Dump(myPolygon2D, S);
110}
111
112//=======================================================================
113//function : Whatis
114//purpose :
115//=======================================================================
116
117void DrawTrSurf_Polygon2D::Whatis(Draw_Interpretor& I) const
118{
119 I << "polygon2D";
120}
121