1 module cassowary.Point;
2 
3 import std.conv;
4 import cassowary.Variable;
5 
6 class ClPoint
7 {
8 	this(double x, double y)
9 	{
10 		_clv_x = new ClVariable(x);
11 		_clv_y = new ClVariable(y);
12 	}
13 
14 	this(double x, double y, int a)
15 	{
16 		_clv_x = new ClVariable("x" ~ a.to!string(), x);
17 		_clv_y = new ClVariable("y" ~ a.to!string(), y);
18 	}
19 
20 	this(ClVariable clv_x, ClVariable clv_y)
21 	{
22 		_clv_x = clv_x;
23 		_clv_y = clv_y;
24 	}
25 
26 	ClVariable X()
27 	{
28 		return _clv_x;
29 	}
30 
31 	ClVariable Y()
32 	{
33 		return _clv_y;
34 	}
35 
36 	// use only before adding into the solver
37 	void SetXY(double x, double y)
38 	{
39 		_clv_x.set_value(x);
40 		_clv_y.set_value(y);
41 	}
42 
43 	void SetXY(ClVariable clv_x, ClVariable clv_y)
44 	{
45 		_clv_x = clv_x;
46 		_clv_y = clv_y;
47 	}
48 
49 	double Xvalue()
50 	{
51 		return X().value();
52 	}
53 
54 	double Yvalue()
55 	{
56 		return Y().value();
57 	}
58 
59 	override string toString()
60 	{
61 		return "(" ~ _clv_x.toString() ~ ", " ~ _clv_y.toString() ~ ")";
62 	}
63 
64 	private ClVariable _clv_x;
65 	private ClVariable _clv_y;
66 }