mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0024637: Visualization - clean up implementation of rendering in immediate mode
Remove unused flag "DoubleBuf". Remove Visual3d_TransientManager "class" (functionality moved to PrsMgr_PresentationManager). Remove unused "Add" immediate mode. V3d_View class - remove methods ::TransientManagerBeginDraw(), ::TransientManagerClearDraw(), ::TransientManagerBeginAddDraw(). Add method ::RedrawImmediate() to redraw only immediate presentations. OpenGl_GraphicDriver - add methods ::DisplayImmediateStructure(), ::EraseImmediateStructure(), ::RedrawImmediate(). OpenGl_View - manage list of immediate structures. OpenGl_Workspace - automate rendering workflow of immediate + persistent layers. Merge PrsMgr_PresentationManager3d class into PrsMgr_PresentationManager. Mark PrsMgr_PresentationManager3d as alias to PrsMgr_PresentationManager to simplify porting. Prs3d_Presentation - remove unused field myStruct. Prs3d_PresentationShadow - shadow link to existing presentation with custom attributes. Graphic3d_Structure::Highlight() - do not register undisplayed structure in structure manager. AIS_InteractiveContext, AIS_LocalContext add flag to prevent view update into methods ::MoveTo(), ::HilightNextDetected(), ::HilightPreviousDetected() to allow update of customized immediate structures before redraw but after ::MoveTo(). Remove unused method AIS_InteractiveContext::Drag(). StdSelect_ViewerSelector3d do not user immediate mode in methods ::DisplayAreas(), ::ClearAreas(), ::ClearSensitive(), ::DisplaySensitive(), GridEcho - update value in StdSelect_ViewerSelector3d::Pick() instead of V3d_View::Compute(). Do not use global variable for GridEcho vertex. Redraw immediate mode not within GridEcho but at AIS_InteractiveContext, AIS_LocalContext layer. V3d_View::ToPixMap() - disable autoupdate during FitAll. Avoid Redraw() into FBO without ImmediateModeDrawToFront flag. PrsMgr_PresentationManager stores list of temporary immediate presentations, automatically cleared within BeginImmediateMode() call. Methods with ambiguous names have been renamed (new names now consistent with pre-existed method names in AIS_LocalContext class): - BeginDraw -> BeginImmediateDraw - EndDraw -> EndImmediateDraw Remove now useless Remove() method (and ImmediateRemove() in AIS). Visual3d_View now stores map of displayed immediate presentations. ViewerTest_EventManager - eliminate double redraw in selection methods. Fix warning
This commit is contained in:
@@ -25,7 +25,6 @@
|
||||
-- GG : 25/05/00 BUC60688 Add SetSensitivity() methods
|
||||
-- VSV : 22/05/01 Add Selection by polygon
|
||||
-- SAV : Add DisplayFromCollector() method
|
||||
-- GG : IMP150501 CADPAK_V2 Add Drag() method
|
||||
-- ZSV : IMP160701 Add InitDetected(),MoreDetected(),NextDetected(),
|
||||
-- DetectedCurrentShape(),DetectedCurrentObject()
|
||||
-- methods
|
||||
@@ -1090,20 +1089,23 @@ is
|
||||
|
||||
---Category: GRAPHIC DETECTION / SELECTION
|
||||
|
||||
|
||||
MoveTo(me:mutable;XPix,YPix:Integer from Standard;aView:View from V3d)
|
||||
MoveTo (me : mutable;
|
||||
theXPix, theYPix : Integer from Standard;
|
||||
theView : View from V3d;
|
||||
theToRedrawOnUpdate : Boolean from Standard = Standard_True)
|
||||
returns StatusOfDetection from AIS;
|
||||
---Purpose: Relays mouse position in pixels XPix and YPix to the
|
||||
-- interactive context selectors. This is done by the view
|
||||
-- aView passing this position to the main viewer and updating it.
|
||||
-- Functions in both Neutral Point and local contexts.
|
||||
|
||||
---Purpose: Relays mouse position in pixels theXPix and theYPix to the interactive context selectors.
|
||||
-- This is done by the view theView passing this position to the main viewer and updating it.
|
||||
-- Functions in both Neutral Point and local contexts.
|
||||
-- If theToRedrawOnUpdate is set to false, callee should call RedrawImmediate() to highlight detected object.
|
||||
|
||||
HasNextDetected(me) returns Boolean from Standard;
|
||||
---Purpose: returns True if other entities were detected in the
|
||||
-- last mouse detection
|
||||
|
||||
HilightNextDetected(me:mutable;aView:View from V3d)
|
||||
HilightNextDetected (me : mutable;
|
||||
theView : View from V3d;
|
||||
theToRedrawImmediate : Boolean from Standard = Standard_True)
|
||||
returns Integer from Standard;
|
||||
---Purpose: if more than 1 object is detected by the selector,
|
||||
-- only the "best" owner is hilighted at the mouse position.
|
||||
@@ -1116,7 +1118,9 @@ is
|
||||
-- have been hilighted , the next call will hilight
|
||||
-- the first one again
|
||||
|
||||
HilightPreviousDetected(me:mutable;aView:View from V3d)
|
||||
HilightPreviousDetected (me : mutable;
|
||||
theView : View from V3d;
|
||||
theToRedrawImmediate : Boolean from Standard = Standard_True)
|
||||
returns Integer from Standard;
|
||||
---Purpose: Same as previous methods in reverse direction...
|
||||
|
||||
@@ -1633,52 +1637,31 @@ is
|
||||
-- 4.EndImmediateDraw() draws all the stored objects...
|
||||
--
|
||||
|
||||
BeginImmediateDraw (me:mutable) returns Boolean from Standard;
|
||||
BeginImmediateDraw (me : mutable)
|
||||
returns Boolean from Standard;
|
||||
---Purpose: initializes the list of presentations to be displayed
|
||||
-- returns False if No Local COnte
|
||||
|
||||
ImmediateAdd (me:mutable;anIObj:InteractiveObject from AIS;aMode:Integer from Standard=0)
|
||||
ImmediateAdd (me : mutable;
|
||||
theObj : InteractiveObject from AIS;
|
||||
theMode : Integer from Standard = 0)
|
||||
returns Boolean from Standard;
|
||||
---Purpose: returns True if <anIObj> has been stored in the list.
|
||||
|
||||
ImmediateRemove (me:mutable;anIObj:InteractiveObject from AIS;aMode:Integer from Standard=0)
|
||||
returns Boolean from Standard;
|
||||
---Purpose: returns True if <anIObj> has been removed from the list.
|
||||
|
||||
EndImmediateDraw(me:mutable;aView : View from V3d;DoubleBuf:Boolean from Standard=Standard_False)
|
||||
EndImmediateDraw (me : mutable;
|
||||
theView : View from V3d)
|
||||
returns Boolean from Standard;
|
||||
---Purpose: returns True if the immediate display has been done.
|
||||
EndImmediateDraw(me:mutable;DoubleBuf:Boolean from Standard=Standard_False)
|
||||
|
||||
EndImmediateDraw (me : mutable)
|
||||
returns Boolean from Standard;
|
||||
---Purpose: Uses the First Active View of Main Viewer!!!
|
||||
---Purpose: Uses the First Active View of Main Viewer!
|
||||
-- returns True if the immediate display has been done.
|
||||
|
||||
IsImmediateModeOn(me) returns Boolean from Standard;
|
||||
|
||||
Drag ( me : mutable;
|
||||
aView: View from V3d;
|
||||
anObject: InteractiveObject from AIS;
|
||||
aTranformation: Transformation from Geom;
|
||||
postConcatenate: Boolean from Standard = Standard_False;
|
||||
update: Boolean from Standard = Standard_False;
|
||||
zBuffer: Boolean from Standard = Standard_False)
|
||||
is static;
|
||||
---Level: Public
|
||||
---Purpose: Transforms the current presentation of the object <anObject>
|
||||
-- using the transient graphic space of the view <aView> in
|
||||
-- immediat mode graphics.
|
||||
---Warning: When <update> is TRUE, then the view is redrawn with ALL
|
||||
-- transformed presentations.
|
||||
-- When <zBuffer> is TRUE all transient graphic are drawn
|
||||
-- using zbuffer activity.
|
||||
-- Note that when <update> is TRUE the view is cleared and redrawn
|
||||
-- and soforth the Z buffer is always activated therefore the <zBuffer>
|
||||
-- parameter is ignored in this case.
|
||||
|
||||
|
||||
---Category: Activation/Deactivation of Selection Modes.
|
||||
|
||||
|
||||
SetAutomaticHilight(me:mutable;aStatus:Boolean);
|
||||
---Purpose:
|
||||
-- Sets the highlighting status aStatus of detected and
|
||||
|
@@ -21,12 +21,6 @@
|
||||
|
||||
#define BUC60814 //GG_300101 Idem UKI60826
|
||||
|
||||
#define IMP150501 //GG_150501 CADPAK_V2 Add Drag() method
|
||||
|
||||
#define IMP160701 //ZSV Add InitDetected(),MoreDetected(),NextDetected(),
|
||||
// DetectedCurrentShape(),DetectedCurrentObject()
|
||||
// methods
|
||||
|
||||
#define OCC138 //VTN Avoding infinit loop in AddOrRemoveCurrentObject method.
|
||||
|
||||
#define OCC9657
|
||||
@@ -42,6 +36,8 @@
|
||||
#include <AIS_GlobalStatus.hxx>
|
||||
#include <AIS_Shape.hxx>
|
||||
|
||||
#include <Aspect_Grid.hxx>
|
||||
|
||||
#include <V3d_Light.hxx>
|
||||
#include <V3d_PositionalLight.hxx>
|
||||
#include <V3d_SpotLight.hxx>
|
||||
@@ -52,10 +48,7 @@
|
||||
#include <SelectMgr_Selection.hxx>
|
||||
#include <SelectBasics_SensitiveEntity.hxx>
|
||||
|
||||
#ifdef IMP150501
|
||||
#include <Visual3d_TransientManager.hxx>
|
||||
#include <Prs3d_Presentation.hxx>
|
||||
#endif
|
||||
|
||||
#ifdef OCC9657
|
||||
#include <AIS_MapOfInteractive.hxx>
|
||||
@@ -128,81 +121,66 @@ static void InfoOnLight(const Handle(V3d_View) aView)
|
||||
}
|
||||
#endif
|
||||
*/
|
||||
|
||||
//=======================================================================
|
||||
//function : MoveTo
|
||||
//purpose :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
AIS_StatusOfDetection AIS_InteractiveContext::MoveTo(const Standard_Integer XPix,
|
||||
const Standard_Integer YPix,
|
||||
const Handle(V3d_View)& aView)
|
||||
AIS_StatusOfDetection AIS_InteractiveContext::MoveTo (const Standard_Integer theXPix,
|
||||
const Standard_Integer theYPix,
|
||||
const Handle(V3d_View)& theView,
|
||||
const Standard_Boolean theToRedrawOnUpdate)
|
||||
{
|
||||
if(HasOpenedContext()){
|
||||
if (HasOpenedContext())
|
||||
{
|
||||
myWasLastMain = Standard_True;
|
||||
return myLocalContexts(myCurLocalIndex)->MoveTo(XPix,YPix,aView);
|
||||
return myLocalContexts (myCurLocalIndex)->MoveTo (theXPix, theYPix, theView, theToRedrawOnUpdate);
|
||||
}
|
||||
|
||||
#ifdef IMP160701
|
||||
//Nullify class members storing information about detected AIS objects.
|
||||
myAISCurDetected = 0;
|
||||
myAISDetectedSeq.Clear();
|
||||
#endif
|
||||
|
||||
// OCC11904 - local variables made non-static - it looks and works better like this
|
||||
Handle (PrsMgr_PresentationManager3d) pmgr ;
|
||||
Handle (StdSelect_ViewerSelector3d) selector;
|
||||
Standard_Boolean ismain = Standard_True,UpdVwr = Standard_False;
|
||||
|
||||
// Preliminaires
|
||||
if(aView->Viewer()== myMainVwr) {
|
||||
pmgr = myMainPM;
|
||||
selector=myMainSel;
|
||||
myLastPicked = myLastinMain;
|
||||
myWasLastMain = Standard_True;
|
||||
}
|
||||
else
|
||||
if (theView->Viewer() != myMainVwr)
|
||||
{
|
||||
return AIS_SOD_Error;
|
||||
|
||||
AIS_StatusOfDetection TheStat(AIS_SOD_Nothing);
|
||||
|
||||
|
||||
// allonzy
|
||||
selector->Pick(XPix, YPix, aView);
|
||||
|
||||
#ifdef IMP160701
|
||||
//filling of myAISDetectedSeq sequence storing information about detected AIS objects
|
||||
// (the objects must be AIS_Shapes).
|
||||
Handle(SelectMgr_EntityOwner) anEntityOwner;
|
||||
const Standard_Integer NbDetected = selector->NbPicked();
|
||||
for(Standard_Integer i_detect = 1;i_detect<=NbDetected;i_detect++)
|
||||
{
|
||||
anEntityOwner = selector->Picked(i_detect);
|
||||
if(!anEntityOwner.IsNull())
|
||||
if(myFilters->IsOk(anEntityOwner))
|
||||
{
|
||||
Handle(AIS_InteractiveObject) anObj =
|
||||
Handle(AIS_InteractiveObject)::DownCast(anEntityOwner->Selectable());
|
||||
if(!Handle(AIS_Shape)::DownCast(anObj).IsNull())
|
||||
myAISDetectedSeq.Append(anObj);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
selector->Init();
|
||||
if ( selector->More() )
|
||||
// preliminaires
|
||||
myLastPicked = myLastinMain;
|
||||
myWasLastMain = Standard_True;
|
||||
AIS_StatusOfDetection aStatus = AIS_SOD_Nothing;
|
||||
Standard_Boolean toUpdateViewer = Standard_False;
|
||||
|
||||
// allonzy
|
||||
myMainSel->Pick (theXPix, theYPix, theView);
|
||||
|
||||
// filling of myAISDetectedSeq sequence storing information about detected AIS objects
|
||||
// (the objects must be AIS_Shapes)
|
||||
const Standard_Integer aDetectedNb = myMainSel->NbPicked();
|
||||
for (Standard_Integer aDetIter = 1; aDetIter <= aDetectedNb; ++aDetIter)
|
||||
{
|
||||
if ( HasOpenedContext() )
|
||||
Handle(SelectMgr_EntityOwner) anOwner = myMainSel->Picked (aDetIter);
|
||||
if (anOwner.IsNull()
|
||||
|| !myFilters->IsOk (anOwner))
|
||||
{
|
||||
if ( !myFilters->IsOk( selector->OnePicked() ) )
|
||||
return AIS_SOD_AllBad;
|
||||
else
|
||||
if ( !myLocalContexts( myCurLocalIndex )->Filter()->IsOk( selector->OnePicked() ) )
|
||||
return AIS_SOD_AllBad;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Does nothing if previously detected object is equal to the current one
|
||||
if ( selector->OnePicked()->Selectable() == myLastPicked )
|
||||
|
||||
Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable());
|
||||
if (!Handle(AIS_Shape)::DownCast (anObj).IsNull())
|
||||
{
|
||||
myAISDetectedSeq.Append (anObj);
|
||||
}
|
||||
}
|
||||
|
||||
myMainSel->Init();
|
||||
if (myMainSel->More())
|
||||
{
|
||||
// does nothing if previously detected object is equal to the current one
|
||||
if (myMainSel->OnePicked()->Selectable() == myLastPicked)
|
||||
{
|
||||
return AIS_SOD_OnlyOneDetected;
|
||||
}
|
||||
|
||||
// Previously detected object is unhilighted if it is not selected or hilighted
|
||||
// with selection color if it is selected. Such highlighting with selection color
|
||||
@@ -211,69 +189,77 @@ AIS_StatusOfDetection AIS_InteractiveContext::MoveTo(const Standard_Integer XPix
|
||||
// method call. As result it is necessary to rehighligt it with mySelectionColor.
|
||||
if (!myLastPicked.IsNull())
|
||||
{
|
||||
Standard_Integer aHiMod = myLastPicked->HasHilightMode() ? myLastPicked->HilightMode() : 0;
|
||||
const Standard_Integer aHiMod = myLastPicked->HasHilightMode() ? myLastPicked->HilightMode() : 0;
|
||||
if (myLastPicked->State() != 1)
|
||||
{
|
||||
pmgr->Unhighlight (myLastPicked, aHiMod);
|
||||
UpdVwr = Standard_True;
|
||||
myMainPM->Unhighlight (myLastPicked, aHiMod);
|
||||
toUpdateViewer = Standard_True;
|
||||
}
|
||||
else if (myToHilightSelected)
|
||||
{
|
||||
pmgr->Color (myLastPicked, mySelectionColor, aHiMod);
|
||||
UpdVwr = Standard_True;
|
||||
myMainPM->Color (myLastPicked, mySelectionColor, aHiMod);
|
||||
toUpdateViewer = Standard_True;
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize myLastPicked field with currently detected object
|
||||
myLastPicked = Handle(AIS_InteractiveObject)::DownCast (selector->OnePicked()->Selectable());
|
||||
// initialize myLastPicked field with currently detected object
|
||||
myLastPicked = Handle(AIS_InteractiveObject)::DownCast (myMainSel->OnePicked()->Selectable());
|
||||
myLastinMain = myLastPicked;
|
||||
|
||||
if ( ismain )
|
||||
myLastinMain = myLastPicked;
|
||||
|
||||
// Highlight detected object if it is not selected or myToHilightSelected flag is true
|
||||
if (!myLastPicked.IsNull()
|
||||
&& (myLastPicked->State()!= 1 || myToHilightSelected))
|
||||
// highlight detected object if it is not selected or myToHilightSelected flag is true
|
||||
if (!myLastPicked.IsNull())
|
||||
{
|
||||
Standard_Integer aHiMod = myLastPicked->HasHilightMode() ? myLastPicked->HilightMode() : 0;
|
||||
pmgr->Color (myLastPicked, myHilightColor, aHiMod);
|
||||
UpdVwr = Standard_True;
|
||||
}
|
||||
if (myLastPicked->State() != 1 || myToHilightSelected)
|
||||
{
|
||||
const Standard_Integer aHiMod = myLastPicked->HasHilightMode() ? myLastPicked->HilightMode() : 0;
|
||||
myMainPM->Color (myLastPicked, myHilightColor, aHiMod);
|
||||
toUpdateViewer = Standard_True;
|
||||
}
|
||||
|
||||
if (!myLastPicked.IsNull()
|
||||
&& myLastPicked->State() == 1)
|
||||
{
|
||||
TheStat = AIS_SOD_Selected;
|
||||
if (myLastPicked->State() == 1)
|
||||
{
|
||||
aStatus = AIS_SOD_Selected;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Previously detected object is unhilighted if it is not selected or hilighted
|
||||
// with selection color if it is selected.
|
||||
TheStat = AIS_SOD_Nothing;
|
||||
// previously detected object is unhilighted if it is not selected or hilighted
|
||||
// with selection color if it is selected
|
||||
aStatus = AIS_SOD_Nothing;
|
||||
if (!myLastPicked.IsNull())
|
||||
{
|
||||
Standard_Integer aHiMod = myLastPicked->HasHilightMode() ? myLastPicked->HilightMode() : 0;
|
||||
if (myLastPicked->State() != 1)
|
||||
{
|
||||
pmgr->Unhighlight (myLastPicked, aHiMod);
|
||||
UpdVwr = Standard_True;
|
||||
myMainPM->Unhighlight (myLastPicked, aHiMod);
|
||||
toUpdateViewer = Standard_True;
|
||||
}
|
||||
else if (myToHilightSelected)
|
||||
{
|
||||
pmgr->Color (myLastPicked, mySelectionColor, aHiMod);
|
||||
UpdVwr = Standard_True;
|
||||
myMainPM->Color (myLastPicked, mySelectionColor, aHiMod);
|
||||
toUpdateViewer = Standard_True;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ismain )
|
||||
myLastinMain.Nullify();
|
||||
myLastinMain.Nullify();
|
||||
}
|
||||
|
||||
if(UpdVwr) aView->Viewer()->Update();
|
||||
|
||||
if (toUpdateViewer)
|
||||
{
|
||||
if (theToRedrawOnUpdate)
|
||||
{
|
||||
theView->Viewer()->Update();
|
||||
}
|
||||
else
|
||||
{
|
||||
theView->Viewer()->Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
myLastPicked.Nullify();
|
||||
|
||||
mylastmoveview = aView;
|
||||
return TheStat;
|
||||
mylastmoveview = theView;
|
||||
return aStatus;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -1310,56 +1296,30 @@ Handle(SelectMgr_EntityOwner) AIS_InteractiveContext::DetectedOwner() const
|
||||
|
||||
//=======================================================================
|
||||
//function : HilightNextDetected
|
||||
//purpose :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer AIS_InteractiveContext::HilightNextDetected(const Handle(V3d_View)& V)
|
||||
Standard_Integer AIS_InteractiveContext::HilightNextDetected (const Handle(V3d_View)& theView,
|
||||
const Standard_Boolean theToRedrawImmediate)
|
||||
{
|
||||
if(!HasOpenedContext())
|
||||
return 0;
|
||||
return myLocalContexts(myCurLocalIndex)->HilightNextDetected(V);
|
||||
return HasOpenedContext()
|
||||
? myLocalContexts (myCurLocalIndex)->HilightNextDetected (theView, theToRedrawImmediate)
|
||||
: 0;
|
||||
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : HilightNextDetected
|
||||
//purpose :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer AIS_InteractiveContext::HilightPreviousDetected(const Handle(V3d_View)& V)
|
||||
Standard_Integer AIS_InteractiveContext::HilightPreviousDetected (const Handle(V3d_View)& theView,
|
||||
const Standard_Boolean theToRedrawImmediate)
|
||||
{
|
||||
if(!HasOpenedContext())
|
||||
return 0;
|
||||
return myLocalContexts(myCurLocalIndex)->HilightPreviousDetected(V);
|
||||
return HasOpenedContext()
|
||||
? myLocalContexts (myCurLocalIndex)->HilightPreviousDetected (theView, theToRedrawImmediate)
|
||||
: 0;
|
||||
|
||||
}
|
||||
|
||||
#ifdef IMP150501
|
||||
void AIS_InteractiveContext::Drag(
|
||||
const Handle(V3d_View)& aView,
|
||||
const Handle(AIS_InteractiveObject)& anObject,
|
||||
const Handle(Geom_Transformation)& aTrsf,
|
||||
const Standard_Boolean postConcatenate,
|
||||
const Standard_Boolean update,
|
||||
const Standard_Boolean zBuffer) {
|
||||
|
||||
if( anObject.IsNull() || aView.IsNull() ) return;
|
||||
|
||||
if( update ) {
|
||||
anObject->SetTransformation(aTrsf,postConcatenate,Standard_True);
|
||||
aView->Update();
|
||||
} else if( Visual3d_TransientManager::BeginDraw(aView->View(),
|
||||
zBuffer,Standard_False) ) {
|
||||
Handle(Prs3d_Presentation) P = anObject->Presentation();
|
||||
if( !P.IsNull() ) {
|
||||
if( postConcatenate ) P->Multiply(aTrsf);
|
||||
else P->Transform(aTrsf);
|
||||
Visual3d_TransientManager::DrawStructure(P);
|
||||
}
|
||||
Visual3d_TransientManager::EndDraw(Standard_True);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef IMP160701
|
||||
//=======================================================================
|
||||
//function : InitDetected
|
||||
//purpose :
|
||||
@@ -1439,4 +1399,3 @@ Handle(AIS_InteractiveObject) AIS_InteractiveContext::DetectedCurrentObject() co
|
||||
else
|
||||
return aBad;
|
||||
}
|
||||
#endif
|
||||
|
@@ -773,82 +773,71 @@ Standard_Integer AIS_InteractiveContext::PurgeViewer(const Handle(V3d_Viewer)& V
|
||||
return NbCleared;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : IsImmediateModeOn
|
||||
//purpose :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean AIS_InteractiveContext::IsImmediateModeOn() const
|
||||
{
|
||||
if(!HasOpenedContext()) return Standard_False;
|
||||
return myLocalContexts(myCurLocalIndex)->IsImmediateModeOn();
|
||||
}
|
||||
|
||||
Standard_Boolean AIS_InteractiveContext::BeginImmediateDraw()
|
||||
//=======================================================================
|
||||
//function : BeginImmediateDraw
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean AIS_InteractiveContext::BeginImmediateDraw()
|
||||
{
|
||||
if(HasOpenedContext())
|
||||
return myLocalContexts(myCurLocalIndex)->BeginImmediateDraw();
|
||||
return Standard_False;
|
||||
return HasOpenedContext()
|
||||
&& myLocalContexts (myCurLocalIndex)->BeginImmediateDraw();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ImmediateAdd
|
||||
//purpose :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean AIS_InteractiveContext::ImmediateAdd(const Handle(AIS_InteractiveObject)& anIObj,
|
||||
const Standard_Integer AMode)
|
||||
{
|
||||
if(HasOpenedContext()){
|
||||
return myLocalContexts(myCurLocalIndex)->ImmediateAdd(anIObj,AMode);}
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ImmediateRemove
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean AIS_InteractiveContext::ImmediateRemove(const Handle(AIS_InteractiveObject)& anIObj,
|
||||
const Standard_Integer aMode)
|
||||
Standard_Boolean AIS_InteractiveContext::ImmediateAdd (const Handle(AIS_InteractiveObject)& theObj,
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
if(HasOpenedContext())
|
||||
return myLocalContexts(myCurLocalIndex)->ImmediateRemove(anIObj,aMode);
|
||||
return Standard_False;
|
||||
return HasOpenedContext()
|
||||
&& myLocalContexts (myCurLocalIndex)->ImmediateAdd (theObj, theMode);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : EndImmediateDraw
|
||||
//purpose :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean AIS_InteractiveContext::EndImmediateDraw(const Handle(V3d_View)& aView,
|
||||
const Standard_Boolean DoubleBuf)
|
||||
Standard_Boolean AIS_InteractiveContext::EndImmediateDraw (const Handle(V3d_View)& theView)
|
||||
{
|
||||
if(HasOpenedContext())
|
||||
return myLocalContexts(myCurLocalIndex)->EndImmediateDraw(aView,DoubleBuf);
|
||||
return Standard_False;
|
||||
|
||||
return HasOpenedContext()
|
||||
&& myLocalContexts (myCurLocalIndex)->EndImmediateDraw (theView);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : EndImmediateDraw
|
||||
//purpose :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean AIS_InteractiveContext::EndImmediateDraw(const Standard_Boolean DoubleBuf)
|
||||
Standard_Boolean AIS_InteractiveContext::EndImmediateDraw()
|
||||
{
|
||||
if(HasOpenedContext()){
|
||||
Handle(V3d_View) V ;
|
||||
myMainVwr->InitActiveViews();
|
||||
if(myMainVwr->MoreActiveViews()){
|
||||
V = myMainVwr->ActiveView();
|
||||
|
||||
return myLocalContexts(myCurLocalIndex)->EndImmediateDraw(V,DoubleBuf);
|
||||
}
|
||||
if (!HasOpenedContext())
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
return Standard_False;
|
||||
|
||||
|
||||
myMainVwr->InitActiveViews();
|
||||
if (!myMainVwr->MoreActiveViews())
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
Handle(V3d_View) aView = myMainVwr->ActiveView();
|
||||
return myLocalContexts (myCurLocalIndex)->EndImmediateDraw (aView);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -40,7 +40,6 @@ class gp_Pnt;
|
||||
class TopoDS_Edge;
|
||||
class TopoDS_Shape;
|
||||
class Geom_Plane;
|
||||
class PrsMgr_PresentationManager3d;
|
||||
class Prs3d_Presentation;
|
||||
class Prs3d_Projector;
|
||||
class Geom_Transformation;
|
||||
|
@@ -230,13 +230,12 @@ is
|
||||
AutomaticHilight(me) returns Boolean;
|
||||
---C++: inline
|
||||
|
||||
|
||||
|
||||
---Category: THE SELECTION PROCESS
|
||||
|
||||
|
||||
MoveTo(me:mutable;Xpix,Ypix : Integer from Standard;
|
||||
aview : View from V3d)
|
||||
MoveTo (me : mutable;
|
||||
theXpix, theYpix : Integer from Standard;
|
||||
theView : View from V3d;
|
||||
theToRedrawImmediate : Boolean from Standard)
|
||||
returns StatusOfDetection from AIS;
|
||||
|
||||
|
||||
@@ -245,15 +244,18 @@ is
|
||||
---Purpose: returns True if more than one entity
|
||||
-- was detected at the last Mouse position.
|
||||
|
||||
HilightNextDetected(me:mutable;aView:View from V3d)
|
||||
HilightNextDetected (me : mutable;
|
||||
theView : View from V3d;
|
||||
theToRedrawImmediate : Boolean from Standard)
|
||||
returns Integer from Standard;
|
||||
---Purpose: returns True if last detected. the next detected will
|
||||
-- be first one (endless loop)
|
||||
|
||||
HilightPreviousDetected(me:mutable;aView:View from V3d)
|
||||
HilightPreviousDetected (me : mutable;
|
||||
theView : View from V3d;
|
||||
theToRedrawImmediate : Boolean from Standard)
|
||||
returns Integer from Standard;
|
||||
|
||||
|
||||
UnhilightLastDetected(me:mutable;aView:View from V3d) returns Boolean from Standard;
|
||||
---Purpose: returns True if something was done...
|
||||
|
||||
@@ -474,24 +476,29 @@ is
|
||||
---Category: IMMEDIATE MODE
|
||||
|
||||
|
||||
BeginImmediateDraw (me:mutable) returns Boolean from Standard;
|
||||
---Purpose: initializes the list of presentations to be displayed
|
||||
-- returns False if No Local COnte
|
||||
|
||||
ImmediateAdd (me:mutable;anIObj:InteractiveObject from AIS;aMode:Integer from Standard=0)
|
||||
BeginImmediateDraw (me : mutable)
|
||||
returns Boolean from Standard;
|
||||
---Purpose: returns True if <anIObj> has been stored in the list.
|
||||
---Purpose: Resets the transient list of presentations previously displayed in immediate mode
|
||||
-- and begins accumulation of new list by following AddToImmediateList()/Color()/Highlight() calls.
|
||||
|
||||
ImmediateRemove (me:mutable;anIObj:InteractiveObject from AIS;aMode:Integer from Standard=0)
|
||||
ClearImmediateDraw (me : mutable) is virtual;
|
||||
---Purpose: Resets the transient list of presentations previously displayed in immediate mode.
|
||||
|
||||
ImmediateAdd (me : mutable;
|
||||
theObj : InteractiveObject from AIS;
|
||||
theMode : Integer from Standard = 0)
|
||||
returns Boolean from Standard;
|
||||
---Purpose: returns True if <anIObj> has been removed from the list.
|
||||
---Purpose: Stores presentation theMode of object theObj in the transient list of presentations to be displayed in immediate mode.
|
||||
-- Will be taken in account in EndImmediateDraw method.
|
||||
|
||||
EndImmediateDraw(me:mutable;aView : View from V3d;DoubleBuf:Boolean from Standard=Standard_False)
|
||||
EndImmediateDraw (me : mutable;
|
||||
theView : View from V3d)
|
||||
returns Boolean from Standard;
|
||||
---Purpose: returns True if the immediate display has been done.
|
||||
---Purpose: Allows rapid drawing of the view theView by avoiding an update of the whole background.
|
||||
|
||||
IsImmediateModeOn (me) returns Boolean from Standard;
|
||||
---Purpose: Returns true if Presentation Manager is accumulating transient list of presentations to be displayed in immediate mode.
|
||||
|
||||
IsImmediateModeOn(me) returns Boolean from Standard;
|
||||
|
||||
---Category: INTERNAL METHODS;
|
||||
|
||||
UpdateConversion(me:mutable);
|
||||
@@ -523,9 +530,10 @@ is
|
||||
ActivateStandardModes(me:mutable;anObject: SelectableObject from SelectMgr;
|
||||
WithProj: Boolean from Standard = Standard_True) is static private;
|
||||
|
||||
ManageDetected(me:mutable;
|
||||
aPickOwner : EntityOwner from SelectMgr;
|
||||
aview : View from V3d) is static private;
|
||||
manageDetected (me : mutable;
|
||||
thePickOwner : EntityOwner from SelectMgr;
|
||||
theView : View from V3d;
|
||||
theToRedrawImmediate : Boolean from Standard) is static private;
|
||||
|
||||
DetectedIndex(me:mutable) returns Integer from Standard is static private;
|
||||
---C++: inline
|
||||
@@ -568,17 +576,10 @@ is
|
||||
|
||||
ClearSensitive(me:mutable;aView:View from V3d) is static;
|
||||
|
||||
|
||||
|
||||
MainSelector(me) returns any ViewerSelector3d from StdSelect;
|
||||
---C++: inline
|
||||
---C++: return const&
|
||||
|
||||
|
||||
HilightTriangle(me:mutable;Rank:Integer from Standard;aViou:View from V3d) is static private;
|
||||
---Level: Internal
|
||||
|
||||
|
||||
FindSelectedOwnerFromIO(me;anIObj:InteractiveObject from AIS)
|
||||
returns EntityOwner from SelectMgr;
|
||||
|
||||
|
@@ -50,7 +50,6 @@
|
||||
#include <AIS_Selection.hxx>
|
||||
#include <V3d_Viewer.hxx>
|
||||
#include <V3d_View.hxx>
|
||||
#include <Visual3d_TransientManager.hxx>
|
||||
#include <Visual3d_View.hxx>
|
||||
|
||||
#ifdef ALE70590
|
||||
@@ -693,10 +692,10 @@ Standard_Boolean AIS_LocalContext::HasSameProjector(const Handle(Select3D_Projec
|
||||
|
||||
//=======================================================================
|
||||
//function : Terminate
|
||||
//purpose :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void AIS_LocalContext::Terminate( const Standard_Boolean updateviewer )
|
||||
void AIS_LocalContext::Terminate (const Standard_Boolean theToUpdate)
|
||||
{
|
||||
ClearDetected();
|
||||
Clear();
|
||||
@@ -720,23 +719,21 @@ void AIS_LocalContext::Terminate( const Standard_Boolean updateviewer )
|
||||
AIS_Selection::Select();
|
||||
AIS_Selection::Remove(mySelName.ToCString());
|
||||
|
||||
// CLE
|
||||
// const Handle(V3d_Viewer)& Vwr = myCTX->CurrentViewer();
|
||||
Handle(V3d_Viewer) Vwr = myCTX->CurrentViewer();
|
||||
// ENDCLE
|
||||
Handle(V3d_View) curV;
|
||||
for(Vwr->InitActiveViews();Vwr->MoreActiveViews();Vwr->NextActiveViews()){
|
||||
curV = Vwr->ActiveView();
|
||||
Visual3d_TransientManager::ClearDraw( curV->View(), updateviewer );
|
||||
Handle(V3d_Viewer) aViewer = myCTX->CurrentViewer();
|
||||
for (aViewer->InitActiveViews(); aViewer->MoreActiveViews(); aViewer->NextActiveViews())
|
||||
{
|
||||
Handle(V3d_View) aView = aViewer->ActiveView();
|
||||
aView->View()->ClearImmediate();
|
||||
}
|
||||
|
||||
Handle(V3d_View) aDummyView;
|
||||
myMainVS->ClearAreas (aDummyView);
|
||||
myMainVS->ClearSensitive (aDummyView);
|
||||
|
||||
#ifdef DEB
|
||||
Handle(V3d_View) BidV;
|
||||
myMainVS->ClearAreas(BidV);
|
||||
myMainVS->ClearSensitive(BidV);
|
||||
|
||||
#endif
|
||||
if (theToUpdate)
|
||||
{
|
||||
myCTX->UpdateCurrentViewer();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1172,50 +1169,68 @@ void AIS_LocalContext::UpdateSort()
|
||||
myMainVS->UpdateSort();
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : IMMEDIATE MODE
|
||||
//purpose :
|
||||
//function : BeginImmediateDraw
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean AIS_LocalContext::BeginImmediateDraw()
|
||||
Standard_Boolean AIS_LocalContext::BeginImmediateDraw()
|
||||
{
|
||||
if(myMainPM->IsImmediateModeOn()){
|
||||
myMainPM->BeginDraw();
|
||||
if (myMainPM->IsImmediateModeOn())
|
||||
{
|
||||
myMainPM->BeginImmediateDraw();
|
||||
return Standard_True;
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
|
||||
Standard_Boolean AIS_LocalContext::ImmediateAdd(const Handle(AIS_InteractiveObject)& anIObj,
|
||||
const Standard_Integer aMode)
|
||||
//=======================================================================
|
||||
//function : ImmediateAdd
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean AIS_LocalContext::ImmediateAdd (const Handle(AIS_InteractiveObject)& theObj,
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
if(!myMainPM->IsImmediateModeOn())
|
||||
if (!myMainPM->IsImmediateModeOn())
|
||||
{
|
||||
return Standard_False;
|
||||
myMainPM->Add(anIObj,aMode);
|
||||
}
|
||||
|
||||
myMainPM->AddToImmediateList (myMainPM->CastPresentation (theObj, theMode)->Presentation());
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
Standard_Boolean AIS_LocalContext::ImmediateRemove(const Handle(AIS_InteractiveObject)& anIObj,
|
||||
const Standard_Integer aMode)
|
||||
//=======================================================================
|
||||
//function : EndImmediateDraw
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean AIS_LocalContext::EndImmediateDraw (const Handle(V3d_View)& theView)
|
||||
{
|
||||
if(!myMainPM->IsImmediateModeOn()) return Standard_False;
|
||||
myMainPM->Remove(anIObj,aMode);
|
||||
if (!myMainPM->IsImmediateModeOn())
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
myMainPM->EndImmediateDraw (theView);
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
Standard_Boolean AIS_LocalContext::EndImmediateDraw(const Handle(V3d_View)& aView,
|
||||
const Standard_Boolean DoubleBuf)
|
||||
// =======================================================================
|
||||
// function : ClearImmediateDraw
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void AIS_LocalContext::ClearImmediateDraw()
|
||||
{
|
||||
if(!myMainPM->IsImmediateModeOn()) return Standard_False;
|
||||
myMainPM->EndDraw(aView,DoubleBuf);
|
||||
return Standard_True;
|
||||
myMainPM->ClearImmediateDraw();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsImmediateModeOn
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean AIS_LocalContext::IsImmediateModeOn() const
|
||||
{return myMainPM->IsImmediateModeOn();}
|
||||
{
|
||||
return myMainPM->IsImmediateModeOn();
|
||||
}
|
||||
|
||||
void AIS_LocalContext::SetSensitivityMode(const StdSelect_SensitivityMode aMode) {
|
||||
|
||||
|
@@ -47,9 +47,6 @@
|
||||
|
||||
#define IMP300101 //GG Enable to use polygon highlighting
|
||||
|
||||
#define BUC60863 //GG_270301 Clear hilight soon after selecting or
|
||||
// unselecting something in Local Context mode.
|
||||
|
||||
#define BUC60876 //GG_050401 Clear selection always even
|
||||
// if the current highlight mode is not 0.
|
||||
|
||||
@@ -71,12 +68,6 @@
|
||||
#define USE_MAP //san : 18/04/03 USE_MAP - additional datamap is used to speed up access
|
||||
//to certain owners in AIS_Selection::myresult list
|
||||
|
||||
#define IMP120402 // GG : Add protection in manual detection methods
|
||||
// after deselecting any item using ShiftSelect action.
|
||||
// Thanks to Ivan FONTAINE of SAMTECH company
|
||||
|
||||
#define IMP051001 //GG manage Z detection
|
||||
|
||||
#define OCC9026 //AEL Performance optimization of the FindSelectedOwnerFromShape() method.
|
||||
|
||||
#include <AIS_LocalContext.jxx>
|
||||
@@ -88,7 +79,6 @@
|
||||
#include <Prs3d_ShadingAspect.hxx>
|
||||
#include <AIS_LocalStatus.hxx>
|
||||
#include <StdPrs_WFShape.hxx>
|
||||
#include <Visual3d_TransientManager.hxx>
|
||||
#include <Graphic3d_ArrayOfTriangles.hxx>
|
||||
#include <Graphic3d_Group.hxx>
|
||||
#include <Select3D_SensitiveTriangulation.hxx>
|
||||
@@ -103,6 +93,7 @@
|
||||
|
||||
#include <Geom_Transformation.hxx>
|
||||
#include <AIS_Selection.hxx>
|
||||
#include <Aspect_Grid.hxx>
|
||||
#ifdef IMP120701
|
||||
#include <AIS_Shape.hxx>
|
||||
#endif
|
||||
@@ -114,87 +105,78 @@ static Standard_Integer GetHiMod(const Handle(AIS_InteractiveObject)& IO)
|
||||
}
|
||||
|
||||
//==================================================
|
||||
// Function:
|
||||
// Function: MoveTo
|
||||
// Purpose :
|
||||
//==================================================
|
||||
AIS_StatusOfDetection AIS_LocalContext::MoveTo(const Standard_Integer Xpix,
|
||||
const Standard_Integer Ypix,
|
||||
const Handle(V3d_View)& aview)
|
||||
AIS_StatusOfDetection AIS_LocalContext::MoveTo (const Standard_Integer theXpix,
|
||||
const Standard_Integer theYpix,
|
||||
const Handle(V3d_View)& theView,
|
||||
const Standard_Boolean theToRedrawImmediate)
|
||||
{
|
||||
// check that ViewerSelector gives
|
||||
if(aview->Viewer()== myCTX->CurrentViewer()) {
|
||||
#ifdef IMP160701
|
||||
//Nullify class members storing information about detected AIS objects.
|
||||
myAISCurDetected = 0;
|
||||
myAISDetectedSeq.Clear();
|
||||
#endif
|
||||
myCurDetected = 0;
|
||||
myDetectedSeq.Clear();
|
||||
myMainVS->Pick(Xpix,Ypix,aview);
|
||||
Standard_Boolean had_nothing = myMainVS->NbPicked()==0;
|
||||
Standard_Integer NbDetected = myMainVS->NbPicked();
|
||||
Handle(SelectMgr_EntityOwner) EO;
|
||||
|
||||
for(Standard_Integer i_detect = 1;i_detect<=NbDetected;i_detect++){
|
||||
EO = myMainVS->Picked(i_detect);
|
||||
if(!EO.IsNull()){
|
||||
if(myFilters->IsOk(EO)) {
|
||||
myDetectedSeq.Append(i_detect); // normallly they are already arranged in correct order...
|
||||
#ifdef IMP160701
|
||||
Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast(EO->Selectable());
|
||||
if(!Handle(AIS_Shape)::DownCast(anObj).IsNull())
|
||||
myAISDetectedSeq.Append(anObj);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//result of courses..
|
||||
if(had_nothing || myDetectedSeq.IsEmpty()){
|
||||
if(mylastindex !=0 && mylastindex <= myMapOfOwner.Extent()){
|
||||
|
||||
#ifdef BUC60863
|
||||
Unhilight(myMapOfOwner(mylastindex),aview);
|
||||
#else
|
||||
if(!IsSelected(myMapOfOwner(mylastindex)))
|
||||
Unhilight(myMapOfOwner(mylastindex),aview);
|
||||
#endif
|
||||
}
|
||||
mylastindex=0;
|
||||
return (had_nothing ? AIS_SOD_Nothing : AIS_SOD_AllBad);
|
||||
}
|
||||
|
||||
// all owners detected by the selector are passed to the
|
||||
// filters and correct ones are preserved...
|
||||
myCurDetected = 1;
|
||||
EO = myMainVS->Picked(myDetectedSeq(myCurDetected));
|
||||
|
||||
static Standard_Boolean Normal_State(Standard_True);
|
||||
static Standard_Boolean firsttime(Standard_True);
|
||||
if(firsttime){
|
||||
OSD_Environment toto("HITRI");
|
||||
if(!toto.Value().IsEmpty())
|
||||
Normal_State = Standard_False;
|
||||
firsttime = Standard_False;
|
||||
}
|
||||
|
||||
if(Normal_State)
|
||||
ManageDetected(EO,aview);
|
||||
else
|
||||
HilightTriangle(1,aview);
|
||||
|
||||
if(myDetectedSeq.Length() == 1){
|
||||
if(NbDetected==1)
|
||||
return AIS_SOD_OnlyOneDetected;
|
||||
else
|
||||
return AIS_SOD_OnlyOneGood;
|
||||
}
|
||||
else
|
||||
return AIS_SOD_SeveralGood;
|
||||
|
||||
|
||||
// check that ViewerSelector gives
|
||||
if (theView->Viewer() != myCTX->CurrentViewer())
|
||||
{
|
||||
return AIS_SOD_Error;
|
||||
}
|
||||
|
||||
myAISCurDetected = 0;
|
||||
myAISDetectedSeq.Clear();
|
||||
|
||||
myCurDetected = 0;
|
||||
myDetectedSeq.Clear();
|
||||
myMainVS->Pick (theXpix, theYpix, theView);
|
||||
|
||||
const Standard_Integer aDetectedNb = myMainVS->NbPicked();
|
||||
for (Standard_Integer aDetIter = 1; aDetIter <= aDetectedNb; ++aDetIter)
|
||||
{
|
||||
Handle(SelectMgr_EntityOwner) anOwner = myMainVS->Picked (aDetIter);
|
||||
if (anOwner.IsNull()
|
||||
|| !myFilters->IsOk (anOwner))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
myDetectedSeq.Append (aDetIter); // normallly they are already arranged in correct order...
|
||||
Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable());
|
||||
if (!Handle(AIS_Shape)::DownCast (anObj).IsNull())
|
||||
{
|
||||
myAISDetectedSeq.Append (anObj);
|
||||
}
|
||||
}
|
||||
|
||||
// result of courses..
|
||||
if (aDetectedNb == 0 || myDetectedSeq.IsEmpty())
|
||||
{
|
||||
if (mylastindex != 0 && mylastindex <= myMapOfOwner.Extent())
|
||||
{
|
||||
Unhilight (myMapOfOwner (mylastindex), theView);
|
||||
if (theToRedrawImmediate)
|
||||
{
|
||||
theView->RedrawImmediate();
|
||||
}
|
||||
}
|
||||
|
||||
mylastindex = 0;
|
||||
return aDetectedNb == 0
|
||||
? AIS_SOD_Nothing
|
||||
: AIS_SOD_AllBad;
|
||||
}
|
||||
|
||||
// all owners detected by the selector are passed to the
|
||||
// filters and correct ones are preserved...
|
||||
myCurDetected = 1;
|
||||
Handle(SelectMgr_EntityOwner) anOwner = myMainVS->Picked (myDetectedSeq (myCurDetected));
|
||||
manageDetected (anOwner, theView, theToRedrawImmediate);
|
||||
if (myDetectedSeq.Length() == 1)
|
||||
{
|
||||
return aDetectedNb == 1
|
||||
? AIS_SOD_OnlyOneDetected
|
||||
: AIS_SOD_OnlyOneGood;
|
||||
}
|
||||
else
|
||||
{
|
||||
return AIS_SOD_SeveralGood;
|
||||
}
|
||||
return AIS_SOD_Error;
|
||||
}
|
||||
|
||||
//==================================================
|
||||
@@ -229,24 +211,25 @@ AIS_StatusOfPick AIS_LocalContext::Select(const Standard_Boolean updateviewer)
|
||||
AIS_Selection::ClearAndSelect(EO);
|
||||
#endif
|
||||
|
||||
if(myAutoHilight) {
|
||||
#ifdef BUC60863
|
||||
if (myAutoHilight)
|
||||
{
|
||||
const Handle(V3d_Viewer)& aViewer = myCTX->CurrentViewer();
|
||||
for(aViewer->InitActiveViews(); aViewer->MoreActiveViews(); aViewer->NextActiveViews())
|
||||
Unhilight(EO, aViewer->ActiveView());
|
||||
|
||||
// san - advanced selection highlighting mechanism
|
||||
if (!EO->IsAutoHilight() && EO->HasSelectable()){
|
||||
Handle(AIS_InteractiveObject) anIO =
|
||||
Handle(AIS_InteractiveObject)::DownCast(EO->Selectable());
|
||||
UpdateSelected(anIO, Standard_False);
|
||||
for (aViewer->InitActiveViews(); aViewer->MoreActiveViews(); aViewer->NextActiveViews())
|
||||
{
|
||||
Unhilight (EO, aViewer->ActiveView());
|
||||
}
|
||||
|
||||
if(updateviewer)
|
||||
myCTX->CurrentViewer()->Update();
|
||||
#else
|
||||
HilightPicked(updateviewer);
|
||||
#endif
|
||||
// advanced selection highlighting mechanism
|
||||
if (!EO->IsAutoHilight() && EO->HasSelectable())
|
||||
{
|
||||
Handle(AIS_InteractiveObject) anIO = Handle(AIS_InteractiveObject)::DownCast(EO->Selectable());
|
||||
UpdateSelected (anIO, Standard_False);
|
||||
}
|
||||
|
||||
if (updateviewer)
|
||||
{
|
||||
myCTX->CurrentViewer()->Update();
|
||||
}
|
||||
}
|
||||
return ( AIS_Selection::Extent() == 1)? AIS_SOP_OneSelected : AIS_SOP_SeveralSelected ;
|
||||
}
|
||||
@@ -321,10 +304,6 @@ AIS_StatusOfPick AIS_LocalContext::ShiftSelect(const Standard_Boolean updateview
|
||||
{
|
||||
Standard_Integer I = DetectedIndex();
|
||||
if(I>0){
|
||||
#ifndef BUC60863
|
||||
if(myAutoHilight)
|
||||
UnhilightPicked(Standard_False);
|
||||
#endif
|
||||
|
||||
AIS_Selection::SetCurrentSelection(mySelName.ToCString());
|
||||
#ifdef BUC60774
|
||||
@@ -346,24 +325,25 @@ AIS_StatusOfPick AIS_LocalContext::ShiftSelect(const Standard_Boolean updateview
|
||||
AIS_Selection::Select(EO);
|
||||
#endif
|
||||
|
||||
if(myAutoHilight) {
|
||||
#ifdef BUC60863
|
||||
if(myAutoHilight)
|
||||
{
|
||||
const Handle(V3d_Viewer)& aViewer = myCTX->CurrentViewer();
|
||||
for(aViewer->InitActiveViews(); aViewer->MoreActiveViews(); aViewer->NextActiveViews())
|
||||
Unhilight(EO, aViewer->ActiveView());
|
||||
|
||||
// san - advanced selection highlighting mechanism
|
||||
if (!EO->IsAutoHilight() && EO->HasSelectable()){
|
||||
Handle(AIS_InteractiveObject) anIO =
|
||||
Handle(AIS_InteractiveObject)::DownCast(EO->Selectable());
|
||||
UpdateSelected(anIO, Standard_False);
|
||||
for (aViewer->InitActiveViews(); aViewer->MoreActiveViews(); aViewer->NextActiveViews())
|
||||
{
|
||||
Unhilight (EO, aViewer->ActiveView());
|
||||
}
|
||||
|
||||
if(updateviewer)
|
||||
// advanced selection highlighting mechanism
|
||||
if (!EO->IsAutoHilight() && EO->HasSelectable())
|
||||
{
|
||||
Handle(AIS_InteractiveObject) anIO = Handle(AIS_InteractiveObject)::DownCast (EO->Selectable());
|
||||
UpdateSelected (anIO, Standard_False);
|
||||
}
|
||||
|
||||
if (updateviewer)
|
||||
{
|
||||
myCTX->CurrentViewer()->Update();
|
||||
#else
|
||||
HilightPicked(updateviewer);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#ifdef BUC60774
|
||||
Standard_Integer NS = AIS_Selection::Extent();
|
||||
@@ -385,6 +365,8 @@ AIS_StatusOfPick AIS_LocalContext::ShiftSelect(const Standard_Integer XPMin,
|
||||
const Handle(V3d_View)& aView,
|
||||
const Standard_Boolean updateviewer)
|
||||
{
|
||||
myMainPM->ClearImmediateDraw();
|
||||
|
||||
if(aView->Viewer()== myCTX->CurrentViewer()) {
|
||||
myMainVS->Pick( XPMin,YPMin,XPMax,YPMax,aView);
|
||||
#ifdef BUC60774
|
||||
@@ -526,62 +508,48 @@ AIS_StatusOfPick AIS_LocalContext::ShiftSelect( const TColgp_Array1OfPnt2d& aPol
|
||||
}
|
||||
|
||||
//==================================================
|
||||
// Function:
|
||||
// Function: Hilight
|
||||
// Purpose :
|
||||
//==================================================
|
||||
void AIS_LocalContext::Hilight(const Handle(SelectMgr_EntityOwner)& Ownr,
|
||||
const Handle(V3d_View)& aview)
|
||||
void AIS_LocalContext::Hilight (const Handle(SelectMgr_EntityOwner)& theOwner,
|
||||
const Handle(V3d_View)& theView)
|
||||
{
|
||||
#ifdef BUC60863
|
||||
if( aview.IsNull() ) return;
|
||||
aview->TransientManagerClearDraw();
|
||||
#else
|
||||
if(aview->TransientManagerBeginDraw())
|
||||
Visual3d_TransientManager::EndDraw();
|
||||
#endif
|
||||
myMainPM->BeginDraw();
|
||||
Handle(SelectMgr_SelectableObject) SO = Ownr->Selectable();
|
||||
Standard_Integer HM = GetHiMod(*((Handle(AIS_InteractiveObject)*)&SO));
|
||||
Ownr->HilightWithColor(myMainPM,myCTX->HilightColor(),HM);
|
||||
#ifdef IMP051001
|
||||
myMainPM->EndDraw(aview,myCTX->ZDetection());
|
||||
#else
|
||||
myMainPM->EndDraw(aview);
|
||||
#endif
|
||||
if (theView.IsNull())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const Standard_Integer aHilightMode = GetHiMod (Handle(AIS_InteractiveObject)::DownCast (theOwner->Selectable()));
|
||||
myMainPM->BeginImmediateDraw();
|
||||
theOwner->HilightWithColor (myMainPM, myCTX->HilightColor(), aHilightMode);
|
||||
myMainPM->EndImmediateDraw (theView);
|
||||
}
|
||||
|
||||
//==================================================
|
||||
// Function:
|
||||
// Function: Unhilight
|
||||
// Purpose :
|
||||
//==================================================
|
||||
void AIS_LocalContext::Unhilight(const Handle(SelectMgr_EntityOwner)& Ownr,
|
||||
const Handle(V3d_View)& aview)
|
||||
void AIS_LocalContext::Unhilight (const Handle(SelectMgr_EntityOwner)& theOwner,
|
||||
const Handle(V3d_View)& theView)
|
||||
{
|
||||
|
||||
Handle(SelectMgr_SelectableObject) SO = Ownr->Selectable();
|
||||
Standard_Integer HM = GetHiMod(*((Handle(AIS_InteractiveObject)*)&SO));
|
||||
#ifdef BUC60863
|
||||
if( aview.IsNull() ) return;
|
||||
if( IsSelected(Ownr) ) {
|
||||
if ( Ownr->IsAutoHilight() )
|
||||
Ownr->HilightWithColor(myMainPM,myCTX->SelectionColor(),HM);
|
||||
}
|
||||
else
|
||||
if (theView.IsNull())
|
||||
{
|
||||
myMainPM->BeginDraw();
|
||||
Ownr->Unhilight(myMainPM,HM);
|
||||
myMainPM->EndDraw(aview);
|
||||
return;
|
||||
}
|
||||
|
||||
myMainPM->ClearImmediateDraw();
|
||||
const Standard_Integer aHilightMode = GetHiMod (Handle(AIS_InteractiveObject)::DownCast (theOwner->Selectable()));
|
||||
if (IsSelected (theOwner))
|
||||
{
|
||||
if (theOwner->IsAutoHilight())
|
||||
{
|
||||
theOwner->HilightWithColor (myMainPM, myCTX->SelectionColor(), aHilightMode);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
theOwner->Unhilight (myMainPM, aHilightMode);
|
||||
}
|
||||
aview->TransientManagerClearDraw();
|
||||
#else
|
||||
if(aview->TransientManagerBeginDraw())
|
||||
Visual3d_TransientManager::EndDraw();
|
||||
myMainPM->BeginDraw();
|
||||
Ownr->Unhilight(myMainPM,HM);
|
||||
myMainPM->EndDraw(aview);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -647,12 +615,9 @@ void AIS_LocalContext::HilightPicked(const Standard_Boolean updateviewer)
|
||||
aMapIter.More(); aMapIter.Next() )
|
||||
aMapIter.Key()->HilightSelected ( myMainPM, aMapIter.Value() );
|
||||
|
||||
if(updateviewer){
|
||||
#ifdef BUC60863
|
||||
myCTX->CurrentViewer()->Update();
|
||||
#else
|
||||
if(updMain) myCTX->CurrentViewer()->Update();
|
||||
#endif
|
||||
if (updateviewer)
|
||||
{
|
||||
myCTX->CurrentViewer()->Update();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -660,9 +625,10 @@ void AIS_LocalContext::HilightPicked(const Standard_Boolean updateviewer)
|
||||
// Function:
|
||||
// Purpose :
|
||||
//==================================================
|
||||
void AIS_LocalContext::
|
||||
UnhilightPicked(const Standard_Boolean updateviewer)
|
||||
void AIS_LocalContext::UnhilightPicked (const Standard_Boolean updateviewer)
|
||||
{
|
||||
myMainPM->ClearImmediateDraw();
|
||||
|
||||
Standard_Boolean updMain(Standard_False);
|
||||
|
||||
Handle(AIS_Selection) Sel = AIS_Selection::Selection(mySelName.ToCString());
|
||||
@@ -1086,91 +1052,94 @@ void AIS_LocalContext::AddOrRemoveSelected(const Handle(SelectMgr_EntityOwner)&
|
||||
}
|
||||
|
||||
//==================================================
|
||||
// Function:
|
||||
// Function: manageDetected
|
||||
// Purpose :
|
||||
//==================================================
|
||||
void AIS_LocalContext::ManageDetected(const Handle(SelectMgr_EntityOwner)& aPickOwner,
|
||||
const Handle(V3d_View)& aview)
|
||||
void AIS_LocalContext::manageDetected (const Handle(SelectMgr_EntityOwner)& thePickOwner,
|
||||
const Handle(V3d_View)& theView,
|
||||
const Standard_Boolean theToRedrawImmediate)
|
||||
{
|
||||
#ifdef BUC60818
|
||||
// Warning : aPickOwner may be null !
|
||||
if (aPickOwner.IsNull()) return;
|
||||
#else
|
||||
if(!myAutoHilight) return;
|
||||
#endif
|
||||
// const Handle(SelectMgr_SelectableObject)& SO = aPickOwner->Selectable();
|
||||
Standard_Boolean okStatus = myFilters->IsOk(aPickOwner);
|
||||
// OK...
|
||||
if(okStatus){
|
||||
//=======================================================================================================
|
||||
// 2 cases : a- object is in the map of picks:
|
||||
// 1. this is the same index as the last detected: -> Do nothing
|
||||
// 2. otherwise :
|
||||
// - if lastindex = 0 (no object was detected at the last step)
|
||||
// the object presentation is highlighted and lastindex = index(objet)
|
||||
// - othrwise :
|
||||
// the presentation of the object corresponding to lastindex is "unhighlighted"
|
||||
// it is removed if the object is not visualized but only active
|
||||
// then the presentation of the detected object is highlighted and lastindex = index(objet)
|
||||
// b- the object is not in the map of picked objects
|
||||
// - if lastindex != 0 (object detected at the last step) it is unhighlighted ...
|
||||
// if the object was decomposed, presentation is created for the detected shape and the couple
|
||||
// (Proprietaire,Prs)is added in the map.
|
||||
// otherwise the couple(proprietaire, NullPrs) is placed in the map and the interactive object
|
||||
// itself is highlighted.
|
||||
//
|
||||
//=======================================================================================================
|
||||
|
||||
|
||||
//szv:
|
||||
Standard_Boolean wasContained = myMapOfOwner.Contains(aPickOwner);
|
||||
Standard_Integer theNewIndex = 0;
|
||||
if (wasContained)
|
||||
theNewIndex = myMapOfOwner.FindIndex(aPickOwner);
|
||||
else
|
||||
theNewIndex = myMapOfOwner.Add(aPickOwner);
|
||||
|
||||
// For the advanced mesh selection mode the owner indices comparison
|
||||
// is not effective because in that case only one owner manage the
|
||||
// selection in current selection mode. It is necessary to check the current detected
|
||||
// entity and hilight it only if the detected entity is not the same as
|
||||
// previous detected (IsForcedHilight call)
|
||||
if (theNewIndex != mylastindex || aPickOwner->IsForcedHilight()) {
|
||||
|
||||
if (mylastindex && mylastindex <= myMapOfOwner.Extent()) {
|
||||
|
||||
const Handle(SelectMgr_EntityOwner)& LastOwnr = myMapOfOwner(mylastindex);
|
||||
#ifdef BUC60863
|
||||
Unhilight(LastOwnr,aview);
|
||||
#else
|
||||
if(!IsSelected(LastOwnr))
|
||||
Unhilight(LastOwnr,aview);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (myAutoHilight) {
|
||||
// wasContained should not be checked because with this verification different
|
||||
// behaviour of application may occer depending whether mouse is moved above
|
||||
// owner first or second time
|
||||
//if (wasContained) {
|
||||
#ifdef BUC60569
|
||||
if (aPickOwner->State() <= 0 || myCTX->ToHilightSelected())
|
||||
#else
|
||||
if(!IsSelected (aPickOwner) || myCTX->ToHilightSelected())
|
||||
#endif
|
||||
Hilight(aPickOwner,aview);
|
||||
/*}
|
||||
else Hilight(aPickOwner,aview);*/
|
||||
}
|
||||
|
||||
mylastindex = theNewIndex;
|
||||
if (thePickOwner.IsNull())
|
||||
{
|
||||
if (theToRedrawImmediate)
|
||||
{
|
||||
theView->RedrawImmediate();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (mylastindex) mylastgood = mylastindex;
|
||||
|
||||
}
|
||||
if (!myFilters->IsOk (thePickOwner))
|
||||
{
|
||||
if (mylastindex != 0)
|
||||
{
|
||||
mylastgood = mylastindex;
|
||||
}
|
||||
if (theToRedrawImmediate)
|
||||
{
|
||||
theView->RedrawImmediate();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
//=======================================================================================================
|
||||
// 2 cases : a- object is in the map of picks:
|
||||
// 1. this is the same index as the last detected: -> Do nothing
|
||||
// 2. otherwise :
|
||||
// - if lastindex = 0 (no object was detected at the last step)
|
||||
// the object presentation is highlighted and lastindex = index(objet)
|
||||
// - othrwise :
|
||||
// the presentation of the object corresponding to lastindex is "unhighlighted"
|
||||
// it is removed if the object is not visualized but only active
|
||||
// then the presentation of the detected object is highlighted and lastindex = index(objet)
|
||||
// b- the object is not in the map of picked objects
|
||||
// - if lastindex != 0 (object detected at the last step) it is unhighlighted ...
|
||||
// if the object was decomposed, presentation is created for the detected shape and the couple
|
||||
// (Proprietaire,Prs)is added in the map.
|
||||
// otherwise the couple(proprietaire, NullPrs) is placed in the map and the interactive object
|
||||
// itself is highlighted.
|
||||
//
|
||||
//=======================================================================================================
|
||||
|
||||
const Standard_Integer aNewIndex = myMapOfOwner.Contains (thePickOwner)
|
||||
? myMapOfOwner.FindIndex (thePickOwner)
|
||||
: myMapOfOwner.Add (thePickOwner);
|
||||
|
||||
// For the advanced mesh selection mode the owner indices comparison
|
||||
// is not effective because in that case only one owner manage the
|
||||
// selection in current selection mode. It is necessary to check the current detected
|
||||
// entity and hilight it only if the detected entity is not the same as
|
||||
// previous detected (IsForcedHilight call)
|
||||
if (aNewIndex != mylastindex
|
||||
|| thePickOwner->IsForcedHilight())
|
||||
{
|
||||
if (mylastindex != 0
|
||||
&& mylastindex <= myMapOfOwner.Extent())
|
||||
{
|
||||
const Handle(SelectMgr_EntityOwner)& aLastOwner = myMapOfOwner (mylastindex);
|
||||
Unhilight (aLastOwner, theView);
|
||||
}
|
||||
|
||||
if (myAutoHilight)
|
||||
{
|
||||
if (thePickOwner->State() <= 0
|
||||
|| myCTX->ToHilightSelected())
|
||||
{
|
||||
Hilight (thePickOwner, theView);
|
||||
}
|
||||
if (theToRedrawImmediate)
|
||||
{
|
||||
theView->RedrawImmediate();
|
||||
}
|
||||
}
|
||||
|
||||
mylastindex = aNewIndex;
|
||||
}
|
||||
|
||||
if (mylastindex)
|
||||
{
|
||||
mylastgood = mylastindex;
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : HasDetectedShape
|
||||
@@ -1314,138 +1283,78 @@ Standard_Boolean AIS_LocalContext::IsValidForSelection(const Handle(AIS_Interact
|
||||
|
||||
//=======================================================================
|
||||
//function : HilightNextDetected
|
||||
//purpose :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer AIS_LocalContext::HilightNextDetected(const Handle(V3d_View)& V)
|
||||
Standard_Integer AIS_LocalContext::HilightNextDetected (const Handle(V3d_View)& theView,
|
||||
const Standard_Boolean theToRedrawImmediate)
|
||||
{
|
||||
// go to the next owner
|
||||
|
||||
if(myDetectedSeq.IsEmpty()) return Standard_False;
|
||||
Standard_Integer L = myDetectedSeq.Length();
|
||||
myCurDetected++;
|
||||
|
||||
if(myCurDetected>L)
|
||||
myCurDetected = 1;
|
||||
Handle(SelectMgr_EntityOwner) EO = myMainVS->Picked(myCurDetected);
|
||||
#ifdef IMP120402
|
||||
if( EO.IsNull() ) return 0;
|
||||
#endif
|
||||
|
||||
static Standard_Boolean Normal_State(Standard_True);
|
||||
static Standard_Boolean firsttime(Standard_True);
|
||||
if(firsttime){
|
||||
OSD_Environment toto("HITRI");
|
||||
if(!toto.Value().IsEmpty())
|
||||
Normal_State = Standard_False;
|
||||
firsttime = Standard_False;
|
||||
if (myDetectedSeq.IsEmpty())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
if(Normal_State)
|
||||
ManageDetected(EO,V);
|
||||
else
|
||||
HilightTriangle(myCurDetected,V);
|
||||
const Standard_Integer aLen = myDetectedSeq.Length();
|
||||
if (++myCurDetected > aLen)
|
||||
{
|
||||
myCurDetected = 1;
|
||||
}
|
||||
Handle(SelectMgr_EntityOwner) anOwner = myMainVS->Picked (myCurDetected);
|
||||
if (anOwner.IsNull())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
manageDetected (anOwner, theView, theToRedrawImmediate);
|
||||
return myCurDetected;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : HilightPreviousDetected
|
||||
//purpose :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer AIS_LocalContext::HilightPreviousDetected(const Handle(V3d_View)& V)
|
||||
Standard_Integer AIS_LocalContext::HilightPreviousDetected (const Handle(V3d_View)& theView,
|
||||
const Standard_Boolean theToRedrawImmediate)
|
||||
{
|
||||
if(myDetectedSeq.IsEmpty()) return Standard_False;
|
||||
|
||||
myCurDetected--;
|
||||
|
||||
if(myCurDetected<1)
|
||||
myCurDetected = 1;
|
||||
Handle(SelectMgr_EntityOwner) EO = myMainVS->Picked(myCurDetected);
|
||||
#ifdef IMP120402
|
||||
if( EO.IsNull() ) return 0;
|
||||
#endif
|
||||
|
||||
static Standard_Boolean Normal_State(Standard_True);
|
||||
static Standard_Boolean firsttime(Standard_True);
|
||||
if(firsttime){
|
||||
OSD_Environment toto("HITRI");
|
||||
if(!toto.Value().IsEmpty())
|
||||
Normal_State = Standard_False;
|
||||
firsttime = Standard_False;
|
||||
if (myDetectedSeq.IsEmpty())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (--myCurDetected < 1)
|
||||
{
|
||||
myCurDetected = 1;
|
||||
}
|
||||
Handle(SelectMgr_EntityOwner) anOwner = myMainVS->Picked (myCurDetected);
|
||||
if (anOwner.IsNull())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
if(Normal_State)
|
||||
ManageDetected(EO,V);
|
||||
else
|
||||
HilightTriangle(myCurDetected,V);
|
||||
manageDetected (anOwner, theView, theToRedrawImmediate);
|
||||
return myCurDetected;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : UnhilightLastDetected
|
||||
//purpose :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean AIS_LocalContext::UnhilightLastDetected(const Handle(V3d_View)& aview)
|
||||
Standard_Boolean AIS_LocalContext::UnhilightLastDetected (const Handle(V3d_View)& theView)
|
||||
{
|
||||
if(!IsValidIndex(mylastindex)) return Standard_False;
|
||||
myMainPM->BeginDraw();
|
||||
const Handle(SelectMgr_EntityOwner)& Ownr = myMapOfOwner(mylastindex);
|
||||
Standard_Integer HM(0);
|
||||
if(Ownr->HasSelectable()){
|
||||
Handle(SelectMgr_SelectableObject) SO = Ownr->Selectable();
|
||||
HM = GetHiMod(*((Handle(AIS_InteractiveObject)*)&SO));
|
||||
}
|
||||
myMapOfOwner(mylastindex)->Unhilight(myMainPM,HM);
|
||||
myMainPM->EndDraw(aview);
|
||||
mylastindex =0;
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : HilightTriangle
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void AIS_LocalContext::HilightTriangle(const Standard_Integer Rank,
|
||||
const Handle(V3d_View)& view)
|
||||
{
|
||||
static Standard_Integer PrevRank(0);
|
||||
if(Rank==PrevRank) return;
|
||||
Handle(SelectBasics_SensitiveEntity) SE = myMainVS->Primitive(Rank);
|
||||
if(SE->IsKind(STANDARD_TYPE(Select3D_SensitiveTriangulation)))
|
||||
if (!IsValidIndex (mylastindex))
|
||||
{
|
||||
Handle(Select3D_SensitiveTriangulation) Tr = *((Handle(Select3D_SensitiveTriangulation)*)&SE);
|
||||
gp_Pnt p1,p2,p3 ; Tr->DetectedTriangle(p1,p2,p3);
|
||||
|
||||
Handle(Graphic3d_ArrayOfTriangles) aTris = new Graphic3d_ArrayOfTriangles(3);
|
||||
aTris->AddVertex(p1);
|
||||
aTris->AddVertex(p2);
|
||||
aTris->AddVertex(p3);
|
||||
|
||||
static Handle(Prs3d_Presentation) TriPrs =
|
||||
new Prs3d_Presentation(myMainPM->StructureManager());
|
||||
TriPrs->Clear();
|
||||
#ifdef IMP300101
|
||||
Handle(Prs3d_ShadingAspect) asp = myCTX->DefaultDrawer()->ShadingAspect();
|
||||
asp->SetColor(myCTX->HilightColor());
|
||||
TriPrs->SetShadingAspect(asp);
|
||||
#endif
|
||||
Prs3d_Root::CurrentGroup(TriPrs)->AddPrimitiveArray(aTris);
|
||||
|
||||
#ifndef IMP300101
|
||||
if(view->TransientManagerBeginDraw())
|
||||
Visual3d_TransientManager::EndDraw();
|
||||
#endif
|
||||
if(view->TransientManagerBeginDraw()) {
|
||||
Visual3d_TransientManager::DrawStructure(TriPrs);
|
||||
Visual3d_TransientManager::EndDraw();
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
myMainPM->BeginImmediateDraw();
|
||||
const Handle(SelectMgr_EntityOwner)& anOwner = myMapOfOwner (mylastindex);
|
||||
const Standard_Integer aHilightMode = anOwner->HasSelectable()
|
||||
? GetHiMod (Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable()))
|
||||
: 0;
|
||||
|
||||
myMapOfOwner (mylastindex)->Unhilight (myMainPM, aHilightMode);
|
||||
myMainPM->EndImmediateDraw (theView);
|
||||
mylastindex = 0;
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@@ -29,10 +29,6 @@
|
||||
|
||||
class Graphic3d_AspectFillArea3d;
|
||||
class Graphic3d_Texture2Dmanual;
|
||||
class TopoDS_Shape;
|
||||
class TCollection_AsciiString;
|
||||
class PrsMgr_PresentationManager3d;
|
||||
class Prs3d_Presentation;
|
||||
|
||||
//! This class allows to map textures on shapes.
|
||||
//! Presentations modes AIS_WireFrame (0) and AIS_Shaded (1) behave in the same manner as in AIS_Shape,
|
||||
|
Reference in New Issue
Block a user