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.
public:
-
-
//! Initializes the relation of identity between the two
//! entities, FirstShape and SecondShape. The plane
//! aPlane is initialized in case a visual reference is
//! needed to show identity.
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.
virtual Standard_Boolean IsMovable() const Standard_OVERRIDE;
//! 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;
-
-
-
DEFINE_STANDARD_RTTIEXT(AIS_IdenticRelation,AIS_Relation)
-protected:
-
-
-
-
private:
Standard_EXPORT gp_Dir ComputeCircleDirection (const Handle(Geom_Circle)& aCirc, const TopoDS_Vertex& ConnectedVertex) const;
+private:
+
+ TColStd_ListOfTransient myUsers;
Standard_Boolean isCircle;
gp_Pnt myFAttach;
gp_Pnt mySAttach;
gp_Pnt myCenter;
-
};
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
-// Modified by XAB & Serguei Dec 97 (angle &deviation coeffts)
-
#include <AIS_ConnectedInteractive.hxx>
+
#include <AIS_DataMapIteratorOfDataMapOfILC.hxx>
#include <AIS_DataMapIteratorOfDataMapOfIOStatus.hxx>
#include <AIS_GlobalStatus.hxx>
#include <V3d_View.hxx>
#include <V3d_Viewer.hxx>
-IMPLEMENT_STANDARD_RTTIEXT(AIS_InteractiveContext,MMgt_TShared)
+IMPLEMENT_STANDARD_RTTIEXT(AIS_InteractiveContext, Standard_Transient)
-//#include <AIS_DataMapIteratorOfDataMapOfInteractiveInteger.hxx>
namespace
{
typedef NCollection_DataMap<Handle(SelectMgr_SelectableObject), Handle(SelectMgr_IndexedMapOfOwner)> AIS_MapOfObjectOwners;
InitAttributes();
}
-void AIS_InteractiveContext::Delete() const
+//=======================================================================
+//function : ~AIS_InteractiveContext
+//purpose :
+//=======================================================================
+AIS_InteractiveContext::~AIS_InteractiveContext()
{
// clear the current selection
mySelection->Clear();
anObj->CurrentSelection()->UpdateBVHStatus (SelectMgr_TBU_Renew);
}
}
- MMgt_TShared::Delete();
}
//=======================================================================
return;
}
- if (!theIObj->HasInteractiveContext())
- {
- theIObj->SetContext (this);
- }
-
+ setContextToObject (theIObj);
if (theDispStatus == AIS_DS_Temporary
&& !HasOpenedContext())
{
return;
}
- if (!theIObj->HasInteractiveContext())
- {
- theIObj->SetContext (this);
- }
-
+ setContextToObject (theIObj);
if (HasOpenedContext())
{
myLocalContexts (myCurLocalIndex)->Load (theIObj, theToAllowDecomposition, theSelMode);
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())
{
myLocalContexts (myCurLocalIndex)->Remove (theIObj);
if (theObj.IsNull())
return;
- if (!theObj->HasInteractiveContext())
- theObj->SetContext (this);
-
+ setContextToObject (theObj);
if (!HasOpenedContext())
{
if (!myObjects.IsBound (theObj))
return;
}
- if (!theIObj->HasInteractiveContext())
- {
- theIObj->SetContext (this);
- }
-
+ setContextToObject (theIObj);
if (myObjects.IsBound (theIObj))
{
Handle(AIS_GlobalStatus) aStatus = myObjects (theIObj);
const Standard_Integer theMode,
const Standard_Boolean theToUpdateViewer)
{
- if (!theIObj->HasInteractiveContext())
- {
- theIObj->SetContext(this);
- }
-
+ setContextToObject (theIObj);
if (!myObjects.IsBound (theIObj))
{
theIObj->SetDisplayMode (theMode);
return;
}
- if (!theIObj->HasInteractiveContext())
- {
- theIObj->SetContext (this);
- }
+ setContextToObject (theIObj);
theIObj->SetColor (theColor);
redisplayPrsRecModes (theIObj, theToUpdateViewer);
}
return;
}
- if (!theIObj->HasInteractiveContext())
- {
- theIObj->SetContext (this);
- }
-
// to be modified after the related methods of AIS_Shape are passed to InteractiveObject
+ setContextToObject (theIObj);
if (theIObj->Type() != AIS_KOI_Object
&& theIObj->Type() != AIS_KOI_Shape)
{
return;
}
- if (!theIObj->HasInteractiveContext())
- {
- theIObj->SetContext (this);
- }
-
// To be modified after the related methods of AIS_Shape are passed to InteractiveObject
+ setContextToObject (theIObj);
if (theIObj->Type() != AIS_KOI_Object
&& theIObj->Type() != AIS_KOI_Shape)
{
return;
}
- if (!theIObj->HasInteractiveContext())
- {
- theIObj->SetContext (this);
- }
-
// To be modified after the related methods of AIS_Shape are passed to InteractiveObject
+ setContextToObject (theIObj);
if (theIObj->Type() != AIS_KOI_Shape)
{
return;
return;
}
- if (!theIObj->HasInteractiveContext())
- {
- theIObj->SetContext (this);
- }
-
// To be modified after the related methods of AIS_Shape are passed to InteractiveObject
+ setContextToObject (theIObj);
if (theIObj->Type() != AIS_KOI_Shape)
{
return;
return;
}
- if (!theIObj->HasInteractiveContext())
- {
- theIObj->SetContext (this);
- }
-
// To be modified after the related methods of AIS_Shape are passed to InteractiveObject
+ setContextToObject (theIObj);
if (theIObj->Type() != AIS_KOI_Shape)
{
return;
return;
}
- if (!theIObj->HasInteractiveContext())
- {
- theIObj->SetContext (this);
- }
-
// To be modified after the related methods of AIS_Shape are passed to InteractiveObject
+ setContextToObject (theIObj);
if (theIObj->Type() != AIS_KOI_Shape)
{
return;
return;
}
- if (!theIObj->HasInteractiveContext())
- {
- theIObj->SetContext (this);
- }
-
+ setContextToObject (theIObj);
theIObj->SetWidth (theWidth);
redisplayPrsRecModes (theIObj, theToUpdateViewer);
if (!myLastinMain.IsNull() && myLastinMain->IsSameSelectable (theIObj))
return;
}
- if (!theIObj->HasInteractiveContext())
- {
- theIObj->SetContext (this);
- }
-
+ setContextToObject (theIObj);
theIObj->SetMaterial (theName);
redisplayPrsRecModes (theIObj, theToUpdateViewer);
}
return;
}
- if (!theIObj->HasInteractiveContext())
- {
- theIObj->SetContext (this);
- }
-
+ setContextToObject (theIObj);
if (!theIObj->IsTransparent()
&& theValue <= 0.05)
{
return;
}
- if (!theIObj->HasInteractiveContext())
- {
- theIObj->SetContext (this);
- }
-
+ setContextToObject (theIObj);
theIObj->SetAttributes (theDrawer);
Update (theIObj, theToUpdateViewer);
}
return;
}
- if (!theIObj->HasInteractiveContext())
- {
- theIObj->SetContext (this);
- }
+ setContextToObject (theIObj);
theIObj->UnsetAttributes();
Update (theIObj, theToUpdateViewer);
}
#include <Standard_Integer.hxx>
#include <AIS_DataMapOfILC.hxx>
#include <AIS_SequenceOfInteractive.hxx>
-#include <MMgt_TShared.hxx>
#include <AIS_DisplayStatus.hxx>
#include <AIS_KindOfInteractive.hxx>
#include <Standard_Real.hxx>
class SelectMgr_Filter;
class TCollection_AsciiString;
-
-class AIS_InteractiveContext;
-DEFINE_STANDARD_HANDLE(AIS_InteractiveContext, MMgt_TShared)
-
//! The Interactive Context allows you to manage
//! graphic behavior and selection of Interactive Objects
//! in one or more viewers. Class methods make this
//! 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
//! 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:
-
-
//! Constructs the interactive context object defined by
//! the principal 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 Standard_Boolean GetAutoActivateSelection() const;
//! Redraws immediate structures in all views of the viewer given taking into account its visibility.
Standard_EXPORT void RedrawImmediate (const Handle(V3d_Viewer)& theViewer);
-
-friend class AIS_LocalContext;
-
-
- DEFINE_STANDARD_RTTIEXT(AIS_InteractiveContext,MMgt_TShared)
-
protected:
Standard_EXPORT void GetDefModes (const Handle(AIS_InteractiveObject)& anIobj, Standard_Integer& Dmode, Standard_Integer& HiMod, Standard_Integer& SelMode) const;
? 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:
AIS_DataMapOfIOStatus myObjects;
Standard_Boolean myZDetectionFlag;
Standard_Boolean myIsAutoActivateSelMode;
-
};
+DEFINE_STANDARD_HANDLE(AIS_InteractiveContext, Standard_Transient)
#include <AIS_InteractiveContext.lxx>
-
-
-
-
#endif // _AIS_InteractiveContext_HeaderFile
if (!myObjects.IsBound (theObject) || !theObject->HasSelection (aGlobalSelMode))
return;
- if (!theObject->HasInteractiveContext())
- theObject->SetContext (this);
-
+ setContextToObject (theObject);
const Handle(SelectMgr_EntityOwner) anOwner = theObject->GlobalSelOwner();
if (anOwner.IsNull() || !anOwner->HasSelectable())
if ( anObj.IsNull() )
return;
- if( !anObj->HasInteractiveContext() )
- anObj->SetContext( this );
-
+ setContextToObject (anObj);
anObj->SetPolygonOffsets( aMode, aFactor, aUnits );
if ( updateviewer ) {
myRecomputeEveryPrs(Standard_True),
myCTXPtr(NULL),
mySelPriority(-1),
-myDisplayMode (-1),
-mystate(0)
+myDisplayMode (-1)
{
- Handle (AIS_InteractiveContext) Bid;
- myCTXPtr = Bid.operator->();
SetCurrentFacingModel();
}
Standard_Boolean AIS_InteractiveObject::RecomputeEveryPrs() const
{return myRecomputeEveryPrs;}
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
-Standard_Boolean AIS_InteractiveObject::HasInteractiveContext() const
-{
- Handle (AIS_InteractiveContext) aNull;
- return (myCTXPtr != aNull.operator->());
-}
-
//=======================================================================
//function :
//purpose :
}
//=======================================================================
-//function :
-//purpose :
+//function : SetContext
+//purpose :
//=======================================================================
-void AIS_InteractiveObject::SetContext(const Handle(AIS_InteractiveContext)& aCtx)
+void AIS_InteractiveObject::SetContext (const Handle(AIS_InteractiveContext)& theCtx)
{
- myCTXPtr = aCtx.operator->();
- if( aCtx.IsNull())
+ if (myCTXPtr == theCtx.get())
+ {
return;
- myDrawer->Link(aCtx->DefaultDrawer());
+ }
+
+ myCTXPtr = theCtx.get();
+ if (!theCtx.IsNull())
+ {
+ myDrawer->Link (theCtx->DefaultDrawer());
+ }
}
//=======================================================================
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 :
//purpose :
#ifndef _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 <TColStd_ListOfInteger.hxx>
-#include <SelectMgr_SelectableObject.hxx>
-#include <PrsMgr_TypeOfPresentation3d.hxx>
#include <AIS_KindOfInteractive.hxx>
-#include <Quantity_NameOfColor.hxx>
-#include <Standard_ShortReal.hxx>
-class Standard_Transient;
+#include <Graphic3d_NameOfMaterial.hxx>
+#include <PrsMgr_TypeOfPresentation3d.hxx>
+#include <SelectMgr_SelectableObject.hxx>
+#include <TColStd_ListOfInteger.hxx>
+#include <TColStd_ListOfTransient.hxx>
+#include <Quantity_Color.hxx>
+
class AIS_InteractiveContext;
-class Quantity_Color;
class Graphic3d_MaterialAspect;
class Prs3d_Presentation;
class Prs3d_BasicAspect;
class Bnd_Box;
-
-class AIS_InteractiveObject;
-DEFINE_STANDARD_HANDLE(AIS_InteractiveObject, SelectMgr_SelectableObject)
-
-
//! Defines a class of objects with display and selection services.
//! Entities which are visualized and selected are
//! Interactive Objects. You can make use of classes of
//! affect the same attributes in the Drawer.
class AIS_InteractiveObject : public SelectMgr_SelectableObject
{
-
+ friend class AIS_InteractiveContext;
+ DEFINE_STANDARD_RTTIEXT(AIS_InteractiveObject, SelectMgr_SelectableObject)
public:
-
-
//! Returns the kind of Interactive Object:
//! - None
//! - Datum
//! Mode 2 : Selection Of Edges
//! Mode 3 : Selection Of Wires
//! 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
//! SetColor(), SetTransparency(), SetMaterial() methods
//! default facing model is Aspect_TOFM_TWO_SIDE. This mean that attributes is
//! considered as infinite, i.e. its graphic presentations
//! are not taken in account for View FitAll...
Standard_EXPORT void SetInfiniteState (const Standard_Boolean aFlag = Standard_True);
-
//! Returns true if the interactive object is infinite. In this
//! case, its graphic presentations are not taken into
//! account in the fit-all view.
- Standard_Boolean IsInfinite() const;
-
- //! Indicates whether the Interactive Object has a pointer
- //! to an interactive context.
- Standard_EXPORT Standard_Boolean HasInteractiveContext() const;
-
+ Standard_Boolean IsInfinite() const { return myInfiniteState; }
+
+ //! Indicates whether the Interactive Object has a pointer to an interactive context.
+ Standard_Boolean HasInteractiveContext() const { return myCTXPtr != NULL; }
+
//! Returns the context pointer to the interactive context.
Standard_EXPORT Handle(AIS_InteractiveContext) GetContext() const;
//! edges, wires, and faces.
//! - Users, presentable objects connecting to sensitive
//! primitives, or a shape which has been decomposed.
- const Handle(Standard_Transient)& GetOwner() const;
-
- //! Allows you to attribute the owner ApplicativeEntity to
+ const Handle(Standard_Transient)& GetOwner() const { return myOwner; }
+
+ //! Allows you to attribute the owner theApplicativeEntity to
//! an Interactive Object. This can be a shape for a set of
//! sub-shapes or a sub-shape for sub-shapes which it
//! 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
//! to attribute an Owner to it in the form of a Transient.
//! This method removes the owner from the graphic entity.
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
//! 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.
//! An object can have its own temporary display mode,
//! which is different from that proposed by the interactive context.
//! - AIS_Shaded
//! This range can, however, be extended through the creation of new display modes.
Standard_EXPORT void SetDisplayMode (const Standard_Integer aMode);
-
+
//! Removes display mode settings from the interactive object.
- void UnsetDisplayMode();
-
+ void UnsetDisplayMode() { myDisplayMode = -1; }
+
//! Returns the display mode setting of the Interactive Object.
//! The range of possibilities is the following:
//! - AIS_WireFrame
//! - AIS_Shaded
//! This range can, however, be extended through the
//! 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.
//! You can modify the selection priority of an owner to
//! - priority 5 - its origin
//! - priority 3 - its axes
//! - priority 2 - its planes
- Standard_Integer SelectionPriority() const;
-
- //! Allows you to provide a setting aPriority for selection priority.
+ Standard_Integer SelectionPriority() const { return mySelPriority; }
+
+ //! Allows you to provide a setting thePriority for selection priority.
//! You can modify selection priority of an owner to make
//! one entity more selectionable than another one. The
//! default selection priority for an owner is 5, for
//! example. To increase selection priority, choose a
//! setting between 5 and 10. An entity with priority 7 will
//! 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.
- void UnsetSelectionPriority();
-
+ void UnsetSelectionPriority() { mySelPriority = -1; }
+
//! Returns true if there is a setting for selection priority.
//! You can modify selection priority of an owner to make
//! one entity more selectionable than another one. The
//! example. To increase selection priority, choose a
//! setting between 5 and 10. An entity with priority 7 will
//! 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.
- Standard_Boolean HasHilightMode() const;
-
+ Standard_Boolean HasHilightMode() const { return myHilightMode != -1; }
+
//! Returns the setting for highlight mode.
//! At dynamic detection, the presentation echoed by the
//! Interactive Context, is by default the presentation
//! wireframe presentation or with shading, we want to
//! systematically highlight the wireframe presentation.
//! Consequently, we set the highlight mode to 0.
- Standard_Integer HilightMode() const;
-
- //! Sets the highlight mode anIndex for the interactive object.
+ Standard_Integer HilightMode() const { return myHilightMode; }
+
+ //! Sets the highlight mode theMode for the interactive object.
//! If, for example, you want to systematically highlight
//! the wireframe presentation of a shape - whether
//! visualized in wireframe presentation or with shading -
//! 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
//! ex : for a shape which would be displayed in shading mode
//! the hilight Prs is the wireframe mode.
//! if No specific hilight mode is defined, the displayed Prs
//! will be the hilighted one.
- void UnsetHilightMode();
-
+ void UnsetHilightMode() { myHilightMode = -1; }
+
//! 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.
- virtual Quantity_NameOfColor Color() const;
-
- virtual void Color (Quantity_Color& aColor) const;
-
+ virtual Quantity_NameOfColor Color() const { return myOwnColor.Name(); }
+
+ virtual void Color (Quantity_Color& theColor) const { theColor = myOwnColor; }
+
//! 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.
- Standard_Real Width() const;
-
+ Standard_Real Width() const { return myOwnWidth; }
+
//! 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.
//! This will be on of the following materials:
//! - Brass
//! - Pewter
//! - Silver
//! - Stone.
- virtual Graphic3d_NameOfMaterial Material() const;
-
+ virtual Graphic3d_NameOfMaterial Material() const { return myOwnMaterial; }
+
//! Sets the name aName for material defining this
//! display attribute for the interactive object.
//! Material aspect determines shading aspect, color and
Standard_EXPORT virtual void SetTransparency (const Standard_Real aValue = 0.6);
//! Returns true if there is a transparency setting.
- Standard_Boolean IsTransparent() const;
-
+ Standard_Boolean IsTransparent() const { return myTransparency > 0.005; }
+
//! Returns the transparency setting.
//! This will be between 0.0 and 1.0.
//! At 0.0 an object will be totally opaque, and at 1.0, fully transparent.
//! Clears settings provided by the drawing tool aDrawer.
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
//! in the current DisplayMode()
Standard_EXPORT Standard_Boolean HasPresentation() const;
//! so that modifications will take effect on already computed presentation groups (thus avoiding re-displaying the object).
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:
Standard_Boolean myRecomputeEveryPrs;
TColStd_ListOfInteger myToRecomputeModes;
-
private:
-
- 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;
+ AIS_InteractiveContext* myCTXPtr;
Handle(Standard_Transient) myOwner;
- TColStd_ListOfTransient myUsers;
Standard_Integer mySelPriority;
Standard_Integer myDisplayMode;
- Standard_Integer mystate;
-
};
-
-#include <AIS_InteractiveObject.lxx>
-
-
-
-
+DEFINE_STANDARD_HANDLE(AIS_InteractiveObject, SelectMgr_SelectableObject)
#endif // _AIS_InteractiveObject_HeaderFile
const Handle(Prs3d_Presentation)& /*thePrs*/,
const Standard_Integer /*theMode*/)
{
+ Handle(AIS_InteractiveContext) aCtx = GetContext();
for (PrsMgr_ListOfPresentableObjectsIter anIter (Children()); anIter.More(); anIter.Next())
{
Handle(AIS_InteractiveObject) aChild = Handle(AIS_InteractiveObject)::DownCast (anIter.Value());
- if (aChild.IsNull())
- {
- continue;
- }
-
- if (!aChild->HasInteractiveContext())
+ if (!aChild.IsNull())
{
- aChild->SetContext (GetContext());
+ aChild->SetContext (aCtx);
}
}
}
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);
+ }
+ }
+}
//! children of multiple connected interactive object.
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
//! Establishes the connection between the Connected Interactive Object, theInteractive, and its reference.
+++ /dev/null
-// 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
AIS_Point.lxx
AIS_PointCloud.cxx
AIS_PointCloud.hxx
-AIS_PToContext.hxx
AIS_RadiusDimension.cxx
AIS_RadiusDimension.hxx
AIS_Relation.cxx
break;
}
}
+
+ aCurrentContext->RemoveAll (Standard_False);
if(isRemoveDriver)
{
ViewerTest_myDrivers.UnBind2 (aCurrentContext->CurrentViewer()->Driver());
+++ /dev/null
-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
-
vfont add [locate_data_file DejaVuSans.ttf] SansFont
vinit
-vpoint angleP1 0 0 0
-vpoint angleP2 50 50 50
-vpoint angleP3 50 50 100
-vdimension dim1 -angle -shapes angleP1 angleP2 angleP3 -font SansFont
+vpoint angle1P1 0 0 0
+vpoint angle1P2 50 50 50
+vpoint angle1P3 50 50 100
+vdimension dim1 -angle -shapes angle1P1 angle1P2 angle1P3 -font SansFont
vfit
vmoveto 249 206
puts "Error : Highlighting of angle dimension with 2d text is wrong."
}
vinit Viewer2/View2
-vdisplay angleP1 angleP2 angleP3
-vdimension dim2 -angle -text 3d -shapes angleP1 angleP2 angleP3 -font SansFont
+vpoint angle2P1 0 0 0
+vpoint angle2P2 50 50 50
+vpoint angle2P3 50 50 100
+vdimension dim2 -angle -text 3d -shapes angle2P1 angle2P2 angle2P3 -font SansFont
vfit
vmoveto 263 251
vpoint radP1 0 0 0
vpoint radP2 50 50 0
vpoint radP3 100 0 0
-vcircle circle radP1 radP2 radP3 0
+vcircle circle1 radP1 radP2 radP3 0
verase radP1 radP2 radP3
-vdimension dim1 -radius -shapes circle -font SansFont
+vdimension dim1 -radius -shapes circle1 -font SansFont
vfit
vmoveto 123 158
}
vinit Viewer2/View2
-vdisplay circle
-vdimension dim2 -radius -text 3d -shapes circle -font SansFont
+vcircle circle2 radP1 radP2 radP3 0
+vdimension dim2 -radius -text 3d -shapes circle2 -font SansFont
vfit
vmoveto 191 196
vpoint diamP1 0 0 0
vpoint diamP2 50 50 0
vpoint diamP3 100 0 0
-vcircle circle diamP1 diamP2 diamP3 0
+vcircle circle1 diamP1 diamP2 diamP3 0
verase diamP1 diamP2 diamP3
-vdimension dim1 -diameter -shapes circle -font SansFont
+vdimension dim1 -diameter -shapes circle1 -font SansFont
vfit
vmoveto 208 205
}
vinit Viewer2/View2
-vdisplay circle
-vdimension dim2 -diameter -text 3d -shapes circle -font SansFont
+vcircle circle2 diamP1 diamP2 diamP3 0
+vdimension dim2 -diameter -text 3d -shapes circle2 -font SansFont
vfit
vmoveto 208 205
+++ /dev/null
-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