1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-19 13:40:49 +03:00

0029470: Samples - eliminate references to deprecated Local Context from MFC sample

AIS_InteractiveContext::MoveTo(), ::Select(), ::ShiftSelect() now throw
an exception on invalid V3d_View argument instead of returning empty results.
AIS_InteractiveContext::DetectedShape() and ::BeginImmediateDraw() now can
be called without opened Local Context.

Draw Harness - removed unused commands vsetam, vunsetam.
Removed unused methods ViewerTest::StandardModeActivation(), ::PickObject(), PickObjects().
Interactive input of Selection modes 0..7 now redirects to vselmode
instead of removed ViewerTest::StandardModeActivation().
This commit is contained in:
kgv
2018-03-11 13:21:01 +03:00
committed by bugmaster
parent d9ca2e0cb1
commit 8c088c52fc
22 changed files with 374 additions and 939 deletions

View File

@@ -46,8 +46,6 @@ class Prs3d_Presentation;
class AIS_Triangulation;
class AIS_InteractiveContext;
class AIS_GraphicTool;
class AIS_LocalContext;
class AIS_LocalStatus;
class AIS_GlobalStatus;
class AIS_InteractiveObject;
class AIS_Point;
@@ -87,112 +85,52 @@ class AIS_BadEdgeFilter;
class AIS_Selection;
//! Application Interactive Services provide the means to
//! create links between an application GUI viewer and
//! the packages which are used to manage selection
//! and presentation. The tools AIS defined in order to
//! do this include different sorts of entities: both the
//! selectable viewable objects themselves and the
//! context and attribute managers to define their
//! selection and display.
//! To orient the user as he works in a modeling
//! environment, views and selections must be
//! comprehensible. There must be several different sorts
//! of selectable and viewable object defined. These must
//! also be interactive, that is, connecting graphic
//! representation and the underlying reference
//! geometry. These entities are called Interactive
//! Objects, and are divided into four types:
//! Application Interactive Services provide the means to create links between an application GUI viewer and
//! the packages which are used to manage selection and presentation.
//! The tools AIS defined in order to do this include different sorts of entities:
//! both the selectable viewable objects themselves and the context and attribute managers to define their selection and display.
//! To orient the user as he works in a modeling environment, views and selections must be comprehensible.
//! There must be several different sorts of selectable and viewable object defined.
//! These must also be interactive, that is, connecting graphic representation and the underlying reference geometry.
//! These entities are called Interactive Objects, and are divided into four types:
//! - the Datum
//! - the Relation
//! - the Object
//! - None.
//! The Datum groups together the construction elements
//! such as lines, circles, points, trihedra, plane trihedra,
//! planes and axes.
//! The Relation is made up of constraints on one or
//! more interactive shapes and the corresponding
//! reference geometry. For example, you might want to
//! constrain two edges in a parallel relation. This
//! contraint is considered as an object in its own right,
//! and is shown as a sensitive primitive. This takes the
//! graphic form of a perpendicular arrow marked with
//! the || symbol and lying between the two edges.
//! The Object type includes topological shapes, and
//! connections between shapes.
//! None, in order not to eliminate the object, tells the
//! application to look further until it finds an object
//! definition in its generation which is accepted.
//! Inside these categories, you have the possibility
//! of an additional characterization by means of a
//! signature. The signature provides an index to the
//! further characterization. By default, the Interactive
//! Object has a None type and a signature of 0
//! (equivalent to None.) If you want to give a particular
//! type and signature to your interactive object, you must
//! redefine the two virtual methods: Type and Signature.
//! In the C++ inheritance structure of the package, each
//! class representing a specific Interactive Object
//! inherits AIS_InteractiveObject. Among these
//! inheriting classes, AIS_Relation functions as the
//! abstract mother class for tinheriting classes defining
//! display of specific relational constraints and types of
//! dimension. Some of these include:
//! - display of constraints based on relations of
//! symmetry, tangency, parallelism and concentricity
//! - display of dimensions for angles, offsets,
//! diameters, radii and chamfers.
//! No viewer can show everything at once with any
//! coherence or clarity. Views must be managed
//! carefully both sequentially and at any given instant.
//! Another function of the view is that of a context to
//! carry out design in. The design changes are applied
//! to the objects in the view and then extended to the
//! underlying reference geometry by a solver. To make
//! sense of this complicated visual data, several display
//! and selection tools are required. To facilitate
//! management, each object and each construction
//! element has a selection priority. There are also
//! means to modify the default priority.
//! To define an environment of dynamic detection, you
//! can use standard filter classes or create your own. A
//! filter questions the owner of the sensitive primitive in
//! local context to determine if it has the the desired
//! qualities. If it answers positively, it is kept. If not, it is rejected.
//! The Datum groups together the construction elements such as lines, circles, points, trihedra, plane trihedra, planes and axes.
//! The Relation is made up of constraints on one or more interactive shapes and the corresponding reference geometry.
//! For example, you might want to constrain two edges in a parallel relation.
//! This contraint is considered as an object in its own right, and is shown as a sensitive primitive.
//! This takes the graphic form of a perpendicular arrow marked with the || symbol and lying between the two edges.
//! The Object type includes topological shapes, and connections between shapes.
//! None, in order not to eliminate the object, tells the application to look further until it finds an object definition in its generation which is accepted.
//! Inside these categories, you have the possibility of an additional characterization by means of a signature.
//! The signature provides an index to the further characterization.
//! By default, the Interactive Object has a None type and a signature of 0 (equivalent to None.)
//! If you want to give a particular type and signature to your interactive object, you must redefine the two virtual methods: Type and Signature.
//! In the C++ inheritance structure of the package, each class representing a specific Interactive Object inherits AIS_InteractiveObject.
//! Among these inheriting classes, AIS_Relation functions as the abstract mother class for tinheriting classes defining display of specific relational constraints and types of dimension.
//! Some of these include:
//! - display of constraints based on relations of symmetry, tangency, parallelism and concentricity
//! - display of dimensions for angles, offsets, diameters, radii and chamfers.
//! No viewer can show everything at once with any coherence or clarity.
//! Views must be managed carefully both sequentially and at any given instant.
//! Another function of the view is that of a context to carry out design in.
//! The design changes are applied to the objects in the view and then extended to the underlying reference geometry by a solver.
//! To make sense of this complicated visual data, several display and selection tools are required.
//! To facilitate management, each object and each construction element has a selection priority.
//! There are also means to modify the default priority.
//! To define an environment of dynamic detection, you can use standard filter classes or create your own.
//! A filter questions the owner of the sensitive primitive to determine if it has the the desired qualities.
//! If it answers positively, it is kept. If not, it is rejected.
//! The standard filters supplied in AIS include:
//! AIS_AttributeFilter
//! AIS_SignatureFilter
//! AIS_TypeFilter.
//! Only the type filter can be used in the default
//! operating mode, the neutral point. The others can
//! only be used in open local contexts.
//! Neutral point and local context constitute the two
//! operating modes of the central entity which pilots
//! visualizations and selections, the Interactive Context.
//! It is linked to a main viewer and if you like, a trash bin
//! viewer as well.
//! The neutral point, which is the default mode, allows
//! you to easily visualize and select interactive objects
//! which have been loaded into the context. Opening
//! local contexts allows you to prepare and use a
//! temporary selection environment without disturbing
//! the neutral point. A set of functions allows you to
//! choose the interactive objects which you want to act
//! on, the selection modes which you want to activate,
//! and the temporary visualizations which you will
//! execute. When the operation is finished, you close the
//! current local context and return to the state in which
//! you were before opening it (neutral point or previous
//! local context).
//! An interactive object can have a certain number of
//! graphic attributes which are specific to it, such as
//! visualization mode, color, and material. By the same
//! token, the interactive context has a set of graphic
//! attributes, the Drawer which is valid by default for the
//! objects it controls. When an interactive object is
//! visualized, the required graphic attributes are first
//! taken from the object's own Drawer if one exists, or
//! from the context drawer for the others.
//! - AIS_AttributeFilter
//! - AIS_SignatureFilter
//! - AIS_TypeFilter.
//! A set of functions allows you to choose the interactive objects which you want to act on, the selection modes which you want to activate.
//! An interactive object can have a certain number of graphic attributes which are specific to it, such as visualization mode, color, and material.
//! By the same token, the interactive context has a set of graphic attributes, the Drawer which is valid by default for the objects it controls.
//! When an interactive object is visualized, the required graphic attributes are first taken from the object's own Drawer if one exists, or from the context drawer for the others.
class AIS
{
public:
@@ -312,69 +250,6 @@ public:
Standard_EXPORT static void ComputeProjVertexPresentation (const Handle(Prs3d_Presentation)& aPres, const Handle(Prs3d_Drawer)& aDrawer, const TopoDS_Vertex& aVertex, const gp_Pnt& ProjPoint, const Quantity_NameOfColor aColor = Quantity_NOC_PURPLE, const Standard_Real aWidth = 2, const Aspect_TypeOfMarker aProjTOM = Aspect_TOM_PLUS, const Aspect_TypeOfLine aCallTOL = Aspect_TOL_DOT);
protected:
private:
friend class AIS_Triangulation;
friend class AIS_InteractiveContext;
friend class AIS_GraphicTool;
friend class AIS_LocalContext;
friend class AIS_LocalStatus;
friend class AIS_GlobalStatus;
friend class AIS_InteractiveObject;
friend class AIS_Point;
friend class AIS_Axis;
friend class AIS_Trihedron;
friend class AIS_PlaneTrihedron;
friend class AIS_Line;
friend class AIS_Circle;
friend class AIS_Plane;
friend class AIS_Shape;
friend class AIS_ConnectedInteractive;
friend class AIS_MultipleConnectedInteractive;
friend class AIS_DimensionOwner;
friend class AIS_Relation;
friend class AIS_EllipseRadiusDimension;
friend class AIS_MaxRadiusDimension;
friend class AIS_MinRadiusDimension;
friend class AIS_Chamf2dDimension;
friend class AIS_Chamf3dDimension;
friend class AIS_OffsetDimension;
friend class AIS_FixRelation;
friend class AIS_PerpendicularRelation;
friend class AIS_ParallelRelation;
friend class AIS_TangentRelation;
friend class AIS_ConcentricRelation;
friend class AIS_IdenticRelation;
friend class AIS_SymmetricRelation;
friend class AIS_MidPointRelation;
friend class AIS_EqualRadiusRelation;
friend class AIS_EqualDistanceRelation;
friend class AIS_TypeFilter;
friend class AIS_SignatureFilter;
friend class AIS_ExclusionFilter;
friend class AIS_AttributeFilter;
friend class AIS_C0RegularityFilter;
friend class AIS_BadEdgeFilter;
friend class AIS_Selection;
};
#endif // _AIS_HeaderFile

