Commit b4603f17 authored by BRAMAS Berenger's avatar BRAMAS Berenger

make a rank at the upper left of the rect

parent 279a35e3
......@@ -71,7 +71,7 @@ public:
fclose(fsvg);
}
void addRect(const int inX, const int inY, const int inWidth, const int inHeight, const int inLevel = 0){
void addRect(const int inX, const int inY, const int inWidth, const int inHeight, const int inLevel = 0, const int rank = -1){
if(int(colors.size()) <= inLevel){
for(int idxColor = int(colors.size()) ; idxColor <= inLevel ; ++idxColor){
colors.push_back(std::tuple<int, int, int>(255*drand48(),255*drand48(),255*drand48()));
......@@ -84,11 +84,18 @@ public:
int(inHeight*pixelperunknown),
std::get<0>(colors[inLevel]),std::get<1>(colors[inLevel]),std::get<2>(colors[inLevel]));
if(rank != -1){
fprintf(fsvg, "<text x=\"%d\" y=\"%d\" fill=\"black\" font-size=\"55\">%d</text>\n",
int(margin + inX*pixelperunknown) + 55,
int(margin + inY*pixelperunknown) + 55,
rank);
}
rectCounter += 1;
}
template <class... T>
void addRectWithLegend(const int inX, const int inY, const int inWidth, const int inHeight, int inLevel = -1){
void addRectWithLegend(const int inX, const int inY, const int inWidth, const int inHeight, int inLevel = -1, const int rank = -1){
if(int(colors.size()) <= inLevel){
for(int idxColor = int(colors.size()) ; idxColor <= inLevel ; ++idxColor){
colors.push_back(std::tuple<int, int, int>(255*drand48(),255*drand48(),255*drand48()));
......@@ -113,6 +120,13 @@ public:
fprintf(fsvg, "/>\n");
if(rank != -1){
fprintf(fsvg, "<text x=\"%d\" y=\"%d\" fill=\"black\" font-size=\"55\">%d</text>\n",
int(margin + inX*pixelperunknown) + 55,
int(margin + inY*pixelperunknown) + 55,
rank);
}
rectCounter += 1;
}
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment