1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-09 18:50:54 +03:00

0025034: Highlighted dimension objects are not in Detected list of AIS_InteractiveContext:

Detected sequence in local ind interactive contexts is filled with interactive objects, not with AIS_Shape only.
This commit is contained in:
aba 2014-07-03 15:44:13 +04:00 committed by apn
parent 0a36ca0a40
commit 57ad5cbd5d
4 changed files with 85 additions and 48 deletions

View File

@ -1525,12 +1525,26 @@ is
---Purpose: returns the owner of the detected sensitive primitive. ---Purpose: returns the owner of the detected sensitive primitive.
InitDetected(me: mutable); InitDetected(me: mutable);
---Purpose:
-- Initialization for iteration through mouse-detected objects in
-- interactive context or in local context if it is opened.
MoreDetected(me) returns Boolean from Standard; MoreDetected(me) returns Boolean from Standard;
---Purpose:
-- @return true if there is more mouse-detected objects after the current one
-- during iteration through mouse-detected interactive objects.
NextDetected(me: mutable); NextDetected(me: mutable);
---Purpose:
-- Gets next current object during iteration through mouse-detected
-- interactive objects.
DetectedCurrentShape(me) returns Shape from TopoDS; DetectedCurrentShape(me) returns Shape from TopoDS;
---C++: return const & ---C++: return const &
---Purpose:
-- @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.
DetectedCurrentObject(me) returns InteractiveObject from AIS; DetectedCurrentObject(me) returns InteractiveObject from AIS;
--Purpose:
-- @return current mouse-detected interactive object or null object if there is no current detected.
---Category: SPECIFIC LOCAL CONTEXT ACTIONS. ---Category: SPECIFIC LOCAL CONTEXT ACTIONS.
@ -2078,13 +2092,16 @@ fields
myCurLocalIndex : Integer from Standard; myCurLocalIndex : Integer from Standard;
mylastmoveview : View from V3d; mylastmoveview : View from V3d;
-- the detected objects. -- The detected objects
myAISDetectedSeq : SequenceOfInteractive from AIS; myAISDetectedSeq : SequenceOfInteractive from AIS;
-- the sequence of detected interative objects.
myAISCurDetected : Integer from Standard; myAISCurDetected : Integer from Standard;
-- This variables is used by following functions: -- current detected interactive object.
-- This variable is used by following functions:
-- InitDetected(), MoreDetected(), NextDetected(), DetectedCurrentShape(), DetectedCurrentObject(). -- InitDetected(), MoreDetected(), NextDetected(), DetectedCurrentShape(), DetectedCurrentObject().
myZDetectionFlag: Boolean from Standard; myZDetectionFlag: Boolean from Standard;
-- This variables is used by SetZDetection() and ZDetection() methods -- This variable is used by SetZDetection() and ZDetection() methods
-- abd: -- abd:
myIsAutoActivateSelMode : Boolean from Standard; myIsAutoActivateSelMode : Boolean from Standard;

View File

