AbstractGraph is only used within TouchGFX.
 
Symbols
loading...
Files
loading...

AbstractGraph class

@class AbstractGraph AbstractGraph.hpp gui/common/AbstractGraph.hpp Simple widget capable of drawing a graph line. The graph line consists of a number of points with different x values. Points on the graph can be added and removed and the coordinate system of the graph can easily be setup. The graph is limited to integer values for x and y and the values should not exceed 1000. @see CanvasWidget

Syntax

class AbstractGraph : public CanvasWidget { public:     class GraphPoint     {     public:         GraphPoint()         {         }         int x;          int y;          CWRUtil::Q5 dx, dy;      };     AbstractGraph();     virtual ~AbstractGraph();     CWRUtil::Q5 widgetX(int x) const;     CWRUtil::Q5 widgetY(int y) const;     CWRUtil::Q5 widgetXindex(int index) const;     CWRUtil::Q5 widgetYindex(int index) const;     void setBuffer(GraphPoint *pointsBuffer, int numPointsInBuffer);     void setLinkedGraph(AbstractGraph &other);     void setRange(int newLeft, int newRight, int newTop, int newBottom);     virtual void setX(int16_t x);     virtual void setY(int16_t y);     virtual void setWidth(int16_t width);     virtual void setHeight(int16_t height);     template <class T>     void setLineWidth(T width)     {         CWRUtil::Q5 newLineWidth = CWRUtil::toQ5(width);         if (lineWidth == newLineWidth) return;         lineWidth = newLineWidth;         if (numPoints > 0)         {             updateAndInvalidateCacheForLinesBetweenIndeces(0, numPoints - 1);         }     }     template <class T>     T getLineWidth() const     {         return int(lineWidth)/T(Rasterizer::POLY_BASE_SIZE);     }     virtual void clearGraph();     virtual bool addValue(int x, int y);     virtual bool deleteValue(int x);     virtual bool drawCanvasWidget(const Rect& invalidatedArea) const; protected:     virtual Rect getMinimalRectContainingIndices(int firstIndex, int lastIndex) const = 0;     virtual void invalidateRectContainingIndices(int firstIndex, int lastIndex) const;     virtual void updateAndInvalidateCacheForLinesBetweenIndeces(int firstIndex, int lastIndex);     virtual Rect getMinimalRect() const;     AbstractGraph *linkedGraph;      int         left, right, top, bottom;      GraphPoint *points;                        int         maxPoints;                     int         numPoints;                     CWRUtil::Q5 lineWidth;                     CWRUtil::Q5 widgetWidth;                   CWRUtil::Q5 widgetHeight;                  CWRUtil::Q5 graphWidth;                    CWRUtil::Q5 graphHeight;                   virtual void setNumPoints(int numPointsUsed);     virtual void invalidateLineFromIndex(int index);     virtual void insertPointAtIndex(int index);     virtual void deletePointAtIndex(int index);     virtual int findX(int x);     CWRUtil::Q5 xAboveOutgoing(int index) const { return widgetXindex(index) + points[index].dy; }     CWRUtil::Q5 yAboveOutgoing(int index) const { return widgetYindex(index) - points[index].dx; }     CWRUtil::Q5 xBelowOutgoing(int index) const { return widgetXindex(index) - points[index].dy; }     CWRUtil::Q5 yBelowOutgoing(int index) const { return widgetYindex(index) + points[index].dx; }     CWRUtil::Q5 xAboveIncoming(int index) const { return widgetXindex(index) + points[index-1].dy; }     CWRUtil::Q5 yAboveIncoming(int index) const { return widgetYindex(index) - points[index-1].dx; }     CWRUtil::Q5 xBelowIncoming(int index) const { return widgetXindex(index) - points[index-1].dy; }     CWRUtil::Q5 yBelowIncoming(int index) const { return widgetYindex(index) + points[index-1].dx; } private:     void assignRange(int newLeft, int newRight, int newTop, int newBottom);     virtual void assignWidth(int16_t width);     virtual void assignHeight(int16_t height); };

Fields

linkedGraph

No summary provided. Read more...

left

No summary provided. Read more...
No summary provided. Read more...

top

No summary provided. Read more...

bottom

No summary provided. Read more...

points

No summary provided. Read more...

maxPoints

No summary provided. Read more...

numPoints

No summary provided. Read more...

lineWidth

No summary provided. Read more...

widgetWidth

No summary provided. Read more...

widgetHeight

No summary provided. Read more...

graphWidth

No summary provided. Read more...

graphHeight

No summary provided. Read more...

Methods

setLineWidth()

No summary provided. Read more...

getLineWidth() const

No summary provided. Read more...

clearGraph()

@fn virtual void NewGraph::clearGraph() Clears the graph. Read more...

addValue()

@fn virtual bool AbstractGraph::addValue(int x, int y) Adds a value to the graph. Adds a value to the graph. Read more...

