0029938: Visualization - SelectMgr_ViewerSelector::PickedPoint() should return point...
[occt.git] / src / SelectMgr / SelectMgr_SelectableObject.cxx
CommitLineData
b311480e 1// Created on: 1995-02-20
2// Created by: Mister rmi
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
f838dac4 17#include <SelectMgr_SelectableObject.hxx>
7fd59977 18
7f917335 19#include <Aspect_TypeOfMarker.hxx>
42cf5bc1 20#include <Bnd_Box.hxx>
21#include <gp_Pnt.hxx>
7f917335 22#include <Graphic3d_AspectLine3d.hxx>
23#include <Graphic3d_AspectMarker3d.hxx>
42cf5bc1 24#include <Prs3d_Drawer.hxx>
25#include <Prs3d_LineAspect.hxx>
26#include <Prs3d_PlaneAspect.hxx>
27#include <Prs3d_PointAspect.hxx>
28#include <Prs3d_Presentation.hxx>
69ff08ff 29#include <PrsMgr_PresentableObjectPointer.hxx>
42cf5bc1 30#include <PrsMgr_PresentationManager3d.hxx>
31#include <Select3D_SensitiveEntity.hxx>
32#include <SelectBasics_EntityOwner.hxx>
33#include <SelectMgr_EntityOwner.hxx>
c04c30b3 34#include <SelectMgr_IndexedMapOfOwner.hxx>
42cf5bc1 35#include <SelectMgr_Selection.hxx>
36#include <SelectMgr_SelectionManager.hxx>
37#include <Standard_NoSuchObject.hxx>
38#include <Standard_NotImplemented.hxx>
39#include <Standard_Type.hxx>
0717ddc1 40#include <TopLoc_Location.hxx>
7fd59977 41
92efcf78 42IMPLEMENT_STANDARD_RTTIEXT(SelectMgr_SelectableObject,PrsMgr_PresentableObject)
43
b5cce1ab 44namespace
7fd59977 45{
b5cce1ab 46 Handle(SelectMgr_Selection) THE_NULL_SELECTION;
47 Handle(SelectMgr_EntityOwner) THE_NULL_ENTITYOWNER;
48}
7fd59977 49
7fd59977 50//==================================================
f838dac4 51// Function: SelectMgr_SelectableObject
7fd59977 52// Purpose :
53//==================================================
54
c3282ec1 55SelectMgr_SelectableObject::SelectMgr_SelectableObject (const PrsMgr_TypeOfPresentation3d aTypeOfPresentation3d)
56: PrsMgr_PresentableObject (aTypeOfPresentation3d),
c3282ec1 57 myAutoHilight (Standard_True),
b5cce1ab 58 mycurrent (0),
c3282ec1 59 myGlobalSelMode (0)
7f917335 60{
f838dac4 61 //
7f917335 62}
7fd59977 63
4c0d97ac 64//==================================================
65// Function: Destructor
66// Purpose : Clears all selections of the object
67//==================================================
68SelectMgr_SelectableObject::~SelectMgr_SelectableObject()
69{
b5cce1ab 70 for (SelectMgr_SequenceOfSelection::Iterator aSelIter (myselections); aSelIter.More(); aSelIter.Next())
7411850a 71 {
b5cce1ab 72 aSelIter.Value()->Clear();
7411850a 73 }
7fd59977 74}
75
76//==================================================
f751596e 77// Function: RecomputePrimitives
78// Purpose : IMPORTANT: Do not use this method to update
79// selection primitives except implementing custom
80// selection manager! This method does not take
81// into account necessary BVH updates, but may
82// invalidate the pointers it refers to.
83// TO UPDATE SELECTION properly from outside classes,
84// use method UpdateSelection.
7fd59977 85//==================================================
f751596e 86void SelectMgr_SelectableObject::RecomputePrimitives()
7fd59977 87{
b5cce1ab 88 for (SelectMgr_SequenceOfSelection::Iterator aSelIter (myselections); aSelIter.More(); aSelIter.Next())
89 {
90 RecomputePrimitives (aSelIter.Value()->Mode());
91 }
7fd59977 92}
93
7fd59977 94//==================================================
f751596e 95// Function: RecomputePrimitives
96// Purpose : IMPORTANT: Do not use this method to update
97// selection primitives except implementing custom
98// selection manager! This method does not take
99// into account necessary BVH updates, but may
100// invalidate the pointers it refers to.
101// TO UPDATE SELECTION properly from outside classes,
102// use method UpdateSelection.
7fd59977 103//==================================================
f751596e 104void SelectMgr_SelectableObject::RecomputePrimitives (const Standard_Integer theMode)
7fd59977 105{
b5cce1ab 106 SelectMgr_SelectableObject* aSelParent = dynamic_cast<SelectMgr_SelectableObject* > (Parent());
107 for (SelectMgr_SequenceOfSelection::Iterator aSelIter (myselections); aSelIter.More(); aSelIter.Next())
f751596e 108 {
b5cce1ab 109 const Handle(SelectMgr_Selection)& aSel = aSelIter.Value();
110 if (aSel->Mode() == theMode)
f751596e 111 {
b5cce1ab 112 aSel->Clear();
113 ComputeSelection (aSel, theMode);
114 aSel->UpdateStatus (SelectMgr_TOU_Partial);
115 aSel->UpdateBVHStatus (SelectMgr_TBU_Renew);
116 if (theMode == 0 && aSelParent != NULL)
f751596e 117 {
b5cce1ab 118 if (const Handle(SelectMgr_EntityOwner)& anAsmOwner = aSelParent->GetAssemblyOwner())
119 {
120 SetAssemblyOwner (anAsmOwner, theMode);
121 }
f751596e 122 }
7fd59977 123 return;
124 }
125 }
f751596e 126
127 Handle(SelectMgr_Selection) aNewSel = new SelectMgr_Selection (theMode);
128 ComputeSelection (aNewSel, theMode);
129
b5cce1ab 130 if (theMode == 0 && aSelParent != NULL)
f751596e 131 {
b5cce1ab 132 if (const Handle(SelectMgr_EntityOwner)& anAsmOwner = aSelParent->GetAssemblyOwner())
133 {
134 SetAssemblyOwner (anAsmOwner, theMode);
135 }
f751596e 136 }
137
138 aNewSel->UpdateStatus (SelectMgr_TOU_Partial);
139 aNewSel->UpdateBVHStatus (SelectMgr_TBU_Add);
140
141 myselections.Append (aNewSel);
7fd59977 142}
143
144//==================================================
145// Function: ClearSelections
146// Purpose :
147//==================================================
b5cce1ab 148void SelectMgr_SelectableObject::ClearSelections (const Standard_Boolean theToUpdate)
7fd59977 149{
b5cce1ab 150 for (SelectMgr_SequenceOfSelection::Iterator aSelIter (myselections); aSelIter.More(); aSelIter.Next())
151 {
152 const Handle(SelectMgr_Selection)& aSel = aSelIter.Value();
153 aSel->Clear();
154 aSel->UpdateBVHStatus (SelectMgr_TBU_Remove);
155 if (theToUpdate)
f751596e 156 {
b5cce1ab 157 aSel->UpdateStatus (SelectMgr_TOU_Full);
f751596e 158 }
7fd59977 159 }
160}
161
162
163//==================================================
164// Function: Selection
165// Purpose :
166//==================================================
167
b5cce1ab 168const Handle(SelectMgr_Selection)& SelectMgr_SelectableObject::Selection (const Standard_Integer theMode) const
7fd59977 169{
b5cce1ab 170 if (theMode == -1)
171 {
172 return THE_NULL_SELECTION;
173 }
174
175 for (SelectMgr_SequenceOfSelection::Iterator aSelIter (myselections); aSelIter.More(); aSelIter.Next())
176 {
177 const Handle(SelectMgr_Selection)& aSel = aSelIter.Value();
178 if (aSel->Mode() == theMode)
7fd59977 179 {
b5cce1ab 180 return aSel;
181 }
182 }
183 return THE_NULL_SELECTION;
7fd59977 184}
185
7fd59977 186//==================================================
187// Function: AddSelection
188// Purpose :
189//==================================================
190
b5cce1ab 191void SelectMgr_SelectableObject::AddSelection (const Handle(SelectMgr_Selection)& theSel,
192 const Standard_Integer theMode)
7fd59977 193{
b5cce1ab 194 if(theSel->IsEmpty())
f751596e 195 {
b5cce1ab 196 ComputeSelection(theSel, theMode);
197 theSel->UpdateStatus(SelectMgr_TOU_Partial);
198 theSel->UpdateBVHStatus (SelectMgr_TBU_Add);
7fd59977 199 }
b5cce1ab 200
201 Standard_Boolean isReplaced = Standard_False;
202 for (SelectMgr_SequenceOfSelection::Iterator aSelIter (myselections); aSelIter.More(); aSelIter.Next())
f751596e 203 {
b5cce1ab 204 if (aSelIter.Value()->Mode() == theMode)
7fd59977 205 {
f751596e 206 isReplaced = Standard_True;
b5cce1ab 207 myselections.Remove (aSelIter);
208 break;
7fd59977 209 }
f751596e 210 }
211
b5cce1ab 212 myselections.Append (theSel);
f751596e 213 if (isReplaced)
214 {
215 myselections.Last()->UpdateBVHStatus (SelectMgr_TBU_Renew);
216 }
217
b5cce1ab 218 if (theMode == 0)
f751596e 219 {
b5cce1ab 220 SelectMgr_SelectableObject* aSelParent = dynamic_cast<SelectMgr_SelectableObject* > (Parent());
221 if (aSelParent != NULL)
69ff08ff 222 {
b5cce1ab 223 if (const Handle(SelectMgr_EntityOwner)& anAsmOwner = aSelParent->GetAssemblyOwner())
224 {
225 SetAssemblyOwner (anAsmOwner, theMode);
226 }
69ff08ff 227 }
f751596e 228 }
7fd59977 229}
230
7fd59977 231//=======================================================================
0717ddc1 232//function : ReSetTransformation
b5cce1ab 233//purpose :
7fd59977 234//=======================================================================
0717ddc1 235void SelectMgr_SelectableObject::ResetTransformation()
7fd59977 236{
b5cce1ab 237 for (SelectMgr_SequenceOfSelection::Iterator aSelIter (myselections); aSelIter.More(); aSelIter.Next())
f751596e 238 {
b5cce1ab 239 const Handle(SelectMgr_Selection)& aSel = aSelIter.Value();
240 aSel->UpdateStatus (SelectMgr_TOU_Partial);
241 aSel->UpdateBVHStatus (SelectMgr_TBU_None);
7fd59977 242 }
243
0717ddc1 244 PrsMgr_PresentableObject::ResetTransformation();
7fd59977 245}
246
7fd59977 247//=======================================================================
0717ddc1 248//function : UpdateTransformation
b5cce1ab 249//purpose :
7fd59977 250//=======================================================================
825aa485 251void SelectMgr_SelectableObject::UpdateTransformation()
7fd59977 252{
b5cce1ab 253 for (SelectMgr_SequenceOfSelection::Iterator aSelIter (myselections); aSelIter.More(); aSelIter.Next())
825aa485 254 {
b5cce1ab 255 aSelIter.Value()->UpdateStatus (SelectMgr_TOU_Partial);
7fd59977 256 }
7fd59977 257
825aa485 258 PrsMgr_PresentableObject::UpdateTransformation();
7fd59977 259}
260
7fd59977 261//=======================================================================
0717ddc1 262//function : UpdateTransformation
b5cce1ab 263//purpose :
7fd59977 264//=======================================================================
b5cce1ab 265void SelectMgr_SelectableObject::UpdateTransformations (const Handle(SelectMgr_Selection)& theSel)
7fd59977 266{
b5cce1ab 267 const TopLoc_Location aSelfLocation (Transformation());
b5cce1ab 268 for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator aSelEntIter (theSel->Entities()); aSelEntIter.More(); aSelEntIter.Next())
269 {
270 if (Handle(Select3D_SensitiveEntity) aSensEntity = Handle(Select3D_SensitiveEntity)::DownCast (aSelEntIter.Value()->BaseSensitive()))
271 {
272 const Handle(SelectBasics_EntityOwner)& aEOwner = aSensEntity->OwnerId();
273 if (Handle(SelectMgr_EntityOwner) aMgrEO = Handle(SelectMgr_EntityOwner)::DownCast (aEOwner))
274 {
0717ddc1 275 aMgrEO->SetLocation (aSelfLocation);
b5cce1ab 276 }
7fd59977 277 }
278 }
279}
280
281//=======================================================================
282//function : HilightSelected
b5cce1ab 283//purpose :
7fd59977 284//=======================================================================
b5cce1ab 285void SelectMgr_SelectableObject::HilightSelected (const Handle(PrsMgr_PresentationManager3d)&,
286 const SelectMgr_SequenceOfOwner&)
7fd59977 287{
9775fa61 288 throw Standard_NotImplemented("SelectMgr_SelectableObject::HilightSelected");
7fd59977 289}
290
291//=======================================================================
292//function : ClearSelected
b5cce1ab 293//purpose :
7fd59977 294//=======================================================================
b5cce1ab 295void SelectMgr_SelectableObject::ClearSelected()
7fd59977 296{
b5cce1ab 297 if(!mySelectionPrs.IsNull())
298 {
2b442de5 299 mySelectionPrs->Clear();
b5cce1ab 300 }
7fd59977 301}
302
731c9b5b 303//=======================================================================
304//function : ClearDynamicHighlight
305//purpose :
306//=======================================================================
307void SelectMgr_SelectableObject::ClearDynamicHighlight (const Handle(PrsMgr_PresentationManager3d)& theMgr)
308{
309 theMgr->ClearImmediateDraw();
310}
311
7fd59977 312//=======================================================================
313//function : HilightOwnerWithColor
b5cce1ab 314//purpose :
7fd59977 315//=======================================================================
8e5fb5ea 316void SelectMgr_SelectableObject::HilightOwnerWithColor (const Handle(PrsMgr_PresentationManager3d)&,
f838dac4 317 const Handle(Prs3d_Drawer)&,
8e5fb5ea 318 const Handle(SelectMgr_EntityOwner)&)
7fd59977 319{
9775fa61 320 throw Standard_NotImplemented("SelectMgr_SelectableObject::HilightOwnerWithColor");
7fd59977 321}
322
323//=======================================================================
b5cce1ab 324//function : IsAutoHilight
325//purpose :
7fd59977 326//=======================================================================
b5cce1ab 327Standard_Boolean SelectMgr_SelectableObject::IsAutoHilight() const
7fd59977 328{
329 return myAutoHilight;
330}
331
332//=======================================================================
b5cce1ab 333//function : SetAutoHilight
334//purpose :
7fd59977 335//=======================================================================
336void SelectMgr_SelectableObject::SetAutoHilight ( const Standard_Boolean newAutoHilight )
337{
338 myAutoHilight = newAutoHilight;
339}
340
341//=======================================================================
342//function : GetHilightPresentation
b5cce1ab 343//purpose :
7fd59977 344//=======================================================================
778cd667 345Handle(Prs3d_Presentation) SelectMgr_SelectableObject::GetHilightPresentation (const Handle(PrsMgr_PresentationManager3d)& theMgr)
7fd59977 346{
778cd667 347 if (myHilightPrs.IsNull() && !theMgr.IsNull())
348 {
349 myHilightPrs = new Prs3d_Presentation (theMgr->StructureManager());
350 myHilightPrs->SetTransformPersistence (TransformPersistence());
e2aba8eb 351 myHilightPrs->SetClipPlanes (myClipPlanes);
778cd667 352 }
7fd59977 353
354 return myHilightPrs;
355}
356
357
358//=======================================================================
359//function : GetSelectPresentation
b5cce1ab 360//purpose :
7fd59977 361//=======================================================================
778cd667 362Handle(Prs3d_Presentation) SelectMgr_SelectableObject::GetSelectPresentation (const Handle(PrsMgr_PresentationManager3d)& theMgr)
7fd59977 363{
778cd667 364 if (mySelectionPrs.IsNull() && !theMgr.IsNull())
365 {
366 mySelectionPrs = new Prs3d_Presentation (theMgr->StructureManager());
367 mySelectionPrs->SetTransformPersistence (TransformPersistence());
e2aba8eb 368 mySelectionPrs->SetClipPlanes (myClipPlanes);
7fd59977 369 }
778cd667 370
7fd59977 371 return mySelectionPrs;
372}
373
905b0e31 374//=======================================================================
375//function : ErasePresentations
376//purpose :
377//=======================================================================
378void SelectMgr_SelectableObject::ErasePresentations (Standard_Boolean theToRemove)
379{
380 if (!mySelectionPrs.IsNull())
381 {
382 mySelectionPrs->Erase();
383 if (theToRemove)
384 {
385 mySelectionPrs->Clear();
386 mySelectionPrs.Nullify();
387 }
388 }
389 if (!myHilightPrs.IsNull())
390 {
391 myHilightPrs->Erase();
392 if (theToRemove)
393 {
394 myHilightPrs->Clear();
395 myHilightPrs.Nullify();
396 }
397 }
398}
399
59f45b7c 400//=======================================================================
401//function : SetZLayer
402//purpose :
403//=======================================================================
a1954302 404void SelectMgr_SelectableObject::SetZLayer (const Graphic3d_ZLayerId theLayerId)
59f45b7c 405{
59f45b7c 406 // update own presentations
a1954302 407 PrsMgr_PresentableObject::SetZLayer (theLayerId);
59f45b7c 408
409 // update selection presentations
410 if (!mySelectionPrs.IsNull())
411 mySelectionPrs->SetZLayer (theLayerId);
412
413 if (!myHilightPrs.IsNull())
414 myHilightPrs->SetZLayer (theLayerId);
415
416 // update all entity owner presentations
b5cce1ab 417 for (SelectMgr_SequenceOfSelection::Iterator aSelIter (myselections); aSelIter.More(); aSelIter.Next())
59f45b7c 418 {
b5cce1ab 419 const Handle(SelectMgr_Selection)& aSel = aSelIter.Value();
420 for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator aSelEntIter (aSel->Entities()); aSelEntIter.More(); aSelEntIter.Next())
59f45b7c 421 {
b5cce1ab 422 if (Handle(Select3D_SensitiveEntity) aEntity = Handle(Select3D_SensitiveEntity)::DownCast (aSelEntIter.Value()->BaseSensitive()))
59f45b7c 423 {
b5cce1ab 424 if (Handle(SelectMgr_EntityOwner) aOwner = Handle(SelectMgr_EntityOwner)::DownCast (aEntity->OwnerId()))
425 {
a1954302 426 aOwner->SetZLayer (theLayerId);
b5cce1ab 427 }
59f45b7c 428 }
429 }
430 }
431}
6262338c 432
e2aba8eb 433//=======================================================================
434//function : UpdateClipping
435//purpose :
436//=======================================================================
437void SelectMgr_SelectableObject::UpdateClipping()
438{
439 PrsMgr_PresentableObject::UpdateClipping();
440 if (!mySelectionPrs.IsNull())
441 {
442 mySelectionPrs->SetClipPlanes (myClipPlanes);
443 }
444 if (!myHilightPrs.IsNull())
445 {
446 myHilightPrs->SetClipPlanes (myClipPlanes);
447 }
448}
449
f751596e 450//=======================================================================
21a2b7cc 451//function : updateSelection
f751596e 452//purpose : Sets update status FULL to selections of the object. Must be
453// used as the only method of UpdateSelection from outer classes
454// to prevent BVH structures from being outdated.
455//=======================================================================
21a2b7cc 456void SelectMgr_SelectableObject::updateSelection (const Standard_Integer theMode)
f751596e 457{
458 if (theMode == -1)
459 {
b5cce1ab 460 for (SelectMgr_SequenceOfSelection::Iterator aSelIter (myselections); aSelIter.More(); aSelIter.Next())
f751596e 461 {
b5cce1ab 462 const Handle(SelectMgr_Selection)& aSel = aSelIter.Value();
f751596e 463 aSel->UpdateStatus (SelectMgr_TOU_Full);
464 }
f751596e 465 return;
466 }
467
b5cce1ab 468 for (SelectMgr_SequenceOfSelection::Iterator aSelIter (myselections); aSelIter.More(); aSelIter.Next())
f751596e 469 {
b5cce1ab 470 const Handle(SelectMgr_Selection)& aSel = aSelIter.Value();
471 if (aSel->Mode() == theMode)
f751596e 472 {
b5cce1ab 473 aSel->UpdateStatus (SelectMgr_TOU_Full);
f751596e 474 return;
475 }
476 }
477}
478
f751596e 479//=======================================================================
480//function : SetAssemblyOwner
481//purpose : Sets common entity owner for assembly sensitive object entities
482//=======================================================================
483void SelectMgr_SelectableObject::SetAssemblyOwner (const Handle(SelectMgr_EntityOwner)& theOwner,
484 const Standard_Integer theMode)
485{
486 if (theMode == -1)
487 {
b5cce1ab 488 for (SelectMgr_SequenceOfSelection::Iterator aSelIter (myselections); aSelIter.More(); aSelIter.Next())
f751596e 489 {
b5cce1ab 490 const Handle(SelectMgr_Selection)& aSel = aSelIter.Value();
491 for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator aSelEntIter (aSel->Entities()); aSelEntIter.More(); aSelEntIter.Next())
f751596e 492 {
b5cce1ab 493 aSelEntIter.Value()->BaseSensitive()->Set (theOwner);
f751596e 494 }
495 }
f751596e 496 return;
497 }
498
b5cce1ab 499 for (SelectMgr_SequenceOfSelection::Iterator aSelIter (myselections); aSelIter.More(); aSelIter.Next())
f751596e 500 {
b5cce1ab 501 const Handle(SelectMgr_Selection)& aSel = aSelIter.Value();
502 if (aSel->Mode() == theMode)
f751596e 503 {
b5cce1ab 504 for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator aSelEntIter (aSel->Entities()); aSelEntIter.More(); aSelEntIter.Next())
f751596e 505 {
b5cce1ab 506 aSelEntIter.Value()->BaseSensitive()->Set (theOwner);
f751596e 507 }
508 return;
509 }
510 }
511}
512
b586500b 513//=======================================================================
514//function : BndBoxOfSelected
02974a19 515//purpose :
b586500b 516//=======================================================================
02974a19 517Bnd_Box SelectMgr_SelectableObject::BndBoxOfSelected (const Handle(SelectMgr_IndexedMapOfOwner)& theOwners)
b586500b 518{
b586500b 519 if (theOwners->IsEmpty())
02974a19 520 return Bnd_Box();
b586500b 521
02974a19 522 Bnd_Box aBnd;
b5cce1ab 523 for (SelectMgr_SequenceOfSelection::Iterator aSelIter (myselections); aSelIter.More(); aSelIter.Next())
b586500b 524 {
b5cce1ab 525 const Handle(SelectMgr_Selection)& aSel = aSelIter.Value();
b586500b 526 if (aSel->GetSelectionState() != SelectMgr_SOS_Activated)
527 continue;
528
b5cce1ab 529 for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator aSelEntIter (aSel->Entities()); aSelEntIter.More(); aSelEntIter.Next())
b586500b 530 {
b5cce1ab 531 const Handle(SelectMgr_EntityOwner) anOwner = Handle(SelectMgr_EntityOwner)::DownCast (aSelEntIter.Value()->BaseSensitive()->OwnerId());
b586500b 532 if (theOwners->Contains (anOwner))
533 {
b5cce1ab 534 Select3D_BndBox3d aBox = aSelEntIter.Value()->BaseSensitive()->BoundingBox();
02974a19 535 aBnd.Update (aBox.CornerMin().x(), aBox.CornerMin().y(), aBox.CornerMin().z(),
536 aBox.CornerMax().x(), aBox.CornerMax().y(), aBox.CornerMax().z());
b586500b 537 }
538 }
539 }
540
541 return aBnd;
542}
c3282ec1 543
544//=======================================================================
545//function : GlobalSelOwner
546//purpose : Returns entity owner corresponding to selection of the object as a whole
547//=======================================================================
548Handle(SelectMgr_EntityOwner) SelectMgr_SelectableObject::GlobalSelOwner() const
549{
c3282ec1 550 const Handle(SelectMgr_Selection)& aGlobalSel = Selection (myGlobalSelMode);
b5cce1ab 551 if (!aGlobalSel.IsNull()
552 && !aGlobalSel->IsEmpty())
553 {
554 return Handle(SelectMgr_EntityOwner)::DownCast (aGlobalSel->Entities().First()->BaseSensitive()->OwnerId());
555 }
556 return THE_NULL_ENTITYOWNER;
557}
c3282ec1 558
b5cce1ab 559//=======================================================================
560//function : GetAssemblyOwner
561//purpose :
562//=======================================================================
563const Handle(SelectMgr_EntityOwner)& SelectMgr_SelectableObject::GetAssemblyOwner() const
564{
565 return THE_NULL_ENTITYOWNER;
c3282ec1 566}