Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

TxqDrawable Class Reference

The TxqDrawable is a base class for all canvas drawables. More...

#include <TxqDrawable.h>

Inheritance diagram for TxqDrawable::

Txq2dDrawable Txq3dDrawable Txq2dAxis Txq2dLabel Txq2dLineArray Txq2dPoint Txq2dSeg TxqAttribDrawable Txq3dAxis Txq3dLabel Txq3dLine Txq3dPoints List of all members.

Public Methods

 TxqDrawable ()
 The constructor is default. More...

virtual void setColor (QColor c)
 Set the color of the object. More...

virtual QColor getColor ()
 Gets the current color of the object. More...

virtual void setPrintColor (QColor c)
 Set the print color of the object. More...

QColor getPrintColor ()
 Get the print color of the object. More...

virtual void setPrint (bool pr)
 Set the flag to print this object. More...

void setTranslatable (bool b)
 Set the translatable state of the drawable. More...

bool isTranslatable ()
 Get the translable state of the drawable. More...

void setResizable (bool b)
 Set the resizable state of the drawable. More...

bool isResizable ()
 Get the resizable state of the drawable. More...

void setRotatable (bool b)
 Set the rotatable state of the drawable. More...

bool isRotatable ()
 Get the rotatable state of the drawable. More...

void setControlable (bool b)
 Get the controlable state of the drawable, i.e. More...

bool isControlable ()
 Get the controlable state of the drawable. More...

void setLabel (QString *s)
 Set the drawable's label. More...

QString* getLabel ()
 Get the drawable's label. More...

void setLabelColor (QColor *c)
 Set the color of the drawable's label. More...

QColorgetLabelColor ()
 Get the color of the drawable's label. More...

void constrainY ()
 Constrains the motion of the drawable to only along the y axis. More...

bool isConstrainedY ()
 Gets the state of constrainment along the y axis. More...

void constrainX ()
 Constrains the motion of the drawable to only along the x axis. More...

bool isConstrainedX ()
 Gets the state of constrainment along the x axis. More...

void setLimitsX (int lower, int upper)
 Constrains the motion of the drawable to only along the x axis to be between the limits. More...

void setLimitsY (int lower, int upper)
 Constrains the motion of the drawable to only along the y axis to be between the limits. More...

bool isInXRange (int x)
 Returns true if x is within the limits on the x axis and false if not. More...

bool isInYRange (int y)
 Returns true if y is within the limits on the y axis and false if not. More...

void processRotation (double delta)
 Processes the rotation by firing an action event and calling the rotate() method. More...

virtual void rotate (double delta)
 Rotates the drawable to the specified angle measured from the positive x-axis and increasing in the clockwise direction. More...

void setRotationPoint (double x, double y)
 Set the point about which to rotate the object For most classes, this will be defaulted to the centerPoint. More...

void setRotationPoint (TxqDoublePoint point)
 Set the point about which to rotate the object For most classes, this will be defaulted to the centerPoint. More...

TxqDoublePoint getRotationPoint ()
 Get the rotation point. More...

void setAngle (double newAngle)
 Set the current angle of the drawable. More...

double getAngle ()
 Returns the current angle of the drawable. More...

void findCenterPoint ()
 Finds center of drawables bounds in the TxqCanvas coordinate system. More...

void findCenterFromBounds ()
 Finds center of drawables bounds in the TxqCanvas's coordinate system. More...

TxqDoublePoint getCenterPoint ()
 Returns the current center of the TxqDrawable in the TxqCanvas's coordinate system. More...

void setCenterPoint (TxqDoublePoint cp)
 Set the center of the TxqDrawable in the TxqCanvas's coordinate system. More...

void setCenterPoint (double x, double y)
 Set the center of the TxqDrawable in the TxqCanvas's coordinate system. More...

virtual void setLocation (int x, int y)
 Set the location of the objects. More...

void setDrawRect (int x, int y, int w, int h)
 Set the bounds of the rectangle which initially determines the size of the TxqDrawable. More...

QRect* getDrawRect ()
 Gets the bounds of the rectangle which initially determines the size of the TxqDrawable. More...

void clicked (TxqDoublePoint *point)
 Handles clicking by registering the clicked point and firing an action event. More...

QPoint* getClickedPoint ()
 Returns the last clicked point. More...

void movedTo (QPoint *point)
 Moves the drawable to the specified point. More...

QPoint* getMovedToPoint ()
 Returns the last point that the drawable was moved to. More...

QPoint* topPoint ()
 Returns the top-middle point of this drawable. More...

QPoint* bottomPoint ()
 Returns the bottom-middle point of this drawable. More...

QPoint* leftPoint ()
 Returns the left-middle point of this drawable. More...

