[pgsqlclient-checkins] pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/PgTypes PgLSeg.cs,1.2,1.3 P
Status: Inactive
Brought to you by:
carlosga_fb
From: <car...@us...> - 2003-10-20 21:48:17
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/PgTypes In directory sc8-pr-cvs1:/tmp/cvs-serv4688 Modified Files: PgLSeg.cs PgPath.cs PgPolygon.cs Log Message: Updated files Index: PgLSeg.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/PgTypes/PgLSeg.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PgLSeg.cs 18 Oct 2003 13:11:18 -0000 1.2 --- PgLSeg.cs 20 Oct 2003 21:39:41 -0000 1.3 *************** *** 89,93 **** { System.Text.StringBuilder b = new System.Text.StringBuilder(); ! b.AppendFormat("(({0},{1}),({2},{3}))", this.startPoint.X , this.startPoint.Y, this.endPoint.X , this.endPoint.Y); --- 89,93 ---- { System.Text.StringBuilder b = new System.Text.StringBuilder(); ! b.AppendFormat("[({0},{1}),({2},{3})]", this.startPoint.X , this.startPoint.Y, this.endPoint.X , this.endPoint.Y); Index: PgPath.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/PgTypes/PgPath.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PgPath.cs 18 Oct 2003 11:57:37 -0000 1.1 --- PgPath.cs 20 Oct 2003 21:39:41 -0000 1.2 *************** *** 23,29 **** public class PgPath { ! public PgPath() { } } } --- 23,141 ---- public class PgPath { ! #region FIELDS ! ! private PgPoint[] points; ! private bool isClosedPath; ! ! #endregion ! ! #region PROPERTIES ! ! public PgPoint[] Points ! { ! get { return points; } ! } ! ! public bool IsClosedPath ! { ! get { return isClosedPath; } ! } ! ! #endregion ! ! #region CONSTRUCTORS ! ! public PgPath(bool isClosedPath, PgPoint[] points) ! { ! this.isClosedPath = isClosedPath; ! this.points = (PgPoint[])points.Clone(); ! } ! ! #endregion ! ! #region OPERATORS ! ! public static bool operator ==(PgPath left, PgPath right) ! { ! bool equals = false; ! ! if (left.Points.Length == right.Points.Length) ! { ! equals = true; ! for (int i = 0; i < left.Points.Length; i++) ! { ! if (left.Points[i] != right.Points[i]) ! { ! equals = false; ! break; ! } ! } ! } ! ! return equals; ! } ! ! public static bool operator !=(PgPath left, PgPath right) ! { ! bool notequals = true; ! ! if (left.Points.Length == right.Points.Length) ! { ! notequals = false; ! for (int i = 0; i < left.Points.Length; i++) ! { ! if (left.Points[i] != right.Points[i]) ! { ! notequals = true; ! break; ! } ! } ! } ! ! return notequals; ! } ! ! #endregion ! ! #region OVERRIDEN_METHODS ! ! public override string ToString() { + System.Text.StringBuilder b = new System.Text.StringBuilder(); + + b.Append(this.isClosedPath ? "(" : "["); + + for (int i = 0; i < this.points.Length; i++) + { + if (b.Length > 1) + { + b.Append(","); + } + b.Append(this.points[i].ToString()); + } + + b.Append(this.isClosedPath ? ")" : "]"); + + return b.ToString(); + } + + public override int GetHashCode() + { + return base.GetHashCode(); } + + public override bool Equals(object obj) + { + if (obj is PgPath) + { + return (obj as PgPath) == this; + } + else + { + return false; + } + } + + #endregion } } Index: PgPolygon.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/PgTypes/PgPolygon.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PgPolygon.cs 18 Oct 2003 13:38:40 -0000 1.2 --- PgPolygon.cs 20 Oct 2003 21:39:41 -0000 1.3 *************** *** 97,111 **** System.Text.StringBuilder b = new System.Text.StringBuilder(); for (int i = 0; i < this.points.Length; i++) { ! if (b.Length > 0) { b.Append(","); } ! b.AppendFormat("({0},{1}),({2},{3})", ! this.points[0].X, this.points[i].Y); } ! b.AppendFormat("( {0} )", b.ToString()); return b.ToString(); --- 97,112 ---- System.Text.StringBuilder b = new System.Text.StringBuilder(); + b.Append("("); + for (int i = 0; i < this.points.Length; i++) { ! if (b.Length > 1) { b.Append(","); } ! b.Append(this.points[i].ToString()); } ! b.Append(")"); return b.ToString(); |