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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
|
// File: HLRTest_DrawablePolyEdgeTool.cxx
// Created: Wed Oct 14 11:16:16 1992
// Author: Christophe MARION
// <cma@sdsun1>
// Modified by cma, Mon Oct 23 16:11:46 1995
#include <HLRTest_DrawablePolyEdgeTool.ixx>
#include <HLRBRep_BiPoint.hxx>
#include <HLRBRep_ListIteratorOfListOfBPoint.hxx>
#include <HLRAlgo_EdgeStatus.hxx>
#include <HLRAlgo_EdgeIterator.hxx>
#include <Draw_Color.hxx>
#include <OSD_Chronometer.hxx>
#define PntX1 ((Standard_Real*)Coordinates)[0]
#define PntY1 ((Standard_Real*)Coordinates)[1]
#define PntZ1 ((Standard_Real*)Coordinates)[2]
#define PntX2 ((Standard_Real*)Coordinates)[3]
#define PntY2 ((Standard_Real*)Coordinates)[4]
#define PntZ2 ((Standard_Real*)Coordinates)[5]
//=======================================================================
//function : HLRTest_DrawablePolyEdgeTool
//purpose :
//=======================================================================
HLRTest_DrawablePolyEdgeTool::
HLRTest_DrawablePolyEdgeTool (const Handle(HLRBRep_PolyAlgo)& Alg,
const Standard_Integer ViewId,
const Standard_Boolean Debug) :
myAlgo(Alg),
myDispHid(Standard_False),
myViewId(ViewId),
myDebug(Debug),
myHideMode(Standard_True)
{
OSD_Chronometer ChronHide;
if (myDebug) {
ChronHide.Reset();
ChronHide.Start();
}
Standard_Real sta,end,dx,dy,dz;
Standard_ShortReal tolsta,tolend;
HLRAlgo_EdgeIterator It;
myBiPntVis.Clear();
myBiPntHid.Clear();
Standard_Address Coordinates;
HLRAlgo_EdgeStatus status;
TopoDS_Shape S;
Standard_Boolean reg1,regn,outl,intl;
for (myAlgo->InitHide(); myAlgo->MoreHide(); myAlgo->NextHide()) {
myAlgo->Hide(Coordinates,status,S,reg1,regn,outl,intl);
dx = PntX2 - PntX1;
dy = PntY2 - PntY1;
dz = PntZ2 - PntZ1;
for (It.InitVisible(status);
It.MoreVisible();
It.NextVisible()) {
It.Visible(sta,tolsta,end,tolend);
myBiPntVis.Append
(HLRBRep_BiPoint
(PntX1 + sta * dx,PntY1 + sta * dy,PntZ1 + sta * dz,
PntX1 + end * dx,PntY1 + end * dy,PntZ1 + end * dz,
S,reg1,regn,outl,intl));
}
for (It.InitHidden(status);
It.MoreHidden();
It.NextHidden()) {
It.Hidden(sta,tolsta,end,tolend);
myBiPntHid.Append
(HLRBRep_BiPoint
(PntX1 + sta * dx,PntY1 + sta * dy,PntZ1 + sta * dz,
PntX1 + end * dx,PntY1 + end * dy,PntZ1 + end * dz,
S,reg1,regn,outl,intl));
}
}
if (myDebug) {
ChronHide.Stop();
cout << " Temps Hide :";
ChronHide.Show();
}
}
//=======================================================================
//function : DrawOn
//purpose :
//=======================================================================
void HLRTest_DrawablePolyEdgeTool::DrawOn (Draw_Display& D) const
{
if (myViewId == D.ViewId()) {
if (myHideMode) {
HLRBRep_ListIteratorOfListOfBPoint It;
if (myDispHid) {
D.SetColor(Draw_bleu);
for (It.Initialize(myBiPntHid);
It.More();
It.Next()) {
const HLRBRep_BiPoint& BP = It.Value();
Standard_Boolean todraw = Standard_True;
if ((!myDispRg1 && BP.Rg1Line() && !BP.OutLine()) ||
(!myDispRgN && BP.RgNLine() && !BP.OutLine()))
todraw = Standard_False;
if (todraw) {
D.MoveTo(BP.P1());
D.DrawTo(BP.P2());
}
}
}
D.SetColor(Draw_vert);
for (It.Initialize(myBiPntVis);
It.More();
It.Next()) {
const HLRBRep_BiPoint& BP = It.Value();
Standard_Boolean todraw = Standard_True;
if ((!myDispRg1 && BP.Rg1Line() && !BP.OutLine()) ||
(!myDispRgN && BP.RgNLine() && !BP.OutLine()))
todraw = Standard_False;
if (todraw) {
D.MoveTo(BP.P1());
D.DrawTo(BP.P2());
}
}
}
else {
Standard_Address Coordinates;
TopoDS_Shape S;
Standard_Boolean reg1,regn,outl,intl;
D.SetColor(Draw_vert);
for (myAlgo->InitShow(); myAlgo->MoreShow(); myAlgo->NextShow()) {
myAlgo->Show(Coordinates,S,reg1,regn,outl,intl);
Standard_Boolean todraw = Standard_True;
if ((!myDispRg1 && reg1 && !outl) ||
(!myDispRgN && regn && !outl))
todraw = Standard_False;
if (todraw) {
D.MoveTo(gp_Pnt(PntX1,PntY1,PntZ1));
D.DrawTo(gp_Pnt(PntX2,PntY2,PntZ2));
}
}
}
}
}
|