Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

Dsp Class Reference

#include <dsp.h>

List of all members.

Public Member Functions

Date:
13-May-2011
Author:
Luiz F. Martha
Version:
1.0
This file contains class to adjust the window (visible portion of the model) for visualization.

The basic graphics system used to display primitives is the "CD - Canvas Drawing". Please refer to CD documentation for additional information.

See specification of public functions of this module in hearder file "dsp.h", which also contains code color definitions.

Revisions:

  • Version 1.0 by L.F. Martha on 13-May-2011: Initial version. Modified from Trab6 of current semeter: In the constructor function, removed calls to CD to specify mark type and mark size. This is now specified in the model display function.


 Dsp (cdCanvas *canvas)
 This function creates a new the display module.
virtual ~Dsp ()
 This function deletes a display module.
void Window (double scale, double *xmin, double *xmax, double *ymin, double *ymax)
 This function adjusts the given window limits according to the given scaling factor.
void PanWindow (double dx, double dy, double *xmin, double *xmax, double *ymin, double *ymax)
 This function shifts the given window limits according to the given pan (displacement) factors.
void PanDragWindowStart (double x, double y)
 This function and the function below are used to pan (translate) interactively the visualization window.
void PanDragWindowMove (double x, double y, double *xmin, double *xmax, double *ymin, double *ymax)
 This function should be called when there is an event of mouse-move, while the mouse button is pressed or when it is released, during an interactive pan manipulation of the visualization window.
void XorMode (int on)
 This function sets on or off XOR mode display.

Static Public Attributes

static const long int BACKGROUND_COLOR = 0xC0C0C0L
 Defines gray as background color.
static const long int WHITE = 0xFFFFFFL
 Some predefined RGB color codes for convenience (stolen from CD graphics system):.
static const long int GRAY = 0xC0C0C0L
static const long int DARK_GRAY = 0x808080L
static const long int BLACK = 0x000000L
static const long int RED = 0xFF0000L
static const long int DARK_RED = 0x800000L
static const long int GREEN = 0x00FF00L
static const long int DARK_GREEN = 0x008000L
static const long int BLUE = 0x0000FFL
static const long int DARK_BLUE = 0x000080L
static const long int YELLOW = 0xFFFF00L
static const long int DARK_YELLOW = 0x808000L
static const long int MAGENTA = 0xFF00FFL
static const long int DARK_MAGENTA = 0x800080L
static const long int CYAN = 0x00FFFFL
static const long int DARK_CYAN = 0x008080L

Protected Attributes

cdCanvas * Gdatascreen
 CD handle to data canvas.
double curr_mousept_x
 Current mouse position for a mouse-move event.
double curr_mousept_y
 Current mouse position for a mouse-move event.


Constructor & Destructor Documentation

Dsp::Dsp cdCanvas *  canvas  ) 
 

This function creates a new the display module.

It sets the background color of the current color: light gray.

Parameters:
canvas - CD handle to data canvas (in)

Definition at line 53 of file dsp.cpp.

References BACKGROUND_COLOR, and Gdatascreen.

Dsp::~Dsp  )  [virtual]
 

This function deletes a display module.

It does everything is necessary to close the visualization part of this program. Currently nothing is done.

Definition at line 62 of file dsp.cpp.


Member Function Documentation

void Dsp::PanDragWindowMove double  x,
double  y,
double *  xmin,
double *  xmax,
double *  ymin,
double *  ymax
 

This function should be called when there is an event of mouse-move, while the mouse button is pressed or when it is released, during an interactive pan manipulation of the visualization window.

The translation parameters used to drag the window are computed based on the previous mouse point location and on the given point location. The given point location is updated as a current point for the next mouse move call.

Parameters:
x - x coordinate of current mouse location (in)
y - y coordinate of current mouse location (in)
xmin,xmax,ymin,ymax - given and adjusted window limits (in/out)

Definition at line 149 of file dsp.cpp.

References curr_mousept_x, curr_mousept_y, and PanWindow().

Referenced by Prj::MouseButtonDrag(), and Prj::MouseButtonRelease().

void Dsp::PanDragWindowStart double  x,
double  y
 

This function and the function below are used to pan (translate) interactively the visualization window.

The present one should be called when there is an event of mouse button-press. The location where this event occur is used as a current point to compute the window translation vector.

Parameters:
x - x coord. of location on target primitive (in)
y - y coord. of location on target primitive (in)

Definition at line 137 of file dsp.cpp.

References curr_mousept_x, and curr_mousept_y.

Referenced by Prj::MouseButtonPress().

void Dsp::PanWindow double  dx,
double  dy,
double *  xmin,
double *  xmax,
double *  ymin,
double *  ymax
 

This function shifts the given window limits according to the given pan (displacement) factors.

A negative horizontal displacement will result in a shift to the right of the displayed objects in the canvas viewport. A positive horizontal displacement will result in a shift to the left. A negative vertical displacement will result in a upward shift and a positive vertical displacement in a downward shift.

Parameters:
dx,dy - horizontal and vertical window displac. (in)
xmin,xmax,ymin,ymax - given and adjusted window limits (in/out)

Definition at line 117 of file dsp.cpp.

References Gdatascreen.

Referenced by Prj::PanDown(), PanDragWindowMove(), Prj::PanLeft(), Prj::PanRight(), and Prj::PanUp().

