KwikPeg Manuals
Home
PegFiniteDial
Examples
Examples
Index
Index


Members
Styles
Signals
(none)
Overview Derived from class PegDial

The PegFiniteDial class implements a finite dial, a dial for which the needle travel is restricted to some minimum and maximum limit. The needle may travel from 0 degrees through the entire 360 degrees of a circle. However, the needle cannot travel beyond 360 degrees.

The PegFiniteDial class maps each measurement value to the face of the dial so that minimum and maximum measurement values correspond to the limits of the dial's needle travel.

The finite dial is drawn within a bounding rectangle with an optional frame. The colors of the dial face, tick marks, needle and needle anchor are all adjustable to meet the needs of your application. The background color is determined by the dial itself or by its parent.

The center of rotation of the dial needle for a PegFiniteDial object is unconditionally located at the center of the dial's client area.

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



 See Also

PegDial

PegFiniteBitmapDial

PegCircularDial

PegCircularBitmapDial



 Styles

The PegFiniteDial class supports the following style flags:

FF_NONE No frame.
FF_THIN Thin frame.
FF_THICK Thick 3D frame.
FF_RAISED Raised 3D frame.
FF_RECESSED Recessed 3D frame.
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.

Top of page


 Members

Constructors:

PegFiniteDial(const PegRect &Rect,
  SIGNED iMinAngle, SIGNED iMaxAngle,
  LONG lMinValue, LONG lMaxValue,
  WORD wStyle = DS_STANDARDSTYLE)
PegFiniteDial(SIGNED iLeft, SIGNED iTop,
  SIGNED iMinAngle, SIGNED iMaxAngle,
  LONG lMinValue, LONG lMaxValue,
  WORD wStyle = DS_STANDARDSTYLE)

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

The second constructor creates a finite 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.

For both constructors, the following parameters are provided.

The dial's needle motion will be restricted to the angular range iMinAngle to iMaxAngle degrees. If necessary, review the definition of angles as they apply to dial geometry.

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 minimum needle angle. The maximum measured value maps directly to the maximum needle angle. Hence, needle travel will go from the minimum angle to the maximum angle as the measured value goes from its minimum value to its maximum value.

The frame style and dial characteristics will be governed by the style flags provided by parameter wStyle.

 

Public Functions:

virtual void Draw(void)

The PegFiniteDial class overrides the Draw() function to draw the dial face, the optional tick marks, the needle anchor and the dial needle to reflect the current value of the variable which the dial represents.

virtual void SetLimits(
  SIGNED iMinAngle, SIGNED iMaxAngle,
  LONG lMinValue, LONG lMaxValue)

This virtual function sets the limits for the range of travel for the dial needle and defines the values of the measured variable which correspond to the dial needle extremes.

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 minimum needle angle. The maximum measured value maps directly to the maximum needle angle. Hence, needle travel will go from the minimum angle to the maximum angle as the measured value goes from its minimum value to its maximum value.


Top of page


 Examples

The following example illustrates three finite dials derived from the PegFiniteDial class and drawn within a decorated window.

 
The PegFiniteDial objects illustrated above were created by the following code fragment:

    PegFiniteDial *mpDial1, *mpDial2, *mpDial3;
    :
    :
    PegRect WinRect;

    WinRect.Set(50, 50, 200, 200);
    mpDial1 = new PegFiniteDial(WinRect,
        180, 0, -50, 100,
        AF_TRANSPARENT | DS_STANDARDSTYLE);
    mpDial1->SetTicFreq(10);
    mpDial1->SetTicLen(10);
    mpDial1->SetDialColor(CYAN);

    WinRect.Shift(160, 0);
    mpDial2 = new PegFiniteDial(WinRect,
        225, 315, 0, 300,
        FF_RAISED | DS_THICKNEEDLE |
        DS_TICMARKS | DS_RECTCOR);
    mpDial2->SetColor(PCI_NORMAL, DARKGRAY);
    mpDial2->SetNeedleColor(BLUE);
    mpDial2->SetTicFreq(50);
    mpDial2->SetTicLen(20);

    WinRect.Shift(160, 0);
    mpDial3 = new PegFiniteDial(WinRect,
        225, 315, 0, 300,
        FF_RECESSED | DS_POLYNEEDLE |
        DS_TICMARKS | DS_RECTCOR);
    mpDial3->SetColor(PCI_NORMAL, LIGHTGRAY);
    mpDial3->SetDialColor(GREEN);
    mpDial3->SetNeedleColor(YELLOW);
    mpDial3->SetTicFreq(50);
    mpDial3->SetTicLen(20);

    mpDial1->SetValue(65, FALSE);
    Add(mpDial1);
    PegPrompt* pPrompt =
        new PegPrompt(105, 160, 40, "65", 101,
            FF_RECESSED | TJ_CENTER | TT_COPY);
    pPrompt->SetColor(PCI_NTEXT, RED);
    mpDial1->Add(pPrompt);

    mpDial2->SetValue(137, FALSE);
    Add(mpDial2);
    pPrompt = new PegPrompt(265, 160, 40, "137", 102,
            FF_RECESSED | TJ_CENTER | TT_COPY);
    pPrompt->SetColor(PCI_NTEXT, BLUE);
    mpDial2->Add(pPrompt);

    mpDial3->SetValue(280, FALSE);
    Add(mpDial3);



Top of page
KwikPeg Manuals
Home
Index
Index

 
Copyright © 2000-2003