CIvfFltkWidget Class Reference

#include <ivffltk/deprecated/IvfFltkWidget.h>

Inheritance diagram for CIvfFltkWidget:

CIvfBase List of all members.

Public Member Functions

 CIvfFltkWidget (int X, int Y, int W, int H, const char *L=0)
virtual ~CIvfFltkWidget ()
 IvfClassInfo ("CIvfFltkWidget", CIvfBase)
CIvfCameragetCamera ()
void addToScene (CIvfShape *shape)
void deleteSelected ()
void deleteSelectedKeep ()
void manipulateSelected (int mode)
int getManipulatorMode ()
void createLine ()
void centerSelected ()
void deleteAll ()
void resetView ()
void clearSelection ()
void selectAll ()
void setEditMode (int mode)
int getEditMode ()
void setWorkspace (double size)
double getWorkspace ()
CIvfWorkspacegetScene ()
bool getUseOverlay ()
void setUseOverlay (bool flag)
void setSelectEnable (bool flag)
void setEditEnabled (bool flag)
void setSnapToGrid (bool flag)
bool getSnapToGrid ()
int getCurrentMouseButton ()
int getCurrentModifier ()
CIvfCompositegetSelectedShapes ()
bool isInitialized ()

Protected Member Functions

void draw ()
int handle (int event)
virtual void doMouseUp (int x, int y)
virtual void doMouseDown (int x, int y)
virtual void doPassiveMotion (int x, int y)
virtual void doMotion (int x, int y)
virtual void doMouse (int x, int y)
virtual void onInit ()
virtual void onDestroy ()
virtual void onCreateNode (double x, double y, double z, CIvfNode *&newNode)
virtual void onCreateLine (CIvfNode *node1, CIvfNode *node2, CIvfShape *&newLine)
virtual void onSelect (CIvfComposite *selectedShapes)
virtual void onDeSelect ()
virtual void onCoordinate (double x, double y, double z)
virtual void onDeleteShape (CIvfShape *shape, bool &doit)
virtual void onInitContext ()
virtual void onOverlay ()
virtual void onHighlightShape (CIvfShape *shape)
virtual void onMove (CIvfComposite *selectedShapes, double &dx, double &dy, double &dz, bool &doit)
virtual void onSelectFilter (CIvfShape *shape, bool &select)
virtual void onHighlightFilter (CIvfShape *, bool &highlight)
virtual void onMotion (int x, int y)
virtual void onPassiveMotion (int x, int y)
virtual void onMouse (int x, int y)
virtual void onMouseDown (int x, int y)
virtual void onMouseUp (int x, int y)

Detailed Description

Ivf FLTK Widget

Widget for interfacing the Ivf++ library with a FLTK Application. The class should be used to derive custom widgets. These widgets should implement/override the onXXX methods in the class to enable it to create shapes. NOTE: To derive more general widgets use the CIvfFltkBase instead.

Author:
Jonas Lindemann

Definition at line 123 of file IvfFltkWidget.h.


Constructor & Destructor Documentation

CIvfFltkWidget::CIvfFltkWidget int  X,
int  Y,
int  W,
int  H,
const char *  L = 0
 

CIvfFltkWidget constructor

Initializes the widget position and size and an optional title

Parameters:
X Widget x position.
Y Widget y position.
W Widget width.
H Widget height.
L Widget title (optional)

virtual CIvfFltkWidget::~CIvfFltkWidget  )  [virtual]
 

CIvfFltkWidget destructor


Member Function Documentation

void CIvfFltkWidget::addToScene CIvfShape shape  ) 
 

Add a shape to the scene.

If addReference() is not called on the shape before adding it to the scene, the shape is owned by the widget and will be destroyed when not needed.

void CIvfFltkWidget::centerSelected  ) 
 

Centers camera on selected shape.

void CIvfFltkWidget::createLine  ) 
 

Creates a line between two selected nodes

This method calls the virtual method onCreateLine(...) to enable derived classes to instanciate new classes.

void CIvfFltkWidget::deleteAll  ) 
 

Deletes all shapes in scene.

Shapes are deleted if not referenced.

void CIvfFltkWidget::deleteSelected  ) 
 

Deletes selected shapes

Shapes are deleted if not referenced.

void CIvfFltkWidget::draw  )  [protected]
 

Implements the FL_Gl_Window draw method

This method is called when the widget is to be drawn.

CIvfCamera* CIvfFltkWidget::getCamera  ) 
 

Returns camera used by widget

int CIvfFltkWidget::getCurrentMouseButton  ) 
 

Return current mouse button

int CIvfFltkWidget::getEditMode  ) 
 

Returns current edit mode

int CIvfFltkWidget::getManipulatorMode  ) 
 

Returns manipulation mode

CIvfWorkspace* CIvfFltkWidget::getScene  ) 
 

Return the scene object used by the widget

bool CIvfFltkWidget::getSnapToGrid  ) 
 

Return snap to grid state

bool CIvfFltkWidget::getUseOverlay  ) 
 

Return overlay use

double CIvfFltkWidget::getWorkspace  ) 
 

Returns workspace size

int CIvfFltkWidget::handle int  event  )  [protected]
 

Implements the FL_Gl_Window handle method

This method is called in response to GUI events.

void CIvfFltkWidget::manipulateSelected int  mode  ) 
 

Manipulate selected shape

Attaches a manipulator to the currently selected shape. The current edit mode is changed to IVF_MANIPULATE. Manipulation mode can be set to two different modes:

