svn-gvsig-desktop / branches / v2_0_0_prep / libraries / libFMap_geometries / src / org / gvsig / fmap / geom / aggregate / MultiPoint2DZ.java @ 26866
History | View | Annotate | Download (3.21 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.aggregate; |
42 |
|
43 |
import java.awt.geom.Point2D; |
44 |
|
45 |
import org.cresques.cts.IProjection; |
46 |
import org.gvsig.fmap.geom.Geometry; |
47 |
import org.gvsig.fmap.geom.GeometryLocator; |
48 |
import org.gvsig.fmap.geom.Geometry.SUBTYPES; |
49 |
import org.gvsig.fmap.geom.primitive.FShape; |
50 |
import org.gvsig.fmap.geom.type.GeometryType; |
51 |
|
52 |
/**
|
53 |
* Multipunto 3D.
|
54 |
*
|
55 |
* @author Vicente Caballero Navarro
|
56 |
*/
|
57 |
public class MultiPoint2DZ extends MultiPoint2D implements MultiPoint { |
58 |
|
59 |
private static final long serialVersionUID = 1L; |
60 |
|
61 |
// Registramos el tipo de geometria
|
62 |
private static GeometryType geomType = GeometryLocator.getGeometryManager() |
63 |
.registerGeometryType(MultiPoint2DZ.class, null, TYPES.MULTIPOINT, SUBTYPES.GEOM2DZ);
|
64 |
|
65 |
public static int CODE = geomType.getId(); |
66 |
|
67 |
double[] z = null; |
68 |
|
69 |
/**
|
70 |
* Constructor without arguments. It is necessary to create
|
71 |
* geometries using the {@link GeometryType}{@link #create()}
|
72 |
* method
|
73 |
*/
|
74 |
public MultiPoint2DZ() {
|
75 |
super();
|
76 |
} |
77 |
|
78 |
/**
|
79 |
* Crea un nuevo Multipoint3D.
|
80 |
*
|
81 |
* @param x
|
82 |
* Array de Xs.
|
83 |
* @param y
|
84 |
* Array de Ys.
|
85 |
* @param z
|
86 |
* Array de Zs.
|
87 |
*/
|
88 |
public MultiPoint2DZ(String id, IProjection projection, double[] x, |
89 |
double[] y, double[] z) { |
90 |
super(id, projection, x, y);
|
91 |
this.z = z;
|
92 |
} |
93 |
|
94 |
/*
|
95 |
* (non-Javadoc)
|
96 |
*
|
97 |
* @see com.iver.cit.gvsig.fmap.core.IGeometry#cloneGeometry()
|
98 |
*/
|
99 |
public Geometry cloneGeometry() {
|
100 |
double[] x = new double[getPrimitivesNumber()]; |
101 |
double[] y = new double[getPrimitivesNumber()]; |
102 |
for (int i = 0; i < getPrimitivesNumber(); i++) { |
103 |
Point2D p = ((Geometry)geometries.get(i)).getHandlers(Geometry.SELECTHANDLER)[0] |
104 |
.getPoint(); |
105 |
|
106 |
x[i] = p.getX(); |
107 |
y[i] = p.getY(); |
108 |
} |
109 |
return new MultiPoint2DZ(id, projection, x, y, (double[]) z.clone()); |
110 |
} |
111 |
|
112 |
/**
|
113 |
* Devuelve un array con todos los valores de Z.
|
114 |
*
|
115 |
* @return Array de Zs.
|
116 |
*/
|
117 |
public double[] getZs() { |
118 |
return z;
|
119 |
} |
120 |
|
121 |
/**
|
122 |
* @see org.gvsig.fmap.geom.Geometry#getShapeType()
|
123 |
*/
|
124 |
public int getShapeType() { |
125 |
return FShape.MULTIPOINT | FShape.Z;
|
126 |
} |
127 |
|
128 |
} |