summaryrefslogtreecommitdiff
path: root/src/DrawTrSurf/DrawTrSurf_Polygon2D.cxx
blob: 5ad352ed714060f8d62f718b7d1b8911ba1ffa42 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
// File:	DrawTrSurf_Polygon2D.cxx
// Created:	Tue Mar 14 16:13:44 1995
// Author:	Laurent PAINNOT
//		<lpa@metrox>


#include <DrawTrSurf_Polygon2D.ixx>
#include <Poly.hxx>
#include <Draw_Color.hxx>
#include <Draw_MarkerShape.hxx>

//=======================================================================
//function : DrawTrSurf_Polygon2D
//purpose  : 
//=======================================================================

DrawTrSurf_Polygon2D::DrawTrSurf_Polygon2D(const Handle(Poly_Polygon2D)& P):
   myPolygon2D(P),
   myNodes(Standard_False)
{
}

//=======================================================================
//function : Polygon2D
//purpose  : 
//=======================================================================

Handle(Poly_Polygon2D) DrawTrSurf_Polygon2D::Polygon2D() const 
{
  return myPolygon2D;
}

//=======================================================================
//function : ShowNodes
//purpose  : 
//=======================================================================

void DrawTrSurf_Polygon2D::ShowNodes(const Standard_Boolean B)
{
  myNodes = B;
}

//=======================================================================
//function : ShowNodes
//purpose  : 
//=======================================================================

Standard_Boolean DrawTrSurf_Polygon2D::ShowNodes() const 
{
  return myNodes;
}

//=======================================================================
//function : DrawOn
//purpose  : 
//=======================================================================

void DrawTrSurf_Polygon2D::DrawOn(Draw_Display& dis) const 
{
  dis.SetColor(Draw_jaune);

  
  const TColgp_Array1OfPnt2d& Points = myPolygon2D->Nodes();

  for (Standard_Integer i = Points.Lower(); i <= Points.Upper()-1; i++) {
    dis.Draw(Points(i), Points(i+1));
  }
  

  if (myNodes) { 
    for (Standard_Integer i = Points.Lower(); i <= Points.Upper(); i++) {
      dis.DrawMarker(Points(i), Draw_X);
    }
  }

}

//=======================================================================
//function : Copy
//purpose  : 
//=======================================================================

Handle(Draw_Drawable3D) DrawTrSurf_Polygon2D::Copy() const 
{
  return new DrawTrSurf_Polygon2D(myPolygon2D);
}

//=======================================================================
//function : Dump
//purpose  : 
//=======================================================================

void DrawTrSurf_Polygon2D::Dump(Standard_OStream& S) const 
{
  Poly::Dump(myPolygon2D, S);
}

//=======================================================================
//function : Whatis
//purpose  : 
//=======================================================================

void DrawTrSurf_Polygon2D::Whatis(Draw_Interpretor& I) const 
{
  I << "polygon2D";
}