1 // NpgsqlTypes.NpgsqlTypesHelper.cs
4 // Glen Parker <glenebob@nwlink.com>
6 // Copyright (C) 2004 The Npgsql Development Team
7 // npgsql-general@gborg.postgresql.org
8 // http://gborg.postgresql.org/project/npgsql/projdisplay.php
10 // This library is free software; you can redistribute it and/or
11 // modify it under the terms of the GNU Lesser General Public
12 // License as published by the Free Software Foundation; either
13 // version 2.1 of the License, or (at your option) any later version.
15 // This library is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 // Lesser General Public License for more details.
20 // You should have received a copy of the GNU Lesser General Public
21 // License along with this library; if not, write to the Free Software
22 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 // This file provides implementations of PostgreSQL specific data types that cannot
25 // be mapped to standard .NET classes.
28 using System
.Collections
;
29 using System
.Globalization
;
34 using System
.Resources
;
41 /// Represents a PostgreSQL Point type
44 public struct NpgsqlPoint
49 public NpgsqlPoint(Single X
, Single Y
)
83 public struct NpgsqlBox
85 private NpgsqlPoint _UpperRight
;
86 private NpgsqlPoint _LowerLeft
;
88 public NpgsqlBox(NpgsqlPoint UpperRight
, NpgsqlPoint LowerLeft
)
90 _UpperRight
= UpperRight
;
91 _LowerLeft
= LowerLeft
;
95 public NpgsqlPoint UpperRight
107 public NpgsqlPoint LowerLeft
123 /// Represents a PostgreSQL Line Segment type.
125 public struct NpgsqlLSeg
127 public NpgsqlPoint Start
;
128 public NpgsqlPoint End
;
130 public NpgsqlLSeg(NpgsqlPoint Start
, NpgsqlPoint End
)
136 public override String
ToString()
138 return String
.Format("({0}, {1})", Start
, End
);
143 /// Represents a PostgreSQL Path type.
145 public struct NpgsqlPath
147 internal NpgsqlPoint
[] Points
;
149 internal Boolean IsOpen
;
151 public NpgsqlPath(NpgsqlPoint
[] Points
)
153 this.Points
= Points
;
158 { get { return Points.Length; }
}
160 public NpgsqlPoint
this [Int32 Index
]
161 { get { return Points[Index]; }
}
173 /// Represents a PostgreSQL Polygon type.
175 public struct NpgsqlPolygon
177 internal NpgsqlPoint
[] Points
;
179 public NpgsqlPolygon(NpgsqlPoint
[] Points
)
181 this.Points
= Points
;
185 { get { return Points.Length; }
}
187 public NpgsqlPoint
this [Int32 Index
]
188 { get { return Points[Index]; }
}
192 /// Represents a PostgreSQL Circle type.
194 public struct NpgsqlCircle
196 public NpgsqlPoint Center
;
197 public Double Radius
;
199 public NpgsqlCircle(NpgsqlPoint Center
, Double Radius
)
201 this.Center
= Center
;
202 this.Radius
= Radius
;
205 public override String
ToString()
207 return string.Format("({0}), {1}", Center
, Radius
);