mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +03:00
0027957: Visualization, AIS_InteractiveContext - protect from displaying the same AIS_InteractiveObject within multiple contexts
AIS_InteractiveContext methods adding object to the context now throws Standard_ProgramError exception if object has been already displayed in another context. AIS_InteractiveContext::Remove() now NULLifies context assigned to the object. AIS_InteractiveContext now inherits from Standard_Transient instead of deprecated MMgt_TShared and defines C++ destructor instead of method Delete(). AIS_InteractiveObject - undocumented property State() has been removed. Undocumented property Users() has been moved to AIS_IdenticRelation. Draw Harness command vclose now clear AIS_InteractiveContext content before nullifying it to ensure that objects have been properly removed. AIS_MultipleConnectedInteractive now overrides method ::SetContext() to assign context for children objects.
This commit is contained in:
parent
1be4179947
commit
2ec85268a1
@ -52,14 +52,19 @@ class AIS_IdenticRelation : public AIS_Relation
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//! Initializes the relation of identity between the two
|
//! Initializes the relation of identity between the two
|
||||||
//! entities, FirstShape and SecondShape. The plane
|
//! entities, FirstShape and SecondShape. The plane
|
||||||
//! aPlane is initialized in case a visual reference is
|
//! aPlane is initialized in case a visual reference is
|
||||||
//! needed to show identity.
|
//! needed to show identity.
|
||||||
Standard_EXPORT AIS_IdenticRelation(const TopoDS_Shape& FirstShape, const TopoDS_Shape& SecondShape, const Handle(Geom_Plane)& aPlane);
|
Standard_EXPORT AIS_IdenticRelation(const TopoDS_Shape& FirstShape, const TopoDS_Shape& SecondShape, const Handle(Geom_Plane)& aPlane);
|
||||||
|
|
||||||
|
Standard_Boolean HasUsers() const { return !myUsers.IsEmpty(); }
|
||||||
|
|
||||||
|
const TColStd_ListOfTransient& Users() const { return myUsers; }
|
||||||
|
|
||||||
|
void AddUser (const Handle(Standard_Transient)& theUser) { myUsers.Append (theUser); }
|
||||||
|
|
||||||
|
void ClearUsers() { myUsers.Clear(); }
|
||||||
|
|
||||||
//! Returns true if the interactive object is movable.
|
//! Returns true if the interactive object is movable.
|
||||||
virtual Standard_Boolean IsMovable() const Standard_OVERRIDE;
|
virtual Standard_Boolean IsMovable() const Standard_OVERRIDE;
|
||||||
@ -73,16 +78,8 @@ public:
|
|||||||
//! to the object to display before computation !!!
|
//! to the object to display before computation !!!
|
||||||
Standard_EXPORT virtual void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Geom_Transformation)& aTrsf, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE;
|
Standard_EXPORT virtual void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Geom_Transformation)& aTrsf, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
DEFINE_STANDARD_RTTIEXT(AIS_IdenticRelation,AIS_Relation)
|
DEFINE_STANDARD_RTTIEXT(AIS_IdenticRelation,AIS_Relation)
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
||||||
@ -136,12 +133,14 @@ private:
|
|||||||
|
|
||||||
Standard_EXPORT gp_Dir ComputeCircleDirection (const Handle(Geom_Circle)& aCirc, const TopoDS_Vertex& ConnectedVertex) const;
|
Standard_EXPORT gp_Dir ComputeCircleDirection (const Handle(Geom_Circle)& aCirc, const TopoDS_Vertex& ConnectedVertex) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
TColStd_ListOfTransient myUsers;
|
||||||
Standard_Boolean isCircle;
|
Standard_Boolean isCircle;
|
||||||
gp_Pnt myFAttach;
|
gp_Pnt myFAttach;
|
||||||
gp_Pnt mySAttach;
|
gp_Pnt mySAttach;
|
||||||
gp_Pnt myCenter;
|
gp_Pnt myCenter;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,9 +14,8 @@
|
|||||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||||
// commercial license or contractual agreement.
|
// commercial license or contractual agreement.
|
||||||
|
|
||||||
// Modified by XAB & Serguei Dec 97 (angle &deviation coeffts)
|
|
||||||
|
|
||||||
#include <AIS_ConnectedInteractive.hxx>
|
#include <AIS_ConnectedInteractive.hxx>
|
||||||
|
|
||||||
#include <AIS_DataMapIteratorOfDataMapOfILC.hxx>
|
#include <AIS_DataMapIteratorOfDataMapOfILC.hxx>
|
||||||
#include <AIS_DataMapIteratorOfDataMapOfIOStatus.hxx>
|
#include <AIS_DataMapIteratorOfDataMapOfIOStatus.hxx>
|
||||||
#include <AIS_GlobalStatus.hxx>
|
#include <AIS_GlobalStatus.hxx>
|
||||||
@ -61,9 +60,8 @@
|
|||||||
#include <V3d_View.hxx>
|
#include <V3d_View.hxx>
|
||||||
#include <V3d_Viewer.hxx>
|
#include <V3d_Viewer.hxx>
|
||||||
|
|
||||||
IMPLEMENT_STANDARD_RTTIEXT(AIS_InteractiveContext,MMgt_TShared)
|
IMPLEMENT_STANDARD_RTTIEXT(AIS_InteractiveContext, Standard_Transient)
|
||||||
|
|
||||||
//#include <AIS_DataMapIteratorOfDataMapOfInteractiveInteger.hxx>
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
typedef NCollection_DataMap<Handle(SelectMgr_SelectableObject), Handle(SelectMgr_IndexedMapOfOwner)> AIS_MapOfObjectOwners;
|
typedef NCollection_DataMap<Handle(SelectMgr_SelectableObject), Handle(SelectMgr_IndexedMapOfOwner)> AIS_MapOfObjectOwners;
|
||||||
@ -101,7 +99,11 @@ myIsAutoActivateSelMode(Standard_True)
|
|||||||
InitAttributes();
|
InitAttributes();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AIS_InteractiveContext::Delete() const
|
//=======================================================================
|
||||||
|
//function : ~AIS_InteractiveContext
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
AIS_InteractiveContext::~AIS_InteractiveContext()
|
||||||
{
|
{
|
||||||
// clear the current selection
|
// clear the current selection
|
||||||
mySelection->Clear();
|
mySelection->Clear();
|
||||||
@ -121,7 +123,6 @@ void AIS_InteractiveContext::Delete() const
|
|||||||
anObj->CurrentSelection()->UpdateBVHStatus (SelectMgr_TBU_Renew);
|
anObj->CurrentSelection()->UpdateBVHStatus (SelectMgr_TBU_Renew);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MMgt_TShared::Delete();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -389,11 +390,7 @@ void AIS_InteractiveContext::Display (const Handle(AIS_InteractiveObject)& theIO
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!theIObj->HasInteractiveContext())
|
setContextToObject (theIObj);
|
||||||
{
|
|
||||||
theIObj->SetContext (this);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (theDispStatus == AIS_DS_Temporary
|
if (theDispStatus == AIS_DS_Temporary
|
||||||
&& !HasOpenedContext())
|
&& !HasOpenedContext())
|
||||||
{
|
{
|
||||||
@ -494,11 +491,7 @@ void AIS_InteractiveContext::Load (const Handle(AIS_InteractiveObject)& theIObj,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!theIObj->HasInteractiveContext())
|
setContextToObject (theIObj);
|
||||||
{
|
|
||||||
theIObj->SetContext (this);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (HasOpenedContext())
|
if (HasOpenedContext())
|
||||||
{
|
{
|
||||||
myLocalContexts (myCurLocalIndex)->Load (theIObj, theToAllowDecomposition, theSelMode);
|
myLocalContexts (myCurLocalIndex)->Load (theIObj, theToAllowDecomposition, theSelMode);
|
||||||
@ -775,6 +768,15 @@ void AIS_InteractiveContext::Remove (const Handle(AIS_InteractiveObject)& theIOb
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (theIObj->HasInteractiveContext())
|
||||||
|
{
|
||||||
|
if (theIObj->myCTXPtr != this)
|
||||||
|
{
|
||||||
|
Standard_ProgramError::Raise ("AIS_InteractiveContext - object has been displayed in another context!");
|
||||||
|
}
|
||||||
|
theIObj->SetContext (Handle(AIS_InteractiveContext)());
|
||||||
|
}
|
||||||
|
|
||||||
if (HasOpenedContext())
|
if (HasOpenedContext())
|
||||||
{
|
{
|
||||||
myLocalContexts (myCurLocalIndex)->Remove (theIObj);
|
myLocalContexts (myCurLocalIndex)->Remove (theIObj);
|
||||||
@ -857,9 +859,7 @@ void AIS_InteractiveContext::HilightWithColor(const Handle(AIS_InteractiveObject
|
|||||||
if (theObj.IsNull())
|
if (theObj.IsNull())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!theObj->HasInteractiveContext())
|
setContextToObject (theObj);
|
||||||
theObj->SetContext (this);
|
|
||||||
|
|
||||||
if (!HasOpenedContext())
|
if (!HasOpenedContext())
|
||||||
{
|
{
|
||||||
if (!myObjects.IsBound (theObj))
|
if (!myObjects.IsBound (theObj))
|
||||||
@ -1115,11 +1115,7 @@ void AIS_InteractiveContext::SetDisplayPriority (const Handle(AIS_InteractiveObj
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!theIObj->HasInteractiveContext())
|
setContextToObject (theIObj);
|
||||||
{
|
|
||||||
theIObj->SetContext (this);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (myObjects.IsBound (theIObj))
|
if (myObjects.IsBound (theIObj))
|
||||||
{
|
{
|
||||||
Handle(AIS_GlobalStatus) aStatus = myObjects (theIObj);
|
Handle(AIS_GlobalStatus) aStatus = myObjects (theIObj);
|
||||||
@ -1523,11 +1519,7 @@ void AIS_InteractiveContext::SetDisplayMode (const Handle(AIS_InteractiveObject)
|
|||||||
const Standard_Integer theMode,
|
const Standard_Integer theMode,
|
||||||
const Standard_Boolean theToUpdateViewer)
|
const Standard_Boolean theToUpdateViewer)
|
||||||
{
|
{
|
||||||
if (!theIObj->HasInteractiveContext())
|
setContextToObject (theIObj);
|
||||||
{
|
|
||||||
theIObj->SetContext(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!myObjects.IsBound (theIObj))
|
if (!myObjects.IsBound (theIObj))
|
||||||
{
|
{
|
||||||
theIObj->SetDisplayMode (theMode);
|
theIObj->SetDisplayMode (theMode);
|
||||||
@ -1729,10 +1721,7 @@ void AIS_InteractiveContext::SetColor (const Handle(AIS_InteractiveObject)& theI
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!theIObj->HasInteractiveContext())
|
setContextToObject (theIObj);
|
||||||
{
|
|
||||||
theIObj->SetContext (this);
|
|
||||||
}
|
|
||||||
theIObj->SetColor (theColor);
|
theIObj->SetColor (theColor);
|
||||||
redisplayPrsRecModes (theIObj, theToUpdateViewer);
|
redisplayPrsRecModes (theIObj, theToUpdateViewer);
|
||||||
}
|
}
|
||||||
@ -1765,12 +1754,8 @@ void AIS_InteractiveContext::SetDeviationCoefficient (const Handle(AIS_Interacti
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!theIObj->HasInteractiveContext())
|
|
||||||
{
|
|
||||||
theIObj->SetContext (this);
|
|
||||||
}
|
|
||||||
|
|
||||||
// to be modified after the related methods of AIS_Shape are passed to InteractiveObject
|
// to be modified after the related methods of AIS_Shape are passed to InteractiveObject
|
||||||
|
setContextToObject (theIObj);
|
||||||
if (theIObj->Type() != AIS_KOI_Object
|
if (theIObj->Type() != AIS_KOI_Object
|
||||||
&& theIObj->Type() != AIS_KOI_Shape)
|
&& theIObj->Type() != AIS_KOI_Shape)
|
||||||
{
|
{
|
||||||
@ -1799,12 +1784,8 @@ void AIS_InteractiveContext::SetHLRDeviationCoefficient (const Handle(AIS_Intera
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!theIObj->HasInteractiveContext())
|
|
||||||
{
|
|
||||||
theIObj->SetContext (this);
|
|
||||||
}
|
|
||||||
|
|
||||||
// To be modified after the related methods of AIS_Shape are passed to InteractiveObject
|
// To be modified after the related methods of AIS_Shape are passed to InteractiveObject
|
||||||
|
setContextToObject (theIObj);
|
||||||
if (theIObj->Type() != AIS_KOI_Object
|
if (theIObj->Type() != AIS_KOI_Object
|
||||||
&& theIObj->Type() != AIS_KOI_Shape)
|
&& theIObj->Type() != AIS_KOI_Shape)
|
||||||
{
|
{
|
||||||
@ -1833,12 +1814,8 @@ void AIS_InteractiveContext::SetDeviationAngle (const Handle(AIS_InteractiveObje
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!theIObj->HasInteractiveContext())
|
|
||||||
{
|
|
||||||
theIObj->SetContext (this);
|
|
||||||
}
|
|
||||||
|
|
||||||
// To be modified after the related methods of AIS_Shape are passed to InteractiveObject
|
// To be modified after the related methods of AIS_Shape are passed to InteractiveObject
|
||||||
|
setContextToObject (theIObj);
|
||||||
if (theIObj->Type() != AIS_KOI_Shape)
|
if (theIObj->Type() != AIS_KOI_Shape)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@ -1866,12 +1843,8 @@ void AIS_InteractiveContext::SetAngleAndDeviation (const Handle(AIS_InteractiveO
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!theIObj->HasInteractiveContext())
|
|
||||||
{
|
|
||||||
theIObj->SetContext (this);
|
|
||||||
}
|
|
||||||
|
|
||||||
// To be modified after the related methods of AIS_Shape are passed to InteractiveObject
|
// To be modified after the related methods of AIS_Shape are passed to InteractiveObject
|
||||||
|
setContextToObject (theIObj);
|
||||||
if (theIObj->Type() != AIS_KOI_Shape)
|
if (theIObj->Type() != AIS_KOI_Shape)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@ -1908,12 +1881,8 @@ void AIS_InteractiveContext::SetHLRAngleAndDeviation (const Handle(AIS_Interacti
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!theIObj->HasInteractiveContext())
|
|
||||||
{
|
|
||||||
theIObj->SetContext (this);
|
|
||||||
}
|
|
||||||
|
|
||||||
// To be modified after the related methods of AIS_Shape are passed to InteractiveObject
|
// To be modified after the related methods of AIS_Shape are passed to InteractiveObject
|
||||||
|
setContextToObject (theIObj);
|
||||||
if (theIObj->Type() != AIS_KOI_Shape)
|
if (theIObj->Type() != AIS_KOI_Shape)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@ -1940,12 +1909,8 @@ void AIS_InteractiveContext::SetHLRDeviationAngle (const Handle(AIS_InteractiveO
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!theIObj->HasInteractiveContext())
|
|
||||||
{
|
|
||||||
theIObj->SetContext (this);
|
|
||||||
}
|
|
||||||
|
|
||||||
// To be modified after the related methods of AIS_Shape are passed to InteractiveObject
|
// To be modified after the related methods of AIS_Shape are passed to InteractiveObject
|
||||||
|
setContextToObject (theIObj);
|
||||||
if (theIObj->Type() != AIS_KOI_Shape)
|
if (theIObj->Type() != AIS_KOI_Shape)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@ -2025,11 +1990,7 @@ void AIS_InteractiveContext::SetWidth (const Handle(AIS_InteractiveObject)& theI
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!theIObj->HasInteractiveContext())
|
setContextToObject (theIObj);
|
||||||
{
|
|
||||||
theIObj->SetContext (this);
|
|
||||||
}
|
|
||||||
|
|
||||||
theIObj->SetWidth (theWidth);
|
theIObj->SetWidth (theWidth);
|
||||||
redisplayPrsRecModes (theIObj, theToUpdateViewer);
|
redisplayPrsRecModes (theIObj, theToUpdateViewer);
|
||||||
if (!myLastinMain.IsNull() && myLastinMain->IsSameSelectable (theIObj))
|
if (!myLastinMain.IsNull() && myLastinMain->IsSameSelectable (theIObj))
|
||||||
@ -2080,11 +2041,7 @@ void AIS_InteractiveContext::SetMaterial (const Handle(AIS_InteractiveObject)& t
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!theIObj->HasInteractiveContext())
|
setContextToObject (theIObj);
|
||||||
{
|
|
||||||
theIObj->SetContext (this);
|
|
||||||
}
|
|
||||||
|
|
||||||
theIObj->SetMaterial (theName);
|
theIObj->SetMaterial (theName);
|
||||||
redisplayPrsRecModes (theIObj, theToUpdateViewer);
|
redisplayPrsRecModes (theIObj, theToUpdateViewer);
|
||||||
}
|
}
|
||||||
@ -2117,11 +2074,7 @@ void AIS_InteractiveContext::SetTransparency (const Handle(AIS_InteractiveObject
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!theIObj->HasInteractiveContext())
|
setContextToObject (theIObj);
|
||||||
{
|
|
||||||
theIObj->SetContext (this);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!theIObj->IsTransparent()
|
if (!theIObj->IsTransparent()
|
||||||
&& theValue <= 0.05)
|
&& theValue <= 0.05)
|
||||||
{
|
{
|
||||||
@ -2194,11 +2147,7 @@ void AIS_InteractiveContext::SetLocalAttributes (const Handle(AIS_InteractiveObj
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!theIObj->HasInteractiveContext())
|
setContextToObject (theIObj);
|
||||||
{
|
|
||||||
theIObj->SetContext (this);
|
|
||||||
}
|
|
||||||
|
|
||||||
theIObj->SetAttributes (theDrawer);
|
theIObj->SetAttributes (theDrawer);
|
||||||
Update (theIObj, theToUpdateViewer);
|
Update (theIObj, theToUpdateViewer);
|
||||||
}
|
}
|
||||||
@ -2215,10 +2164,7 @@ void AIS_InteractiveContext::UnsetLocalAttributes (const Handle(AIS_InteractiveO
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!theIObj->HasInteractiveContext())
|
setContextToObject (theIObj);
|
||||||
{
|
|
||||||
theIObj->SetContext (this);
|
|
||||||
}
|
|
||||||
theIObj->UnsetAttributes();
|
theIObj->UnsetAttributes();
|
||||||
Update (theIObj, theToUpdateViewer);
|
Update (theIObj, theToUpdateViewer);
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,6 @@
|
|||||||
#include <Standard_Integer.hxx>
|
#include <Standard_Integer.hxx>
|
||||||
#include <AIS_DataMapOfILC.hxx>
|
#include <AIS_DataMapOfILC.hxx>
|
||||||
#include <AIS_SequenceOfInteractive.hxx>
|
#include <AIS_SequenceOfInteractive.hxx>
|
||||||
#include <MMgt_TShared.hxx>
|
|
||||||
#include <AIS_DisplayStatus.hxx>
|
#include <AIS_DisplayStatus.hxx>
|
||||||
#include <AIS_KindOfInteractive.hxx>
|
#include <AIS_KindOfInteractive.hxx>
|
||||||
#include <Standard_Real.hxx>
|
#include <Standard_Real.hxx>
|
||||||
@ -67,10 +66,6 @@ class Standard_Transient;
|
|||||||
class SelectMgr_Filter;
|
class SelectMgr_Filter;
|
||||||
class TCollection_AsciiString;
|
class TCollection_AsciiString;
|
||||||
|
|
||||||
|
|
||||||
class AIS_InteractiveContext;
|
|
||||||
DEFINE_STANDARD_HANDLE(AIS_InteractiveContext, MMgt_TShared)
|
|
||||||
|
|
||||||
//! The Interactive Context allows you to manage
|
//! The Interactive Context allows you to manage
|
||||||
//! graphic behavior and selection of Interactive Objects
|
//! graphic behavior and selection of Interactive Objects
|
||||||
//! in one or more viewers. Class methods make this
|
//! in one or more viewers. Class methods make this
|
||||||
@ -133,19 +128,19 @@ DEFINE_STANDARD_HANDLE(AIS_InteractiveContext, MMgt_TShared)
|
|||||||
//! selection mode is equal to 0, but it might be redefined if needed. Sub-part selection
|
//! selection mode is equal to 0, but it might be redefined if needed. Sub-part selection
|
||||||
//! of the objects without using local context provides a possibility to activate part
|
//! of the objects without using local context provides a possibility to activate part
|
||||||
//! selection modes along with global selection mode.
|
//! selection modes along with global selection mode.
|
||||||
class AIS_InteractiveContext : public MMgt_TShared
|
class AIS_InteractiveContext : public Standard_Transient
|
||||||
{
|
{
|
||||||
|
friend class AIS_LocalContext;
|
||||||
|
DEFINE_STANDARD_RTTIEXT(AIS_InteractiveContext, Standard_Transient)
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//! Constructs the interactive context object defined by
|
//! Constructs the interactive context object defined by
|
||||||
//! the principal viewer MainViewer.
|
//! the principal viewer MainViewer.
|
||||||
Standard_EXPORT AIS_InteractiveContext(const Handle(V3d_Viewer)& MainViewer);
|
Standard_EXPORT AIS_InteractiveContext(const Handle(V3d_Viewer)& MainViewer);
|
||||||
|
|
||||||
Standard_EXPORT virtual void Delete() const Standard_OVERRIDE;
|
//! Destructor.
|
||||||
|
Standard_EXPORT virtual ~AIS_InteractiveContext();
|
||||||
|
|
||||||
Standard_EXPORT void SetAutoActivateSelection (const Standard_Boolean Auto);
|
Standard_EXPORT void SetAutoActivateSelection (const Standard_Boolean Auto);
|
||||||
|
|
||||||
Standard_EXPORT Standard_Boolean GetAutoActivateSelection() const;
|
Standard_EXPORT Standard_Boolean GetAutoActivateSelection() const;
|
||||||
@ -1599,12 +1594,6 @@ public:
|
|||||||
//! Redraws immediate structures in all views of the viewer given taking into account its visibility.
|
//! Redraws immediate structures in all views of the viewer given taking into account its visibility.
|
||||||
Standard_EXPORT void RedrawImmediate (const Handle(V3d_Viewer)& theViewer);
|
Standard_EXPORT void RedrawImmediate (const Handle(V3d_Viewer)& theViewer);
|
||||||
|
|
||||||
|
|
||||||
friend class AIS_LocalContext;
|
|
||||||
|
|
||||||
|
|
||||||
DEFINE_STANDARD_RTTIEXT(AIS_InteractiveContext,MMgt_TShared)
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
Standard_EXPORT void GetDefModes (const Handle(AIS_InteractiveObject)& anIobj, Standard_Integer& Dmode, Standard_Integer& HiMod, Standard_Integer& SelMode) const;
|
Standard_EXPORT void GetDefModes (const Handle(AIS_InteractiveObject)& anIobj, Standard_Integer& Dmode, Standard_Integer& HiMod, Standard_Integer& SelMode) const;
|
||||||
@ -1700,6 +1689,22 @@ protected:
|
|||||||
? aHiDrawer->SelectionStyle() : mySelStyle;
|
? aHiDrawer->SelectionStyle() : mySelStyle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! Assign the context to the object or throw exception if object was already assigned to another context.
|
||||||
|
void setContextToObject (const Handle(AIS_InteractiveObject)& theObj)
|
||||||
|
{
|
||||||
|
if (theObj->HasInteractiveContext())
|
||||||
|
{
|
||||||
|
if (theObj->myCTXPtr != this)
|
||||||
|
{
|
||||||
|
Standard_ProgramError::Raise ("AIS_InteractiveContext - object has been already displayed in another context!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
theObj->SetContext (this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
AIS_DataMapOfIOStatus myObjects;
|
AIS_DataMapOfIOStatus myObjects;
|
||||||
@ -1730,14 +1735,10 @@ protected:
|
|||||||
Standard_Boolean myZDetectionFlag;
|
Standard_Boolean myZDetectionFlag;
|
||||||
Standard_Boolean myIsAutoActivateSelMode;
|
Standard_Boolean myIsAutoActivateSelMode;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
DEFINE_STANDARD_HANDLE(AIS_InteractiveContext, Standard_Transient)
|
||||||
|
|
||||||
#include <AIS_InteractiveContext.lxx>
|
#include <AIS_InteractiveContext.lxx>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif // _AIS_InteractiveContext_HeaderFile
|
#endif // _AIS_InteractiveContext_HeaderFile
|
||||||
|
@ -1163,9 +1163,7 @@ void AIS_InteractiveContext::AddOrRemoveSelected (const Handle(AIS_InteractiveOb
|
|||||||
if (!myObjects.IsBound (theObject) || !theObject->HasSelection (aGlobalSelMode))
|
if (!myObjects.IsBound (theObject) || !theObject->HasSelection (aGlobalSelMode))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!theObject->HasInteractiveContext())
|
setContextToObject (theObject);
|
||||||
theObject->SetContext (this);
|
|
||||||
|
|
||||||
const Handle(SelectMgr_EntityOwner) anOwner = theObject->GlobalSelOwner();
|
const Handle(SelectMgr_EntityOwner) anOwner = theObject->GlobalSelOwner();
|
||||||
|
|
||||||
if (anOwner.IsNull() || !anOwner->HasSelectable())
|
if (anOwner.IsNull() || !anOwner->HasSelectable())
|
||||||
|
@ -51,9 +51,7 @@ void AIS_InteractiveContext::SetPolygonOffsets(
|
|||||||
if ( anObj.IsNull() )
|
if ( anObj.IsNull() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( !anObj->HasInteractiveContext() )
|
setContextToObject (anObj);
|
||||||
anObj->SetContext( this );
|
|
||||||
|
|
||||||
anObj->SetPolygonOffsets( aMode, aFactor, aUnits );
|
anObj->SetPolygonOffsets( aMode, aFactor, aUnits );
|
||||||
|
|
||||||
if ( updateviewer ) {
|
if ( updateviewer ) {
|
||||||
|
@ -65,11 +65,8 @@ myCurrentFacingModel(Aspect_TOFM_BOTH_SIDE),
|
|||||||
myRecomputeEveryPrs(Standard_True),
|
myRecomputeEveryPrs(Standard_True),
|
||||||
myCTXPtr(NULL),
|
myCTXPtr(NULL),
|
||||||
mySelPriority(-1),
|
mySelPriority(-1),
|
||||||
myDisplayMode (-1),
|
myDisplayMode (-1)
|
||||||
mystate(0)
|
|
||||||
{
|
{
|
||||||
Handle (AIS_InteractiveContext) Bid;
|
|
||||||
myCTXPtr = Bid.operator->();
|
|
||||||
SetCurrentFacingModel();
|
SetCurrentFacingModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,16 +106,6 @@ Standard_Integer AIS_InteractiveObject::Signature() const
|
|||||||
Standard_Boolean AIS_InteractiveObject::RecomputeEveryPrs() const
|
Standard_Boolean AIS_InteractiveObject::RecomputeEveryPrs() const
|
||||||
{return myRecomputeEveryPrs;}
|
{return myRecomputeEveryPrs;}
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function :
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean AIS_InteractiveObject::HasInteractiveContext() const
|
|
||||||
{
|
|
||||||
Handle (AIS_InteractiveContext) aNull;
|
|
||||||
return (myCTXPtr != aNull.operator->());
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function :
|
//function :
|
||||||
//purpose :
|
//purpose :
|
||||||
@ -129,15 +116,21 @@ Handle(AIS_InteractiveContext) AIS_InteractiveObject::GetContext() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function :
|
//function : SetContext
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
void AIS_InteractiveObject::SetContext(const Handle(AIS_InteractiveContext)& aCtx)
|
void AIS_InteractiveObject::SetContext (const Handle(AIS_InteractiveContext)& theCtx)
|
||||||
{
|
{
|
||||||
myCTXPtr = aCtx.operator->();
|
if (myCTXPtr == theCtx.get())
|
||||||
if( aCtx.IsNull())
|
{
|
||||||
return;
|
return;
|
||||||
myDrawer->Link(aCtx->DefaultDrawer());
|
}
|
||||||
|
|
||||||
|
myCTXPtr = theCtx.get();
|
||||||
|
if (!theCtx.IsNull())
|
||||||
|
{
|
||||||
|
myDrawer->Link (theCtx->DefaultDrawer());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -160,35 +153,6 @@ void AIS_InteractiveObject::ClearOwner()
|
|||||||
myOwner.Nullify();
|
myOwner.Nullify();
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function :
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Boolean AIS_InteractiveObject::HasUsers() const
|
|
||||||
{
|
|
||||||
return (!myUsers.IsEmpty());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function :
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void AIS_InteractiveObject::AddUser(const Handle(Standard_Transient)& aUser)
|
|
||||||
{
|
|
||||||
myUsers.Append(aUser);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function :
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void AIS_InteractiveObject::ClearUsers()
|
|
||||||
{
|
|
||||||
myUsers.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function :
|
//function :
|
||||||
//purpose :
|
//purpose :
|
||||||
|
@ -17,36 +17,21 @@
|
|||||||
#ifndef _AIS_InteractiveObject_HeaderFile
|
#ifndef _AIS_InteractiveObject_HeaderFile
|
||||||
#define _AIS_InteractiveObject_HeaderFile
|
#define _AIS_InteractiveObject_HeaderFile
|
||||||
|
|
||||||
#include <Standard.hxx>
|
|
||||||
#include <Standard_Type.hxx>
|
|
||||||
|
|
||||||
#include <AIS_PToContext.hxx>
|
|
||||||
#include <TColStd_ListOfTransient.hxx>
|
|
||||||
#include <Standard_Real.hxx>
|
|
||||||
#include <Quantity_Color.hxx>
|
|
||||||
#include <Graphic3d_NameOfMaterial.hxx>
|
|
||||||
#include <Standard_Integer.hxx>
|
|
||||||
#include <Standard_Boolean.hxx>
|
|
||||||
#include <Aspect_TypeOfFacingModel.hxx>
|
#include <Aspect_TypeOfFacingModel.hxx>
|
||||||
#include <TColStd_ListOfInteger.hxx>
|
|
||||||
#include <SelectMgr_SelectableObject.hxx>
|
|
||||||
#include <PrsMgr_TypeOfPresentation3d.hxx>
|
|
||||||
#include <AIS_KindOfInteractive.hxx>
|
#include <AIS_KindOfInteractive.hxx>
|
||||||
#include <Quantity_NameOfColor.hxx>
|
#include <Graphic3d_NameOfMaterial.hxx>
|
||||||
#include <Standard_ShortReal.hxx>
|
#include <PrsMgr_TypeOfPresentation3d.hxx>
|
||||||
class Standard_Transient;
|
#include <SelectMgr_SelectableObject.hxx>
|
||||||
|
#include <TColStd_ListOfInteger.hxx>
|
||||||
|
#include <TColStd_ListOfTransient.hxx>
|
||||||
|
#include <Quantity_Color.hxx>
|
||||||
|
|
||||||
class AIS_InteractiveContext;
|
class AIS_InteractiveContext;
|
||||||
class Quantity_Color;
|
|
||||||
class Graphic3d_MaterialAspect;
|
class Graphic3d_MaterialAspect;
|
||||||
class Prs3d_Presentation;
|
class Prs3d_Presentation;
|
||||||
class Prs3d_BasicAspect;
|
class Prs3d_BasicAspect;
|
||||||
class Bnd_Box;
|
class Bnd_Box;
|
||||||
|
|
||||||
|
|
||||||
class AIS_InteractiveObject;
|
|
||||||
DEFINE_STANDARD_HANDLE(AIS_InteractiveObject, SelectMgr_SelectableObject)
|
|
||||||
|
|
||||||
|
|
||||||
//! Defines a class of objects with display and selection services.
|
//! Defines a class of objects with display and selection services.
|
||||||
//! Entities which are visualized and selected are
|
//! Entities which are visualized and selected are
|
||||||
//! Interactive Objects. You can make use of classes of
|
//! Interactive Objects. You can make use of classes of
|
||||||
@ -74,11 +59,10 @@ DEFINE_STANDARD_HANDLE(AIS_InteractiveObject, SelectMgr_SelectableObject)
|
|||||||
//! affect the same attributes in the Drawer.
|
//! affect the same attributes in the Drawer.
|
||||||
class AIS_InteractiveObject : public SelectMgr_SelectableObject
|
class AIS_InteractiveObject : public SelectMgr_SelectableObject
|
||||||
{
|
{
|
||||||
|
friend class AIS_InteractiveContext;
|
||||||
|
DEFINE_STANDARD_RTTIEXT(AIS_InteractiveObject, SelectMgr_SelectableObject)
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//! Returns the kind of Interactive Object:
|
//! Returns the kind of Interactive Object:
|
||||||
//! - None
|
//! - None
|
||||||
//! - Datum
|
//! - Datum
|
||||||
@ -125,8 +109,8 @@ public:
|
|||||||
//! Mode 2 : Selection Of Edges
|
//! Mode 2 : Selection Of Edges
|
||||||
//! Mode 3 : Selection Of Wires
|
//! Mode 3 : Selection Of Wires
|
||||||
//! Mode 4 : Selection Of Faces ...
|
//! Mode 4 : Selection Of Faces ...
|
||||||
virtual Standard_Boolean AcceptShapeDecomposition() const;
|
virtual Standard_Boolean AcceptShapeDecomposition() const { return Standard_False; }
|
||||||
|
|
||||||
//! change the current facing model apply on polygons for
|
//! change the current facing model apply on polygons for
|
||||||
//! SetColor(), SetTransparency(), SetMaterial() methods
|
//! SetColor(), SetTransparency(), SetMaterial() methods
|
||||||
//! default facing model is Aspect_TOFM_TWO_SIDE. This mean that attributes is
|
//! default facing model is Aspect_TOFM_TWO_SIDE. This mean that attributes is
|
||||||
@ -185,17 +169,15 @@ public:
|
|||||||
//! considered as infinite, i.e. its graphic presentations
|
//! considered as infinite, i.e. its graphic presentations
|
||||||
//! are not taken in account for View FitAll...
|
//! are not taken in account for View FitAll...
|
||||||
Standard_EXPORT void SetInfiniteState (const Standard_Boolean aFlag = Standard_True);
|
Standard_EXPORT void SetInfiniteState (const Standard_Boolean aFlag = Standard_True);
|
||||||
|
|
||||||
|
|
||||||
//! Returns true if the interactive object is infinite. In this
|
//! Returns true if the interactive object is infinite. In this
|
||||||
//! case, its graphic presentations are not taken into
|
//! case, its graphic presentations are not taken into
|
||||||
//! account in the fit-all view.
|
//! account in the fit-all view.
|
||||||
Standard_Boolean IsInfinite() const;
|
Standard_Boolean IsInfinite() const { return myInfiniteState; }
|
||||||
|
|
||||||
//! Indicates whether the Interactive Object has a pointer
|
//! Indicates whether the Interactive Object has a pointer to an interactive context.
|
||||||
//! to an interactive context.
|
Standard_Boolean HasInteractiveContext() const { return myCTXPtr != NULL; }
|
||||||
Standard_EXPORT Standard_Boolean HasInteractiveContext() const;
|
|
||||||
|
|
||||||
//! Returns the context pointer to the interactive context.
|
//! Returns the context pointer to the interactive context.
|
||||||
Standard_EXPORT Handle(AIS_InteractiveContext) GetContext() const;
|
Standard_EXPORT Handle(AIS_InteractiveContext) GetContext() const;
|
||||||
|
|
||||||
@ -218,32 +200,23 @@ public:
|
|||||||
//! edges, wires, and faces.
|
//! edges, wires, and faces.
|
||||||
//! - Users, presentable objects connecting to sensitive
|
//! - Users, presentable objects connecting to sensitive
|
||||||
//! primitives, or a shape which has been decomposed.
|
//! primitives, or a shape which has been decomposed.
|
||||||
const Handle(Standard_Transient)& GetOwner() const;
|
const Handle(Standard_Transient)& GetOwner() const { return myOwner; }
|
||||||
|
|
||||||
//! Allows you to attribute the owner ApplicativeEntity to
|
//! Allows you to attribute the owner theApplicativeEntity to
|
||||||
//! an Interactive Object. This can be a shape for a set of
|
//! an Interactive Object. This can be a shape for a set of
|
||||||
//! sub-shapes or a sub-shape for sub-shapes which it
|
//! sub-shapes or a sub-shape for sub-shapes which it
|
||||||
//! is composed of. The owner takes the form of a transient.
|
//! is composed of. The owner takes the form of a transient.
|
||||||
void SetOwner (const Handle(Standard_Transient)& ApplicativeEntity);
|
void SetOwner (const Handle(Standard_Transient)& theApplicativeEntity) { myOwner = theApplicativeEntity; }
|
||||||
|
|
||||||
//! Each Interactive Object has methods which allow us
|
//! Each Interactive Object has methods which allow us
|
||||||
//! to attribute an Owner to it in the form of a Transient.
|
//! to attribute an Owner to it in the form of a Transient.
|
||||||
//! This method removes the owner from the graphic entity.
|
//! This method removes the owner from the graphic entity.
|
||||||
Standard_EXPORT void ClearOwner();
|
Standard_EXPORT void ClearOwner();
|
||||||
|
|
||||||
Standard_EXPORT Standard_Boolean HasUsers() const;
|
|
||||||
|
|
||||||
const TColStd_ListOfTransient& Users() const;
|
|
||||||
|
|
||||||
Standard_EXPORT void AddUser (const Handle(Standard_Transient)& aUser);
|
|
||||||
|
|
||||||
Standard_EXPORT void ClearUsers();
|
|
||||||
|
|
||||||
|
|
||||||
//! Returns true if the Interactive Object has a display
|
//! Returns true if the Interactive Object has a display
|
||||||
//! mode setting. Otherwise, it is displayed in Neutral Point.
|
//! mode setting. Otherwise, it is displayed in Neutral Point.
|
||||||
Standard_Boolean HasDisplayMode() const;
|
Standard_Boolean HasDisplayMode() const { return myDisplayMode != -1; }
|
||||||
|
|
||||||
//! Sets the display mode aMode for the interactive object.
|
//! Sets the display mode aMode for the interactive object.
|
||||||
//! An object can have its own temporary display mode,
|
//! An object can have its own temporary display mode,
|
||||||
//! which is different from that proposed by the interactive context.
|
//! which is different from that proposed by the interactive context.
|
||||||
@ -252,17 +225,17 @@ public:
|
|||||||
//! - AIS_Shaded
|
//! - AIS_Shaded
|
||||||
//! This range can, however, be extended through the creation of new display modes.
|
//! This range can, however, be extended through the creation of new display modes.
|
||||||
Standard_EXPORT void SetDisplayMode (const Standard_Integer aMode);
|
Standard_EXPORT void SetDisplayMode (const Standard_Integer aMode);
|
||||||
|
|
||||||
//! Removes display mode settings from the interactive object.
|
//! Removes display mode settings from the interactive object.
|
||||||
void UnsetDisplayMode();
|
void UnsetDisplayMode() { myDisplayMode = -1; }
|
||||||
|
|
||||||
//! Returns the display mode setting of the Interactive Object.
|
//! Returns the display mode setting of the Interactive Object.
|
||||||
//! The range of possibilities is the following:
|
//! The range of possibilities is the following:
|
||||||
//! - AIS_WireFrame
|
//! - AIS_WireFrame
|
||||||
//! - AIS_Shaded
|
//! - AIS_Shaded
|
||||||
//! This range can, however, be extended through the
|
//! This range can, however, be extended through the
|
||||||
//! creation of new display modes.
|
//! creation of new display modes.
|
||||||
Standard_Integer DisplayMode() const;
|
Standard_Integer DisplayMode() const { return myDisplayMode; }
|
||||||
|
|
||||||
//! Returns the selection priority setting. -1 indicates that there is none.
|
//! Returns the selection priority setting. -1 indicates that there is none.
|
||||||
//! You can modify the selection priority of an owner to
|
//! You can modify the selection priority of an owner to
|
||||||
@ -281,20 +254,20 @@ public:
|
|||||||
//! - priority 5 - its origin
|
//! - priority 5 - its origin
|
||||||
//! - priority 3 - its axes
|
//! - priority 3 - its axes
|
||||||
//! - priority 2 - its planes
|
//! - priority 2 - its planes
|
||||||
Standard_Integer SelectionPriority() const;
|
Standard_Integer SelectionPriority() const { return mySelPriority; }
|
||||||
|
|
||||||
//! Allows you to provide a setting aPriority for selection priority.
|
//! Allows you to provide a setting thePriority for selection priority.
|
||||||
//! You can modify selection priority of an owner to make
|
//! You can modify selection priority of an owner to make
|
||||||
//! one entity more selectionable than another one. The
|
//! one entity more selectionable than another one. The
|
||||||
//! default selection priority for an owner is 5, for
|
//! default selection priority for an owner is 5, for
|
||||||
//! example. To increase selection priority, choose a
|
//! example. To increase selection priority, choose a
|
||||||
//! setting between 5 and 10. An entity with priority 7 will
|
//! setting between 5 and 10. An entity with priority 7 will
|
||||||
//! take priority over one with a setting of 6.
|
//! take priority over one with a setting of 6.
|
||||||
void SetSelectionPriority (const Standard_Integer aPriority);
|
void SetSelectionPriority (const Standard_Integer thePriority) { mySelPriority = thePriority; }
|
||||||
|
|
||||||
//! Removes the setting for selection priority. SelectionPriority then returns -1.
|
//! Removes the setting for selection priority. SelectionPriority then returns -1.
|
||||||
void UnsetSelectionPriority();
|
void UnsetSelectionPriority() { mySelPriority = -1; }
|
||||||
|
|
||||||
//! Returns true if there is a setting for selection priority.
|
//! Returns true if there is a setting for selection priority.
|
||||||
//! You can modify selection priority of an owner to make
|
//! You can modify selection priority of an owner to make
|
||||||
//! one entity more selectionable than another one. The
|
//! one entity more selectionable than another one. The
|
||||||
@ -302,11 +275,11 @@ public:
|
|||||||
//! example. To increase selection priority, choose a
|
//! example. To increase selection priority, choose a
|
||||||
//! setting between 5 and 10. An entity with priority 7 will
|
//! setting between 5 and 10. An entity with priority 7 will
|
||||||
//! take priority over one with a setting of 6.
|
//! take priority over one with a setting of 6.
|
||||||
Standard_Boolean HasSelectionPriority() const;
|
Standard_Boolean HasSelectionPriority() const { return mySelPriority != -1; }
|
||||||
|
|
||||||
//! Returns true if the Interactive Object is in highlight mode.
|
//! Returns true if the Interactive Object is in highlight mode.
|
||||||
Standard_Boolean HasHilightMode() const;
|
Standard_Boolean HasHilightMode() const { return myHilightMode != -1; }
|
||||||
|
|
||||||
//! Returns the setting for highlight mode.
|
//! Returns the setting for highlight mode.
|
||||||
//! At dynamic detection, the presentation echoed by the
|
//! At dynamic detection, the presentation echoed by the
|
||||||
//! Interactive Context, is by default the presentation
|
//! Interactive Context, is by default the presentation
|
||||||
@ -321,39 +294,39 @@ public:
|
|||||||
//! wireframe presentation or with shading, we want to
|
//! wireframe presentation or with shading, we want to
|
||||||
//! systematically highlight the wireframe presentation.
|
//! systematically highlight the wireframe presentation.
|
||||||
//! Consequently, we set the highlight mode to 0.
|
//! Consequently, we set the highlight mode to 0.
|
||||||
Standard_Integer HilightMode() const;
|
Standard_Integer HilightMode() const { return myHilightMode; }
|
||||||
|
|
||||||
//! Sets the highlight mode anIndex for the interactive object.
|
//! Sets the highlight mode theMode for the interactive object.
|
||||||
//! If, for example, you want to systematically highlight
|
//! If, for example, you want to systematically highlight
|
||||||
//! the wireframe presentation of a shape - whether
|
//! the wireframe presentation of a shape - whether
|
||||||
//! visualized in wireframe presentation or with shading -
|
//! visualized in wireframe presentation or with shading -
|
||||||
//! you set the highlight mode to 0.
|
//! you set the highlight mode to 0.
|
||||||
void SetHilightMode (const Standard_Integer anIndex);
|
void SetHilightMode (const Standard_Integer theMode) { myHilightMode = theMode; }
|
||||||
|
|
||||||
//! Allows the user to take a given Prs for hilight
|
//! Allows the user to take a given Prs for hilight
|
||||||
//! ex : for a shape which would be displayed in shading mode
|
//! ex : for a shape which would be displayed in shading mode
|
||||||
//! the hilight Prs is the wireframe mode.
|
//! the hilight Prs is the wireframe mode.
|
||||||
//! if No specific hilight mode is defined, the displayed Prs
|
//! if No specific hilight mode is defined, the displayed Prs
|
||||||
//! will be the hilighted one.
|
//! will be the hilighted one.
|
||||||
void UnsetHilightMode();
|
void UnsetHilightMode() { myHilightMode = -1; }
|
||||||
|
|
||||||
//! Returns true if the Interactive Object has color.
|
//! Returns true if the Interactive Object has color.
|
||||||
Standard_Boolean HasColor() const;
|
Standard_Boolean HasColor() const { return hasOwnColor; }
|
||||||
|
|
||||||
//! Returns the color setting of the Interactive Object.
|
//! Returns the color setting of the Interactive Object.
|
||||||
virtual Quantity_NameOfColor Color() const;
|
virtual Quantity_NameOfColor Color() const { return myOwnColor.Name(); }
|
||||||
|
|
||||||
virtual void Color (Quantity_Color& aColor) const;
|
virtual void Color (Quantity_Color& theColor) const { theColor = myOwnColor; }
|
||||||
|
|
||||||
//! Returns true if the Interactive Object has width.
|
//! Returns true if the Interactive Object has width.
|
||||||
Standard_Boolean HasWidth() const;
|
Standard_Boolean HasWidth() const { return myOwnWidth != 0.0; }
|
||||||
|
|
||||||
//! Returns the width setting of the Interactive Object.
|
//! Returns the width setting of the Interactive Object.
|
||||||
Standard_Real Width() const;
|
Standard_Real Width() const { return myOwnWidth; }
|
||||||
|
|
||||||
//! Returns true if the Interactive Object has a setting for material.
|
//! Returns true if the Interactive Object has a setting for material.
|
||||||
Standard_Boolean HasMaterial() const;
|
Standard_Boolean HasMaterial() const { return hasOwnMaterial; }
|
||||||
|
|
||||||
//! Returns the current material setting.
|
//! Returns the current material setting.
|
||||||
//! This will be on of the following materials:
|
//! This will be on of the following materials:
|
||||||
//! - Brass
|
//! - Brass
|
||||||
@ -362,8 +335,8 @@ public:
|
|||||||
//! - Pewter
|
//! - Pewter
|
||||||
//! - Silver
|
//! - Silver
|
||||||
//! - Stone.
|
//! - Stone.
|
||||||
virtual Graphic3d_NameOfMaterial Material() const;
|
virtual Graphic3d_NameOfMaterial Material() const { return myOwnMaterial; }
|
||||||
|
|
||||||
//! Sets the name aName for material defining this
|
//! Sets the name aName for material defining this
|
||||||
//! display attribute for the interactive object.
|
//! display attribute for the interactive object.
|
||||||
//! Material aspect determines shading aspect, color and
|
//! Material aspect determines shading aspect, color and
|
||||||
@ -386,8 +359,8 @@ public:
|
|||||||
Standard_EXPORT virtual void SetTransparency (const Standard_Real aValue = 0.6);
|
Standard_EXPORT virtual void SetTransparency (const Standard_Real aValue = 0.6);
|
||||||
|
|
||||||
//! Returns true if there is a transparency setting.
|
//! Returns true if there is a transparency setting.
|
||||||
Standard_Boolean IsTransparent() const;
|
Standard_Boolean IsTransparent() const { return myTransparency > 0.005; }
|
||||||
|
|
||||||
//! Returns the transparency setting.
|
//! Returns the transparency setting.
|
||||||
//! This will be between 0.0 and 1.0.
|
//! This will be between 0.0 and 1.0.
|
||||||
//! At 0.0 an object will be totally opaque, and at 1.0, fully transparent.
|
//! At 0.0 an object will be totally opaque, and at 1.0, fully transparent.
|
||||||
@ -398,11 +371,7 @@ public:
|
|||||||
|
|
||||||
//! Clears settings provided by the drawing tool aDrawer.
|
//! Clears settings provided by the drawing tool aDrawer.
|
||||||
Standard_EXPORT virtual void UnsetAttributes() Standard_OVERRIDE;
|
Standard_EXPORT virtual void UnsetAttributes() Standard_OVERRIDE;
|
||||||
|
|
||||||
void State (const Standard_Integer theState);
|
|
||||||
|
|
||||||
Standard_Integer State() const;
|
|
||||||
|
|
||||||
//! Returns TRUE when this object has a presentation
|
//! Returns TRUE when this object has a presentation
|
||||||
//! in the current DisplayMode()
|
//! in the current DisplayMode()
|
||||||
Standard_EXPORT Standard_Boolean HasPresentation() const;
|
Standard_EXPORT Standard_Boolean HasPresentation() const;
|
||||||
@ -459,10 +428,15 @@ public:
|
|||||||
//! so that modifications will take effect on already computed presentation groups (thus avoiding re-displaying the object).
|
//! so that modifications will take effect on already computed presentation groups (thus avoiding re-displaying the object).
|
||||||
Standard_EXPORT void SynchronizeAspects();
|
Standard_EXPORT void SynchronizeAspects();
|
||||||
|
|
||||||
friend class AIS_InteractiveContext;
|
private:
|
||||||
|
|
||||||
|
Standard_EXPORT virtual Standard_Boolean RecomputeEveryPrs() const;
|
||||||
|
|
||||||
DEFINE_STANDARD_RTTIEXT(AIS_InteractiveObject,SelectMgr_SelectableObject)
|
Standard_EXPORT void MustRecomputePrs (const Standard_Integer aMode) const;
|
||||||
|
|
||||||
|
Standard_EXPORT const TColStd_ListOfInteger& ListOfRecomputeModes() const;
|
||||||
|
|
||||||
|
Standard_EXPORT void SetRecomputeOk();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
@ -483,33 +457,15 @@ protected:
|
|||||||
Standard_Boolean myRecomputeEveryPrs;
|
Standard_Boolean myRecomputeEveryPrs;
|
||||||
TColStd_ListOfInteger myToRecomputeModes;
|
TColStd_ListOfInteger myToRecomputeModes;
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
AIS_InteractiveContext* myCTXPtr;
|
||||||
Standard_EXPORT virtual Standard_Boolean RecomputeEveryPrs() const;
|
|
||||||
|
|
||||||
Standard_EXPORT void MustRecomputePrs (const Standard_Integer aMode) const;
|
|
||||||
|
|
||||||
Standard_EXPORT const TColStd_ListOfInteger& ListOfRecomputeModes() const;
|
|
||||||
|
|
||||||
Standard_EXPORT void SetRecomputeOk();
|
|
||||||
|
|
||||||
AIS_PToContext myCTXPtr;
|
|
||||||
Handle(Standard_Transient) myOwner;
|
Handle(Standard_Transient) myOwner;
|
||||||
TColStd_ListOfTransient myUsers;
|
|
||||||
Standard_Integer mySelPriority;
|
Standard_Integer mySelPriority;
|
||||||
Standard_Integer myDisplayMode;
|
Standard_Integer myDisplayMode;
|
||||||
Standard_Integer mystate;
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
DEFINE_STANDARD_HANDLE(AIS_InteractiveObject, SelectMgr_SelectableObject)
|
||||||
#include <AIS_InteractiveObject.lxx>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif // _AIS_InteractiveObject_HeaderFile
|
#endif // _AIS_InteractiveObject_HeaderFile
|
||||||
|
@ -259,17 +259,13 @@ void AIS_MultipleConnectedInteractive::Compute (const Handle(PrsMgr_Presentation
|
|||||||
const Handle(Prs3d_Presentation)& /*thePrs*/,
|
const Handle(Prs3d_Presentation)& /*thePrs*/,
|
||||||
const Standard_Integer /*theMode*/)
|
const Standard_Integer /*theMode*/)
|
||||||
{
|
{
|
||||||
|
Handle(AIS_InteractiveContext) aCtx = GetContext();
|
||||||
for (PrsMgr_ListOfPresentableObjectsIter anIter (Children()); anIter.More(); anIter.Next())
|
for (PrsMgr_ListOfPresentableObjectsIter anIter (Children()); anIter.More(); anIter.Next())
|
||||||
{
|
{
|
||||||
Handle(AIS_InteractiveObject) aChild = Handle(AIS_InteractiveObject)::DownCast (anIter.Value());
|
Handle(AIS_InteractiveObject) aChild = Handle(AIS_InteractiveObject)::DownCast (anIter.Value());
|
||||||
if (aChild.IsNull())
|
if (!aChild.IsNull())
|
||||||
{
|
{
|
||||||
continue;
|
aChild->SetContext (aCtx);
|
||||||
}
|
|
||||||
|
|
||||||
if (!aChild->HasInteractiveContext())
|
|
||||||
{
|
|
||||||
aChild->SetContext (GetContext());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -374,3 +370,20 @@ Standard_Boolean AIS_MultipleConnectedInteractive::HasSelection (const Standard_
|
|||||||
|
|
||||||
return Standard_True;
|
return Standard_True;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : SetContext
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void AIS_MultipleConnectedInteractive::SetContext (const Handle(AIS_InteractiveContext)& theCtx)
|
||||||
|
{
|
||||||
|
AIS_InteractiveObject::SetContext (theCtx);
|
||||||
|
for (PrsMgr_ListOfPresentableObjectsIter anIter (Children()); anIter.More(); anIter.Next())
|
||||||
|
{
|
||||||
|
Handle(AIS_InteractiveObject) aChild = Handle(AIS_InteractiveObject)::DownCast (anIter.Value());
|
||||||
|
if (!aChild.IsNull())
|
||||||
|
{
|
||||||
|
aChild->SetContext (theCtx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -79,6 +79,9 @@ public:
|
|||||||
//! children of multiple connected interactive object.
|
//! children of multiple connected interactive object.
|
||||||
Standard_EXPORT virtual Standard_Boolean HasSelection (const Standard_Integer theMode) const Standard_OVERRIDE;
|
Standard_EXPORT virtual Standard_Boolean HasSelection (const Standard_Integer theMode) const Standard_OVERRIDE;
|
||||||
|
|
||||||
|
//! Assigns interactive context.
|
||||||
|
Standard_EXPORT virtual void SetContext (const Handle(AIS_InteractiveContext)& theCtx) Standard_OVERRIDE;
|
||||||
|
|
||||||
public: // short aliases to Connect() method
|
public: // short aliases to Connect() method
|
||||||
|
|
||||||
//! Establishes the connection between the Connected Interactive Object, theInteractive, and its reference.
|
//! Establishes the connection between the Connected Interactive Object, theInteractive, and its reference.
|
||||||
|
@ -1,23 +0,0 @@
|
|||||||
// Created on: 1996-12-11
|
|
||||||
// Created by: Robert COUBLANC
|
|
||||||
// Copyright (c) 1996-1999 Matra Datavision
|
|
||||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
|
||||||
//
|
|
||||||
// This file is part of Open CASCADE Technology software library.
|
|
||||||
//
|
|
||||||
// This library is free software; you can redistribute it and/or modify it under
|
|
||||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
|
||||||
// by the Free Software Foundation, with special exception defined in the file
|
|
||||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
||||||
// distribution for complete text of the license and disclaimer of any warranty.
|
|
||||||
//
|
|
||||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
|
||||||
// commercial license or contractual agreement.
|
|
||||||
|
|
||||||
#ifndef _AIS_PToContext_HeaderFile
|
|
||||||
#define _AIS_PToContext_HeaderFile
|
|
||||||
|
|
||||||
class AIS_InteractiveContext;
|
|
||||||
typedef AIS_InteractiveContext* AIS_PToContext;
|
|
||||||
|
|
||||||
#endif // _AIS_PToContext_HeaderFile
|
|
@ -137,7 +137,6 @@ AIS_Point.hxx
|
|||||||
AIS_Point.lxx
|
AIS_Point.lxx
|
||||||
AIS_PointCloud.cxx
|
AIS_PointCloud.cxx
|
||||||
AIS_PointCloud.hxx
|
AIS_PointCloud.hxx
|
||||||
AIS_PToContext.hxx
|
|
||||||
AIS_RadiusDimension.cxx
|
AIS_RadiusDimension.cxx
|
||||||
AIS_RadiusDimension.hxx
|
AIS_RadiusDimension.hxx
|
||||||
AIS_Relation.cxx
|
AIS_Relation.cxx
|
||||||
|
@ -1138,6 +1138,8 @@ void ViewerTest::RemoveView (const TCollection_AsciiString& theViewName, const S
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
aCurrentContext->RemoveAll (Standard_False);
|
||||||
if(isRemoveDriver)
|
if(isRemoveDriver)
|
||||||
{
|
{
|
||||||
ViewerTest_myDrivers.UnBind2 (aCurrentContext->CurrentViewer()->Driver());
|
ViewerTest_myDrivers.UnBind2 (aCurrentContext->CurrentViewer()->Driver());
|
||||||
|
@ -1,37 +0,0 @@
|
|||||||
puts "============"
|
|
||||||
puts "OCC23670"
|
|
||||||
puts "============"
|
|
||||||
puts ""
|
|
||||||
############################################################################
|
|
||||||
# Support for multiple 3D views
|
|
||||||
############################################################################
|
|
||||||
|
|
||||||
#test case for vinit and vactivate commands
|
|
||||||
#create view with default name Driver1/Viewer1/View1
|
|
||||||
vinit
|
|
||||||
vinit MyDriver/MyViewer/View1
|
|
||||||
vinit MyDriver/MyViewer/MyView
|
|
||||||
vactivate Driver1/Viewer1/View1
|
|
||||||
box a 10 10 10
|
|
||||||
vdisplay a
|
|
||||||
vfit
|
|
||||||
vactivate MyDriver/MyViewer/MyView
|
|
||||||
#activate MyDriver/MyViewer/View1
|
|
||||||
vactivate View1
|
|
||||||
box b 5 5 5 10 10 10
|
|
||||||
vdisplay a b
|
|
||||||
vfit
|
|
||||||
#disactivate active view
|
|
||||||
vactivate none
|
|
||||||
vactivate Driver1/Viewer1/View1
|
|
||||||
vsetdispmode 1
|
|
||||||
set x_coord 205
|
|
||||||
set y_coord 180
|
|
||||||
checkcolor $x_coord $y_coord 1 0.87 0.15
|
|
||||||
|
|
||||||
vactivate MyDriver/MyViewer/MyView
|
|
||||||
vsetdispmode 1
|
|
||||||
checkcolor $x_coord $y_coord 0 0 0
|
|
||||||
|
|
||||||
checkview -screenshot -3d -path ${imagedir}/${test_image}.png
|
|
||||||
|
|
@ -11,10 +11,10 @@ pload VISUALIZATION
|
|||||||
vfont add [locate_data_file DejaVuSans.ttf] SansFont
|
vfont add [locate_data_file DejaVuSans.ttf] SansFont
|
||||||
|
|
||||||
vinit
|
vinit
|
||||||
vpoint angleP1 0 0 0
|
vpoint angle1P1 0 0 0
|
||||||
vpoint angleP2 50 50 50
|
vpoint angle1P2 50 50 50
|
||||||
vpoint angleP3 50 50 100
|
vpoint angle1P3 50 50 100
|
||||||
vdimension dim1 -angle -shapes angleP1 angleP2 angleP3 -font SansFont
|
vdimension dim1 -angle -shapes angle1P1 angle1P2 angle1P3 -font SansFont
|
||||||
vfit
|
vfit
|
||||||
vmoveto 249 206
|
vmoveto 249 206
|
||||||
|
|
||||||
@ -27,8 +27,10 @@ if { $stat != 1 } {
|
|||||||
puts "Error : Highlighting of angle dimension with 2d text is wrong."
|
puts "Error : Highlighting of angle dimension with 2d text is wrong."
|
||||||
}
|
}
|
||||||
vinit Viewer2/View2
|
vinit Viewer2/View2
|
||||||
vdisplay angleP1 angleP2 angleP3
|
vpoint angle2P1 0 0 0
|
||||||
vdimension dim2 -angle -text 3d -shapes angleP1 angleP2 angleP3 -font SansFont
|
vpoint angle2P2 50 50 50
|
||||||
|
vpoint angle2P3 50 50 100
|
||||||
|
vdimension dim2 -angle -text 3d -shapes angle2P1 angle2P2 angle2P3 -font SansFont
|
||||||
vfit
|
vfit
|
||||||
vmoveto 263 251
|
vmoveto 263 251
|
||||||
|
|
||||||
|
@ -14,9 +14,9 @@ vinit
|
|||||||
vpoint radP1 0 0 0
|
vpoint radP1 0 0 0
|
||||||
vpoint radP2 50 50 0
|
vpoint radP2 50 50 0
|
||||||
vpoint radP3 100 0 0
|
vpoint radP3 100 0 0
|
||||||
vcircle circle radP1 radP2 radP3 0
|
vcircle circle1 radP1 radP2 radP3 0
|
||||||
verase radP1 radP2 radP3
|
verase radP1 radP2 radP3
|
||||||
vdimension dim1 -radius -shapes circle -font SansFont
|
vdimension dim1 -radius -shapes circle1 -font SansFont
|
||||||
vfit
|
vfit
|
||||||
vmoveto 123 158
|
vmoveto 123 158
|
||||||
|
|
||||||
@ -30,8 +30,8 @@ if { $stat != 1 } {
|
|||||||
}
|
}
|
||||||
|
|
||||||
vinit Viewer2/View2
|
vinit Viewer2/View2
|
||||||
vdisplay circle
|
vcircle circle2 radP1 radP2 radP3 0
|
||||||
vdimension dim2 -radius -text 3d -shapes circle -font SansFont
|
vdimension dim2 -radius -text 3d -shapes circle2 -font SansFont
|
||||||
vfit
|
vfit
|
||||||
vmoveto 191 196
|
vmoveto 191 196
|
||||||
|
|
||||||
|
@ -14,9 +14,9 @@ vinit
|
|||||||
vpoint diamP1 0 0 0
|
vpoint diamP1 0 0 0
|
||||||
vpoint diamP2 50 50 0
|
vpoint diamP2 50 50 0
|
||||||
vpoint diamP3 100 0 0
|
vpoint diamP3 100 0 0
|
||||||
vcircle circle diamP1 diamP2 diamP3 0
|
vcircle circle1 diamP1 diamP2 diamP3 0
|
||||||
verase diamP1 diamP2 diamP3
|
verase diamP1 diamP2 diamP3
|
||||||
vdimension dim1 -diameter -shapes circle -font SansFont
|
vdimension dim1 -diameter -shapes circle1 -font SansFont
|
||||||
vfit
|
vfit
|
||||||
vmoveto 208 205
|
vmoveto 208 205
|
||||||
|
|
||||||
@ -30,8 +30,8 @@ if { $stat != 1 } {
|
|||||||
}
|
}
|
||||||
|
|
||||||
vinit Viewer2/View2
|
vinit Viewer2/View2
|
||||||
vdisplay circle
|
vcircle circle2 diamP1 diamP2 diamP3 0
|
||||||
vdimension dim2 -diameter -text 3d -shapes circle -font SansFont
|
vdimension dim2 -diameter -text 3d -shapes circle2 -font SansFont
|
||||||
vfit
|
vfit
|
||||||
vmoveto 208 205
|
vmoveto 208 205
|
||||||
|
|
||||||
|
@ -1,37 +0,0 @@
|
|||||||
puts "=========="
|
|
||||||
puts "OCC2883"
|
|
||||||
puts "=========="
|
|
||||||
puts ""
|
|
||||||
########################################################################
|
|
||||||
# It is impossible to set material, color and transparency to compound
|
|
||||||
########################################################################
|
|
||||||
|
|
||||||
set FilePath_v1 ${imagedir}/bug2883_2_v1.png
|
|
||||||
set FilePath_v2 ${imagedir}/bug2883_2_v2.png
|
|
||||||
|
|
||||||
file delete -force ${FilePath_v1}
|
|
||||||
file delete -force ${FilePath_v2}
|
|
||||||
|
|
||||||
box b1 0 0 0 1 2 3
|
|
||||||
box b2 4 0 0 3 1 2
|
|
||||||
vinit drv1/v1/v1
|
|
||||||
vsetdispmode 1
|
|
||||||
vdisplay b1 b2
|
|
||||||
vfit
|
|
||||||
vinit drv1/v2/v1
|
|
||||||
vsetdispmode 1
|
|
||||||
vdisplay b1 b2
|
|
||||||
vfit
|
|
||||||
vsetcolor b1 RED
|
|
||||||
vactivate drv1/v1/v1
|
|
||||||
vdump ${FilePath_v1}
|
|
||||||
vactivate drv1/v2/v1
|
|
||||||
vdump ${FilePath_v2}
|
|
||||||
set info [diffimage ${FilePath_v1} ${FilePath_v2} 0 0 0]
|
|
||||||
if { $info != 0 } {
|
|
||||||
puts "Error: images v1 and v2 are different"
|
|
||||||
} else {
|
|
||||||
puts "OK: images v1 and v2 are similar"
|
|
||||||
}
|
|
||||||
|
|
||||||
checkview -screenshot -3d -path ${imagedir}/${test_image}.png
|
|
Loading…
x
Reference in New Issue
Block a user