~jozilla/uiml.net/uiml.net-tp

« back to all changes in this revision

Viewing changes to Cassowary/ClPoint.cs

  • Committer: Jo Vermeulen
  • Date: 2007-09-05 14:26:30 UTC
  • mfrom: (249.1.16 Uiml.net)
  • Revision ID: jo.vermeulen@uhasselt.be-20070905142630-w5eafpsfntbgz0ko
Merged with Jo's main branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
  Cassowary.net: an incremental constraint solver for .NET
3
 
  (http://lumumba.uhasselt.be/jo/projects/cassowary.net/)
4
 
  
5
 
  Copyright (C) 2005  Jo Vermeulen (jo.vermeulen@uhasselt.be)
6
 
  
7
 
  This program is free software; you can redistribute it and/or
8
 
  modify it under the terms of the GNU Lesser General Public License
9
 
  as published by the Free Software Foundation; either version 2.1
10
 
  of  the License, or (at your option) any later version.
11
 
 
12
 
  This program is distributed in the hope that it will be useful,
13
 
  but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 
  GNU Lesser General Public License for more details.
16
 
 
17
 
  You should have received a copy of the GNU Lesser General Public License
18
 
  along with this program; if not, write to the Free Software
19
 
  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
20
 
*/
21
 
 
22
 
using System;
23
 
 
24
 
namespace Cassowary
25
 
{
26
 
  public class ClPoint
27
 
  {
28
 
    public ClPoint(double x, double y)
29
 
    {
30
 
      _clv_x = new ClVariable(x);
31
 
      _clv_y = new ClVariable(y);
32
 
    }
33
 
 
34
 
    public ClPoint(double x, double y, int a)
35
 
    {
36
 
      _clv_x = new ClVariable("x"+a,x);
37
 
      _clv_y = new ClVariable("y"+a,y);
38
 
    }
39
 
 
40
 
    public ClPoint(ClVariable clv_x, ClVariable clv_y)
41
 
    {
42
 
      _clv_x = clv_x;
43
 
      _clv_y = clv_y;
44
 
    }
45
 
 
46
 
    public ClVariable X
47
 
    {
48
 
      get { return _clv_x; }
49
 
      set { _clv_x = value; }
50
 
    }
51
 
 
52
 
    public ClVariable Y
53
 
    {
54
 
      get { return _clv_y; }
55
 
      set { _clv_y = value; }
56
 
    }
57
 
 
58
 
    /// <remarks>
59
 
    /// Use only before adding into the solver
60
 
    /// </remarks>
61
 
    public void SetXY(double x, double y)
62
 
    {
63
 
      _clv_x.Value = x;
64
 
      _clv_y.Value = y;
65
 
    }
66
 
 
67
 
    public void SetXY(ClVariable clv_x, ClVariable clv_y)
68
 
    {
69
 
      _clv_x = clv_x;
70
 
      _clv_y = clv_y;
71
 
    }
72
 
 
73
 
    public double XValue
74
 
    {
75
 
      get { return X.Value;  }
76
 
      set { X.Value = value; }
77
 
    }
78
 
 
79
 
    public double YValue
80
 
    {
81
 
      get { return Y.Value; }
82
 
      set { Y.Value = value; }
83
 
    } 
84
 
 
85
 
    public override string ToString()
86
 
    {
87
 
      return "(" + _clv_x.ToString() + ", " + _clv_y.ToString() + ")";
88
 
    }
89
 
 
90
 
    private ClVariable _clv_x;
91
 
    private ClVariable _clv_y;
92
 
  }
93
 
}