VTK
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
vtkContextScene Class Reference

Provides a 2D scene for vtkContextItem objects. More...

#include <vtkContextScene.h>

Inheritance diagram for vtkContextScene:
[legend]
Collaboration diagram for vtkContextScene:
[legend]

Public Types

enum  {
  SELECTION_NONE = 0, SELECTION_DEFAULT, SELECTION_ADDITION, SELECTION_SUBTRACTION,
  SELECTION_TOGGLE
}
 Enum of valid selection modes for charts in the scene. More...
 
typedef vtkObject Superclass
 

Public Member Functions

virtual vtkTypeBool IsA (const char *type)
 Return 1 if this class is the same type of (or a subclass of) the named class. More...
 
vtkContextSceneNewInstance () const
 
void PrintSelf (ostream &os, vtkIndent indent) override
 Methods invoked by print to print information about the object including superclasses. More...
 
virtual bool Paint (vtkContext2D *painter)
 Paint event for the chart, called whenever the chart needs to be drawn. More...
 
unsigned int AddItem (vtkAbstractContextItem *item)
 Add child items to this item. More...
 
bool RemoveItem (vtkAbstractContextItem *item)
 Remove child item from this item. More...
 
bool RemoveItem (unsigned int index)
 Remove child item from this item. More...
 
vtkAbstractContextItemGetItem (unsigned int index)
 Get the item at the specified index. More...
 
unsigned int GetNumberOfItems ()
 Get the number of child items. More...
 
void ClearItems ()
 Remove all child items from this item. More...
 
virtual void SetAnnotationLink (vtkAnnotationLink *link)
 Set the vtkAnnotationLink for the chart. More...
 
virtual vtkAnnotationLinkGetAnnotationLink ()
 Get the vtkAnnotationLink for the chart. More...
 
virtual void SetGeometry (int, int)
 Set the width and height of the scene in pixels. More...
 
void SetGeometry (int[2])
 
virtual int * GetGeometry ()
 Get the width and height of the scene in pixels. More...
 
virtual void GetGeometry (int &, int &)
 
virtual void GetGeometry (int[2])
 
virtual void SetUseBufferId (bool)
 Set whether the scene should use the color buffer. More...
 
virtual bool GetUseBufferId ()
 Get whether the scene is using the color buffer. More...
 
virtual int GetViewWidth ()
 Get the width of the view. More...
 
virtual int GetViewHeight ()
 Get the height of the view. More...
 
int GetSceneWidth ()
 Get the width of the scene. More...
 
int GetSceneHeight ()
 Get the height of the scene. More...
 
virtual void SetScaleTiles (bool)
 Whether to scale the scene transform when tiling, for example when using vtkWindowToImageFilter to take a large screenshot. More...
 
virtual bool GetScaleTiles ()
 
virtual void ScaleTilesOn ()
 
virtual void ScaleTilesOff ()
 
vtkVector2i GetLogicalTileScale ()
 The tile scale of the target vtkRenderWindow. More...
 
virtual void SetRenderer (vtkRenderer *renderer)
 This should not be necessary as the context view should take care of rendering. More...
 
virtual vtkRendererGetRenderer ()
 
void SetDirty (bool isDirty)
 Inform the scene that something changed that requires a repaint of the scene. More...
 
bool GetDirty () const
 
void ReleaseGraphicsResources ()
 Release graphics resources hold by the scene. More...
 
vtkWeakPointer< vtkContext2DGetLastPainter ()
 Last painter used. More...
 
vtkAbstractContextBufferIdGetBufferId ()
 Return buffer id. More...
 
virtual void SetTransform (vtkTransform2D *transform)
 Set the transform for the scene. More...
 
vtkTransform2DGetTransform ()
 Get the transform for the scene. More...
 
bool HasTransform ()
 Check whether the scene has a transform. More...
 
- Public Member Functions inherited from vtkObject
 vtkBaseTypeMacro (vtkObject, vtkObjectBase)
 
virtual void DebugOn ()
 Turn debugging output on. More...
 
