A topSchema is a schema surrounded by a dashed rectangle with a label on the top left. More...
#include <topSchema.h>
Inherits schema.
Public Member Functions | |
virtual void | place (double ox, double oy, 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 |
Top schema has no input. | |
virtual point | outputPoint (unsigned int i) const |
Top schema has no output. | |
Private Member Functions | |
topSchema (schema *s1, double margin, const string &text, const string &link) | |
A topSchema is a schema surrounded by a dashed rectangle with a label on the top left. | |
Private Attributes | |
schema * | fSchema |
double | fMargin |
string | fText |
string | fLink |
vector< point > | fInputPoint |
vector< point > | fOutputPoint |
Friends | |
schema * | makeTopSchema (schema *s1, double margin, const string &text, const string &link) |
Creates a new top schema. |
A topSchema is a schema surrounded by a dashed rectangle with a label on the top left.
The rectangle is placed at half the margin parameter. Arrows are added to all the outputs
Definition at line 34 of file topSchema.h.
topSchema::topSchema | ( | schema * | s, | |
double | margin, | |||
const string & | text, | |||
const string & | link | |||
) | [private] |
A topSchema is a schema surrounded by a dashed rectangle with a label on the top left.
The rectangle is placed at half the margin parameter. Arrows are added to the outputs. The constructor is made private to enforce the usage of makeTopSchema.
Definition at line 45 of file topSchema.cpp.
void topSchema::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 92 of file topSchema.cpp.
References schema::draw(), device::fleche(), fLink, fMargin, fSchema, fText, schema::height(), device::label(), schema::orientation(), schema::outputPoint(), schema::outputs(), schema::placed(), device::rect(), schema::width(), point::x, schema::x(), point::y, and schema::y().
00093 { 00094 assert(placed()); 00095 00096 // draw a background white rectangle 00097 dev.rect(x(), y(), width()-1, height()-1, "#ffffff", fLink.c_str()); 00098 00099 // draw the label 00100 dev.label(x()+fMargin, y()+fMargin/2, fText.c_str()); 00101 00102 fSchema->draw(dev); 00103 00104 // draw arrows at output points of schema 00105 for (unsigned int i=0; i<fSchema->outputs(); i++) { 00106 point p = fSchema->outputPoint(i); 00107 dev.fleche(p.x, p.y, 0, orientation()); 00108 } 00109 }
point topSchema::inputPoint | ( | unsigned int | i | ) | const [virtual] |
Top schema has no input.
Implements schema.
Definition at line 71 of file topSchema.cpp.
References schema::inputs(), and schema::placed().
point topSchema::outputPoint | ( | unsigned int | i | ) | const [virtual] |
Top schema has no output.
Implements schema.
Definition at line 81 of file topSchema.cpp.
References schema::outputs(), and schema::placed().
void topSchema::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 60 of file topSchema.cpp.
References schema::beginPlace(), schema::endPlace(), fMargin, fSchema, and schema::place().
00061 { 00062 beginPlace(ox, oy, orientation); 00063 00064 fSchema->place(ox+fMargin, oy+fMargin, orientation); 00065 endPlace(); 00066 }
schema* makeTopSchema | ( | schema * | s1, | |
double | margin, | |||
const string & | text, | |||
const string & | link | |||
) | [friend] |
Creates a new top schema.
Definition at line 33 of file topSchema.cpp.
00034 { 00035 return new topSchema (makeDecorateSchema(s, margin/2, text), margin/2, "", link); 00036 }
vector<point> topSchema::fInputPoint [private] |
Definition at line 40 of file topSchema.h.
string topSchema::fLink [private] |
Definition at line 39 of file topSchema.h.
Referenced by draw().
double topSchema::fMargin [private] |
Definition at line 37 of file topSchema.h.
vector<point> topSchema::fOutputPoint [private] |
Definition at line 41 of file topSchema.h.
schema* topSchema::fSchema [private] |
Definition at line 36 of file topSchema.h.
string topSchema::fText [private] |
Definition at line 38 of file topSchema.h.
Referenced by draw().