//-Methods, in order
-void Graphic3d_Group::Clear () {
-
- if (IsDeleted ()) return;
-
- MyCGroup.ContextLine.IsSet = 0,
- MyCGroup.ContextText.IsSet = 0,
- MyCGroup.ContextMarker.IsSet = 0,
- MyCGroup.ContextFillArea.IsSet = 0;
+void Graphic3d_Group::Clear (Standard_Boolean theUpdateStructureMgr)
+{
+ if (IsDeleted ()) return;
- MyCGroup.ContextLine.IsDef = 0,
- MyCGroup.ContextText.IsDef = 0,
- MyCGroup.ContextMarker.IsDef = 0,
- MyCGroup.ContextFillArea.IsDef = 0;
+ MyCGroup.ContextLine.IsSet = 0,
+ MyCGroup.ContextText.IsSet = 0,
+ MyCGroup.ContextMarker.IsSet = 0,
+ MyCGroup.ContextFillArea.IsSet = 0;
- MyCGroup.PickId.IsDef = 0,
- MyCGroup.PickId.IsSet = 0,
- MyCGroup.PickId.Value = 0;
+ MyCGroup.ContextLine.IsDef = 0,
+ MyCGroup.ContextText.IsDef = 0,
+ MyCGroup.ContextMarker.IsDef = 0,
+ MyCGroup.ContextFillArea.IsDef = 0;
- MyBounds.XMin = ShortRealLast (),
- MyBounds.YMin = ShortRealLast (),
- MyBounds.ZMin = ShortRealLast ();
+ MyCGroup.PickId.IsDef = 0,
+ MyCGroup.PickId.IsSet = 0,
+ MyCGroup.PickId.Value = 0;
- MyBounds.XMax = ShortRealFirst (),
- MyBounds.YMax = ShortRealFirst (),
- MyBounds.ZMax = ShortRealFirst ();
+ MyBounds.XMin = ShortRealLast (),
+ MyBounds.YMin = ShortRealLast (),
+ MyBounds.ZMin = ShortRealLast ();
- if (MyContainsFacet) MyStructure->GroupsWithFacet (-1);
- MyContainsFacet = Standard_False,
- MyIsEmpty = Standard_True;
+ MyBounds.XMax = ShortRealFirst (),
+ MyBounds.YMax = ShortRealFirst (),
+ MyBounds.ZMax = ShortRealFirst ();
- MyGraphicDriver->ClearGroup (MyCGroup);
+ if (MyContainsFacet) MyStructure->GroupsWithFacet (-1);
+ MyContainsFacet = Standard_False,
+ MyIsEmpty = Standard_True;
- Update ();
+ MyGraphicDriver->ClearGroup (MyCGroup);
+ // clear method could be used on Graphic3d_Structure destruction,
+ // and its structure manager could be already destroyed, in that
+ // case we don't need to update it;
+ if (theUpdateStructureMgr)
+ Update ();
}
void Graphic3d_Group::Destroy () {
Standard_Integer i, Length;
- // clean groups in graphics driver at first
+ // clean groups in graphics driver at first; this is also should be done
+ // to avoid unwanted group cleaning in group's destructor
+ // Pass Standard_False to Clear(..) method to avoid updating in
+ // structure manager, it isn't necessary, besides of it structure manager
+ // could be already destroyed and invalid pointers used in structure;
Length = MyGroups.Length();
for (Standard_Integer aGrId = 1; aGrId <= Length; ++aGrId)
- MyGroups.ChangeValue (aGrId)->Clear();
+ MyGroups.ChangeValue (aGrId)->Clear (Standard_False);
// Standard_Address APtr = (void *) This ().operator->();
Standard_Address APtr = (void *) this;