QPoint* rightPoint ()
 Returns the right-middle point of this drawable. More...

void fireAction (QString s)
 Fire the action to a listener. More...

void setDump (bool df)
 Set the dump flag. More...

virtual void dump (QTextStream *ts)
 Dump the obect contents to the text stream ts. More...

virtual ~TxqDrawable ()
 the destructor. More...


Protected Methods

virtual void initialize ()
 Initialize data. More...


Protected Attributes

bool translatable
bool resizable
bool rotatable
bool controlable
int controlFrameIndex
QPoint* movedToPoint
bool xConstrained
bool yConstrained
int xLowerLimit
int xUpperLimit
int yLowerLimit
int yUpperLimit
TxqDoublePoint centerPoint
TxqDoublePoint rotationPoint
double angle
TxqDoublePointclickedPoint
QString* label
 The label pointer. More...

QColorlabelColor
 The label pointer color. More...

QRect* drawRect
 The draw rectangle pointer. More...

QColor color
 The color of the object. More...

QColor prcolor
 The print color of the object. More...

bool isPrint
 The flag to determine if the paint method is printing. More...

std::vector<TxqDoublePointpoints
 The vector of points making up the object. More...

bool dumpFlag
 The dump flag true if this object can dump contents. More...


Static Protected Attributes

const double PI
const double HALFPI
const double THREEHALFPI
const double TWOPI
const double physBoundsWidth

Detailed Description

The TxqDrawable is a base class for all canvas drawables.

A TxqDrawable is an object which can be rendered on a TxqCanvas and can contain a QColor.

Copyright 2000 by Tech-X Corporation

Author:
Kelly G. Luetkemeyer

Version:
Id:
TxqDrawable.h,v 1.9 2002/01/17 19:28:00 kgl Exp

Definition at line 50 of file TxqDrawable.h.


Constructor & Destructor Documentation

TxqDrawable::TxqDrawable ( )
 

The constructor is default.

TxqDrawable::~TxqDrawable ( ) [virtual]
 

the destructor.


Member Function Documentation

QPoint * TxqDrawable::bottomPoint ( )
 

Returns the bottom-middle point of this drawable.

void TxqDrawable::clicked ( TxqDoublePoint * point )
 

Handles clicking by registering the clicked point and firing an action event.

void TxqDrawable::constrainX ( )
 

Constrains the motion of the drawable to only along the x axis.

void TxqDrawable::constrainY ( )
 

Constrains the motion of the drawable to only along the y axis.

void TxqDrawable::dump ( QTextStream * ts ) [virtual]
 

Dump the obect contents to the text stream ts.

Parameters:
ts   the QTextStream to dump this object.

Reimplemented in Txq2dLabel, Txq2dLine, Txq2dLineArray, Txq2dLineSeg, Txq2dPoint, Txq2dPointArray, Txq2dPoints, Txq2dPolygon, Txq2dPolygonArray, Txq2dVector, Txq3dLabel, Txq3dLine, Txq3dPoints, and TxqAttribDrawable.

void TxqDrawable::findCenterFromBounds ( )
 

Finds center of drawables bounds in the TxqCanvas's coordinate system.

One pixel is subtracted because for a given dimension "d" one can only draw to the (d-1)th pixel.

Reimplemented in Txq2dLineSeg.

void TxqDrawable::findCenterPoint ( )
 

Finds center of drawables bounds in the TxqCanvas coordinate system.

void TxqDrawable::fireAction ( QString s )
 

Fire the action to a listener.

double TxqDrawable::getAngle ( )
 

Returns the current angle of the drawable.

TxqDoublePoint TxqDrawable::getCenterPoint ( )
 

Returns the current center of the TxqDrawable in the TxqCanvas's coordinate system.

QPoint * TxqDrawable::getClickedPoint ( )
 

Returns the last clicked point.

QColor TxqDrawable::getColor ( ) [virtual]
 

Gets the current color of the object.

Returns:
the QColor of the object.

QRect * TxqDrawable::getDrawRect ( )
 

Gets the bounds of the rectangle which initially determines the size of the TxqDrawable.

QString * TxqDrawable::getLabel ( )
 

Get the drawable's label.

Returns:
the drawable's label as a QString pointer.

Reimplemented in Txq2dLabel, and Txq3dLabel.

QColor * TxqDrawable::getLabelColor ( )
 

Get the color of the drawable's label.

Returns:
the color of the drawable's label as a QColor pointer.

QPoint * TxqDrawable::getMovedToPoint ( )
 

Returns the last point that the drawable was moved to.

QColor TxqDrawable::getPrintColor ( )
 

Get the print color of the object.

Returns:
the QColor of the object when printing.

TxqDoublePoint TxqDrawable::getRotationPoint ( )
 

