From eb4320f2d9eab96323bbd611c373ab632b7b6cda Mon Sep 17 00:00:00 2001 From: dbv Date: Thu, 3 Oct 2013 14:11:13 +0400 Subject: [PATCH] 0023654: Problem with displaying vertices in OCC view after closing all OCC views and opening new one Fixed graphic structure recompute after closing view. Removed collector and all corresponding logic and methods from AIS_InteractiveContext. Method AIS_InteractiveContext::Erase() now hide object from viewer without deleting resources. Erased objects now properly recomputed after closing view. Samples update Removed useless method AIS_InteractiveContext::EraseMode() Documentation update Warnings fix Regressions fix --- .../standard/01_Geometry/src/GeomSources.cpp | 4 +- .../standard/02_Modeling/src/ModelingDoc.cpp | 22 +- .../standard/04_Viewer3d/src/Viewer3dDoc.cpp | 6 +- .../07_Triangulation/src/TriangulationDoc.cpp | 4 +- .../standard/08_HLR/src/SelectionDialog.cpp | 2 +- .../10_Convert/src/WNT/OCCDemoDoc.cpp | 6 +- samples/mfc/standard/Common/OCC_3dBaseDoc.cpp | 4 +- .../Common/Primitive/Sample2D_Markers.cpp | 2 +- samples/qt/Common/src/DocumentCommon.cxx | 2 +- samples/qt/VoxelDemo/src/Application.cpp | 14 +- src/AIS/AIS.cdl | 1 - src/AIS/AIS_InteractiveContext.cdl | 170 +---- src/AIS/AIS_InteractiveContext.cxx | 646 ++++-------------- src/AIS/AIS_InteractiveContext.lxx | 18 - src/AIS/AIS_InteractiveContext_1.cxx | 50 +- src/AIS/AIS_InteractiveContext_2.cxx | 46 +- src/AIS/AIS_InteractiveContext_3.cxx | 22 - src/AIS/AIS_LocalContext.cxx | 55 +- src/AIS/AIS_LocalContext_1.cxx | 18 +- src/Graphic3d/Graphic3d_GraphicDriver.cdl | 17 +- src/Graphic3d/Graphic3d_GraphicDriver.cxx | 11 + src/Graphic3d/Graphic3d_Structure.cdl | 5 + src/Graphic3d/Graphic3d_Structure.cxx | 17 +- src/Graphic3d/Graphic3d_StructureManager.cdl | 29 +- src/Graphic3d/Graphic3d_StructureManager.cxx | 35 +- src/OpenGl/OpenGl_GraphicDriver.hxx | 5 - src/OpenGl/OpenGl_GraphicDriver_3.cxx | 17 - src/OpenGl/OpenGl_GraphicDriver_7.cxx | 3 + src/PrsMgr/PrsMgr_PresentableObject.cdl | 1 + src/PrsMgr/PrsMgr_Presentation.cdl | 4 +- src/PrsMgr/PrsMgr_Presentation3d.cdl | 14 +- src/PrsMgr/PrsMgr_Presentation3d.cxx | 72 +- src/PrsMgr/PrsMgr_PresentationManager.cdl | 5 + src/PrsMgr/PrsMgr_PresentationManager.cxx | 6 + src/PrsMgr/PrsMgr_Prs.cdl | 5 +- src/PrsMgr/PrsMgr_Prs.cxx | 10 + src/QABugs/QABugs_1.cxx | 8 +- src/QABugs/QABugs_11.cxx | 20 +- src/ViewerTest/ViewerTest.cxx | 2 +- src/ViewerTest/ViewerTest_ObjectCommands.cxx | 475 ++++++++----- src/ViewerTest/ViewerTest_ViewerCommands.cxx | 24 +- src/Visual3d/Visual3d_View.cxx | 99 +-- src/Visual3d/Visual3d_ViewManager.cxx | 2 - tests/bugs/vis/bug2066 | 3 +- tests/bugs/vis/bug23654_MarkersRecompute | 83 +++ 45 files changed, 817 insertions(+), 1247 deletions(-) create mode 100644 tests/bugs/vis/bug23654_MarkersRecompute diff --git a/samples/mfc/standard/01_Geometry/src/GeomSources.cpp b/samples/mfc/standard/01_Geometry/src/GeomSources.cpp index 6ac43ba82b..b5da460b14 100755 --- a/samples/mfc/standard/01_Geometry/src/GeomSources.cpp +++ b/samples/mfc/standard/01_Geometry/src/GeomSources.cpp @@ -18,7 +18,7 @@ void GeomSources::PreProcess(CGeometryDoc* aDoc,DisplayType aDisplayType) { if (aDisplayType == No2D3D ) { - aDoc->GetAISContext()->EraseAll(Standard_False); + aDoc->GetAISContext()->EraseAll(); aDoc->Put3DOnTop(); } @@ -40,7 +40,7 @@ void GeomSources::PreProcess(CGeometryDoc* aDoc,DisplayType aDisplayType) if (aDisplayType == a2D3D) { - aDoc->GetAISContext()->EraseAll(Standard_False); + aDoc->GetAISContext()->EraseAll(); aDoc->GetISessionContext()->EraseAll(); aDoc->Put3DOnTop(false); aDoc->Put2DOnTop(false); diff --git a/samples/mfc/standard/02_Modeling/src/ModelingDoc.cpp b/samples/mfc/standard/02_Modeling/src/ModelingDoc.cpp index f4ab37af4c..0a7a7b0f85 100755 --- a/samples/mfc/standard/02_Modeling/src/ModelingDoc.cpp +++ b/samples/mfc/standard/02_Modeling/src/ModelingDoc.cpp @@ -1106,8 +1106,8 @@ Sleep(1000); TopoDS_Shape ShapeCut = BRepAlgoAPI_Cut(theSphere,theBox); -myAISContext->Erase(ais1,Standard_False,Standard_False); -myAISContext->Erase(ais2,Standard_False,Standard_False); +myAISContext->Erase(ais1,Standard_False); +myAISContext->Erase(ais2,Standard_False); Handle (AIS_Shape) aSection = new AIS_Shape(ShapeCut); myAISContext->SetDisplayMode(aSection,1,Standard_False); @@ -1169,8 +1169,8 @@ Sleep(1000); TopoDS_Shape FusedShape = BRepAlgoAPI_Fuse(theBox1,theBox2); -myAISContext->Erase(ais1,Standard_True,Standard_False); -myAISContext->Erase(ais2,Standard_True,Standard_False); +myAISContext->Erase(ais1,Standard_True); +myAISContext->Erase(ais2,Standard_True); Handle (AIS_Shape) aFusion = new AIS_Shape(FusedShape); myAISContext->SetDisplayMode(aFusion,1,Standard_False); @@ -1226,8 +1226,8 @@ Sleep(500); TopoDS_Shape theCommonSurface = BRepAlgoAPI_Common(theBox,theWedge); -myAISContext->Erase(aboxshape,Standard_True,Standard_False); -myAISContext->Erase(awedge,Standard_True,Standard_False); +myAISContext->Erase(aboxshape,Standard_True); +myAISContext->Erase(awedge,Standard_True); Handle(AIS_Shape) acommon = new AIS_Shape(theCommonSurface); myAISContext->SetColor(acommon,Quantity_NOC_GREEN,Standard_False); @@ -1717,7 +1717,7 @@ myAISContext->SetCurrentObject(aBlendedBox,Standard_False); Fit(); Sleep(500); -myAISContext->Erase(ais1,Standard_True,Standard_False); +myAISContext->Erase(ais1,Standard_True); TCollection_AsciiString Message ("\ \n\ @@ -2137,7 +2137,7 @@ void CModelingDoc::OnGlueLocal() BRepFeat_Gluer glue(S2,S1); glue.Bind(F2,F1); TopoDS_Shape res1 = glue.Shape(); - myAISContext->Erase(ais2,Standard_False,Standard_False); + myAISContext->Erase(ais2,Standard_False); ais1->Set(res1); @@ -2187,7 +2187,7 @@ void CModelingDoc::OnGlueLocal() for (CommonEdges.InitIterator(); CommonEdges.More(); CommonEdges.Next()) glue2.Bind(CommonEdges.EdgeFrom(),CommonEdges.EdgeTo()); TopoDS_Shape res2 = glue2.Shape(); - myAISContext->Erase(ais3,Standard_False,Standard_False); + myAISContext->Erase(ais3,Standard_False); ais4->Set(res2); @@ -2484,7 +2484,7 @@ void CModelingDoc::OnSplitLocal() asplit.Build(); //Sleep(1000); - myAISContext->Erase(ais1,Standard_False,Standard_False); + myAISContext->Erase(ais1,Standard_False); //Fit(); TopoDS_Shape Result = asplit.Shape(); @@ -2565,7 +2565,7 @@ void CModelingDoc::OnThickLocal() Fit(); Sleep(1000); - myAISContext->Erase(abox1,Standard_True,Standard_False); + myAISContext->Erase(abox1,Standard_True); Fit(); diff --git a/samples/mfc/standard/04_Viewer3d/src/Viewer3dDoc.cpp b/samples/mfc/standard/04_Viewer3d/src/Viewer3dDoc.cpp index 7ffd698099..afb33e7e2c 100755 --- a/samples/mfc/standard/04_Viewer3d/src/Viewer3dDoc.cpp +++ b/samples/mfc/standard/04_Viewer3d/src/Viewer3dDoc.cpp @@ -985,7 +985,7 @@ BOOL CViewer3dDoc::OnNewDocument() // (SDI documents will reuse this document) SetTitle(myPresentation->GetName()); - myAISContext->EraseAll(Standard_False); + myAISContext->EraseAll(); myAISContext->SetDisplayMode(AIS_Shaded); POSITION pos = GetFirstViewPosition(); @@ -1046,14 +1046,14 @@ void CViewer3dDoc::DoSample() void CViewer3dDoc::OnBUTTONStart() { - myAISContext->EraseAll(Standard_False); + myAISContext->EraseAll(); myPresentation->FirstSample(); DoSample(); } void CViewer3dDoc::OnBUTTONEnd() { - myAISContext->EraseAll(Standard_False); + myAISContext->EraseAll(); myPresentation->LastSample(); DoSample(); } diff --git a/samples/mfc/standard/07_Triangulation/src/TriangulationDoc.cpp b/samples/mfc/standard/07_Triangulation/src/TriangulationDoc.cpp index 88b8697ad1..c1826312c7 100755 --- a/samples/mfc/standard/07_Triangulation/src/TriangulationDoc.cpp +++ b/samples/mfc/standard/07_Triangulation/src/TriangulationDoc.cpp @@ -360,14 +360,14 @@ void CTriangulationDoc::DoSample() void CTriangulationDoc::OnBUTTONStart() { - myAISContext->EraseAll(Standard_False); + myAISContext->EraseAll(); myPresentation->FirstSample(); DoSample(); } void CTriangulationDoc::OnBUTTONEnd() { - myAISContext->EraseAll(Standard_False); + myAISContext->EraseAll(); myPresentation->LastSample(); DoSample(); } diff --git a/samples/mfc/standard/08_HLR/src/SelectionDialog.cpp b/samples/mfc/standard/08_HLR/src/SelectionDialog.cpp index 25f7a16d8d..afd7d09d8b 100644 --- a/samples/mfc/standard/08_HLR/src/SelectionDialog.cpp +++ b/samples/mfc/standard/08_HLR/src/SelectionDialog.cpp @@ -166,7 +166,7 @@ void CSelectionDialog::OnGetShape() UpdateProjector(); myDisplayableShape->SetNbIsos(m_NbIsos); - myInteractiveContext->EraseAll(Standard_False); + myInteractiveContext->EraseAll(); myInteractiveContext->Display(myTrihedron); Standard_Boolean OneOrMoreFound = Standard_False; diff --git a/samples/mfc/standard/10_Convert/src/WNT/OCCDemoDoc.cpp b/samples/mfc/standard/10_Convert/src/WNT/OCCDemoDoc.cpp index 70798193fb..f813941f2a 100755 --- a/samples/mfc/standard/10_Convert/src/WNT/OCCDemoDoc.cpp +++ b/samples/mfc/standard/10_Convert/src/WNT/OCCDemoDoc.cpp @@ -73,7 +73,7 @@ BOOL COCCDemoDoc::OnNewDocument() // (SDI documents will reuse this document) SetTitle(myPresentation->GetName()); - myAISContext->EraseAll(Standard_False); + myAISContext->EraseAll(); myAISContext->SetDisplayMode(AIS_Shaded); POSITION pos = GetFirstViewPosition(); @@ -164,14 +164,14 @@ void COCCDemoDoc::DoSample() void COCCDemoDoc::OnBUTTONStart() { - myAISContext->EraseAll(Standard_False); + myAISContext->EraseAll(); myPresentation->FirstSample(); DoSample(); } void COCCDemoDoc::OnBUTTONEnd() { - myAISContext->EraseAll(Standard_False); + myAISContext->EraseAll(); myPresentation->LastSample(); DoSample(); } diff --git a/samples/mfc/standard/Common/OCC_3dBaseDoc.cpp b/samples/mfc/standard/Common/OCC_3dBaseDoc.cpp index fb2ef67834..e7246c9ab5 100755 --- a/samples/mfc/standard/Common/OCC_3dBaseDoc.cpp +++ b/samples/mfc/standard/Common/OCC_3dBaseDoc.cpp @@ -260,7 +260,7 @@ void OCC_3dBaseDoc::OnUpdateObjectColor(CCmdUI* pCmdUI) void OCC_3dBaseDoc::OnObjectErase() { for(myAISContext->InitCurrent();myAISContext->MoreCurrent();myAISContext->NextCurrent()) - myAISContext->Erase(myAISContext->Current(),Standard_True,Standard_False); + myAISContext->Erase(myAISContext->Current(),Standard_True); myAISContext->ClearCurrents(); } void OCC_3dBaseDoc::OnUpdateObjectErase(CCmdUI* pCmdUI) @@ -363,7 +363,7 @@ void OCC_3dBaseDoc::OnUpdateObjectTransparency(CCmdUI* pCmdUI) void OCC_3dBaseDoc::OnObjectDisplayall() { - myAISContext->DisplayAll(Standard_False); + myAISContext->DisplayAll(); } void OCC_3dBaseDoc::OnUpdateObjectDisplayall(CCmdUI* pCmdUI) diff --git a/samples/mfc/standard/Common/Primitive/Sample2D_Markers.cpp b/samples/mfc/standard/Common/Primitive/Sample2D_Markers.cpp index e54a90b361..4e26df513f 100755 --- a/samples/mfc/standard/Common/Primitive/Sample2D_Markers.cpp +++ b/samples/mfc/standard/Common/Primitive/Sample2D_Markers.cpp @@ -50,7 +50,7 @@ void Sample2D_Markers::Compute ( const Handle(PrsMgr_PresentationManager3d)& aP else { Handle(Graphic3d_AspectMarker3d) aMarker = new Graphic3d_AspectMarker3d(myMarkerType,myColor,myIndex); - aPresentation->SetPrimitivesAspect(aMarker); + Prs3d_Root::CurrentGroup (aPresentation)->SetPrimitivesAspect(aMarker); Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints = new Graphic3d_ArrayOfPoints (1); anArrayOfPoints->AddVertex (myXPosition, myYPosition, 0); Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray (anArrayOfPoints); diff --git a/samples/qt/Common/src/DocumentCommon.cxx b/samples/qt/Common/src/DocumentCommon.cxx index 3410c5a4c8..83f7efe473 100755 --- a/samples/qt/Common/src/DocumentCommon.cxx +++ b/samples/qt/Common/src/DocumentCommon.cxx @@ -223,7 +223,7 @@ void DocumentCommon::onTransparency() void DocumentCommon::onDelete() { for ( myContext->InitCurrent(); myContext->MoreCurrent(); myContext->NextCurrent() ) - myContext->Erase( myContext->Current(), false, true ); + myContext->Erase( myContext->Current(), false); myContext->ClearSelected(); getApplication()->onSelectionChanged(); } diff --git a/samples/qt/VoxelDemo/src/Application.cpp b/samples/qt/VoxelDemo/src/Application.cpp index 0a1ae077bb..52b032edb0 100644 --- a/samples/qt/VoxelDemo/src/Application.cpp +++ b/samples/qt/VoxelDemo/src/Application.cpp @@ -404,7 +404,7 @@ void Application::open() } // Display the voxels - myViewer->getIC()->EraseAll(false, false); + myViewer->getIC()->EraseAll(false); Voxel_DS* ds = myBoolVoxels; if (!ds) ds = myColorVoxels; @@ -848,7 +848,7 @@ void Application::testROctBoolDS() // Display - myViewer->getIC()->EraseAll(false, false); + myViewer->getIC()->EraseAll(false); initPrs(); myVoxels->SetBoolVoxels(0); myVoxels->SetColorVoxels(0); @@ -1506,7 +1506,7 @@ void Application::convert(const int ivoxel) } } - myViewer->getIC()->EraseAll(false, false); + myViewer->getIC()->EraseAll(false); Voxel_DS* ds = myBoolVoxels; if (!ds) @@ -1757,7 +1757,7 @@ void Application::displayColorScale() void Application::displayWaves() { - myViewer->getIC()->EraseAll(false, false); + myViewer->getIC()->EraseAll(false); // Make voxels if (myBoolVoxels) @@ -1902,7 +1902,7 @@ void Application::sphere() void Application::load(const TopoDS_Shape& S) { - myViewer->getIC()->EraseAll(false, false); + myViewer->getIC()->EraseAll(false); // Delete voxels of previous shape. if (myBoolVoxels) @@ -1948,7 +1948,7 @@ void Application::load(const TopoDS_Shape& S) void Application::displayCut() { - myViewer->getIC()->EraseAll(false, false); + myViewer->getIC()->EraseAll(false); // Make a sphere with a lot of toruses, // cut the toruses from the sphere. @@ -2043,7 +2043,7 @@ void Application::displayCut() void Application::displayCollisions() { - myViewer->getIC()->EraseAll(false, false); + myViewer->getIC()->EraseAll(false); // Make a big box with a lot of small spheres inside. double x = 0.0, y = 0.0, z = 0.0, xlen = 100.0, ylen = 100.0, zlen = 100.0, r = 10.0; diff --git a/src/AIS/AIS.cdl b/src/AIS/AIS.cdl index 59caa1d754..66cfab96c4 100755 --- a/src/AIS/AIS.cdl +++ b/src/AIS/AIS.cdl @@ -189,7 +189,6 @@ is enumeration DisplayStatus is DS_Displayed, DS_Erased, - DS_FullErased, DS_Temporary, DS_None; ---Purpose: diff --git a/src/AIS/AIS_InteractiveContext.cdl b/src/AIS/AIS_InteractiveContext.cdl index 8ed0021b3f..3198e79956 100755 --- a/src/AIS/AIS_InteractiveContext.cdl +++ b/src/AIS/AIS_InteractiveContext.cdl @@ -151,25 +151,9 @@ is ---Purpose: -- Constructs the interactive context object defined by -- the principal viewer MainViewer. - - Create(MainViewer,Collector: Viewer from V3d) - returns mutable InteractiveContext from AIS; - ---Purpose: - -- Constructs the interactive context object defined by - -- the principal viewer MainViewer and the collector - -- (or trash) viewer. - Delete(me) is redefined; - IsCollectorClosed(me) returns Boolean from Standard; - ---C++: inline - CloseCollector(me:mutable); - ---C++: inline - OpenCollector(me:mutable); - - - ---Category: General DISPLAY SERVICES SetAutoActivateSelection( me: mutable; Auto : Boolean from Standard ); GetAutoActivateSelection( me ) returns Boolean from Standard; @@ -242,70 +226,27 @@ is Erase(me : mutable; aniobj : InteractiveObject from AIS; - updateviewer : Boolean from Standard = Standard_True; - PutInCollector : Boolean from Standard = Standard_False); ----Purpose: To erase presentations in current local context, or --- failing that, in other local contexts which allow erasing. --- --- If putinCollector is True, the object is erased with graphical status Erased, --- and put into the Collector. These objects can be retrieved --- from Interactive Context by ObjectsInCollector method. --- If putinCollector is False, the objects erased with graphical status FullErased, --- and not put into the Collector. These objects can be retrieved --- from Interactive Context by ErasedObjects method. --- --- Note: objects that are put into the Collector recomute their presentation --- for Collector Presentation Manager. --- --- If a local context is open and if updateviewer is --- False, the presentation of the Interactive --- Object activates the selection mode; the object is --- displayed but no viewer will be updated. - - EraseMode(me : mutable; - aniobj : InteractiveObject from AIS; - aMode : Integer from Standard; - updateviewer : Boolean from Standard = Standard_True); - ---Purpose: Updates viewer contents and returns the display --- mode of each aniobj object. Use only if more than --- one display mode is active in the main viewer. --- This method works only on presentation modes other --- than the default mode. Nothing is done if aMode is --- the default presentation mode. --- If a local context is open and if updateviewer equals --- Standard_False, the presentation of the Interactive --- Object activates the selection mode; the object is --- displayed but no viewer will be updated. - - - - EraseAll(me:mutable; - PutInCollector : Boolean from Standard = Standard_False; - updateviewer : Boolean from Standard = Standard_True); - ---Purpose: Every erased object goes into the Collector viewer, - -- depending on PutInCollector value. - - DisplayAll(me : mutable; - OnlyFromCollector : Boolean from Standard = Standard_False; - updateviewer : Boolean from Standard = Standard_True); - ---Purpose: Displays all erased objects or display all objects from collector - - DisplayFromCollector(me : mutable; - anIObj : InteractiveObject from AIS; - updateviewer : Boolean from Standard = Standard_True); - ---Purpose: display anIObj from the collector. - - EraseSelected(me:mutable; - PutInCollector:Boolean from Standard=Standard_False; - updateviewer:Boolean from Standard = Standard_True); + updateviewer : Boolean from Standard = Standard_True); +---Purpose: Hides the object. The object's presentations are simply +-- flagged as invisible and therefore excluded from redrawing. +-- To show hidden objects, use Display(). + + EraseAll (me : mutable; + updateviewer: Boolean from Standard = Standard_True); + ---Purpose: Hides all objects. The object's presentations are simply +-- flagged as invisible and therefore excluded from redrawing. +-- To show all hidden objects, use DisplayAll(). + + DisplayAll(me : mutable; + updateviewer: Boolean from Standard = Standard_True); + ---Purpose: Displays all hidden objects. + + EraseSelected(me: mutable; + updateviewer: Boolean from Standard = Standard_True); ---Purpose: --- Erases selected objects if there is no open active local context. --- If there is no local context activated and if --- updateviewer equals Standard_False, the --- presentation of the Interactive Object activates the --- selection mode; the object is displayed but no viewer --- will be updated. --- If a local context is open, this method is neutral. +-- Hides selected objects. The object's presentations are simply +-- flagged as invisible and therefore excluded from redrawing. +-- To show hidden objects, use Display(). DisplaySelected(me:mutable;updateviewer:Boolean from Standard = Standard_True); ---Purpose: Displays selected objects if a local context is open. @@ -800,8 +741,7 @@ is ---Purpose: Returns the display status of the entity anIobj. -- This will be one of the following: -- - DS_Displayed displayed in main viewer --- - DS_Erased erased in the Collector --- - DS_FullErased erased everywhere but in the Collector +-- - DS_Erased hidden in main viewer -- - DS_Temporary temporarily displayed -- - DS_None nowhere displayed. @@ -831,17 +771,12 @@ is -- will be returned TRUE -- gives the name of the hilightcolor - IsInCollector(me;anIObj:InteractiveObject from AIS) - returns Boolean from Standard; ----Purpose: --- Returns true if the entity anIobj is in the Collector viewer. - DisplayPriority(me;anIobj: InteractiveObject from AIS) returns Integer from Standard; ---Purpose: -- Returns the display priority of the entity anIobj. This -- will be display mode of anIobj if it is in the main --- viewer, and the highlight mode if it is in the Collector viewer. +-- viewer. HasColor(me; aniobj: InteractiveObject from AIS) returns Boolean from Standard; @@ -875,11 +810,6 @@ is -- are called current objects; those selected in open -- local context, selected objects. - UpdateCollector(me:mutable); ----Purpose: Updates the Collector viewer. - - - ---Category: General Attributes for the session DisplayMode(me) returns Integer from Standard; @@ -1161,7 +1091,7 @@ is -- is changed. -- When is FALSE , only the current group -- of the object presentation is changed. - -- Updates the viewer or collector when is TRUE + -- Updates the viewer when is TRUE ---Category: Graphic attributes management ---Category: GRAPHIC DETECTION / SELECTION @@ -1963,30 +1893,9 @@ is -- by Default, = -1 means -- control only on . - Collector(me) returns any Viewer from V3d; - ---C++: return const & - ---C++: inline - - ObjectsInCollector (me;aListOfIO : in out ListOfInteractive from AIS); - ---Purpose: - -- Returns the list aListOfIO of erased objects of a - -- particular Type WhichKind and Signature WhichSignature. - -- By Default, WhichSignature equals 1. This means - -- that there is a check on type only. - - ObjectsInCollector (me; - WhichKind :KindOfInteractive from AIS; - WhichSignature :Integer from Standard; - aListOfIO : in out ListOfInteractive from AIS); - ---Purpose: gives the list of erased objects of a particular - -- Type and signature - -- by Default, = -1 means - -- control only on . - - ErasedObjects (me;theListOfIO : in out ListOfInteractive from AIS); ---Purpose: - -- Returns the list theListOfIO of erased objects (but not placed into collecter) + -- Returns the list theListOfIO of erased objects (hidden objects) -- particular Type WhichKind and Signature WhichSignature. -- By Default, WhichSignature equals 1. This means -- that there is a check on type only. @@ -1995,7 +1904,7 @@ is WhichKind :KindOfInteractive from AIS; WhichSignature :Integer from Standard; theListOfIO : in out ListOfInteractive from AIS); - ---Purpose: gives the list of erased objects (but not placed into collecter) + ---Purpose: gives the list of erased objects (hidden objects) -- Type and signature -- by Default, = -1 means -- control only on . @@ -2054,9 +1963,7 @@ is DomainOfMainViewer(me) returns CString from Standard; ---Purpose: Returns the domain name of the main viewer. - DomainOfCollector(me) returns CString from Standard; - ---Purpose: Returns the domain name of the Collector viewer. - + ---Category: Internal ---Category: Internal @@ -2078,24 +1985,13 @@ is MainPrsMgr (me) returns any PresentationManager3d from PrsMgr; ---C++: inline ---C++: return const & - CollectorPrsMgr(me) returns any PresentationManager3d from PrsMgr; - ---C++: inline - ---C++: return const & - MainSelector(me) returns any ViewerSelector3d from StdSelect; ---C++: inline ---C++: return const & LocalSelector(me) returns any ViewerSelector3d from StdSelect; - - CollectorSelector(me) returns any ViewerSelector3d from StdSelect; - ---C++: inline - ---C++: return const & - - - - PurgeDisplay(me:mutable;CollectorToo:Boolean from Standard = Standard_False) + PurgeDisplay(me:mutable) returns Integer from Standard; ---Level: Internal ---Purpose: Clears all the structures which don't @@ -2131,9 +2027,8 @@ is EraseGlobal(me : mutable; - anObj : InteractiveObject from AIS; - updateviewer : Boolean from Standard = Standard_True; - PutInCollector : Boolean from Standard = Standard_False) is static private; + anObj : InteractiveObject from AIS; + updateviewer : Boolean from Standard = Standard_True) is static private; ClearGlobal(me : mutable; anObj : InteractiveObject from AIS; @@ -2172,12 +2067,6 @@ fields myMainVwr : Viewer from V3d; myMainSel : ViewerSelector3d from StdSelect; - myCollectorPM : PresentationManager3d from PrsMgr; - myCollectorVwr : Viewer from V3d; - myCollectorSel : ViewerSelector3d from StdSelect; - - myIsCollClosed : Boolean from Standard; - -- the selection and current objects. mySelectionName : AsciiString from TCollection; @@ -2185,7 +2074,6 @@ fields myLastPicked : InteractiveObject from AIS; myLastinMain : InteractiveObject from AIS; - myLastinColl : InteractiveObject from AIS; myWasLastMain : Boolean from Standard; diff --git a/src/AIS/AIS_InteractiveContext.cxx b/src/AIS/AIS_InteractiveContext.cxx index 591be7d937..85547fd57c 100755 --- a/src/AIS/AIS_InteractiveContext.cxx +++ b/src/AIS/AIS_InteractiveContext.cxx @@ -129,7 +129,6 @@ mgrSelector(new SelectMgr_SelectionManager()), myMainPM(new PrsMgr_PresentationManager3d(MainViewer->Viewer())), myMainVwr(MainViewer), myMainSel(new StdSelect_ViewerSelector3d()), -myIsCollClosed(Standard_True), myToHilightSelected( Standard_False ), myFilters(new SelectMgr_OrFilter()), myDefaultDrawer(new Prs3d_Drawer()), @@ -148,42 +147,6 @@ myIsAutoActivateSelMode( Standard_True ) InitAttributes(); } - -//======================================================================= -//function : AIS_InteractiveContext -//purpose : -//======================================================================= - -AIS_InteractiveContext::AIS_InteractiveContext(const Handle(V3d_Viewer)& MainViewer, - const Handle(V3d_Viewer)& Collector): -mgrSelector(new SelectMgr_SelectionManager()), -myMainPM(new PrsMgr_PresentationManager3d(MainViewer->Viewer())), -myMainVwr(MainViewer), -myMainSel(new StdSelect_ViewerSelector3d()), -myCollectorPM(new PrsMgr_PresentationManager3d(Collector->Viewer())), -myCollectorVwr(Collector), -myCollectorSel(new StdSelect_ViewerSelector3d()), -myIsCollClosed(Standard_False), -myToHilightSelected( Standard_False ), -myFilters(new SelectMgr_OrFilter()), -myDefaultDrawer(new Prs3d_Drawer()), -myDefaultColor(Quantity_NOC_GOLDENROD), -myHilightColor(Quantity_NOC_CYAN1), -mySelectionColor(Quantity_NOC_GRAY80), -myPreselectionColor(Quantity_NOC_GREEN), -mySubIntensity(Quantity_NOC_GRAY40), -myDisplayMode(0), -myCurLocalIndex(0), -#ifdef IMP051001 -myZDetectionFlag(0), -#endif -myIsAutoActivateSelMode( Standard_True ) -{ - InitAttributes(); - mgrSelector->Add(myCollectorSel); - SetPixelTolerance(); -} - void AIS_InteractiveContext::Delete() const { #ifdef OCC172 @@ -237,13 +200,6 @@ void AIS_InteractiveContext::UpdateCurrentViewer() myMainVwr->Update(); } -void AIS_InteractiveContext::OpenCollector() -{ - myIsCollClosed = Standard_False; - // to be completed.... -} - - //======================================================================= //function : DomainOfMainViewer @@ -318,50 +274,6 @@ void AIS_InteractiveContext::DisplayedObjects(const AIS_KindOfInteractive TheKin ObjectsByDisplayStatus( TheKind, TheSign, AIS_DS_Displayed, aListOfIO ); } -//======================================================================= -//function : UpdateCollector -//purpose : -//======================================================================= - -void AIS_InteractiveContext::UpdateCollector() -{ - if (!myCollectorVwr.IsNull()) - myCollectorVwr->Update(); -} - -//======================================================================= -//function : DomainOfCollector -//purpose : -//======================================================================= - -Standard_CString AIS_InteractiveContext::DomainOfCollector() const -{ - if(myCollectorVwr.IsNull()) return ""; - return myCollectorVwr->Domain(); -} - -//======================================================================= -//function : ObjectsInCollector -//purpose : -//======================================================================= - -void AIS_InteractiveContext::ObjectsInCollector(AIS_ListOfInteractive& aListOfIO) const -{ - ObjectsByDisplayStatus( AIS_DS_Erased, aListOfIO ); -} - -//======================================================================= -//function : ObjectsInCollector -//purpose : -//======================================================================= - -void AIS_InteractiveContext::ObjectsInCollector(const AIS_KindOfInteractive TheKind, - const Standard_Integer TheSign, - AIS_ListOfInteractive& aListOfIO) const -{ - ObjectsByDisplayStatus( TheKind, TheSign, AIS_DS_Erased, aListOfIO ); -} - //======================================================================= //function : ErasedObjects //purpose : @@ -369,7 +281,7 @@ void AIS_InteractiveContext::ObjectsInCollector(const AIS_KindOfInteractive TheK void AIS_InteractiveContext::ErasedObjects(AIS_ListOfInteractive& theListOfIO) const { - ObjectsByDisplayStatus( AIS_DS_FullErased, theListOfIO ); + ObjectsByDisplayStatus( AIS_DS_Erased, theListOfIO ); } //======================================================================= @@ -381,7 +293,7 @@ void AIS_InteractiveContext::ErasedObjects(const AIS_KindOfInteractive TheKind, const Standard_Integer TheSign, AIS_ListOfInteractive& theListOfIO) const { - ObjectsByDisplayStatus( TheKind, TheSign, AIS_DS_FullErased, theListOfIO ); + ObjectsByDisplayStatus( TheKind, TheSign, AIS_DS_Erased, theListOfIO ); } //======================================================================= @@ -477,8 +389,7 @@ void AIS_InteractiveContext::Display(const Handle(AIS_InteractiveObject)& anIObj // SAN : Do not return here. Perform advanced display mode analysis a bit later... if(IsDisplayed(anIObj)) return; #endif - Standard_Boolean updcol = Standard_False; - + // it did not yet exist if(!myObjects.IsBound(anIObj)){ @@ -505,34 +416,11 @@ void AIS_InteractiveContext::Display(const Handle(AIS_InteractiveObject)& anIObj // const Handle(AIS_GlobalStatus)& STATUS = myObjects(anIObj); Handle(AIS_GlobalStatus) STATUS = myObjects(anIObj); // ENDCLE - switch (STATUS->GraphicStatus()){ - case AIS_DS_Erased:{ - if(STATUS->IsHilighted()) - myCollectorPM->Unhighlight(anIObj,HiMod); - myCollectorPM->Erase(anIObj,HiMod); - mgrSelector->Deactivate(anIObj,myCollectorSel); - updcol = updateviewer; - }// attention the break is not set on purpose... - case AIS_DS_FullErased:{ - TColStd_ListIteratorOfListOfInteger ItL (STATUS->DisplayedModes()); - for (;ItL.More();ItL.Next()){ - myMainPM->Display(anIObj,ItL.Value()); - if(STATUS->IsSubIntensityOn()) - myMainPM->Color(anIObj,mySubIntensity,ItL.Value()); - } - if( myIsAutoActivateSelMode ) - for (ItL.Initialize(STATUS->SelectionModes());ItL.More();ItL.Next()) - mgrSelector->Activate(anIObj,ItL.Value(),myMainSel); - STATUS->SetGraphicStatus(AIS_DS_Displayed); - if(STATUS->IsHilighted()) - myMainPM->Highlight(anIObj,HiMod); - break; - } -#ifdef OCC4373 - // SAN : erase presentations for all display modes different from ; - // then make sure is displayed and maybe highlighted; - // Finally, activate selection mode if not yet activated. - case AIS_DS_Displayed:{ + if (STATUS->GraphicStatus() == AIS_DS_Displayed || STATUS->GraphicStatus() == AIS_DS_Erased) + { + // SAN : erase presentations for all display modes different from ; + // then make sure is displayed and maybe highlighted; + // Finally, activate selection mode if not yet activated. TColStd_ListOfInteger aModesToRemove; TColStd_ListIteratorOfListOfInteger ItL (STATUS->DisplayedModes()); for(;ItL.More();ItL.Next()){ @@ -554,6 +442,10 @@ void AIS_InteractiveContext::Display(const Handle(AIS_InteractiveObject)& anIObj STATUS->AddDisplayMode(DispMode); myMainPM->Display(anIObj,DispMode); + if (STATUS->GraphicStatus() == AIS_DS_Erased) + { + STATUS->SetGraphicStatus(AIS_DS_Displayed); + } if(STATUS->IsHilighted()){ myMainPM->Highlight(anIObj,HiMod); } @@ -564,19 +456,12 @@ void AIS_InteractiveContext::Display(const Handle(AIS_InteractiveObject)& anIObj if(!mgrSelector->IsActivated(anIObj,SelMode)) mgrSelector->Activate(anIObj,SelMode,myMainSel); } - - break; - } -#endif - default: - break; } } if(anIObj->IsTransparent() && !myMainVwr->Viewer()->Transparency()) myMainVwr->Viewer()->SetTransparency(Standard_True); if(updateviewer) myMainVwr->Update(); - if(updcol && !myCollectorVwr.IsNull()) myCollectorVwr->Update(); } // LOCAL CONTEXT OPEN @@ -671,7 +556,7 @@ void AIS_InteractiveContext::Load(const Handle(AIS_InteractiveObject)& anIObj, GetDefModes(anIObj,DispMode,HiMod,SelModeDef); Handle(AIS_GlobalStatus) STATUS= - new AIS_GlobalStatus(AIS_DS_FullErased,DispMode,SelModeDef); + new AIS_GlobalStatus(AIS_DS_Erased,DispMode,SelModeDef); myObjects.Bind (anIObj,STATUS); return; } @@ -686,8 +571,7 @@ void AIS_InteractiveContext::Load(const Handle(AIS_InteractiveObject)& anIObj, //======================================================================= void AIS_InteractiveContext::Erase(const Handle(AIS_InteractiveObject)& anIObj, - const Standard_Boolean updateviewer, - const Standard_Boolean PutInCollector) + const Standard_Boolean updateviewer) { if(anIObj.IsNull()) return; @@ -695,7 +579,7 @@ void AIS_InteractiveContext::Erase(const Handle(AIS_InteractiveObject)& anIObj, anIObj->ClearSelected(); if(!HasOpenedContext()){ - EraseGlobal(anIObj,updateviewer,PutInCollector); + EraseGlobal(anIObj,updateviewer); } else { @@ -715,62 +599,31 @@ void AIS_InteractiveContext::Erase(const Handle(AIS_InteractiveObject)& anIObj, } if(!WasInCtx) - EraseGlobal(anIObj,updateviewer,PutInCollector); + EraseGlobal(anIObj,updateviewer); else if(updateviewer) myMainVwr->Update(); } } -//======================================================================= -//function : Erase -//purpose : -//======================================================================= - -void AIS_InteractiveContext::EraseMode(const Handle(AIS_InteractiveObject)& anIObj, - const Standard_Integer aMode, - const Standard_Boolean /*updateviewer*/) -{ - if(anIObj.IsNull()) return; - - if(!myObjects.IsBound(anIObj)) return; - - if(anIObj->HasDisplayMode()){ - if(anIObj->DisplayMode()==aMode) return; - } - else if(myDisplayMode==aMode) return; - // CLE - // const Handle(AIS_GlobalStatus)& STATUS = myObjects(anIObj); - Handle(AIS_GlobalStatus) STATUS = myObjects(anIObj); - // ENDCLE - if(STATUS->GraphicStatus()!=AIS_DS_Displayed) return; - - -// if(STATUS->IsDModeIn(aMode)) {} -} - - //======================================================================= //function : EraseAll //purpose : //======================================================================= -void AIS_InteractiveContext::EraseAll(const Standard_Boolean PutInCollector, - const Standard_Boolean updateviewer) +void AIS_InteractiveContext::EraseAll(const Standard_Boolean updateviewer) { - if(!HasOpenedContext()){ - AIS_DataMapIteratorOfDataMapOfIOStatus ItM(myObjects); - - for(;ItM.More();ItM.Next()){ + if(!HasOpenedContext()) + { + for (AIS_DataMapIteratorOfDataMapOfIOStatus ItM(myObjects); ItM.More(); ItM.Next()) + { if(ItM.Value()->GraphicStatus() == AIS_DS_Displayed) - Erase(ItM.Key(),Standard_False,PutInCollector); + Erase(ItM.Key(),Standard_False); } - if(updateviewer){ + if(updateviewer) + { myMainVwr->Update(); - if (PutInCollector && !myCollectorVwr.IsNull()) - myCollectorVwr->Update(); } } - } //======================================================================= @@ -778,27 +631,23 @@ void AIS_InteractiveContext::EraseAll(const Standard_Boolean PutInCollector, //purpose : //======================================================================= -void AIS_InteractiveContext::DisplayAll(const Standard_Boolean OnlyFromCollector, - const Standard_Boolean updateviewer) +void AIS_InteractiveContext::DisplayAll(const Standard_Boolean updateviewer) { if(!HasOpenedContext()){ - Standard_Boolean FoundInCollector(Standard_False); - AIS_DisplayStatus aDStatus = OnlyFromCollector ? AIS_DS_Erased : AIS_DS_FullErased,TheStatus; - if(!HasOpenedContext()){ - AIS_DataMapIteratorOfDataMapOfIOStatus ItM(myObjects); - - for(;ItM.More();ItM.Next()){ - TheStatus = ItM.Value()->GraphicStatus(); - if(TheStatus == aDStatus) + AIS_DisplayStatus aStatus; + + if (!HasOpenedContext()) + { + for (AIS_DataMapIteratorOfDataMapOfIOStatus ItM (myObjects); ItM.More(); ItM.Next()) + { + aStatus = ItM.Value()->GraphicStatus(); + if (aStatus == AIS_DS_Erased) Display(ItM.Key(),Standard_False); - if(TheStatus == AIS_DS_Erased) - FoundInCollector = Standard_True; } - if(updateviewer){ + if(updateviewer) + { myMainVwr->Update(); - if(FoundInCollector && !myCollectorVwr.IsNull()) - myCollectorVwr->Update(); } } } @@ -813,20 +662,20 @@ void AIS_InteractiveContext::DisplayAll(const Standard_Boolean OnlyFromCollector void AIS_InteractiveContext::DisplaySelected(const Standard_Boolean updateviewer) { - if(!HasOpenedContext()){ + if (!HasOpenedContext()) + { Standard_Boolean found = Standard_False; Handle(AIS_Selection) sel = AIS_Selection::Selection(myCurrentName.ToCString()); Handle(AIS_InteractiveObject) iObj; - for (sel->Init();sel->More();sel->Next()) { + for (sel->Init(); sel->More(); sel->Next()) + { iObj = Handle(AIS_InteractiveObject)::DownCast(sel->Value()); Display(iObj,Standard_False); found = Standard_True; } - if(found && updateviewer) { + if (found && updateviewer) + { myMainVwr->Update(); - if(!(myIsCollClosed && myCollectorVwr.IsNull())) - - myCollectorVwr->Update(); } } } @@ -837,23 +686,22 @@ void AIS_InteractiveContext::DisplaySelected(const Standard_Boolean updateviewer //purpose : //======================================================================= -void AIS_InteractiveContext::EraseSelected(const Standard_Boolean PutInCollector, - const Standard_Boolean updateviewer) +void AIS_InteractiveContext::EraseSelected(const Standard_Boolean updateviewer) { - - if(!HasOpenedContext()){ + if (!HasOpenedContext()) + { Standard_Boolean found = Standard_False; Handle(AIS_Selection) sel = AIS_Selection::Selection(myCurrentName.ToCString()); Handle(AIS_InteractiveObject) iObj; - for(sel->Init();sel->More();sel->Next()) { + for (sel->Init();sel->More();sel->Next()) + { iObj = Handle(AIS_InteractiveObject)::DownCast(sel->Value()); - Erase(iObj,Standard_False,PutInCollector); + Erase(iObj,Standard_False); found = Standard_True; } - if(found && updateviewer) { + if(found && updateviewer) + { myMainVwr->Update(); - if(PutInCollector && !myCollectorVwr.IsNull()) - myCollectorVwr->Update(); } } } @@ -1079,42 +927,28 @@ void AIS_InteractiveContext::Hilight(const Handle(AIS_InteractiveObject)& anIObj if(!anIObj->HasInteractiveContext()) anIObj->SetContext(this); if (!HasOpenedContext()) - { - if(!myObjects.IsBound(anIObj)) return; + { + if(!myObjects.IsBound(anIObj)) return; - // CLE - // const Handle(AIS_GlobalStatus)& STATUS = myObjects(anIObj); - // const TColStd_ListOfInteger& LL = STATUS->DisplayedModes(); - Handle(AIS_GlobalStatus) STATUS = myObjects(anIObj); + // CLE + // const Handle(AIS_GlobalStatus)& STATUS = myObjects(anIObj); + // const TColStd_ListOfInteger& LL = STATUS->DisplayedModes(); + Handle(AIS_GlobalStatus) STATUS = myObjects(anIObj); - // ENDCLE - STATUS->SetHilightStatus (Standard_True); - - switch(STATUS->GraphicStatus()){ - case AIS_DS_Displayed: - { - Standard_Integer DispMode,HiMode,SelMode; - GetDefModes(anIObj,DispMode,HiMode,SelMode); -// if(!STATUS->IsDModeIn(HiMode)){ -// myMainPM->Display(anIObj,HiMode); -// } - myMainPM->Highlight(anIObj,HiMode); - if(updateviewer) myMainVwr->Update(); - break; - } - case AIS_DS_Erased: - { - Standard_Integer HiMode = anIObj->HasHilightMode()? anIObj->HilightMode():0; - myCollectorPM->Highlight(anIObj,HiMode); - if(updateviewer) myCollectorVwr->Update(); - break; - } - default: - break; - } + // ENDCLE + STATUS->SetHilightStatus (Standard_True); + + if (STATUS->GraphicStatus() == AIS_DS_Displayed) + { + Standard_Integer aHilightMode = anIObj->HasHilightMode() ? anIObj->HilightMode() : 0; + myMainPM->Highlight (anIObj, aHilightMode); } + } else + { myLocalContexts(myCurLocalIndex)->Hilight(anIObj); + } + if(updateviewer) myMainVwr->Update(); } //======================================================================= @@ -1131,38 +965,23 @@ void AIS_InteractiveContext::HilightWithColor(const Handle(AIS_InteractiveObject if(!anIObj->HasInteractiveContext()) anIObj->SetContext(this); if (!HasOpenedContext()) - { - if(!myObjects.IsBound(anIObj)) return; + { + if(!myObjects.IsBound(anIObj)) return; - const Handle(AIS_GlobalStatus)& STATUS = myObjects(anIObj); - STATUS->SetHilightStatus (Standard_True); - - switch(STATUS->GraphicStatus()){ - case AIS_DS_Displayed: - { - Standard_Integer DispMode,HiMode,SelMode; - GetDefModes(anIObj,DispMode,HiMode,SelMode); -// if(!STATUS->IsDModeIn(HiMode)){ -// myMainPM->Display(anIObj,HiMode); -// } - myMainPM->Color(anIObj,aCol,HiMode); - STATUS->SetHilightColor(aCol); - if(updateviewer) myMainVwr->Update(); - break; - } - case AIS_DS_Erased: - { - Standard_Integer HiMode = anIObj->HasHilightMode()? anIObj->HilightMode():0; - myCollectorPM->Color(anIObj,aCol,HiMode); - if(updateviewer) myCollectorVwr->Update(); - break; - } - default: - break; - } + const Handle(AIS_GlobalStatus)& STATUS = myObjects(anIObj); + STATUS->SetHilightStatus (Standard_True); + + if (STATUS->GraphicStatus() == AIS_DS_Displayed) + { + Standard_Integer aHilightMode = anIObj->HasHilightMode() ? anIObj->HilightMode() : 0; + myMainPM->Color (anIObj, aCol, aHilightMode); + STATUS->SetHilightColor (aCol); } + } else + { myLocalContexts(myCurLocalIndex)->Hilight(anIObj,aCol); + } if(updateviewer) myMainVwr->Update(); } @@ -1176,37 +995,23 @@ void AIS_InteractiveContext::Unhilight(const Handle(AIS_InteractiveObject)& anIO if(anIObj.IsNull()) return; if (!HasOpenedContext()) - { - if(!myObjects.IsBound(anIObj)) return; + { + if(!myObjects.IsBound(anIObj)) return; - const Handle(AIS_GlobalStatus)& STATUS = myObjects(anIObj); - STATUS->SetHilightStatus (Standard_False); - STATUS->SetHilightColor(Quantity_NOC_WHITE); - - switch(STATUS->GraphicStatus()){ - case AIS_DS_Displayed: - { - Standard_Integer DispMode,HiMode,SelMode; - GetDefModes(anIObj,DispMode,HiMode,SelMode); - myMainPM->Unhighlight(anIObj,HiMode); -// if(!STATUS->IsDModeIn(HiMode)) -// myMainPM->Erase(anIObj,HiMode); - if(updateviewer) myMainVwr->Update(); - break; - } - case AIS_DS_Erased: - { - Standard_Integer HiMode = anIObj->HasHilightMode()? anIObj->HilightMode():0; - myCollectorPM->Unhighlight(anIObj,HiMode); - if(updateviewer) myCollectorVwr->Update(); - break; - } - default: - break; - } + const Handle(AIS_GlobalStatus)& STATUS = myObjects(anIObj); + STATUS->SetHilightStatus (Standard_False); + STATUS->SetHilightColor(Quantity_NOC_WHITE); + + if (STATUS->GraphicStatus() == AIS_DS_Displayed) + { + Standard_Integer aHilightMode = anIObj->HasHilightMode() ? anIObj->HilightMode() : 0; + myMainPM->Unhighlight (anIObj, aHilightMode); } + } else + { myLocalContexts(myCurLocalIndex)->Unhilight(anIObj); + } if(updateviewer) myMainVwr->Update(); } @@ -1286,21 +1091,6 @@ Standard_Boolean AIS_InteractiveContext::IsDisplayed(const Handle(AIS_Interactiv return Standard_False; } -//======================================================================= -//function : IsDisplayed -//purpose : -//======================================================================= - -Standard_Boolean AIS_InteractiveContext::IsInCollector(const Handle(AIS_InteractiveObject)& anIObj) const -{ - if(anIObj.IsNull()) return Standard_False; - - - if(myObjects.IsBound(anIObj)) - return (myObjects(anIObj)->GraphicStatus()==AIS_DS_Erased); - return Standard_False; -} - //======================================================================= //function : IsDisplayed @@ -1336,25 +1126,16 @@ Standard_Integer AIS_InteractiveContext:: DisplayPriority(const Handle(AIS_InteractiveObject)& anIObj) const { if(anIObj.IsNull()) return -1; - if(myObjects.IsBound(anIObj)){ - // CLE - // const Handle(AIS_GlobalStatus) & STATUS = myObjects(anIObj); + + if (myObjects.IsBound(anIObj)) + { Handle(AIS_GlobalStatus) STATUS = myObjects(anIObj); - // ENDCLE - Standard_Integer DM,HM,SM ; - GetDefModes(anIObj,DM,HM,SM); - switch(STATUS->GraphicStatus()){ - case AIS_DS_Displayed: - { - return myMainPM->DisplayPriority(anIObj,DM); - break; - } - case AIS_DS_Erased: - return myCollectorPM->DisplayPriority(anIObj,HM); - default: - break; + if (STATUS->GraphicStatus() == AIS_DS_Displayed || STATUS->GraphicStatus() == AIS_DS_Erased) + { + Standard_Integer aDispMode = anIObj->HasDisplayMode() ? anIObj->DisplayMode() : + (anIObj->AcceptDisplayMode(myDisplayMode)? myDisplayMode : 0); + return myMainPM->DisplayPriority (anIObj, aDispMode); } - return 0; } return 0; } @@ -1370,30 +1151,21 @@ void AIS_InteractiveContext::SetDisplayPriority(const Handle(AIS_InteractiveObje return; if(!anIObj->HasInteractiveContext()) anIObj->SetContext(this); - if(myObjects.IsBound(anIObj)){ - // CLE - // const Handle(AIS_GlobalStatus) & STATUS = myObjects(anIObj); + if(myObjects.IsBound(anIObj)) + { Handle(AIS_GlobalStatus) STATUS = myObjects(anIObj); - // ENDCLE - Standard_Integer DM,HM,SM ; - GetDefModes(anIObj,DM,HM,SM); - switch(STATUS->GraphicStatus()){ - case AIS_DS_Displayed: - { - myMainPM->SetDisplayPriority(anIObj,DM,aPriority); - break; - } - case AIS_DS_Erased: - { - myCollectorPM->SetDisplayPriority(anIObj,HM,aPriority); - break; - } - default: - break; + + if (STATUS->GraphicStatus() == AIS_DS_Displayed || STATUS->GraphicStatus() == AIS_DS_Erased) + { + Standard_Integer aDisplayMode = anIObj->HasDisplayMode() ? anIObj->DisplayMode() : + (anIObj->AcceptDisplayMode(myDisplayMode)? myDisplayMode : 0); + myMainPM->SetDisplayPriority (anIObj, aDisplayMode, aPriority); } } else if (HasOpenedContext()) - {myLocalContexts(myCurLocalIndex)->SetDisplayPriority(anIObj,aPriority);} + { + myLocalContexts(myCurLocalIndex)->SetDisplayPriority(anIObj,aPriority); + } } //======================================================================= @@ -1423,7 +1195,7 @@ void AIS_InteractiveContext::Redisplay(const AIS_KindOfInteractive KOI, const Standard_Integer /*Sign*/, const Standard_Boolean updateviewer) { - Standard_Boolean found_viewer(Standard_False),found_coll(Standard_False); + Standard_Boolean found_viewer(Standard_False); // update for(AIS_DataMapIteratorOfDataMapOfIOStatus It(myObjects);It.More();It.Next()){ // CLE @@ -1436,24 +1208,16 @@ void AIS_InteractiveContext::Redisplay(const AIS_KindOfInteractive KOI, // ((IO->Signature()==Sign)? Standard_True:Standard_False); #endif Redisplay(IO,Standard_False); - switch(It.Value()->GraphicStatus()){ - case AIS_DS_Displayed: + if (It.Value()->GraphicStatus() == AIS_DS_Displayed) + { found_viewer = Standard_True; - break; - case AIS_DS_Erased: - found_coll = Standard_True; - break; - default: - break; } } } // update viewer... - if(updateviewer){ - if(found_viewer) - myMainVwr->Update(); - if(found_coll) - myCollectorVwr->Update(); + if(updateviewer && found_viewer) + { + myMainVwr->Update(); } } @@ -1469,26 +1233,16 @@ void AIS_InteractiveContext::RecomputePrsOnly(const Handle(AIS_InteractiveObject { if(anIObj.IsNull()) return; anIObj->Update(allmodes); - - if(updateviewer) { - if(HasOpenedContext()) - myMainVwr->Update(); - else{ - if(myObjects.IsBound(anIObj)){ - switch(myObjects(anIObj)->GraphicStatus()){ - case AIS_DS_Displayed: - myMainVwr->Update(); - break; - case AIS_DS_Erased: - { - if(!myCollectorVwr.IsNull()) - myCollectorVwr->Update(); - } - default: - break; - } - } - } + + if (!updateviewer) + { + return; + } + + if (HasOpenedContext() || + (myObjects.IsBound(anIObj) && myObjects(anIObj)->GraphicStatus() == AIS_DS_Displayed)) + { + myMainVwr->Update(); } } //======================================================================= @@ -1507,24 +1261,14 @@ void AIS_InteractiveContext::RecomputeSelectionOnly(const Handle(AIS_Interactive ActivatedModes(anIObj,LI); if(!HasOpenedContext()){ if(!myObjects.IsBound(anIObj)) return; - switch(myObjects(anIObj)->GraphicStatus()) + + if (myObjects(anIObj)->GraphicStatus() == AIS_DS_Displayed) + { + for(Lit.Initialize(LI);Lit.More();Lit.Next()) { - case AIS_DS_Displayed: - { - for(Lit.Initialize(LI);Lit.More();Lit.Next()) - mgrSelector->Activate(anIObj,Lit.Value(),myMainSel); - break; - } - case AIS_DS_Erased: - { - for(Lit.Initialize(LI);Lit.More();Lit.Next()) - mgrSelector->Activate(anIObj,Lit.Value(),myCollectorSel); - - break; - } - default: - break; + mgrSelector->Activate(anIObj,Lit.Value(),myMainSel); } + } } } @@ -1560,9 +1304,6 @@ void AIS_InteractiveContext::Update(const Handle(AIS_InteractiveObject)& anIObj, case AIS_DS_Temporary: myMainVwr->Update(); break; - case AIS_DS_Erased: - myCollectorVwr->Update(); - break; default: break; } @@ -1768,7 +1509,7 @@ void AIS_InteractiveContext::SetDisplayMode(const AIS_DisplayMode aMode, STATUS->AddDisplayMode(aMode); if(STATUS->GraphicStatus()== AIS_DS_Displayed){ - myMainPM->Erase(anObj, myDisplayMode); + myMainPM->SetVisibility (anObj, myDisplayMode, Standard_False); myMainPM->Display(anObj, aMode); if(STATUS->IsSubIntensityOn()) myMainPM->Color(anObj,mySubIntensity,aMode); @@ -1798,33 +1539,12 @@ void AIS_InteractiveContext::SetDisplayMode(const Handle(AIS_InteractiveObject)& if(!myObjects.IsBound(anIObj)) anIObj->SetDisplayMode(aMode); -#ifdef BUC60632 else if( anIObj->AcceptDisplayMode(aMode) ) -#else - else -#endif { // CLE // const Handle(AIS_GlobalStatus)& STATUS = myObjects(anIObj); Handle(AIS_GlobalStatus) STATUS = myObjects(anIObj); // ENDCLE -#ifndef OCC4373 - // the interactive object has no mode : OldMode = Mode Session - // already has a mode : OldMode = old mode Propre - - Standard_Integer OldMode = anIObj->HasDisplayMode() ? anIObj->DisplayMode(): myDisplayMode; - - if(STATUS->IsDModeIn(OldMode)) - STATUS->RemoveDisplayMode(OldMode); - STATUS->AddDisplayMode(aMode); - - if(STATUS->GraphicStatus()==AIS_DS_Displayed){ - if(aMode!=OldMode ){ - if(myMainPM->IsHighlighted(anIObj,OldMode)) - myMainPM->Unhighlight(anIObj,OldMode); - - myMainPM->Erase(anIObj,OldMode); -#else // SAN : erase presentations for all display modes different from if(STATUS->GraphicStatus()==AIS_DS_Displayed){ TColStd_ListOfInteger aModesToRemove; @@ -1837,7 +1557,7 @@ void AIS_InteractiveContext::SetDisplayMode(const Handle(AIS_InteractiveObject)& aModesToRemove.Append(OldMode); if(myMainPM->IsHighlighted(anIObj,OldMode)) myMainPM->Unhighlight(anIObj,OldMode); - myMainPM->Erase(anIObj,OldMode); + myMainPM->SetVisibility (anIObj, OldMode, Standard_False); } } @@ -1846,8 +1566,7 @@ void AIS_InteractiveContext::SetDisplayMode(const Handle(AIS_InteractiveObject)& if(!STATUS->IsDModeIn(aMode)) STATUS->AddDisplayMode(aMode); -#endif - + myMainPM->Display(anIObj,aMode); Standard_Integer DM,HM,SM; GetDefModes(anIObj,DM,HM,SM); @@ -1861,9 +1580,6 @@ void AIS_InteractiveContext::SetDisplayMode(const Handle(AIS_InteractiveObject)& myMainVwr->Viewer()->SetTransparency(Standard_True); if(updateviewer) myMainVwr->Update(); -#ifndef OCC4373 - } -#endif } anIObj->SetDisplayMode(aMode); } @@ -1895,7 +1611,7 @@ UnsetDisplayMode(const Handle(AIS_InteractiveObject)& anIObj, if(STATUS->GraphicStatus()==AIS_DS_Displayed){ if(myMainPM->IsHighlighted(anIObj,OldMode)) myMainPM->Unhighlight(anIObj,OldMode); - myMainPM->Erase(anIObj,OldMode); + myMainPM->SetVisibility (anIObj, OldMode, Standard_False); myMainPM->Display(anIObj,myDisplayMode); Standard_Integer DM,HM,SM; GetDefModes(anIObj,DM,HM,SM); @@ -2520,8 +2236,6 @@ void AIS_InteractiveContext::SetSelectedAspect( } if( found && updateViewer) { myMainVwr->Update(); - if( !(myIsCollClosed && myCollectorVwr.IsNull()) ) - myCollectorVwr->Update(); } } } @@ -2583,11 +2297,6 @@ void AIS_InteractiveContext::Status(const Handle(AIS_InteractiveObject)& anIObj, astatus +="\t| -->Erased\n"; break; } - case AIS_DS_FullErased: - { - astatus +="\t| -->Full Erased\n"; - break; - } default: break; } @@ -2642,8 +2351,7 @@ void AIS_InteractiveContext::GetDefModes(const Handle(AIS_InteractiveObject)& an //======================================================================= void AIS_InteractiveContext::EraseGlobal(const Handle(AIS_InteractiveObject)& anIObj, - const Standard_Boolean updateviewer, - const Standard_Boolean PutInCollector) + const Standard_Boolean updateviewer) { if(anIObj.IsNull()) return ; if(!myObjects.IsBound(anIObj)) return; @@ -2659,30 +2367,16 @@ void AIS_InteractiveContext::EraseGlobal(const Handle(AIS_InteractiveObject)& an for(;ItL.More();ItL.Next()){ if(myMainPM->IsHighlighted(anIObj,ItL.Value())) myMainPM->Unhighlight(anIObj,ItL.Value()); - myMainPM->Erase(anIObj,ItL.Value()); + myMainPM->SetVisibility (anIObj, ItL.Value(), Standard_False); } if(IsCurrent(anIObj) && !STATUS->IsDModeIn(Dmode)) - myMainPM->Erase(anIObj,Dmode); + myMainPM->SetVisibility (anIObj, Dmode, Standard_False); for(ItL.Initialize(STATUS->SelectionModes());ItL.More();ItL.Next()) mgrSelector->Deactivate(anIObj,ItL.Value(),myMainSel); if(updateviewer) myMainVwr->Update(); } - if(PutInCollector && !myCollectorPM.IsNull()){ - myCollectorPM->Display(anIObj,Dmode); -#ifdef OCC328 - Standard_Integer SMode = anIObj->SelectionMode(); - mgrSelector->Activate(anIObj,SMode,myCollectorSel); -#else - mgrSelector->Activate(anIObj,0,myCollectorSel); -#endif - if(STATUS->IsHilighted()) - myCollectorPM->Highlight(anIObj,Dmode); - STATUS->SetGraphicStatus(AIS_DS_Erased); - if(updateviewer) myCollectorVwr->Update(); - } - else - STATUS->SetGraphicStatus(AIS_DS_FullErased); + STATUS->SetGraphicStatus(AIS_DS_Erased); } @@ -2733,8 +2427,6 @@ void AIS_InteractiveContext::ClearGlobal(const Handle(AIS_InteractiveObject)& an if(myLastinMain == anIObj) myLastinMain.Nullify(); - if(myLastinColl == anIObj) - myLastinColl.Nullify(); if(myLastPicked == anIObj) myLastPicked.Nullify(); @@ -2743,26 +2435,11 @@ void AIS_InteractiveContext::ClearGlobal(const Handle(AIS_InteractiveObject)& an // to avoid memory leaks mgrSelector->Remove(anIObj); - switch(STATUS->GraphicStatus()){ - case AIS_DS_Erased: - { - Standard_Integer DM = anIObj->HasHilightMode() ? anIObj->HilightMode() : 0; - if(STATUS->IsHilighted()){ - myCollectorPM->Unhighlight(anIObj,DM); - } - myCollectorPM->Erase(anIObj,DM); - myCollectorPM->Clear(anIObj,DM); - if(updateviewer) myCollectorVwr->Update(); - break; - } - case AIS_DS_Displayed: - { - if(updateviewer) myMainVwr->Update(); - break; - } - default: - break; - } + if (updateviewer && (STATUS->GraphicStatus() == AIS_DS_Displayed)) + { + myMainVwr->Update(); + } + myObjects.UnBind(anIObj); } @@ -2789,17 +2466,8 @@ void AIS_InteractiveContext::ClearGlobalPrs(const Handle(AIS_InteractiveObject)& myMainPM->Clear(anIObj,aMode); } - if(STATUS->GraphicStatus()== AIS_DS_Erased) - { - if(DM==aMode){ - if(STATUS->IsHilighted()) - myCollectorPM->Unhighlight(anIObj,aMode); - myCollectorPM->Erase(anIObj,DM); - myCollectorPM->Clear(anIObj,DM); - } - if(updateviewer) myCollectorVwr->Update(); - } - else if(STATUS->GraphicStatus()==AIS_DS_Displayed && updateviewer) + + if(STATUS->GraphicStatus()==AIS_DS_Displayed && updateviewer) myMainVwr->Update(); } @@ -2940,7 +2608,6 @@ void AIS_InteractiveContext::SetSensitivityMode(const StdSelect_SensitivityMode myLocalContexts(myCurLocalIndex)->SetSensitivityMode(aMode); else { myMainSel->SetSensitivityMode(aMode); - if( !myCollectorSel.IsNull() ) myCollectorSel->SetSensitivityMode(aMode); } } @@ -2967,7 +2634,6 @@ void AIS_InteractiveContext::SetSensitivity(const Standard_Real aPrecision) { myLocalContexts(myCurLocalIndex)->SetSensitivity(aPrecision); else { myMainSel->SetSensitivity(aPrecision); - if( !myCollectorSel.IsNull() ) myCollectorSel->SetSensitivity(aPrecision); } } @@ -2994,7 +2660,6 @@ void AIS_InteractiveContext::SetPixelTolerance(const Standard_Integer aPrecision myLocalContexts(myCurLocalIndex)->SetPixelTolerance(aPrecision); else { myMainSel->SetPixelTolerance(aPrecision); - if( !myCollectorSel.IsNull() ) myCollectorSel->SetPixelTolerance(aPrecision); } } @@ -3174,20 +2839,9 @@ void AIS_InteractiveContext::SetZLayer (const Handle(AIS_InteractiveObject)& the if (myObjects.IsBound (theIObj)) { - switch (myObjects (theIObj)->GraphicStatus ()) + if (myObjects (theIObj)->GraphicStatus() == AIS_DS_Displayed || myObjects (theIObj)->GraphicStatus() == AIS_DS_Erased) { - case AIS_DS_Displayed: - { - theIObj->SetZLayer (myMainPM, theLayerId); - break; - } - case AIS_DS_Erased: - { - theIObj->SetZLayer (myCollectorPM, theLayerId); - break; - } - default: - break; + theIObj->SetZLayer (myMainPM, theLayerId); } } else if (HasOpenedContext ()) diff --git a/src/AIS/AIS_InteractiveContext.lxx b/src/AIS/AIS_InteractiveContext.lxx index e04ed2d7f9..ed8c03cfec 100755 --- a/src/AIS/AIS_InteractiveContext.lxx +++ b/src/AIS/AIS_InteractiveContext.lxx @@ -21,11 +21,6 @@ inline const Handle(V3d_Viewer)& AIS_InteractiveContext::CurrentViewer() const return myMainVwr; } -inline const Handle(V3d_Viewer)& AIS_InteractiveContext::Collector() const -{ - return myCollectorVwr; -} - inline Quantity_NameOfColor AIS_InteractiveContext::HilightColor() const { return myHilightColor; @@ -44,12 +39,6 @@ inline Quantity_NameOfColor AIS_InteractiveContext::PreSelectionColor() const inline Quantity_NameOfColor AIS_InteractiveContext::DefaultColor() const { return myDefaultColor; } -inline Standard_Boolean AIS_InteractiveContext::IsCollectorClosed() const -{return myIsCollClosed;} - -inline void AIS_InteractiveContext::CloseCollector() -{myIsCollClosed = Standard_True;} - inline Quantity_NameOfColor AIS_InteractiveContext::SubIntensityColor() const { @@ -88,10 +77,6 @@ inline const Handle(SelectMgr_SelectionManager)& AIS_InteractiveContext::Selecti inline const Handle(PrsMgr_PresentationManager3d)& AIS_InteractiveContext::MainPrsMgr() const {return myMainPM ;} -inline const Handle(PrsMgr_PresentationManager3d)& AIS_InteractiveContext::CollectorPrsMgr() const -{return myCollectorPM ;} - - inline Standard_Boolean AIS_InteractiveContext::HasOpenedContext() const {return myCurLocalIndex != 0;} @@ -111,9 +96,6 @@ inline void AIS_InteractiveContext::SetOkCurrent() inline const Handle(StdSelect_ViewerSelector3d)& AIS_InteractiveContext::MainSelector() const {return myMainSel;} -inline const Handle(StdSelect_ViewerSelector3d)& AIS_InteractiveContext::CollectorSelector() const -{return myCollectorSel;} - inline void AIS_InteractiveContext::SetToHilightSelected(const Standard_Boolean toHilight) { myToHilightSelected = toHilight; diff --git a/src/AIS/AIS_InteractiveContext_1.cxx b/src/AIS/AIS_InteractiveContext_1.cxx index 0130bbad35..6f4323aaf1 100755 --- a/src/AIS/AIS_InteractiveContext_1.cxx +++ b/src/AIS/AIS_InteractiveContext_1.cxx @@ -146,7 +146,7 @@ AIS_StatusOfDetection AIS_InteractiveContext::MoveTo(const Standard_Integer XPix const Standard_Integer YPix, const Handle(V3d_View)& aView) { - if(HasOpenedContext()&& aView->Viewer()!=myCollectorVwr){ + if(HasOpenedContext()){ myWasLastMain = Standard_True; return myLocalContexts(myCurLocalIndex)->MoveTo(XPix,YPix,aView); } @@ -169,13 +169,6 @@ AIS_StatusOfDetection AIS_InteractiveContext::MoveTo(const Standard_Integer XPix myLastPicked = myLastinMain; myWasLastMain = Standard_True; } - else if (aView->Viewer()== myCollectorVwr){ - pmgr = myCollectorPM; - selector=myCollectorSel; - myLastPicked = myLastinColl; - ismain = Standard_False; - myWasLastMain = Standard_False; - } else return AIS_SOD_Error; @@ -247,8 +240,6 @@ AIS_StatusOfDetection AIS_InteractiveContext::MoveTo(const Standard_Integer XPix if ( ismain ) myLastinMain = myLastPicked; - else - myLastinColl = myLastPicked; #ifdef IMP191001 // Highlight detected object if it is not selected or myToHilightSelected flag is true if ( !myLastPicked.IsNull() && @@ -289,8 +280,6 @@ AIS_StatusOfDetection AIS_InteractiveContext::MoveTo(const Standard_Integer XPix if ( ismain ) myLastinMain.Nullify(); - else - myLastinColl.Nullify(); } if(UpdVwr) aView->Viewer()->Update(); @@ -325,12 +314,7 @@ AIS_StatusOfPick AIS_InteractiveContext::Select(const Standard_Integer XPMin, if(aView->Viewer()== myMainVwr) { selector= myMainSel; myWasLastMain = Standard_True;} - - else if (aView->Viewer()==myCollectorVwr){ - selector= myCollectorSel; - myWasLastMain = Standard_False;} - - + selector->Pick(XPMin,YPMin,XPMax,YPMax,aView); AIS_Selection::SetCurrentSelection(myCurrentName.ToCString()); @@ -395,12 +379,7 @@ AIS_StatusOfPick AIS_InteractiveContext::Select(const TColgp_Array1OfPnt2d& aPol if(aView->Viewer()== myMainVwr) { selector= myMainSel; myWasLastMain = Standard_True;} - - else if (aView->Viewer()==myCollectorVwr){ - selector= myCollectorSel; - myWasLastMain = Standard_False;} - - + selector->Pick(aPolyline,aView); AIS_Selection::SetCurrentSelection(myCurrentName.ToCString()); @@ -467,12 +446,6 @@ AIS_StatusOfPick AIS_InteractiveContext::Select(const Standard_Boolean updatevie if(updateviewer) UpdateCurrentViewer();} } - else if (!myWasLastMain && !myLastinColl.IsNull()){ - if(myLastinColl->State()!=1){ - SetCurrentObject(myLastinColl,Standard_False); - if(updateviewer) - UpdateCollector();} - } else{ AIS_Selection::SetCurrentSelection(myCurrentName.ToCString()); Handle(AIS_Selection) S = AIS_Selection::CurrentSelection(); @@ -493,9 +466,7 @@ AIS_StatusOfPick AIS_InteractiveContext::Select(const Standard_Boolean updatevie AIS_Selection::Select(); if(updateviewer){ if(myWasLastMain) - UpdateCurrentViewer(); - else - UpdateCollector(); + UpdateCurrentViewer(); } } Standard_Integer NS = NbCurrents(); @@ -524,10 +495,7 @@ AIS_StatusOfPick AIS_InteractiveContext::ShiftSelect(const Standard_Boolean upda } if(myWasLastMain && !myLastinMain.IsNull()) AddOrRemoveCurrentObject(myLastinMain,updateviewer); - else if (!myWasLastMain && !myLastinColl.IsNull()) - AddOrRemoveCurrentObject(myLastinColl,updateviewer); - - + Standard_Integer NS = NbCurrents(); if(NS==0) return AIS_SOP_NothingSelected; if(NS==1) return AIS_SOP_OneSelected; @@ -558,10 +526,6 @@ AIS_StatusOfPick AIS_InteractiveContext::ShiftSelect(const Standard_Integer XPMi if(aView->Viewer()== myMainVwr) { selector= myMainSel; myWasLastMain = Standard_True;} - - else if (aView->Viewer()==myCollectorVwr){ - selector= myCollectorSel; - myWasLastMain = Standard_False;} else return AIS_SOP_NothingSelected; @@ -605,10 +569,6 @@ AIS_StatusOfPick AIS_InteractiveContext::ShiftSelect( const TColgp_Array1OfPnt2d selector= myMainSel; myWasLastMain = Standard_True; } - else if ( aView->Viewer() == myCollectorVwr ) { - selector= myCollectorSel; - myWasLastMain = Standard_False; - } else return AIS_SOP_NothingSelected; diff --git a/src/AIS/AIS_InteractiveContext_2.cxx b/src/AIS/AIS_InteractiveContext_2.cxx index 198c5bd82d..cef773bb06 100755 --- a/src/AIS/AIS_InteractiveContext_2.cxx +++ b/src/AIS/AIS_InteractiveContext_2.cxx @@ -63,7 +63,6 @@ OpenLocalContext(const Standard_Boolean UseDisplayedObjects, // entities connected to dynamic selection at neutral point are set to 0. myLastinMain.Nullify(); - myLastinColl.Nullify(); myLastPicked.Nullify(); myWasLastMain = Standard_True; @@ -186,8 +185,6 @@ void AIS_InteractiveContext::CloseAllContexts(const Standard_Boolean updateviewe ResetOriginalState(Standard_False); myMainSel->UpdateSort(); - if(!myIsCollClosed && !myCollectorSel.IsNull()) - myCollectorSel->UpdateSort(); if(updateviewer) myMainVwr->Update(); } @@ -376,22 +373,18 @@ SubIntensityOn(const Handle(AIS_InteractiveObject)& anIObj, if(GB->IsSubIntensityOn()) return; GB->SubIntensityOn(); - Standard_Boolean UpdMain(Standard_False),UpdColl(Standard_False); + Standard_Boolean UpdMain(Standard_False); for(TColStd_ListIteratorOfListOfInteger It(GB->DisplayedModes());It.More();It.Next()){ - if(GB->GraphicStatus()==AIS_DS_Displayed){ + if (GB->GraphicStatus()==AIS_DS_Displayed) + { myMainPM->Color(anIObj,mySubIntensity,It.Value()); - UpdMain = Standard_True;} - else if(GB->GraphicStatus()==AIS_DS_Erased){ - myCollectorPM->Color(anIObj,mySubIntensity,It.Value()); - UpdColl=Standard_True; + UpdMain = Standard_True; } } if(updateviewer){ if(UpdMain) myMainVwr->Update(); - if(UpdColl) - myCollectorVwr->Update(); } } else { @@ -424,15 +417,13 @@ SubIntensityOff(const Handle(AIS_InteractiveObject)& anIObj, if(!GB->IsSubIntensityOn()) return; GB->SubIntensityOff(); - Standard_Boolean UpdMain(Standard_False),UpdColl(Standard_False); + Standard_Boolean UpdMain(Standard_False); for(TColStd_ListIteratorOfListOfInteger It(GB->DisplayedModes());It.More();It.Next()){ - if(GB->GraphicStatus()!=AIS_DS_Erased){ + if(GB->GraphicStatus()==AIS_DS_Displayed) + { myMainPM->Unhighlight(anIObj,It.Value()); - UpdMain = Standard_True;} - else { - myCollectorPM->Unhighlight(anIObj,It.Value()); - UpdColl=Standard_True; + UpdMain = Standard_True; } } @@ -444,8 +435,6 @@ SubIntensityOff(const Handle(AIS_InteractiveObject)& anIObj, if(updateviewer){ if(UpdMain) myMainVwr->Update(); - if(UpdColl) - myCollectorVwr->Update(); } } else { @@ -749,17 +738,11 @@ void AIS_InteractiveContext::NotUseDisplayedObjects() //purpose : //======================================================================= -Standard_Integer AIS_InteractiveContext::PurgeDisplay(const Standard_Boolean CollectorToo) +Standard_Integer AIS_InteractiveContext::PurgeDisplay() { if(HasOpenedContext()) return 0; Standard_Integer NbStr = PurgeViewer(myMainVwr); - if(!myCollectorVwr.IsNull()) - if(CollectorToo){ - NbStr+=PurgeViewer(myCollectorVwr); - if(!IsCollectorClosed()) - myCollectorVwr->Update(); - } myMainVwr->Update(); return NbStr; @@ -881,7 +864,7 @@ Standard_Boolean AIS_InteractiveContext::EndImmediateDraw(const Standard_Boolean void AIS_InteractiveContext::ResetOriginalState(const Standard_Boolean updateviewer) { - Standard_Boolean upd_main(Standard_False),upd_col(Standard_False); + Standard_Boolean upd_main(Standard_False); TColStd_ListIteratorOfListOfInteger itl; for (AIS_DataMapIteratorOfDataMapOfIOStatus it(myObjects);it.More();it.Next()){ @@ -908,12 +891,7 @@ void AIS_InteractiveContext::ResetOriginalState(const Standard_Boolean updatevie break; } case AIS_DS_Erased:{ - upd_col = Standard_True; - EraseGlobal(iobj,Standard_False,Standard_True); - break; - } - case AIS_DS_FullErased:{ - EraseGlobal(iobj,Standard_False,Standard_False); + EraseGlobal(iobj,Standard_False); break; } default: @@ -923,8 +901,6 @@ void AIS_InteractiveContext::ResetOriginalState(const Standard_Boolean updatevie if(updateviewer){ if(upd_main) myMainVwr->Update(); - if(upd_col) - myCollectorVwr->Update(); } } diff --git a/src/AIS/AIS_InteractiveContext_3.cxx b/src/AIS/AIS_InteractiveContext_3.cxx index ec3ff60320..8917e27230 100755 --- a/src/AIS/AIS_InteractiveContext_3.cxx +++ b/src/AIS/AIS_InteractiveContext_3.cxx @@ -25,28 +25,6 @@ #include // OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets -//======================================================================= -//function : Erase -//purpose : display an interactive object from the collector. -//======================================================================= -void AIS_InteractiveContext::DisplayFromCollector(const Handle(AIS_InteractiveObject)& anIObj, - const Standard_Boolean updateviewer) -{ - if ( !IsInCollector( anIObj ) ) return; - - if ( !HasOpenedContext() ){ - - if ( DisplayStatus( anIObj ) == AIS_DS_Erased ) - Display( anIObj,Standard_False); - - if( updateviewer ){ - myMainVwr->Update(); - if( !myCollectorVwr.IsNull() ) - myCollectorVwr->Update(); - } - } -} - // OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets //======================================================================= diff --git a/src/AIS/AIS_LocalContext.cxx b/src/AIS/AIS_LocalContext.cxx index f3c54950da..96cb86a14c 100755 --- a/src/AIS/AIS_LocalContext.cxx +++ b/src/AIS/AIS_LocalContext.cxx @@ -317,13 +317,13 @@ Erase(const Handle(AIS_InteractiveObject)& anInteractive) AddOrRemoveSelected(anInteractive); if(myMainPM->IsHighlighted(anInteractive,STAT->HilightMode())) myMainPM->Unhighlight(anInteractive,STAT->HilightMode()); - myMainPM->Erase(anInteractive,STAT->DisplayMode()); + myMainPM->SetVisibility (anInteractive, STAT->DisplayMode(), Standard_False); STAT->SetDisplayMode(-1); status = Standard_True; } if(STAT->IsTemporary()){ if(myMainPM->IsDisplayed(anInteractive,STAT->HilightMode())) - myMainPM->Erase(anInteractive,STAT->HilightMode()); + myMainPM->SetVisibility (anInteractive, STAT->HilightMode(), Standard_False); } //selection step @@ -590,13 +590,7 @@ void AIS_LocalContext::ActivateStandardMode(const TopAbs_ShapeEnum aType) AIS_DataMapIteratorOfDataMapOfSelStat ItM(myActiveObjects); for(;ItM.More();ItM.Next()){ -#ifdef BUC60722 - AIS_DisplayStatus DS = - myCTX->DisplayStatus(Handle(AIS_InteractiveObject)::DownCast(ItM.Key())); - if( ItM.Value()->Decomposed() && (DS != AIS_DS_FullErased) ) -#else if(ItM.Value()->Decomposed()) -#endif myCTX->SelectionManager()->Activate(ItM.Key(), IMode, myMainVS); @@ -844,8 +838,8 @@ void AIS_LocalContext::Unhilight(const Handle(AIS_InteractiveObject)& anObject) myMainPM->Unhighlight(anObject,Att->HilightMode()); if(Att->IsTemporary() && Att->DisplayMode()==-1) if(!IsSomeWhereElse) - myMainPM->Erase(anObject,Att->HilightMode()); - + myMainPM->SetVisibility (anObject, Att->HilightMode(), Standard_False); + Att->SubIntensityOff(); Att->SetHilightColor(Quantity_NOC_WHITE); } @@ -1148,31 +1142,30 @@ HasFilters(const TopAbs_ShapeEnum aType) const void AIS_LocalContext::ClearDetected() { - for(Standard_Integer I=1;I<=myMapOfOwner.Extent();I++){ - - if(!myMapOfOwner(I).IsNull()){ + for(Standard_Integer I=1;I<=myMapOfOwner.Extent();I++) + { + if(!myMapOfOwner(I).IsNull()) + { if(myMapOfOwner(I)->IsHilighted(myMainPM)) - myMapOfOwner(I)->Unhilight(myMainPM); - else if (myMapOfOwner(I)->IsHilighted(myCTX->CollectorPrsMgr())) - myMapOfOwner(I)->Unhilight(myCTX->CollectorPrsMgr()); - - else{ - const Handle(SelectMgr_SelectableObject)& SO = - myMapOfOwner.FindKey(I)->Selectable(); - if(myActiveObjects.IsBound(SO)){ - const Handle(AIS_LocalStatus)& Att = myActiveObjects(SO); - - if(Att->IsTemporary() && - Att->DisplayMode()==-1 && - Att->SelectionModes().IsEmpty()){ - myMapOfOwner(I)->Clear(myMainPM); - //myMapOfOwner(I)->Clear();//rob-jmi... - } - } + myMapOfOwner(I)->Unhilight(myMainPM); + else + { + const Handle(SelectMgr_SelectableObject)& SO = + myMapOfOwner.FindKey(I)->Selectable(); + if(myActiveObjects.IsBound(SO)) + { + const Handle(AIS_LocalStatus)& Att = myActiveObjects(SO); + + if(Att->IsTemporary() && + Att->DisplayMode()==-1 && + Att->SelectionModes().IsEmpty()) + { + myMapOfOwner(I)->Clear(myMainPM); + } + } } } } - } void AIS_LocalContext::UpdateConversion() diff --git a/src/AIS/AIS_LocalContext_1.cxx b/src/AIS/AIS_LocalContext_1.cxx index 17592abbe6..fef2707d94 100755 --- a/src/AIS/AIS_LocalContext_1.cxx +++ b/src/AIS/AIS_LocalContext_1.cxx @@ -594,7 +594,7 @@ void AIS_LocalContext::Unhilight(const Handle(SelectMgr_EntityOwner)& Ownr, //======================================================================= void AIS_LocalContext::HilightPicked(const Standard_Boolean updateviewer) { - Standard_Boolean updMain(Standard_False),updColl(Standard_False); + Standard_Boolean updMain(Standard_False); Handle(AIS_Selection) Sel = AIS_Selection::Selection(mySelName.ToCString()); #ifdef BUC60765 @@ -626,11 +626,7 @@ void AIS_LocalContext::HilightPicked(const Standard_Boolean updateviewer) if(BROwnr.IsNull() || !BROwnr->ComesFromDecomposition()){ Handle(SelectMgr_SelectableObject) SO = Ownr->Selectable(); IO = *((Handle(AIS_InteractiveObject)*)&SO); - if(myCTX->IsInCollector(IO)){ - PM = myCTX->CollectorPrsMgr(); - updColl = Standard_True;} - else - updMain = Standard_True; + updMain = Standard_True; } else updMain = Standard_True; @@ -661,7 +657,6 @@ void AIS_LocalContext::HilightPicked(const Standard_Boolean updateviewer) #else if(updMain) myCTX->CurrentViewer()->Update(); #endif - if(updColl) myCTX->Collector()->Update(); } } @@ -672,7 +667,7 @@ void AIS_LocalContext::HilightPicked(const Standard_Boolean updateviewer) void AIS_LocalContext:: UnhilightPicked(const Standard_Boolean updateviewer) { - Standard_Boolean updMain(Standard_False),updColl(Standard_False); + Standard_Boolean updMain(Standard_False); Handle(AIS_Selection) Sel = AIS_Selection::Selection(mySelName.ToCString()); #ifdef BUC60765 @@ -711,11 +706,7 @@ UnhilightPicked(const Standard_Boolean updateviewer) Handle(AIS_InteractiveObject) IO = *((Handle(AIS_InteractiveObject)*)&SO); HM = GetHiMod(IO); #endif - if(myCTX->IsInCollector(IO)){ - PM = myCTX->CollectorPrsMgr(); - updColl = Standard_True;} - else - updMain = Standard_True; + updMain = Standard_True; } else updMain = Standard_True; @@ -735,7 +726,6 @@ UnhilightPicked(const Standard_Boolean updateviewer) #else if(updMain) myCTX->CurrentViewer()->Update(); #endif - if(updColl) myCTX->Collector()->Update(); } } diff --git a/src/Graphic3d/Graphic3d_GraphicDriver.cdl b/src/Graphic3d/Graphic3d_GraphicDriver.cdl index bc3fbec022..9f693ab973 100755 --- a/src/Graphic3d/Graphic3d_GraphicDriver.cdl +++ b/src/Graphic3d/Graphic3d_GraphicDriver.cdl @@ -205,15 +205,6 @@ is is deferred; ---Purpose: call_togl_markercontextgroup - MarkerContextGroup ( me : mutable; - ACGroup : CGroup from Graphic3d; - NoInsert : Integer from Standard; - AMarkWidth : Integer from Standard; - AMarkHeight: Integer from Standard; - ATexture : HArray1OfByte from TColStd ) - is deferred; - ---Purpose: call_togl_markercontextgroup - RemoveGroup ( me : mutable; ACGroup : CGroup from Graphic3d ) is deferred; @@ -1028,10 +1019,18 @@ is ---Purpose: returns Handle to display connection + IsDeviceLost (me) + returns Boolean from Standard; + -- Purpose: @return Standard_True in cases when the last view has been removed but some objects still present. + + ResetDeviceLostFlag (me: mutable); + -- Purpose: Resets DeviceLostFlag to default (Standard_False) state. + fields MyTraceLevel : Integer from Standard is protected; MySharedLibrary : SharedLibrary from OSD is protected; myDisplayConnection: DisplayConnection_Handle from Aspect is protected; + myDeviceLostFlag : Boolean from Standard is protected; end GraphicDriver from Graphic3d; diff --git a/src/Graphic3d/Graphic3d_GraphicDriver.cxx b/src/Graphic3d/Graphic3d_GraphicDriver.cxx index 942dde55f8..6122ea7dd6 100755 --- a/src/Graphic3d/Graphic3d_GraphicDriver.cxx +++ b/src/Graphic3d/Graphic3d_GraphicDriver.cxx @@ -48,6 +48,7 @@ Graphic3d_GraphicDriver::Graphic3d_GraphicDriver (const Standard_CString AShrNam SetTrace (0); MySharedLibrary.SetName (AShrName); + myDeviceLostFlag = Standard_False; //if (! MySharedLibrary.DlOpen (OSD_RTLD_LAZY)) //Aspect_DriverDefinitionError::Raise (MySharedLibrary.DlError ()); @@ -222,3 +223,13 @@ const Handle(Aspect_DisplayConnection)& Graphic3d_GraphicDriver::GetDisplayConne { return myDisplayConnection; } + +Standard_Boolean Graphic3d_GraphicDriver::IsDeviceLost() const +{ + return myDeviceLostFlag; +} + +void Graphic3d_GraphicDriver::ResetDeviceLostFlag() +{ + myDeviceLostFlag = Standard_False; +} diff --git a/src/Graphic3d/Graphic3d_Structure.cdl b/src/Graphic3d/Graphic3d_Structure.cdl index a8bac353bd..92c176dfe7 100755 --- a/src/Graphic3d/Graphic3d_Structure.cdl +++ b/src/Graphic3d/Graphic3d_Structure.cdl @@ -382,6 +382,11 @@ is -- Category: Compute methods ---------------------------- + Compute (me: mutable) + is virtual; + ---Level: Advanced + ---Category: Methods to modify the class definition + Compute ( me : mutable; aProjector : DataStructureManager from Graphic3d ) returns Structure from Graphic3d is virtual; diff --git a/src/Graphic3d/Graphic3d_Structure.cxx b/src/Graphic3d/Graphic3d_Structure.cxx index 702c6863dc..f0173d7d7e 100755 --- a/src/Graphic3d/Graphic3d_Structure.cxx +++ b/src/Graphic3d/Graphic3d_Structure.cxx @@ -298,6 +298,7 @@ void Graphic3d_Structure::Display () { MyStructureManager->Display (this); } + MyCStructure.visible = 1; } void Graphic3d_Structure::Display (const Standard_Integer Priority) { @@ -311,6 +312,7 @@ void Graphic3d_Structure::Display (const Standard_Integer Priority) { MyStructureManager->Display (this); } + MyCStructure.visible = 1; } void Graphic3d_Structure::SetDisplayPriority (const Standard_Integer Priority) { @@ -438,11 +440,6 @@ void Graphic3d_Structure::SetVisible (const Standard_Boolean AValue) { MyGraphicDriver->NameSetStructure (MyCStructure); - if (AValue) - MyStructureManager->Visible (this); - else - MyStructureManager->Invisible (this); - Update (); } @@ -651,6 +648,11 @@ void Graphic3d_Structure::GroupsWithFacet (const Standard_Integer ADelta) { } +void Graphic3d_Structure::Compute() +{ + // Implemented by Presentation +} + Handle(Graphic3d_Structure) Graphic3d_Structure::Compute (const Handle(Graphic3d_DataStructureManager)& ) { // Implemented by Presentation @@ -2420,11 +2422,6 @@ void Graphic3d_Structure::SetManager (const Handle(Graphic3d_StructureManager)& if (MyCStructure.highlight) { } - if (MyCStructure.visible) { - MyStructureManager->Invisible (this); - AManager->Visible (this); - } - if (MyCStructure.pick) { MyStructureManager->Undetectable (this); AManager->Detectable (this); diff --git a/src/Graphic3d/Graphic3d_StructureManager.cdl b/src/Graphic3d/Graphic3d_StructureManager.cdl index fb27021457..f9678f5fab 100755 --- a/src/Graphic3d/Graphic3d_StructureManager.cdl +++ b/src/Graphic3d/Graphic3d_StructureManager.cdl @@ -202,13 +202,6 @@ is -- in a visualiser . ---Category: Inquire methods, MapOfStructure - VisibleStructures ( me; SG: in out MapOfStructure from Graphic3d ) - is static; - ---Level: Internal - ---Purpose: Returns the set of visible structures - -- in a visualiser . - ---Category: Inquire methods, MapOfStructure - ---------------------------- -- Category: Inquire methods ---------------------------- @@ -418,13 +411,6 @@ is ---Category: Private methods ---C++: return const & - Invisible ( me : mutable; - AStructure : Structure from Graphic3d ) - is static private; - ---Level: Internal - ---Purpose: Sets invisible the structure . - ---Category: Private methods - Identification ( me ) returns Integer from Standard is virtual; @@ -477,13 +463,10 @@ is ---Purpose: Suppress the highlighting on the structure . ---Category: Private methods - Visible ( me : mutable; - AStructure : Structure from Graphic3d ) - is static private; - ---Level: Internal - ---Purpose: Sets visible the structure . - -- in the manager. - ---Category: Private methods + ReComputeStructures (me: mutable); + -- Purpose: Recomputes all displayed structures. Used to recompute GL + -- resources after the last view has been closed without removing objects. + -- fields @@ -519,10 +502,6 @@ fields MyHighlightedStructure : MapOfStructure from Graphic3d is protected; - -- the visible structures - MyVisibleStructure : MapOfStructure from Graphic3d - is protected; - -- the pickable structures MyPickStructure : MapOfStructure from Graphic3d is protected; diff --git a/src/Graphic3d/Graphic3d_StructureManager.cxx b/src/Graphic3d/Graphic3d_StructureManager.cxx index a61874457e..7556aab818 100755 --- a/src/Graphic3d/Graphic3d_StructureManager.cxx +++ b/src/Graphic3d/Graphic3d_StructureManager.cxx @@ -66,9 +66,6 @@ static Standard_Integer StructureManager_CurrentId = 0; // -- les structures mises en evidence // MyHighlightedStructure : SequenceOfStructure; -// -- les structures visibles -// MyVisibleStructure : SequenceOfStructure; - // -- les structures detectables // MyPickStructure : SequenceOfStructure; @@ -80,7 +77,6 @@ static Standard_Integer StructureManager_CurrentId = 0; Graphic3d_StructureManager::Graphic3d_StructureManager (const Handle(Graphic3d_GraphicDriver)& theDriver): MyDisplayedStructure (), MyHighlightedStructure (), -MyVisibleStructure (), MyPickStructure () { Standard_Real Coef; @@ -145,7 +141,6 @@ void Graphic3d_StructureManager::Destroy () { MyDisplayedStructure.Clear (); MyHighlightedStructure.Clear (); - MyVisibleStructure.Clear (); MyPickStructure.Clear (); StructureManager_ArrayId[MyId] = 0; @@ -232,18 +227,6 @@ void Graphic3d_StructureManager::Remove (const Standard_Integer AnId) { } -void Graphic3d_StructureManager::Visible (const Handle(Graphic3d_Structure)& AStructure) { - - MyVisibleStructure.Add(AStructure); - -} - -void Graphic3d_StructureManager::Invisible (const Handle(Graphic3d_Structure)& AStructure) { - - MyVisibleStructure.Remove(AStructure); - -} - void Graphic3d_StructureManager::Detectable (const Handle(Graphic3d_Structure)& AStructure) { MyPickStructure.Add(AStructure); @@ -293,13 +276,6 @@ void Graphic3d_StructureManager::PickStructures (Graphic3d_MapOfStructure& SG) c } -void Graphic3d_StructureManager::VisibleStructures (Graphic3d_MapOfStructure& SG) const { - - SG.Assign(MyVisibleStructure); - - -} - void Graphic3d_StructureManager::MinMaxValues (Standard_Real& XMin, Standard_Real& YMin, Standard_Real& ZMin, Standard_Real& XMax, Standard_Real& YMax, Standard_Real& ZMax) const { Standard_Boolean Flag = Standard_True; @@ -397,3 +373,14 @@ const Handle(Graphic3d_GraphicDriver)& Graphic3d_StructureManager::GraphicDriver return (MyGraphicDriver); } + +void Graphic3d_StructureManager::ReComputeStructures() +{ + for (Graphic3d_MapIteratorOfMapOfStructure anIter(MyDisplayedStructure); anIter.More(); anIter.Next()) + { + Handle(Graphic3d_Structure) aStructure = anIter.Key(); + + aStructure->Clear(); + aStructure->Compute(); + } +} diff --git a/src/OpenGl/OpenGl_GraphicDriver.hxx b/src/OpenGl/OpenGl_GraphicDriver.hxx index f2f86c9580..f5af18f665 100644 --- a/src/OpenGl/OpenGl_GraphicDriver.hxx +++ b/src/OpenGl/OpenGl_GraphicDriver.hxx @@ -108,11 +108,6 @@ public: // Methods for graphical groups const Standard_Integer theNoInsert); Standard_EXPORT void MarkerContextGroup (const Graphic3d_CGroup& theCGroup, const Standard_Integer theNoInsert); - Standard_EXPORT void MarkerContextGroup (const Graphic3d_CGroup& theCGroup, - const Standard_Integer theNoInsert, - const Standard_Integer theMarkWidth, - const Standard_Integer theMarkHeight, - const Handle(TColStd_HArray1OfByte)& theTexture); Standard_EXPORT void RemoveGroup (const Graphic3d_CGroup& theCGroup); Standard_EXPORT void TextContextGroup (const Graphic3d_CGroup& theCGroup, const Standard_Integer theNoInsert); diff --git a/src/OpenGl/OpenGl_GraphicDriver_3.cxx b/src/OpenGl/OpenGl_GraphicDriver_3.cxx index 50f98fac11..f51a56baaa 100755 --- a/src/OpenGl/OpenGl_GraphicDriver_3.cxx +++ b/src/OpenGl/OpenGl_GraphicDriver_3.cxx @@ -67,23 +67,6 @@ void OpenGl_GraphicDriver::MarkerContextGroup (const Graphic3d_CGroup& theCGroup ((OpenGl_Group* )theCGroup.ptrGroup)->SetAspectMarker (GetSharedContext(), theCGroup.ContextMarker, theNoInsert); } -void OpenGl_GraphicDriver::MarkerContextGroup (const Graphic3d_CGroup& theCGroup, - const Standard_Integer theNoInsert, - const Standard_Integer /*theMarkWidth*/, - const Standard_Integer /*theMarkHeight*/, - const Handle(TColStd_HArray1OfByte)& /*theTexture*/) -{ - if (!theCGroup.ContextMarker.IsDef) - { - return; - } - - if (theCGroup.ptrGroup != NULL) - { - ((OpenGl_Group* )theCGroup.ptrGroup)->SetAspectMarker (GetSharedContext(), theCGroup.ContextMarker, theNoInsert); - } -} - void OpenGl_GraphicDriver::RemoveGroup (const Graphic3d_CGroup& theCGroup) { OpenGl_Structure* aStructure = (OpenGl_Structure* )theCGroup.Struct->ptrStructure; diff --git a/src/OpenGl/OpenGl_GraphicDriver_7.cxx b/src/OpenGl/OpenGl_GraphicDriver_7.cxx index 5b183776a4..84f522cf93 100755 --- a/src/OpenGl/OpenGl_GraphicDriver_7.cxx +++ b/src/OpenGl/OpenGl_GraphicDriver_7.cxx @@ -25,6 +25,7 @@ #include #include #include +#include /*----------------------------------------------------------------------*/ @@ -433,6 +434,8 @@ void OpenGl_GraphicDriver::RemoveView (const Graphic3d_CView& theCView) OpenGl_Structure* aStruct = aStructIt.ChangeValue(); aStruct->ReleaseGlResources (aShareCtx); } + myTempText->Release (aShareCtx); + myDeviceLostFlag = Standard_True; } OpenGl_CView* aCView = (OpenGl_CView* )theCView.ptrView; diff --git a/src/PrsMgr/PrsMgr_PresentableObject.cdl b/src/PrsMgr/PrsMgr_PresentableObject.cdl index 97dd501622..fa0527336a 100755 --- a/src/PrsMgr/PrsMgr_PresentableObject.cdl +++ b/src/PrsMgr/PrsMgr_PresentableObject.cdl @@ -295,6 +295,7 @@ fields myTransformPersistence : CTransPersStruct from Graphic3d; friends + class Presentation3d from PrsMgr, class PresentationManager from PrsMgr, Compute from Presentation3d from PrsMgr(me : mutable; aProjector : DataStructureManager from Graphic3d), Compute from Presentation3d from PrsMgr(me : mutable; aProjector : DataStructureManager from Graphic3d; diff --git a/src/PrsMgr/PrsMgr_Presentation.cdl b/src/PrsMgr/PrsMgr_Presentation.cdl index 6aafcc9075..1f25394b7b 100755 --- a/src/PrsMgr/PrsMgr_Presentation.cdl +++ b/src/PrsMgr/PrsMgr_Presentation.cdl @@ -40,7 +40,9 @@ is Display(me: mutable) is deferred private; Erase(me) is deferred private; - + + SetVisible (me: mutable; theValue: Boolean from Standard) is deferred private; + Highlight(me: mutable) is deferred private; Unhighlight (me) is deferred private; diff --git a/src/PrsMgr/PrsMgr_Presentation3d.cdl b/src/PrsMgr/PrsMgr_Presentation3d.cdl index 58006569fc..52a2bd694f 100755 --- a/src/PrsMgr/PrsMgr_Presentation3d.cdl +++ b/src/PrsMgr/PrsMgr_Presentation3d.cdl @@ -54,8 +54,17 @@ is Display(me: mutable) is redefined static private; - Erase(me) is redefined static private; + Display (me: mutable; + theIsHighlight: Boolean from Standard) + is static private; + ---Level: Private; + ---Purpose: displays myStructure and sets myDisplayReason to theIsHighlight value if + -- myStructure was not displayed or was invisible + Erase(me) is redefined static private; + + SetVisible (me: mutable; theValue: Boolean from Standard) is redefined static private; + Highlight(me: mutable) is redefined static private; Unhighlight (me) is redefined static private; @@ -126,6 +135,9 @@ is ---Category: Computed Structures + Compute(me : mutable; theStructure: Structure from Graphic3d) + is static private; + Compute(me : mutable; aProjector: DataStructureManager from Graphic3d) returns Structure from Graphic3d is static private; diff --git a/src/PrsMgr/PrsMgr_Presentation3d.cxx b/src/PrsMgr/PrsMgr_Presentation3d.cxx index 38004c60ff..7b822bceed 100755 --- a/src/PrsMgr/PrsMgr_Presentation3d.cxx +++ b/src/PrsMgr/PrsMgr_Presentation3d.cxx @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -47,24 +48,41 @@ PrsMgr_KindOfPrs PrsMgr_Presentation3d::KindOfPresentation() const {return PrsMgr_KOP_3D;} -void PrsMgr_Presentation3d::Display () { - myStructure->Display(); +void PrsMgr_Presentation3d::Display() +{ + Display (Standard_False); myDisplayReason = Standard_False; } +void PrsMgr_Presentation3d::Display(const Standard_Boolean theIsHighlight) +{ + if (!myStructure->IsDisplayed()) + { + myStructure->Display(); + myDisplayReason = theIsHighlight; + } + else if (!myStructure->IsVisible()) + { + myStructure->SetVisible (Standard_True); + myDisplayReason = theIsHighlight; + } +} + void PrsMgr_Presentation3d::Erase () const { myStructure->Erase();} +void PrsMgr_Presentation3d::SetVisible (const Standard_Boolean theValue) +{ + myStructure->SetVisible (theValue); +} + void PrsMgr_Presentation3d::Highlight () { - if(!myStructure->IsDisplayed()) { - myStructure->Display(); - myDisplayReason = Standard_True; - } + Display (Standard_True); myStructure->Highlight();} void PrsMgr_Presentation3d::Unhighlight () const { myStructure->UnHighlight(); - if(myDisplayReason) myStructure->Erase(); + if (myDisplayReason) myStructure->SetVisible (Standard_False); } void PrsMgr_Presentation3d::Clear() { @@ -81,13 +99,7 @@ void PrsMgr_Presentation3d::Clear() { } void PrsMgr_Presentation3d::Color(const Quantity_NameOfColor aColor){ - Standard_Boolean ImmMode = myPresentationManager->IsImmediateModeOn(); - if(!ImmMode){ - if(!myStructure->IsDisplayed()) { - myStructure->Display(); - myDisplayReason = Standard_True; - } - } + Display (Standard_True); myStructure->Color(aColor); } @@ -96,7 +108,7 @@ void PrsMgr_Presentation3d::BoundBox() const { } Standard_Boolean PrsMgr_Presentation3d::IsDisplayed () const { - return myStructure->IsDisplayed() && !myDisplayReason; + return myStructure->IsDisplayed() && myStructure->IsVisible() && !myDisplayReason; } Standard_Boolean PrsMgr_Presentation3d::IsHighlighted () const { @@ -167,6 +179,36 @@ Compute(const Handle(Graphic3d_DataStructureManager)& aProjector) //purpose : //======================================================================= +void PrsMgr_Presentation3d::Compute (const Handle(Graphic3d_Structure)& theStructure) +{ + Standard_Integer aDispMode = 0; + + Standard_Integer aPresentationsNumber = myPresentableObject->myPresentations.Length(); + for (Standard_Integer anIter = 1; anIter <= aPresentationsNumber; anIter++) + { + const PrsMgr_ModedPresentation& aModedPresentation = myPresentableObject->myPresentations.Value (anIter); + Handle(PrsMgr_Presentation) aPresentation = aModedPresentation.Presentation(); + PrsMgr_Presentation3d* aPresentation3d = (PrsMgr_Presentation3d* )aPresentation.operator->(); + if (aPresentation3d == this) + { + aDispMode = aModedPresentation.Mode(); + break; + } + } + + Handle(Prs3d_Presentation) aPrs3d = Handle(Prs3d_Presentation)::DownCast (theStructure); + + myPresentableObject->Compute( + Handle(PrsMgr_PresentationManager3d)::DownCast (PresentationManager()), + aPrs3d, + aDispMode); +} + +//======================================================================= +//function : Compute +//purpose : +//======================================================================= + void PrsMgr_Presentation3d::Compute(const Handle(Graphic3d_DataStructureManager)& aProjector, const Handle(Graphic3d_Structure)& TheStructToFill) { diff --git a/src/PrsMgr/PrsMgr_PresentationManager.cdl b/src/PrsMgr/PrsMgr_PresentationManager.cdl index 164ee9f9a4..4eab53f89b 100755 --- a/src/PrsMgr/PrsMgr_PresentationManager.cdl +++ b/src/PrsMgr/PrsMgr_PresentationManager.cdl @@ -65,6 +65,11 @@ is -- aPresentableObject in this framework with the -- display mode aMode. + SetVisibility (me: mutable; thePresentableObject: PresentableObject from PrsMgr; + theMode: Integer from Standard; + theValue: Boolean from Standard); + ---Purpose: Sets the visibility of presentable object. + Highlight(me: mutable; aPresentableObject: mutable PresentableObject from PrsMgr; aMode: Integer from Standard = 0) ---Purpose: Highlights the presentation of the presentable object diff --git a/src/PrsMgr/PrsMgr_PresentationManager.cxx b/src/PrsMgr/PrsMgr_PresentationManager.cxx index 170a883cb3..26a0fa7949 100755 --- a/src/PrsMgr/PrsMgr_PresentationManager.cxx +++ b/src/PrsMgr/PrsMgr_PresentationManager.cxx @@ -66,6 +66,12 @@ void PrsMgr_PresentationManager::Clear(const Handle(PrsMgr_PresentableObject)& a Presentation(aPresentableObject,aMode)->Clear();} } +void PrsMgr_PresentationManager::SetVisibility (const Handle(PrsMgr_PresentableObject)& thePresentableObject, + const Standard_Integer theMode, + const Standard_Boolean theValue) +{ + Presentation(thePresentableObject, theMode)->SetVisible (theValue); +} void PrsMgr_PresentationManager::Highlight( const Handle(PrsMgr_PresentableObject)& aPresentableObject, diff --git a/src/PrsMgr/PrsMgr_Prs.cdl b/src/PrsMgr/PrsMgr_Prs.cdl index 035a7f6344..b43ec142b4 100755 --- a/src/PrsMgr/PrsMgr_Prs.cdl +++ b/src/PrsMgr/PrsMgr_Prs.cdl @@ -36,7 +36,10 @@ is aPresentation : Presentation3dPointer from PrsMgr; aTypeOfPresentation3d : TypeOfPresentation3d from PrsMgr) returns mutable Prs from PrsMgr; - + + Compute (me: mutable) + is redefined static; + Compute(me : mutable; aProjector: DataStructureManager from Graphic3d) returns Structure from Graphic3d is redefined static; diff --git a/src/PrsMgr/PrsMgr_Prs.cxx b/src/PrsMgr/PrsMgr_Prs.cxx index b00b7f3565..43e12edae7 100755 --- a/src/PrsMgr/PrsMgr_Prs.cxx +++ b/src/PrsMgr/PrsMgr_Prs.cxx @@ -37,6 +37,16 @@ PrsMgr_Prs::PrsMgr_Prs (const Handle(Graphic3d_StructureManager)& aStructureMana //purpose : //======================================================================= +void PrsMgr_Prs::Compute() +{ + myPresentation3d->Compute (this); +} + +//======================================================================= +//function : Compute +//purpose : +//======================================================================= + Handle(Graphic3d_Structure) PrsMgr_Prs::Compute(const Handle(Graphic3d_DataStructureManager)& aProjector) { return myPresentation3d->Compute(aProjector); } diff --git a/src/QABugs/QABugs_1.cxx b/src/QABugs/QABugs_1.cxx index ae91ac8f67..dfd48e839b 100644 --- a/src/QABugs/QABugs_1.cxx +++ b/src/QABugs/QABugs_1.cxx @@ -112,7 +112,7 @@ static Standard_Integer OCC328bug (Draw_Interpretor& di, Standard_Integer argc, return 1; } - Standard_Boolean updateviewer = Standard_True, PutInCollector = Standard_True; + Standard_Boolean updateviewer = Standard_True; ViewerTest_DoubleMapOfInteractiveAndName& aMap = GetMapOfAIS(); @@ -137,7 +137,7 @@ static Standard_Integer OCC328bug (Draw_Interpretor& di, Standard_Integer argc, aContext->ActivateStandardMode(AIS_Shape::SelectionType(ChoosingMode)); theactivatedmodes.Add(ChoosingMode); } - aContext->Erase(AISObj, updateviewer, PutInCollector); + aContext->Erase(AISObj, updateviewer); aContext->UpdateCurrentViewer(); aContext->Display(AISObj, updateviewer); @@ -405,7 +405,7 @@ static Standard_Integer OCC74bug_set (Draw_Interpretor& di, Standard_Integer arg return 1; } - Standard_Boolean updateviewer = Standard_True, PutInCollector = Standard_True; + Standard_Boolean updateviewer = Standard_True; ViewerTest_DoubleMapOfInteractiveAndName& aMap = GetMapOfAIS(); @@ -427,7 +427,7 @@ static Standard_Integer OCC74bug_set (Draw_Interpretor& di, Standard_Integer arg if (!aContext->HasOpenedContext()) { aContext->OpenLocalContext(); } - aContext->Erase(AISObj, updateviewer, PutInCollector); + aContext->Erase(AISObj, updateviewer); aContext->UpdateCurrentViewer(); aContext->Display(AISObj, updateviewer); aContext->UpdateCurrentViewer(); diff --git a/src/QABugs/QABugs_11.cxx b/src/QABugs/QABugs_11.cxx index 574290434e..69ab34dfad 100755 --- a/src/QABugs/QABugs_11.cxx +++ b/src/QABugs/QABugs_11.cxx @@ -1682,7 +1682,7 @@ static Standard_Integer OCC708 (Draw_Interpretor& di, Standard_Integer argc, con return 1; } - Standard_Boolean updateviewer = Standard_True, PutInCollector = Standard_True; + Standard_Boolean updateviewer = Standard_True; ViewerTest_DoubleMapOfInteractiveAndName& aMap = GetMapOfAIS(); @@ -1702,7 +1702,7 @@ static Standard_Integer OCC708 (Draw_Interpretor& di, Standard_Integer argc, con if (!aContext->HasOpenedContext()) { aContext->OpenLocalContext(); } - aContext->Erase(AISObj, updateviewer, PutInCollector); + aContext->Erase(AISObj, updateviewer); aContext->UpdateCurrentViewer(); aContext->Display(AISObj, updateviewer); aContext->UpdateCurrentViewer(); @@ -3158,18 +3158,6 @@ static Standard_Integer OCC7068 (Draw_Interpretor& di, Standard_Integer argc, co } } - // ObjectsInCollector - AIS_ListOfInteractive ListOfIO_2; - AISContext->ObjectsInCollector(ListOfIO_2); - di<< "ObjectsInCollector = " << ListOfIO_2.Extent() <<"\n"; - if (!ListOfIO_2.IsEmpty() ) { - AIS_ListIteratorOfListOfInteractive iter; - for (iter.Initialize(ListOfIO_2); iter.More() ; iter.Next() ) { - Handle(AIS_InteractiveObject) aIO=iter.Value(); - di<< GetMapOfAIS().Find1(aIO).ToCString() <<"\n"; - } - } - return 0; } @@ -5282,9 +5270,9 @@ Standard_Integer CR23234 (Draw_Interpretor& di, Standard_Integer argc, const cha { aisContext->CloseAllContexts(); aisContext->RemoveAll(false); - aisContext->EraseSelected(false, false); + aisContext->EraseSelected(false); } - aisContext->EraseAll(false,false); + aisContext->EraseAll(false); Handle(Geom_Axis2Placement) trihedronAxis = new Geom_Axis2Placement(gp::XOY()); Handle(AIS_Trihedron) trihedron = new AIS_Trihedron(trihedronAxis); if (aMode) diff --git a/src/ViewerTest/ViewerTest.cxx b/src/ViewerTest/ViewerTest.cxx index a5537024bf..aaee1e1083 100755 --- a/src/ViewerTest/ViewerTest.cxx +++ b/src/ViewerTest/ViewerTest.cxx @@ -873,7 +873,7 @@ static int VwrTst_DispErase(const Handle(AIS_InteractiveObject)& IO, Ctx->Display(IO,Mode,Upd); break; case 2:{ - Ctx->Erase(IO,Mode,Upd); + Ctx->Erase(IO,Upd); break; } case 3:{ diff --git a/src/ViewerTest/ViewerTest_ObjectCommands.cxx b/src/ViewerTest/ViewerTest_ObjectCommands.cxx index 5651f2f0b4..d766a4055e 100755 --- a/src/ViewerTest/ViewerTest_ObjectCommands.cxx +++ b/src/ViewerTest/ViewerTest_ObjectCommands.cxx @@ -145,6 +145,7 @@ #include #include +#include #ifdef HAVE_STRINGS_H #include @@ -2325,7 +2326,7 @@ protected: Standard_Real aHeight; Standard_Boolean aZoomable; Quantity_Color aColor; - Standard_CString aFont; + TCollection_AsciiString aFont; Font_FontAspect aFontAspect; Graphic3d_HorizontalTextAlignment aHJustification; Graphic3d_VerticalTextAlignment aVJustification; @@ -2371,7 +2372,7 @@ void MyTextClass::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPresent Handle_Prs3d_TextAspect asp = myDrawer->TextAspect(); - asp->SetFont(aFont); + asp->SetFont(aFont.ToCString()); asp->SetColor(aColor); asp->SetHeight(aHeight); // I am changing the myHeight value @@ -2995,10 +2996,10 @@ class MyPArrayObject : public AIS_InteractiveObject public: - MyPArrayObject (const Handle(Graphic3d_ArrayOfPrimitives) theArray, + MyPArrayObject (Handle(TColStd_HArray1OfAsciiString) theArrayDescription, Handle(Graphic3d_AspectMarker3d) theMarkerAspect = NULL) { - myArray = theArray; + myArrayDescription = theArrayDescription; myMarkerAspect = theMarkerAspect; } @@ -3013,9 +3014,15 @@ private: void ComputeSelection (const Handle(SelectMgr_Selection)& theSelection, const Standard_Integer /*theMode*/); + bool CheckInputCommand (const TCollection_AsciiString theCommand, + const Handle(TColStd_HArray1OfAsciiString) theArgsArray, + Standard_Integer &theArgIndex, + Standard_Integer theArgCount, + Standard_Integer theMaxArgs); + protected: - Handle(Graphic3d_ArrayOfPrimitives) myArray; + Handle(TColStd_HArray1OfAsciiString) myArrayDescription; Handle(Graphic3d_AspectMarker3d) myMarkerAspect; }; @@ -3027,158 +3034,66 @@ void MyPArrayObject::Compute (const Handle(PrsMgr_PresentationManager3d)& /*aPre const Handle(Prs3d_Presentation)& aPresentation, const Standard_Integer /*aMode*/) { - aPresentation->Clear(); - if (!myMarkerAspect.IsNull()) - { - Prs3d_Root::CurrentGroup (aPresentation)->SetGroupPrimitivesAspect (myMarkerAspect); - } - Prs3d_Root::CurrentGroup (aPresentation)->AddPrimitiveArray (myArray); -} - -void MyPArrayObject::ComputeSelection (const Handle(SelectMgr_Selection)& theSelection, - const Standard_Integer /*theMode*/) -{ - Handle(SelectMgr_EntityOwner) anEntityOwner = new SelectMgr_EntityOwner (this); - - for (Standard_Integer anIter = 1; anIter <= myArray->VertexNumber(); anIter++) - { - - Handle(Select3D_SensitivePoint) aSensetivePoint = new Select3D_SensitivePoint (anEntityOwner, myArray->Vertice (anIter)); - theSelection->Add (aSensetivePoint); - } -} - -static bool CheckInputCommand (const TCollection_AsciiString theCommand, - const char **theArgStr, int &theArgIndex, - int theArgCount, int theMaxArgs) -{ - // check if there is more elements than expected - if (theArgIndex >= theMaxArgs) - return false; - - TCollection_AsciiString aStrCommand(theArgStr[theArgIndex]); - aStrCommand.LowerCase(); - if (aStrCommand.Search(theCommand) != 1 || - theArgIndex + (theArgCount - 1) >= theMaxArgs) - return false; - - // go to the first data element - theArgIndex++; - - // check data if it can be converted to numeric - for (int aElement = 0; aElement < theArgCount; aElement++, theArgIndex++) - { - aStrCommand = theArgStr[theArgIndex]; - if (!aStrCommand.IsRealValue()) - return false; - } - - return true; -} - -//============================================================================= -//function : VDrawPArray -//purpose : Draws primitives array from list of vertexes, bounds, edges -//============================================================================= - -static int VDrawPArray (Draw_Interpretor& di, Standard_Integer argc, const char** argv) -{ - Handle(AIS_InteractiveContext) aContextAIS = ViewerTest::GetAISContext(); - if (aContextAIS.IsNull()) - { - di << "Call vinit before!\n"; - return 1; - } - else if (argc < 3) - { - di << "Use: " << argv[0] << " Name TypeOfArray" - << " [vertex] ... [bounds] ... [edges]\n" - << " TypeOfArray={ points | segments | polylines | triangles |\n" - << " trianglefans | trianglestrips | quads |\n" - << " quadstrips | polygons }\n" - << " vertex={ 'v' x y z [normal={ 'n' nx ny nz }] [color={ 'c' r g b }]" - << " [texel={ 't' tx ty }] } \n" - << " bounds={ 'b' verticies_count [color={ 'c' r g b }] }\n" - << " edges={ 'e' vertex_id [hidden_edge={'h'}] }\n"; - return 1; - } - // read the arguments - Standard_Integer aArgIndex = 1; - TCollection_AsciiString aName (argv[aArgIndex++]); - TCollection_AsciiString anArrayType (argv[aArgIndex++]); - const Standard_Integer anArgsFrom = aArgIndex; - - // parse number of verticies, bounds, edges + // Parsing array description Standard_Integer aVertexNum = 0, aBoundNum = 0, aEdgeNum = 0; Standard_Boolean hasVColors, hasBColors, hasNormals, hasInfos, hasTexels; hasVColors = hasNormals = hasBColors = hasInfos = hasTexels = Standard_False; + Standard_Integer anArgIndex = 0; + Standard_Integer anArgsCount = myArrayDescription->Length(); + TCollection_AsciiString anArrayType = myArrayDescription->Value (anArgIndex++); + TCollection_AsciiString aCommand; - while (aArgIndex < argc) + while (anArgIndex < anArgsCount) { - aCommand = argv[aArgIndex]; + aCommand = myArrayDescription->Value (anArgIndex); aCommand.LowerCase(); - if (!aCommand.IsAscii()) - { - di << "Unexpected argument: #" << aArgIndex - 1 << " , " - << "should be an array element: 'v', 'b', 'e' \n"; - break; - } // vertex command - if (CheckInputCommand ("v", argv, aArgIndex, 3, argc)) + if (CheckInputCommand ("v", myArrayDescription, anArgIndex, 3, anArgsCount)) { // vertex has a normal or normal with color or texel - if (CheckInputCommand ("n", argv, aArgIndex, 3, argc)) + if (CheckInputCommand ("n", myArrayDescription, anArgIndex, 3, anArgsCount)) hasNormals = Standard_True; // vertex has a color - if (CheckInputCommand ("c", argv, aArgIndex, 3, argc)) + if (CheckInputCommand ("c", myArrayDescription, anArgIndex, 3, anArgsCount)) hasVColors = Standard_True; // vertex has a texel - if (CheckInputCommand ("t", argv, aArgIndex, 2, argc)) + if (CheckInputCommand ("t", myArrayDescription, anArgIndex, 2, anArgsCount)) hasTexels = Standard_True; aVertexNum++; } // bound command - else if (CheckInputCommand ("b", argv, aArgIndex, 1, argc)) + else if (CheckInputCommand ("b", myArrayDescription, anArgIndex, 1, anArgsCount)) { // bound has color - if (CheckInputCommand ("c", argv, aArgIndex, 3, argc)) + if (CheckInputCommand ("c", myArrayDescription, anArgIndex, 3, anArgsCount)) hasBColors = Standard_True; aBoundNum++; } // edge command - else if (CheckInputCommand ("e", argv, aArgIndex, 1, argc)) + else if (CheckInputCommand ("e", myArrayDescription, anArgIndex, 1, anArgsCount)) { // edge has a hide flag - if (CheckInputCommand ("h", argv, aArgIndex, 0, argc)) + if (CheckInputCommand ("h", myArrayDescription, anArgIndex, 0, anArgsCount)) hasInfos = Standard_True; aEdgeNum++; } // unknown command else - aArgIndex++; + anArgIndex++; } - if (aVertexNum == 0) - { - di << "You should pass any verticies in the list of array elements\n"; - return 1; - } - - // create an array of primitives by types Handle(Graphic3d_ArrayOfPrimitives) anArray; - Handle(Graphic3d_AspectMarker3d) anAspPoints; if (anArrayType == "points") { anArray = new Graphic3d_ArrayOfPoints (aVertexNum); - anAspPoints = new Graphic3d_AspectMarker3d (Aspect_TOM_POINT, Quantity_NOC_YELLOW, 1.0f); } else if (anArrayType == "segments") anArray = new Graphic3d_ArrayOfSegments (aVertexNum, aEdgeNum, hasVColors); @@ -3208,78 +3123,216 @@ static int VDrawPArray (Draw_Interpretor& di, Standard_Integer argc, const char* anArray = new Graphic3d_ArrayOfPolygons (aVertexNum, aBoundNum, aEdgeNum, hasNormals, hasVColors, hasBColors, hasTexels, hasInfos); - else - { - di << "Unexpected type of primitiives array\n"; - return 1; - } - // parse an array of primitives - aArgIndex = anArgsFrom; - while (aArgIndex < argc) + anArgIndex = 1; + while (anArgIndex < anArgsCount) { - aCommand = argv[aArgIndex]; + aCommand = myArrayDescription->Value (anArgIndex); aCommand.LowerCase(); if (!aCommand.IsAscii()) break; // vertex command - if (CheckInputCommand ("v", argv, aArgIndex, 3, argc)) + if (CheckInputCommand ("v", myArrayDescription, anArgIndex, 3, anArgsCount)) { - anArray->AddVertex (Draw::Atof (argv[aArgIndex - 3]), - Draw::Atof (argv[aArgIndex - 2]), - Draw::Atof (argv[aArgIndex - 1])); + anArray->AddVertex (myArrayDescription->Value (anArgIndex - 3).RealValue(), + myArrayDescription->Value (anArgIndex - 2).RealValue(), + myArrayDescription->Value (anArgIndex - 1).RealValue()); // vertex has a normal or normal with color or texel - if (CheckInputCommand ("n", argv, aArgIndex, 3, argc)) + if (CheckInputCommand ("n", myArrayDescription, anArgIndex, 3, anArgsCount)) anArray->SetVertexNormal (anArray->VertexNumber (), - Draw::Atof (argv[aArgIndex - 3]), - Draw::Atof (argv[aArgIndex - 2]), - Draw::Atof (argv[aArgIndex - 1])); + myArrayDescription->Value (anArgIndex - 3).RealValue(), + myArrayDescription->Value (anArgIndex - 2).RealValue(), + myArrayDescription->Value (anArgIndex - 1).RealValue()); - if (CheckInputCommand ("c", argv, aArgIndex, 3, argc)) + if (CheckInputCommand ("c", myArrayDescription, anArgIndex, 3, anArgsCount)) anArray->SetVertexColor (anArray->VertexNumber (), - Draw::Atof (argv[aArgIndex - 3]), - Draw::Atof (argv[aArgIndex - 2]), - Draw::Atof (argv[aArgIndex - 1])); + myArrayDescription->Value (anArgIndex - 3).RealValue(), + myArrayDescription->Value (anArgIndex - 2).RealValue(), + myArrayDescription->Value (anArgIndex - 1).RealValue()); - if (CheckInputCommand ("t", argv, aArgIndex, 2, argc)) + if (CheckInputCommand ("t", myArrayDescription, anArgIndex, 2, anArgsCount)) anArray->SetVertexTexel (anArray->VertexNumber (), - Draw::Atof (argv[aArgIndex - 2]), - Draw::Atof (argv[aArgIndex - 1])); + myArrayDescription->Value (anArgIndex - 2).RealValue(), + myArrayDescription->Value (anArgIndex - 1).RealValue()); } // bounds command - else if (CheckInputCommand ("b", argv, aArgIndex, 1, argc)) + else if (CheckInputCommand ("b", myArrayDescription, anArgIndex, 1, anArgsCount)) { - Standard_Integer aVertCount = Draw::Atoi (argv[aArgIndex - 1]); + Standard_Integer aVertCount = myArrayDescription->Value (anArgIndex - 1).IntegerValue(); - if (CheckInputCommand ("c", argv, aArgIndex, 3, argc)) + if (CheckInputCommand ("c", myArrayDescription, anArgIndex, 3, anArgsCount)) anArray->AddBound (aVertCount, - Draw::Atof (argv[aArgIndex - 3]), - Draw::Atof (argv[aArgIndex - 2]), - Draw::Atof (argv[aArgIndex - 1])); + myArrayDescription->Value (anArgIndex - 3).RealValue(), + myArrayDescription->Value (anArgIndex - 2).RealValue(), + myArrayDescription->Value (anArgIndex - 1).RealValue()); else anArray->AddBound (aVertCount); } // edge command - else if (CheckInputCommand ("e", argv, aArgIndex, 1, argc)) + else if (CheckInputCommand ("e", myArrayDescription, anArgIndex, 1, anArgsCount)) { - Standard_Integer aVertIndex = Draw::Atoi (argv[aArgIndex - 1]); + Standard_Integer aVertIndex = myArrayDescription->Value (anArgIndex - 1).IntegerValue(); // edge has/hasn't hide flag - if (CheckInputCommand ("h", argv, aArgIndex, 0, argc)) + if (CheckInputCommand ("h", myArrayDescription, anArgIndex, 0, anArgsCount)) anArray->AddEdge (aVertIndex, Standard_False); else anArray->AddEdge (aVertIndex, Standard_True); } // unknown command else - aArgIndex++; + anArgIndex++; + } + + aPresentation->Clear(); + if (!myMarkerAspect.IsNull()) + { + Prs3d_Root::CurrentGroup (aPresentation)->SetGroupPrimitivesAspect (myMarkerAspect); + } + Prs3d_Root::CurrentGroup (aPresentation)->AddPrimitiveArray (anArray); +} + +void MyPArrayObject::ComputeSelection (const Handle(SelectMgr_Selection)& theSelection, + const Standard_Integer /*theMode*/) +{ + Handle(SelectMgr_EntityOwner) anEntityOwner = new SelectMgr_EntityOwner (this); + + Standard_Integer anArgIndex = 1; + while (anArgIndex < myArrayDescription->Length()) + { + if (CheckInputCommand ("v", myArrayDescription, anArgIndex, 3, myArrayDescription->Length())) + { + gp_Pnt aPoint (myArrayDescription->Value (anArgIndex - 3).RealValue(), + myArrayDescription->Value (anArgIndex - 2).RealValue(), + myArrayDescription->Value (anArgIndex - 1).RealValue()); + Handle(Select3D_SensitivePoint) aSensetivePoint = new Select3D_SensitivePoint (anEntityOwner, aPoint); + theSelection->Add (aSensetivePoint); + } + else + { + anArgIndex++; + } + } +} + +bool MyPArrayObject::CheckInputCommand (const TCollection_AsciiString theCommand, + const Handle(TColStd_HArray1OfAsciiString) theArgsArray, + Standard_Integer &theArgIndex, + Standard_Integer theArgCount, + Standard_Integer theMaxArgs) +{ + // check if there is more elements than expected + if (theArgIndex >= theMaxArgs) + return false; + + TCollection_AsciiString aStrCommand = theArgsArray->Value (theArgIndex); + aStrCommand.LowerCase(); + if (aStrCommand.Search(theCommand) != 1 || + theArgIndex + (theArgCount - 1) >= theMaxArgs) + return false; + + // go to the first data element + theArgIndex++; + + // check data if it can be converted to numeric + for (int aElement = 0; aElement < theArgCount; aElement++, theArgIndex++) + { + aStrCommand = theArgsArray->Value (theArgIndex); + if (!aStrCommand.IsRealValue()) + return false; + } + + return true; +} + +//============================================================================= +//function : VDrawPArray +//purpose : Draws primitives array from list of vertexes, bounds, edges +//============================================================================= + +static int VDrawPArray (Draw_Interpretor& di, Standard_Integer argc, const char** argv) +{ + Handle(AIS_InteractiveContext) aContextAIS = ViewerTest::GetAISContext(); + if (aContextAIS.IsNull()) + { + di << "Call vinit before!\n"; + return 1; + } + else if (argc < 3) + { + di << "Use: " << argv[0] << " Name TypeOfArray" + << " [vertex] ... [bounds] ... [edges]\n" + << " TypeOfArray={ points | segments | polylines | triangles |\n" + << " trianglefans | trianglestrips | quads |\n" + << " quadstrips | polygons }\n" + << " vertex={ 'v' x y z [normal={ 'n' nx ny nz }] [color={ 'c' r g b }]" + << " [texel={ 't' tx ty }] } \n" + << " bounds={ 'b' verticies_count [color={ 'c' r g b }] }\n" + << " edges={ 'e' vertex_id [hidden_edge={'h'}] }\n"; + return 1; + } + + // read the arguments + Standard_Integer aArgIndex = 1; + TCollection_AsciiString aName (argv[aArgIndex++]); + TCollection_AsciiString anArrayType (argv[aArgIndex++]); + + Standard_Boolean hasVertex = Standard_False; + + Handle(TColStd_HArray1OfAsciiString) anArgsArray = new TColStd_HArray1OfAsciiString (0, argc - 2); + anArgsArray->SetValue (0, anArrayType); + + if (anArrayType != "points" && + anArrayType != "segments" && + anArrayType != "polylines" && + anArrayType != "triangles" && + anArrayType != "trianglefans" && + anArrayType != "trianglestrips" && + anArrayType != "quads" && + anArrayType != "quadstrips" && + anArrayType != "polygons") + { + di << "Unexpected type of primitives array\n"; + return 1; + } + + TCollection_AsciiString aCommand; + for (Standard_Integer anArgIndex = 3; anArgIndex < argc; anArgIndex++) + { + aCommand = argv[anArgIndex]; + aCommand.LowerCase(); + if (!aCommand.IsAscii()) + { + di << "Unexpected argument: #" << aArgIndex - 1 << " , " + << "should be an array element: 'v', 'b', 'e' \n"; + break; + } + + if (aCommand == "v") + { + hasVertex = Standard_True; + } + + anArgsArray->SetValue (anArgIndex - 2, aCommand); + } + + if (!hasVertex) + { + di << "You should pass any verticies in the list of array elements\n"; + return 1; + } + + Handle(Graphic3d_AspectMarker3d) anAspPoints; + if (anArrayType == "points") + { + anAspPoints = new Graphic3d_AspectMarker3d (Aspect_TOM_POINT, Quantity_NOC_YELLOW, 1.0f); } // create primitives array object - Handle(MyPArrayObject) aPObject = new MyPArrayObject (anArray, anAspPoints); + Handle(MyPArrayObject) aPObject = new MyPArrayObject (anArgsArray, anAspPoints); // register the object in map VDisplayAISObject (aName, aPObject); @@ -4440,6 +4493,105 @@ static Standard_Integer VShowFaceBoundary (Draw_Interpretor& /*di*/, return 0; } +// This class is used for testing markers. +DEFINE_STANDARD_HANDLE(ViewerTest_MarkersArrayObject, AIS_InteractiveObject) +class ViewerTest_MarkersArrayObject : public AIS_InteractiveObject +{ + +public: + + ViewerTest_MarkersArrayObject (const gp_XYZ& theStartPoint, + const Standard_Integer& thePointsOnSide, + Handle(Graphic3d_AspectMarker3d) theMarkerAspect = NULL) + { + myStartPoint = theStartPoint; + myPointsOnSide = thePointsOnSide; + myMarkerAspect = theMarkerAspect; + } + + DEFINE_STANDARD_RTTI(MyPArrayObject); + +private: + + void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, + const Handle(Prs3d_Presentation)& aPresentation, + const Standard_Integer aMode); + + void ComputeSelection (const Handle(SelectMgr_Selection)& theSelection, + const Standard_Integer /*theMode*/); + +protected: + + gp_XYZ myStartPoint; + Standard_Integer myPointsOnSide; + Handle(Graphic3d_AspectMarker3d) myMarkerAspect; +}; + +IMPLEMENT_STANDARD_HANDLE(ViewerTest_MarkersArrayObject, AIS_InteractiveObject) +IMPLEMENT_STANDARD_RTTIEXT(ViewerTest_MarkersArrayObject, AIS_InteractiveObject) + +void ViewerTest_MarkersArrayObject::Compute (const Handle(PrsMgr_PresentationManager3d)& /*aPresentationManager*/, + const Handle(Prs3d_Presentation)& aPresentation, + const Standard_Integer /*aMode*/) +{ + Handle(Graphic3d_ArrayOfPrimitives) anArray = new Graphic3d_ArrayOfPoints ((Standard_Integer )Pow (myPointsOnSide, 3), myPointsOnSide != 1); + if (myPointsOnSide == 1) + { + anArray->AddVertex (myStartPoint); + } + else + { + for (Standard_Real i = 1; i <= myPointsOnSide; i++) + { + for (Standard_Real j = 1; j <= myPointsOnSide; j++) + { + for (Standard_Real k = 1; k <= myPointsOnSide; k++) + { + anArray->AddVertex (myStartPoint.X() + i, myStartPoint.Y() + j, myStartPoint.Z() + k); + anArray->SetVertexColor (anArray->VertexNumber(), + i / myPointsOnSide, + j / myPointsOnSide, + k / myPointsOnSide); + } + } + } + } + + aPresentation->Clear(); + if (!myMarkerAspect.IsNull()) + { + Prs3d_Root::CurrentGroup (aPresentation)->SetGroupPrimitivesAspect (myMarkerAspect); + } + Prs3d_Root::CurrentGroup (aPresentation)->AddPrimitiveArray (anArray); +} + +void ViewerTest_MarkersArrayObject::ComputeSelection (const Handle(SelectMgr_Selection)& theSelection, + const Standard_Integer /*theMode*/) +{ + Handle(SelectMgr_EntityOwner) anEntityOwner = new SelectMgr_EntityOwner (this); + + if (myPointsOnSide == 1) + { + gp_Pnt aPoint (myStartPoint); + Handle(Select3D_SensitivePoint) aSensetivePoint = new Select3D_SensitivePoint (anEntityOwner, aPoint); + theSelection->Add (aSensetivePoint); + } + else + { + for (Standard_Real i = 1; i <= myPointsOnSide; i++) + { + for (Standard_Real j = 1; j <= myPointsOnSide; j++) + { + for (Standard_Real k = 1; k <= myPointsOnSide; k++) + { + gp_Pnt aPoint (myStartPoint.X() + i, myStartPoint.Y() + j, myStartPoint.Z() + k); + Handle(Select3D_SensitivePoint) aSensetivePoint = new Select3D_SensitivePoint (anEntityOwner, aPoint); + theSelection->Add (aSensetivePoint); + } + } + } + } +} //======================================================================= //function : VMarkersTest //purpose : Draws an array of markers for testing purposes. @@ -4519,31 +4671,8 @@ static Standard_Integer VMarkersTest (Draw_Interpretor&, anAspect = new Graphic3d_AspectMarker3d (aMarkerType >= 0 ? (Aspect_TypeOfMarker )aMarkerType : Aspect_TOM_POINT, aColor, aScale); } - Handle(Graphic3d_ArrayOfPrimitives) anArray = new Graphic3d_ArrayOfPoints ((Standard_Integer )Pow (aPointsOnSide, 3), aPointsOnSide != 1); - if (aPointsOnSide == 1) - { - anArray->AddVertex (aPnt); - } - else - { - for (Standard_Real i = 1; i <= aPointsOnSide; i++) - { - for (Standard_Real j = 1; j <= aPointsOnSide; j++) - { - for (Standard_Real k = 1; k <= aPointsOnSide; k++) - { - anArray->AddVertex (aPnt.X() + i, aPnt.Y() + j, aPnt.Z() + k); - anArray->SetVertexColor (anArray->VertexNumber(), - i / aPointsOnSide, - j / aPointsOnSide, - k / aPointsOnSide); - } - } - } - } - - Handle(MyPArrayObject) aPObject = new MyPArrayObject (anArray, anAspect); - VDisplayAISObject (aName, aPObject); + Handle(ViewerTest_MarkersArrayObject) aMarkersArray = new ViewerTest_MarkersArrayObject (aPnt, aPointsOnSide, anAspect); + VDisplayAISObject (aName, aMarkersArray); return 0; } diff --git a/src/ViewerTest/ViewerTest_ViewerCommands.cxx b/src/ViewerTest/ViewerTest_ViewerCommands.cxx index 58b45b3a51..2f672db784 100755 --- a/src/ViewerTest/ViewerTest_ViewerCommands.cxx +++ b/src/ViewerTest/ViewerTest_ViewerCommands.cxx @@ -601,7 +601,7 @@ TCollection_AsciiString ViewerTest::ViewerInit (const Standard_Integer thePxLeft } // Create viewer - Handle(V3d_Viewer) a3DViewer, a3DCollector; + Handle(V3d_Viewer) a3DViewer; // If it's the single view, we first look for empty context if (ViewerTest_myViews.IsEmpty() && !ViewerTest_myContexts.IsEmpty()) { @@ -610,25 +610,21 @@ TCollection_AsciiString ViewerTest::ViewerInit (const Standard_Integer thePxLeft if (anIter.More()) ViewerTest::SetAISContext (anIter.Value()); a3DViewer = ViewerTest::GetAISContext()->CurrentViewer(); - a3DCollector= ViewerTest::GetAISContext()->Collector(); } else if (ViewerTest_myContexts.IsBound1(aViewNames.GetViewerName())) { ViewerTest::SetAISContext(ViewerTest_myContexts.Find1(aViewNames.GetViewerName())); a3DViewer = ViewerTest::GetAISContext()->CurrentViewer(); - a3DCollector= ViewerTest::GetAISContext()->Collector(); } - else if (a3DViewer.IsNull() || a3DCollector.IsNull()) + else if (a3DViewer.IsNull()) { toCreateViewer = Standard_True; TCollection_ExtendedString NameOfWindow("Viewer3D"); a3DViewer = new V3d_Viewer(aGraphicDriver, NameOfWindow.ToExtString()); NameOfWindow = TCollection_ExtendedString("Collector"); - a3DCollector = new V3d_Viewer(aGraphicDriver, NameOfWindow.ToExtString()); a3DViewer->SetDefaultBackgroundColor(Quantity_NOC_BLACK); - a3DCollector->SetDefaultBackgroundColor(Quantity_NOC_STEELBLUE); } // AIS context setup @@ -636,7 +632,7 @@ TCollection_AsciiString ViewerTest::ViewerInit (const Standard_Integer thePxLeft !(ViewerTest_myContexts.IsBound1(aViewNames.GetViewerName()))) { Handle(AIS_InteractiveContext) aContext = - new AIS_InteractiveContext(a3DViewer, a3DCollector); + new AIS_InteractiveContext(a3DViewer); ViewerTest::SetAISContext (aContext); ViewerTest_myContexts.Bind (aViewNames.GetViewerName(), ViewerTest::GetAISContext()); } @@ -707,7 +703,6 @@ TCollection_AsciiString ViewerTest::ViewerInit (const Standard_Integer thePxLeft aView.Nullify(); a3DViewer.Nullify(); - a3DCollector.Nullify(); return aViewNames.GetViewName(); } @@ -4526,16 +4521,11 @@ static Standard_Integer VPurgeDisplay (Draw_Interpretor& di, Standard_Integer argc, const char ** argv) { - if (argc > 2) + if (argc > 1) { - di << "Usage : " << argv[0] << " [CollectorToo = 0|1]" << "\n"; + di << "Usage : " << argv[0] << "\n"; return 1; } - Standard_Boolean isCollectorToo = Standard_False; - if (argc == 2) - { - isCollectorToo = (atoi(argv [1]) != 0); - } Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext(); if (aContext.IsNull()) { @@ -4543,7 +4533,7 @@ static Standard_Integer VPurgeDisplay (Draw_Interpretor& di, return 1; } aContext->CloseAllContexts(Standard_False); - di << aContext->PurgeDisplay(isCollectorToo) << "\n"; + di << aContext->PurgeDisplay() << "\n"; return 0; } @@ -5451,7 +5441,7 @@ void ViewerTest::ViewerCommands(Draw_Interpretor& theCommands) "vantialiasing 1|0", __FILE__,VAntialiasing,group); theCommands.Add ("vpurgedisplay", - "vpurgedisplay [CollectorToo = 0|1]" + "vpurgedisplay" "- removes structures which don't belong to objects displayed in neutral point", __FILE__, VPurgeDisplay, group); theCommands.Add("vsetviewsize", diff --git a/src/Visual3d/Visual3d_View.cxx b/src/Visual3d/Visual3d_View.cxx index 960f7f723b..a39d89b90a 100755 --- a/src/Visual3d/Visual3d_View.cxx +++ b/src/Visual3d/Visual3d_View.cxx @@ -1777,6 +1777,12 @@ void Visual3d_View::Update (const Handle(Visual3d_Layer)& AnUnderLayer, const Ha if (! MyWindow->IsMapped ()) return; + if (MyGraphicDriver->IsDeviceLost()) + { + MyViewManager->ReComputeStructures(); + MyGraphicDriver->ResetDeviceLostFlag(); + } + // If activation/desactivation of ZBuffer should be automatic // depending on the presence or absence of facets. if (MyViewManager->ZBufferAuto ()) { @@ -1999,41 +2005,14 @@ void Visual3d_View::Display (const Handle(Graphic3d_Structure)& AStructure, cons Standard_Integer Index = IsComputed (AStructure); if ((Index != 0) && (AStructure->Visual () != Graphic3d_TOS_COMPUTED)) { - -#ifdef TRACE_LENGTH - if (MyTOCOMPUTESequence.Length () != MyCOMPUTEDSequence.Length ()) { - cout << "In Visual3d_View::Display, "; - cout << "TOCOMPUTE " << MyTOCOMPUTESequence.Length () - << " != COMPUTED " << MyCOMPUTEDSequence.Length () - << "\n" << flush; - } -#endif MyTOCOMPUTESequence.Remove (Index); MyCOMPUTEDSequence.Remove (Index); - -#ifdef TRACE_LENGTH - if (MyTOCOMPUTESequence.Length () != MyCOMPUTEDSequence.Length ()) - cout << "\tTOCOMPUTE " << MyTOCOMPUTESequence.Length () - << " != COMPUTED " << MyCOMPUTEDSequence.Length () - << "\n" << flush; -#endif Index = 0; } Visual3d_TypeOfAnswer Answer = AcceptDisplay (AStructure); -#ifdef TRACE_DISPLAY - Standard_Integer StructId = AStructure->Identification (); - cout << "Visual3d_View" << MyCView.ViewId << "::Display (" - << StructId << ");\n"; - cout << flush; -#endif - if (Answer == Visual3d_TOA_NO) { -#ifdef TRACE_DISPLAY - cout << "Answer : Visual3d_TOA_NO\n"; - cout << flush; -#endif return; } @@ -2043,10 +2022,6 @@ Standard_Integer Index = IsComputed (AStructure); } if (Answer == Visual3d_TOA_YES ) { -#ifdef TRACE_DISPLAY - cout << "Answer : Visual3d_TOA_YES\n"; - cout << flush; -#endif if (IsDisplayed (AStructure)) return; MyGraphicDriver->DisplayStructure ( MyCView, @@ -2058,32 +2033,8 @@ Standard_Integer Index = IsComputed (AStructure); } if (Answer == Visual3d_TOA_COMPUTE) { -#ifdef TRACE_DISPLAY - cout << "Answer : Visual3d_TOA_COMPUTE\n"; - cout << "Index : " << Index << "\n" << flush; -#endif if (Index != 0) { // Already computed, is COMPUTED still valid? -#ifdef TRACE_DISPLAY - if (MyCOMPUTEDSequence.Value (Index)->HLRValidation ()) { - cout << "Structure " - << MyTOCOMPUTESequence.Value (Index)->Identification () - << "already calculated, in the view " - << Identification () << ", par la structure " - << MyCOMPUTEDSequence.Value (Index)->Identification () - << "\n was not recalculated as HLR is valid\n"; - cout << flush; - } - else { - cout << "Structure " - << MyTOCOMPUTESequence.Value (Index)->Identification () - << " already calculated, in the view " - << Identification () << ", by the structure " - << MyCOMPUTEDSequence.Value (Index)->Identification () - << "\n should be recalculated as HLR is invalid\n"; - cout << flush; - } -#endif Standard_Integer OldStructId = MyCOMPUTEDSequence.Value (Index)->Identification (); @@ -2175,37 +2126,16 @@ Standard_Integer ii, jj; #endif TheStructure->SetHLRValidation (Standard_True); -#ifdef TRACE_LENGTH - if (MyTOCOMPUTESequence.Length () != MyCOMPUTEDSequence.Length ()) - cout << "\tTOCOMPUTE " << MyTOCOMPUTESequence.Length () - << " != COMPUTED " << MyCOMPUTEDSequence.Length () - << "\n" << flush; -#endif - // TOCOMPUTE and COMPUTED associated to sequences are added MyTOCOMPUTESequence.Append (AStructure); MyCOMPUTEDSequence.Append (TheStructure); -#ifdef TRACE_LENGTH - if (MyTOCOMPUTESequence.Length () != MyCOMPUTEDSequence.Length ()) - cout << "\tTOCOMPUTE " << MyTOCOMPUTESequence.Length () - << " != COMPUTED " << MyCOMPUTEDSequence.Length () - << "\n" << flush; -#endif - // The previous are removed if necessary if (Index != 0) { MyTOCOMPUTESequence.Remove (Index); MyCOMPUTEDSequence.Remove (Index); } -#ifdef TRACE_LENGTH - if (MyTOCOMPUTESequence.Length () != MyCOMPUTEDSequence.Length ()) - cout << "\tTOCOMPUTE " << MyTOCOMPUTESequence.Length () - << " != COMPUTED " << MyCOMPUTEDSequence.Length () - << "\n" << flush; -#endif - // Return type of visualisation of the view Visual3d_TypeOfVisualization ViewType = MyContext.Visualization (); @@ -2231,18 +2161,6 @@ Standard_Boolean ComputeShading = ((ViewType == Visual3d_TOV_SHADING) && TheStructure->GraphicHighlight (Aspect_TOHM_COLOR); } -#ifdef TRACE_DISPLAY - cout << "Structure " << StructId - << " in the view " << Identification () - << " is calculated by the structure " - << TheStructure->Identification (); - if (Answer == Visual3d_TOA_YES) - cout << " and displayed\n"; - else - cout << " but not displayed\n"; - cout << flush; -#endif - // It is displayed only if the calculated structure // has a proper type corresponding to the one of the view. if (Answer != Visual3d_TOA_NO) { @@ -2533,6 +2451,11 @@ void Visual3d_View::MinMaxValues (const Graphic3d_MapOfStructure& ASet, Standard Iterator.More (); Iterator.Next ()) { + if (!Iterator.Key()->IsVisible()) + { + continue; + } + if ( (Iterator.Key ())->IsInfinite ()){ //XMin, YMin .... ZMax are initialized by means of infinite line data (Iterator.Key ())->MinMaxValues (Xm, Ym, Zm, XM, YM, ZM); diff --git a/src/Visual3d/Visual3d_ViewManager.cxx b/src/Visual3d/Visual3d_ViewManager.cxx index 409ddb641c..6ffaf78fcc 100755 --- a/src/Visual3d/Visual3d_ViewManager.cxx +++ b/src/Visual3d/Visual3d_ViewManager.cxx @@ -141,7 +141,6 @@ void Visual3d_ViewManager::Remove () { // clear all structures whilst views are alive for correct GPU memory management MyDisplayedStructure.Clear(); MyHighlightedStructure.Clear(); - MyVisibleStructure.Clear(); MyPickStructure.Clear(); // clear list of managed views @@ -317,7 +316,6 @@ void Visual3d_ViewManager::Erase (const Handle(Graphic3d_Structure)& AStructure) } MyHighlightedStructure.Remove (AStructure); - MyVisibleStructure.Remove (AStructure); MyPickStructure.Remove (AStructure); } diff --git a/tests/bugs/vis/bug2066 b/tests/bugs/vis/bug2066 index 1c7ddc1c5d..8eead3f8e2 100755 --- a/tests/bugs/vis/bug2066 +++ b/tests/bugs/vis/bug2066 @@ -12,9 +12,8 @@ vinit vdisplay b b2 vfit verase b -set CollectorToo 1 -if [catch {vpurgedisplay $CollectorToo} result] { +if [catch {vpurgedisplay} result] { puts "Faulty OCC2066" } else { puts "OK OCC2066" diff --git a/tests/bugs/vis/bug23654_MarkersRecompute b/tests/bugs/vis/bug23654_MarkersRecompute new file mode 100644 index 0000000000..a95490ece9 --- /dev/null +++ b/tests/bugs/vis/bug23654_MarkersRecompute @@ -0,0 +1,83 @@ +puts "========" +puts "OCC23654 Markers recompute" +puts "========" + +# reflects Aspect_TypeOfMarker enumeration +set aMarkerTypeNames { + Aspect_TOM_POINT + Aspect_TOM_PLUS + Aspect_TOM_STAR + Aspect_TOM_X + Aspect_TOM_O + Aspect_TOM_O_POINT + Aspect_TOM_O_PLUS + Aspect_TOM_O_STAR + Aspect_TOM_O_X + Aspect_TOM_RING1 + Aspect_TOM_RING2 + Aspect_TOM_RING3 + Aspect_TOM_BALL + Aspect_TOM_USERDEFINED +} + +# generate custom marker +set aCustom1 $imagedir/${casename}_m1.png +set aCustom2 $imagedir/${casename}_m2.png +box b 1 1 1 +vinit name=Driver1/Viewer1/View1 l=32 t=32 w=512 h=512 +vclear +vdisplay b +vaxo +vfit +vdump $aCustom1 rgba 32 32 +vsetdispmode b 1 +vsetcolor b RED +vrotate 1 0 0 +vdump $aCustom2 rgba 32 32 + +# draw box in advance which should fit all our markers +box b -8 -8 0 16 16 2 + +vcaps sprites=1 +set aV "Driver1/Viewer1/View1" +vinit name=$aV l=32 t=32 w=512 h=512 +vactivate $aV +vclear + +vbottom +vdisplay b +vfit +verase b + +for { set aMarkerType 0 } { $aMarkerType <= 13 } { incr aMarkerType } { + set aRow [expr $aMarkerType - 7] + set aCol 5 + set aName [lindex $aMarkerTypeNames $aMarkerType] + vdrawtext "$aName" 0 [expr $aRow + 0.5] 0 128 255 255 1 1 000 0 12 2 Arial + if { $aMarkerType == 13 } { + vmarkerstest m${aMarkerType}_${aCol} $aCol $aRow 0 PointsOnSide=1 FileName=$aCustom1 + set aCol [expr $aCol - 1] + vmarkerstest m${aMarkerType}_${aCol} $aCol $aRow 0 PointsOnSide=1 FileName=$aCustom2 + } else { + for { set aMarkerScale 1.0 } { $aMarkerScale <= 7 } { set aMarkerScale [expr $aMarkerScale + 0.5] } { + vmarkerstest m${aMarkerType}_${aCol} $aCol $aRow 0 MarkerType=$aMarkerType Scale=$aMarkerScale PointsOnSide=1 + set aCol [expr $aCol - 1] + } + } +} + +set anImage1 $imagedir/${casename}_1.png +set anImage2 $imagedir/${casename}_2.png + +vdump $anImage1 + +vclose $aV 1 + +vinit name=$aV l=32 t=32 w=512 h=512 +vactivate $aV +vbottom +vdisplay b +vfit +verase b + +vdump $anImage2 \ No newline at end of file -- 2.39.5