代码拉取完成,页面将自动刷新
#ifndef TIKZDRAWTEMPLATES_H
#define TIKZDRAWTEMPLATES_H
#include <tikztemplates.h>
#include <statisticsextensions.h>
#include <tikzextensions.h>
#include <QString>
#include <QMap>
#include <QPoint>
#include <QColor>
#include <QPoint>
namespace draw_ext {
QString num2str(int num);
QString sanitizeString(QString input);
}
enum drawtype_t{
block=0,
vector,
grid
};
class drawElement{
public:
virtual QString render()=0;
private:
QString p_template;
};
class drawBlock : public drawElement{
public:
drawBlock();
drawBlock(QPoint start, QPoint stop, QString typeName, int value);
QString render(){return p_template;}
private:
QString p_template, p_typeName;
};
class drawVector : public drawElement{
public:
drawVector();
drawVector(QPoint start, QPoint stop, QString typeName);
QString render(){return p_template;}
private:
QString p_template;
};
class drawGrid :public drawElement{
public:
drawGrid();
drawGrid(QPoint start, QPoint stop, QString typeName);
QString render(){return p_template;}
private:
QString p_template;
};
class drawPlainVector : public drawElement{
public:
drawPlainVector();
drawPlainVector(QPoint start, QPoint stop, QString typeName);
QString render(){return p_template;}
private:
QString p_template;
};
class drawPlainBlock : public drawElement{
public:
drawPlainBlock();
drawPlainBlock(QPoint start, QPoint stop, QString typeName, int value);
QString render(){return p_template;}
private:
QString p_template, p_typeName;
};
class DrawFactory{
public:
drawElement *getElement(drawtype_t drawtype, QPoint start, QPoint stop, QString typeName, int value, bool plain)
{
typeName = draw_ext::sanitizeString(typeName);
drawElement *el = NULL;
switch(drawtype)
{
case grid:
el = new drawGrid(start, stop, typeName);
break;
case block:
{
if(plain)
el = new drawPlainBlock(start, stop, typeName, value);
else
el = new drawBlock(start, stop, typeName, value);
break;
}
case vector:
{
if(plain)
el = new drawPlainVector(start, stop, typeName);
else
el = new drawVector(start, stop, typeName);
}
break;
default:
el = NULL;
break;
}
return el;
}
};
class StatisticsTikzDrawItem{
public:
StatisticsTikzDrawItem(QString statName);
void setType(drawtype_t dtype){p_drawType = dtype;}
void setValue(int value){p_value = value;}
void setStartStop(QPoint start, QPoint stop);
void setToGrid(QPoint shift);
void setPlain(bool plain){p_plain = plain;}
drawtype_t getDrawType(){return p_drawType;}
QString render();
private:
void applyShift();
QPoint startPoint, stopPoint;
QString layerName, statTypeName;
QString stringValue;
int p_value;
int shiftX, shiftY;
drawtype_t p_drawType;
bool toGrid;
bool p_plain;
};
typedef QList<StatisticsTikzDrawItem> StatisticsTikzDrawItemList;
class StatisticsTikzDrawLayer{
public:
StatisticsTikzDrawLayer(StatisticsType statItem, bool gridb);
void addElements(StatisticsTikzDrawItem item){p_elementsList.append(item);}
void addElements(StatisticsTikzDrawItemList list);
void setGlobalSettings(TikzDrawSettings settings);
QString layer(){return p_layerName;}
QString statType(){return p_statType;}
int size(){return p_elementsList.size();}
QColor minColor(){return p_settings.minColor;}
QColor maxColor(){return p_settings.maxColor;}
int minValue(){return p_minValue;}
int maxValue(){return p_maxValue;}
bool show(){return p_render;}
drawtype_t drawType(){return p_drawType;}
QString render(QPoint shift);
TikzDrawLayerSettings settings(){return p_settings;}
private:
int p_minValue, p_maxValue;
bool p_render;
QPoint p_topLeft, p_bottomRight;
QString p_layerName, p_lineType, p_statType;
StatisticsTikzDrawItemList p_elementsList;
QString p_drawTemplate;
drawtype_t p_drawType;
TikzDrawLayerSettings p_settings;
TikzDrawSettings p_globalSettings;
};
typedef QList<StatisticsTikzDrawLayer> StatisticsTikzDraw;
#endif // TIKZDRAWTEMPLATES_H
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。