Get the rotation point.

void TxqDrawable::initialize ( ) [protected, virtual]
 

Initialize data.

Reimplemented in Txq2dLine, Txq2dLineSeg, Txq2dPoint, Txq2dPointArray, Txq2dPoints, Txq2dPolygon, Txq2dVector, Txq3dLine, and Txq3dPoints.

bool TxqDrawable::isConstrainedX ( )
 

Gets the state of constrainment along the x axis.

bool TxqDrawable::isConstrainedY ( )
 

Gets the state of constrainment along the y axis.

bool TxqDrawable::isControlable ( )
 

Get the controlable state of the drawable.

Returns:
the control flag.

bool TxqDrawable::isInXRange ( int x )
 

Returns true if x is within the limits on the x axis and false if not.

bool TxqDrawable::isInYRange ( int y )
 

Returns true if y is within the limits on the y axis and false if not.

bool TxqDrawable::isResizable ( )
 

Get the resizable state of the drawable.

Returns:
the resizable state flag.

bool TxqDrawable::isRotatable ( )
 

Get the rotatable state of the drawable.

Returns:
the rotatable flag.

bool TxqDrawable::isTranslatable ( )
 

Get the translable state of the drawable.

Returns:
the translate flag.

QPoint * TxqDrawable::leftPoint ( )
 

Returns the left-middle point of this drawable.

void TxqDrawable::movedTo ( QPoint * point )
 

Moves the drawable to the specified point.

void TxqDrawable::processRotation ( double delta )
 

Processes the rotation by firing an action event and calling the rotate() method.

QPoint * TxqDrawable::rightPoint ( )
 

Returns the right-middle point of this drawable.

void TxqDrawable::rotate ( double delta ) [virtual]
 

Rotates the drawable to the specified angle measured from the positive x-axis and increasing in the clockwise direction.

This method is abstract and relies on derived classes to provide the implementation.

Reimplemented in Txq2dPolygon.

void TxqDrawable::setAngle ( double myAngle )
 

Set the current angle of the drawable.

Parameters:
the   newAngle value for the drawable in degrees.

Reimplemented in Txq2dLineSeg.

void TxqDrawable::setCenterPoint ( double x,
double y )
 

Set the center of the TxqDrawable in the TxqCanvas's coordinate system.

void TxqDrawable::setCenterPoint ( TxqDoublePoint cp )
 

Set the center of the TxqDrawable in the TxqCanvas's coordinate system.

void TxqDrawable::setColor ( QColor c ) [virtual]
 

Set the color of the object.

Parameters:
c   the color for the TxqDrawable object.

Reimplemented in Txq2dLine, Txq2dOutlined, Txq2dPoints, Txq2dVector, and Txq3dDrawable.

void TxqDrawable::setControlable ( bool b )
 

Get the controlable state of the drawable, i.e.

if the drawable is rotatable, resizable, or otherwise controllable

Parameters:
b   the control flag

void TxqDrawable::setDrawRect ( int x,
int y,
int w,
int h )
 

Set the bounds of the rectangle which initially determines the size of the TxqDrawable.

The component bounds may be later increased to allow for rotation, but if one wants to reset the drawable's original position+size, the drawRect is the bounds to set.

void TxqDrawable::setDump ( bool df )
 

Set the dump flag.

Parameters:
df   the dump flag, true if this object can be dumped to a text file.

void TxqDrawable::setLabel ( QString * s )
 

Set the drawable's label.

Parameters:
the   QString pointer for the objects's label

void TxqDrawable::setLabelColor ( QColor * c )
 

Set the color of the drawable's label.

Parameters:
c   the QColor pointer

void TxqDrawable::setLimitsX ( int lower,
int upper )
 

Constrains the motion of the drawable to only along the x axis to be between the limits.

void TxqDrawable::setLimitsY ( int lower,
int upper )
 

Constrains the motion of the drawable to only along the y axis to be between the limits.

void TxqDrawable::setLocation ( int x,
int y ) [virtual]
 

Set the location of the objects.

Reimplemented in Txq2dLabel, Txq2dPoint, Txq2dPointArray, Txq2dPoints, Txq2dSeg, Txq3dAxis, and Txq3dLabel.

Referenced by Txq3dLabel::setLocation(), and Txq3dAxis::setLocation().

void TxqDrawable::setPrint ( bool pr ) [virtual]
 

Set the flag to print this object.

Parameters:
pr   bool flag for printing true if printing is desired false if not printing

Reimplemented in Txq2dOutlined.

void TxqDrawable::setPrintColor ( QColor c ) [virtual]
 

Set the print color of the object.

Parameters:
c   the color to be used when printing the object.

