An enlarged schema. More...
#include <enlargedSchema.h>
Inherits schema.
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. | |
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().
00046 : schema(s->inputs(), s->outputs(), width, s->height()), 00047 fSchema(s) 00048 { 00049 for (unsigned int i=0; i<inputs(); i++) fInputPoint.push_back(point(0)); 00050 for (unsigned int i=0; i<outputs(); i++) fOutputPoint.push_back(point(0)); 00051 }
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, schema::inputPoint(), inputPoint(), schema::inputs(), schema::outputPoint(), outputPoint(), schema::outputs(), schema::placed(), device::trait(), point::x, and point::y.
00108 { 00109 assert(placed()); 00110 00111 fSchema->draw(dev); 00112 00113 // draw enlarge input wires 00114 for (unsigned int i=0; i<inputs(); i++) { 00115 point p = inputPoint(i); 00116 point q = fSchema->inputPoint(i); 00117 dev.trait(p.x, p.y, q.x, q.y); 00118 } 00119 00120 // draw enlarge output wires 00121 for (unsigned int i=0; i<outputs(); i++) { 00122 point p = outputPoint(i); 00123 point q = fSchema->outputPoint(i); 00124 dev.trait(p.x, p.y, q.x, q.y); 00125 } 00126 }
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 draw().
00087 { 00088 assert (placed()); 00089 assert (i < inputs()); 00090 return fInputPoint[i]; 00091 }
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 draw().
00097 { 00098 assert (placed()); 00099 assert (i < outputs()); 00100 return fOutputPoint[i]; 00101 }
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.
00060 { 00061 beginPlace(ox, oy, orientation); 00062 00063 double dx = (width() - fSchema->width())/2; 00064 fSchema->place(ox+dx, oy, orientation); 00065 00066 if (orientation == kRightLeft) { 00067 dx = -dx; 00068 } 00069 00070 for (unsigned int i=0; i < inputs(); i++) { 00071 point p = fSchema->inputPoint(i); 00072 fInputPoint[i] = point(p.x-dx, p.y); 00073 } 00074 00075 for (unsigned int i=0; i < outputs(); i++) { 00076 point p = fSchema->outputPoint(i); 00077 fOutputPoint[i] = point(p.x+dx, p.y); 00078 } 00079 00080 endPlace(); 00081 }
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.