svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.compat.cdc / org.gvsig.fmap.geometry / org.gvsig.fmap.geometry.impl / src / main / java / org / gvsig / fmap / geom / aggregate / impl / MultiPoint2DZ.java @ 40559
History | View | Annotate | Download (2.57 KB)
1 |
/**
|
---|---|
2 |
* gvSIG. Desktop Geographic Information System.
|
3 |
*
|
4 |
* Copyright (C) 2007-2013 gvSIG Association.
|
5 |
*
|
6 |
* This program is free software; you can redistribute it and/or
|
7 |
* modify it under the terms of the GNU General Public License
|
8 |
* as published by the Free Software Foundation; either version 3
|
9 |
* of the License, or (at your option) any later version.
|
10 |
*
|
11 |
* This program is distributed in the hope that it will be useful,
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
* GNU General Public License for more details.
|
15 |
*
|
16 |
* You should have received a copy of the GNU General Public License
|
17 |
* along with this program; if not, write to the Free Software
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19 |
* MA 02110-1301, USA.
|
20 |
*
|
21 |
* For any additional information, do not hesitate to contact us
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com.
|
23 |
*/
|
24 |
package org.gvsig.fmap.geom.aggregate.impl; |
25 |
|
26 |
import java.awt.geom.Point2D; |
27 |
|
28 |
import org.cresques.cts.IProjection; |
29 |
import org.gvsig.fmap.geom.Geometry; |
30 |
import org.gvsig.fmap.geom.aggregate.MultiPoint; |
31 |
import org.gvsig.fmap.geom.type.GeometryType; |
32 |
|
33 |
/**
|
34 |
* Multipunto 3D.
|
35 |
*
|
36 |
* @author Vicente Caballero Navarro
|
37 |
*/
|
38 |
public class MultiPoint2DZ extends MultiPoint2D implements MultiPoint { |
39 |
private static final long serialVersionUID = -2905029760276555041L; |
40 |
double[] z = null; |
41 |
|
42 |
/**
|
43 |
* The constructor with the GeometryType like and argument
|
44 |
* is used by the {@link GeometryType}{@link #create()}
|
45 |
* to create the geometry
|
46 |
* @param type
|
47 |
* The geometry type
|
48 |
*/
|
49 |
public MultiPoint2DZ(GeometryType geometryType) {
|
50 |
super(geometryType);
|
51 |
} |
52 |
|
53 |
/**
|
54 |
*
|
55 |
* @param id
|
56 |
* @param projection
|
57 |
* @param x
|
58 |
* @param y
|
59 |
* @param z
|
60 |
*/
|
61 |
MultiPoint2DZ(GeometryType geometryType, String id, IProjection projection, double[] x, |
62 |
double[] y, double[] z) { |
63 |
super(geometryType, id, projection, x, y);
|
64 |
this.z = z;
|
65 |
} |
66 |
|
67 |
/*
|
68 |
* (non-Javadoc)
|
69 |
*
|
70 |
* @see com.iver.cit.gvsig.fmap.core.IGeometry#cloneGeometry()
|
71 |
*/
|
72 |
public Geometry cloneGeometry() {
|
73 |
double[] x = new double[getPrimitivesNumber()]; |
74 |
double[] y = new double[getPrimitivesNumber()]; |
75 |
for (int i = 0; i < getPrimitivesNumber(); i++) { |
76 |
Point2D p = ((Geometry)geometries.get(i)).getHandlers(Geometry.SELECTHANDLER)[0] |
77 |
.getPoint(); |
78 |
|
79 |
x[i] = p.getX(); |
80 |
y[i] = p.getY(); |
81 |
} |
82 |
return new MultiPoint2DZ(geometryType, id, projection, x, y, (double[]) z.clone()); |
83 |
} |
84 |
|
85 |
/**
|
86 |
* Devuelve un array con todos los valores de Z.
|
87 |
*
|
88 |
* @return Array de Zs.
|
89 |
*/
|
90 |
public double[] getZs() { |
91 |
return z;
|
92 |
} |
93 |
} |