/usr/include/vtk-6.3/vtkBalloonRepresentation.h is in libvtk6-dev 6.3.0+dfsg1-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 | /*=========================================================================
Program: Visualization Toolkit
Module: vtkBalloonRepresentation.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
// .NAME vtkBalloonRepresentation - represent the vtkBalloonWidget
// .SECTION Description
// The vtkBalloonRepresentation is used to represent the vtkBalloonWidget.
// This representation is defined by two items: a text string and an image.
// At least one of these two items must be defined, but it is allowable to
// specify both, or just an image or just text. If both the text and image
// are specified, then methods are available for positioning the text and
// image with respect to each other.
//
// The balloon representation consists of three parts: text, a rectangular
// frame behind the text, and an image placed next to the frame and sized
// to match the frame.
//
// The size of the balloon is ultimately controlled by the text properties
// (i.e., font size). This representation uses a layout policy as follows.
//
// If there is just text and no image, then the text properties and padding
// are used to control the size of the balloon.
//
// If there is just an image and no text, then the ImageSize[2] member is
// used to control the image size. (The image will fit into this rectangle,
// but will not necessarily fill the whole rectangle, i.e., the image is not
// stretched).
//
// If there is text and an image, the following approach ia used. First,
// based on the font size and other related properties (e.g., padding),
// determine the size of the frame. Second, depending on the layout of the
// image and text frame, control the size of the neighboring image (since the
// frame and image share a common edge). However, if this results in an image
// that is smaller than ImageSize[2], then the image size will be set to
// ImageSize[2] and the frame will be adjusted accordingly. The text is
// always placed in the center of the frame if the frame is resized.
// .SECTION See Also
// vtkBalloonWidget
#ifndef vtkBalloonRepresentation_h
#define vtkBalloonRepresentation_h
#include "vtkInteractionWidgetsModule.h" // For export macro
#include "vtkWidgetRepresentation.h"
class vtkTextMapper;
class vtkTextActor;
class vtkTextProperty;
class vtkPoints;
class vtkCellArray;
class vtkPolyData;
class vtkPolyDataMapper2D;
class vtkActor2D;
class vtkProperty2D;
class vtkImageData;
class vtkTexture;
class vtkPoints;
class vtkPolyData;
class vtkPolyDataMapper2D;
class vtkActor2D;
class VTKINTERACTIONWIDGETS_EXPORT vtkBalloonRepresentation : public vtkWidgetRepresentation
{
public:
// Description:
// Instantiate the class.
static vtkBalloonRepresentation *New();
// Description:
// Standard VTK methods.
vtkTypeMacro(vtkBalloonRepresentation,vtkWidgetRepresentation);
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
// Specify/retrieve the image to display in the balloon.
virtual void SetBalloonImage(vtkImageData *img);
vtkGetObjectMacro(BalloonImage,vtkImageData);
// Description:
// Specify/retrieve the text to display in the balloon.
vtkGetStringMacro(BalloonText);
vtkSetStringMacro(BalloonText);
// Description:
// Specify the minimum size for the image. Note that this is a bounding
// rectangle, the image will fit inside of it. However, if the balloon
// consists of text plus an image, then the image may be bigger than
// ImageSize[2] to fit into the balloon frame.
vtkSetVector2Macro(ImageSize,int);
vtkGetVector2Macro(ImageSize,int);
// Description:
// Set/get the text property (relevant only if text is shown).
virtual void SetTextProperty(vtkTextProperty *p);
vtkGetObjectMacro(TextProperty,vtkTextProperty);
// Description:
// Set/get the frame property (relevant only if text is shown).
// The frame lies behind the text.
virtual void SetFrameProperty(vtkProperty2D *p);
vtkGetObjectMacro(FrameProperty,vtkProperty2D);
// Description:
// Set/get the image property (relevant only if an image is shown).
virtual void SetImageProperty(vtkProperty2D *p);
vtkGetObjectMacro(ImageProperty,vtkProperty2D);
//BTX
enum {ImageLeft=0,ImageRight,ImageBottom,ImageTop};
//ETX
// Description:
// Specify the layout of the image and text within the balloon. Note that
// there are reduncies in these methods, for example
// SetBalloonLayoutToImageLeft() results in the same effect as
// SetBalloonLayoutToTextRight(). If only text is specified, or only an
// image is specified, then it doesn't matter how the layout is specified.
vtkSetMacro(BalloonLayout,int);
vtkGetMacro(BalloonLayout,int);
void SetBalloonLayoutToImageLeft() {this->SetBalloonLayout(ImageLeft);}
void SetBalloonLayoutToImageRight() {this->SetBalloonLayout(ImageRight);}
void SetBalloonLayoutToImageBottom() {this->SetBalloonLayout(ImageBottom);}
void SetBalloonLayoutToImageTop() {this->SetBalloonLayout(ImageTop);}
void SetBalloonLayoutToTextLeft() {this->SetBalloonLayout(ImageRight);}
void SetBalloonLayoutToTextRight() {this->SetBalloonLayout(ImageLeft);}
void SetBalloonLayoutToTextTop() {this->SetBalloonLayout(ImageBottom);}
void SetBalloonLayoutToTextBottom() {this->SetBalloonLayout(ImageTop);}
// Description:
// Set/Get the offset from the mouse pointer from which to place the
// balloon. The representation will try and honor this offset unless there
// is a collision with the side of the renderer, in which case the balloon
// will be repositioned to lie within the rendering window.
vtkSetVector2Macro(Offset,int);
vtkGetVector2Macro(Offset,int);
// Description:
// Set/Get the padding (in pixels) that is used between the text and the
// frame.
vtkSetClampMacro(Padding,int,0,100);
vtkGetMacro(Padding,int);
// Description:
// These are methods that satisfy vtkWidgetRepresentation's API.
virtual void StartWidgetInteraction(double e[2]);
virtual void EndWidgetInteraction(double e[2]);
virtual void BuildRepresentation();
virtual int ComputeInteractionState(int X, int Y, int modify=0);
// Description:
// Methods required by vtkProp superclass.
virtual void ReleaseGraphicsResources(vtkWindow *w);
virtual int RenderOverlay(vtkViewport *viewport);
// Description:
// State is either outside, or inside (on the text portion ot the image).
enum _InteractionState {Outside=0, OnText, OnImage};
protected:
vtkBalloonRepresentation();
~vtkBalloonRepresentation();
// The balloon text and image
char *BalloonText;
vtkImageData *BalloonImage;
// The layout of the balloon
int BalloonLayout;
// Controlling placement
int Padding;
int Offset[2];
int ImageSize[2];
// Represent the text
vtkTextMapper *TextMapper;
vtkActor2D *TextActor;
vtkTextProperty *TextProperty;
// Represent the image
vtkTexture *Texture;
vtkPolyData *TexturePolyData;
vtkPoints *TexturePoints;
vtkPolyDataMapper2D *TextureMapper;
vtkActor2D *TextureActor;
vtkProperty2D *ImageProperty;
// The frame
vtkPoints *FramePoints;
vtkCellArray *FramePolygon;
vtkPolyData *FramePolyData;
vtkPolyDataMapper2D *FrameMapper;
vtkActor2D *FrameActor;
vtkProperty2D *FrameProperty;
// Internal variable controlling rendering process
int TextVisible;
int ImageVisible;
// Helper methods
void AdjustImageSize(double imageSize[2]);
void ScaleImage(double imageSize[2],double scale);
private:
vtkBalloonRepresentation(const vtkBalloonRepresentation&); //Not implemented
void operator=(const vtkBalloonRepresentation&); //Not implemented
};
#endif
|