KwikPeg Manuals
Home
PegCircularBitmapDial
Index
Index


Members
Styles
Signals
(none)
Overview Derived from class PegCircularDial

The PegCircularBitmapDial class implements a circular dial, the analog equivalent of a digital readout. Unlike a finite bitmap dial, the needle travel is not restricted to an arc of less than or equal to 360 degrees. The needle may travel from its start position through the entire 360 degrees of a circle and beyond. Multiple revoutions of the needle are allowed.

The circular bitmap dial is drawn within a bounding rectangle but has no frame or tick marks. Instead, the face of the dial is drawn using a background bitmap image which, if necessary, can provide the frame and tick marks. The bitmap image can include transparent regions, allowing it to float over the background of the dial's parent. The colors of the dial needle and needle anchor are adjustable to provide the proper contrast with the dial's bitmap image. If desired, a separate bitmap image can be provided for the dial anchor.

Unlike the PegCircularDial class, the PegCircularBitmapDial class allows the center of rotation of the dial needle to be located anywhere within the dial's client area. Using this feature, a dial can be constructed with a circular dial face that fits within a much smaller rectangle somewhere within the dial's client area. Be sure to adjust the needle length using function SetNeedleLength to meet your dial requirements.

To use the PegCircularBitmapDial class or its derivatives, your KwikPeg configuration must have the following option enabled:
  Drawing: HMI graphics



 See Also

PegDial

PegCircularDial

PegFiniteDial

PegFiniteBitmapDial



 Styles

The PegCircularBitmapDial class supports the following style flags:

DS_RECTCOR  If this style flag is set, the center of rotation of the dial needle will be at the center of the dial's bounding rectangle (its mReal rectangle).
DS_USERCOR  If this style flag is set, the center of rotation of the dial needle will be at the screen coordinates specified by your application. This style flag permits the center of the needle rotation to be outside the rectangle in which a finite dial is drawn.
DS_TICMARKS  If this style flag is set, the dial will be drawn with tick marks at the defined intervals.
DS_THINNEEDLE  If this style flag is set, the dial needle will be drawn as a thin single line, 1 pixel wide.
DS_THICKNEEDLE  If this style flag is set, the dial needle will be drawn as a thick single line, 3 pixels wide.
DS_POLYNEEDLE  If this style flag is set, the dial needle will be drawn as a filled polygon.
DS_STANDARDSTYLE  This style flag mask selects the following styles which are commonly used for dials:
DS_THINNEEDLE | DS_CLOCKWISE | DS_TICMARKS | DS_RECTCOR.
Note that derived classes may only support a subset of these style flags. For example, the finite dials simply ignore the DS_CLOCKWISE style flag since the direction of needle travel is determined by the dial's needle limits. The circular dials also ignore the DS_CLOCKWISE style flag since the direction of needle rotation is determined by the limits of the measured variable.
AF_TRANSPARENT  If this style flag is set, the background color will be that of the dial's parent object.

The PegCircularBitmapDial class does not support tick marks or any of the frame styles because a bitmap image is used for the background of the dial's client area. A frame and tick marks, if required, can be added to the background bitmap image.


Top of page


 Members

Constructors:

PegCircularBitmapDial(const PegRect &Rect,
  SIGNED iRefAngle, LONG lValuePerRev,
  LONG lMinValue, LONG lMaxValue,
  PegBitmap *pBkgBitmap,
  PegBitmap *pAnchorBitmap = NULL,
  WORD wStyle = DS_STANDARDSTYLE)
PegCircularBitmapDial(SIGNED iLeft, SIGNED iTop,
  SIGNED iRefAngle, LONG lValuePerRev,
  LONG lMinValue, LONG lMaxValue,
  PegBitmap *pBkgBitmap,
  PegBitmap *pAnchorBitmap = NULL,
  WORD wStyle = DS_STANDARDSTYLE)

The first constructor creates a circular bitmap dial in the rectangle specified by parameter Rect.

The second constructor creates a circular bitmap dial with its top left corner located at (iLeft,iTop). By default, an object created in this fashion will have a width and height of 100 pixels. If a background bitmap is specified, the dial is sized to the height and width of the bitmap image.

For both constructors, the following parameters are provided.

The starting point (reference angle) for the dial's needle is to be located at iRefAngle degrees. If necessary, review the definition of angles as they apply to dial geometry.

The sweep value for the measured variable is lValuePerRev. Every time the measured value changes by this amount, the dial needle will rotate through 360 degrees.

Values for the measured variable which the dial represents are restricted to the range lMinValue to lMaxValue.

The minimum measured value maps directly to the needle's reference angle. The needle will rotate until the maximum value of the measured value is reached. If the maximum value is greater than the minimum value, the needle will rotate clockwise. Otherwise, the needle will rotate counterclockwise.

Parameter pBkgBitmap is a pointer to the bitmap image which will be used as the dial background, forming the dial face. If the bitmap image includes transparent regions, be sure to use the AF_TRANSPARENT style flag so that the image will float over the parent's background or over the dial's background if the dial has no parent.

Parameter pAnchorBitmap is a pointer to the anchor point bitmap image to be drawn centered over the dial's center of rotation. If this parameter is NULL, the anchor point will be drawn as a small circle.

The dial characteristics will be governed by the style flags provided by parameter wStyle. Note that frame styles are not supported by circular bitmap dials.

 

Public Functions:

virtual void Draw(void)

The PegCircularBitmapDial class overrides the Draw() function to draw the bitmap image background, the needle anchor and the dial needle to reflect the current value of the variable which the dial represents.

PegBitmap *GetAnchorBitmap(void) const

This function returns a pointer to the PegBitmap bitmap image which is used as the dial anchor point. The function returns NULL if the object does not have an anchor bitmap installed.

PegBitmap *GetBkgBitmap(void) const

This function returns a pointer to the PegBitmap bitmap image which is used as the dial background to form the dial face.

SIGNED GetCORX(void) const
SIGNED GetCORY(void) const

These inline functions return the relative x and y cordinates, in pixels, of the center of rotation of the dial needle. The x,y location of the center of rotation is measured relative to the top left corner of the dial's client area.

void SetAnchorBitmap(PegBitmap *pBmp)

This function sets the bitmap for the anchor point to the bitmap image referenced by parameter pBmp. The dial is not redrawn.

void SetBkgBitmap(PegBitmap *pBmp)

This function sets the background bitmap for the dial face to the bitmap image referenced by parameter pBmp. The dial is not redrawn.

void SetCOR(SIGNED CORX, SIGNED CORY,
  BOOL bRedraw = FALSE)

This function sets the relative x,y cordinates, in pixels, of the center of rotation of the dial needle to CORX,CORY. The x,y location of the center of rotation is measured relative to the top left corner of the dial's client area. The center of rotation must be within the client area of the dial.

If parameter bRedraw is TRUE, the dial will be redrawn so that the needle reflects the updated location of the needle's center of rotation.

void UseTrueCOR(BOOL bUse)

This function establishes the style to be used for needle center of rotation calculations.

If bUse is TRUE, style flag DS_RECTCOR is set and style flag DS_USERCOR is reset.

If bUse is FALSE, style flag DS_USERCOR is set and style flag DS_RECTCOR is reset.




Top of page
KwikPeg Manuals
Home
Index
Index

 
Copyright © 2000-2003