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 / primitive / impl / Curve2DZ.java @ 40559
History | View | Annotate | Download (2.86 KB)
1 | 40559 | jjdelcerro | /**
|
---|---|---|---|
2 | * gvSIG. Desktop Geographic Information System.
|
||
3 | 40435 | jjdelcerro | *
|
4 | 40559 | jjdelcerro | * Copyright (C) 2007-2013 gvSIG Association.
|
5 | 40435 | jjdelcerro | *
|
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 | 40559 | jjdelcerro | * as published by the Free Software Foundation; either version 3
|
9 | 40435 | jjdelcerro | * 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 | 40559 | jjdelcerro | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19 | * MA 02110-1301, USA.
|
||
20 | 40435 | jjdelcerro | *
|
21 | 40559 | jjdelcerro | * For any additional information, do not hesitate to contact us
|
22 | * at info AT gvsig.com, or visit our website www.gvsig.com.
|
||
23 | 40435 | jjdelcerro | */
|
24 | package org.gvsig.fmap.geom.primitive.impl; |
||
25 | |||
26 | import org.cresques.cts.IProjection; |
||
27 | |||
28 | import org.gvsig.fmap.geom.Geometry; |
||
29 | import org.gvsig.fmap.geom.primitive.Curve; |
||
30 | import org.gvsig.fmap.geom.primitive.FShape; |
||
31 | import org.gvsig.fmap.geom.primitive.GeneralPathX; |
||
32 | import org.gvsig.fmap.geom.type.GeometryType; |
||
33 | |||
34 | /**
|
||
35 | * Polilinea 3D.
|
||
36 | *
|
||
37 | * @author Vicente Caballero Navarro
|
||
38 | */
|
||
39 | public class Curve2DZ extends Curve2D implements Curve { |
||
40 | private static final long serialVersionUID = 3431077088722464314L; |
||
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 Curve2DZ(GeometryType geometryType) {
|
||
50 | super(geometryType);
|
||
51 | } |
||
52 | |||
53 | /**
|
||
54 | * Constructor used in the {@link Geometry#cloneGeometry()} method
|
||
55 | * @param id
|
||
56 | * @param projection
|
||
57 | * @param gpx
|
||
58 | * @param pZ
|
||
59 | */
|
||
60 | Curve2DZ(GeometryType geometryType, String id, IProjection projection, GeneralPathX gpx) {
|
||
61 | super(geometryType, id, projection, gpx);
|
||
62 | } |
||
63 | |||
64 | /*
|
||
65 | * (non-Javadoc)
|
||
66 | * @see org.gvsig.fmap.geom.primitive.impl.Curve2D#getShapeType()
|
||
67 | */
|
||
68 | public int getShapeType() { |
||
69 | return TYPES.CURVE;
|
||
70 | } |
||
71 | |||
72 | /*
|
||
73 | * (non-Javadoc)
|
||
74 | * @see org.gvsig.fmap.geom.primitive.impl.Curve2D#cloneFShape()
|
||
75 | */
|
||
76 | public FShape cloneFShape() {
|
||
77 | return new Curve2DZ(getGeometryType(), id, projection, (GeneralPathX) gp.clone()); |
||
78 | } |
||
79 | |||
80 | public double getCoordinateAt(int index, int dimension) { |
||
81 | if (index > gp.getNumCoords()) {
|
||
82 | throw new ArrayIndexOutOfBoundsException(); |
||
83 | } |
||
84 | double[] coords = gp.getPointAt(index).getCoordinates(); |
||
85 | if(dimension < coords.length)
|
||
86 | return gp.getPointAt(index).getCoordinateAt(dimension);
|
||
87 | return 0D; |
||
88 | } |
||
89 | |||
90 | public int getDimension() { |
||
91 | return 3; |
||
92 | } |
||
93 | } |