class PlotSymbol
Class representing a symbol that can be drawn to Plot. It consists of common properties (size, colors, ...) and a virtual Paint(Draw&) routine, which defines how to draw the symbol. PlotSymbol itself is equal to empty symbol (i.e. it doesn't paint anything) and serves as a base class for any other symbol.
static template <class T> void Register(const String& name)
Registers this class into the internal list of all types of symbols as name.
static void Unregister(const String& name)
Removes symbol previously registered as name from the internal list symbols.
static String TypeName(int i)
Returns name of the ith item on the symbol list.
static int TypeIndex(const String& name)
Looks up position of symbol name in internal list.
static int GetCount()
Returns number of registered symbols.
static PlotSymbol* Create(int i)
Returns a new symbol of ith type in the internal list.
static Vector<String> GetTypes()
Returns a vector with names of all registered symbols.
int GetType()const
Returns an position of this type of symbol in the internal list of symbols.
PlotSymbol* Copy()const
Returns new instance of symbol of same type as this.
void Paint(Painter& sw,Pointf pos)const
Paints symbol on canvas sw at position pos.
unsigned GetHashValue()const
Returns hash of this symbol. Hash value should change only when any of the internal properties changes, that is when it is necessary to repaint the symbol in caches.
String ToString()const
Returns string containing values of the internal properties. Intended for debugging purposes.
virtual void PaintOp(Painter& sw)const
Function determining how will the symbol be painted. This is usually the only function overridden in inherited classes. PaintOp should always respect the internal properties, that is draw the symbol with specified colors and fitting into rectangle given by size (with symbols center in the center of this rect).
PlotSymbol& SetSize(Sizef size)
PlotSymbol& SetSize(double cx,double cy)
Sets size of the symbol in pixels.
PlotSymbol& SetColor(RGBA color)
Sets color of the symbol.
PlotSymbol& SetFrameColor(RGBA color)
Sets color of the symbols frame.
PlotSymbol& SetThickness(double thickness)
Sets thickness of the symbols lines in pixels.
Sizef GetSize()const
Returns the current size of the symbol in pixels.
RGBA GetColor()const
Returns the current color of the symbol.
RGBA GetFrameColor()const
Returns the current color of the symbols frame in pixels.
double GetThickness()const
Returns the current thickness of the symbols lines in pixels.
PlotSymbol()
Constructs a symbol with default properties.
PlotSymbol(Sizef size,RGBA color,RGBA frame,double thickness)
Constructs a symbol with given properties.
template <class T>
class WithPlotSymbol : public PlotSymbol
Helper template to create inherited symbols. All it does is that it sets the T::PaintOp() to be used as the painting routines whenever the symbol has to be painted. It does not register the symbol.
These symbols are available by default:
struct Cross : public WithPlotSymbol<Cross>
Cross
struct XCross : public WithPlotSymbol<XCross>
Diagonal cross
struct Circle : public WithPlotSymbol<Circle>
Circle
struct Square : public WithPlotSymbol<Square>
Square
struct Star : public WithPlotSymbol<Star>
Star
|