virtual void DebugOff ()
 Turn debugging output off. More...
 
bool GetDebug ()
 Get the value of the debug flag. More...
 
void SetDebug (bool debugFlag)
 Set the value of the debug flag. More...
 
virtual void Modified ()
 Update the modification time for this object. More...
 
virtual vtkMTimeType GetMTime ()
 Return this object's modified time. More...
 
unsigned long AddObserver (unsigned long event, vtkCommand *, float priority=0.0f)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object. More...
 
unsigned long AddObserver (const char *event, vtkCommand *, float priority=0.0f)
 
vtkCommandGetCommand (unsigned long tag)
 
void RemoveObserver (vtkCommand *)
 
void RemoveObservers (unsigned long event, vtkCommand *)
 
void RemoveObservers (const char *event, vtkCommand *)
 
vtkTypeBool HasObserver (unsigned long event, vtkCommand *)
 
vtkTypeBool HasObserver (const char *event, vtkCommand *)
 
void RemoveObserver (unsigned long tag)
 
void RemoveObservers (unsigned long event)
 
void RemoveObservers (const char *event)
 
void RemoveAllObservers ()
 
vtkTypeBool HasObserver (unsigned long event)
 
vtkTypeBool HasObserver (const char *event)
 
template<class U , class T >
unsigned long AddObserver (unsigned long event, U observer, void(T::*callback)(), float priority=0.0f)
 Overloads to AddObserver that allow developers to add class member functions as callbacks for events. More...
 