View File

@@ -122,6 +122,7 @@ myCurHighlighted(0),
myPickingStrategy (SelectMgr_PickingStrategy_FirstAcceptable),
myIsAutoActivateSelMode(Standard_True)
{
mgrSelector->Add (myMainSel);
myStyles[Prs3d_TypeOfHighlight_None] = myDefaultDrawer;
myStyles[Prs3d_TypeOfHighlight_Selected] = new Prs3d_Drawer();
myStyles[Prs3d_TypeOfHighlight_Dynamic] = new Prs3d_Drawer();
@@ -2694,7 +2695,6 @@ Standard_Boolean AIS_InteractiveContext::IsInLocal (const Handle(AIS_Interactive
//=======================================================================
void AIS_InteractiveContext::InitAttributes()
{
mgrSelector->Add (myMainSel);
Graphic3d_MaterialAspect aMat (Graphic3d_NOM_BRASS);
myDefaultDrawer->ShadingAspect()->SetMaterial (aMat);

View File

@@ -57,7 +57,6 @@ class Prs3d_LineAspect;
class Prs3d_BasicAspect;
class SelectMgr_EntityOwner;
class SelectMgr_Filter;
class TCollection_AsciiString;
//! The Interactive Context allows you to manage graphic behavior and selection of Interactive Objects in one or more viewers.
//! Class methods make this highly transparent.
@@ -153,7 +152,7 @@ public: //! @name object display management
Standard_EXPORT void Remove (const Handle(AIS_InteractiveObject)& theIObj,
const Standard_Boolean theToUpdateViewer);
//! Removes all the objects from all opened Local Contexts and from the Neutral Point.
//! Removes all the objects from Context.
Standard_EXPORT void RemoveAll (const Standard_Boolean theToUpdateViewer);
//! Recomputes the seen parts presentation of the Object.
@@ -341,7 +340,6 @@ public: //! @name mouse picking logic (detection and dynamic highlighting of ent
//! 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.
//! @sa PickingStrategy()
Standard_EXPORT AIS_StatusOfDetection MoveTo (const Standard_Integer theXPix,
@@ -502,7 +500,7 @@ public: //! @name Selection management
Standard_EXPORT void UnhilightSelected (const Standard_Boolean theToUpdateViewer);
//! Updates the list of selected objects:
//! i.e. highlights the newely selected ones and unhighlights previously selected objects.
//! i.e. highlights the newly selected ones and unhighlights previously selected objects.
//! @sa HilightSelected().
Standard_EXPORT void UpdateSelected (const Standard_Boolean theToUpdateViewer);
@@ -646,7 +644,7 @@ public: //! @name management of active Selection Modes
//! Deactivates all the activated selection mode at all displayed objects.
Standard_EXPORT void Deactivate();
//! Returns the list of activated selection modes in an open context.
//! Returns the list of activated selection modes.
Standard_EXPORT void ActivatedModes (const Handle(AIS_InteractiveObject)& anIobj, TColStd_ListOfInteger& theList) const;
//! Returns a collection containing all entity owners created for the interactive object in specified selection mode (in all active modes if the Mode == -1)
@@ -1111,17 +1109,17 @@ public: //! @name Local Context management (deprecated)
//! If you have opened a local context by loading an object with the default options (<AllowShapeDecomposition >= Standard_True),
//! all objects of the "Shape" type are also activated with the same modes.
//! You can act on the state of these "Standard" objects by using SetShapeDecomposition(Status).
Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
Standard_DEPRECATED ("Local Context is deprecated - ::Activate() and AIS_Shape::SelectionMode() should be used instead")
Standard_EXPORT void ActivateStandardMode (const TopAbs_ShapeEnum aStandardActivation);
//! Provides an alternative to the Display methods when deactivating specific selection modes.
//! This has the effect of deactivating the corresponding selection mode aStandardActivation for all objects
//! in Local Context which accept decomposition into sub-shapes.
Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
Standard_DEPRECATED ("Local Context is deprecated - ::Deactivate() should be used instead")
Standard_EXPORT void DeactivateStandardMode (const TopAbs_ShapeEnum aStandardActivation);
//! Returns the list of activated standard selection modes available in a local context.
Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
Standard_DEPRECATED ("Local Context is deprecated - list of activated Selection Modes should be tracked on application side; see also ::ActivatedModes()")
Standard_EXPORT const TColStd_ListOfInteger& ActivatedStandardModes() const;
//! returns if possible, the first local context where the object is seen
@@ -1174,51 +1172,51 @@ public:
//! Initializes a scan of the current selected objects in Neutral Point.
//! Objects selected when there is no open local context are called current objects; those selected in open local context, selected objects.
Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
Standard_DEPRECATED ("Local Context is deprecated - ::InitSelected() should be called instead")
Standard_EXPORT void InitCurrent();
//! Returns true if there is another object found by the scan of the list of current objects.
//! Objects selected when there is no open local context are called current objects; those selected in open local context, selected objects.
Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
Standard_DEPRECATED ("Local Context is deprecated - ::MoreSelected() should be called instead")
Standard_EXPORT Standard_Boolean MoreCurrent() const;
//! Continues the scan to the next object in the list of current objects.
//! Objects selected when there is no open local context are called current objects; those selected in open local context, selected objects.
Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
Standard_DEPRECATED ("Local Context is deprecated - ::NextSelected() should be called instead")
Standard_EXPORT void NextCurrent();
//! Returns the current interactive object.
//! Objects selected when there is no open local context are called current objects; those selected in open local context, selected objects.
Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
Standard_DEPRECATED ("Local Context is deprecated - ::SelectedInteractive() should be called instead")
Standard_EXPORT Handle(AIS_InteractiveObject) Current() const;
Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
Standard_DEPRECATED ("Local Context is deprecated - ::NbSelected() should be called instead")
Standard_EXPORT Standard_Integer NbCurrents();
//! Highlights current objects.
//! Objects selected when there is no open local context are called current objects; those selected in open local context, selected objects.
Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
Standard_DEPRECATED ("Local Context is deprecated - ::HilightSelected() should be called instead")
Standard_EXPORT void HilightCurrents (const Standard_Boolean theToUpdateViewer);
//! Removes highlighting from current objects.
//! Objects selected when there is no open local context are called current objects; those selected in open local context, selected objects.
Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
Standard_DEPRECATED ("Local Context is deprecated - ::UnhilightSelected() should be called instead")
Standard_EXPORT void UnhilightCurrents (const Standard_Boolean theToUpdateViewer);
//! Empties previous current objects in order to get the current objects detected by the selector using UpdateCurrent.
//! Objects selected when there is no open local context are called current objects; those selected in open local context, selected objects.
Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
Standard_DEPRECATED ("Local Context is deprecated - ::ClearSelected() should be called instead")
Standard_EXPORT void ClearCurrents (const Standard_Boolean theToUpdateViewer);
//! @return current mouse-detected shape or empty (null) shape, if current interactive object
//! is not a shape (AIS_Shape) or there is no current mouse-detected interactive object at all.
//! @sa DetectedCurrentOwner()/InitDetected()/MoreDetected()/NextDetected().
Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
Standard_DEPRECATED ("Local Context is deprecated - ::DetectedCurrentOwner() should be called instead")
Standard_EXPORT const TopoDS_Shape& DetectedCurrentShape() const;
//! @return current mouse-detected interactive object or null object, if there is no currently detected interactives
//! @sa DetectedCurrentOwner()/InitDetected()/MoreDetected()/NextDetected().
Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
Standard_DEPRECATED ("Local Context is deprecated - ::DetectedCurrentOwner() should be called instead")
Standard_EXPORT Handle(AIS_InteractiveObject) DetectedCurrentObject() const;
public: //! @name sub-intensity management (deprecated)

View File

@@ -303,6 +303,11 @@ AIS_StatusOfDetection AIS_InteractiveContext::MoveTo (const Standard_Integer th
const Handle(V3d_View)& theView,
const Standard_Boolean theToRedrawOnUpdate)
{
if (theView->Viewer() != myMainVwr)
{
throw Standard_ProgramError ("AIS_InteractiveContext::MoveTo() - invalid argument");
}
if (HasOpenedContext())
{
myWasLastMain = Standard_True;
@@ -313,11 +318,6 @@ AIS_StatusOfDetection AIS_InteractiveContext::MoveTo (const Standard_Integer th
myCurHighlighted = 0;
myDetectedSeq.Clear();
if (theView->Viewer() != myMainVwr)
{
return AIS_SOD_Error;
}
// preliminaires
myLastPicked = myLastinMain;
myWasLastMain = Standard_True;
@@ -454,6 +454,11 @@ AIS_StatusOfPick AIS_InteractiveContext::Select (const Standard_Integer theXPMi
const Handle(V3d_View)& theView,
const Standard_Boolean toUpdateViewer)
{
if (theView->Viewer() != myMainVwr)
{
throw Standard_ProgramError ("AIS_InteractiveContext::Select() - invalid argument");
}
// all objects detected by the selector are taken, previous current objects are emptied,
// new objects are put...
@@ -466,18 +471,11 @@ AIS_StatusOfPick AIS_InteractiveContext::Select (const Standard_Integer theXPMi
ClearSelected (Standard_False);
Handle(StdSelect_ViewerSelector3d) aSelector;
if (theView->Viewer() == myMainVwr)
myWasLastMain = Standard_True;
myMainSel->Pick (theXPMin, theYPMin, theXPMax, theYPMax, theView);
for (Standard_Integer aPickIter = 1; aPickIter <= myMainSel->NbPicked(); ++aPickIter)
{
aSelector = myMainSel;
myWasLastMain = Standard_True;
}
aSelector->Pick (theXPMin, theYPMin, theXPMax, theYPMax, theView);
for (Standard_Integer aPickIter = 1; aPickIter <= aSelector->NbPicked(); ++aPickIter)
{
const Handle(SelectMgr_EntityOwner)& aCurOwner = aSelector->Picked (aPickIter);
const Handle(SelectMgr_EntityOwner)& aCurOwner = myMainSel->Picked (aPickIter);
if (aCurOwner.IsNull() || !aCurOwner->HasSelectable() || !myFilters->IsOk (aCurOwner))
continue;
@@ -503,6 +501,11 @@ AIS_StatusOfPick AIS_InteractiveContext::Select (const TColgp_Array1OfPnt2d& the
const Handle(V3d_View)& theView,
const Standard_Boolean toUpdateViewer)
{
if (theView->Viewer() != myMainVwr)
{
throw Standard_ProgramError ("AIS_InteractiveContext::Select() - invalid argument");
}
// all objects detected by the selector are taken, previous current objects are emptied,
// new objects are put...
@@ -513,18 +516,11 @@ AIS_StatusOfPick AIS_InteractiveContext::Select (const TColgp_Array1OfPnt2d& the
ClearSelected (Standard_False);
Handle(StdSelect_ViewerSelector3d) aSelector;
if (theView->Viewer() == myMainVwr)
myWasLastMain = Standard_True;
myMainSel->Pick (thePolyline, theView);
for (Standard_Integer aPickIter = 1; aPickIter <= myMainSel->NbPicked(); ++aPickIter)
{
aSelector = myMainSel;
myWasLastMain = Standard_True;
}
aSelector->Pick (thePolyline, theView);
for (Standard_Integer aPickIter = 1; aPickIter <= aSelector->NbPicked(); ++aPickIter)
{
const Handle(SelectMgr_EntityOwner) anOwner = aSelector->Picked (aPickIter);
const Handle(SelectMgr_EntityOwner) anOwner = myMainSel->Picked (aPickIter);
if (anOwner.IsNull() || !anOwner->HasSelectable() || !myFilters->IsOk (anOwner))
continue;
@@ -640,6 +636,11 @@ AIS_StatusOfPick AIS_InteractiveContext::ShiftSelect (const Standard_Integer the
const Handle(V3d_View)& theView,
const Standard_Boolean toUpdateViewer)
{
if (theView->Viewer() != myMainVwr)
{
throw Standard_ProgramError ("AIS_InteractiveContext::ShiftSelect() - invalid argument");
}
if (HasOpenedContext())
{
return myLocalContexts(myCurLocalIndex)->ShiftSelect (theXPMin, theYPMin, theXPMax, theYPMax,
@@ -648,21 +649,11 @@ AIS_StatusOfPick AIS_InteractiveContext::ShiftSelect (const Standard_Integer the
UnhilightSelected (Standard_False);
Handle(StdSelect_ViewerSelector3d) aSelector;
if (theView->Viewer() == myMainVwr)
myWasLastMain = Standard_True;
myMainSel->Pick (theXPMin, theYPMin, theXPMax, theYPMax, theView);
for (Standard_Integer aPickIter = 1; aPickIter <= myMainSel->NbPicked(); ++aPickIter)
{
aSelector = myMainSel;
myWasLastMain = Standard_True;
}
else
{
return AIS_SOP_NothingSelected;
}
aSelector->Pick (theXPMin, theYPMin, theXPMax, theYPMax, theView);
for (Standard_Integer aPickIter = 1; aPickIter <= aSelector->NbPicked(); ++aPickIter)
{
const Handle(SelectMgr_EntityOwner) anOwner = aSelector->Picked (aPickIter);
const Handle(SelectMgr_EntityOwner) anOwner = myMainSel->Picked (aPickIter);
if (anOwner.IsNull() || !anOwner->HasSelectable() || !myFilters->IsOk (anOwner))
continue;
@@ -688,6 +679,11 @@ AIS_StatusOfPick AIS_InteractiveContext::ShiftSelect (const TColgp_Array1OfPnt2d
const Handle(V3d_View)& theView,
const Standard_Boolean toUpdateViewer)
{
if (theView->Viewer() != myMainVwr)
{
throw Standard_ProgramError ("AIS_InteractiveContext::ShiftSelect() - invalid argument");
}
if (HasOpenedContext())
{
return myLocalContexts(myCurLocalIndex)->ShiftSelect (thePolyline, theView, toUpdateViewer);
@@ -695,22 +691,11 @@ AIS_StatusOfPick AIS_InteractiveContext::ShiftSelect (const TColgp_Array1OfPnt2d
UnhilightSelected (Standard_False);
Handle(StdSelect_ViewerSelector3d) aSelector;
if (theView->Viewer() == myMainVwr)
myWasLastMain = Standard_True;
myMainSel->Pick (thePolyline, theView);
for (Standard_Integer aPickIter = 1; aPickIter <= myMainSel->NbPicked(); ++aPickIter)
{
aSelector= myMainSel;
myWasLastMain = Standard_True;
}
else
{
return AIS_SOP_NothingSelected;
}
aSelector->Pick (thePolyline, theView);
for (Standard_Integer aPickIter = 1; aPickIter <= aSelector->NbPicked(); ++aPickIter)
{
const Handle(SelectMgr_EntityOwner) anOwner = aSelector->Picked (aPickIter);
const Handle(SelectMgr_EntityOwner) anOwner = myMainSel->Picked (aPickIter);
if (anOwner.IsNull() || !anOwner->HasSelectable() || !myFilters->IsOk (anOwner))
continue;
@@ -1482,21 +1467,30 @@ Standard_Boolean AIS_InteractiveContext::HasDetected() const
Standard_Boolean AIS_InteractiveContext::HasDetectedShape() const
{
if(HasOpenedContext())
if (HasOpenedContext())
{
return myLocalContexts(myCurLocalIndex)->HasDetectedShape();
return Standard_False;
}
Handle(StdSelect_BRepOwner) anOwner = Handle(StdSelect_BRepOwner)::DownCast (myLastPicked);
return !anOwner.IsNull()
&& anOwner->HasShape();
}
//=======================================================================
//function : DetectedShape
//purpose :
//=======================================================================
const TopoDS_Shape&
AIS_InteractiveContext::DetectedShape() const
const TopoDS_Shape& AIS_InteractiveContext::DetectedShape() const
{
return myLocalContexts(myCurLocalIndex)->DetectedShape();
}
if (HasOpenedContext())
{
return myLocalContexts(myCurLocalIndex)->DetectedShape();
}
Handle(StdSelect_BRepOwner) anOwner = Handle(StdSelect_BRepOwner)::DownCast (myLastPicked);
return anOwner->Shape();
}
//=======================================================================
//function : DetectedInteractive
@@ -1696,13 +1690,9 @@ const TopoDS_Shape& AIS_InteractiveContext::DetectedCurrentShape() const
Standard_DISABLE_DEPRECATION_WARNINGS
Handle(AIS_Shape) aCurrentShape = Handle(AIS_Shape)::DownCast (DetectedCurrentObject());
Standard_ENABLE_DEPRECATION_WARNINGS
if (aCurrentShape.IsNull())
{
return AIS_InteractiveContext_myDummyShape;
}
return aCurrentShape->Shape();
return !aCurrentShape.IsNull()
? aCurrentShape->Shape()
: AIS_InteractiveContext_myDummyShape;
}
//=======================================================================
@@ -1717,8 +1707,8 @@ Handle(AIS_InteractiveObject) AIS_InteractiveContext::DetectedCurrentObject() co
}
return MoreDetected()
? Handle(AIS_InteractiveObject)::DownCast (myMainSel->Picked (myDetectedSeq (myCurDetected))->Selectable())
: NULL;
? Handle(AIS_InteractiveObject)::DownCast (myMainSel->Picked (myDetectedSeq (myCurDetected))->Selectable())
: Handle(AIS_InteractiveObject)();
}
//=======================================================================

View File

@@ -781,8 +781,11 @@ Standard_Integer AIS_InteractiveContext::PurgeViewer(const Handle(V3d_Viewer)& V
Standard_Boolean AIS_InteractiveContext::IsImmediateModeOn() const
{
if(!HasOpenedContext()) return Standard_False;
return myLocalContexts(myCurLocalIndex)->IsImmediateModeOn();
if (HasOpenedContext())
{
return myLocalContexts(myCurLocalIndex)->IsImmediateModeOn();
}
return myMainPM->IsImmediateModeOn();
}
//=======================================================================
@@ -792,8 +795,17 @@ Standard_Boolean AIS_InteractiveContext::IsImmediateModeOn() const
Standard_Boolean AIS_InteractiveContext::BeginImmediateDraw()
{
return HasOpenedContext()
&& myLocalContexts (myCurLocalIndex)->BeginImmediateDraw();
if (HasOpenedContext())
{
return myLocalContexts(myCurLocalIndex)->BeginImmediateDraw();
}
if (myMainPM->IsImmediateModeOn())
{
myMainPM->BeginImmediateDraw();
return Standard_True;
}
return Standard_False;
}
//=======================================================================
@@ -804,8 +816,18 @@ Standard_Boolean AIS_InteractiveContext::BeginImmediateDraw()
Standard_Boolean AIS_InteractiveContext::ImmediateAdd (const Handle(AIS_InteractiveObject)& theObj,
const Standard_Integer theMode)
{
return HasOpenedContext()
&& myLocalContexts (myCurLocalIndex)->ImmediateAdd (theObj, theMode);
if (HasOpenedContext())
{
return myLocalContexts(myCurLocalIndex)->ImmediateAdd (theObj, theMode);
}
if (!myMainPM->IsImmediateModeOn())
{
return Standard_False;
}
myMainPM->AddToImmediateList (myMainPM->Presentation (theObj, theMode)->Presentation());
return Standard_True;
}
//=======================================================================
@@ -815,8 +837,18 @@ Standard_Boolean AIS_InteractiveContext::ImmediateAdd (const Handle(AIS_Interact
Standard_Boolean AIS_InteractiveContext::EndImmediateDraw (const Handle(V3d_View)& theView)
{
return HasOpenedContext()
&& myLocalContexts (myCurLocalIndex)->EndImmediateDraw (theView->Viewer());
if (HasOpenedContext())
{
return myLocalContexts(myCurLocalIndex)->EndImmediateDraw (theView->Viewer());
}
if (!myMainPM->IsImmediateModeOn())
{
return Standard_False;
}
myMainPM->EndImmediateDraw (theView->Viewer());
return Standard_True;
}
//=======================================================================
@@ -826,12 +858,18 @@ Standard_Boolean AIS_InteractiveContext::EndImmediateDraw (const Handle(V3d_View
Standard_Boolean AIS_InteractiveContext::EndImmediateDraw()
{
if (!HasOpenedContext())
if (HasOpenedContext())
{
return myLocalContexts(myCurLocalIndex)->EndImmediateDraw (myMainVwr);
}
if (!myMainPM->IsImmediateModeOn())
{
return Standard_False;
}
return myLocalContexts (myCurLocalIndex)->EndImmediateDraw (myMainVwr);
myMainPM->EndImmediateDraw (myMainVwr);
return Standard_True;
}

View File

@@ -18,7 +18,6 @@
#include <AIS_GlobalStatus.hxx>
#include <AIS_InteractiveContext.hxx>
#include <AIS_InteractiveObject.hxx>
#include <AIS_LocalContext.hxx>
#include <Prs3d_BasicAspect.hxx>
#include <Prs3d_LineAspect.hxx>
#include <Quantity_Color.hxx>