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 / Circle2DZ.java @ 40435
History | View | Annotate | Download (1.77 KB)
1 | 40435 | jjdelcerro | /**
|
---|---|---|---|
2 | *
|
||
3 | */
|
||
4 | package org.gvsig.fmap.geom.primitive.impl; |
||
5 | |||
6 | import java.awt.geom.Point2D; |
||
7 | |||
8 | import org.cresques.cts.IProjection; |
||
9 | import org.gvsig.fmap.geom.Geometry; |
||
10 | import org.gvsig.fmap.geom.primitive.Circle; |
||
11 | import org.gvsig.fmap.geom.primitive.GeneralPathX; |
||
12 | import org.gvsig.fmap.geom.type.GeometryType; |
||
13 | |||
14 | /**
|
||
15 | * @author paco
|
||
16 | *
|
||
17 | */
|
||
18 | public class Circle2DZ extends Circle2D implements Circle { |
||
19 | private static final long serialVersionUID = 5806439460681368421L; |
||
20 | private double z; |
||
21 | |||
22 | /**
|
||
23 | * The constructor with the GeometryType like and argument
|
||
24 | * is used by the {@link GeometryType}{@link #create()}
|
||
25 | * to create the geometry
|
||
26 | * @param type
|
||
27 | * The geometry type
|
||
28 | */
|
||
29 | public Circle2DZ(GeometryType geometryType) {
|
||
30 | super(geometryType);
|
||
31 | } |
||
32 | |||
33 | /**
|
||
34 | * Constructor used in the {@link Geometry#cloneGeometry()} method
|
||
35 | * @param id
|
||
36 | * @param projection
|
||
37 | * @param gpx
|
||
38 | * @param c
|
||
39 | * @param r
|
||
40 | * @param z
|
||
41 | */
|
||
42 | Circle2DZ(GeometryType geometryType, String id, IProjection projection, GeneralPathX gpx, Point2D c, double r, double z) { |
||
43 | super(geometryType, id, projection, gpx, c, r);
|
||
44 | this.z = z;
|
||
45 | } |
||
46 | |||
47 | /* (non-Javadoc)
|
||
48 | * @see org.gvsig.fmap.geom.primitive.Circle2D#setCoordinateAt(int, int, double)
|
||
49 | */
|
||
50 | public void setCoordinateAt(int index, int dimension, double value) { |
||
51 | if (dimension == 2){ |
||
52 | z = value; |
||
53 | }else{
|
||
54 | super.setCoordinateAt(index, dimension, value);
|
||
55 | } |
||
56 | } |
||
57 | |||
58 | public double getCoordinateAt(int index, int dimension) { |
||
59 | if (index > gp.getNumCoords()) {
|
||
60 | throw new ArrayIndexOutOfBoundsException(); |
||
61 | } |
||
62 | double[] coords = gp.getPointAt(index).getCoordinates(); |
||
63 | if(dimension < coords.length)
|
||
64 | return gp.getPointAt(index).getCoordinateAt(dimension);
|
||
65 | return 0D; |
||
66 | } |
||
67 | |||
68 | public int getDimension() { |
||
69 | return 3; |
||
70 | } |
||
71 | } |