-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFlattenerFilterElement.cs
65 lines (55 loc) · 1.92 KB
/
FlattenerFilterElement.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
using System;
using System.Collections.Generic;
using System.Text;
using MetaphysicsIndustries.Epiphany;
using MetaphysicsIndustries.Acuity;
using System.Drawing;
using MetaphysicsIndustries.Crystalline;
using MetaphysicsIndustries.Utilities;
namespace MetaphysicsIndustries.Amethyst
{
[Serializable]
public class FlattenerFilterElement : MatrixFilterElement
{
public FlattenerFilterElement()
: base(new FlattenerFilterNode(), new SizeV(100, 80))
{
}
public new FlattenerFilterNode Node
{
get { return (FlattenerFilterNode)base.Node; }
}
protected override void InitTerminals()
{
base.InitTerminals();
TerminalsByConnection[Node.Input].Position = Height / 2;
TerminalsByConnection[Node.Width].Side = BoxOrientation.Up;
TerminalsByConnection[Node.Width].DisplayText = "w";
TerminalsByConnection[Node.Width].Position = Width / 2;
}
[Serializable]
public class FlattenerFilterNode : MatrixFilterNode
{
public FlattenerFilterNode()
: base("Flattener")
{
}
private InputConnection<int> _width = new InputConnection<int>("Width");
public InputConnection<int> Width
{
get { return _width; }
}
protected override void InitConnections()
{
base.InitConnections();
InputConnectionBases.Add(Width);
}
public override void Execute(Dictionary<InputConnectionBase, object> inputs, Dictionary<OutputConnectionBase, object> outputs)
{
int w = (int)inputs[Width];
Filter = new FlattenerMatrixFilter(w);
base.Execute(inputs, outputs);
}
}
}
}