svn-gvsig-desktop / branches / v2_0_0_prep / libraries / libFMap_geometries / src / org / gvsig / fmap / geom / primitive / impl / Point2DZ.java @ 29097
History | View | Annotate | Download (3.2 KB)
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
4 |
*
|
5 |
* This program is free software; you can redistribute it and/or
|
6 |
* modify it under the terms of the GNU General Public License
|
7 |
* as published by the Free Software Foundation; either version 2
|
8 |
* of the License, or (at your option) any later version.
|
9 |
*
|
10 |
* This program is distributed in the hope that it will be useful,
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
* GNU General Public License for more details.
|
14 |
*
|
15 |
* You should have received a copy of the GNU General Public License
|
16 |
* along with this program; if not, write to the Free Software
|
17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
18 |
*
|
19 |
* For more information, contact:
|
20 |
*
|
21 |
* Generalitat Valenciana
|
22 |
* Conselleria d'Infraestructures i Transport
|
23 |
* Av. Blasco Ib??ez, 50
|
24 |
* 46010 VALENCIA
|
25 |
* SPAIN
|
26 |
*
|
27 |
* +34 963862235
|
28 |
* gvsig@gva.es
|
29 |
* www.gvsig.gva.es
|
30 |
*
|
31 |
* or
|
32 |
*
|
33 |
* IVER T.I. S.A
|
34 |
* Salamanca 50
|
35 |
* 46005 Valencia
|
36 |
* Spain
|
37 |
*
|
38 |
* +34 963163400
|
39 |
* dac@iver.es
|
40 |
*/
|
41 |
package org.gvsig.fmap.geom.primitive.impl; |
42 |
|
43 |
import org.cresques.cts.IProjection; |
44 |
import org.gvsig.fmap.geom.Geometry; |
45 |
import org.gvsig.fmap.geom.primitive.FShape; |
46 |
import org.gvsig.fmap.geom.primitive.Point; |
47 |
import org.gvsig.fmap.geom.type.GeometryType; |
48 |
|
49 |
/**
|
50 |
* Punto 3D.
|
51 |
*
|
52 |
* @author Vicente Caballero Navarro
|
53 |
*/
|
54 |
public class Point2DZ extends Point2D implements Point{ |
55 |
private static final long serialVersionUID = 1L; |
56 |
|
57 |
/**
|
58 |
* The constructor with the GeometryType like and argument
|
59 |
* is used by the {@link GeometryType}{@link #create()}
|
60 |
* to create the geometry
|
61 |
* @param type
|
62 |
* The geometry type
|
63 |
*/
|
64 |
public Point2DZ(GeometryType geomType) {
|
65 |
super(geomType);
|
66 |
coordinates[2] = 0; |
67 |
} |
68 |
|
69 |
/**
|
70 |
* Constructor used in the {@link Geometry#cloneGeometry()} method
|
71 |
* @param id
|
72 |
* @param projection
|
73 |
* @param x
|
74 |
* @param y
|
75 |
* @param z
|
76 |
*/
|
77 |
Point2DZ(GeometryType geomType, String id, IProjection projection, double x, double y, double z) { |
78 |
super(geomType, id, projection, x, y);
|
79 |
coordinates[2] = z;
|
80 |
} |
81 |
|
82 |
public Point2DZ (double x, double y, double z) { |
83 |
super(TYPES.POINT, SUBTYPES.GEOM2DZ);
|
84 |
coordinates[0] = x;
|
85 |
coordinates[1] = y;
|
86 |
coordinates[2] = z;
|
87 |
} |
88 |
|
89 |
|
90 |
/*
|
91 |
* (non-Javadoc)
|
92 |
* @see org.gvsig.fmap.geom.primitive.impl.Point2D#getShapeType()
|
93 |
*/
|
94 |
public int getShapeType() { |
95 |
return TYPES.POINT;
|
96 |
} |
97 |
|
98 |
/*
|
99 |
* (non-Javadoc)
|
100 |
* @see org.gvsig.fmap.geom.primitive.impl.Point2D#cloneFShape()
|
101 |
*/
|
102 |
public FShape cloneFShape() {
|
103 |
return new Point2DZ(getGeometryType(), id, projection, coordinates[0], coordinates[1], coordinates[2]); |
104 |
} |
105 |
|
106 |
/*
|
107 |
* (non-Javadoc)
|
108 |
* @see org.gvsig.fmap.geom.primitive.impl.Point2D#getDimension()
|
109 |
*/
|
110 |
public int getDimension() { |
111 |
return 3; |
112 |
} |
113 |
|
114 |
/*
|
115 |
* (non-Javadoc)
|
116 |
* @see org.gvsig.fmap.geom.primitive.impl.Point2D#equals(java.lang.Object)
|
117 |
*/
|
118 |
public boolean equals(Object other) { |
119 |
if (!super.equals(other)) { |
120 |
return false; |
121 |
} |
122 |
|
123 |
Point2DZ pother = (Point2DZ) other; |
124 |
if (Math.abs(this.coordinates[2] - pother.coordinates[2]) > 0.0000001) { |
125 |
return false; |
126 |
} |
127 |
return true; |
128 |
} |
129 |
} |