#include "blockSchema.h"
#include "device.h"
#include <vector>
#include <string>
#include <assert.h>
Go to the source code of this file.
Functions | |
static double | quantize (int n) |
schema * | makeBlockSchema (unsigned int inputs, unsigned int outputs, const string &text, const string &color, const string &link) |
Build a simple colored blockSchema with a certain number of inputs and outputs, a text to be displayed, and an optional link. |
schema* makeBlockSchema | ( | unsigned int | inputs, | |
unsigned int | outputs, | |||
const string & | text, | |||
const string & | color, | |||
const string & | link | |||
) |
Build a simple colored blockSchema with a certain number of inputs and outputs, a text to be displayed, and an optional link.
Computes the size of the box according to the length of the text and the maximum number of ports.
Definition at line 40 of file blockSchema.cpp.
References dHorz, dVert, dWire, max(), and quantize().
Referenced by generateBargraphSchema(), generateDiagramSchema(), generateInputSlotSchema(), generateInsideSchema(), generateOutputSlotSchema(), and generateUserInterfaceSchema().
00045 { 00046 // determine the optimal size of the box 00047 double minimal = 3*dWire; 00048 double w = 2*dHorz + max( minimal, quantize(text.size()) ); 00049 double h = 2*dVert + max( minimal, max(inputs, outputs) * dWire ); 00050 00051 return new blockSchema(inputs, outputs, w, h, text, color, link); 00052 }
static double quantize | ( | int | n | ) | [static] |
Definition at line 28 of file blockSchema.cpp.
References dLetter.
Referenced by makeBlockSchema().
00029 { 00030 int q = 3; 00031 return dLetter * (q *((n+q-1)/q)); 00032 }