deleteValue()

@fn virtual bool AbstractGraph::deleteValue(int x) Deletes the value on the graph line at the given x coordinate. Deletes the value on the graph line at the given x coordinate. Read more...

drawCanvasWidget() const

@fn virtual bool AbstractGraph::drawCanvasWidget(const Rect& invalidatedArea) const Draw the graph line. Draw the graph line. Care is taken not to spend time drawing graphs lines that are outside the invalidated area. Read more...

getMinimalRectContainingIndices() const

No summary provided. Read more...

invalidateRectContainingIndices() const

No summary provided. Read more...

updateAndInvalidateCacheForLinesBetweenIndeces()

@fn Rect AbstractGraph::updateCacheForLinesBetweenIndeces(int firstIndex, int lastIndex) Updates the NewGraph cache for one element. The cache is used to be able to quickly redraw the graph line without calculating the slope of all the lines that make up the graph line. Read more...

getMinimalRect() const

@fn Rect AbstractGraph::getMinimalRect() const Gets minimal rectangle containing the NewGraph. Used for invalidating only the required part of the screen. Read more...

setNumPoints()

@fn void AbstractGraph::setNumPoints(int numPointsUsed) Sets number of used points. Sets number of used points, synchronize with linked graph. Read more...

invalidateLineFromIndex()

@fn void AbstractGraph::invalidateLineFromIndex(int index) Invalidate line from index to index+1. Invalidate line from index to index+1. Read more...

widgetX() const

@fn CWRUtil::Q5 AbstractGraph::widgetX(int x) const; Calculate Widget x coordinate. Calculate widget x coordinate from a graph x coordinate. Read more...

widgetY() const

@fn CWRUtil::Q5 AbstractGraph::widgetY(int y) const; Calculate Widget y coordinate. Calculate widget y coordinate from a graph y coordinate. Read more...

widgetXindex() const

@fn CWRUtil::Q5 AbstractGraph::widgetXindex(int index) const; Calculate Widget x coordinate of the index'th point. Calculate widget x coordinate of the index'th point. Read more...

widgetYindex() const

@fn CWRUtil::Q5 AbstractGraph::widgetYindex(int index) const; Calculate Widget y coordinate of the index'th point. Calculate widget y coordinate of the index'th point. Read more...

setBuffer()

@fn void AbstractGraph::setBuffer(GraphPoint *pointsBuffer, int numPointsInBuffer) Sets a buffer to be used to store points on the graph line. Sets a buffer to be used to store points on the graph line. Read more...

setLinkedGraph()

@fn void AbstractGraph::setLinkedGraph(AbstractGraph &other); Sets linked graph. Sets linked graph which is updated when necessary. Invalidation etc is also handled. Linked graphs share the memory used for graph points and will thus reduce memory requirements. Read more...

setRange()

@fn void AbstractGraph::setRange(int newLeft, int newRight, int newTop, int newBottom) Sets the range of the graph. Sets the range of the graph. Read more...

setX()

@fn virtual void Drawable::setX(int16_t x) Sets the x coordinate of this drawable. Sets the x coordinate of this drawable. Read more...

setY()

@fn virtual void Drawable::setY(int16_t y) Sets the y coordinate of this drawable. Sets the y coordinate of this drawable. Read more...

setWidth()

@fn virtual void AbstractGraph::setWidth(int16_t width) Sets the width of this drawable. Sets the width of this drawable. Read more...

setHeight()

@fn virtual void AbstractGraph::setHeight(int16_t height) Sets the height of this drawable. Sets the height of this drawable. Read more...

insertPointAtIndex()

@fn void AbstractGraph::insertPointAtIndex(int index) Inserts a point at the given index. There is only made room for the point, by moving all points after the given index one index up. Read more...

deletePointAtIndex()

@fn void AbstractGraph::deletePointAtIndex(int index) Deletes the point at the given index. Deletes the point at the given index. Read more...

findX()

@fn int AbstractGraph::findX(int x) Searches for the given x coordinate. Searches for the given x coordinate. If the x coordinate is not found, the closest index is returned so that the point at the returned index has the first x value higher than the sought x coordinate (or at usedPoints if the x coordinate is higher than the x coordinate of all existing points). Read more...

xAboveOutgoing() const

No summary provided. Read more...

yAboveOutgoing() const

No summary provided. Read more...

xBelowOutgoing() const

No summary provided. Read more...

yBelowOutgoing() const

No summary provided. Read more...

xAboveIncoming() const

No summary provided. Read more...

yAboveIncoming() const

No summary provided. Read more...

xBelowIncoming() const

No summary provided. Read more...

yBelowIncoming() const

No summary provided. Read more...

assignRange()

@fn void AbstractGraph::assignRange(int newLeft, int newRight, int newTop, int newBottom) Sets the range of the graph. Sets the range of the graph. Read more...

assignWidth()

