1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-10 18:51:21 +03:00

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
This commit is contained in:
dbv 2013-10-03 14:11:13 +04:00 committed by bugmaster
parent 3ed30348aa
commit eb4320f2d9
45 changed files with 826 additions and 1256 deletions

View File

@ -18,7 +18,7 @@ void GeomSources::PreProcess(CGeometryDoc* aDoc,DisplayType aDisplayType)
{ {
if (aDisplayType == No2D3D ) if (aDisplayType == No2D3D )
{ {
aDoc->GetAISContext()->EraseAll(Standard_False); aDoc->GetAISContext()->EraseAll();
aDoc->Put3DOnTop(); aDoc->Put3DOnTop();
} }
@ -40,7 +40,7 @@ void GeomSources::PreProcess(CGeometryDoc* aDoc,DisplayType aDisplayType)
if (aDisplayType == a2D3D) if (aDisplayType == a2D3D)
{ {
aDoc->GetAISContext()->EraseAll(Standard_False); aDoc->GetAISContext()->EraseAll();
aDoc->GetISessionContext()->EraseAll(); aDoc->GetISessionContext()->EraseAll();
aDoc->Put3DOnTop(false); aDoc->Put3DOnTop(false);
aDoc->Put2DOnTop(false); aDoc->Put2DOnTop(false);

View File

@ -1106,8 +1106,8 @@ Sleep(1000);
TopoDS_Shape ShapeCut = BRepAlgoAPI_Cut(theSphere,theBox); TopoDS_Shape ShapeCut = BRepAlgoAPI_Cut(theSphere,theBox);
myAISContext->Erase(ais1,Standard_False,Standard_False); myAISContext->Erase(ais1,Standard_False);
myAISContext->Erase(ais2,Standard_False,Standard_False); myAISContext->Erase(ais2,Standard_False);
Handle (AIS_Shape) aSection = new AIS_Shape(ShapeCut); Handle (AIS_Shape) aSection = new AIS_Shape(ShapeCut);
myAISContext->SetDisplayMode(aSection,1,Standard_False); myAISContext->SetDisplayMode(aSection,1,Standard_False);
@ -1169,8 +1169,8 @@ Sleep(1000);
TopoDS_Shape FusedShape = BRepAlgoAPI_Fuse(theBox1,theBox2); TopoDS_Shape FusedShape = BRepAlgoAPI_Fuse(theBox1,theBox2);
myAISContext->Erase(ais1,Standard_True,Standard_False); myAISContext->Erase(ais1,Standard_True);
myAISContext->Erase(ais2,Standard_True,Standard_False); myAISContext->Erase(ais2,Standard_True);
Handle (AIS_Shape) aFusion = new AIS_Shape(FusedShape); Handle (AIS_Shape) aFusion = new AIS_Shape(FusedShape);
myAISContext->SetDisplayMode(aFusion,1,Standard_False); myAISContext->SetDisplayMode(aFusion,1,Standard_False);
@ -1226,8 +1226,8 @@ Sleep(500);
TopoDS_Shape theCommonSurface = BRepAlgoAPI_Common(theBox,theWedge); TopoDS_Shape theCommonSurface = BRepAlgoAPI_Common(theBox,theWedge);
myAISContext->Erase(aboxshape,Standard_True,Standard_False); myAISContext->Erase(aboxshape,Standard_True);
myAISContext->Erase(awedge,Standard_True,Standard_False); myAISContext->Erase(awedge,Standard_True);
Handle(AIS_Shape) acommon = new AIS_Shape(theCommonSurface); Handle(AIS_Shape) acommon = new AIS_Shape(theCommonSurface);
myAISContext->SetColor(acommon,Quantity_NOC_GREEN,Standard_False); myAISContext->SetColor(acommon,Quantity_NOC_GREEN,Standard_False);
@ -1717,7 +1717,7 @@ myAISContext->SetCurrentObject(aBlendedBox,Standard_False);
Fit(); Fit();
Sleep(500); Sleep(500);
myAISContext->Erase(ais1,Standard_True,Standard_False); myAISContext->Erase(ais1,Standard_True);
TCollection_AsciiString Message ("\ TCollection_AsciiString Message ("\
\n\ \n\
@ -2137,7 +2137,7 @@ void CModelingDoc::OnGlueLocal()
BRepFeat_Gluer glue(S2,S1); BRepFeat_Gluer glue(S2,S1);
glue.Bind(F2,F1); glue.Bind(F2,F1);
TopoDS_Shape res1 = glue.Shape(); TopoDS_Shape res1 = glue.Shape();
myAISContext->Erase(ais2,Standard_False,Standard_False); myAISContext->Erase(ais2,Standard_False);
ais1->Set(res1); ais1->Set(res1);
@ -2187,7 +2187,7 @@ void CModelingDoc::OnGlueLocal()
for (CommonEdges.InitIterator(); CommonEdges.More(); CommonEdges.Next()) for (CommonEdges.InitIterator(); CommonEdges.More(); CommonEdges.Next())
glue2.Bind(CommonEdges.EdgeFrom(),CommonEdges.EdgeTo()); glue2.Bind(CommonEdges.EdgeFrom(),CommonEdges.EdgeTo());
TopoDS_Shape res2 = glue2.Shape(); TopoDS_Shape res2 = glue2.Shape();
myAISContext->Erase(ais3,Standard_False,Standard_False); myAISContext->Erase(ais3,Standard_False);
ais4->Set(res2); ais4->Set(res2);
@ -2484,7 +2484,7 @@ void CModelingDoc::OnSplitLocal()
asplit.Build(); asplit.Build();
//Sleep(1000); //Sleep(1000);
myAISContext->Erase(ais1,Standard_False,Standard_False); myAISContext->Erase(ais1,Standard_False);
//Fit(); //Fit();
TopoDS_Shape Result = asplit.Shape(); TopoDS_Shape Result = asplit.Shape();
@ -2565,7 +2565,7 @@ void CModelingDoc::OnThickLocal()
Fit(); Fit();
Sleep(1000); Sleep(1000);
myAISContext->Erase(abox1,Standard_True,Standard_False); myAISContext->Erase(abox1,Standard_True);
Fit(); Fit();

View File

@ -985,7 +985,7 @@ BOOL CViewer3dDoc::OnNewDocument()
// (SDI documents will reuse this document) // (SDI documents will reuse this document)
SetTitle(myPresentation->GetName()); SetTitle(myPresentation->GetName());
myAISContext->EraseAll(Standard_False); myAISContext->EraseAll();
myAISContext->SetDisplayMode(AIS_Shaded); myAISContext->SetDisplayMode(AIS_Shaded);
POSITION pos = GetFirstViewPosition(); POSITION pos = GetFirstViewPosition();
@ -1046,14 +1046,14 @@ void CViewer3dDoc::DoSample()
void CViewer3dDoc::OnBUTTONStart() void CViewer3dDoc::OnBUTTONStart()
{ {
myAISContext->EraseAll(Standard_False); myAISContext->EraseAll();
myPresentation->FirstSample(); myPresentation->FirstSample();
DoSample(); DoSample();
} }
void CViewer3dDoc::OnBUTTONEnd() void CViewer3dDoc::OnBUTTONEnd()
{ {
myAISContext->EraseAll(Standard_False); myAISContext->EraseAll();
myPresentation->LastSample(); myPresentation->LastSample();
DoSample(); DoSample();
} }

View File

@ -360,14 +360,14 @@ void CTriangulationDoc::DoSample()
void CTriangulationDoc::OnBUTTONStart() void CTriangulationDoc::OnBUTTONStart()
{ {
myAISContext->EraseAll(Standard_False); myAISContext->EraseAll();
myPresentation->FirstSample(); myPresentation->FirstSample();
DoSample(); DoSample();
} }
void CTriangulationDoc::OnBUTTONEnd() void CTriangulationDoc::OnBUTTONEnd()
{ {
myAISContext->EraseAll(Standard_False); myAISContext->EraseAll();
myPresentation->LastSample(); myPresentation->LastSample();
DoSample(); DoSample();
} }

View File

@ -166,7 +166,7 @@ void CSelectionDialog::OnGetShape()
UpdateProjector(); UpdateProjector();
myDisplayableShape->SetNbIsos(m_NbIsos); myDisplayableShape->SetNbIsos(m_NbIsos);
myInteractiveContext->EraseAll(Standard_False); myInteractiveContext->EraseAll();
myInteractiveContext->Display(myTrihedron); myInteractiveContext->Display(myTrihedron);
Standard_Boolean OneOrMoreFound = Standard_False; Standard_Boolean OneOrMoreFound = Standard_False;

View File

@ -73,7 +73,7 @@ BOOL COCCDemoDoc::OnNewDocument()
// (SDI documents will reuse this document) // (SDI documents will reuse this document)
SetTitle(myPresentation->GetName()); SetTitle(myPresentation->GetName());
myAISContext->EraseAll(Standard_False); myAISContext->EraseAll();
myAISContext->SetDisplayMode(AIS_Shaded); myAISContext->SetDisplayMode(AIS_Shaded);
POSITION pos = GetFirstViewPosition(); POSITION pos = GetFirstViewPosition();
@ -164,14 +164,14 @@ void COCCDemoDoc::DoSample()
void COCCDemoDoc::OnBUTTONStart() void COCCDemoDoc::OnBUTTONStart()
{ {
myAISContext->EraseAll(Standard_False); myAISContext->EraseAll();
myPresentation->FirstSample(); myPresentation->FirstSample();
DoSample(); DoSample();
} }
void COCCDemoDoc::OnBUTTONEnd() void COCCDemoDoc::OnBUTTONEnd()
{ {
myAISContext->EraseAll(Standard_False); myAISContext->EraseAll();
myPresentation->LastSample(); myPresentation->LastSample();
DoSample(); DoSample();
} }

View File

@ -260,7 +260,7 @@ void OCC_3dBaseDoc::OnUpdateObjectColor(CCmdUI* pCmdUI)
void OCC_3dBaseDoc::OnObjectErase() void OCC_3dBaseDoc::OnObjectErase()
{ {
for(myAISContext->InitCurrent();myAISContext->MoreCurrent();myAISContext->NextCurrent()) for(myAISContext->InitCurrent();myAISContext->MoreCurrent();myAISContext->NextCurrent())
myAISContext->Erase(myAISContext->Current(),Standard_True,Standard_False); myAISContext->Erase(myAISContext->Current(),Standard_True);
myAISContext->ClearCurrents(); myAISContext->ClearCurrents();
} }
void OCC_3dBaseDoc::OnUpdateObjectErase(CCmdUI* pCmdUI) void OCC_3dBaseDoc::OnUpdateObjectErase(CCmdUI* pCmdUI)
@ -363,7 +363,7 @@ void OCC_3dBaseDoc::OnUpdateObjectTransparency(CCmdUI* pCmdUI)
void OCC_3dBaseDoc::OnObjectDisplayall() void OCC_3dBaseDoc::OnObjectDisplayall()
{ {
myAISContext->DisplayAll(Standard_False); myAISContext->DisplayAll();
} }
void OCC_3dBaseDoc::OnUpdateObjectDisplayall(CCmdUI* pCmdUI) void OCC_3dBaseDoc::OnUpdateObjectDisplayall(CCmdUI* pCmdUI)

View File

@ -50,7 +50,7 @@ void Sample2D_Markers::Compute ( const Handle(PrsMgr_PresentationManager3d)& aP
else else
{ {
Handle(Graphic3d_AspectMarker3d) aMarker = new Graphic3d_AspectMarker3d(myMarkerType,myColor,myIndex); 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); Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints = new Graphic3d_ArrayOfPoints (1);
anArrayOfPoints->AddVertex (myXPosition, myYPosition, 0); anArrayOfPoints->AddVertex (myXPosition, myYPosition, 0);
Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray (anArrayOfPoints); Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray (anArrayOfPoints);

View File

@ -223,7 +223,7 @@ void DocumentCommon::onTransparency()
void DocumentCommon::onDelete() void DocumentCommon::onDelete()
{ {
for ( myContext->InitCurrent(); myContext->MoreCurrent(); myContext->NextCurrent() ) for ( myContext->InitCurrent(); myContext->MoreCurrent(); myContext->NextCurrent() )
myContext->Erase( myContext->Current(), false, true ); myContext->Erase( myContext->Current(), false);
myContext->ClearSelected(); myContext->ClearSelected();
getApplication()->onSelectionChanged(); getApplication()->onSelectionChanged();
} }

View File

@ -404,7 +404,7 @@ void Application::open()
} }
// Display the voxels // Display the voxels
myViewer->getIC()->EraseAll(false, false); myViewer->getIC()->EraseAll(false);
Voxel_DS* ds = myBoolVoxels; Voxel_DS* ds = myBoolVoxels;
if (!ds) if (!ds)
ds = myColorVoxels; ds = myColorVoxels;
@ -848,7 +848,7 @@ void Application::testROctBoolDS()
// Display // Display
myViewer->getIC()->EraseAll(false, false); myViewer->getIC()->EraseAll(false);
initPrs(); initPrs();
myVoxels->SetBoolVoxels(0); myVoxels->SetBoolVoxels(0);
myVoxels->SetColorVoxels(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; Voxel_DS* ds = myBoolVoxels;
if (!ds) if (!ds)
@ -1757,7 +1757,7 @@ void Application::displayColorScale()
void Application::displayWaves() void Application::displayWaves()
{ {
myViewer->getIC()->EraseAll(false, false); myViewer->getIC()->EraseAll(false);
// Make voxels // Make voxels
if (myBoolVoxels) if (myBoolVoxels)
@ -1902,7 +1902,7 @@ void Application::sphere()
void Application::load(const TopoDS_Shape& S) void Application::load(const TopoDS_Shape& S)
{ {
myViewer->getIC()->EraseAll(false, false); myViewer->getIC()->EraseAll(false);
// Delete voxels of previous shape. // Delete voxels of previous shape.
if (myBoolVoxels) if (myBoolVoxels)
@ -1948,7 +1948,7 @@ void Application::load(const TopoDS_Shape& S)
void Application::displayCut() void Application::displayCut()
{ {
myViewer->getIC()->EraseAll(false, false); myViewer->getIC()->EraseAll(false);
// Make a sphere with a lot of toruses, // Make a sphere with a lot of toruses,
// cut the toruses from the sphere. // cut the toruses from the sphere.
@ -2043,7 +2043,7 @@ void Application::displayCut()
void Application::displayCollisions() void Application::displayCollisions()
{ {
myViewer->getIC()->EraseAll(false, false); myViewer->getIC()->EraseAll(false);
// Make a big box with a lot of small spheres inside. // 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; double x = 0.0, y = 0.0, z = 0.0, xlen = 100.0, ylen = 100.0, zlen = 100.0, r = 10.0;

View File

@ -189,7 +189,6 @@ is
enumeration DisplayStatus is enumeration DisplayStatus is
DS_Displayed, DS_Displayed,
DS_Erased, DS_Erased,
DS_FullErased,
DS_Temporary, DS_Temporary,
DS_None; DS_None;
---Purpose: ---Purpose:

View File

@ -151,25 +151,9 @@ is
---Purpose: ---Purpose:
-- Constructs the interactive context object defined by -- Constructs the interactive context object defined by
-- the principal viewer MainViewer. -- 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; Delete(me) is redefined;
IsCollectorClosed(me) returns Boolean from Standard;
---C++: inline
CloseCollector(me:mutable);
---C++: inline
OpenCollector(me:mutable);
---Category: General DISPLAY SERVICES ---Category: General DISPLAY SERVICES
SetAutoActivateSelection( me: mutable; Auto : Boolean from Standard ); SetAutoActivateSelection( me: mutable; Auto : Boolean from Standard );
GetAutoActivateSelection( me ) returns Boolean from Standard; GetAutoActivateSelection( me ) returns Boolean from Standard;
@ -242,70 +226,27 @@ is
Erase(me : mutable; Erase(me : mutable;
aniobj : InteractiveObject from AIS; aniobj : InteractiveObject from AIS;
updateviewer : Boolean from Standard = Standard_True; updateviewer : Boolean from Standard = Standard_True);
PutInCollector : Boolean from Standard = Standard_False); ---Purpose: Hides the object. The object's presentations are simply
---Purpose: To erase presentations in current local context, or -- flagged as invisible and therefore excluded from redrawing.
-- failing that, in other local contexts which allow erasing. -- To show hidden objects, use Display().
--
-- 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; EraseAll (me : mutable;
aniobj : InteractiveObject from AIS; updateviewer: Boolean from Standard = Standard_True);
aMode : Integer from Standard; ---Purpose: Hides all objects. The object's presentations are simply
updateviewer : Boolean from Standard = Standard_True); -- flagged as invisible and therefore excluded from redrawing.
---Purpose: Updates viewer contents and returns the display -- To show all hidden objects, use DisplayAll().
-- 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.
DisplayAll(me : mutable;
updateviewer: Boolean from Standard = Standard_True);
---Purpose: Displays all hidden objects.
EraseSelected(me: mutable;
EraseAll(me:mutable; updateviewer: Boolean from Standard = Standard_True);
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);
---Purpose: ---Purpose:
-- Erases selected objects if there is no open active local context. -- Hides selected objects. The object's presentations are simply
-- If there is no local context activated and if -- flagged as invisible and therefore excluded from redrawing.
-- updateviewer equals Standard_False, the -- To show hidden objects, use Display().
-- 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.
DisplaySelected(me:mutable;updateviewer:Boolean from Standard = Standard_True); DisplaySelected(me:mutable;updateviewer:Boolean from Standard = Standard_True);
---Purpose: Displays selected objects if a local context is open. ---Purpose: Displays selected objects if a local context is open.
@ -800,8 +741,7 @@ is
---Purpose: Returns the display status of the entity anIobj. ---Purpose: Returns the display status of the entity anIobj.
-- This will be one of the following: -- This will be one of the following:
-- - DS_Displayed displayed in main viewer -- - DS_Displayed displayed in main viewer
-- - DS_Erased erased in the Collector -- - DS_Erased hidden in main viewer
-- - DS_FullErased erased everywhere but in the Collector
-- - DS_Temporary temporarily displayed -- - DS_Temporary temporarily displayed
-- - DS_None nowhere displayed. -- - DS_None nowhere displayed.
@ -831,17 +771,12 @@ is
-- <WithColor> will be returned TRUE -- <WithColor> will be returned TRUE
-- <theHiCol> gives the name of the hilightcolor -- <theHiCol> 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) DisplayPriority(me;anIobj: InteractiveObject from AIS)
returns Integer from Standard; returns Integer from Standard;
---Purpose: ---Purpose:
-- Returns the display priority of the entity anIobj. This -- Returns the display priority of the entity anIobj. This
-- will be display mode of anIobj if it is in the main -- 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) HasColor(me; aniobj: InteractiveObject from AIS)
returns Boolean from Standard; returns Boolean from Standard;
@ -875,11 +810,6 @@ is
-- are called current objects; those selected in open -- are called current objects; those selected in open
-- local context, selected objects. -- local context, selected objects.
UpdateCollector(me:mutable);
---Purpose: Updates the Collector viewer.
---Category: General Attributes for the session ---Category: General Attributes for the session
DisplayMode(me) returns Integer from Standard; DisplayMode(me) returns Integer from Standard;
@ -1161,7 +1091,7 @@ is
-- is changed. -- is changed.
-- When <globalChange> is FALSE , only the current group -- When <globalChange> is FALSE , only the current group
-- of the object presentation is changed. -- of the object presentation is changed.
-- Updates the viewer or collector when <updateViewer> is TRUE -- Updates the viewer when <updateViewer> is TRUE
---Category: Graphic attributes management ---Category: Graphic attributes management
---Category: GRAPHIC DETECTION / SELECTION ---Category: GRAPHIC DETECTION / SELECTION
@ -1963,30 +1893,9 @@ is
-- by Default, <WhichSignature> = -1 means -- by Default, <WhichSignature> = -1 means
-- control only on <WhichKind>. -- control only on <WhichKind>.
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, <WhichSignature> = -1 means
-- control only on <WhichKind>.
ErasedObjects (me;theListOfIO : in out ListOfInteractive from AIS); ErasedObjects (me;theListOfIO : in out ListOfInteractive from AIS);
---Purpose: ---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. -- particular Type WhichKind and Signature WhichSignature.
-- By Default, WhichSignature equals 1. This means -- By Default, WhichSignature equals 1. This means
-- that there is a check on type only. -- that there is a check on type only.
@ -1995,7 +1904,7 @@ is
WhichKind :KindOfInteractive from AIS; WhichKind :KindOfInteractive from AIS;
WhichSignature :Integer from Standard; WhichSignature :Integer from Standard;
theListOfIO : in out ListOfInteractive from AIS); 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 -- Type and signature
-- by Default, <WhichSignature> = -1 means -- by Default, <WhichSignature> = -1 means
-- control only on <WhichKind>. -- control only on <WhichKind>.
@ -2054,9 +1963,7 @@ is
DomainOfMainViewer(me) returns CString from Standard; DomainOfMainViewer(me) returns CString from Standard;
---Purpose: Returns the domain name of the main viewer. ---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
---Category: Internal ---Category: Internal
@ -2078,24 +1985,13 @@ is
MainPrsMgr (me) returns any PresentationManager3d from PrsMgr; MainPrsMgr (me) returns any PresentationManager3d from PrsMgr;
---C++: inline ---C++: inline
---C++: return const & ---C++: return const &
CollectorPrsMgr(me) returns any PresentationManager3d from PrsMgr;
---C++: inline
---C++: return const &
MainSelector(me) returns any ViewerSelector3d from StdSelect; MainSelector(me) returns any ViewerSelector3d from StdSelect;
---C++: inline ---C++: inline
---C++: return const & ---C++: return const &
LocalSelector(me) returns any ViewerSelector3d from StdSelect; LocalSelector(me) returns any ViewerSelector3d from StdSelect;
PurgeDisplay(me:mutable)
CollectorSelector(me) returns any ViewerSelector3d from StdSelect;
---C++: inline
---C++: return const &
PurgeDisplay(me:mutable;CollectorToo:Boolean from Standard = Standard_False)
returns Integer from Standard; returns Integer from Standard;
---Level: Internal ---Level: Internal
---Purpose: Clears all the structures which don't ---Purpose: Clears all the structures which don't
@ -2131,9 +2027,8 @@ is
EraseGlobal(me : mutable; EraseGlobal(me : mutable;
anObj : InteractiveObject from AIS; anObj : InteractiveObject from AIS;
updateviewer : Boolean from Standard = Standard_True; updateviewer : Boolean from Standard = Standard_True) is static private;
PutInCollector : Boolean from Standard = Standard_False) is static private;
ClearGlobal(me : mutable; ClearGlobal(me : mutable;
anObj : InteractiveObject from AIS; anObj : InteractiveObject from AIS;
@ -2172,12 +2067,6 @@ fields
myMainVwr : Viewer from V3d; myMainVwr : Viewer from V3d;
myMainSel : ViewerSelector3d from StdSelect; 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. -- the selection and current objects.
mySelectionName : AsciiString from TCollection; mySelectionName : AsciiString from TCollection;
@ -2185,7 +2074,6 @@ fields
myLastPicked : InteractiveObject from AIS; myLastPicked : InteractiveObject from AIS;
myLastinMain : InteractiveObject from AIS; myLastinMain : InteractiveObject from AIS;
myLastinColl : InteractiveObject from AIS;
myWasLastMain : Boolean from Standard; myWasLastMain : Boolean from Standard;

File diff suppressed because it is too large Load Diff

View File

@ -21,11 +21,6 @@ inline const Handle(V3d_Viewer)& AIS_InteractiveContext::CurrentViewer() const
return myMainVwr; return myMainVwr;
} }
inline const Handle(V3d_Viewer)& AIS_InteractiveContext::Collector() const
{
return myCollectorVwr;
}
inline Quantity_NameOfColor AIS_InteractiveContext::HilightColor() const inline Quantity_NameOfColor AIS_InteractiveContext::HilightColor() const
{ {
return myHilightColor; return myHilightColor;
@ -44,12 +39,6 @@ inline Quantity_NameOfColor AIS_InteractiveContext::PreSelectionColor() const
inline Quantity_NameOfColor AIS_InteractiveContext::DefaultColor() const inline Quantity_NameOfColor AIS_InteractiveContext::DefaultColor() const
{ return myDefaultColor; { 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 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 inline const Handle(PrsMgr_PresentationManager3d)& AIS_InteractiveContext::MainPrsMgr() const
{return myMainPM ;} {return myMainPM ;}
inline const Handle(PrsMgr_PresentationManager3d)& AIS_InteractiveContext::CollectorPrsMgr() const
{return myCollectorPM ;}
inline Standard_Boolean AIS_InteractiveContext::HasOpenedContext() const inline Standard_Boolean AIS_InteractiveContext::HasOpenedContext() const
{return myCurLocalIndex != 0;} {return myCurLocalIndex != 0;}
@ -111,9 +96,6 @@ inline void AIS_InteractiveContext::SetOkCurrent()
inline const Handle(StdSelect_ViewerSelector3d)& AIS_InteractiveContext::MainSelector() const inline const Handle(StdSelect_ViewerSelector3d)& AIS_InteractiveContext::MainSelector() const
{return myMainSel;} {return myMainSel;}
inline const Handle(StdSelect_ViewerSelector3d)& AIS_InteractiveContext::CollectorSelector() const
{return myCollectorSel;}
inline void AIS_InteractiveContext::SetToHilightSelected(const Standard_Boolean toHilight) inline void AIS_InteractiveContext::SetToHilightSelected(const Standard_Boolean toHilight)
{ {
myToHilightSelected = toHilight; myToHilightSelected = toHilight;

View File

@ -146,7 +146,7 @@ AIS_StatusOfDetection AIS_InteractiveContext::MoveTo(const Standard_Integer XPix
const Standard_Integer YPix, const Standard_Integer YPix,
const Handle(V3d_View)& aView) const Handle(V3d_View)& aView)
{ {
if(HasOpenedContext()&& aView->Viewer()!=myCollectorVwr){ if(HasOpenedContext()){
myWasLastMain = Standard_True; myWasLastMain = Standard_True;
return myLocalContexts(myCurLocalIndex)->MoveTo(XPix,YPix,aView); return myLocalContexts(myCurLocalIndex)->MoveTo(XPix,YPix,aView);
} }
@ -169,13 +169,6 @@ AIS_StatusOfDetection AIS_InteractiveContext::MoveTo(const Standard_Integer XPix
myLastPicked = myLastinMain; myLastPicked = myLastinMain;
myWasLastMain = Standard_True; myWasLastMain = Standard_True;
} }
else if (aView->Viewer()== myCollectorVwr){
pmgr = myCollectorPM;
selector=myCollectorSel;
myLastPicked = myLastinColl;
ismain = Standard_False;
myWasLastMain = Standard_False;
}
else else
return AIS_SOD_Error; return AIS_SOD_Error;
@ -247,8 +240,6 @@ AIS_StatusOfDetection AIS_InteractiveContext::MoveTo(const Standard_Integer XPix
if ( ismain ) if ( ismain )
myLastinMain = myLastPicked; myLastinMain = myLastPicked;
else
myLastinColl = myLastPicked;
#ifdef IMP191001 #ifdef IMP191001
// Highlight detected object if it is not selected or myToHilightSelected flag is true // Highlight detected object if it is not selected or myToHilightSelected flag is true
if ( !myLastPicked.IsNull() && if ( !myLastPicked.IsNull() &&
@ -289,8 +280,6 @@ AIS_StatusOfDetection AIS_InteractiveContext::MoveTo(const Standard_Integer XPix
if ( ismain ) if ( ismain )
myLastinMain.Nullify(); myLastinMain.Nullify();
else
myLastinColl.Nullify();
} }
if(UpdVwr) aView->Viewer()->Update(); if(UpdVwr) aView->Viewer()->Update();
@ -325,12 +314,7 @@ AIS_StatusOfPick AIS_InteractiveContext::Select(const Standard_Integer XPMin,
if(aView->Viewer()== myMainVwr) { if(aView->Viewer()== myMainVwr) {
selector= myMainSel; selector= myMainSel;
myWasLastMain = Standard_True;} myWasLastMain = Standard_True;}
else if (aView->Viewer()==myCollectorVwr){
selector= myCollectorSel;
myWasLastMain = Standard_False;}
selector->Pick(XPMin,YPMin,XPMax,YPMax,aView); selector->Pick(XPMin,YPMin,XPMax,YPMax,aView);
AIS_Selection::SetCurrentSelection(myCurrentName.ToCString()); AIS_Selection::SetCurrentSelection(myCurrentName.ToCString());
@ -395,12 +379,7 @@ AIS_StatusOfPick AIS_InteractiveContext::Select(const TColgp_Array1OfPnt2d& aPol
if(aView->Viewer()== myMainVwr) { if(aView->Viewer()== myMainVwr) {
selector= myMainSel; selector= myMainSel;
myWasLastMain = Standard_True;} myWasLastMain = Standard_True;}
else if (aView->Viewer()==myCollectorVwr){
selector= myCollectorSel;
myWasLastMain = Standard_False;}
selector->Pick(aPolyline,aView); selector->Pick(aPolyline,aView);
AIS_Selection::SetCurrentSelection(myCurrentName.ToCString()); AIS_Selection::SetCurrentSelection(myCurrentName.ToCString());
@ -467,12 +446,6 @@ AIS_StatusOfPick AIS_InteractiveContext::Select(const Standard_Boolean updatevie
if(updateviewer) if(updateviewer)
UpdateCurrentViewer();} UpdateCurrentViewer();}
} }
else if (!myWasLastMain && !myLastinColl.IsNull()){
if(myLastinColl->State()!=1){
SetCurrentObject(myLastinColl,Standard_False);
if(updateviewer)
UpdateCollector();}
}
else{ else{
AIS_Selection::SetCurrentSelection(myCurrentName.ToCString()); AIS_Selection::SetCurrentSelection(myCurrentName.ToCString());
Handle(AIS_Selection) S = AIS_Selection::CurrentSelection(); Handle(AIS_Selection) S = AIS_Selection::CurrentSelection();
@ -493,9 +466,7 @@ AIS_StatusOfPick AIS_InteractiveContext::Select(const Standard_Boolean updatevie
AIS_Selection::Select(); AIS_Selection::Select();
if(updateviewer){ if(updateviewer){
if(myWasLastMain) if(myWasLastMain)
UpdateCurrentViewer(); UpdateCurrentViewer();
else
UpdateCollector();
} }
} }
Standard_Integer NS = NbCurrents(); Standard_Integer NS = NbCurrents();
@ -524,10 +495,7 @@ AIS_StatusOfPick AIS_InteractiveContext::ShiftSelect(const Standard_Boolean upda
} }
if(myWasLastMain && !myLastinMain.IsNull()) if(myWasLastMain && !myLastinMain.IsNull())
AddOrRemoveCurrentObject(myLastinMain,updateviewer); AddOrRemoveCurrentObject(myLastinMain,updateviewer);
else if (!myWasLastMain && !myLastinColl.IsNull())
AddOrRemoveCurrentObject(myLastinColl,updateviewer);
Standard_Integer NS = NbCurrents(); Standard_Integer NS = NbCurrents();
if(NS==0) return AIS_SOP_NothingSelected; if(NS==0) return AIS_SOP_NothingSelected;
if(NS==1) return AIS_SOP_OneSelected; if(NS==1) return AIS_SOP_OneSelected;
@ -558,10 +526,6 @@ AIS_StatusOfPick AIS_InteractiveContext::ShiftSelect(const Standard_Integer XPMi
if(aView->Viewer()== myMainVwr) { if(aView->Viewer()== myMainVwr) {
selector= myMainSel; selector= myMainSel;
myWasLastMain = Standard_True;} myWasLastMain = Standard_True;}
else if (aView->Viewer()==myCollectorVwr){
selector= myCollectorSel;
myWasLastMain = Standard_False;}
else else
return AIS_SOP_NothingSelected; return AIS_SOP_NothingSelected;
@ -605,10 +569,6 @@ AIS_StatusOfPick AIS_InteractiveContext::ShiftSelect( const TColgp_Array1OfPnt2d
selector= myMainSel; selector= myMainSel;
myWasLastMain = Standard_True; myWasLastMain = Standard_True;
} }
else if ( aView->Viewer() == myCollectorVwr ) {
selector= myCollectorSel;
myWasLastMain = Standard_False;
}
else else
return AIS_SOP_NothingSelected; return AIS_SOP_NothingSelected;

View File

@ -63,7 +63,6 @@ OpenLocalContext(const Standard_Boolean UseDisplayedObjects,
// entities connected to dynamic selection at neutral point are set to 0. // entities connected to dynamic selection at neutral point are set to 0.
myLastinMain.Nullify(); myLastinMain.Nullify();
myLastinColl.Nullify();
myLastPicked.Nullify(); myLastPicked.Nullify();
myWasLastMain = Standard_True; myWasLastMain = Standard_True;
@ -186,8 +185,6 @@ void AIS_InteractiveContext::CloseAllContexts(const Standard_Boolean updateviewe
ResetOriginalState(Standard_False); ResetOriginalState(Standard_False);
myMainSel->UpdateSort(); myMainSel->UpdateSort();
if(!myIsCollClosed && !myCollectorSel.IsNull())
myCollectorSel->UpdateSort();
if(updateviewer) myMainVwr->Update(); if(updateviewer) myMainVwr->Update();
} }
@ -376,22 +373,18 @@ SubIntensityOn(const Handle(AIS_InteractiveObject)& anIObj,
if(GB->IsSubIntensityOn()) if(GB->IsSubIntensityOn())
return; return;
GB->SubIntensityOn(); 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()){ 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()); myMainPM->Color(anIObj,mySubIntensity,It.Value());
UpdMain = Standard_True;} UpdMain = Standard_True;
else if(GB->GraphicStatus()==AIS_DS_Erased){
myCollectorPM->Color(anIObj,mySubIntensity,It.Value());
UpdColl=Standard_True;
} }
} }
if(updateviewer){ if(updateviewer){
if(UpdMain) if(UpdMain)
myMainVwr->Update(); myMainVwr->Update();
if(UpdColl)
myCollectorVwr->Update();
} }
} }
else { else {
@ -424,15 +417,13 @@ SubIntensityOff(const Handle(AIS_InteractiveObject)& anIObj,
if(!GB->IsSubIntensityOn()) if(!GB->IsSubIntensityOn())
return; return;
GB->SubIntensityOff(); 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()){ 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()); myMainPM->Unhighlight(anIObj,It.Value());
UpdMain = Standard_True;} UpdMain = Standard_True;
else {
myCollectorPM->Unhighlight(anIObj,It.Value());
UpdColl=Standard_True;
} }
} }
@ -444,8 +435,6 @@ SubIntensityOff(const Handle(AIS_InteractiveObject)& anIObj,
if(updateviewer){ if(updateviewer){
if(UpdMain) if(UpdMain)
myMainVwr->Update(); myMainVwr->Update();
if(UpdColl)
myCollectorVwr->Update();
} }
} }
else { else {
@ -749,17 +738,11 @@ void AIS_InteractiveContext::NotUseDisplayedObjects()
//purpose : //purpose :
//======================================================================= //=======================================================================
Standard_Integer AIS_InteractiveContext::PurgeDisplay(const Standard_Boolean CollectorToo) Standard_Integer AIS_InteractiveContext::PurgeDisplay()
{ {
if(HasOpenedContext()) return 0; if(HasOpenedContext()) return 0;
Standard_Integer NbStr = PurgeViewer(myMainVwr); Standard_Integer NbStr = PurgeViewer(myMainVwr);
if(!myCollectorVwr.IsNull())
if(CollectorToo){
NbStr+=PurgeViewer(myCollectorVwr);
if(!IsCollectorClosed())
myCollectorVwr->Update();
}
myMainVwr->Update(); myMainVwr->Update();
return NbStr; return NbStr;
@ -881,7 +864,7 @@ Standard_Boolean AIS_InteractiveContext::EndImmediateDraw(const Standard_Boolean
void AIS_InteractiveContext::ResetOriginalState(const Standard_Boolean updateviewer) 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; TColStd_ListIteratorOfListOfInteger itl;
for (AIS_DataMapIteratorOfDataMapOfIOStatus it(myObjects);it.More();it.Next()){ for (AIS_DataMapIteratorOfDataMapOfIOStatus it(myObjects);it.More();it.Next()){
@ -908,12 +891,7 @@ void AIS_InteractiveContext::ResetOriginalState(const Standard_Boolean updatevie
break; break;
} }
case AIS_DS_Erased:{ case AIS_DS_Erased:{
upd_col = Standard_True; EraseGlobal(iobj,Standard_False);
EraseGlobal(iobj,Standard_False,Standard_True);
break;
}
case AIS_DS_FullErased:{
EraseGlobal(iobj,Standard_False,Standard_False);
break; break;
} }
default: default:
@ -923,8 +901,6 @@ void AIS_InteractiveContext::ResetOriginalState(const Standard_Boolean updatevie
if(updateviewer){ if(updateviewer){
if(upd_main) if(upd_main)
myMainVwr->Update(); myMainVwr->Update();
if(upd_col)
myCollectorVwr->Update();
} }
} }

View File

@ -25,28 +25,6 @@
#include <AIS_GlobalStatus.hxx> #include <AIS_GlobalStatus.hxx>
// OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets // 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 // OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets
//======================================================================= //=======================================================================

View File

@ -317,13 +317,13 @@ Erase(const Handle(AIS_InteractiveObject)& anInteractive)
AddOrRemoveSelected(anInteractive); AddOrRemoveSelected(anInteractive);
if(myMainPM->IsHighlighted(anInteractive,STAT->HilightMode())) if(myMainPM->IsHighlighted(anInteractive,STAT->HilightMode()))
myMainPM->Unhighlight(anInteractive,STAT->HilightMode()); myMainPM->Unhighlight(anInteractive,STAT->HilightMode());
myMainPM->Erase(anInteractive,STAT->DisplayMode()); myMainPM->SetVisibility (anInteractive, STAT->DisplayMode(), Standard_False);
STAT->SetDisplayMode(-1); STAT->SetDisplayMode(-1);
status = Standard_True; status = Standard_True;
} }
if(STAT->IsTemporary()){ if(STAT->IsTemporary()){
if(myMainPM->IsDisplayed(anInteractive,STAT->HilightMode())) if(myMainPM->IsDisplayed(anInteractive,STAT->HilightMode()))
myMainPM->Erase(anInteractive,STAT->HilightMode()); myMainPM->SetVisibility (anInteractive, STAT->HilightMode(), Standard_False);
} }
//selection step //selection step
@ -590,13 +590,7 @@ void AIS_LocalContext::ActivateStandardMode(const TopAbs_ShapeEnum aType)
AIS_DataMapIteratorOfDataMapOfSelStat ItM(myActiveObjects); AIS_DataMapIteratorOfDataMapOfSelStat ItM(myActiveObjects);
for(;ItM.More();ItM.Next()){ 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()) if(ItM.Value()->Decomposed())
#endif
myCTX->SelectionManager()->Activate(ItM.Key(), myCTX->SelectionManager()->Activate(ItM.Key(),
IMode, IMode,
myMainVS); myMainVS);
@ -844,8 +838,8 @@ void AIS_LocalContext::Unhilight(const Handle(AIS_InteractiveObject)& anObject)
myMainPM->Unhighlight(anObject,Att->HilightMode()); myMainPM->Unhighlight(anObject,Att->HilightMode());
if(Att->IsTemporary() && Att->DisplayMode()==-1) if(Att->IsTemporary() && Att->DisplayMode()==-1)
if(!IsSomeWhereElse) if(!IsSomeWhereElse)
myMainPM->Erase(anObject,Att->HilightMode()); myMainPM->SetVisibility (anObject, Att->HilightMode(), Standard_False);
Att->SubIntensityOff(); Att->SubIntensityOff();
Att->SetHilightColor(Quantity_NOC_WHITE); Att->SetHilightColor(Quantity_NOC_WHITE);
} }
@ -1148,31 +1142,30 @@ HasFilters(const TopAbs_ShapeEnum aType) const
void AIS_LocalContext::ClearDetected() void AIS_LocalContext::ClearDetected()
{ {
for(Standard_Integer I=1;I<=myMapOfOwner.Extent();I++){ for(Standard_Integer I=1;I<=myMapOfOwner.Extent();I++)
{
if(!myMapOfOwner(I).IsNull()){ if(!myMapOfOwner(I).IsNull())
{
if(myMapOfOwner(I)->IsHilighted(myMainPM)) if(myMapOfOwner(I)->IsHilighted(myMainPM))
myMapOfOwner(I)->Unhilight(myMainPM); myMapOfOwner(I)->Unhilight(myMainPM);
else if (myMapOfOwner(I)->IsHilighted(myCTX->CollectorPrsMgr())) else
myMapOfOwner(I)->Unhilight(myCTX->CollectorPrsMgr()); {
const Handle(SelectMgr_SelectableObject)& SO =
else{ myMapOfOwner.FindKey(I)->Selectable();
const Handle(SelectMgr_SelectableObject)& SO = if(myActiveObjects.IsBound(SO))
myMapOfOwner.FindKey(I)->Selectable(); {
if(myActiveObjects.IsBound(SO)){ const Handle(AIS_LocalStatus)& Att = myActiveObjects(SO);
const Handle(AIS_LocalStatus)& Att = myActiveObjects(SO);
if(Att->IsTemporary() &&
if(Att->IsTemporary() && Att->DisplayMode()==-1 &&
Att->DisplayMode()==-1 && Att->SelectionModes().IsEmpty())
Att->SelectionModes().IsEmpty()){ {
myMapOfOwner(I)->Clear(myMainPM); myMapOfOwner(I)->Clear(myMainPM);
//myMapOfOwner(I)->Clear();//rob-jmi... }
} }
}
} }
} }
} }
} }
void AIS_LocalContext::UpdateConversion() void AIS_LocalContext::UpdateConversion()

View File

@ -594,7 +594,7 @@ void AIS_LocalContext::Unhilight(const Handle(SelectMgr_EntityOwner)& Ownr,
//======================================================================= //=======================================================================
void AIS_LocalContext::HilightPicked(const Standard_Boolean updateviewer) 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()); Handle(AIS_Selection) Sel = AIS_Selection::Selection(mySelName.ToCString());
#ifdef BUC60765 #ifdef BUC60765
@ -626,11 +626,7 @@ void AIS_LocalContext::HilightPicked(const Standard_Boolean updateviewer)
if(BROwnr.IsNull() || !BROwnr->ComesFromDecomposition()){ if(BROwnr.IsNull() || !BROwnr->ComesFromDecomposition()){
Handle(SelectMgr_SelectableObject) SO = Ownr->Selectable(); Handle(SelectMgr_SelectableObject) SO = Ownr->Selectable();
IO = *((Handle(AIS_InteractiveObject)*)&SO); IO = *((Handle(AIS_InteractiveObject)*)&SO);
if(myCTX->IsInCollector(IO)){ updMain = Standard_True;
PM = myCTX->CollectorPrsMgr();
updColl = Standard_True;}
else
updMain = Standard_True;
} }
else else
updMain = Standard_True; updMain = Standard_True;
@ -661,7 +657,6 @@ void AIS_LocalContext::HilightPicked(const Standard_Boolean updateviewer)
#else #else
if(updMain) myCTX->CurrentViewer()->Update(); if(updMain) myCTX->CurrentViewer()->Update();
#endif #endif
if(updColl) myCTX->Collector()->Update();
} }
} }
@ -672,7 +667,7 @@ void AIS_LocalContext::HilightPicked(const Standard_Boolean updateviewer)
void AIS_LocalContext:: void AIS_LocalContext::
UnhilightPicked(const Standard_Boolean updateviewer) 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()); Handle(AIS_Selection) Sel = AIS_Selection::Selection(mySelName.ToCString());
#ifdef BUC60765 #ifdef BUC60765
@ -711,11 +706,7 @@ UnhilightPicked(const Standard_Boolean updateviewer)
Handle(AIS_InteractiveObject) IO = *((Handle(AIS_InteractiveObject)*)&SO); Handle(AIS_InteractiveObject) IO = *((Handle(AIS_InteractiveObject)*)&SO);
HM = GetHiMod(IO); HM = GetHiMod(IO);
#endif #endif
if(myCTX->IsInCollector(IO)){ updMain = Standard_True;
PM = myCTX->CollectorPrsMgr();
updColl = Standard_True;}
else
updMain = Standard_True;
} }
else else
updMain = Standard_True; updMain = Standard_True;
@ -735,7 +726,6 @@ UnhilightPicked(const Standard_Boolean updateviewer)
#else #else
if(updMain) myCTX->CurrentViewer()->Update(); if(updMain) myCTX->CurrentViewer()->Update();
#endif #endif
if(updColl) myCTX->Collector()->Update();
} }
} }