Reimplemented in Txq2dLine, Txq2dOutlined, Txq2dPoints, and Txq2dVector.

void TxqDrawable::setResizable ( bool b )
 

Set the resizable state of the drawable.

If this is false the drawable can not be resized.

Returns:
the resizable flag.

void TxqDrawable::setRotatable ( bool b )
 

Set the rotatable state of the drawable.

If this is false the drawable can not be rotated.

Parameters:
b   the rotatable flag.

void TxqDrawable::setRotationPoint ( TxqDoublePoint point )
 

Set the point about which to rotate the object For most classes, this will be defaulted to the centerPoint.

void TxqDrawable::setRotationPoint ( double x,
double y )
 

Set the point about which to rotate the object For most classes, this will be defaulted to the centerPoint.

void TxqDrawable::setTranslatable ( bool b )
 

Set the translatable state of the drawable.

If this is false the drawable can not be moved.

Parameters:
b   the translate flag.

QPoint * TxqDrawable::topPoint ( )
 

Returns the top-middle point of this drawable.


Member Data Documentation

const double TxqDrawable::HALFPI [static, protected]
 

Definition at line 397 of file TxqDrawable.h.

const double TxqDrawable::PI [static, protected]
 

Definition at line 396 of file TxqDrawable.h.

const double TxqDrawable::THREEHALFPI [static, protected]
 

Definition at line 398 of file TxqDrawable.h.

const double TxqDrawable::TWOPI [static, protected]
 

Definition at line 399 of file TxqDrawable.h.

double TxqDrawable::angle [protected]
 

Definition at line 402 of file TxqDrawable.h.

TxqDoublePoint TxqDrawable::centerPoint [protected]
 

Definition at line 400 of file TxqDrawable.h.

TxqDoublePoint * TxqDrawable::clickedPoint [protected]
 

Definition at line 406 of file TxqDrawable.h.

QColor TxqDrawable::color [protected]
 

The color of the object.

Reimplemented in Txq2dLineArray, and TxqAttribDrawable.

Definition at line 427 of file TxqDrawable.h.

int TxqDrawable::controlFrameIndex [protected]
 

Definition at line 384 of file TxqDrawable.h.

bool TxqDrawable::controlable [protected]
 

Definition at line 383 of file TxqDrawable.h.

QRect * TxqDrawable::drawRect [protected]
 

The draw rectangle pointer.

Definition at line 422 of file TxqDrawable.h.

bool TxqDrawable::dumpFlag [protected]
 

The dump flag true if this object can dump contents.

Definition at line 449 of file TxqDrawable.h.

bool TxqDrawable::isPrint [protected]
 

The flag to determine if the paint method is printing.

Definition at line 438 of file TxqDrawable.h.

QString * TxqDrawable::label [protected]
 

The label pointer.

Reimplemented in Txq2dLabel, and Txq3dLabel.

Definition at line 412 of file TxqDrawable.h.

QColor * TxqDrawable::labelColor [protected]
 

The label pointer color.

Definition at line 417 of file TxqDrawable.h.

QPoint * TxqDrawable::movedToPoint [protected]
 

Definition at line 387 of file TxqDrawable.h.

const double TxqDrawable::physBoundsWidth [static, protected]
 

Definition at line 407 of file TxqDrawable.h.

std::vector< TxqDoublePoint > TxqDrawable::points [protected]
 

The vector of points making up the object.

Definition at line 443 of file TxqDrawable.h.

QColor TxqDrawable::prcolor [protected]
 

The print color of the object.

Definition at line 432 of file TxqDrawable.h.

bool TxqDrawable::resizable [protected]
 

Definition at line 381 of file TxqDrawable.h.

bool TxqDrawable::rotatable [protected]
 

Definition at line 382 of file TxqDrawable.h.

TxqDoublePoint TxqDrawable::rotationPoint [protected]
 

Definition at line 401 of file TxqDrawable.h.

bool TxqDrawable::translatable [protected]
 

Definition at line 380 of file TxqDrawable.h.

bool TxqDrawable::xConstrained [protected]
 

Definition at line 388 of file TxqDrawable.h.

int TxqDrawable::xLowerLimit [protected]
 

Definition at line 390 of file TxqDrawable.h.

int TxqDrawable::xUpperLimit [protected]
 

Definition at line 391 of file TxqDrawable.h.

bool TxqDrawable::yConstrained [protected]
 

Definition at line 389 of file TxqDrawable.h.

int TxqDrawable::yLowerLimit [protected]
 

Definition at line 392 of file TxqDrawable.h.

int TxqDrawable::yUpperLimit [protected]
 

Definition at line 393 of file TxqDrawable.h.


The documentation for this class was generated from the following file: Copyright Tech-X Corporation, all rights reserved.