Mercurial > postarc
comparison Postarc/Postarc/Feature/Point.cs @ 0:1aca3d413885 tip
Initial import of Postarc
author | Christian Lins <christian.lins@intevation.de> |
---|---|
date | Fri, 05 Oct 2012 23:55:06 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:1aca3d413885 |
---|---|
1 /* | |
2 * Postarc | |
3 * | |
4 * Author: | |
5 * Christian Lins <christian.lins@intevation.de> | |
6 * | |
7 * Copyright: | |
8 * Copyright (C) 2012 Intevation GmbH <http://www.intevation.de/> | |
9 * | |
10 * This program is free software: you can redistribute it and/or modify | |
11 * it under the terms of the GNU Lesser General Public License as published by | |
12 * the Free Software Foundation, either version 3 of the License, or | |
13 * (at your option) any later version. | |
14 * | |
15 * This program 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 | |
18 * GNU General Public License for more details. | |
19 * | |
20 * You should have received a copy of the GNU Lesser General Public License | |
21 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
22 */ | |
23 | |
24 using System; | |
25 using System.Collections.Generic; | |
26 using System.Linq; | |
27 using System.Text; | |
28 using ESRI.ArcGIS.Geometry; | |
29 using NpgsqlTypes; | |
30 using System.Globalization; | |
31 using ESRI.ArcGIS.Geodatabase; | |
32 using System.Diagnostics; | |
33 using ESRI.ArcGIS.esriSystem; | |
34 | |
35 namespace Postarc.Feature | |
36 { | |
37 public class Point : | |
38 IWKTGeometry, | |
39 IGeometryDef, | |
40 IPoint, | |
41 IGeometry, | |
42 IGeometry2, | |
43 IGeometry3, | |
44 IGeometry4, | |
45 IGeometry5, | |
46 IClone, | |
47 IConstructPoint, | |
48 IConstructPoint2 | |
49 { | |
50 protected PointClass point = new PointClass(); | |
51 | |
52 public double X | |
53 { | |
54 get | |
55 { | |
56 return this.point.X; | |
57 } | |
58 set | |
59 { | |
60 this.point.X = value; | |
61 } | |
62 } | |
63 | |
64 public double Y | |
65 { | |
66 get | |
67 { | |
68 return this.point.Y; | |
69 } | |
70 set | |
71 { | |
72 this.point.Y = Y; | |
73 } | |
74 } | |
75 | |
76 public double Z | |
77 { | |
78 get | |
79 { | |
80 return point.Z; | |
81 } | |
82 set | |
83 { | |
84 this.point.Z = value; | |
85 } | |
86 } | |
87 | |
88 public Point() | |
89 { | |
90 this.point.SpatialReference = FeatureLayer.CreateGeographicSpatialReference(); | |
91 this.point.PutCoords(0, 0); | |
92 } | |
93 | |
94 public Point(IPoint point) | |
95 { | |
96 this.point.SpatialReference = point.SpatialReference; | |
97 this.point.PutCoords(point.X, point.Y); | |
98 } | |
99 | |
100 /// <summary> | |
101 /// Compares X, Y, M, Z, ID (in order) of this point with | |
102 /// otherPoint's respective values. | |
103 /// </summary> | |
104 /// <param name="otherPoint"></param> | |
105 /// <returns> | |
106 /// 0 if equal, 1 if this point is greater, -1 if smaller | |
107 /// </returns> | |
108 public int Compare(IPoint otherPoint) | |
109 { | |
110 return this.point.Compare(otherPoint); | |
111 } | |
112 | |
113 public void ConstrainAngle(double constraintAngle, IPoint anchor, bool allowOpposite) | |
114 { | |
115 this.point.ConstrainAngle(constraintAngle, anchor, allowOpposite); | |
116 } | |
117 | |
118 public void ConstrainDistance(double constraintRadius, IPoint anchor) | |
119 { | |
120 this.point.ConstrainDistance(constraintRadius, anchor); | |
121 } | |
122 | |
123 public esriGeometryDimension Dimension | |
124 { | |
125 get | |
126 { | |
127 // A point has no dimension | |
128 return this.point.Dimension; | |
129 } | |
130 } | |
131 | |
132 /// <summary> | |
133 /// Creates and returns an envelope of this point. | |
134 /// </summary> | |
135 public IEnvelope Envelope | |
136 { | |
137 get | |
138 { | |
139 return this.point.Envelope; | |
140 } | |
141 } | |
142 | |
143 public void GeoNormalize() | |
144 { | |
145 this.point.GeoNormalize(); | |
146 } | |
147 | |
148 public void GeoNormalizeFromLongitude(double longitude) | |
149 { | |
150 this.point.GeoNormalizeFromLongitude(longitude); | |
151 } | |
152 | |
153 public esriGeometryType GeometryType | |
154 { | |
155 get | |
156 { | |
157 return esriGeometryType.esriGeometryPoint; | |
158 } | |
159 } | |
160 | |
161 public int ID | |
162 { | |
163 get | |
164 { | |
165 return this.point.ID; | |
166 } | |
167 set | |
168 { | |
169 this.point.ID = value; | |
170 } | |
171 } | |
172 | |
173 public bool IsEmpty | |
174 { | |
175 get | |
176 { | |
177 return this.point.IsEmpty; | |
178 } | |
179 } | |
180 | |
181 public double M | |
182 { | |
183 get | |
184 { | |
185 return this.point.M; | |
186 } | |
187 set | |
188 { | |
189 this.point.M = value; | |
190 } | |
191 } | |
192 | |
193 public void Project(ISpatialReference newReferenceSystem) | |
194 { | |
195 this.point.Project(newReferenceSystem); | |
196 } | |
197 | |
198 public void PutCoords(double X, double Y) | |
199 { | |
200 this.point.X = X; | |
201 this.point.Y = Y; | |
202 } | |
203 | |
204 public void QueryCoords(out double X, out double Y) | |
205 { | |
206 X = this.X; | |
207 Y = this.Y; | |
208 } | |
209 | |
210 public void SetEmpty() | |
211 { | |
212 this.point.X = 0; | |
213 this.point.Y = 0; | |
214 } | |
215 | |
216 public void SnapToSpatialReference() | |
217 { | |
218 this.point.SnapToSpatialReference(); | |
219 } | |
220 | |
221 public ISpatialReference SpatialReference | |
222 { | |
223 get | |
224 { | |
225 return this.point.SpatialReference; | |
226 } | |
227 set | |
228 { | |
229 Debug.WriteLine("Point::SpatialReference::set"); | |
230 this.point.SpatialReference = value; | |
231 } | |
232 } | |
233 | |
234 public double get_VertexAttribute(esriGeometryAttributes attributeType) | |
235 { | |
236 return this.point.get_VertexAttribute(attributeType); | |
237 } | |
238 | |
239 public void set_VertexAttribute(esriGeometryAttributes attributeType, double attributeValue) | |
240 { | |
241 this.point.set_VertexAttribute(attributeType, attributeValue); | |
242 } | |
243 | |
244 public string GetWKT() | |
245 { | |
246 StringBuilder wkt = new StringBuilder(); | |
247 wkt.Append("POINT("); | |
248 wkt.Append(X.ToString("r", CultureInfo.InvariantCulture)); | |
249 wkt.Append(" "); | |
250 wkt.Append(Y.ToString("r", CultureInfo.InvariantCulture)); | |
251 wkt.Append(")"); | |
252 return wkt.ToString(); | |
253 } | |
254 | |
255 public int AvgNumPoints | |
256 { | |
257 get | |
258 { | |
259 return 1; | |
260 } | |
261 } | |
262 | |
263 public int GridCount | |
264 { | |
265 get | |
266 { | |
267 return 0; | |
268 } | |
269 } | |
270 | |
271 public bool HasM | |
272 { | |
273 get | |
274 { | |
275 return false; | |
276 } | |
277 } | |
278 | |
279 public bool HasZ | |
280 { | |
281 get | |
282 { | |
283 return false; | |
284 } | |
285 } | |
286 | |
287 public double get_GridSize(int index) | |
288 { | |
289 return 0; | |
290 } | |
291 | |
292 | |
293 public void SetWKT(string wkt) | |
294 { | |
295 wkt = wkt.Split(new char[] { '(', ')' })[1]; | |
296 string[] wkts = wkt.Split(' '); | |
297 X = double.Parse(wkts[0]); | |
298 Y = double.Parse(wkts[1]); | |
299 } | |
300 | |
301 | |
302 public void QueryEnvelope(IEnvelope outEnvelope) | |
303 { | |
304 this.point.QueryEnvelope(outEnvelope); | |
305 } | |
306 | |
307 public IPoint CentroidEx | |
308 { | |
309 get { throw new NotImplementedException(); } | |
310 } | |
311 | |
312 public bool Changed | |
313 { | |
314 get | |
315 { | |
316 throw new NotImplementedException(); | |
317 } | |
318 set | |
319 { | |
320 throw new NotImplementedException(); | |
321 } | |
322 } | |
323 | |
324 public void Project5(ISpatialReference newSpatialReference, int ProjectionHint) | |
325 { | |
326 throw new NotImplementedException(); | |
327 } | |
328 | |
329 public void ProjectEx(ISpatialReference newReferenceSystem, esriTransformDirection direction, IGeoTransformation GeoTransformation, bool bAngularDensify, double maxSegmentLength, double maxDeviation) | |
330 { | |
331 throw new NotImplementedException(); | |
332 } | |
333 | |
334 public void ProjectEx5(ISpatialReference newReferenceSystem, esriTransformDirection direction, ITransformation transformation, bool bAngularDensify, double maxSegmentLength, double maxDeviation, int ProjectionHint) | |
335 { | |
336 throw new NotImplementedException(); | |
337 } | |
338 | |
339 public void QueryWKSEnvelope(out ESRI.ArcGIS.esriSystem.WKSEnvelope e) | |
340 { | |
341 throw new NotImplementedException(); | |
342 } | |
343 | |
344 public void Assign(IClone src) | |
345 { | |
346 throw new NotImplementedException(); | |
347 } | |
348 | |
349 public IClone Clone() | |
350 { | |
351 throw new NotImplementedException(); | |
352 } | |
353 | |
354 public bool IsEqual(IClone other) | |
355 { | |
356 throw new NotImplementedException(); | |
357 } | |
358 | |
359 public bool IsIdentical(IClone other) | |
360 { | |
361 throw new NotImplementedException(); | |
362 } | |
363 | |
364 public void ConstructAlong(ICurve curve, esriSegmentExtension extension, double distance, bool asRatio) | |
365 { | |
366 throw new NotImplementedException(); | |
367 } | |
368 | |
369 public void ConstructAngleBisector(IPoint from, IPoint through, IPoint to, double distance, bool useAcuteAngle) | |
370 { | |
371 throw new NotImplementedException(); | |
372 } | |
373 | |
374 public void ConstructAngleDistance(IPoint p, double inAngle, double distance) | |
375 { | |
376 throw new NotImplementedException(); | |
377 } | |
378 | |
379 public void ConstructAngleIntersection(IPoint p1, double angle1, IPoint p2, double angle2) | |
380 { | |
381 throw new NotImplementedException(); | |
382 } | |
383 | |
384 public void ConstructAverage(IPointCollection Points, esriGeometryAttributes attributeType) | |
385 { | |
386 throw new NotImplementedException(); | |
387 } | |
388 | |
389 public void ConstructDeflection(ILine baseLine, double distance, double inAngle) | |
390 { | |
391 throw new NotImplementedException(); | |
392 } | |
393 | |
394 public void ConstructDeflectionIntersection(ILine baseLine, double startAngle, double endAngle, bool OnRightSide) | |
395 { | |
396 throw new NotImplementedException(); | |
397 } | |
398 | |
399 public void ConstructOffset(ICurve curve, esriSegmentExtension extension, double distance, bool asRatio, double Offset) | |
400 { | |
401 throw new NotImplementedException(); | |
402 } | |
403 | |
404 public void ConstructParallel(ISegment Segment, esriSegmentExtension extension, IPoint start, double distance) | |
405 { | |
406 throw new NotImplementedException(); | |
407 } | |
408 | |
409 public void ConstructPerpendicular(ISegment @base, esriSegmentExtension extension, IPoint p, double distance, bool bUseLineOrientation) | |
410 { | |
411 throw new NotImplementedException(); | |
412 } | |
413 | |
414 public void ConstructThreePointResection(IPoint point1, double angleP1P2, IPoint point2, double angleP2P3, IPoint point3, out double arcAngle) | |
415 { | |
416 throw new NotImplementedException(); | |
417 } | |
418 } | |
419 } |