@ -167,7 +167,7 @@ AIS_StatusOfDetection AIS_InteractiveContext::MoveTo (const Standard_Integer th
} }
Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable()); Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable());
if (!Handle(AIS_Shape)::DownCast (anObj).IsNull()) if (!anObj.IsNull())
{ {
myAISDetectedSeq.Append (anObj); myAISDetectedSeq.Append (anObj);
} }
@ -1327,15 +1327,16 @@ Standard_Integer AIS_InteractiveContext::HilightPreviousDetected (const Handle(V
//======================================================================= //=======================================================================
void AIS_InteractiveContext::InitDetected() void AIS_InteractiveContext::InitDetected()
{ {
if(HasOpenedContext()) if (HasOpenedContext())
{ {
myLocalContexts(myCurLocalIndex)->InitDetected(); myLocalContexts(myCurLocalIndex)->InitDetected();
return; return;
} }
if(myAISDetectedSeq.Length() != 0) if(myAISDetectedSeq.Length() != 0)
{
myAISCurDetected = 1; myAISCurDetected = 1;
}
} }
//======================================================================= //=======================================================================
@ -1344,10 +1345,12 @@ void AIS_InteractiveContext::InitDetected()
//======================================================================= //=======================================================================
Standard_Boolean AIS_InteractiveContext::MoreDetected() const Standard_Boolean AIS_InteractiveContext::MoreDetected() const
{ {
if(HasOpenedContext()) if (HasOpenedContext())
{
return myLocalContexts(myCurLocalIndex)->MoreDetected(); return myLocalContexts(myCurLocalIndex)->MoreDetected();
}
return (myAISCurDetected>0 &&myAISCurDetected <= myAISDetectedSeq.Length()) ? return (myAISCurDetected > 0 && myAISCurDetected <= myAISDetectedSeq.Length()) ?
Standard_True : Standard_False; Standard_True : Standard_False;
} }
@ -1370,33 +1373,35 @@ void AIS_InteractiveContext::NextDetected()
//function : DetectedCurrentShape //function : DetectedCurrentShape
//purpose : //purpose :
//======================================================================= //=======================================================================
const TopoDS_Shape& AIS_InteractiveContext::DetectedCurrentShape() const const TopoDS_Shape& AIS_InteractiveContext::DetectedCurrentShape() const
{ {
if(HasOpenedContext()) if (HasOpenedContext())
{
return myLocalContexts(myCurLocalIndex)->DetectedCurrentShape(); return myLocalContexts(myCurLocalIndex)->DetectedCurrentShape();
}
static TopoDS_Shape bidsh; static TopoDS_Shape aDummyShape;
if(myAISCurDetected > 0 &&
myAISCurDetected <= myAISDetectedSeq.Length()) Handle(AIS_Shape) aCurrentShape = Handle(AIS_Shape)::DownCast (DetectedCurrentObject());
return Handle(AIS_Shape)::DownCast(myAISDetectedSeq(myAISCurDetected))->Shape();
return bidsh; if (aCurrentShape.IsNull())
{
return aDummyShape;
}
return aCurrentShape->Shape();
} }
//======================================================================= //=======================================================================
//function : DetectedCurrentObject //function : DetectedCurrentObject
//purpose : //purpose :
//======================================================================= //=======================================================================
Handle(AIS_InteractiveObject) AIS_InteractiveContext::DetectedCurrentObject() const
Handle(AIS_InteractiveObject) AIS_InteractiveContext::DetectedCurrentObject() const { {
if(HasOpenedContext()) if (HasOpenedContext())
{
return myLocalContexts(myCurLocalIndex)->DetectedCurrentObject(); return myLocalContexts(myCurLocalIndex)->DetectedCurrentObject();
}
Handle(AIS_InteractiveObject) aBad; return MoreDetected() ? myAISDetectedSeq(myAISCurDetected) : NULL;
if(myAISCurDetected > 0 &&
myAISCurDetected <= myAISDetectedSeq.Length())
return myAISDetectedSeq(myAISCurDetected);
else
return aBad;
} }

View File

@ -340,11 +340,28 @@ is
---C++: inline ---C++: inline
InitDetected(me: mutable); InitDetected(me: mutable);
---Purpose:
-- Initialization for iteration through mouse-detected objects in local context.
MoreDetected(me) returns Boolean from Standard; MoreDetected(me) returns Boolean from Standard;
---Purpose:
-- @return true if there is more mouse-detected objects after the current one
-- during iteration through mouse-detected interactive objects.
NextDetected(me: mutable); NextDetected(me: mutable);
---Purpose:
-- Gets next current object during iteration through mouse-detected
-- interactive objects.
DetectedCurrentShape(me) returns Shape from TopoDS; DetectedCurrentShape(me) returns Shape from TopoDS;
---C++: return const & ---C++: return const &
---Purpose:
-- @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.
DetectedCurrentObject(me) returns InteractiveObject from AIS; DetectedCurrentObject(me) returns InteractiveObject from AIS;
---Purpose:
-- @return current mouse-detected interactive object or null object if there is no current detected.
HasDetectedShape(me) returns Boolean from Standard; HasDetectedShape(me) returns Boolean from Standard;
DetectedShape (me) returns Shape from TopoDS; DetectedShape (me) returns Shape from TopoDS;
@ -625,10 +642,13 @@ fields
myDetectedSeq : SequenceOfInteger from TColStd; myDetectedSeq : SequenceOfInteger from TColStd;
myCurDetected : Integer from Standard; myCurDetected : Integer from Standard;
-- the detected objects. -- The detected objects.
myAISDetectedSeq : SequenceOfInteractive from AIS; myAISDetectedSeq : SequenceOfInteractive from AIS;
-- the sequence of detected interative objects.
myAISCurDetected : Integer from Standard; myAISCurDetected : Integer from Standard;
-- This variables is used by following functions: -- current detected interactive object.
-- This variable is used by following functions:
-- InitDetected(), MoreDetected(), NextDetected(), DetectedCurrentShape(), DetectedCurrentObject(). -- InitDetected(), MoreDetected(), NextDetected(), DetectedCurrentShape(), DetectedCurrentObject().
friends friends

View File

@ -138,9 +138,9 @@ AIS_StatusOfDetection AIS_LocalContext::MoveTo (const Standard_Integer theXpix,
continue; continue;
} }
myDetectedSeq.Append (aDetIter); // normallly they are already arranged in correct order... myDetectedSeq.Append (aDetIter); // normally they are already arranged in correct order...
Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable()); Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable());
if (!Handle(AIS_Shape)::DownCast (anObj).IsNull()) if (!anObj.IsNull())
{ {
myAISDetectedSeq.Append (anObj); myAISDetectedSeq.Append (anObj);
} }
@ -1476,7 +1476,6 @@ Handle(SelectMgr_EntityOwner) AIS_LocalContext::FindSelectedOwnerFromShape(const
//function : AIS_LocalContext::InitDetected //function : AIS_LocalContext::InitDetected
//purpose : //purpose :
//======================================================================= //=======================================================================
void AIS_LocalContext::InitDetected() void AIS_LocalContext::InitDetected()
{ {
myAISCurDetected = myAISDetectedSeq.Length()? 1 : 0; myAISCurDetected = myAISDetectedSeq.Length()? 1 : 0;
@ -1486,47 +1485,43 @@ void AIS_LocalContext::InitDetected()
//function : AIS_LocalContext::MoreDetected //function : AIS_LocalContext::MoreDetected
//purpose : //purpose :
//======================================================================= //=======================================================================
Standard_Boolean AIS_LocalContext::MoreDetected() const Standard_Boolean AIS_LocalContext::MoreDetected() const
{ {
return (myAISCurDetected > 0 && myAISCurDetected <= myAISDetectedSeq.Length()); return (myAISCurDetected > 0 && myAISCurDetected <= myAISDetectedSeq.Length());
} }
//======================================================================= //=======================================================================
//function : AIS_LocalContext::NextDetected //function : AIS_LocalContext::NextDetected
//purpose : //purpose :
//======================================================================= //=======================================================================
void AIS_LocalContext::NextDetected() void AIS_LocalContext::NextDetected()
{ {
if (MoreDetected()) myAISCurDetected++; myAISCurDetected++;
} }
//======================================================================= //=======================================================================
//function : DetectedCurrentShape //function : DetectedCurrentShape
//purpose : //purpose :
//======================================================================= //=======================================================================
const TopoDS_Shape& AIS_LocalContext::DetectedCurrentShape() const const TopoDS_Shape& AIS_LocalContext::DetectedCurrentShape() const
{ {
static TopoDS_Shape bidsh; static TopoDS_Shape aDummyShape;
if (MoreDetected())
return Handle(AIS_Shape)::DownCast(myAISDetectedSeq(myAISCurDetected))->Shape();
return bidsh;
}
Handle(AIS_Shape) aCurrentShape = Handle(AIS_Shape)::DownCast (DetectedCurrentObject());
if (aCurrentShape.IsNull())
{
return aDummyShape;
}
return aCurrentShape->Shape();
}
//======================================================================= //=======================================================================
//function : DetectedCurrentObject //function : DetectedCurrentObject
//purpose : //purpose :
//======================================================================= //=======================================================================
Handle(AIS_InteractiveObject) AIS_LocalContext::DetectedCurrentObject() const Handle(AIS_InteractiveObject) AIS_LocalContext::DetectedCurrentObject() const
{ {
Handle(AIS_InteractiveObject) theIObj; return MoreDetected() ? myAISDetectedSeq(myAISCurDetected) : NULL;
if (MoreDetected())
theIObj = myAISDetectedSeq(myAISCurDetected);
return theIObj;
} }
#endif #endif