View File

@ -205,15 +205,6 @@ is
is deferred; is deferred;
---Purpose: call_togl_markercontextgroup ---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; RemoveGroup ( me : mutable;
ACGroup : CGroup from Graphic3d ) ACGroup : CGroup from Graphic3d )
is deferred; is deferred;
@ -1028,10 +1019,18 @@ is
---Purpose: returns Handle to display connection ---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 fields
MyTraceLevel : Integer from Standard is protected; MyTraceLevel : Integer from Standard is protected;
MySharedLibrary : SharedLibrary from OSD is protected; MySharedLibrary : SharedLibrary from OSD is protected;
myDisplayConnection: DisplayConnection_Handle from Aspect is protected; myDisplayConnection: DisplayConnection_Handle from Aspect is protected;
myDeviceLostFlag : Boolean from Standard is protected;
end GraphicDriver from Graphic3d; end GraphicDriver from Graphic3d;

View File

@ -48,6 +48,7 @@ Graphic3d_GraphicDriver::Graphic3d_GraphicDriver (const Standard_CString AShrNam
SetTrace (0); SetTrace (0);
MySharedLibrary.SetName (AShrName); MySharedLibrary.SetName (AShrName);
myDeviceLostFlag = Standard_False;
//if (! MySharedLibrary.DlOpen (OSD_RTLD_LAZY)) //if (! MySharedLibrary.DlOpen (OSD_RTLD_LAZY))
//Aspect_DriverDefinitionError::Raise (MySharedLibrary.DlError ()); //Aspect_DriverDefinitionError::Raise (MySharedLibrary.DlError ());
@ -222,3 +223,13 @@ const Handle(Aspect_DisplayConnection)& Graphic3d_GraphicDriver::GetDisplayConne
{ {
return myDisplayConnection; return myDisplayConnection;
} }
Standard_Boolean Graphic3d_GraphicDriver::IsDeviceLost() const
{
return myDeviceLostFlag;
}
void Graphic3d_GraphicDriver::ResetDeviceLostFlag()
{
myDeviceLostFlag = Standard_False;
}

View File

@ -382,6 +382,11 @@ is
-- Category: Compute methods -- Category: Compute methods
---------------------------- ----------------------------
Compute (me: mutable)
is virtual;
---Level: Advanced
---Category: Methods to modify the class definition
Compute ( me : mutable; Compute ( me : mutable;
aProjector : DataStructureManager from Graphic3d ) aProjector : DataStructureManager from Graphic3d )
returns Structure from Graphic3d is virtual; returns Structure from Graphic3d is virtual;

View File

@ -298,6 +298,7 @@ void Graphic3d_Structure::Display () {
MyStructureManager->Display (this); MyStructureManager->Display (this);
} }
MyCStructure.visible = 1;
} }
void Graphic3d_Structure::Display (const Standard_Integer Priority) { void Graphic3d_Structure::Display (const Standard_Integer Priority) {
@ -311,6 +312,7 @@ void Graphic3d_Structure::Display (const Standard_Integer Priority) {
MyStructureManager->Display (this); MyStructureManager->Display (this);
} }
MyCStructure.visible = 1;
} }
void Graphic3d_Structure::SetDisplayPriority (const Standard_Integer Priority) { void Graphic3d_Structure::SetDisplayPriority (const Standard_Integer Priority) {
@ -438,11 +440,6 @@ void Graphic3d_Structure::SetVisible (const Standard_Boolean AValue) {
MyGraphicDriver->NameSetStructure (MyCStructure); MyGraphicDriver->NameSetStructure (MyCStructure);
if (AValue)
MyStructureManager->Visible (this);
else
MyStructureManager->Invisible (this);
Update (); 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)& ) { Handle(Graphic3d_Structure) Graphic3d_Structure::Compute (const Handle(Graphic3d_DataStructureManager)& ) {
// Implemented by Presentation // Implemented by Presentation
@ -2420,11 +2422,6 @@ void Graphic3d_Structure::SetManager (const Handle(Graphic3d_StructureManager)&
if (MyCStructure.highlight) { if (MyCStructure.highlight) {
} }
if (MyCStructure.visible) {
MyStructureManager->Invisible (this);
AManager->Visible (this);
}
if (MyCStructure.pick) { if (MyCStructure.pick) {
MyStructureManager->Undetectable (this); MyStructureManager->Undetectable (this);
AManager->Detectable (this); AManager->Detectable (this);

View File

@ -202,13 +202,6 @@ is
-- in a visualiser <me>. -- in a visualiser <me>.
---Category: Inquire methods, MapOfStructure ---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 <me>.
---Category: Inquire methods, MapOfStructure
---------------------------- ----------------------------
-- Category: Inquire methods -- Category: Inquire methods
---------------------------- ----------------------------
@ -418,13 +411,6 @@ is
---Category: Private methods ---Category: Private methods
---C++: return const & ---C++: return const &
Invisible ( me : mutable;
AStructure : Structure from Graphic3d )
is static private;
---Level: Internal
---Purpose: Sets invisible the structure <AStructure>.
---Category: Private methods
Identification ( me ) Identification ( me )
returns Integer from Standard returns Integer from Standard
is virtual; is virtual;
@ -477,13 +463,10 @@ is
---Purpose: Suppress the highlighting on the structure <AStructure>. ---Purpose: Suppress the highlighting on the structure <AStructure>.
---Category: Private methods ---Category: Private methods
Visible ( me : mutable; ReComputeStructures (me: mutable);
AStructure : Structure from Graphic3d ) -- Purpose: Recomputes all displayed structures. Used to recompute GL
is static private; -- resources after the last view has been closed without removing objects.
---Level: Internal
---Purpose: Sets visible the structure <AStructure>.
-- in the manager.
---Category: Private methods
-- --
fields fields
@ -519,10 +502,6 @@ fields
MyHighlightedStructure : MapOfStructure from Graphic3d MyHighlightedStructure : MapOfStructure from Graphic3d
is protected; is protected;
-- the visible structures
MyVisibleStructure : MapOfStructure from Graphic3d
is protected;
-- the pickable structures -- the pickable structures
MyPickStructure : MapOfStructure from Graphic3d MyPickStructure : MapOfStructure from Graphic3d
is protected; is protected;

View File

@ -66,9 +66,6 @@ static Standard_Integer StructureManager_CurrentId = 0;
// -- les structures mises en evidence // -- les structures mises en evidence
// MyHighlightedStructure : SequenceOfStructure; // MyHighlightedStructure : SequenceOfStructure;
// -- les structures visibles
// MyVisibleStructure : SequenceOfStructure;
// -- les structures detectables // -- les structures detectables
// MyPickStructure : SequenceOfStructure; // MyPickStructure : SequenceOfStructure;
@ -80,7 +77,6 @@ static Standard_Integer StructureManager_CurrentId = 0;
Graphic3d_StructureManager::Graphic3d_StructureManager (const Handle(Graphic3d_GraphicDriver)& theDriver): Graphic3d_StructureManager::Graphic3d_StructureManager (const Handle(Graphic3d_GraphicDriver)& theDriver):
MyDisplayedStructure (), MyDisplayedStructure (),
MyHighlightedStructure (), MyHighlightedStructure (),
MyVisibleStructure (),
MyPickStructure () { MyPickStructure () {
Standard_Real Coef; Standard_Real Coef;
@ -145,7 +141,6 @@ void Graphic3d_StructureManager::Destroy () {
MyDisplayedStructure.Clear (); MyDisplayedStructure.Clear ();
MyHighlightedStructure.Clear (); MyHighlightedStructure.Clear ();
MyVisibleStructure.Clear ();
MyPickStructure.Clear (); MyPickStructure.Clear ();
StructureManager_ArrayId[MyId] = 0; 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) { void Graphic3d_StructureManager::Detectable (const Handle(Graphic3d_Structure)& AStructure) {
MyPickStructure.Add(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 { 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; Standard_Boolean Flag = Standard_True;
@ -397,3 +373,14 @@ const Handle(Graphic3d_GraphicDriver)& Graphic3d_StructureManager::GraphicDriver
return (MyGraphicDriver); 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();
}
}

View File

@ -108,11 +108,6 @@ public: // Methods for graphical groups
const Standard_Integer theNoInsert); const Standard_Integer theNoInsert);
Standard_EXPORT void MarkerContextGroup (const Graphic3d_CGroup& theCGroup, Standard_EXPORT void MarkerContextGroup (const Graphic3d_CGroup& theCGroup,
const Standard_Integer theNoInsert); 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 RemoveGroup (const Graphic3d_CGroup& theCGroup);
Standard_EXPORT void TextContextGroup (const Graphic3d_CGroup& theCGroup, Standard_EXPORT void TextContextGroup (const Graphic3d_CGroup& theCGroup,
const Standard_Integer theNoInsert); const Standard_Integer theNoInsert);

View File

@ -67,23 +67,6 @@ void OpenGl_GraphicDriver::MarkerContextGroup (const Graphic3d_CGroup& theCGroup
((OpenGl_Group* )theCGroup.ptrGroup)->SetAspectMarker (GetSharedContext(), theCGroup.ContextMarker, theNoInsert); ((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) void OpenGl_GraphicDriver::RemoveGroup (const Graphic3d_CGroup& theCGroup)
{ {
OpenGl_Structure* aStructure = (OpenGl_Structure* )theCGroup.Struct->ptrStructure; OpenGl_Structure* aStructure = (OpenGl_Structure* )theCGroup.Struct->ptrStructure;

View File

@ -25,6 +25,7 @@
#include <OpenGl_Structure.hxx> #include <OpenGl_Structure.hxx>
#include <OpenGl_CView.hxx> #include <OpenGl_CView.hxx>
#include <OpenGl_Display.hxx> #include <OpenGl_Display.hxx>
#include <OpenGl_Text.hxx>
/*----------------------------------------------------------------------*/ /*----------------------------------------------------------------------*/
@ -433,6 +434,8 @@ void OpenGl_GraphicDriver::RemoveView (const Graphic3d_CView& theCView)
OpenGl_Structure* aStruct = aStructIt.ChangeValue(); OpenGl_Structure* aStruct = aStructIt.ChangeValue();
aStruct->ReleaseGlResources (aShareCtx); aStruct->ReleaseGlResources (aShareCtx);
} }
myTempText->Release (aShareCtx);
myDeviceLostFlag = Standard_True;
} }
OpenGl_CView* aCView = (OpenGl_CView* )theCView.ptrView; OpenGl_CView* aCView = (OpenGl_CView* )theCView.ptrView;

View File

@ -295,6 +295,7 @@ fields
myTransformPersistence : CTransPersStruct from Graphic3d; myTransformPersistence : CTransPersStruct from Graphic3d;
friends friends
class Presentation3d from PrsMgr,
class PresentationManager 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),
Compute from Presentation3d from PrsMgr(me : mutable; aProjector : DataStructureManager from Graphic3d; Compute from Presentation3d from PrsMgr(me : mutable; aProjector : DataStructureManager from Graphic3d;

View File

@ -40,7 +40,9 @@ is
Display(me: mutable) is deferred private; Display(me: mutable) is deferred private;
Erase(me) is deferred private; Erase(me) is deferred private;
SetVisible (me: mutable; theValue: Boolean from Standard) is deferred private;
Highlight(me: mutable) is deferred private; Highlight(me: mutable) is deferred private;
Unhighlight (me) is deferred private; Unhighlight (me) is deferred private;

View File

@ -54,8 +54,17 @@ is
Display(me: mutable) Display(me: mutable)
is redefined static private; 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; Highlight(me: mutable) is redefined static private;
Unhighlight (me) is redefined static private; Unhighlight (me) is redefined static private;
@ -126,6 +135,9 @@ is
---Category: Computed Structures ---Category: Computed Structures
Compute(me : mutable; theStructure: Structure from Graphic3d)
is static private;
Compute(me : mutable; aProjector: DataStructureManager from Graphic3d) Compute(me : mutable; aProjector: DataStructureManager from Graphic3d)
returns Structure from Graphic3d returns Structure from Graphic3d
is static private; is static private;

View File

@ -27,6 +27,7 @@
#include <PrsMgr_Presentation3d.ixx> #include <PrsMgr_Presentation3d.ixx>
#include <PrsMgr_PresentationManager.hxx> #include <PrsMgr_PresentationManager.hxx>
#include <PrsMgr_Prs.hxx> #include <PrsMgr_Prs.hxx>
#include <PrsMgr_ModedPresentation.hxx>
#include <Visual3d_View.hxx> #include <Visual3d_View.hxx>
#include <Visual3d_ViewOrientation.hxx> #include <Visual3d_ViewOrientation.hxx>
#include <Graphic3d_Structure.hxx> #include <Graphic3d_Structure.hxx>
@ -47,24 +48,41 @@ PrsMgr_KindOfPrs PrsMgr_Presentation3d::KindOfPresentation() const
{return PrsMgr_KOP_3D;} {return PrsMgr_KOP_3D;}
void PrsMgr_Presentation3d::Display () { void PrsMgr_Presentation3d::Display()
myStructure->Display(); {
Display (Standard_False);
myDisplayReason = 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 { void PrsMgr_Presentation3d::Erase () const {
myStructure->Erase();} myStructure->Erase();}
void PrsMgr_Presentation3d::SetVisible (const Standard_Boolean theValue)
{
myStructure->SetVisible (theValue);
}
void PrsMgr_Presentation3d::Highlight () { void PrsMgr_Presentation3d::Highlight () {
if(!myStructure->IsDisplayed()) { Display (Standard_True);
myStructure->Display();
myDisplayReason = Standard_True;
}
myStructure->Highlight();} myStructure->Highlight();}
void PrsMgr_Presentation3d::Unhighlight () const { void PrsMgr_Presentation3d::Unhighlight () const {
myStructure->UnHighlight(); myStructure->UnHighlight();
if(myDisplayReason) myStructure->Erase(); if (myDisplayReason) myStructure->SetVisible (Standard_False);
} }
void PrsMgr_Presentation3d::Clear() { void PrsMgr_Presentation3d::Clear() {
@ -81,13 +99,7 @@ void PrsMgr_Presentation3d::Clear() {
} }
void PrsMgr_Presentation3d::Color(const Quantity_NameOfColor aColor){ void PrsMgr_Presentation3d::Color(const Quantity_NameOfColor aColor){
Standard_Boolean ImmMode = myPresentationManager->IsImmediateModeOn(); Display (Standard_True);
if(!ImmMode){
if(!myStructure->IsDisplayed()) {
myStructure->Display();
myDisplayReason = Standard_True;
}
}
myStructure->Color(aColor); myStructure->Color(aColor);
} }
@ -96,7 +108,7 @@ void PrsMgr_Presentation3d::BoundBox() const {
} }
Standard_Boolean PrsMgr_Presentation3d::IsDisplayed () const { Standard_Boolean PrsMgr_Presentation3d::IsDisplayed () const {
return myStructure->IsDisplayed() && !myDisplayReason; return myStructure->IsDisplayed() && myStructure->IsVisible() && !myDisplayReason;
} }
Standard_Boolean PrsMgr_Presentation3d::IsHighlighted () const { Standard_Boolean PrsMgr_Presentation3d::IsHighlighted () const {
@ -167,6 +179,36 @@ Compute(const Handle(Graphic3d_DataStructureManager)& aProjector)
//purpose : //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, void PrsMgr_Presentation3d::Compute(const Handle(Graphic3d_DataStructureManager)& aProjector,
const Handle(Graphic3d_Structure)& TheStructToFill) const Handle(Graphic3d_Structure)& TheStructToFill)
{ {

View File

@ -65,6 +65,11 @@ is
-- aPresentableObject in this framework with the -- aPresentableObject in this framework with the
-- display mode aMode. -- 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; Highlight(me: mutable; aPresentableObject: mutable PresentableObject from PrsMgr;
aMode: Integer from Standard = 0) aMode: Integer from Standard = 0)
---Purpose: Highlights the presentation of the presentable object ---Purpose: Highlights the presentation of the presentable object

View File

@ -66,6 +66,12 @@ void PrsMgr_PresentationManager::Clear(const Handle(PrsMgr_PresentableObject)& a
Presentation(aPresentableObject,aMode)->Clear();} 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( void PrsMgr_PresentationManager::Highlight(
const Handle(PrsMgr_PresentableObject)& aPresentableObject, const Handle(PrsMgr_PresentableObject)& aPresentableObject,

View File

@ -36,7 +36,10 @@ is
aPresentation : Presentation3dPointer from PrsMgr; aPresentation : Presentation3dPointer from PrsMgr;
aTypeOfPresentation3d : TypeOfPresentation3d from PrsMgr) aTypeOfPresentation3d : TypeOfPresentation3d from PrsMgr)
returns mutable Prs from PrsMgr; returns mutable Prs from PrsMgr;
Compute (me: mutable)
is redefined static;
Compute(me : mutable; aProjector: DataStructureManager from Graphic3d) Compute(me : mutable; aProjector: DataStructureManager from Graphic3d)
returns Structure from Graphic3d returns Structure from Graphic3d
is redefined static; is redefined static;

View File

@ -37,6 +37,16 @@ PrsMgr_Prs::PrsMgr_Prs (const Handle(Graphic3d_StructureManager)& aStructureMana
//purpose : //purpose :
//======================================================================= //=======================================================================
void PrsMgr_Prs::Compute()
{
myPresentation3d->Compute (this);
}
//=======================================================================
//function : Compute
//purpose :
//=======================================================================
Handle(Graphic3d_Structure) PrsMgr_Prs::Compute(const Handle(Graphic3d_DataStructureManager)& aProjector) { Handle(Graphic3d_Structure) PrsMgr_Prs::Compute(const Handle(Graphic3d_DataStructureManager)& aProjector) {
return myPresentation3d->Compute(aProjector); return myPresentation3d->Compute(aProjector);
} }

View File

@ -112,7 +112,7 @@ static Standard_Integer OCC328bug (Draw_Interpretor& di, Standard_Integer argc,
return 1; return 1;
} }
Standard_Boolean updateviewer = Standard_True, PutInCollector = Standard_True; Standard_Boolean updateviewer = Standard_True;
ViewerTest_DoubleMapOfInteractiveAndName& aMap = GetMapOfAIS(); ViewerTest_DoubleMapOfInteractiveAndName& aMap = GetMapOfAIS();
@ -137,7 +137,7 @@ static Standard_Integer OCC328bug (Draw_Interpretor& di, Standard_Integer argc,
aContext->ActivateStandardMode(AIS_Shape::SelectionType(ChoosingMode)); aContext->ActivateStandardMode(AIS_Shape::SelectionType(ChoosingMode));
theactivatedmodes.Add(ChoosingMode); theactivatedmodes.Add(ChoosingMode);
} }
aContext->Erase(AISObj, updateviewer, PutInCollector); aContext->Erase(AISObj, updateviewer);
aContext->UpdateCurrentViewer(); aContext->UpdateCurrentViewer();
aContext->Display(AISObj, updateviewer); aContext->Display(AISObj, updateviewer);
@ -405,7 +405,7 @@ static Standard_Integer OCC74bug_set (Draw_Interpretor& di, Standard_Integer arg
return 1; return 1;
} }
Standard_Boolean updateviewer = Standard_True, PutInCollector = Standard_True; Standard_Boolean updateviewer = Standard_True;
ViewerTest_DoubleMapOfInteractiveAndName& aMap = GetMapOfAIS(); ViewerTest_DoubleMapOfInteractiveAndName& aMap = GetMapOfAIS();
@ -427,7 +427,7 @@ static Standard_Integer OCC74bug_set (Draw_Interpretor& di, Standard_Integer arg
if (!aContext->HasOpenedContext()) { if (!aContext->HasOpenedContext()) {
aContext->OpenLocalContext(); aContext->OpenLocalContext();
} }
aContext->Erase(AISObj, updateviewer, PutInCollector); aContext->Erase(AISObj, updateviewer);
aContext->UpdateCurrentViewer(); aContext->UpdateCurrentViewer();
aContext->Display(AISObj, updateviewer); aContext->Display(AISObj, updateviewer);
aContext->UpdateCurrentViewer(); aContext->UpdateCurrentViewer();

View File

@ -1682,7 +1682,7 @@ static Standard_Integer OCC708 (Draw_Interpretor& di, Standard_Integer argc, con
return 1; return 1;
} }
Standard_Boolean updateviewer = Standard_True, PutInCollector = Standard_True; Standard_Boolean updateviewer = Standard_True;
ViewerTest_DoubleMapOfInteractiveAndName& aMap = GetMapOfAIS(); ViewerTest_DoubleMapOfInteractiveAndName& aMap = GetMapOfAIS();
@ -1702,7 +1702,7 @@ static Standard_Integer OCC708 (Draw_Interpretor& di, Standard_Integer argc, con
if (!aContext->HasOpenedContext()) { if (!aContext->HasOpenedContext()) {
aContext->OpenLocalContext(); aContext->OpenLocalContext();
} }
aContext->Erase(AISObj, updateviewer, PutInCollector); aContext->Erase(AISObj, updateviewer);
aContext->UpdateCurrentViewer(); aContext->UpdateCurrentViewer();
aContext->Display(AISObj, updateviewer); aContext->Display(AISObj, updateviewer);
aContext->UpdateCurrentViewer(); 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; return 0;
} }
@ -5282,9 +5270,9 @@ Standard_Integer CR23234 (Draw_Interpretor& di, Standard_Integer argc, const cha
{ {
aisContext->CloseAllContexts(); aisContext->CloseAllContexts();
aisContext->RemoveAll(false); 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(Geom_Axis2Placement) trihedronAxis = new Geom_Axis2Placement(gp::XOY());
Handle(AIS_Trihedron) trihedron = new AIS_Trihedron(trihedronAxis); Handle(AIS_Trihedron) trihedron = new AIS_Trihedron(trihedronAxis);
if (aMode) if (aMode)

View File

@ -873,7 +873,7 @@ static int VwrTst_DispErase(const Handle(AIS_InteractiveObject)& IO,
Ctx->Display(IO,Mode,Upd); Ctx->Display(IO,Mode,Upd);
break; break;
case 2:{ case 2:{
Ctx->Erase(IO,Mode,Upd); Ctx->Erase(IO,Upd);
break; break;
} }
case 3:{ case 3:{

View File

@ -145,6 +145,7 @@
#include <Prs3d_PointAspect.hxx> #include <Prs3d_PointAspect.hxx>
#include <Image_AlienPixMap.hxx> #include <Image_AlienPixMap.hxx>
#include <TColStd_HArray1OfAsciiString.hxx>
#ifdef HAVE_STRINGS_H #ifdef HAVE_STRINGS_H
#include <strings.h> #include <strings.h>
@ -2325,7 +2326,7 @@ protected:
Standard_Real aHeight; Standard_Real aHeight;
Standard_Boolean aZoomable; Standard_Boolean aZoomable;
Quantity_Color aColor; Quantity_Color aColor;
Standard_CString aFont; TCollection_AsciiString aFont;
Font_FontAspect aFontAspect; Font_FontAspect aFontAspect;
Graphic3d_HorizontalTextAlignment aHJustification; Graphic3d_HorizontalTextAlignment aHJustification;
Graphic3d_VerticalTextAlignment aVJustification; Graphic3d_VerticalTextAlignment aVJustification;
@ -2371,7 +2372,7 @@ void MyTextClass::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPresent
Handle_Prs3d_TextAspect asp = myDrawer->TextAspect(); Handle_Prs3d_TextAspect asp = myDrawer->TextAspect();
asp->SetFont(aFont); asp->SetFont(aFont.ToCString());
asp->SetColor(aColor); asp->SetColor(aColor);
asp->SetHeight(aHeight); // I am changing the myHeight value asp->SetHeight(aHeight); // I am changing the myHeight value
@ -2995,10 +2996,10 @@ class MyPArrayObject : public AIS_InteractiveObject
public: public:
MyPArrayObject (const Handle(Graphic3d_ArrayOfPrimitives) theArray, MyPArrayObject (Handle(TColStd_HArray1OfAsciiString) theArrayDescription,
Handle(Graphic3d_AspectMarker3d) theMarkerAspect = NULL) Handle(Graphic3d_AspectMarker3d) theMarkerAspect = NULL)
{ {
myArray = theArray; myArrayDescription = theArrayDescription;
myMarkerAspect = theMarkerAspect; myMarkerAspect = theMarkerAspect;
} }
@ -3013,9 +3014,15 @@ private:
void ComputeSelection (const Handle(SelectMgr_Selection)& theSelection, void ComputeSelection (const Handle(SelectMgr_Selection)& theSelection,
const Standard_Integer /*theMode*/); 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: protected:
Handle(Graphic3d_ArrayOfPrimitives) myArray; Handle(TColStd_HArray1OfAsciiString) myArrayDescription;
Handle(Graphic3d_AspectMarker3d) myMarkerAspect; Handle(Graphic3d_AspectMarker3d) myMarkerAspect;
}; };
@ -3027,12 +3034,165 @@ void MyPArrayObject::Compute (const Handle(PrsMgr_PresentationManager3d)& /*aPre
const Handle(Prs3d_Presentation)& aPresentation, const Handle(Prs3d_Presentation)& aPresentation,
const Standard_Integer /*aMode*/) const Standard_Integer /*aMode*/)
{ {
// 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 (anArgIndex < anArgsCount)
{
aCommand = myArrayDescription->Value (anArgIndex);
aCommand.LowerCase();
// vertex command
if (CheckInputCommand ("v", myArrayDescription, anArgIndex, 3, anArgsCount))
{
// vertex has a normal or normal with color or texel
if (CheckInputCommand ("n", myArrayDescription, anArgIndex, 3, anArgsCount))
hasNormals = Standard_True;
// vertex has a color
if (CheckInputCommand ("c", myArrayDescription, anArgIndex, 3, anArgsCount))
hasVColors = Standard_True;
// vertex has a texel
if (CheckInputCommand ("t", myArrayDescription, anArgIndex, 2, anArgsCount))
hasTexels = Standard_True;
aVertexNum++;
}
// bound command
else if (CheckInputCommand ("b", myArrayDescription, anArgIndex, 1, anArgsCount))
{
// bound has color
if (CheckInputCommand ("c", myArrayDescription, anArgIndex, 3, anArgsCount))
hasBColors = Standard_True;
aBoundNum++;
}
// edge command
else if (CheckInputCommand ("e", myArrayDescription, anArgIndex, 1, anArgsCount))
{
// edge has a hide flag
if (CheckInputCommand ("h", myArrayDescription, anArgIndex, 0, anArgsCount))
hasInfos = Standard_True;
aEdgeNum++;
}
// unknown command
else
anArgIndex++;
}
Handle(Graphic3d_ArrayOfPrimitives) anArray;
if (anArrayType == "points")
{
anArray = new Graphic3d_ArrayOfPoints (aVertexNum);
}
else if (anArrayType == "segments")
anArray = new Graphic3d_ArrayOfSegments (aVertexNum, aEdgeNum, hasVColors);
else if (anArrayType == "polylines")
anArray = new Graphic3d_ArrayOfPolylines (aVertexNum, aBoundNum, aEdgeNum,
hasVColors, hasBColors, hasInfos);
else if (anArrayType == "triangles")
anArray = new Graphic3d_ArrayOfTriangles (aVertexNum, aEdgeNum, hasNormals,
hasVColors, hasTexels, hasInfos);
else if (anArrayType == "trianglefans")
anArray = new Graphic3d_ArrayOfTriangleFans (aVertexNum, aBoundNum,
hasNormals, hasVColors,
hasBColors, hasTexels);
else if (anArrayType == "trianglestrips")
anArray = new Graphic3d_ArrayOfTriangleStrips (aVertexNum, aBoundNum,
hasNormals, hasVColors,
hasBColors, hasTexels);
else if (anArrayType == "quads")
anArray = new Graphic3d_ArrayOfQuadrangles (aVertexNum, aEdgeNum,
hasNormals, hasVColors,
hasTexels, hasInfos);
else if (anArrayType == "quadstrips")
anArray = new Graphic3d_ArrayOfQuadrangleStrips (aVertexNum, aBoundNum,
hasNormals, hasVColors,
hasBColors, hasTexels);
else if (anArrayType == "polygons")
anArray = new Graphic3d_ArrayOfPolygons (aVertexNum, aBoundNum, aEdgeNum,
hasNormals, hasVColors, hasBColors,
hasTexels, hasInfos);
anArgIndex = 1;
while (anArgIndex < anArgsCount)
{
aCommand = myArrayDescription->Value (anArgIndex);
aCommand.LowerCase();
if (!aCommand.IsAscii())
break;
// vertex command
if (CheckInputCommand ("v", myArrayDescription, anArgIndex, 3, anArgsCount))
{
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", myArrayDescription, anArgIndex, 3, anArgsCount))
anArray->SetVertexNormal (anArray->VertexNumber (),
myArrayDescription->Value (anArgIndex - 3).RealValue(),
myArrayDescription->Value (anArgIndex - 2).RealValue(),
myArrayDescription->Value (anArgIndex - 1).RealValue());
if (CheckInputCommand ("c", myArrayDescription, anArgIndex, 3, anArgsCount))
anArray->SetVertexColor (anArray->VertexNumber (),
myArrayDescription->Value (anArgIndex - 3).RealValue(),
myArrayDescription->Value (anArgIndex - 2).RealValue(),
myArrayDescription->Value (anArgIndex - 1).RealValue());
if (CheckInputCommand ("t", myArrayDescription, anArgIndex, 2, anArgsCount))
anArray->SetVertexTexel (anArray->VertexNumber (),
myArrayDescription->Value (anArgIndex - 2).RealValue(),
myArrayDescription->Value (anArgIndex - 1).RealValue());
}
// bounds command
else if (CheckInputCommand ("b", myArrayDescription, anArgIndex, 1, anArgsCount))
{
Standard_Integer aVertCount = myArrayDescription->Value (anArgIndex - 1).IntegerValue();
if (CheckInputCommand ("c", myArrayDescription, anArgIndex, 3, anArgsCount))
anArray->AddBound (aVertCount,
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", myArrayDescription, anArgIndex, 1, anArgsCount))
{
Standard_Integer aVertIndex = myArrayDescription->Value (anArgIndex - 1).IntegerValue();
// edge has/hasn't hide flag
if (CheckInputCommand ("h", myArrayDescription, anArgIndex, 0, anArgsCount))
anArray->AddEdge (aVertIndex, Standard_False);
else
anArray->AddEdge (aVertIndex, Standard_True);
}
// unknown command
else
anArgIndex++;
}
aPresentation->Clear(); aPresentation->Clear();
if (!myMarkerAspect.IsNull()) if (!myMarkerAspect.IsNull())
{ {
Prs3d_Root::CurrentGroup (aPresentation)->SetGroupPrimitivesAspect (myMarkerAspect); Prs3d_Root::CurrentGroup (aPresentation)->SetGroupPrimitivesAspect (myMarkerAspect);
} }
Prs3d_Root::CurrentGroup (aPresentation)->AddPrimitiveArray (myArray); Prs3d_Root::CurrentGroup (aPresentation)->AddPrimitiveArray (anArray);
} }
void MyPArrayObject::ComputeSelection (const Handle(SelectMgr_Selection)& theSelection, void MyPArrayObject::ComputeSelection (const Handle(SelectMgr_Selection)& theSelection,
@ -3040,23 +3200,35 @@ void MyPArrayObject::ComputeSelection (const Handle(SelectMgr_Selection)& theSel
{ {
Handle(SelectMgr_EntityOwner) anEntityOwner = new SelectMgr_EntityOwner (this); Handle(SelectMgr_EntityOwner) anEntityOwner = new SelectMgr_EntityOwner (this);
for (Standard_Integer anIter = 1; anIter <= myArray->VertexNumber(); anIter++) Standard_Integer anArgIndex = 1;
while (anArgIndex < myArrayDescription->Length())
{ {
if (CheckInputCommand ("v", myArrayDescription, anArgIndex, 3, myArrayDescription->Length()))
Handle(Select3D_SensitivePoint) aSensetivePoint = new Select3D_SensitivePoint (anEntityOwner, myArray->Vertice (anIter)); {
theSelection->Add (aSensetivePoint); 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++;
}
} }
} }
static bool CheckInputCommand (const TCollection_AsciiString theCommand, bool MyPArrayObject::CheckInputCommand (const TCollection_AsciiString theCommand,
const char **theArgStr, int &theArgIndex, const Handle(TColStd_HArray1OfAsciiString) theArgsArray,
int theArgCount, int theMaxArgs) Standard_Integer &theArgIndex,
Standard_Integer theArgCount,
Standard_Integer theMaxArgs)
{ {
// check if there is more elements than expected // check if there is more elements than expected
if (theArgIndex >= theMaxArgs) if (theArgIndex >= theMaxArgs)
return false; return false;
TCollection_AsciiString aStrCommand(theArgStr[theArgIndex]); TCollection_AsciiString aStrCommand = theArgsArray->Value (theArgIndex);
aStrCommand.LowerCase(); aStrCommand.LowerCase();
if (aStrCommand.Search(theCommand) != 1 || if (aStrCommand.Search(theCommand) != 1 ||
theArgIndex + (theArgCount - 1) >= theMaxArgs) theArgIndex + (theArgCount - 1) >= theMaxArgs)
@ -3068,7 +3240,7 @@ static bool CheckInputCommand (const TCollection_AsciiString theCommand,
// check data if it can be converted to numeric // check data if it can be converted to numeric
for (int aElement = 0; aElement < theArgCount; aElement++, theArgIndex++) for (int aElement = 0; aElement < theArgCount; aElement++, theArgIndex++)
{ {
aStrCommand = theArgStr[theArgIndex]; aStrCommand = theArgsArray->Value (theArgIndex);
if (!aStrCommand.IsRealValue()) if (!aStrCommand.IsRealValue())
return false; return false;
} }
@ -3107,17 +3279,30 @@ static int VDrawPArray (Draw_Interpretor& di, Standard_Integer argc, const char*
Standard_Integer aArgIndex = 1; Standard_Integer aArgIndex = 1;
TCollection_AsciiString aName (argv[aArgIndex++]); TCollection_AsciiString aName (argv[aArgIndex++]);
TCollection_AsciiString anArrayType (argv[aArgIndex++]); TCollection_AsciiString anArrayType (argv[aArgIndex++]);
const Standard_Integer anArgsFrom = aArgIndex;
// parse number of verticies, bounds, edges Standard_Boolean hasVertex = Standard_False;
Standard_Integer aVertexNum = 0, aBoundNum = 0, aEdgeNum = 0;
Standard_Boolean hasVColors, hasBColors, hasNormals, hasInfos, hasTexels; Handle(TColStd_HArray1OfAsciiString) anArgsArray = new TColStd_HArray1OfAsciiString (0, argc - 2);
hasVColors = hasNormals = hasBColors = hasInfos = hasTexels = Standard_False; 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; TCollection_AsciiString aCommand;
while (aArgIndex < argc) for (Standard_Integer anArgIndex = 3; anArgIndex < argc; anArgIndex++)
{ {
aCommand = argv[aArgIndex]; aCommand = argv[anArgIndex];
aCommand.LowerCase(); aCommand.LowerCase();
if (!aCommand.IsAscii()) if (!aCommand.IsAscii())
{ {
@ -3126,160 +3311,28 @@ static int VDrawPArray (Draw_Interpretor& di, Standard_Integer argc, const char*
break; break;
} }
// vertex command if (aCommand == "v")
if (CheckInputCommand ("v", argv, aArgIndex, 3, argc))
{ {
// vertex has a normal or normal with color or texel hasVertex = Standard_True;
if (CheckInputCommand ("n", argv, aArgIndex, 3, argc))
hasNormals = Standard_True;
// vertex has a color
if (CheckInputCommand ("c", argv, aArgIndex, 3, argc))
hasVColors = Standard_True;
// vertex has a texel
if (CheckInputCommand ("t", argv, aArgIndex, 2, argc))
hasTexels = Standard_True;
aVertexNum++;
} }
// bound command
else if (CheckInputCommand ("b", argv, aArgIndex, 1, argc))
{
// bound has color
if (CheckInputCommand ("c", argv, aArgIndex, 3, argc))
hasBColors = Standard_True;
aBoundNum++; anArgsArray->SetValue (anArgIndex - 2, aCommand);
}
// edge command
else if (CheckInputCommand ("e", argv, aArgIndex, 1, argc))
{
// edge has a hide flag
if (CheckInputCommand ("h", argv, aArgIndex, 0, argc))
hasInfos = Standard_True;
aEdgeNum++;
}
// unknown command
else
aArgIndex++;
} }
if (aVertexNum == 0) if (!hasVertex)
{ {
di << "You should pass any verticies in the list of array elements\n"; di << "You should pass any verticies in the list of array elements\n";
return 1; return 1;
} }
// create an array of primitives by types
Handle(Graphic3d_ArrayOfPrimitives) anArray;
Handle(Graphic3d_AspectMarker3d) anAspPoints; Handle(Graphic3d_AspectMarker3d) anAspPoints;
if (anArrayType == "points") if (anArrayType == "points")
{ {
anArray = new Graphic3d_ArrayOfPoints (aVertexNum);
anAspPoints = new Graphic3d_AspectMarker3d (Aspect_TOM_POINT, Quantity_NOC_YELLOW, 1.0f); anAspPoints = new Graphic3d_AspectMarker3d (Aspect_TOM_POINT, Quantity_NOC_YELLOW, 1.0f);
} }
else if (anArrayType == "segments")
anArray = new Graphic3d_ArrayOfSegments (aVertexNum, aEdgeNum, hasVColors);
else if (anArrayType == "polylines")
anArray = new Graphic3d_ArrayOfPolylines (aVertexNum, aBoundNum, aEdgeNum,
hasVColors, hasBColors, hasInfos);
else if (anArrayType == "triangles")
anArray = new Graphic3d_ArrayOfTriangles (aVertexNum, aEdgeNum, hasNormals,
hasVColors, hasTexels, hasInfos);
else if (anArrayType == "trianglefans")
anArray = new Graphic3d_ArrayOfTriangleFans (aVertexNum, aBoundNum,
hasNormals, hasVColors,
hasBColors, hasTexels);
else if (anArrayType == "trianglestrips")
anArray = new Graphic3d_ArrayOfTriangleStrips (aVertexNum, aBoundNum,
hasNormals, hasVColors,
hasBColors, hasTexels);
else if (anArrayType == "quads")
anArray = new Graphic3d_ArrayOfQuadrangles (aVertexNum, aEdgeNum,
hasNormals, hasVColors,
hasTexels, hasInfos);
else if (anArrayType == "quadstrips")
anArray = new Graphic3d_ArrayOfQuadrangleStrips (aVertexNum, aBoundNum,
hasNormals, hasVColors,
hasBColors, hasTexels);
else if (anArrayType == "polygons")
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)
{
aCommand = argv[aArgIndex];
aCommand.LowerCase();
if (!aCommand.IsAscii())
break;
// vertex command
if (CheckInputCommand ("v", argv, aArgIndex, 3, argc))
{
anArray->AddVertex (Draw::Atof (argv[aArgIndex - 3]),
Draw::Atof (argv[aArgIndex - 2]),
Draw::Atof (argv[aArgIndex - 1]));
// vertex has a normal or normal with color or texel
if (CheckInputCommand ("n", argv, aArgIndex, 3, argc))
anArray->SetVertexNormal (anArray->VertexNumber (),
Draw::Atof (argv[aArgIndex - 3]),
Draw::Atof (argv[aArgIndex - 2]),
Draw::Atof (argv[aArgIndex - 1]));
if (CheckInputCommand ("c", argv, aArgIndex, 3, argc))
anArray->SetVertexColor (anArray->VertexNumber (),
Draw::Atof (argv[aArgIndex - 3]),
Draw::Atof (argv[aArgIndex - 2]),
Draw::Atof (argv[aArgIndex - 1]));
if (CheckInputCommand ("t", argv, aArgIndex, 2, argc))
anArray->SetVertexTexel (anArray->VertexNumber (),
Draw::Atof (argv[aArgIndex - 2]),
Draw::Atof (argv[aArgIndex - 1]));
}
// bounds command
else if (CheckInputCommand ("b", argv, aArgIndex, 1, argc))
{
Standard_Integer aVertCount = Draw::Atoi (argv[aArgIndex - 1]);
if (CheckInputCommand ("c", argv, aArgIndex, 3, argc))
anArray->AddBound (aVertCount,
Draw::Atof (argv[aArgIndex - 3]),
Draw::Atof (argv[aArgIndex - 2]),
Draw::Atof (argv[aArgIndex - 1]));
else
anArray->AddBound (aVertCount);
}
// edge command
else if (CheckInputCommand ("e", argv, aArgIndex, 1, argc))
{
Standard_Integer aVertIndex = Draw::Atoi (argv[aArgIndex - 1]);
// edge has/hasn't hide flag
if (CheckInputCommand ("h", argv, aArgIndex, 0, argc))
anArray->AddEdge (aVertIndex, Standard_False);
else
anArray->AddEdge (aVertIndex, Standard_True);
}
// unknown command
else
aArgIndex++;
}
// create primitives array object // create primitives array object
Handle(MyPArrayObject) aPObject = new MyPArrayObject (anArray, anAspPoints); Handle(MyPArrayObject) aPObject = new MyPArrayObject (anArgsArray, anAspPoints);
// register the object in map // register the object in map
VDisplayAISObject (aName, aPObject); VDisplayAISObject (aName, aPObject);
@ -4440,6 +4493,105 @@ static Standard_Integer VShowFaceBoundary (Draw_Interpretor& /*di*/,
return 0; 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 //function : VMarkersTest
//purpose : Draws an array of markers for testing purposes. //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); 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); Handle(ViewerTest_MarkersArrayObject) aMarkersArray = new ViewerTest_MarkersArrayObject (aPnt, aPointsOnSide, anAspect);
if (aPointsOnSide == 1) VDisplayAISObject (aName, aMarkersArray);
{
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);
return 0; return 0;
} }

View File

@ -601,7 +601,7 @@ TCollection_AsciiString ViewerTest::ViewerInit (const Standard_Integer thePxLeft
} }
// Create viewer // Create viewer
Handle(V3d_Viewer) a3DViewer, a3DCollector; Handle(V3d_Viewer) a3DViewer;
// If it's the single view, we first look for empty context // If it's the single view, we first look for empty context
if (ViewerTest_myViews.IsEmpty() && !ViewerTest_myContexts.IsEmpty()) if (ViewerTest_myViews.IsEmpty() && !ViewerTest_myContexts.IsEmpty())
{ {
@ -610,25 +610,21 @@ TCollection_AsciiString ViewerTest::ViewerInit (const Standard_Integer thePxLeft
if (anIter.More()) if (anIter.More())
ViewerTest::SetAISContext (anIter.Value()); ViewerTest::SetAISContext (anIter.Value());
a3DViewer = ViewerTest::GetAISContext()->CurrentViewer(); a3DViewer = ViewerTest::GetAISContext()->CurrentViewer();
a3DCollector= ViewerTest::GetAISContext()->Collector();
} }
else if (ViewerTest_myContexts.IsBound1(aViewNames.GetViewerName())) else if (ViewerTest_myContexts.IsBound1(aViewNames.GetViewerName()))
{ {
ViewerTest::SetAISContext(ViewerTest_myContexts.Find1(aViewNames.GetViewerName())); ViewerTest::SetAISContext(ViewerTest_myContexts.Find1(aViewNames.GetViewerName()));
a3DViewer = ViewerTest::GetAISContext()->CurrentViewer(); a3DViewer = ViewerTest::GetAISContext()->CurrentViewer();
a3DCollector= ViewerTest::GetAISContext()->Collector();
} }
else if (a3DViewer.IsNull() || a3DCollector.IsNull()) else if (a3DViewer.IsNull())
{ {
toCreateViewer = Standard_True; toCreateViewer = Standard_True;
TCollection_ExtendedString NameOfWindow("Viewer3D"); TCollection_ExtendedString NameOfWindow("Viewer3D");
a3DViewer = new V3d_Viewer(aGraphicDriver, NameOfWindow.ToExtString()); a3DViewer = new V3d_Viewer(aGraphicDriver, NameOfWindow.ToExtString());
NameOfWindow = TCollection_ExtendedString("Collector"); NameOfWindow = TCollection_ExtendedString("Collector");
a3DCollector = new V3d_Viewer(aGraphicDriver, NameOfWindow.ToExtString());
a3DViewer->SetDefaultBackgroundColor(Quantity_NOC_BLACK); a3DViewer->SetDefaultBackgroundColor(Quantity_NOC_BLACK);
a3DCollector->SetDefaultBackgroundColor(Quantity_NOC_STEELBLUE);
} }
// AIS context setup // AIS context setup
@ -636,7 +632,7 @@ TCollection_AsciiString ViewerTest::ViewerInit (const Standard_Integer thePxLeft
!(ViewerTest_myContexts.IsBound1(aViewNames.GetViewerName()))) !(ViewerTest_myContexts.IsBound1(aViewNames.GetViewerName())))
{ {
Handle(AIS_InteractiveContext) aContext = Handle(AIS_InteractiveContext) aContext =
new AIS_InteractiveContext(a3DViewer, a3DCollector); new AIS_InteractiveContext(a3DViewer);
ViewerTest::SetAISContext (aContext); ViewerTest::SetAISContext (aContext);
ViewerTest_myContexts.Bind (aViewNames.GetViewerName(), ViewerTest::GetAISContext()); ViewerTest_myContexts.Bind (aViewNames.GetViewerName(), ViewerTest::GetAISContext());
} }
@ -707,7 +703,6 @@ TCollection_AsciiString ViewerTest::ViewerInit (const Standard_Integer thePxLeft
aView.Nullify(); aView.Nullify();
a3DViewer.Nullify(); a3DViewer.Nullify();
a3DCollector.Nullify();
return aViewNames.GetViewName(); return aViewNames.GetViewName();
} }
@ -4526,16 +4521,11 @@ static Standard_Integer VPurgeDisplay (Draw_Interpretor& di,
Standard_Integer argc, Standard_Integer argc,
const char ** argv) const char ** argv)
{ {
if (argc > 2) if (argc > 1)
{ {
di << "Usage : " << argv[0] << " [CollectorToo = 0|1]" << "\n"; di << "Usage : " << argv[0] << "\n";
return 1; return 1;
} }
Standard_Boolean isCollectorToo = Standard_False;
if (argc == 2)
{
isCollectorToo = (atoi(argv [1]) != 0);
}
Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext(); Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
if (aContext.IsNull()) if (aContext.IsNull())
{ {
@ -4543,7 +4533,7 @@ static Standard_Integer VPurgeDisplay (Draw_Interpretor& di,
return 1; return 1;
} }
aContext->CloseAllContexts(Standard_False); aContext->CloseAllContexts(Standard_False);
di << aContext->PurgeDisplay(isCollectorToo) << "\n"; di << aContext->PurgeDisplay() << "\n";
return 0; return 0;
} }
@ -5451,7 +5441,7 @@ void ViewerTest::ViewerCommands(Draw_Interpretor& theCommands)
"vantialiasing 1|0", "vantialiasing 1|0",
__FILE__,VAntialiasing,group); __FILE__,VAntialiasing,group);
theCommands.Add ("vpurgedisplay", theCommands.Add ("vpurgedisplay",
"vpurgedisplay [CollectorToo = 0|1]" "vpurgedisplay"
"- removes structures which don't belong to objects displayed in neutral point", "- removes structures which don't belong to objects displayed in neutral point",
__FILE__, VPurgeDisplay, group); __FILE__, VPurgeDisplay, group);
theCommands.Add("vsetviewsize", theCommands.Add("vsetviewsize",

View File

@ -1777,6 +1777,12 @@ void Visual3d_View::Update (const Handle(Visual3d_Layer)& AnUnderLayer, const Ha
if (! MyWindow->IsMapped ()) return; if (! MyWindow->IsMapped ()) return;
if (MyGraphicDriver->IsDeviceLost())
{
MyViewManager->ReComputeStructures();
MyGraphicDriver->ResetDeviceLostFlag();
}
// If activation/desactivation of ZBuffer should be automatic // If activation/desactivation of ZBuffer should be automatic
// depending on the presence or absence of facets. // depending on the presence or absence of facets.
if (MyViewManager->ZBufferAuto ()) { if (MyViewManager->ZBufferAuto ()) {
@ -1999,41 +2005,14 @@ void Visual3d_View::Display (const Handle(Graphic3d_Structure)& AStructure, cons
Standard_Integer Index = IsComputed (AStructure); Standard_Integer Index = IsComputed (AStructure);
if ((Index != 0) && (AStructure->Visual () != Graphic3d_TOS_COMPUTED)) { 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); MyTOCOMPUTESequence.Remove (Index);
MyCOMPUTEDSequence.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; Index = 0;
} }
Visual3d_TypeOfAnswer Answer = AcceptDisplay (AStructure); 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) { if (Answer == Visual3d_TOA_NO) {
#ifdef TRACE_DISPLAY
cout << "Answer : Visual3d_TOA_NO\n";
cout << flush;
#endif
return; return;
} }
@ -2043,10 +2022,6 @@ Standard_Integer Index = IsComputed (AStructure);
} }
if (Answer == Visual3d_TOA_YES ) { if (Answer == Visual3d_TOA_YES ) {
#ifdef TRACE_DISPLAY
cout << "Answer : Visual3d_TOA_YES\n";
cout << flush;
#endif
if (IsDisplayed (AStructure)) return; if (IsDisplayed (AStructure)) return;
MyGraphicDriver->DisplayStructure ( MyGraphicDriver->DisplayStructure (
MyCView, MyCView,
@ -2058,32 +2033,8 @@ Standard_Integer Index = IsComputed (AStructure);
} }
if (Answer == Visual3d_TOA_COMPUTE) { if (Answer == Visual3d_TOA_COMPUTE) {
#ifdef TRACE_DISPLAY
cout << "Answer : Visual3d_TOA_COMPUTE\n";
cout << "Index : " << Index << "\n" << flush;
#endif
if (Index != 0) { if (Index != 0) {
// Already computed, is COMPUTED still valid? // 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 = Standard_Integer OldStructId =
MyCOMPUTEDSequence.Value (Index)->Identification (); MyCOMPUTEDSequence.Value (Index)->Identification ();
@ -2175,37 +2126,16 @@ Standard_Integer ii, jj;
#endif #endif
TheStructure->SetHLRValidation (Standard_True); 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 // TOCOMPUTE and COMPUTED associated to sequences are added
MyTOCOMPUTESequence.Append (AStructure); MyTOCOMPUTESequence.Append (AStructure);
MyCOMPUTEDSequence.Append (TheStructure); 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 // The previous are removed if necessary
if (Index != 0) { if (Index != 0) {
MyTOCOMPUTESequence.Remove (Index); MyTOCOMPUTESequence.Remove (Index);
MyCOMPUTEDSequence.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 // Return type of visualisation of the view
Visual3d_TypeOfVisualization ViewType = MyContext.Visualization (); Visual3d_TypeOfVisualization ViewType = MyContext.Visualization ();
@ -2231,18 +2161,6 @@ Standard_Boolean ComputeShading = ((ViewType == Visual3d_TOV_SHADING) &&
TheStructure->GraphicHighlight (Aspect_TOHM_COLOR); 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 // It is displayed only if the calculated structure
// has a proper type corresponding to the one of the view. // has a proper type corresponding to the one of the view.
if (Answer != Visual3d_TOA_NO) { if (Answer != Visual3d_TOA_NO) {
@ -2533,6 +2451,11 @@ void Visual3d_View::MinMaxValues (const Graphic3d_MapOfStructure& ASet, Standard
Iterator.More (); Iterator.More ();
Iterator.Next ()) { Iterator.Next ()) {
if (!Iterator.Key()->IsVisible())
{
continue;
}
if ( (Iterator.Key ())->IsInfinite ()){ if ( (Iterator.Key ())->IsInfinite ()){
//XMin, YMin .... ZMax are initialized by means of infinite line data //XMin, YMin .... ZMax are initialized by means of infinite line data
(Iterator.Key ())->MinMaxValues (Xm, Ym, Zm, XM, YM, ZM); (Iterator.Key ())->MinMaxValues (Xm, Ym, Zm, XM, YM, ZM);

View File

@ -141,7 +141,6 @@ void Visual3d_ViewManager::Remove () {
// clear all structures whilst views are alive for correct GPU memory management // clear all structures whilst views are alive for correct GPU memory management
MyDisplayedStructure.Clear(); MyDisplayedStructure.Clear();
MyHighlightedStructure.Clear(); MyHighlightedStructure.Clear();
MyVisibleStructure.Clear();
MyPickStructure.Clear(); MyPickStructure.Clear();
// clear list of managed views // clear list of managed views
@ -317,7 +316,6 @@ void Visual3d_ViewManager::Erase (const Handle(Graphic3d_Structure)& AStructure)
} }
MyHighlightedStructure.Remove (AStructure); MyHighlightedStructure.Remove (AStructure);
MyVisibleStructure.Remove (AStructure);
MyPickStructure.Remove (AStructure); MyPickStructure.Remove (AStructure);
} }

View File

@ -12,9 +12,8 @@ vinit
vdisplay b b2 vdisplay b b2
vfit vfit
verase b verase b
set CollectorToo 1
if [catch {vpurgedisplay $CollectorToo} result] { if [catch {vpurgedisplay} result] {
puts "Faulty OCC2066" puts "Faulty OCC2066"
} else { } else {
puts "OK OCC2066" puts "OK OCC2066"

View File

@ -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