@fn virtual void AbstractGraph::assignWidth(int16_t width) Sets the width of this drawable. Sets the width of this drawable. Read more...

assignHeight()

@fn virtual void AbstractGraph::assignHeight(int16_t height) Sets the height of this drawable. Sets the height of this drawable. Read more...

References

LocationReferrerScopeText
AbstractGraph.hpp:39
class AbstractGraph : public CanvasWidget
AbstractGraph.cpp:22AbstractGraph::AbstractGraph()
AbstractGraph::AbstractGraph() :
AbstractGraph.cpp:28AbstractGraph::~AbstractGraph()
AbstractGraph::~AbstractGraph()
AbstractGraph.cpp:32AbstractGraph::widgetX() const
CWRUtil::Q5 AbstractGraph::widgetX(int x) const
AbstractGraph.cpp:38AbstractGraph::widgetY() const
CWRUtil::Q5 AbstractGraph::widgetY(int y) const
AbstractGraph.cpp:44AbstractGraph::widgetXindex() const
CWRUtil::Q5 AbstractGraph::widgetXindex(int index) const
AbstractGraph.cpp:49AbstractGraph::widgetYindex() const
CWRUtil::Q5 AbstractGraph::widgetYindex(int index) const
AbstractGraph.cpp:54AbstractGraph::setBuffer()
AbstractGraph.cpp:65AbstractGraph::setLinkedGraph()
void AbstractGraph::setLinkedGraph(AbstractGraph &other)
AbstractGraph.cpp:81AbstractGraph::setRange()
void AbstractGraph::setRange(int newLeft, int newRight, int newTop, int newBottom)
AbstractGraph.cpp:94AbstractGraph::setX()
void AbstractGraph::setX(int16_t x)
AbstractGraph.cpp:103AbstractGraph::setY()
void AbstractGraph::setY(int16_t y)
AbstractGraph.cpp:112AbstractGraph::setWidth()
void AbstractGraph::setWidth(int16_t width)
AbstractGraph.cpp:121AbstractGraph::setHeight()
void AbstractGraph::setHeight(int16_t height)
AbstractGraph.cpp:130AbstractGraph::clearGraph()
void AbstractGraph::clearGraph()
AbstractGraph.cpp:139AbstractGraph::addValue()
bool AbstractGraph::addValue(int x, int y)
AbstractGraph.cpp:185AbstractGraph::deleteValue()
bool AbstractGraph::deleteValue(int x)
AbstractGraph.cpp:206AbstractGraph::drawCanvasWidget() const
bool AbstractGraph::drawCanvasWidget(const Rect& invalidatedArea) const
AbstractGraph.cpp:267AbstractGraph::invalidateRectContainingIndices() const
void AbstractGraph::invalidateRectContainingIndices(int firstIndex, int lastIndex) const
AbstractGraph.cpp:278AbstractGraph::updateAndInvalidateCacheForLinesBetweenIndeces()
AbstractGraph.cpp:307AbstractGraph::getMinimalRect() const
Rect AbstractGraph::getMinimalRect() const
AbstractGraph.cpp:316AbstractGraph::setNumPoints()
void AbstractGraph::setNumPoints(int numPointsUsed)
AbstractGraph.cpp:325AbstractGraph::invalidateLineFromIndex()
void AbstractGraph::invalidateLineFromIndex(int index)
AbstractGraph.cpp:334AbstractGraph::insertPointAtIndex()
void AbstractGraph::insertPointAtIndex(int index)
AbstractGraph.cpp:345AbstractGraph::deletePointAtIndex()
void AbstractGraph::deletePointAtIndex(int index)
AbstractGraph.cpp:355AbstractGraph::findX()
int AbstractGraph::findX(int x)
AbstractGraph.cpp:390AbstractGraph::assignRange()
void AbstractGraph::assignRange(int newLeft, int newRight, int newTop, int newBottom)
AbstractGraph.cpp:406AbstractGraph::assignWidth()
void AbstractGraph::assignWidth(int16_t width)
AbstractGraph.cpp:416AbstractGraph::assignHeight()
void AbstractGraph::assignHeight(int16_t height)
AbstractGraph.hpp:164AbstractGraph::setLinkedGraph()::otherAbstractGraph::setLinkedGraph()
void setLinkedGraph(AbstractGraph &other);
AbstractGraph.hpp:358AbstractGraph::linkedGraphAbstractGraph
AbstractGraph *linkedGraph; ///< Graph sharing data with this graph. Updated when setting range, changing values etc.
GraphDots.cpp:23GraphDots::GraphDots()
AbstractGraph(), startAngle(0), angleStep(30)
GraphDots.hpp:39GraphDots
class GraphDots : public AbstractGraph
GraphLine.hpp:39GraphLine
class GraphLine : public AbstractGraph

Class Tree

Parent classes
Child classes
all items filtered out
AbstractGraph
all items filtered out
Variables of AbstractGraph type
AbstractGraph