void Dsp::Window double  scale,
double *  xmin,
double *  xmax,
double *  ymin,
double *  ymax
 

This function adjusts the given window limits according to the given scaling factor.

A factor less than one indicates that the window will be decreased, and the result is that the displayed objects will appear bigger in the canvas viewport. A factor greater than one will result in smaller displayed objects in the canvas viewport. The limits are adjusted to be consistent with the current active canvas viewport aspect ratio. The adjustment is such that the center of the given window is maintained.

Parameters:
scale - scaling factor for adjusting window (in)
xmin,xmax,ymin,ymax - given and adjusted window limits (in/out)

Definition at line 68 of file dsp.cpp.

References Gdatascreen.

Referenced by Prj::Fit(), Prj::Help(), Prj::OpenModel(), Prj::Prj(), Prj::Reset(), Prj::Resize(), Prj::ZoomFactor(), Prj::ZoomIn(), and Prj::ZoomOut().

void Dsp::XorMode int  on  ) 
 

This function sets on or off XOR mode display.

Parameters:
on - XOR mode status (1 => on, 0 => off) (in)

Definition at line 173 of file dsp.cpp.

References Gdatascreen.

Referenced by PrmEd::DspTmpPrmLines().


Member Data Documentation

const long int Dsp::BACKGROUND_COLOR = 0xC0C0C0L [static]
 

Defines gray as background color.

Definition at line 50 of file dsp.h.

Referenced by Dsp().

const long int Dsp::BLACK = 0x000000L [static]
 

Definition at line 58 of file dsp.h.

Referenced by drvKeyCrtl(), PrmIO::GetColorCode(), and Prj::Help().

const long int Dsp::BLUE = 0x0000FFL [static]
 

Definition at line 63 of file dsp.h.

Referenced by drvKeyCrtl(), and PrmIO::GetColorCode().

double Dsp::curr_mousept_x [protected]
 

Current mouse position for a mouse-move event.

Definition at line 84 of file dsp.h.

Referenced by PanDragWindowMove(), and PanDragWindowStart().

double Dsp::curr_mousept_y [protected]
 

Current mouse position for a mouse-move event.

Definition at line 84 of file dsp.h.

Referenced by PanDragWindowMove(), and PanDragWindowStart().

const long int Dsp::CYAN = 0x00FFFFL [static]
 

Definition at line 69 of file dsp.h.

Referenced by drvKeyCrtl(), and PrmIO::GetColorCode().

const long int Dsp::DARK_BLUE = 0x000080L [static]
 

Definition at line 64 of file dsp.h.

Referenced by drvKeyCrtl(), and PrmIO::GetColorCode().

const long int Dsp::DARK_CYAN = 0x008080L [static]
 

Definition at line 70 of file dsp.h.

Referenced by drvKeyCrtl(), and PrmIO::GetColorCode().

const long int Dsp::DARK_GRAY = 0x808080L [static]
 

Definition at line 57 of file dsp.h.

Referenced by PrmIO::GetColorCode().

const long int Dsp::DARK_GREEN = 0x008000L [static]
 

Definition at line 62 of file dsp.h.

Referenced by drvKeyCrtl(), and PrmIO::GetColorCode().

const long int Dsp::DARK_MAGENTA = 0x800080L [static]
 

Definition at line 68 of file dsp.h.

Referenced by drvKeyCrtl(), and PrmIO::GetColorCode().

const long int Dsp::DARK_RED = 0x800000L [static]
 

Definition at line 60 of file dsp.h.

Referenced by drvKeyCrtl(), and PrmIO::GetColorCode().

const long int Dsp::DARK_YELLOW = 0x808000L [static]
 

Definition at line 66 of file dsp.h.

Referenced by drvKeyCrtl(), and PrmIO::GetColorCode().

cdCanvas* Dsp::Gdatascreen [protected]
 

CD handle to data canvas.

Definition at line 80 of file dsp.h.

Referenced by Dsp(), PanWindow(), Window(), and XorMode().

const long int Dsp::GRAY = 0xC0C0C0L [static]
 

Definition at line 56 of file dsp.h.

Referenced by PrmIO::GetColorCode().

const long int Dsp::GREEN = 0x00FF00L [static]
 

Definition at line 61 of file dsp.h.

Referenced by drvKeyCrtl(), and PrmIO::GetColorCode().

const long int Dsp::MAGENTA = 0xFF00FFL [static]
 

Definition at line 67 of file dsp.h.

Referenced by drvKeyCrtl(), and PrmIO::GetColorCode().

const long int Dsp::RED = 0xFF0000L [static]
 

Definition at line 59 of file dsp.h.

Referenced by drvKeyCrtl(), and PrmIO::GetColorCode().

const long int Dsp::WHITE = 0xFFFFFFL [static]
 

Some predefined RGB color codes for convenience (stolen from CD graphics system):.

Definition at line 55 of file dsp.h.

Referenced by drvKeyCrtl(), PrmIO::GetColorCode(), and PrmEd::ResetParams().

const long int Dsp::YELLOW = 0xFFFF00L [static]
 

Definition at line 65 of file dsp.h.

Referenced by drvKeyCrtl(), and PrmIO::GetColorCode().


The documentation for this class was generated from the following files:
Generated on Mon May 16 23:26:10 2011 for Trab7 by  doxygen 1.4.2-20050421