A simple rectangular box with a text and inputs and outputs. More...
#include <blockSchema.h>
Inherits schema.
Public Member Functions | |
virtual void | place (double x, double y, int orientation) |
Define the graphic position of the blockSchema. | |
virtual void | draw (device &dev) |
Draw the blockSchema on the device. | |
virtual point | inputPoint (unsigned int i) const |
Returns an input point. | |
virtual point | outputPoint (unsigned int i) const |
Returns an output point. | |
Friends | |
schema * | makeBlockSchema (unsigned int inputs, unsigned int outputs, const string &name, 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. |
A simple rectangular box with a text and inputs and outputs.
The constructor is private in order to make sure makeBlockSchema is used instead
Definition at line 35 of file blockSchema.h.
void blockSchema::draw | ( | device & | dev | ) | [virtual] |
Draw the blockSchema on the device.
This methos can only be called after the blockSchema have been placed
Implements schema.
Definition at line 174 of file blockSchema.cpp.
void blockSchema::place | ( | double | x, | |
double | y, | |||
int | orientation | |||
) | [virtual] |
Define the graphic position of the blockSchema.
Computes the graphic position of all the elements, in particular the inputs and outputs. This method must be called before draw(), otherwise draw is not allowed
Implements schema.
Definition at line 82 of file blockSchema.cpp.
schema* makeBlockSchema | ( | unsigned int | inputs, | |
unsigned int | outputs, | |||
const string & | name, | |||
const string & | color, | |||
const string & | link | |||
) | [friend] |
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.
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 }