0030672: Visualization - AIS_InteractiveContext::SetLocation() sets invalid selection...
[occt.git] / src / SelectMgr / SelectMgr_SelectionManager.cxx
CommitLineData
b311480e 1// Created on: 1995-02-13
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
b5cce1ab 17#include <SelectMgr_SelectionManager.hxx>
42cf5bc1 18
42cf5bc1 19#include <SelectMgr_SelectableObject.hxx>
7fd59977 20#include <SelectMgr_Selection.hxx>
7fd59977 21#include <TCollection_AsciiString.hxx>
7fd59977 22
25e59720 23IMPLEMENT_STANDARD_RTTIEXT(SelectMgr_SelectionManager,Standard_Transient)
92efcf78 24
7fd59977 25//==================================================
26// Function: Create
27// Purpose :
28//==================================================
68dcee02 29SelectMgr_SelectionManager::SelectMgr_SelectionManager (const Handle(SelectMgr_ViewerSelector)& theSelector)
30: mySelector (theSelector)
b5cce1ab 31{
32 //
33}
7fd59977 34
35//==================================================
7fd59977 36// Function: Contains
37// Purpose :
38//==================================================
f751596e 39Standard_Boolean SelectMgr_SelectionManager::Contains (const Handle(SelectMgr_SelectableObject)& theObject) const
40{
68dcee02 41 return myGlobal.Contains (theObject);
7fd59977 42}
43
7fd59977 44//==================================================
45// Function: Load
46// Purpose :
47//==================================================
f751596e 48void SelectMgr_SelectionManager::Load (const Handle(SelectMgr_SelectableObject)& theObject,
49 const Standard_Integer theMode)
7fd59977 50{
f751596e 51 if (myGlobal.Contains(theObject))
52 return;
7fd59977 53
f751596e 54 for (PrsMgr_ListOfPresentableObjectsIter anChildrenIter (theObject->Children()); anChildrenIter.More(); anChildrenIter.Next())
55 {
56 Load (Handle(SelectMgr_SelectableObject)::DownCast (anChildrenIter.Value()), theMode);
7fd59977 57 }
f751596e 58
59 if (!theObject->HasOwnPresentations())
60 return;
61
62 myGlobal.Add(theObject);
68dcee02 63 if (!mySelector->Contains (theObject) && theObject->HasOwnPresentations())
f751596e 64 {
68dcee02 65 mySelector->AddSelectableObject (theObject);
7fd59977 66 }
f751596e 67 if (theMode != -1)
68 loadMode (theObject, theMode);
7fd59977 69}
70
7fd59977 71//==================================================
72// Function: Remove
73// Purpose :
74//==================================================
f751596e 75void SelectMgr_SelectionManager::Remove (const Handle(SelectMgr_SelectableObject)& theObject)
7fd59977 76{
520cde87 77 for (PrsMgr_ListOfPresentableObjectsIter anChildrenIter (theObject->Children()); anChildrenIter.More(); anChildrenIter.Next())
78 {
79 Remove (Handle(SelectMgr_SelectableObject)::DownCast (anChildrenIter.Value()));
80 }
81
82 if (!theObject->HasOwnPresentations())
83 return;
84
f751596e 85 if (myGlobal.Contains (theObject))
86 {
68dcee02 87 if (mySelector->Contains (theObject))
f751596e 88 {
b5cce1ab 89 for (SelectMgr_SequenceOfSelection::Iterator aSelIter (theObject->Selections()); aSelIter.More(); aSelIter.Next())
f751596e 90 {
68dcee02 91 mySelector->RemoveSelectionOfObject (theObject, aSelIter.Value());
b5cce1ab 92 aSelIter.Value()->UpdateBVHStatus (SelectMgr_TBU_Remove);
66278500 93 mySelector->Deactivate (aSelIter.Value());
7fd59977 94 }
68dcee02 95 mySelector->RemoveSelectableObject (theObject);
7fd59977 96 }
f751596e 97 myGlobal.Remove (theObject);
7fd59977 98 }
f751596e 99
100 theObject->ClearSelections();
7fd59977 101}
102
103//==================================================
7fd59977 104// Function: Activate
105// Purpose :
106//==================================================
f751596e 107void SelectMgr_SelectionManager::Activate (const Handle(SelectMgr_SelectableObject)& theObject,
68dcee02 108 const Standard_Integer theMode)
7fd59977 109{
f751596e 110 if (theMode == -1)
111 return;
7fd59977 112
520cde87 113 for (PrsMgr_ListOfPresentableObjectsIter anChildIter (theObject->Children()); anChildIter.More(); anChildIter.Next())
f751596e 114 {
68dcee02 115 Activate (Handle(SelectMgr_SelectableObject)::DownCast (anChildIter.Value()), theMode);
520cde87 116 }
520cde87 117 if (!theObject->HasOwnPresentations())
f751596e 118 return;
7fd59977 119
f751596e 120 Standard_Boolean isComputed = Standard_False;
b5cce1ab 121 if (const Handle(SelectMgr_Selection)& aSelOld = theObject->Selection (theMode))
f751596e 122 {
b5cce1ab 123 isComputed = !aSelOld->IsEmpty();
f751596e 124 }
f751596e 125 if (!isComputed)
b5cce1ab 126 {
f751596e 127 loadMode (theObject, theMode);
b5cce1ab 128 }
f751596e 129
f751596e 130 const Handle(SelectMgr_Selection)& aSelection = theObject->Selection (theMode);
f751596e 131 switch (aSelection->UpdateStatus())
132 {
b5cce1ab 133 case SelectMgr_TOU_Full:
134 {
135 if (theObject->HasSelection (theMode))
136 {
68dcee02 137 mySelector->RemoveSelectionOfObject (theObject, aSelection);
b5cce1ab 138 }
139 theObject->RecomputePrimitives (theMode);
140 // pass through SelectMgr_TOU_Partial
141 }
b1811c1d 142 Standard_FALLTHROUGH
b5cce1ab 143 case SelectMgr_TOU_Partial:
144 {
81ce8c4d 145 theObject->UpdateTransformations (aSelection);
68dcee02 146 mySelector->RebuildObjectsTree();
b5cce1ab 147 break;
148 }
149 default:
150 break;
7fd59977 151 }
f751596e 152 aSelection->UpdateStatus(SelectMgr_TOU_None);
7fd59977 153
f751596e 154 switch (aSelection->BVHUpdateStatus())
155 {
b5cce1ab 156 case SelectMgr_TBU_Add:
157 case SelectMgr_TBU_Renew:
158 {
68dcee02 159 mySelector->AddSelectionToObject (theObject, aSelection);
b5cce1ab 160 break;
161 }
162 case SelectMgr_TBU_Remove:
163 {
164 if (aSelection->GetSelectionState() == SelectMgr_SOS_Deactivated)
165 {
68dcee02 166 mySelector->AddSelectionToObject (theObject, aSelection);
b5cce1ab 167 }
168 break;
169 }
170 default:
171 break;
f751596e 172 }
173 aSelection->UpdateBVHStatus (SelectMgr_TBU_None);
7fd59977 174
f751596e 175 if (myGlobal.Contains (theObject))
176 {
68dcee02 177 mySelector->Activate (theObject->Selection (theMode));
7fd59977 178 }
179}
180
181//==================================================
182// Function: Deactivate
183// Purpose :
184//==================================================
f751596e 185void SelectMgr_SelectionManager::Deactivate (const Handle(SelectMgr_SelectableObject)& theObject,
68dcee02 186 const Standard_Integer theMode)
7fd59977 187{
520cde87 188 for (PrsMgr_ListOfPresentableObjectsIter anChildrenIter (theObject->Children()); anChildrenIter.More(); anChildrenIter.Next())
f751596e 189 {
68dcee02 190 Deactivate (Handle(SelectMgr_SelectableObject)::DownCast (anChildrenIter.Value()), theMode);
520cde87 191 }
520cde87 192 if (!theObject->HasOwnPresentations())
b5cce1ab 193 {
f751596e 194 return;
b5cce1ab 195 }
68dcee02 196 if (!myGlobal.Contains(theObject))
b5cce1ab 197 {
198 return;
199 }
7fd59977 200
b5cce1ab 201 const Handle(SelectMgr_Selection)& aSel = theObject->Selection (theMode);
68dcee02 202 if (theMode == -1)
f751596e 203 {
68dcee02 204 for (SelectMgr_SequenceOfSelection::Iterator aSelIter (theObject->Selections()); aSelIter.More(); aSelIter.Next())
b5cce1ab 205 {
68dcee02 206 mySelector->Deactivate (aSelIter.Value());
b5cce1ab 207 }
7fd59977 208 }
68dcee02 209 else if (!aSel.IsNull())
7fd59977 210 {
68dcee02 211 mySelector->Deactivate (aSel);
f751596e 212 }
7fd59977 213}
7fd59977 214
f751596e 215//=======================================================================
216//function : IsActivated
217//purpose :
218//=======================================================================
219Standard_Boolean SelectMgr_SelectionManager::IsActivated (const Handle(SelectMgr_SelectableObject)& theObject,
68dcee02 220 const Standard_Integer theMode) const
7fd59977 221{
520cde87 222 for (PrsMgr_ListOfPresentableObjectsIter anChildrenIter (theObject->Children()); anChildrenIter.More(); anChildrenIter.Next())
7fd59977 223 {
68dcee02 224 if (IsActivated (Handle(SelectMgr_SelectableObject)::DownCast (anChildrenIter.Value()), theMode))
520cde87 225 return Standard_True;
226 }
520cde87 227 if (!theObject->HasOwnPresentations())
b5cce1ab 228 {
f751596e 229 return Standard_False;
b5cce1ab 230 }
68dcee02 231 if (!myGlobal.Contains(theObject))
b5cce1ab 232 {
f751596e 233 return Standard_False;
b5cce1ab 234 }
7fd59977 235
68dcee02 236 if (theMode == -1)
f751596e 237 {
b5cce1ab 238 for (SelectMgr_SequenceOfSelection::Iterator aSelIter (theObject->Selections()); aSelIter.More(); aSelIter.Next())
f751596e 239 {
68dcee02 240 if (mySelector->Status (aSelIter.Value()) == SelectMgr_SOS_Activated)
b5cce1ab 241 {
f751596e 242 return Standard_True;
b5cce1ab 243 }
f751596e 244 }
f751596e 245 return Standard_False;
246 }
7fd59977 247
f751596e 248 const Handle(SelectMgr_Selection)& aSelection = theObject->Selection (theMode);
b5cce1ab 249 if (aSelection.IsNull())
f751596e 250 {
b5cce1ab 251 return Standard_False;
7fd59977 252 }
68dcee02 253 return !aSelection.IsNull()
254 && mySelector->Status (aSelection) == SelectMgr_SOS_Activated;
7fd59977 255}
256
257//=======================================================================
f751596e 258//function : ClearSelectionStructures
259//purpose : Removes sensitive entities from all viewer selectors
260// after method Clear() was called to the selection they belonged to
261// or it was recomputed somehow
7fd59977 262//=======================================================================
f751596e 263void SelectMgr_SelectionManager::ClearSelectionStructures (const Handle(SelectMgr_SelectableObject)& theObj,
68dcee02 264 const Standard_Integer theMode)
7fd59977 265{
f751596e 266 for (PrsMgr_ListOfPresentableObjectsIter anChildrenIter (theObj->Children()); anChildrenIter.More(); anChildrenIter.Next())
267 {
68dcee02 268 ClearSelectionStructures (Handle(SelectMgr_SelectableObject)::DownCast (anChildrenIter.Value()), theMode);
7fd59977 269 }
7fd59977 270
f751596e 271 if (!theObj->HasOwnPresentations())
b5cce1ab 272 {
273 return;
274 }
68dcee02 275 if (!myGlobal.Contains(theObj))
b5cce1ab 276 {
f751596e 277 return;
b5cce1ab 278 }
7fd59977 279
b5cce1ab 280 if (theMode != -1)
281 {
282 if (const Handle(SelectMgr_Selection)& aSelection = theObj->Selection (theMode))
f751596e 283 {
68dcee02 284 mySelector->RemoveSelectionOfObject (theObj, aSelection);
b5cce1ab 285 aSelection->UpdateBVHStatus (SelectMgr_TBU_Add);
f751596e 286 }
b5cce1ab 287 }
288 else
289 {
290 for (SelectMgr_SequenceOfSelection::Iterator aSelIter (theObj->Selections()); aSelIter.More(); aSelIter.Next())
f751596e 291 {
b5cce1ab 292 const Handle(SelectMgr_Selection)& aSelection = aSelIter.Value();
68dcee02 293 mySelector->RemoveSelectionOfObject (theObj, aSelection);
b5cce1ab 294 aSelection->UpdateBVHStatus (SelectMgr_TBU_Add);
f751596e 295 }
7fd59977 296 }
68dcee02 297 mySelector->RebuildObjectsTree();
7fd59977 298}
299
300//=======================================================================
f751596e 301//function : RestoreSelectionStructuress
302//purpose : Re-adds newely calculated sensitive entities of recomputed selection
303// defined by mode theMode to all viewer selectors contained that selection.
7fd59977 304//=======================================================================
f751596e 305void SelectMgr_SelectionManager::RestoreSelectionStructures (const Handle(SelectMgr_SelectableObject)& theObj,
68dcee02 306 const Standard_Integer theMode)
7fd59977 307{
f751596e 308 for (PrsMgr_ListOfPresentableObjectsIter anChildrenIter (theObj->Children()); anChildrenIter.More(); anChildrenIter.Next())
309 {
68dcee02 310 RestoreSelectionStructures (Handle(SelectMgr_SelectableObject)::DownCast (anChildrenIter.Value()), theMode);
7fd59977 311 }
f751596e 312 if (!theObj->HasOwnPresentations())
b5cce1ab 313 {
314 return;
315 }
68dcee02 316 if (!myGlobal.Contains(theObj))
b5cce1ab 317 {
f751596e 318 return;
b5cce1ab 319 }
7fd59977 320
b5cce1ab 321 if (theMode != -1)
322 {
323 if (const Handle(SelectMgr_Selection)& aSelection = theObj->Selection (theMode))
f751596e 324 {
68dcee02 325 mySelector->AddSelectionToObject (theObj, aSelection);
b5cce1ab 326 aSelection->UpdateBVHStatus (SelectMgr_TBU_None);
f751596e 327 }
b5cce1ab 328 }
329 else
330 {
331 for (SelectMgr_SequenceOfSelection::Iterator aSelIter (theObj->Selections()); aSelIter.More(); aSelIter.Next())
f751596e 332 {
b5cce1ab 333 const Handle(SelectMgr_Selection)& aSelection = aSelIter.Value();
68dcee02 334 mySelector->AddSelectionToObject (theObj, aSelection);
b5cce1ab 335 aSelection->UpdateBVHStatus (SelectMgr_TBU_None);
f751596e 336 }
7fd59977 337 }
68dcee02 338 mySelector->RebuildObjectsTree();
7fd59977 339}
340
341//==================================================
45d5cbf8 342// Function: recomputeSelectionMode
343// Purpose :
344//==================================================
345void SelectMgr_SelectionManager::recomputeSelectionMode (const Handle(SelectMgr_SelectableObject)& theObject,
346 const Handle(SelectMgr_Selection)& theSelection,
347 const Standard_Integer theMode)
348{
349 theSelection->UpdateStatus (SelectMgr_TOU_Full);
350
68dcee02 351 ClearSelectionStructures (theObject, theMode);
352 theObject->RecomputePrimitives (theMode);
353 RestoreSelectionStructures (theObject, theMode);
354 theSelection->UpdateStatus (SelectMgr_TOU_None);
355 theSelection->UpdateBVHStatus (SelectMgr_TBU_None);
45d5cbf8 356}
357
358//==================================================
7fd59977 359// Function: Update
360// Purpose :
361//==================================================
f751596e 362void SelectMgr_SelectionManager::RecomputeSelection (const Handle(SelectMgr_SelectableObject)& theObject,
363 const Standard_Boolean theIsForce,
364 const Standard_Integer theMode)
7fd59977 365{
f751596e 366 if (theIsForce)
367 {
368 if (theMode == -1)
369 {
370 ClearSelectionStructures (theObject);
371 theObject->RecomputePrimitives();
372 theObject->UpdateTransformation();
373 RestoreSelectionStructures (theObject);
7fd59977 374 }
f751596e 375 else if (theObject->HasSelection (theMode))
376 {
377 ClearSelectionStructures (theObject, theMode);
378 theObject->RecomputePrimitives (theMode);
379 theObject->UpdateTransformation();
380 RestoreSelectionStructures (theObject, theMode);
7fd59977 381 }
382 return;
383 }
f751596e 384
385 for (PrsMgr_ListOfPresentableObjectsIter anChildrenIter (theObject->Children()); anChildrenIter.More(); anChildrenIter.Next())
386 {
387 RecomputeSelection (Handle(SelectMgr_SelectableObject)::DownCast (anChildrenIter.Value()), theIsForce, theMode);
388 }
f751596e 389 if (!theObject->HasOwnPresentations())
b5cce1ab 390 {
f751596e 391 return;
b5cce1ab 392 }
68dcee02 393 if (!myGlobal.Contains (theObject))
b5cce1ab 394 {
f751596e 395 return;
b5cce1ab 396 }
f751596e 397
45d5cbf8 398 if (theMode == -1)
f751596e 399 {
b5cce1ab 400 for (SelectMgr_SequenceOfSelection::Iterator aSelIter (theObject->Selections()); aSelIter.More(); aSelIter.Next())
f751596e 401 {
b5cce1ab 402 const Handle(SelectMgr_Selection)& aSelection = aSelIter.Value();
403 const Standard_Integer aSelMode = aSelection->Mode();
45d5cbf8 404 recomputeSelectionMode (theObject, aSelection, aSelMode);
7fd59977 405 }
406 }
45d5cbf8 407 else
408 {
b5cce1ab 409 if (const Handle(SelectMgr_Selection)& aSelection = theObject->Selection (theMode))
410 {
411 recomputeSelectionMode (theObject, aSelection, theMode);
412 }
45d5cbf8 413 }
7fd59977 414}
415
416//=======================================================================
417//function : Update
81bba717 418//purpose : Selections are recalculated if they are flagged
419// "TO RECALCULATE" and activated in one of selectors.
420// If ForceUpdate = True, and they are "TO RECALCULATE"
421// This is done without caring for the state of activation.
7fd59977 422//=======================================================================
f751596e 423void SelectMgr_SelectionManager::Update (const Handle(SelectMgr_SelectableObject)& theObject,
424 const Standard_Boolean theIsForce)
7fd59977 425{
f751596e 426 for (PrsMgr_ListOfPresentableObjectsIter aChildIter (theObject->Children()); aChildIter.More(); aChildIter.Next())
0717ddc1 427 {
f751596e 428 Update (Handle(SelectMgr_SelectableObject)::DownCast (aChildIter.Value()), theIsForce);
0717ddc1 429 }
f751596e 430 if (!theObject->HasOwnPresentations())
b5cce1ab 431 {
f751596e 432 return;
b5cce1ab 433 }
7fd59977 434
b5cce1ab 435 for (SelectMgr_SequenceOfSelection::Iterator aSelIter (theObject->Selections()); aSelIter.More(); aSelIter.Next())
f751596e 436 {
b5cce1ab 437 const Handle(SelectMgr_Selection)& aSelection = aSelIter.Value();
68dcee02 438 if (theIsForce || mySelector->Status (aSelection) == SelectMgr_SOS_Activated)
f751596e 439 {
440 switch (aSelection->UpdateStatus())
441 {
b5cce1ab 442 case SelectMgr_TOU_Full:
443 {
444 ClearSelectionStructures (theObject, aSelection->Mode());
445 theObject->RecomputePrimitives (aSelection->Mode()); // no break on purpose...
446 RestoreSelectionStructures (theObject, aSelection->Mode());
447 // pass through SelectMgr_TOU_Partial
448 }
b1811c1d 449 Standard_FALLTHROUGH
b5cce1ab 450 case SelectMgr_TOU_Partial:
451 {
452 theObject->UpdateTransformations (aSelection);
68dcee02 453 mySelector->RebuildObjectsTree();
b5cce1ab 454 break;
455 }
456 default:
457 break;
7fd59977 458 }
f751596e 459 aSelection->UpdateStatus (SelectMgr_TOU_None);
460 aSelection->UpdateBVHStatus (SelectMgr_TBU_None);
7fd59977 461 }
7fd59977 462 }
463}
464
465//==================================================
f751596e 466// Function: loadMode
467// Purpose : Private Method
7fd59977 468//==================================================
f751596e 469void SelectMgr_SelectionManager::loadMode (const Handle(SelectMgr_SelectableObject)& theObject,
68dcee02 470 const Standard_Integer theMode)
7fd59977 471{
f751596e 472 if (theMode == -1)
b5cce1ab 473 {
f751596e 474 return;
b5cce1ab 475 }
7fd59977 476
b5cce1ab 477 if (const Handle(SelectMgr_Selection)& aSelOld = theObject->Selection (theMode))
f751596e 478 {
b5cce1ab 479 if (aSelOld->IsEmpty())
f751596e 480 {
b5cce1ab 481 if (aSelOld->BVHUpdateStatus() == SelectMgr_TBU_Remove)
f751596e 482 {
b5cce1ab 483 Handle(SelectMgr_Selection) aNewSel = new SelectMgr_Selection (theMode);
484 theObject->AddSelection (aNewSel, theMode);
485 aNewSel->UpdateBVHStatus (SelectMgr_TBU_Remove);
486 aNewSel->SetSelectionState (SelectMgr_SOS_Deactivated);
f751596e 487 }
488 }
b5cce1ab 489 return;
490 }
491
492 Handle(SelectMgr_Selection) aNewSel = new SelectMgr_Selection (theMode);
493 theObject->AddSelection (aNewSel, theMode);
b5cce1ab 494 if (myGlobal.Contains (theObject))
495 {
68dcee02 496 mySelector->AddSelectionToObject (theObject, aNewSel);
497 aNewSel->UpdateBVHStatus (SelectMgr_TBU_None);
7fd59977 498 }
499}
500
7fd59977 501//=======================================================================
502//function : SetUpdateMode
f751596e 503//purpose :
7fd59977 504//=======================================================================
f751596e 505void SelectMgr_SelectionManager::SetUpdateMode (const Handle(SelectMgr_SelectableObject)& theObject,
506 const SelectMgr_TypeOfUpdate theType)
7fd59977 507{
b5cce1ab 508 for (SelectMgr_SequenceOfSelection::Iterator aSelIter (theObject->Selections()); aSelIter.More(); aSelIter.Next())
509 {
510 aSelIter.Value()->UpdateStatus (theType);
511 }
7fd59977 512}
513
f751596e 514//=======================================================================
515//function : SetUpdateMode
516//purpose :
517//=======================================================================
518void SelectMgr_SelectionManager::SetUpdateMode (const Handle(SelectMgr_SelectableObject)& theObject,
519 const Standard_Integer theMode,
520 const SelectMgr_TypeOfUpdate theType)
7fd59977 521{
b5cce1ab 522 if (const Handle(SelectMgr_Selection)& aSel = theObject->Selection (theMode))
523 {
524 aSel->UpdateStatus (theType);
525 }
7fd59977 526}
527
8a1170ad 528//=======================================================================
529//function : SetSelectionSensitivity
530//purpose : Allows to manage sensitivity of a particular selection of interactive object theObject and
531// changes previous sensitivity value of all sensitive entities in selection with theMode
532// to the given theNewSensitivity.
533//=======================================================================
534void SelectMgr_SelectionManager::SetSelectionSensitivity (const Handle(SelectMgr_SelectableObject)& theObject,
535 const Standard_Integer theMode,
536 const Standard_Integer theNewSens)
537{
b5cce1ab 538 Standard_ASSERT_RAISE (theNewSens > 0, "Error! Selection sensitivity have positive value.");
539 if (theObject.IsNull())
540 {
541 return;
542 }
8a1170ad 543
b5cce1ab 544 const Handle(SelectMgr_Selection)& aSel = theObject->Selection (theMode);
0e4e721c 545 if (aSel.IsNull())
b5cce1ab 546 {
8a1170ad 547 return;
b5cce1ab 548 }
8a1170ad 549
8a1170ad 550 const Standard_Integer aPrevSens = aSel->Sensitivity();
551 aSel->SetSensitivity (theNewSens);
68dcee02 552 if (myGlobal.Contains (theObject)
553 && mySelector->Contains (theObject))
8a1170ad 554 {
68dcee02 555 mySelector->myTolerances.Decrement (aPrevSens);
556 mySelector->myTolerances.Add (theNewSens);
557 mySelector->myToUpdateTolerance = Standard_True;
8a1170ad 558 }
559}
1d92133e 560
561//=======================================================================
562//function : UpdateSelection
563//purpose :
564//=======================================================================
565void SelectMgr_SelectionManager::UpdateSelection (const Handle(SelectMgr_SelectableObject)& theObject)
566{
68dcee02 567 if (myGlobal.Contains (theObject)
568 && mySelector->Contains (theObject))
1d92133e 569 {
68dcee02 570 mySelector->MoveSelectableObject (theObject);
1d92133e 571 }
572}