|
FAUST compiler
0.9.9.6b8
|
An enlarged schema. More...
#include <enlargedSchema.h>


Public Member Functions | |
| enlargedSchema (schema *s, double width) | |
| Put additional space left and right of a schema so that the result has a certain width. | |
| virtual void | place (double x, double y, int orientation) |
| Define the graphic position of the schema. | |
| virtual void | draw (device &dev) |
| Draw the enlarged schema. | |
| virtual point | inputPoint (unsigned int i) const |
| Returns an input point. | |
| virtual point | outputPoint (unsigned int i) const |
| Returns an output point. | |
| virtual void | collectTraits (collector &c) |
| Draw the enlarged schema. | |
Private Attributes | |
| schema * | fSchema |
| vector< point > | fInputPoint |
| vector< point > | fOutputPoint |
An enlarged schema.
Definition at line 35 of file enlargedSchema.h.
| enlargedSchema::enlargedSchema | ( | schema * | s, |
| double | width | ||
| ) |
Put additional space left and right of a schema so that the result has a certain width.
The wires are prolonged accordingly.
Definition at line 45 of file enlargedSchema.cpp.
References fInputPoint, fOutputPoint, schema::inputs(), and schema::outputs().
: schema(s->inputs(), s->outputs(), width, s->height()), fSchema(s) { for (unsigned int i=0; i<inputs(); i++) fInputPoint.push_back(point(0,0)); for (unsigned int i=0; i<outputs(); i++) fOutputPoint.push_back(point(0,0)); }

| void enlargedSchema::collectTraits | ( | collector & | c | ) | [virtual] |
Draw the enlarged schema.
This methos can only be called after the block have been placed
Implements schema.
Definition at line 133 of file enlargedSchema.cpp.
References collector::addTrait(), schema::collectTraits(), fSchema, inputPoint(), schema::inputPoint(), schema::inputs(), outputPoint(), schema::outputPoint(), schema::outputs(), and schema::placed().
{
assert(placed());
fSchema->collectTraits(c);
// draw enlarge input wires
for (unsigned int i=0; i<inputs(); i++) {
point p = inputPoint(i);
point q = fSchema->inputPoint(i);
c.addTrait(trait(p,q)); // in->out direction
}
// draw enlarge output wires
for (unsigned int i=0; i<outputs(); i++) {
point q = fSchema->outputPoint(i);
point p = outputPoint(i);
c.addTrait(trait(q,p)); // in->out direction
}
}

| void enlargedSchema::draw | ( | device & | dev | ) | [virtual] |
Draw the enlarged schema.
This methos can only be called after the block have been placed
Implements schema.
Definition at line 107 of file enlargedSchema.cpp.
References schema::draw(), fSchema, inputPoint(), schema::inputPoint(), schema::inputs(), outputPoint(), schema::outputPoint(), schema::outputs(), schema::placed(), device::trait(), point::x, and point::y.
{
assert(placed());
fSchema->draw(dev);
#if 0
// draw enlarge input wires
for (unsigned int i=0; i<inputs(); i++) {
point p = inputPoint(i);
point q = fSchema->inputPoint(i);
if ( (p.z>=0) && (q.z>=0) ) dev.trait(p.x, p.y, q.x, q.y);
}
// draw enlarge output wires
for (unsigned int i=0; i<outputs(); i++) {
point p = outputPoint(i);
point q = fSchema->outputPoint(i);
if ( (p.z>=0) && (q.z>=0) ) dev.trait(p.x, p.y, q.x, q.y);
}
#endif
}

| point enlargedSchema::inputPoint | ( | unsigned int | i | ) | const [virtual] |
Returns an input point.
Implements schema.
Definition at line 86 of file enlargedSchema.cpp.
References fInputPoint, schema::inputs(), and schema::placed().
Referenced by collectTraits(), and draw().
{
assert (placed());
assert (i < inputs());
return fInputPoint[i];
}


| point enlargedSchema::outputPoint | ( | unsigned int | i | ) | const [virtual] |
Returns an output point.
Implements schema.
Definition at line 96 of file enlargedSchema.cpp.
References fOutputPoint, schema::outputs(), and schema::placed().
Referenced by collectTraits(), and draw().
{
assert (placed());
assert (i < outputs());
return fOutputPoint[i];
}


| void enlargedSchema::place | ( | double | ox, |
| double | oy, | ||
| int | orientation | ||
| ) | [virtual] |
Define the graphic position of the schema.
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 59 of file enlargedSchema.cpp.
References schema::beginPlace(), schema::endPlace(), fInputPoint, fOutputPoint, fSchema, schema::inputPoint(), schema::inputs(), kRightLeft, schema::outputPoint(), schema::outputs(), schema::place(), schema::width(), point::x, and point::y.
{
beginPlace(ox, oy, orientation);
double dx = (width() - fSchema->width())/2;
fSchema->place(ox+dx, oy, orientation);
if (orientation == kRightLeft) {
dx = -dx;
}
for (unsigned int i=0; i < inputs(); i++) {
point p = fSchema->inputPoint(i);
fInputPoint[i] = point(p.x-dx, p.y); //, p.z);
}
for (unsigned int i=0; i < outputs(); i++) {
point p = fSchema->outputPoint(i);
fOutputPoint[i] = point(p.x+dx, p.y); //, p.z);
}
endPlace();
}

vector<point> enlargedSchema::fInputPoint [private] |
Definition at line 38 of file enlargedSchema.h.
Referenced by enlargedSchema(), inputPoint(), and place().
vector<point> enlargedSchema::fOutputPoint [private] |
Definition at line 39 of file enlargedSchema.h.
Referenced by enlargedSchema(), outputPoint(), and place().
schema* enlargedSchema::fSchema [private] |
Definition at line 37 of file enlargedSchema.h.
Referenced by collectTraits(), draw(), and place().
1.8.0