blockSchema Class Reference

A simple rectangular box with a text and inputs and outputs. More...

#include <blockSchema.h>

Inherits schema.

Collaboration diagram for blockSchema:
Collaboration graph
[legend]

List of all members.

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

schemamakeBlockSchema (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.

Detailed Description

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.


Member Function Documentation

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.

00175 {
00176     assert(placed());
00177 
00178     drawRectangle(dev);
00179     drawText(dev);
00180     drawOrientationMark(dev);
00181     drawInputWires(dev);
00182     drawOutputWires(dev);
00183 }

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.

00083 {
00084     beginPlace(x, y, orientation);
00085 
00086     placeInputPoints();
00087     placeOutputPoints();
00088 
00089     endPlace();
00090 }


Friends And Related Function Documentation

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 }


The documentation for this class was generated from the following files:

Generated on 1 Feb 2010 for FAUST compiler by  doxygen 1.6.1