0024530: TKMesh - remove unused package IntPoly
[occt.git] / src / StdSelect / StdSelect_ViewerSelector3d.cxx
CommitLineData
b311480e 1// Created on: 1995-03-15
2// Created by: Robert COUBLANC
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//
973c2be1 8// This library is free software; you can redistribute it and / or modify it
9// under the terms of the GNU Lesser General Public version 2.1 as published
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 <StdSelect_ViewerSelector3d.ixx>
18#include <StdSelect.hxx>
19#include <SelectBasics_SensitiveEntity.hxx>
20#include <Graphic3d_AspectLine3d.hxx>
21#include <gp_Pnt.hxx>
22#include <gp_Lin.hxx>
23#include <gp_Pnt2d.hxx>
24#include <gp_Dir.hxx>
25#include <gp_Ax3.hxx>
26#include <gp_GTrsf.hxx>
4269bd1b 27#include <gp_Pln.hxx>
7fd59977 28#include <Select3D_SensitiveEntity.hxx>
b8ddfc2f 29#include <Graphic3d_ArrayOfPolylines.hxx>
51b10cd4 30#include <Graphic3d_SequenceOfHClipPlane.hxx>
4269bd1b 31#include <SelectMgr_SelectableObject.hxx>
7fd59977 32#include <SelectMgr_DataMapIteratorOfDataMapOfIntegerSensitive.hxx>
33#include <SelectBasics_ListOfBox2d.hxx>
34#include <Visual3d_TransientManager.hxx>
35#include <TColgp_HArray1OfPnt.hxx>
36#include <TColgp_Array1OfPnt.hxx>
37#include <TColgp_HArray1OfPnt2d.hxx>
38#include <Select3D_SensitiveCurve.hxx>
39#include <Select3D_SensitiveSegment.hxx>
40#include <Select3D_SensitiveFace.hxx>
41#include <Select3D_SensitiveCircle.hxx>
42#include <Select3D_SensitivePoint.hxx>
43#include <Select3D_SensitiveTriangulation.hxx>
44#include <Select3D_SensitiveTriangle.hxx>
45#include <Select3D_SensitiveWire.hxx>
46#include <Select3D_SensitiveEntitySequence.hxx>
47#include <Select3D_ListOfSensitiveTriangle.hxx>
48#include <Select3D_SensitiveBox.hxx>
49#include <Select3D_ListIteratorOfListOfSensitiveTriangle.hxx>
50
51#include <SelectMgr_DataMapIteratorOfDataMapOfSelectionActivation.hxx>
52#include <Aspect_TypeOfMarker.hxx>
53#include <Graphic3d_AspectMarker3d.hxx>
a577aaab 54#include <Graphic3d_ArrayOfPoints.hxx>
7fd59977 55#include <SelectBasics_ListIteratorOfListOfBox2d.hxx>
56#include <Poly_Connect.hxx>
57#include <TColStd_HArray1OfInteger.hxx>
58
59#include <Poly_Array1OfTriangle.hxx>
60#include <Poly_Triangulation.hxx>
61#include <OSD_Environment.hxx>
62#include <V3d.hxx>
63#include <V3d_View.hxx>
b8ddfc2f 64#include <TColgp_SequenceOfPnt.hxx>
65
7fd59977 66
67static Standard_Integer StdSel_NumberOfFreeEdges (const Handle(Poly_Triangulation)& Trg)
68{
69 Standard_Integer nFree = 0;
70 Poly_Connect pc(Trg);
71 Standard_Integer t[3];
72 Standard_Integer i, j;
73 for (i = 1; i <= Trg->NbTriangles(); i++)
74 {
75 pc.Triangles (i, t[0], t[1], t[2]);
76 for (j = 0; j < 3; j++)
77 if (t[j] == 0) nFree++;
78 }
79 return nFree;
80}
81
82static Standard_Boolean ReadIsDebugMode()
83{
84 OSD_Environment StdSelectdb ("SELDEBUGMODE");
85 return !StdSelectdb.Value().IsEmpty();
86}
87
88static Standard_Boolean StdSelectDebugModeOn()
89{
90 static const Standard_Boolean isDebugMode = ReadIsDebugMode();
91 return isDebugMode;
92}
93
94//==================================================
95// Function:
96// Purpose :
97//==================================================
98
99StdSelect_ViewerSelector3d
100::StdSelect_ViewerSelector3d():
4952a30a 101myprj(new Select3D_Projector()),
7fd59977 102mylastzoom(0.0),
3c982548 103mysensmode(StdSelect_SM_WINDOW),
7fd59977 104mypixtol(2),
105myupdatetol(Standard_True)
106{
107 for (Standard_Integer i=0;i<=13;i++) {mycoeff [i] = 0.;myprevcoeff[i]=0.0;}
108 for (Standard_Integer j=0;j<2;j++) {mycenter [j] = 0.;myprevcenter[j]=0.0;}
109}
110
111
112//==================================================
113// Function:
114// Purpose :
115//==================================================
116
117StdSelect_ViewerSelector3d
4952a30a 118::StdSelect_ViewerSelector3d(const Handle(Select3D_Projector)& aProj):
7fd59977 119myprj(aProj),
120mylastzoom(0.0),
3c982548 121mysensmode(StdSelect_SM_WINDOW),
7fd59977 122mypixtol(2),
123myupdatetol(Standard_True)
124{
125 for (Standard_Integer i=0;i<=13;i++) {mycoeff [i] = 0.;myprevcoeff[i]=0.0;}
126 for (Standard_Integer j=0;j<2;j++) {mycenter [j] = 0.;myprevcenter[j]=0.0;}
127}
128
129//==================================================
130// Function: Convert
131// Purpose :
132//==================================================
133
134void StdSelect_ViewerSelector3d::Convert(const Handle(SelectMgr_Selection)& aSel)
135{
136 for(aSel->Init();aSel->More();aSel->Next())
137 {
138 if(aSel->Sensitive()->NeedsConversion())
139 {
140 Handle(Select3D_SensitiveEntity) SE = *((Handle(Select3D_SensitiveEntity)*) &(aSel->Sensitive()));
141 SE->Project(myprj);
142 if(!tosort) tosort=Standard_True;
143 }
144 }
145}
146
147//==================================================
148// Function: Set
149// Purpose :
150//==================================================
151
152void StdSelect_ViewerSelector3d
3c982548 153::Set(const Handle(Select3D_Projector)& aProj)
7fd59977 154{
3c982548 155 myprj = aProj;
156 toupdate=Standard_True;
7fd59977 157}
158
159//==================================================
3c982548 160// Function: SetSensitivityMode
7fd59977 161// Purpose :
162//==================================================
163
164void StdSelect_ViewerSelector3d
3c982548 165::SetSensitivityMode(const StdSelect_SensitivityMode aMode)
7fd59977 166{
3c982548 167 mysensmode = aMode;
168 toupdate = Standard_True;
169}
170
171//==================================================
172// Function: SetPixelTolerance
173// Purpose :
174//==================================================
175
176void StdSelect_ViewerSelector3d
177::SetPixelTolerance(const Standard_Integer aTolerance)
178{
179 if(mypixtol!=aTolerance)
180 {
181 mypixtol = aTolerance;
182 myupdatetol = Standard_True;
183 }
7fd59977 184}
185
186//==================================================
187// Function: SelectPix
188// Purpose :
189//==================================================
190
191void StdSelect_ViewerSelector3d
192::Pick(const Standard_Integer XPix,
193 const Standard_Integer YPix,
194 const Handle(V3d_View)& aView)
195{
4269bd1b 196 SetClipping (aView->GetClipPlanes());
7fd59977 197 UpdateProj(aView);
198 Standard_Real Xr3d,Yr3d,Zr3d;
199 gp_Pnt2d P2d;
200 aView->Convert(XPix,YPix,Xr3d,Yr3d,Zr3d);
4952a30a 201 myprj->Project(gp_Pnt(Xr3d,Yr3d,Zr3d),P2d);
202
7fd59977 203 InitSelect(P2d.X(),P2d.Y());
204}
205
206
207//==================================================
208// Function: InitSelect
209// Purpose :
210//==================================================
211
212void StdSelect_ViewerSelector3d
213::Pick(const Standard_Integer XPMin,
214 const Standard_Integer YPMin,
215 const Standard_Integer XPMax,
216 const Standard_Integer YPMax,
217 const Handle(V3d_View)& aView)
218{
3c982548 219 if (myupdatetol && SensitivityMode() == StdSelect_SM_WINDOW)
7fd59977 220 {
221 SetSensitivity (aView->Convert (mypixtol));
222 myupdatetol = Standard_False;
223 }
224 UpdateProj (aView);
225
226 Standard_Real x1,y1,z1,x2,y2,z2;
227 gp_Pnt2d P2d_1,P2d_2;
228 aView->Convert(XPMin,YPMin,x1,y1,z1);
229 aView->Convert(XPMax,YPMax,x2,y2,z2);
4952a30a 230 myprj->Project(gp_Pnt(x1,y1,z1),P2d_1);
231 myprj->Project(gp_Pnt(x2,y2,z2),P2d_2);
7fd59977 232
233 InitSelect (Min(P2d_1.X(),P2d_2.X()),
234 Min(P2d_1.Y(),P2d_2.Y()),
235 Max(P2d_1.X(),P2d_2.X()),
236 Max(P2d_1.Y(),P2d_2.Y()));
237}
238
239//==================================================
240// Function: Pick
241// Purpose : Selection using a polyline
242//==================================================
243
b8ddfc2f 244void StdSelect_ViewerSelector3d::Pick(const TColgp_Array1OfPnt2d& aPolyline, const Handle(V3d_View)& aView)
7fd59977 245{
3c982548 246 if (myupdatetol && SensitivityMode() == StdSelect_SM_WINDOW)
7fd59977 247 {
248 SetSensitivity (aView->Convert (mypixtol));
249 myupdatetol = Standard_False;
250 }
251
252 UpdateProj (aView);
253
254 Standard_Integer NbPix = aPolyline.Length();
255 Standard_Integer i;
256
257 // Convert pixel
b8ddfc2f 258 Handle(TColgp_HArray1OfPnt2d) P2d = new TColgp_HArray1OfPnt2d(1,NbPix);
7fd59977 259
260 for (i = 1; i <= NbPix; ++i)
261 {
262 Standard_Real x,y,z;
263 Standard_Integer XP = (Standard_Integer)(aPolyline(i).X());
264 Standard_Integer YP = (Standard_Integer)(aPolyline(i).Y());
265 gp_Pnt2d Pnt2d;
266
267 aView->Convert (XP, YP, x, y, z);
4952a30a 268 myprj->Project (gp_Pnt (x, y, z), Pnt2d);
7fd59977 269
270 P2d->SetValue (i, Pnt2d);
271 }
272
273 const TColgp_Array1OfPnt2d& aPolyConvert = P2d->Array1();
274
275 InitSelect(aPolyConvert);
276}
277
278//==================================================
279// Function: DisplayAreas
280// Purpose : display the activated areas...
281//==================================================
282
b8ddfc2f 283void StdSelect_ViewerSelector3d::DisplayAreas(const Handle(V3d_View)& aView)
7fd59977 284{
3c982548 285 if (myupdatetol && SensitivityMode() == StdSelect_SM_WINDOW)
7fd59977 286 {
287 SetSensitivity (aView->Convert (mypixtol));
b8ddfc2f 288 myupdatetol = Standard_False;
7fd59977 289 }
290 UpdateProj(aView);
291 UpdateSort(); // Updates the activated areas
292
293 if(mystruct.IsNull())
7fd59977 294 mystruct = new Graphic3d_Structure(aView->Viewer()->Viewer());
b8ddfc2f 295
7fd59977 296 if(myareagroup.IsNull())
7fd59977 297 myareagroup = new Graphic3d_Group(mystruct);
7fd59977 298
299 SelectMgr_DataMapIteratorOfDataMapOfIntegerSensitive It(myentities);
4952a30a 300 Handle(Select3D_Projector) prj = StdSelect::GetProjector(aView);
301 prj->SetView(aView);
7fd59977 302
7fd59977 303 Standard_Real xmin,ymin,xmax,ymax;
304 gp_Pnt Pbid;
305 SelectBasics_ListOfBox2d BoxList;
306
b8ddfc2f 307 TColgp_SequenceOfPnt aSeqLines;
7fd59977 308 for (; It.More(); It.Next())
309 {
310 It.Value()->Areas(BoxList);
311 for (SelectBasics_ListIteratorOfListOfBox2d itb (BoxList); itb.More(); itb.Next())
312 {
313 itb.Value().Get (xmin, ymin, xmax, ymax);
314
315 Pbid.SetCoord (xmin - mytolerance, ymin - mytolerance, 0.0);
4952a30a 316 prj->Transform (Pbid, prj->InvertedTransformation());
b8ddfc2f 317 aSeqLines.Append(Pbid);
7fd59977 318
319 Pbid.SetCoord (xmax + mytolerance, ymin - mytolerance, 0.0);
4952a30a 320 prj->Transform (Pbid, prj->InvertedTransformation());
b8ddfc2f 321 aSeqLines.Append(Pbid);
7fd59977 322
323 Pbid.SetCoord (xmax + mytolerance, ymax + mytolerance, 0.0);
4952a30a 324 prj->Transform (Pbid, prj->InvertedTransformation());
b8ddfc2f 325 aSeqLines.Append(Pbid);
7fd59977 326
327 Pbid.SetCoord (xmin - mytolerance, ymax + mytolerance, 0.0);
4952a30a 328 prj->Transform (Pbid, prj->InvertedTransformation());
b8ddfc2f 329 aSeqLines.Append(Pbid);
330 }
331 }
7fd59977 332
b8ddfc2f 333 if (aSeqLines.Length())
334 {
335 Standard_Integer n, np;
336 const Standard_Integer nbl = aSeqLines.Length() / 4;
337 Handle(Graphic3d_ArrayOfPolylines) aPrims = new Graphic3d_ArrayOfPolylines(5*nbl,nbl);
338 for (np = 1, n=0; n<nbl; n++) {
339 aPrims->AddBound(5);
340 const gp_Pnt &p1 = aSeqLines(np++);
341 aPrims->AddVertex(p1);
342 aPrims->AddVertex(aSeqLines(np++));
343 aPrims->AddVertex(aSeqLines(np++));
344 aPrims->AddVertex(aSeqLines(np++));
345 aPrims->AddVertex(p1);
7fd59977 346 }
b8ddfc2f 347 myareagroup->AddPrimitiveArray(aPrims);
7fd59977 348 }
349
b8ddfc2f 350 myareagroup->SetGroupPrimitivesAspect (new Graphic3d_AspectLine3d (Quantity_NOC_AQUAMARINE1, Aspect_TOL_DASH, 1.0));
7fd59977 351 myareagroup->Structure()->SetDisplayPriority(10);
352 myareagroup->Structure()->Display();
353
354 if(aView->TransientManagerBeginDraw())
355 {
356 Visual3d_TransientManager::DrawStructure(mystruct);
357 Visual3d_TransientManager::EndDraw();
358 }
359 else
360 {
361 aView->Update();
362 }
363}
364
365//==================================================
366// Function: ClearAreas
367// Purpose :
368//==================================================
369
b8ddfc2f 370void StdSelect_ViewerSelector3d::ClearAreas(const Handle(V3d_View)& aView)
7fd59977 371{
372 if(myareagroup.IsNull()) return;
373 myareagroup->Clear();
374 if(aView.IsNull()) return;
375 if(aView->TransientManagerBeginDraw())
376 Visual3d_TransientManager::EndDraw();
377 else
378 aView->Update();
379}
380
381//==================================================
382// Function: updateproj
383// Purpose : at any time verifies that
384// the view coefficients did not change :
385// store current view coeffts
386// in static array cf [ 0->2 At coordinates XAT YAT ZAT
387// 3->5 Up coordinates XUP YUP ZUP
388// 6->8 ProjVect coordinates DX DY DZ
389// 9 focale
390// 10 1. if pers 0. else
391//==================================================
392
b8ddfc2f 393Standard_Boolean StdSelect_ViewerSelector3d::UpdateProj(const Handle(V3d_View)& aView)
7fd59977 394{
395 myprevcoeff[ 9] = 0.0;
396 myprevcoeff[10] = 0.0;
397 Standard_Boolean Pers = Standard_False;
398 if (aView->Type() == V3d_PERSPECTIVE)
399 {
400 Pers = Standard_True;
401 myprevcoeff[10] = 1.0;
402 myprevcoeff[ 9] = aView->Focale();
403 }
404 aView->At (myprevcoeff[0], myprevcoeff[1], myprevcoeff[2]);
405 aView->Up (myprevcoeff[3], myprevcoeff[4], myprevcoeff[5]);
406 aView->Proj (myprevcoeff[6], myprevcoeff[7], myprevcoeff[8]);
407 aView->AxialScale (myprevcoeff[11], myprevcoeff[12], myprevcoeff[13]);
408 aView->Center (myprevcenter[0], myprevcenter[1]);
409 Standard_Integer ii;
410
411 for (ii = 0; ii <= 13 && (myprevcoeff[ii] == mycoeff[ii]); ++ii) {}
412 if (ii <= 13 || (myprevcenter[0] != mycenter[0]) || (myprevcenter[1] != mycenter[1]))
413 {
414 if (StdSelectDebugModeOn())
415 {
416 cout<<"\t\t\t\t\t VS3d::UpdateProj====> coefficients changes on reprojette"<<endl;
417 cout<<"\t\t\t\t\t";
418 for (Standard_Integer i = 1; i <= 9; ++i)
419 {
420 cout<<mycoeff[i-1]<<" ";
421 if (i%3==0)
422 cout<<"\n\t\t\t\t\t";
423 }
424 cout<<"focale :"<<mycoeff[9]<<" persp :"<<mycoeff[10]<<endl;
425 cout<<"center :"<<mycenter[0]<<" "<<mycenter[1]<<endl;
426 }
427 toupdate = Standard_True;
428 myupdatetol = Standard_True;
429 for (Standard_Integer imod = ii; imod <= 13; ++imod)
430 {
431 mycoeff[imod] = myprevcoeff[imod];
432 }
433 for (Standard_Integer jmod = 0; jmod < 2; ++jmod)
434 {
435 mycenter[jmod] = myprevcenter[jmod];
436 }
437
b5ac8292 438 myprj = new Select3D_Projector (aView);
439
7fd59977 440 }
441
442 if (Abs (aView->Scale() - mylastzoom) > 1.e-3)
443 {
444 myupdatetol = Standard_True;
445 mylastzoom = aView->Scale();
446 }
447
3c982548 448 if (myupdatetol && SensitivityMode() == StdSelect_SM_WINDOW)
7fd59977 449 {
450 SetSensitivity (aView->Convert (mypixtol));
451 myupdatetol = Standard_False;
452 }
453
454 if (toupdate) UpdateConversion();
455 if (tosort) UpdateSort();
456
457 return Standard_True;
458}
459
460
461//=============================
462// Function: DisplaySensitive.
463// Purpose : Display active primitives.
464//=============================
465void StdSelect_ViewerSelector3d::DisplaySensitive(const Handle(V3d_View)& aViou)
466{
3c982548 467 if (myupdatetol && SensitivityMode() == StdSelect_SM_WINDOW)
7fd59977 468 {
469 SetSensitivity (aViou->Convert (mypixtol));
470 myupdatetol = Standard_False;
471 }
472 if(toupdate) UpdateProj(aViou);
473 if(tosort) UpdateSort(); // Updates the activated areas
474
475 // Preparation des structures
476 if(mystruct.IsNull())
477 mystruct = new Graphic3d_Structure(aViou->Viewer()->Viewer());
478
479 if(mysensgroup.IsNull())
480 mysensgroup = new Graphic3d_Group(mystruct);
481
482 Quantity_Color Col(Quantity_NOC_INDIANRED3);
483 Handle(Graphic3d_AspectMarker3d) AM =
484 new Graphic3d_AspectMarker3d(Aspect_TOM_O_PLUS,Col,2.);
485 mysensgroup-> SetPrimitivesAspect (AM);
486 mysensgroup->SetPrimitivesAspect (
487 new Graphic3d_AspectLine3d (Quantity_NOC_GRAY40, Aspect_TOL_SOLID, 2.0));
488
489 // Remplissage de la structure...
490
491 SelectMgr_DataMapIteratorOfDataMapOfSelectionActivation It(myselections);
7fd59977 492
7fd59977 493 for (; It.More(); It.Next())
494 {
495 if (It.Value()==0)
496 {
497 const Handle(SelectMgr_Selection)& Sel = It.Key();
498 ComputeSensitivePrs(Sel);
499 }
500 }
7fd59977 501
502 mysensgroup->Structure()->SetDisplayPriority(10);
503 mystruct->Display();
504 if (aViou->TransientManagerBeginDraw())
505 {
506 Visual3d_TransientManager::DrawStructure(mystruct);
507 Visual3d_TransientManager::EndDraw();
508 }
509 else if (!aViou.IsNull())
510 {
511 aViou->Update();
512 }
513}
514
515//=============================
516// Function: ClearSensitive
517// Purpose :
518//=============================
519void StdSelect_ViewerSelector3d::ClearSensitive(const Handle(V3d_View)& aViou)
520{
521 if(mysensgroup.IsNull()) return;
522 mysensgroup->Clear();
523 if(aViou.IsNull()) return;
524
525 if(aViou->TransientManagerBeginDraw())
526 Visual3d_TransientManager::EndDraw();
527 else
528 aViou->Update();
529}
530
531//=======================================================================
532//function : DisplaySenstive
533//purpose :
534//=======================================================================
535void StdSelect_ViewerSelector3d::
536DisplaySensitive (const Handle(SelectMgr_Selection)& Sel,
537 const Handle(V3d_View)& aViou,
538 const Standard_Boolean ClearOthers)
539{
540 if (mystruct.IsNull())
541 mystruct = new Graphic3d_Structure (aViou->Viewer()->Viewer());
542 if (mysensgroup.IsNull())
543 {
544 mysensgroup = new Graphic3d_Group (mystruct);
545 Quantity_Color Col (Quantity_NOC_INDIANRED3);
546 Handle(Graphic3d_AspectMarker3d) AM =
547 new Graphic3d_AspectMarker3d (Aspect_TOM_O_PLUS, Col, 2.0);
548 mysensgroup-> SetPrimitivesAspect (AM);
549 mysensgroup->SetPrimitivesAspect (
550 new Graphic3d_AspectLine3d (Quantity_NOC_GRAY40, Aspect_TOL_SOLID, 2.0));
551 }
552
553 if(ClearOthers) mysensgroup->Clear();
554
7fd59977 555 ComputeSensitivePrs(Sel);
556
7fd59977 557 mystruct->SetDisplayPriority(10);
558 mystruct->Display();
559 if(aViou->TransientManagerBeginDraw())
560 {
561 Visual3d_TransientManager::DrawStructure(mystruct);
562 Visual3d_TransientManager::EndDraw();
563 }
564 else if(!aViou.IsNull())
565 {
566 aViou->Update();
567 }
568}
569
570//=======================================================================
571//function : DisplayAreas
572//purpose :
573//=======================================================================
574
575void StdSelect_ViewerSelector3d::
576DisplayAreas (const Handle(SelectMgr_Selection)& Sel,
577 const Handle(V3d_View)& aViou,
578 const Standard_Boolean ClearOthers)
579{
580 if (mystruct.IsNull())
581 mystruct = new Graphic3d_Structure (aViou->Viewer()->Viewer());
b8ddfc2f 582
7fd59977 583 if (mysensgroup.IsNull())
584 {
585 myareagroup = new Graphic3d_Group (mystruct);
b8ddfc2f 586 myareagroup->SetGroupPrimitivesAspect(new Graphic3d_AspectLine3d (Quantity_NOC_AQUAMARINE1, Aspect_TOL_DASH, 1.0));
7fd59977 587 }
588
589 if(ClearOthers) myareagroup->Clear();
590
7fd59977 591 ComputeAreasPrs(Sel);
7fd59977 592
593 mystruct->SetDisplayPriority(10);
594 mystruct->Display();
595
596 if(aViou->TransientManagerBeginDraw())
597 {
598 Visual3d_TransientManager::DrawStructure(mystruct);
599 Visual3d_TransientManager::EndDraw();
600 }
601 else
602 {
603 aViou->Update();
604 }
605}
606
607//=======================================================================
608//function : ComputeSensitivePrs
609//purpose :
610//=======================================================================
611
b8ddfc2f 612void StdSelect_ViewerSelector3d::ComputeSensitivePrs(const Handle(SelectMgr_Selection)& Sel)
7fd59977 613{
b8ddfc2f 614 TColgp_SequenceOfPnt aSeqLines, aSeqFree;
615 TColStd_SequenceOfInteger aSeqBnds;
616
7fd59977 617 for(Sel->Init();Sel->More();Sel->Next())
618 {
b8ddfc2f 619 Handle(Select3D_SensitiveEntity) Ent = Handle(Select3D_SensitiveEntity)::DownCast(Sel->Sensitive());
620 const Standard_Boolean hasloc = (Ent.IsNull()? Standard_False : Ent->HasLocation());
7fd59977 621
622 TopLoc_Location theloc;
623 if(hasloc)
624 theloc = Ent->Location();
625
626 //==============
627 // Box
628 //=============
629
630 if (Ent->DynamicType()==STANDARD_TYPE(Select3D_SensitiveBox))
631 {
632 const Bnd_Box& B = Handle(Select3D_SensitiveBox)::DownCast (Ent)->Box();
633 Standard_Real xmin, ymin, zmin, xmax, ymax, zmax;
634 B.Get (xmin, ymin, zmin, xmax, ymax, zmax);
b8ddfc2f 635 Standard_Integer i;
7fd59977 636 gp_Pnt theboxpoint[8] =
637 {
638 gp_Pnt(xmin,ymin,zmin),
639 gp_Pnt(xmax,ymin,zmin),
640 gp_Pnt(xmax,ymax,zmin),
641 gp_Pnt(xmin,ymax,zmin),
642 gp_Pnt(xmin,ymin,zmax),
643 gp_Pnt(xmax,ymin,zmax),
644 gp_Pnt(xmax,ymax,zmax),
645 gp_Pnt(xmin,ymax,zmax)
646 };
647 if(hasloc)
648 {
b8ddfc2f 649 for (i = 0; i <= 7; i++)
650 theboxpoint[i].Transform (theloc.Transformation());
7fd59977 651 }
7fd59977 652
b8ddfc2f 653 aSeqBnds.Append(5);
654 for (i = 0; i < 4; i++)
655 aSeqLines.Append(theboxpoint[i]);
656 aSeqLines.Append(theboxpoint[0]);
657
658 aSeqBnds.Append(5);
659 for (i = 4; i < 8; i++)
660 aSeqLines.Append(theboxpoint[i]);
661 aSeqLines.Append(theboxpoint[4]);
7fd59977 662
b8ddfc2f 663 for (i = 0; i < 4; i++)
7fd59977 664 {
b8ddfc2f 665 aSeqBnds.Append(2);
666 aSeqLines.Append(theboxpoint[i]);
667 aSeqLines.Append(theboxpoint[i+4]);
7fd59977 668 }
669 }
670 //==============
671 // Face
672 //=============
673 else if (Ent->DynamicType()==STANDARD_TYPE(Select3D_SensitiveFace))
674 {
675 Handle(Select3D_SensitiveFace) aFace = Handle(Select3D_SensitiveFace)::DownCast(Ent);
676 Handle(TColgp_HArray1OfPnt) TheHPts;
677 aFace->Points3D(TheHPts);
678 const TColgp_Array1OfPnt& ThePts = TheHPts->Array1();
679
b8ddfc2f 680 aSeqBnds.Append(ThePts.Length());
7fd59977 681 for (Standard_Integer I = ThePts.Lower(); I <= ThePts.Upper(); I++)
682 {
683 if (hasloc)
b8ddfc2f 684 aSeqLines.Append(ThePts(I).Transformed (theloc.Transformation()));
7fd59977 685 else
b8ddfc2f 686 aSeqLines.Append(ThePts(I));
7fd59977 687 }
7fd59977 688 }
689 //==============
690 // Curve
691 //=============
692 else if (Ent->DynamicType()==STANDARD_TYPE(Select3D_SensitiveCurve))
693 {
694 Handle(Select3D_SensitiveCurve) aCurve = Handle(Select3D_SensitiveCurve)::DownCast(Ent);
695 Handle(TColgp_HArray1OfPnt) TheHPts;
696 aCurve->Points3D(TheHPts);
697 const TColgp_Array1OfPnt& ThePts = TheHPts->Array1();
698
b8ddfc2f 699 aSeqBnds.Append(ThePts.Length());
7fd59977 700 for (Standard_Integer I = ThePts.Lower(); I <= ThePts.Upper(); I++)
701 {
702 if (hasloc)
b8ddfc2f 703 aSeqLines.Append(ThePts(I).Transformed (theloc.Transformation()));
7fd59977 704 else
b8ddfc2f 705 aSeqLines.Append(ThePts(I));
7fd59977 706 }
7fd59977 707 }
708 //==============
709 // Wire
710 //=============
711 else if (Ent->DynamicType()==STANDARD_TYPE(Select3D_SensitiveWire))
712 {
b8ddfc2f 713 Handle(Select3D_SensitiveWire) aWire = Handle(Select3D_SensitiveWire)::DownCast(Ent);
714 Select3D_SensitiveEntitySequence EntitySeq;
715 aWire->GetEdges (EntitySeq);
7fd59977 716
717 for (int i = 1; i <= EntitySeq.Length(); i++)
718 {
719 Handle(Select3D_SensitiveEntity) SubEnt = Handle(Select3D_SensitiveEntity)::DownCast(EntitySeq.Value(i));
720
721 //Segment
722 if (SubEnt->DynamicType()==STANDARD_TYPE(Select3D_SensitiveSegment))
723 {
7fd59977 724 gp_Pnt P1 (Handle(Select3D_SensitiveSegment)::DownCast(SubEnt)->StartPoint().XYZ());
725 gp_Pnt P2 (Handle(Select3D_SensitiveSegment)::DownCast(SubEnt)->EndPoint().XYZ());
726 if (hasloc)
727 {
728 P1.Transform(theloc.Transformation());
729 P2.Transform(theloc.Transformation());
730 }
b8ddfc2f 731 aSeqBnds.Append(2);
732 aSeqLines.Append(P1);
733 aSeqLines.Append(P2);
7fd59977 734 }
735
736 //circle
737 if (SubEnt->DynamicType()==STANDARD_TYPE(Select3D_SensitiveCircle))
738 {
739 Handle(Select3D_SensitiveCircle) C = Handle(Select3D_SensitiveCircle)::DownCast(SubEnt);
740 Standard_Integer Lo, Up;
741 C->ArrayBounds (Lo, Up);
742 Standard_Integer II = Lo;
743 while (II <= Up - 2)
744 {
7fd59977 745 gp_Pnt ThePts[3] =
746 {
747 gp_Pnt (C->GetPoint3d (II).XYZ()),
748 gp_Pnt (C->GetPoint3d (++II).XYZ()),
749 gp_Pnt (C->GetPoint3d (++II).XYZ())
750 };
751
752 if (hasloc)
753 {
754 for (Standard_Integer jj = 0; jj <= 2; jj++)
755 ThePts[jj].Transform (theloc.Transformation());
756 }
757
b8ddfc2f 758 aSeqBnds.Append(4);
759 aSeqLines.Append(ThePts[0]);
760 aSeqLines.Append(ThePts[1]);
761 aSeqLines.Append(ThePts[2]);
762 aSeqLines.Append(ThePts[0]);
7fd59977 763 }
764 }
765
766 //curve
767 if (SubEnt->DynamicType()==STANDARD_TYPE(Select3D_SensitiveCurve))
768 {
769 Handle(Select3D_SensitiveCurve) aCurve = Handle(Select3D_SensitiveCurve)::DownCast(SubEnt);
770 Handle(TColgp_HArray1OfPnt) TheHPts;
771 aCurve->Points3D (TheHPts);
772 const TColgp_Array1OfPnt& ThePts = TheHPts->Array1();
b8ddfc2f 773
774 aSeqBnds.Append(ThePts.Length());
7fd59977 775 for (Standard_Integer I = ThePts.Lower(); I <= ThePts.Upper(); I++)
776 {
777 if (hasloc)
b8ddfc2f 778 aSeqLines.Append(ThePts(I).Transformed (theloc.Transformation()));
7fd59977 779 else
b8ddfc2f 780 aSeqLines.Append(ThePts(I));
7fd59977 781 }
7fd59977 782 }
783 }
784 }
785 //==============
786 // Segment
787 //=============
788 else if (Ent->DynamicType()==STANDARD_TYPE(Select3D_SensitiveSegment))
789 {
7fd59977 790 gp_Pnt P1 (Handle(Select3D_SensitiveSegment)::DownCast(Ent)->StartPoint().XYZ());
791 gp_Pnt P2 (Handle(Select3D_SensitiveSegment)::DownCast(Ent)->EndPoint().XYZ());
792 if (hasloc)
793 {
794 P1.Transform (theloc.Transformation());
795 P2.Transform (theloc.Transformation());
796 }
b8ddfc2f 797 aSeqBnds.Append(2);
798 aSeqLines.Append(P1);
799 aSeqLines.Append(P2);
7fd59977 800 }
801 //==============
802 // Circle
803 //=============
804 else if (Ent->DynamicType()==STANDARD_TYPE(Select3D_SensitiveCircle))
805 {
806 Handle(Select3D_SensitiveCircle) C = Handle(Select3D_SensitiveCircle)::DownCast(Ent);
807 Standard_Integer Lo, Up;
808 C->ArrayBounds (Lo, Up);
809 Standard_Integer II = Lo;
810 while (II <= Up - 2)
811 {
7fd59977 812 gp_Pnt ThePts[3] =
813 {
814 gp_Pnt (C->GetPoint3d (II).XYZ()),
815 gp_Pnt (C->GetPoint3d (++II).XYZ()),
816 gp_Pnt (C->GetPoint3d (++II).XYZ())
817 };
818
819 if (hasloc)
820 {
821 for (Standard_Integer jj = 0; jj <= 2; jj++)
822 ThePts[jj].Transform (theloc.Transformation());
823 }
824
b8ddfc2f 825 aSeqBnds.Append(4);
826 aSeqLines.Append(ThePts[0]);
827 aSeqLines.Append(ThePts[1]);
828 aSeqLines.Append(ThePts[2]);
829 aSeqLines.Append(ThePts[0]);
7fd59977 830 }
831 }
832 //==============
833 // Point
834 //=============
835 else if (Ent->DynamicType()==STANDARD_TYPE(Select3D_SensitivePoint))
836 {
837 gp_Pnt P = hasloc ?
838 Handle(Select3D_SensitivePoint)::DownCast(Ent)->Point() :
839 Handle(Select3D_SensitivePoint)::DownCast(Ent)->Point().Transformed (theloc.Transformation());
a577aaab 840 Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints = new Graphic3d_ArrayOfPoints (1);
841 anArrayOfPoints->AddVertex (P.X(), P.Y(), P.Z());
842 mysensgroup->AddPrimitiveArray (anArrayOfPoints);
7fd59977 843 }
844 //============================================================
845 // Triangulation : On met un petit offset ves l'interieur...
846 //==========================================================
847 else if (Ent->DynamicType()==STANDARD_TYPE(Select3D_SensitiveTriangulation))
848 {
849 const Handle(Poly_Triangulation)& PT =
850 (*((Handle(Select3D_SensitiveTriangulation)*) &Ent))->Triangulation();
851
852 const Poly_Array1OfTriangle& triangles = PT->Triangles();
853 const TColgp_Array1OfPnt& Nodes = PT->Nodes();
7fd59977 854 Standard_Integer n[3];
7fd59977 855
856 TopLoc_Location iloc, bidloc;
857 if ((*((Handle(Select3D_SensitiveTriangulation)*) &Ent))->HasInitLocation())
858 bidloc = (*((Handle(Select3D_SensitiveTriangulation)*) &Ent))->GetInitLocation();
859
860 if (bidloc.IsIdentity())
861 iloc = theloc;
862 else
863 iloc = theloc * bidloc;
864
865 Standard_Integer i;
866 for (i = 1; i <= PT->NbTriangles(); i++)
867 {
868 triangles (i).Get (n[0], n[1], n[2]);
869 gp_Pnt P1 (Nodes (n[0]).Transformed (iloc));
870 gp_Pnt P2 (Nodes (n[1]).Transformed (iloc));
871 gp_Pnt P3 (Nodes (n[2]).Transformed (iloc));
872 gp_XYZ V1 (P1.XYZ());
873 gp_XYZ V2 (P2.XYZ());
874 gp_XYZ V3 (P3.XYZ());
875 gp_XYZ CDG (P1.XYZ()); CDG += (P2.XYZ()); CDG += (P3.XYZ()); CDG /= 3.0;
7fd59977 876 V1 -= CDG; V2 -= CDG; V3 -= CDG;
7fd59977 877 V1 *= 0.9; V2 *= 0.9; V3 *= 0.9;
878 V1 += CDG; V2 += CDG; V3 += CDG;
b8ddfc2f 879
880 aSeqBnds.Append(4);
881 aSeqLines.Append(gp_Pnt(V1));
882 aSeqLines.Append(gp_Pnt(V2));
883 aSeqLines.Append(gp_Pnt(V3));
884 aSeqLines.Append(gp_Pnt(V1));
7fd59977 885 }
886
887 // recherche des bords libres...
888
889 Handle(TColStd_HArray1OfInteger) FreeEdges = new TColStd_HArray1OfInteger (1, 2 * StdSel_NumberOfFreeEdges (PT));
890 TColStd_Array1OfInteger& FreeE = FreeEdges->ChangeArray1();
891 Poly_Connect pc (PT);
892 Standard_Integer t[3];
893 Standard_Integer j;
894 Standard_Integer fr (1);
895 for (i = 1; i <= PT->NbTriangles(); i++)
896 {
897 pc.Triangles (i, t[0], t[1], t[2]);
898 triangles (i).Get (n[0], n[1], n[2]);
899 for (j = 0; j < 3; j++)
900 {
901 Standard_Integer k = (j + 1) % 3;
902 if (t[j] == 0)
903 {
904 FreeE (fr) = n[j];
905 FreeE (fr + 1)= n[k];
906 fr += 2;
907 }
908 }
909 }
7fd59977 910 for (Standard_Integer ifri = 1; ifri <= FreeE.Length(); ifri += 2)
911 {
b8ddfc2f 912 gp_Pnt pe1 (Nodes (FreeE (ifri)).Transformed (iloc)), pe2 (Nodes (FreeE (ifri + 1)).Transformed (iloc));
913 aSeqFree.Append(pe1);
914 aSeqFree.Append(pe2);
7fd59977 915 }
7fd59977 916 }
917 else if (Ent->DynamicType()==STANDARD_TYPE(Select3D_SensitiveTriangle))
918 {
919 Handle(Select3D_SensitiveTriangle) Str = Handle(Select3D_SensitiveTriangle)::DownCast(Ent);
b8ddfc2f 920 gp_Pnt P1, P2, P3;
7fd59977 921 Str->Points3D (P1, P2, P3);
b8ddfc2f 922 gp_Pnt CDG = Str->Center3D();
7fd59977 923
924 gp_XYZ V1 (P1.XYZ()); V1 -= (CDG.XYZ());
925 gp_XYZ V2 (P2.XYZ()); V2 -= (CDG.XYZ());
926 gp_XYZ V3 (P3.XYZ()); V3 -= (CDG.XYZ());
7fd59977 927 V1 *= 0.9; V2 *= 0.9; V3 *= 0.9;
928 V1 += CDG.XYZ(); V2 += CDG.XYZ(); V3 += CDG.XYZ();
b8ddfc2f 929
930 aSeqBnds.Append(4);
931 aSeqLines.Append(gp_Pnt(V1));
932 aSeqLines.Append(gp_Pnt(V2));
933 aSeqLines.Append(gp_Pnt(V3));
934 aSeqLines.Append(gp_Pnt(V1));
7fd59977 935 }
936 }
b8ddfc2f 937
938 Standard_Integer i;
939
940 if (aSeqLines.Length())
941 {
942 Handle(Graphic3d_ArrayOfPolylines) aPrims = new Graphic3d_ArrayOfPolylines(aSeqLines.Length(),aSeqBnds.Length());
943 for (i = 1; i <= aSeqLines.Length(); i++)
944 aPrims->AddVertex(aSeqLines(i));
945 for (i = 1; i <= aSeqBnds.Length(); i++)
946 aPrims->AddBound(aSeqBnds(i));
947 myareagroup->AddPrimitiveArray(aPrims);
948 }
949
950 if (aSeqFree.Length())
951 {
952 mysensgroup->SetPrimitivesAspect (new Graphic3d_AspectLine3d (Quantity_NOC_GREEN, Aspect_TOL_SOLID, 2.0));
953 Handle(Graphic3d_ArrayOfPolylines) aPrims = new Graphic3d_ArrayOfPolylines(aSeqFree.Length(),aSeqFree.Length()/2);
954 for (i = 1; i <= aSeqFree.Length(); i++)
955 {
956 aPrims->AddBound(2);
957 aPrims->AddVertex(aSeqLines(i++));
958 aPrims->AddVertex(aSeqLines(i));
959 }
960 mysensgroup->AddPrimitiveArray(aPrims);
961 mysensgroup->SetPrimitivesAspect (new Graphic3d_AspectLine3d (Quantity_NOC_GRAY40, Aspect_TOL_SOLID, 2.0));
962 }
7fd59977 963}
964
965//=======================================================================
966//function : ComputeAreaPrs
967//purpose :
968//=======================================================================
969
b8ddfc2f 970void StdSelect_ViewerSelector3d::ComputeAreasPrs (const Handle(SelectMgr_Selection)& Sel)
7fd59977 971{
7fd59977 972 Standard_Real xmin, ymin, xmax, ymax;
973 gp_Pnt Pbid;
974 SelectBasics_ListOfBox2d BoxList;
975
b8ddfc2f 976 TColgp_SequenceOfPnt aSeqLines;
7fd59977 977 for (Sel->Init(); Sel->More(); Sel->Next())
978 {
979 Sel->Sensitive()->Areas (BoxList);
980 for (SelectBasics_ListIteratorOfListOfBox2d itb (BoxList); itb.More(); itb.Next())
981 {
982 itb.Value().Get (xmin, ymin, xmax, ymax);
983
984 Pbid.SetCoord (xmin - mytolerance, ymin - mytolerance, 0.0);
4952a30a 985 myprj->Transform (Pbid, myprj->InvertedTransformation());
b8ddfc2f 986 aSeqLines.Append(Pbid);
7fd59977 987
988 Pbid.SetCoord (xmax + mytolerance, ymin - mytolerance, 0.0);
4952a30a 989 myprj->Transform (Pbid, myprj->InvertedTransformation());
b8ddfc2f 990 aSeqLines.Append(Pbid);
7fd59977 991
992 Pbid.SetCoord (xmax + mytolerance, ymax + mytolerance, 0.0);
4952a30a 993 myprj->Transform (Pbid, myprj->InvertedTransformation());
b8ddfc2f 994 aSeqLines.Append(Pbid);
7fd59977 995
996 Pbid.SetCoord (xmin - mytolerance, ymax + mytolerance, 0.0);
4952a30a 997 myprj->Transform (Pbid, myprj->InvertedTransformation());
b8ddfc2f 998 aSeqLines.Append(Pbid);
999 }
1000 }
7fd59977 1001
b8ddfc2f 1002 if (aSeqLines.Length())
1003 {
1004 Standard_Integer n, np;
1005 const Standard_Integer nbl = aSeqLines.Length() / 4;
1006 Handle(Graphic3d_ArrayOfPolylines) aPrims = new Graphic3d_ArrayOfPolylines(5*nbl,nbl);
1007 for (np = 1, n=0; n<nbl; n++) {
1008 aPrims->AddBound(5);
1009 const gp_Pnt &p1 = aSeqLines(np++);
1010 aPrims->AddVertex(p1);
1011 aPrims->AddVertex(aSeqLines(np++));
1012 aPrims->AddVertex(aSeqLines(np++));
1013 aPrims->AddVertex(aSeqLines(np++));
1014 aPrims->AddVertex(p1);
7fd59977 1015 }
b8ddfc2f 1016 myareagroup->AddPrimitiveArray(aPrims);
7fd59977 1017 }
1018}
1019
1020//=======================================================================
4269bd1b 1021//function : SetClipping
7fd59977 1022//purpose :
1023//=======================================================================
51b10cd4 1024void StdSelect_ViewerSelector3d::SetClipping (const Graphic3d_SequenceOfHClipPlane& thePlanes)
7fd59977 1025{
4269bd1b 1026 myClipPlanes = thePlanes;
1027}
1028
1029//=======================================================================
1030//function : ComputeClipRange
1031//purpose :
1032//=======================================================================
51b10cd4 1033void StdSelect_ViewerSelector3d::ComputeClipRange (const Graphic3d_SequenceOfHClipPlane& thePlanes,
4269bd1b 1034 const gp_Lin& thePickLine,
1035 Standard_Real& theDepthMin,
1036 Standard_Real& theDepthMax) const
1037{
1038 theDepthMin = RealFirst();
1039 theDepthMax = RealLast();
1040 Standard_Real aPlaneA, aPlaneB, aPlaneC, aPlaneD;
1041
51b10cd4 1042 Graphic3d_SequenceOfHClipPlane::Iterator aPlaneIt (thePlanes);
4269bd1b 1043 for (; aPlaneIt.More(); aPlaneIt.Next())
7fd59977 1044 {
4269bd1b 1045 const Handle(Graphic3d_ClipPlane)& aClipPlane = aPlaneIt.Value();
1046 if (!aClipPlane->IsOn())
1047 continue;
1048
1049 gp_Pln aGeomPlane = aClipPlane->ToPlane();
1050
1051 aGeomPlane.Coefficients (aPlaneA, aPlaneB, aPlaneC, aPlaneD);
1052
1053 const gp_Dir& aPlaneDir = aGeomPlane.Axis().Direction();
1054 const gp_Dir& aPickDir = thePickLine.Direction();
1055 const gp_XYZ& aPntOnLine = thePickLine.Location().XYZ();
1056 const gp_XYZ& aPlaneDirXYZ = aPlaneDir.XYZ();
1057
1058 Standard_Real aDotProduct = aPickDir.Dot (aPlaneDir);
1059 Standard_Real aDistance = -(aPntOnLine.Dot (aPlaneDirXYZ) + aPlaneD);
1060
1061 // check whether the pick line is parallel to clip plane
1062 if (Abs (aDotProduct) < Precision::Angular())
7fd59977 1063 {
4269bd1b 1064 if (aDistance > 0.0)
1065 {
1066 // line lies above the plane, thus no selection is possible
1067 theDepthMin = 0.0;
1068 theDepthMax = 0.0;
1069 return;
1070 }
1071
1072 // line lies below the plane and is not clipped, skip
1073 continue;
1074 }
1075
1076 // compute distance to point of pick line intersection with the plane
1077 Standard_Real aIntDist = aDistance / aDotProduct;
1078
1079 // change depth limits for case of opposite and directed planes
1080 if (aDotProduct < 0.0)
1081 {
1082 theDepthMax = Min (aIntDist, theDepthMax);
1083 }
1084 else if (aIntDist > theDepthMin)
1085 {
1086 theDepthMin = Max (aIntDist, theDepthMin);
7fd59977 1087 }
1088 }
1089}
4269bd1b 1090
1091//=======================================================================
1092//function : PickingLine
1093//purpose :
1094//=======================================================================
1095gp_Lin StdSelect_ViewerSelector3d::PickingLine(const Standard_Real theX, const Standard_Real theY) const
1096{
1097 return myprj->Shoot (theX, theY);
1098}
1099
1100//=======================================================================
1101//function : DepthClipping
1102//purpose :
1103//=======================================================================
1104void StdSelect_ViewerSelector3d::DepthClipping (const Standard_Real theX,
1105 const Standard_Real theY,
1106 Standard_Real& theDepthMin,
1107 Standard_Real& theDepthMax) const
1108{
1109 return ComputeClipRange (myClipPlanes, PickingLine (theX, theY), theDepthMin, theDepthMax);
1110}
1111
1112//=======================================================================
1113//function : DepthClipping
1114//purpose :
1115//=======================================================================
1116void StdSelect_ViewerSelector3d::DepthClipping (const Standard_Real theX,
1117 const Standard_Real theY,
1118 const Handle(SelectMgr_EntityOwner)& theOwner,
1119 Standard_Real& theDepthMin,
1120 Standard_Real& theDepthMax) const
1121{
1122 return ComputeClipRange (theOwner->Selectable()->GetClipPlanes(),
1123 PickingLine (theX, theY),
1124 theDepthMin, theDepthMax);
1125}
1126
1127//=======================================================================
1128//function : HasDepthClipping
1129//purpose :
1130//=======================================================================
1131Standard_Boolean StdSelect_ViewerSelector3d::HasDepthClipping (const Handle(SelectMgr_EntityOwner)& theOwner) const
1132{
1133 if (!theOwner->HasSelectable())
1134 {
1135 return Standard_False;
1136 }
1137
1138 const Handle(SelectMgr_SelectableObject)& aSelectable = theOwner->Selectable();
1139 return (aSelectable->GetClipPlanes().Size() > 0);
1140}