Home |
HMI (Human-Machine Interface) Classes Class PegCircularDial |
Class PegCircularDialPegCircularDial is an HMI output gadget that provides an analog equivalent to a digital readout. It can be fed any integral data from any source. The dial is categorized as circular because it allows for multiple revolutions of the needle. Each lap of the needle around the circumference of the dial adds a specific value to the accumulative value. To achieve this, the application must specify a reference angle (the angle on the dial where the lap begins) as well as a value per revolution. Coupled with the minimum and maximum values supported by the dial, this allows for predictable circular behavior. As an example, if the minimum value of the dial was 0 and the maximum was 900, and the value per revolution was 300 and the reference angle was 90, then setting the current value of the dial to 0 would force the needle to draw at 90 degrees. Incrementing the value up to 300 would make the needle do one complete revolution around the dial. When the current value reached 900, the needle would be at 90 degrees, having traveled around the circumference of the dial three times. class PegCircularDial : public PegDial { public: PegCircularDial(const PegRect& tRect, PEGINT iRefAngle, LONG lValuePerRev, LONG lMinValue, LONG lMaxValue, PEGUINT wStyle = DS_STANDARDSTYLE); PegCircularDial(PEGINT iLeft, PEGINT iTop, PEGINT iRefAngle, LONG lValuePerRev, LONG lMinValue, LONG lMaxValue, PEGUINT wStyle = DS_STANDARDSTYLE); virtual void Draw(void); virtual void SetLimits(PEGINT iRefAngle, LONG lValuePerRev, LONG lMinValue, LONG lMaxValue); PEGINT GetRefAngle(void) const; LONG GetValuePerRev(void) const; }; Style FlagsPegCircularDial supports the styles described in PegDial. SignalsPegCircularDial does not send any signals. ConstructorsThe first constructor takes a reference to a PegRect to determine its size. It then takes a PEGINT value to denote the reference angle. The reference angle is the point on the dial at which the minimum value that the dial supports will be mapped, as well as where a complete revolution is counted. lValuePerRev tells the dial how much to increment its internal current value for each revolution of the needle around the circumference of the dial. It then takes LONG's for the minimum and maximum value, and a style PEGUINT. The seconds constructor takes PEGINT values to determine the left and top positions of the dial. By default, an object created using this constructor will have a width and height of 100 pixels. The remaining arguments are the same as above. Method DrawPegCircularDial overrides the Draw() function. Method GetRefAngleThis inline function returns the internal reference angle. Method GetValuePerRevThis inline function returns the internal value per revolution. ExamplesThe following is an example of three PegCircularDials on a PegDecoratedWindow. The above PegCircularDial were created by the following code snippet: PegCircularDial * mpDial1, * mpDial2, * mpDial3; ... PegRect WinRect; WinRect.Set(50, 50, 200, 200); mpDial1 = new PegCircularDial(WinRect, 0, 300, 0, 900, AF_TRANSPARENT | DS_STANDARDSTYLE); mpDial1->SetTicFreq(10); mpDial1->SetTicLen(10); mpDial1->SetDialColor(CYAN); mpDial1->RemoveStatus(PSF_VIEWPORT); WinRect.Shift(160, 0); mpDial2 = new PegCircularDial(WinRect, 270, 180, 0, 1800, FF_RAISED); mpDial2->Style(mpDial2->Style() | DS_THICKNEEDLE | DS_TICMARKS | DS_RECTCOR | DS_CLOCKWISE); mpDial2->SetColor(PCI_NORMAL, DARKGRAY); mpDial2->SetNeedleColor(BLUE); mpDial2->SetTicFreq(10); mpDial2->SetTicLen(20); WinRect.Shift(160, 0); mpDial3 = new PegCircularDial(WinRect, 180, 360, 0, 720, FF_RECESSED); mpDial3->Style(mpDial3->Style() | DS_POLYNEEDLE | DS_TICMARKS | DS_RECTCOR | DS_CLOCKWISE); mpDial3->SetColor(PCI_NORMAL, LIGHTGRAY); mpDial3->SetDialColor(GREEN); mpDial3->SetNeedleColor(YELLOW); mpDial3->SetTicFreq(10); mpDial3->SetTicLen(20); Add(mpDial1); PegPrompt * pPrompt = new PegPrompt(105, 210, 40, "0", 101, FF_RECESSED | TJ_CENTER | TT_COPY); pPrompt->SetColor(PCI_NTEXT, RED); Add(pPrompt); Add(mpDial2); pPrompt = new PegPrompt(265, 210, 40, "0", 102, FF_RECESSED | TJ_CENTER | TT_COPY); pPrompt->SetColor(PCI_NTEXT, BLUE); Add(pPrompt); pPrompt = new PegPrompt(425, 210, 40, "0", 103, FF_RECESSED | TJ_CENTER | TT_COPY); pPrompt->SetColor(PCI_NTEXT, GREEN); Add(pPrompt); Add(mpDial3);
|