0c784d0ee1ce9fc1a34b7a450cdfb5d013cff101
[Faustine.git] / interpretor / preprocessor / faust-0.9.47mr3 / compiler / draw / schema / cutSchema.cpp
1 /************************************************************************
2 ************************************************************************
3 FAUST compiler
4 Copyright (C) 2003-2004 GRAME, Centre National de Creation Musicale
5 ---------------------------------------------------------------------
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 ************************************************************************
20 ************************************************************************/
21
22
23 #include "cutSchema.h"
24 #include <assert.h>
25
26 using namespace std;
27
28
29
30 /**
31 * Creates a new Cut schema.
32 */
33 schema* makeCutSchema ()
34 {
35 return new cutSchema();
36 }
37
38
39 /**
40 * A Cut is represented by a small black dot. It has 1 input
41 * and no outputs. It has a 0 width and a 1 wire height. The
42 * constructor is private in order to enforce the usage of
43 * makeCutSchema.
44 */
45 cutSchema::cutSchema ()
46 : schema (1, 0, 0, dWire/100.0), fPoint(0,0)
47 {}
48
49
50 /**
51 * The input point is placed in the middle
52 */
53 void cutSchema::place(double ox, double oy, int orientation)
54 {
55 beginPlace(ox, oy, orientation);
56 fPoint = point(ox, oy + height()*0.5); //, -1);
57 endPlace();
58 }
59
60
61 /**
62 * A cut is represented by a small black dot
63 */
64 void cutSchema::draw(device& dev)
65 {
66 //dev.rond(fPoint.x, fPoint.y, dWire/8.0);
67 }
68
69 void cutSchema::collectTraits(collector& c)
70 {}
71
72 /**
73 * By definition a Cut has only one input point
74 */
75 point cutSchema::inputPoint(unsigned int i) const
76 {
77 assert(i==0);
78 return fPoint;
79 }
80
81 /**
82 * By definition a Cut has no output point
83 */
84 point cutSchema::outputPoint(unsigned int) const
85 {
86 assert(false);
87 return point(-1,-1);
88 }
89
90