00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include "cableSchema.h"
00024 #include <assert.h>
00025 #include <iostream>
00026
00027 using namespace std;
00028
00032 schema* makeCableSchema (unsigned int n)
00033 {
00034 assert(n>0);
00035 return new cableSchema(n);
00036 }
00037
00038
00042 cableSchema::cableSchema (unsigned int n)
00043 : schema (n, n, 0, n*dWire)
00044 {
00045 for (unsigned int i=0; i<n; i++) fPoint.push_back(point(0));
00046 }
00047
00048
00052 void cableSchema::place(double ox, double oy, int orientation)
00053 {
00054 beginPlace(ox, oy, orientation);
00055 if (orientation == kLeftRight) {
00056 for (unsigned int i=0; i<inputs(); i++) {
00057 fPoint[i] = point(ox, oy + dWire/2.0 + i*dWire);
00058 }
00059 } else {
00060 for (unsigned int i=0; i<inputs(); i++) {
00061 fPoint[i] = point(ox, oy + height() - dWire/2.0 - i*dWire);
00062 }
00063 }
00064 endPlace();
00065 }
00066
00067
00068
00073 void cableSchema::draw(device& dev)
00074 {
00075 }
00076
00080 point cableSchema::inputPoint(unsigned int i) const
00081 {
00082 assert(i<inputs());
00083 return fPoint[i];
00084 }
00085
00089 point cableSchema::outputPoint(unsigned int i) const
00090 {
00091 assert(i<outputs());
00092 return fPoint[i];
00093 }