Revision 29097 branches/v2_0_0_prep/libraries/libFMap_geometries/src/org/gvsig/fmap/geom/primitive/impl/Point2DZ.java

View differences:

Point2DZ.java
41 41
package org.gvsig.fmap.geom.primitive.impl;
42 42

  
43 43
import org.cresques.cts.IProjection;
44
import org.gvsig.fmap.geom.GeometryLocator;
45
import org.gvsig.fmap.geom.Geometry.SUBTYPES;
46
import org.gvsig.fmap.geom.Geometry.TYPES;
44
import org.gvsig.fmap.geom.Geometry;
47 45
import org.gvsig.fmap.geom.primitive.FShape;
48 46
import org.gvsig.fmap.geom.primitive.Point;
49 47
import org.gvsig.fmap.geom.type.GeometryType;
......
56 54
public class Point2DZ extends Point2D implements Point{
57 55
	private static final long serialVersionUID = 1L;
58 56

  
59
	private static GeometryType geomType = GeometryLocator.getGeometryManager()
60
		.registerGeometryType(Point2DZ.class, "Point2DZ", TYPES.POINT, SUBTYPES.GEOM2DZ);
61

  
62 57
	/**
63
	 * Constructor without arguments. It is necessary to create
64
	 * geometries using the {@link GeometryType}{@link #create()}
65
	 * method
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
66 63
	 */
67
	public Point2DZ() {
68
		super();
64
	public Point2DZ(GeometryType geomType) {
65
		super(geomType);
69 66
		coordinates[2] = 0;
70 67
	}
71 68

  
72 69
	/**
73
	 * Crea un nuevo FPoint3D.
74
	 *
75
	 * @param x Coordenada x.
76
	 * @param y Coordenada y.
77
	 * @param z Coordenada z.
70
	 * Constructor used in the {@link Geometry#cloneGeometry()} method
71
	 * @param id
72
	 * @param projection
73
	 * @param x
74
	 * @param y
75
	 * @param z
78 76
	 */
79
	public Point2DZ(String id, IProjection projection, double x, double y, double z) {
80
		super(id, projection, x, y);
77
	Point2DZ(GeometryType geomType, String id, IProjection projection, double x, double y, double z) {
78
		super(geomType, id, projection, x, y);
81 79
		coordinates[2] = z;
82 80
	}
83

  
84
	public Point2DZ(double x, double y, double z) {
85
		this(null, null, x, y, z);
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;
86 87
	}
87 88

  
89

  
88 90
	/*
89 91
	 * (non-Javadoc)
90 92
	 * @see org.gvsig.fmap.geom.primitive.impl.Point2D#getShapeType()
......
98 100
	 * @see org.gvsig.fmap.geom.primitive.impl.Point2D#cloneFShape()
99 101
	 */
100 102
	public FShape cloneFShape() {
101
		return new Point2DZ(id, projection, coordinates[0], coordinates[1], coordinates[2]);
103
		return new Point2DZ(getGeometryType(), id, projection, coordinates[0], coordinates[1], coordinates[2]);
102 104
	}
103 105

  
104 106
	/*
......
111 113

  
112 114
	/*
113 115
	 * (non-Javadoc)
114
	 * @see org.gvsig.fmap.geom.primitive.impl.Point2D#getGeometryType()
115
	 */
116
	public GeometryType getGeometryType() {
117
		return geomType;
118
	}
119

  
120
	/*
121
	 * (non-Javadoc)
122 116
	 * @see org.gvsig.fmap.geom.primitive.impl.Point2D#equals(java.lang.Object)
123 117
	 */
124 118
	public boolean equals(Object other) {

Also available in: Unified diff