Parameters:
IVF_TRANS_MANIP translation manipulator
IVF_ROT_MANIP rotation manipulator

virtual void CIvfFltkWidget::onCoordinate double  x,
double  y,
double  z
[protected, virtual]
 

onCoordinate event

This method is called when the cursor is updated.

Parameters:
x Cursor x coordinate
y Cursor y coordinate
z Cursor z coordinate

virtual void CIvfFltkWidget::onCreateLine CIvfNode node1,
CIvfNode node2,
CIvfShape *&  newLine
[protected, virtual]
 

onCreateLine event

This method is called if a line is to created. The following code shows how a onCreateLine method can be implemented.

 void CIvfMyWidget::onCreateLine(CIvfNode* node1, CIvfNode* node2, CIvfShape* &newLine)
 {
          CIvfSolidLine* line = new CIvfSolidLine();
          line->setNodes(node1, node2);
          line->setRadius(m_lineRadius);
          line->setSides(m_lineSides);
          line->setMaterial(m_lineMaterial);
    newLine = (CIvfShape*) line;
 }
Parameters:
node1 First selected node
node2 Second selected node
newLine This parameter should be assigned if a new line has been created.

virtual void CIvfFltkWidget::onCreateNode double  x,
double  y,
double  z,
CIvfNode *&  newNode
[protected, virtual]
 

onCreateNode event

This method is called if a node is to be created. The following code sample shows how a onCreateNode method can be implemented.

 void CIvfMyWidget::onCreateNode(double x, double y, double z, CIvfNode* &newNode)
 {
          newNode = new CIvfNode();
          newNode->setPosition(x, y, z);
          newNode->setNodeSize(m_nodeSize);
          newNode->setNodeType(m_nodeType);
          newNode->setMaterial(m_nodeMaterial);
 }
Parameters:
x node x coordinate
y node y coordinate
z node z coordinate
newNode This parameter shoud be assigned if a new node has been created.

virtual void CIvfFltkWidget::onDeleteShape CIvfShape shape,
bool &  doit
[protected, virtual]
 

onDeleteShape event

Is called when an object is to be deleted. The doit variable determines if the object can be deleted. If doit is true the object will be deleted.

virtual void CIvfFltkWidget::onDeSelect  )  [protected, virtual]
 

onDeSelect event

This method is called when objects have be deselected.

virtual void CIvfFltkWidget::onDestroy  )  [protected, virtual]
 

onDestroy event

This method is called when the widget is destroyed.

virtual void CIvfFltkWidget::onHighlightShape CIvfShape shape  )  [protected, virtual]
 

onHighlightShape event

This event is called when an object has been highlighted in a select operation.

virtual void CIvfFltkWidget::onInit  )  [protected, virtual]
 

onInit event

onInit is called the first time an OpenGL context is activated. All OpenGL dependent intialization code should be placed here, including Ivf++ code.

virtual void CIvfFltkWidget::onInitContext  )  [protected, virtual]
 

onInitContext event

This event is called when an OpenGL context is initialized. OpenGL state initialization code should be placed here.

virtual void CIvfFltkWidget::onMove CIvfComposite selectedShapes,
double &  dx,
double &  dy,
double &  dz,
bool &  doit
[protected, virtual]
 

onMove event

This event is called in response to a move operation. The dx, dy, dz values contains the requested move distance. These can be modified to control the move behavior. The doit flag must be set to true if the move operation should be performed or not.

virtual void CIvfFltkWidget::onOverlay  )  [protected, virtual]
 

onOverlay event

This event is called when an overlay is to be drawn. For this method to be called, the UseOverlay property must be set using the setUseOverlay method. The view port is configured for 2D drawing when this method is called.

virtual void CIvfFltkWidget::onSelect CIvfComposite selectedShapes  )  [protected, virtual]
 

onSelect event

This method is called when a selection has occured.

Parameters:
selectedShapes Currently selected shapes.

void CIvfFltkWidget::resetView  ) 
 

Resets view to initial settings

void CIvfFltkWidget::setEditEnabled bool  flag  ) 
 

Enables/disables edit

void CIvfFltkWidget::setEditMode int  mode  ) 
 

Set widget edit mode.

Sets the edit mode of the widget. Determines how mouse actions and keyboard actions should be handled.

Parameters:
IVF_SELECT Selection of shapes.
IVF_VIEW_ZOOM Rotation and zoom of current view.
IVF_VIEW_PAN Rotation and pan of current view.
IVF_CREATE_NODE Node creation mode.
IVF_CREATE_BOX Box creation mode.
IVF_MOVE Shape move mode.

void CIvfFltkWidget::setSelectEnable bool  flag  ) 
 

Enables/disables selection

void CIvfFltkWidget::setSnapToGrid bool  flag  ) 
 

Enables/disables grid snap

void CIvfFltkWidget::setUseOverlay bool  flag  ) 
 

Enables the use of a overlay layer (see onOverlay)

void CIvfFltkWidget::setWorkspace double  size  ) 
 

Set size of workspace

The workspace size describes the size of the grid and relative node sizes and line radius. Also sets an initial snap distance of the grid. Workspace is centered around the origin (0,0) The visual grid spans (-size/2,-size/2)-(size/2,size/2)


The documentation for this class was generated from the following file:
Generated on Fri Sep 1 15:36:51 2006 for Interactive Visualisation Framework - Ivf++ by  doxygen 1.4.6-NO