Guiliani  Version 2.5 revision 7293 (documentation build 13)
GUIGraph.h
1/*
2* Copyright (C) TES Electronic Solutions GmbH,
3* All Rights Reserved.
4* Contact: info@guiliani.de
5*
6* This file is part of the Guiliani HMI framework
7* for the development of graphical user interfaces on embedded systems.
8*/
9
10#ifndef GUIGRAPH_H
11#define GUIGRAPH_H
12
13#include "GUIObject.h"
14#include "GUIColorPropertyObserver.h"
15#include "GUIFontResource.h"
16
17#include "GUICommonEnums.h"
18
19#include "eC_TArray.h"
20
26{
27public:
32 virtual eC_Float Calculate(const eC_Float& fInput) = 0;
33};
34
45{
46public:
56 CGUICompositeObject* const pkParent,
57 const eC_Value& vX, const eC_Value& vY,
58 const eC_Value& vWidth, const eC_Value& vHeight,
59 const ObjectHandle_t &eID = NO_HANDLE);
60
63
67 CGUIGraph(const CGUIGraph& kToBeCopied);
68
73 CGUIGraph& operator=(const CGUIGraph& kSource);
74
75 virtual ~CGUIGraph();
76
82 const CGUICommonEnums::AxisStyle_t& eAxisStyleX,
83 const CGUICommonEnums::AxisStyle_t& eAxisStyleY);
84
91 CGUICommonEnums::AxisStyle_t& eAxisStyleY) const;
92
100 void SetScaling(const eC_Value& vScalingX, const eC_Value& vScalingY);
101
106 void GetScaling(eC_Value& vScalingX, eC_Value& vScalingY) const;
107
112 void SetLabelSpacing(const eC_UInt& uiLabelSpacingX, const eC_UInt& uiLabelSpacingY);
113
118 void GetLabelSpacing(eC_UInt& uiLabelSpacingX, eC_UInt& uiLabelSpacingY) const;
119
125 void SetValueSpacing(const eC_UInt& uiValueSpacing);
126
130 eC_UInt GetValueSpacing() const;
131
136 void SetLogBase(const eC_UInt& uiLogBaseX, const eC_UInt& uiLogBaseY);
137
142 void GetLogBase(eC_UInt& uiLogBaseX, eC_UInt& uiLogBaseY);
143
150 void SetOffset(const eC_Value& vOffsetX, const eC_Value& vOffsetY);
151
156 void GetOffset(eC_Value& vOffsetX, eC_Value& vOffsetY) const;
157
161 void SetFontID(const FontResource_t& eFontID);
162
167
171 void SetAxisColor(const eC_UInt& uiAxisColor);
172
176 void SetAxisColor(const GlobalProperty_t& eAxisColor);
177
181 eC_UInt GetAxisColor() const;
182
186 void SetAxisLineWidth(const eC_Value& vAxisLineWidth);
187
191 eC_Value GetAxisLineWidth() const;
192
197 void SetLineColor(const eC_UInt& uiIndex, const eC_UInt& uiLineColor);
198
203 void SetLineColor(const eC_UInt& uiIndex, const GlobalProperty_t& eLineColor);
204
209 eC_UInt GetLineColor(const eC_UInt& uiIndex) const;
210
214 void SetLineWidth(const eC_Value& vLineWidth);
215
219 eC_Value GetLineWidth() const;
220
225
230
234 void SetHelperLinesColor(const eC_UInt& uiHelperLinesColor);
235
239 void SetHelperLinesColor(const GlobalProperty_t& eHelperLinesColor);
240
244 eC_UInt GetHelperLinesColor() const;
245
249 void SetHelperLineWidth(const eC_Value& vHelperLineWidth);
250
254 eC_Value GetHelperLineWidth() const;
255
260 void SetFunction(const eC_UInt& uiIndex, CGUIGraphFunction* pkFunction);
261
268 void SetInteractive(const eC_Bool& bInteractive);
269
273 eC_Bool GetInteractive() const;
274
275#if defined(GUILIANI_STREAM_GUI)
280 virtual void ReadFromStream();
281#endif
282
283#if defined(GUILIANI_WRITE_GUI)
289 virtual void WriteToStream(const eC_Bool bWriteClassID=false);
290#endif
291
292 virtual eC_Bool DoDraw();
293
294 virtual eC_Bool DoDrag(
295 const eC_Value& vDeltaX,
296 const eC_Value& vDeltaY,
297 const eC_Value& vAbsX,
298 const eC_Value& vAbsY);
299
300 virtual eC_Bool DoDoubleClick(
301 const eC_Value& vAbsX,
302 const eC_Value& vAbsY);
303
304 virtual eC_Bool IsHighlightable() const { return false; }
305
306private:
307 void Init();
308 void DeInit();
309
310 void DrawAxis();
311 void DrawData(const eC_UInt& uiIndex);
312
313 static eC_Float Lin2Log(
314 const eC_UInt& uiLogFactor,
315 const eC_Value& vValue);
316
317 static eC_Float Log2Lin(
318 const eC_UInt& uiLogFactor,
319 const eC_Value vValue);
320
321 void CalcDecimals();
322
323private:
324 static const eC_UInt INDEX_AXISCOLOR;
325 static const eC_UInt INDEX_HELPERCOLOR;
326 static const eC_UInt INDEX_LINECOLOR;
327 static const eC_UByte MAX_NUMBER_OF_DECIMALS;
328
329 CGUICommonEnums::AxisStyle_t m_eAxisStyleX;
330 eC_Value m_vScalingX;
331 eC_UInt m_uiLabelSpacingX;
332 eC_UInt m_uiValueSpacingX;
333 eC_UInt m_uiLogBaseX;
334 eC_Bool m_bFloatForX;
335 eC_UByte m_ubDecimalsX;
336
337 CGUICommonEnums::AxisStyle_t m_eAxisStyleY;
338 eC_Value m_vScalingY;
339 eC_UInt m_uiLabelSpacingY;
340 eC_UInt m_uiLogBaseY;
341 eC_Bool m_bFloatForY;
342 eC_UByte m_ubDecimalsY;
343
344 eC_Value m_vOffsetX;
345 eC_Value m_vOffsetY;
346
347 FontResource_t m_eFontID;
348 eC_UInt m_uiAxisColor;
349 eC_Value m_vAxisLineWidth;
350 eC_UInt m_uiLineColor;
351 eC_Value m_vDrawLineWidth;
353 eC_UInt m_uiHelpLineColor;
354 eC_Value m_vHelpLineWidth;
355 eC_TArray<CGUIGraphFunction*> m_pkFunction;
356
357 eC_UInt m_uiNumberLineColors;
358
359 eC_Bool m_bInteractive;
360};
361
362#endif
Helper Macros in Guiliani
FontResource_t
List of font resource ids.
Definition: GUIFontResource.h:54
ObjectHandle_t
List of object resource ids.
Definition: GUIObjectHandleResource.h:55
GlobalProperty_t
List of property resource ids.
Definition: GUIPropertyResource.h:67
This observer provides the base-interface for controls when using color-properties.
Definition: GUIColorPropertyObserver.h:23
AxisStyle_t
Axis-types for displaying values.
Definition: GUICommonEnums.h:32
AxisAlignment_t
Axis-alignment for freedom of control.
Definition: GUICommonEnums.h:23
This is the Guiliani base class for all composite objects.
Definition: GUICompositeObject.h:70
this class is used by CGUIGraph to calculate the necessary values for displaying the function-graph
Definition: GUIGraph.h:26
virtual eC_Float Calculate(const eC_Float &fInput)=0
This control can be used to draw multiple function-graphs. Attributes for both axis and the visualiza...
Definition: GUIGraph.h:45
CGUIGraph & operator=(const CGUIGraph &kSource)
void SetFontID(const FontResource_t &eFontID)
void SetScaling(const eC_Value &vScalingX, const eC_Value &vScalingY)
void SetValueSpacing(const eC_UInt &uiValueSpacing)
eC_Value GetLineWidth() const
eC_Value GetAxisLineWidth() const
void GetScaling(eC_Value &vScalingX, eC_Value &vScalingY) const
eC_UInt GetAxisColor() const
void GetLogBase(eC_UInt &uiLogBaseX, eC_UInt &uiLogBaseY)
void SetInteractive(const eC_Bool &bInteractive)
void SetHelperLineWidth(const eC_Value &vHelperLineWidth)
void SetOffset(const eC_Value &vOffsetX, const eC_Value &vOffsetY)
CGUIGraph(const CGUIGraph &kToBeCopied)
void GetLabelSpacing(eC_UInt &uiLabelSpacingX, eC_UInt &uiLabelSpacingY) const
void SetLineWidth(const eC_Value &vLineWidth)
virtual eC_Bool DoDoubleClick(const eC_Value &vAbsX, const eC_Value &vAbsY)
void SetAxisStyle(const CGUICommonEnums::AxisStyle_t &eAxisStyleX, const CGUICommonEnums::AxisStyle_t &eAxisStyleY)
virtual void ReadFromStream()
void SetLineColor(const eC_UInt &uiIndex, const GlobalProperty_t &eLineColor)
eC_UInt GetValueSpacing() const
FontResource_t GetFontID() const
void SetAxisLineWidth(const eC_Value &vAxisLineWidth)
void SetAxisColor(const eC_UInt &uiAxisColor)
CGUIGraph(CGUICompositeObject *const pkParent, const eC_Value &vX, const eC_Value &vY, const eC_Value &vWidth, const eC_Value &vHeight, const ObjectHandle_t &eID=NO_HANDLE)
void SetAxisColor(const GlobalProperty_t &eAxisColor)
void SetHelperLines(const CGUICommonEnums::AxisAlignment_t &eHelperLines)
eC_Bool GetInteractive() const
void SetLogBase(const eC_UInt &uiLogBaseX, const eC_UInt &uiLogBaseY)
eC_UInt GetHelperLinesColor() const
CGUICommonEnums::AxisAlignment_t GetHelperLines() const
void SetHelperLinesColor(const eC_UInt &uiHelperLinesColor)
void SetFunction(const eC_UInt &uiIndex, CGUIGraphFunction *pkFunction)
CGUIGraph()
Default constructor.
virtual void WriteToStream(const eC_Bool bWriteClassID=false)
virtual eC_Bool IsHighlightable() const
Definition: GUIGraph.h:304
void SetHelperLinesColor(const GlobalProperty_t &eHelperLinesColor)
eC_Value GetHelperLineWidth() const
void GetOffset(eC_Value &vOffsetX, eC_Value &vOffsetY) const
eC_UInt GetLineColor(const eC_UInt &uiIndex) const
virtual eC_Bool DoDrag(const eC_Value &vDeltaX, const eC_Value &vDeltaY, const eC_Value &vAbsX, const eC_Value &vAbsY)
virtual eC_Bool DoDraw()
void SetLineColor(const eC_UInt &uiIndex, const eC_UInt &uiLineColor)
void GetAxisStyle(CGUICommonEnums::AxisStyle_t &eAxisStyleX, CGUICommonEnums::AxisStyle_t &eAxisStyleY) const
void SetLabelSpacing(const eC_UInt &uiLabelSpacingX, const eC_UInt &uiLabelSpacingY)
This is the Guiliani base class all controls are derived from.
Definition: GUIObject.h:79