SFA Project On-line Documentation: SFALabels
The SFALabels class is used to provide 2d text within the 3d environment
using the MR Tookit's panel package. This text is used within SFA
to label the axes of the bounding volume, and to draw 'wall labels'
showing information about the currently selected (if any) glyph.
The class handles all interaction between the panel package and SFA,
including panel creation and manipulation.
//
// Labels.H
//
// This file defines the label (Hershey text) implementation
// C++ified verison of original labels.c
//
// James Hall June 1998
//
#ifndef __LABELS_H__
#define __LABELS_H__
# include
# include
# include
# include
# include
# include
// X-Includes
#include
#include
#include
#include
// OpenGL Includes
#include
#include
#include
// SFA Includes
#include "sfa_ui.H"
#include "Defines.H"
#include "DataSet.H"
#include "DataSetList.H"
#include "PackedGlyph.H"
#include "Interface.H"
#include "Subset.H"
// MR Includes
#include "MR/dbg.h"
#include "TwoHand.h"
#include
#include
class SFALabels {
private:
struct panel xPanel, yPanel, zPanel ; /* panels for x,y,z labels */
Panel LegendPanel ; /* legend panel POINTER */
Ptext LPText ; /* legend panel text widget */
char xlabel[255];
char ylabel[255];
char zlabel[255];
char colorlabel[255];
char opacitylabel[255];
Panel XYZposPanel, XYZnegPanel ; /* xy plane panels */
Panel XZYposPanel, XZYnegPanel ; /* xz plane panels */
Panel YZXposPanel, YZXnegPanel ; /* yz plane panels */
float panel_scale ;
vector_minmax_t setsize;
public:
// Constructor & Destructor
SFALabels(void);
~SFALabels(void);
void draw_axis_labels(int, int, int, int, int, int);
void init_fakePanels( void );
void createPanels( float *);
void draw_wall_values( Point3, char *, float *);
void set_setsize(vector_minmax_t);
};
#endif /* define __LABELS_H__ */
Constructors
SFALabels(void);
The constructor sets up the labels for each relevent attribute.
~SFALabels(void);
No code currently in destructor.
Mutators
void set_setsize(vector_minmax_t);
This function sets the size of the current bounding volume.
These values are used to properly position wall labels.
Accessors
Other Functions
void draw_axis_labels(int, int, int, int, int, int);
This function uses the previously setup 'fake' panels and
generates the 'X Axis', 'Y Axis', and 'Z axis' labels aligned
with the appropriate axis.
void init_fakePanels( void );
MR panels typically are manipulated with MR_panel* functions.
In the case of the axis labels, they are always fixed, and we always
know the angle we want these to be facing, so instead of using
the manipulation functions, we create a set of hard coded
values for the panels for the axis labels. This function
initializes the panel structures reponsible for these labels.
void createPanels( float *);
This function is used to create the true MR panels used to draw
the labels on the walls of the view volume. Since these panels
will have text moving around on them (the text is aligned
near the project of the currently selected glyph to the wall
in question) the panels are setup to cover the entire wall. The
text is then placed at the right location each time through the draw
cycle, in the function draw_wall_values.
void draw_wall_values( Point3, char *, float *);
Given the currently selected glyph's location (the first parameter),
this function draws the appropriate wall labels at the projected
locations. Also drawn are lines from the edges of each wall to
add another visual cue to the user to indicate which glyph
is currently selected.
James Hall