template<class U , class T >
unsigned long AddObserver (unsigned long event, U observer, void(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f)
 
template<class U , class T >
unsigned long AddObserver (unsigned long event, U observer, bool(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f)
 Allow user to set the AbortFlagOn() with the return value of the callback method. More...
 
int InvokeEvent (unsigned long event, void *callData)
 This method invokes an event and return whether the event was aborted or not. More...
 
int InvokeEvent (const char *event, void *callData)
 
int InvokeEvent (unsigned long event)
 
int InvokeEvent (const char *event)
 
- Public Member Functions inherited from vtkObjectBase
const char * GetClassName () const
 Return the class name as a string. More...
 
virtual void Delete ()
 Delete a VTK object. More...
 
virtual void FastDelete ()
 Delete a reference to this object. More...
 
void InitializeObjectBase ()
 
void Print (ostream &os)
 Print an object to an ostream. More...
 
virtual void PrintHeader (ostream &os, vtkIndent indent)
 
virtual void PrintTrailer (ostream &os, vtkIndent indent)
 
virtual void Register (vtkObjectBase *o)
 Increase the reference count (mark as used by another object). More...
 
virtual void UnRegister (vtkObjectBase *o)
 Decrease the reference count (release by another object). More...
 
int GetReferenceCount ()
 Return the current reference count of this object. More...
 
void SetReferenceCount (int)
 Sets the reference count. More...
 
void PrintRevisions (ostream &)
 Legacy. More...
 

Static Public Member Functions

static vtkTypeBool IsTypeOf (const char *type)
 
static vtkContextSceneSafeDownCast (vtkObjectBase *o)
 
static vtkContextSceneNew ()
 Creates a 2D Painter object. More...
 
- Static Public Member Functions inherited from vtkObject
static vtkObjectNew ()
 Create an object with Debug turned off, modified time initialized to zero, and reference counting on. More...
 
static void BreakOnError ()
 This method is called when vtkErrorMacro executes. More...
 
static void SetGlobalWarningDisplay (int val)
 This is a global flag that controls whether any debug, warning or error messages are displayed. More...
 
static void GlobalWarningDisplayOn ()
 
static void GlobalWarningDisplayOff ()
 
static int GetGlobalWarningDisplay ()
 
- Static Public Member Functions inherited from vtkObjectBase
static vtkTypeBool IsTypeOf (const char *name)
 Return 1 if this class type is the same type of (or a subclass of) the named class. More...
 
static vtkObjectBaseNew ()
 Create an object with Debug turned off, modified time initialized to zero, and reference counting on. More...
 

Protected Member Functions

virtual vtkObjectBaseNewInstanceInternal () const
 
 vtkContextScene ()
 
 ~vtkContextScene () override
 
virtual bool ProcessSelectionEvent (unsigned int rect[5])
 Process a rubber band selection event. More...
 
virtual bool MouseMoveEvent (const vtkContextMouseEvent &event)
 Process a mouse move event. More...
 
virtual bool ButtonPressEvent (const vtkContextMouseEvent &event)
 Process a mouse button press event. More...
 
virtual bool ButtonReleaseEvent (const vtkContextMouseEvent &event)
 Process a mouse button release event. More...
 
virtual bool DoubleClickEvent (const vtkContextMouseEvent &event)
 Process a mouse button double click event. More...
 
virtual bool MouseWheelEvent (int delta, const vtkContextMouseEvent &event)
 Process a mouse wheel event where delta is the movement forward or back. More...
 
virtual bool KeyPressEvent (const vtkContextKeyEvent &keyEvent)
 Process a key press event. More...
 
virtual bool KeyReleaseEvent (const vtkContextKeyEvent &keyEvent)
 Process a key release event. More...
 
virtual void PaintIds ()
 Paint the scene in a special mode to build a cache for picking. More...
 
void TestBufferIdSupport ()
 Test if BufferId is supported by the OpenGL context. More...
 
vtkIdType GetPickedItem (int x, int y)
 Return the item id under mouse cursor at position (x,y). More...
 
vtkAbstractContextItemGetPickedItem ()
 Return the item under the mouse. More...
 
void UpdateBufferId ()
 Make sure the buffer id used for picking is up-to-date. More...
 
- Protected Member Functions inherited from vtkObject
 vtkObject ()
 
 ~vtkObject () override
 
void RegisterInternal (vtkObjectBase *, vtkTypeBool check) override
 
void UnRegisterInternal (vtkObjectBase *, vtkTypeBool check) override
 
void InternalGrabFocus (vtkCommand *mouseEvents, vtkCommand *keypressEvents=nullptr)
 These methods allow a command to exclusively grab all events. More...
 
void InternalReleaseFocus ()
 
- Protected Member Functions inherited from vtkObjectBase
 vtkObjectBase ()
 
virtual ~vtkObjectBase ()
 
virtual void CollectRevisions (ostream &)
 
virtual void ReportReferences (vtkGarbageCollector *)
 
 vtkObjectBase (const vtkObjectBase &)
 
void operator= (const vtkObjectBase &)
 

Protected Attributes

vtkAnnotationLinkAnnotationLink
 
int Geometry [2]
 
Private * Storage
 
vtkContextScenePrivateChildren
 This structure provides a list of children, along with convenience functions to paint the children etc. More...
 
vtkWeakPointer< vtkContext2DLastPainter
 
vtkWeakPointer< vtkRendererRenderer
 
vtkAbstractContextBufferIdBufferId
 
bool BufferIdDirty
 
bool UseBufferId
 
bool BufferIdSupportTested
 
bool BufferIdSupported
 
bool ScaleTiles
 
vtkTransform2DTransform
 The scene level transform. More...
 
- Protected Attributes inherited from vtkObject
bool Debug
 
vtkTimeStamp MTime
 
vtkSubjectHelper * SubjectHelper
 
- Protected Attributes inherited from vtkObjectBase
std::atomic< int32_t > ReferenceCount
 
vtkWeakPointerBase ** WeakPointers
 

Friends

class vtkContextInteractorStyle
 The vtkContextInteractorStyle class delegates all of the events to the scene, accessing protected API. More...
 

Detailed Description

Provides a 2D scene for vtkContextItem objects.

Provides a 2D scene that vtkContextItem objects can be added to. Manages the items, ensures that they are rendered at the right times and passes on mouse events.

Definition at line 47 of file vtkContextScene.h.

Member Typedef Documentation

◆ Superclass

Definition at line 50 of file vtkContextScene.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

Enum of valid selection modes for charts in the scene.

Enumerator
SELECTION_NONE 
SELECTION_DEFAULT 
SELECTION_ADDITION 
SELECTION_SUBTRACTION 
SELECTION_TOGGLE 

Definition at line 234 of file vtkContextScene.h.

Constructor & Destructor Documentation

◆ vtkContextScene()

vtkContextScene::vtkContextScene ( )
protected

◆ ~vtkContextScene()

vtkContextScene::~vtkContextScene ( )
overrideprotected

Member Function Documentation

◆ IsTypeOf()

static vtkTypeBool vtkContextScene::IsTypeOf ( const char *  type)
static

◆ IsA()

virtual vtkTypeBool vtkContextScene::IsA ( const char *  name)
virtual

Return 1 if this class is the same type of (or a subclass of) the named class.

Returns 0 otherwise. This method works in combination with vtkTypeMacro found in vtkSetGet.h.

Reimplemented from vtkObjectBase.

◆ SafeDownCast()

static vtkContextScene* vtkContextScene::SafeDownCast ( vtkObjectBase o)
static

◆ NewInstanceInternal()

virtual vtkObjectBase* vtkContextScene::NewInstanceInternal ( ) const
protectedvirtual

◆ NewInstance()

vtkContextScene* vtkContextScene::NewInstance ( ) const

◆ PrintSelf()

void vtkContextScene::PrintSelf ( ostream &  os,
vtkIndent  indent 
)
overridevirtual

Methods invoked by print to print information about the object including superclasses.

Typically not called by the user (use Print() instead) but used in the hierarchical print process to combine the output of several classes.

Reimplemented from vtkObject.

◆ New()

static vtkContextScene* vtkContextScene::New ( )
static

Creates a 2D Painter object.

◆ Paint()

virtual bool vtkContextScene::Paint ( vtkContext2D painter)
virtual

Paint event for the chart, called whenever the chart needs to be drawn.

◆ AddItem()

unsigned int vtkContextScene::AddItem ( vtkAbstractContextItem item)

Add child items to this item.

Increments reference count of item.

Returns
the index of the child item.

◆ RemoveItem() [1/2]

bool vtkContextScene::RemoveItem ( vtkAbstractContextItem item)

Remove child item from this item.

Decrements reference count of item.

Parameters
itemthe item to be removed.
Returns
true on success, false otherwise.

◆ RemoveItem() [2/2]

bool vtkContextScene::RemoveItem ( unsigned int  index)

Remove child item from this item.

Decrements reference count of item.

Parameters
indexof the item to be removed.
Returns
true on success, false otherwise.

◆ GetItem()

vtkAbstractContextItem* vtkContextScene::GetItem ( unsigned int  index)

Get the item at the specified index.

Returns
the item at the specified index (null if index is invalid).

◆ GetNumberOfItems()

unsigned int vtkContextScene::GetNumberOfItems ( )

Get the number of child items.

◆ ClearItems()

void vtkContextScene::ClearItems ( )

Remove all child items from this item.

◆ SetAnnotationLink()

virtual void vtkContextScene::SetAnnotationLink ( vtkAnnotationLink link)
virtual

Set the vtkAnnotationLink for the chart.

◆ GetAnnotationLink()

virtual vtkAnnotationLink* vtkContextScene::GetAnnotationLink ( )
virtual

Get the vtkAnnotationLink for the chart.

◆ SetGeometry() [1/2]

virtual void vtkContextScene::SetGeometry ( int  ,
int   
)
virtual

Set the width and height of the scene in pixels.

◆ SetGeometry() [2/2]

void vtkContextScene::SetGeometry ( int  [2])

◆ GetGeometry() [1/3]

virtual int* vtkContextScene::GetGeometry ( )
virtual

Get the width and height of the scene in pixels.

◆ GetGeometry() [2/3]

virtual void vtkContextScene::GetGeometry ( int &  ,
int &   
)
virtual

◆ GetGeometry() [3/3]

virtual void vtkContextScene::GetGeometry ( int  [2])
virtual

◆ SetUseBufferId()

virtual void vtkContextScene::SetUseBufferId ( bool  )
virtual

Set whether the scene should use the color buffer.

Default is true.

◆ GetUseBufferId()

virtual bool vtkContextScene::GetUseBufferId ( )
virtual

Get whether the scene is using the color buffer.

Default is true.

◆ GetViewWidth()

virtual int vtkContextScene::GetViewWidth ( )
virtual

Get the width of the view.

◆ GetViewHeight()

virtual int vtkContextScene::GetViewHeight ( )
virtual

Get the height of the view.

◆ GetSceneWidth()

int vtkContextScene::GetSceneWidth ( )

Get the width of the scene.

◆ GetSceneHeight()

int vtkContextScene::GetSceneHeight ( )

Get the height of the scene.

◆ SetScaleTiles()

virtual void vtkContextScene::SetScaleTiles ( bool  )
virtual

Whether to scale the scene transform when tiling, for example when using vtkWindowToImageFilter to take a large screenshot.

The default is true.

◆ GetScaleTiles()

virtual bool vtkContextScene::GetScaleTiles ( )
virtual

◆ ScaleTilesOn()

virtual void vtkContextScene::ScaleTilesOn ( )
virtual

◆ ScaleTilesOff()

virtual void vtkContextScene::ScaleTilesOff ( )
virtual

◆ GetLogicalTileScale()

vtkVector2i vtkContextScene::GetLogicalTileScale ( )

The tile scale of the target vtkRenderWindow.

Hardcoded pixel offsets, etc should properly account for these <x, y> scale factors. This will simply return vtkVector2i(1, 1) if ScaleTiles is false or if this->Renderer is NULL.

◆ SetRenderer()

virtual void vtkContextScene::SetRenderer ( vtkRenderer renderer)
virtual

This should not be necessary as the context view should take care of rendering.

◆ GetRenderer()

virtual vtkRenderer* vtkContextScene::GetRenderer ( )
virtual

◆ SetDirty()

void vtkContextScene::SetDirty ( bool  isDirty)

Inform the scene that something changed that requires a repaint of the scene.

This should only be used by the vtkContextItem derived objects in a scene in their event handlers.

◆ GetDirty()

bool vtkContextScene::GetDirty ( ) const

◆ ReleaseGraphicsResources()

void vtkContextScene::ReleaseGraphicsResources ( )

Release graphics resources hold by the scene.

◆ GetLastPainter()

vtkWeakPointer<vtkContext2D> vtkContextScene::GetLastPainter ( )

Last painter used.

Not part of the end-user API. Can be used by context items to create their own colorbuffer id (when a context item is a container).

◆ GetBufferId()

vtkAbstractContextBufferId* vtkContextScene::GetBufferId ( )

Return buffer id.

Not part of the end-user API. Can be used by context items to initialize their own colorbuffer id (when a context item is a container).

◆ SetTransform()

virtual void vtkContextScene::SetTransform ( vtkTransform2D transform)
virtual

Set the transform for the scene.

◆ GetTransform()

vtkTransform2D* vtkContextScene::GetTransform ( )

Get the transform for the scene.

◆ HasTransform()

bool vtkContextScene::HasTransform ( )
inline

Check whether the scene has a transform.

Definition at line 229 of file vtkContextScene.h.

◆ ProcessSelectionEvent()

virtual bool vtkContextScene::ProcessSelectionEvent ( unsigned int  rect[5])
protectedvirtual

Process a rubber band selection event.

◆ MouseMoveEvent()

virtual bool vtkContextScene::MouseMoveEvent ( const vtkContextMouseEvent event)
protectedvirtual

Process a mouse move event.

◆ ButtonPressEvent()

virtual bool vtkContextScene::ButtonPressEvent ( const vtkContextMouseEvent event)
protectedvirtual

Process a mouse button press event.

◆ ButtonReleaseEvent()

virtual bool vtkContextScene::ButtonReleaseEvent ( const vtkContextMouseEvent event)
protectedvirtual

Process a mouse button release event.

◆ DoubleClickEvent()

virtual bool vtkContextScene::DoubleClickEvent ( const vtkContextMouseEvent event)
protectedvirtual

Process a mouse button double click event.

◆ MouseWheelEvent()

virtual bool vtkContextScene::MouseWheelEvent ( int  delta,
const vtkContextMouseEvent event 
)
protectedvirtual

Process a mouse wheel event where delta is the movement forward or back.

◆ KeyPressEvent()

virtual bool vtkContextScene::KeyPressEvent ( const vtkContextKeyEvent keyEvent)
protectedvirtual

Process a key press event.

◆ KeyReleaseEvent()

virtual bool vtkContextScene::KeyReleaseEvent ( const vtkContextKeyEvent keyEvent)
protectedvirtual

Process a key release event.

◆ PaintIds()

virtual void vtkContextScene::PaintIds ( )
protectedvirtual

Paint the scene in a special mode to build a cache for picking.

Use internally.

◆ TestBufferIdSupport()

void vtkContextScene::TestBufferIdSupport ( )
protected

Test if BufferId is supported by the OpenGL context.

◆ GetPickedItem() [1/2]

vtkIdType vtkContextScene::GetPickedItem ( int  x,
int  y 
)
protected

Return the item id under mouse cursor at position (x,y).

Return -1 if there is no item under the mouse cursor.

Postcondition
valid_result: result>=-1 && result<this->GetNumberOfItems()

◆ GetPickedItem() [2/2]

vtkAbstractContextItem* vtkContextScene::GetPickedItem ( )
protected

Return the item under the mouse.

If no item is under the mouse, the method returns a null pointer.

◆ UpdateBufferId()

void vtkContextScene::UpdateBufferId ( )
protected

Make sure the buffer id used for picking is up-to-date.

Friends And Related Function Documentation

◆ vtkContextInteractorStyle

friend class vtkContextInteractorStyle
friend

The vtkContextInteractorStyle class delegates all of the events to the scene, accessing protected API.

Definition at line 325 of file vtkContextScene.h.

Member Data Documentation

◆ AnnotationLink

vtkAnnotationLink* vtkContextScene::AnnotationLink
protected

Definition at line 316 of file vtkContextScene.h.

◆ Geometry

int vtkContextScene::Geometry[2]
protected

Definition at line 319 of file vtkContextScene.h.

◆ Storage

Private* vtkContextScene::Storage
protected

Definition at line 331 of file vtkContextScene.h.

◆ Children

vtkContextScenePrivate* vtkContextScene::Children
protected

This structure provides a list of children, along with convenience functions to paint the children etc.

It is derived from std::vector<vtkAbstractContextItem>, defined in a private header.

Definition at line 340 of file vtkContextScene.h.

◆ LastPainter

vtkWeakPointer<vtkContext2D> vtkContextScene::LastPainter
protected

Definition at line 342 of file vtkContextScene.h.

◆ Renderer

vtkWeakPointer<vtkRenderer> vtkContextScene::Renderer
protected

Definition at line 344 of file vtkContextScene.h.

◆ BufferId

vtkAbstractContextBufferId* vtkContextScene::BufferId
protected

Definition at line 346 of file vtkContextScene.h.

◆ BufferIdDirty

bool vtkContextScene::BufferIdDirty
protected

Definition at line 347 of file vtkContextScene.h.

◆ UseBufferId

bool vtkContextScene::UseBufferId
protected

Definition at line 349 of file vtkContextScene.h.

◆ BufferIdSupportTested

bool vtkContextScene::BufferIdSupportTested
protected

Definition at line 351 of file vtkContextScene.h.

◆ BufferIdSupported

bool vtkContextScene::BufferIdSupported
protected

Definition at line 352 of file vtkContextScene.h.

◆ ScaleTiles

bool vtkContextScene::ScaleTiles
protected

Definition at line 354 of file vtkContextScene.h.

◆ Transform

vtkTransform2D* vtkContextScene::Transform
protected

The scene level transform.

Definition at line 359 of file vtkContextScene.h.


The documentation for this class was generated from the following file: