Revision 26866

View differences:

branches/v2_0_0_prep/libraries/libFMap_geometries/src-test/org/gvsig/fmap/geom/primitive/ArcTest.java
33 33
import org.gvsig.fmap.geom.GeometryLibrary;
34 34
import org.gvsig.fmap.geom.GeometryLocator;
35 35
import org.gvsig.fmap.geom.GeometryManager;
36
import org.gvsig.fmap.geom.Geometry.SUBTYPES;
37
import org.gvsig.fmap.geom.Geometry.TYPES;
36 38
import org.slf4j.Logger;
37 39
import org.slf4j.LoggerFactory;
38 40

  
......
58 60
	}
59 61
	
60 62
	public void testCreateArc2D() throws InstantiationException, IllegalAccessException{
61
		Arc arc = (Arc)manager.create(Arc2D.CODE);
63
		Arc arc = (Arc)manager.create(TYPES.ARC, SUBTYPES.GEOM2D);
62 64
		GeneralPathX generalPathX = new GeneralPathX();
63 65
		Exception e = null;
64 66
		try{
......
68 70
		}
69 71
		Assert.assertTrue(e instanceof UnsupportedOperationException);
70 72
		
71
		Point center = (Point)manager.create(Point2D.CODE);
73
		Point center = (Point)manager.create(TYPES.POINT, SUBTYPES.GEOM2D);
72 74
		center.setCoordinateAt(0, 0);
73 75
		center.setCoordinateAt(1, 0);
74 76
		
75
		Point initPoint = (Point)manager.create(Point2D.CODE);
77
		Point initPoint = (Point)manager.create(TYPES.POINT, SUBTYPES.GEOM2D);
76 78
		initPoint.setCoordinateAt(0, 1);
77 79
		initPoint.setCoordinateAt(1, 1);
78 80
		
79
		Point endPoint = (Point)manager.create(Point2D.CODE);
81
		Point endPoint = (Point)manager.create(TYPES.POINT, SUBTYPES.GEOM2D);
80 82
		endPoint.setCoordinateAt(0, 0);
81 83
		endPoint.setCoordinateAt(1, 1);
82 84
		
branches/v2_0_0_prep/libraries/libFMap_geometries/src-test/org/gvsig/fmap/geom/primitive/SurfaceTest.java
36 36
import org.gvsig.fmap.geom.GeometryLibrary;
37 37
import org.gvsig.fmap.geom.GeometryLocator;
38 38
import org.gvsig.fmap.geom.GeometryManager;
39
import org.gvsig.fmap.geom.Geometry.SUBTYPES;
40
import org.gvsig.fmap.geom.Geometry.TYPES;
39 41
import org.slf4j.Logger;
40 42
import org.slf4j.LoggerFactory;
41 43

  
......
62 64
	}
63 65
	
64 66
	public void testCreateSurface2D() throws InstantiationException, IllegalAccessException{
65
		Surface surface = (Surface)manager.create(Surface2D.CODE);
67
		Surface surface = (Surface)manager.create(TYPES.SURFACE, SUBTYPES.GEOM2D);
66 68
		GeneralPathX generalPathX = new GeneralPathX();
67 69
		generalPathX.moveTo(0, 0);
68 70
		generalPathX.lineTo(1, 1);
branches/v2_0_0_prep/libraries/libFMap_geometries/src-test/org/gvsig/fmap/geom/primitive/PointTest.java
36 36
import org.gvsig.fmap.geom.GeometryLibrary;
37 37
import org.gvsig.fmap.geom.GeometryLocator;
38 38
import org.gvsig.fmap.geom.GeometryManager;
39
import org.gvsig.fmap.geom.Geometry.SUBTYPES;
40
import org.gvsig.fmap.geom.Geometry.TYPES;
39 41
import org.slf4j.Logger;
40 42
import org.slf4j.LoggerFactory;
41 43

  
......
62 64
	}
63 65
	
64 66
	public void testCreatePoint2D() throws InstantiationException, IllegalAccessException{
65
		Point point = (Point)manager.create(Point2D.CODE);
67
		Point point = (Point)manager.create(TYPES.POINT, SUBTYPES.GEOM2D);
66 68
		point.setCoordinateAt(0, 1.0);
67 69
		point.setCoordinateAt(1, 2.0);
68 70
		
......
87 89
	}
88 90
	
89 91
	public void testCreatePoint2DZ() throws InstantiationException, IllegalAccessException{
90
		Point point = (Point)manager.create(Point2DZ.CODE);
92
		Point point = (Point)manager.create(TYPES.POINT, SUBTYPES.GEOM2DZ);
91 93
		point.setCoordinateAt(0, 1.0);
92 94
		point.setCoordinateAt(1, 2.0);
93 95
		point.setCoordinateAt(2, 3.0);
branches/v2_0_0_prep/libraries/libFMap_geometries/src-test/org/gvsig/fmap/geom/primitive/SplineTest.java
33 33
import org.gvsig.fmap.geom.GeometryLibrary;
34 34
import org.gvsig.fmap.geom.GeometryLocator;
35 35
import org.gvsig.fmap.geom.GeometryManager;
36
import org.gvsig.fmap.geom.Geometry.SUBTYPES;
37
import org.gvsig.fmap.geom.Geometry.TYPES;
36 38
import org.slf4j.Logger;
37 39
import org.slf4j.LoggerFactory;
38 40

  
......
59 61
	}
60 62
	
61 63
	public void testCreateSpline2D() throws InstantiationException, IllegalAccessException{
62
		Point point1 = (Point)manager.create(Point2D.CODE);
64
		Point point1 = (Point)manager.create(TYPES.POINT, SUBTYPES.GEOM2D);
63 65
		point1.setCoordinateAt(0, 1.0);
64 66
		point1.setCoordinateAt(1, 2.0);
65 67
		
66
		Point point2 = (Point)manager.create(Point2D.CODE);
68
		Point point2 = (Point)manager.create(TYPES.POINT, SUBTYPES.GEOM2D);
67 69
		point2.setCoordinateAt(0, 4.0);
68 70
		point2.setCoordinateAt(1, 5.0);
69 71
	
70
		Curve curve = (Curve)manager.create(Spline2D.CODE);
71
		curve.addVertex(point1);
72
		curve.addVertex(point2);
72
		Spline spline = (Spline)manager.create(TYPES.SPLINE, SUBTYPES.GEOM2D);
73
		spline.addVertex(point1);
74
		spline.addVertex(point2);
73 75
		
74
		Assert.assertEquals(1.0, curve.getCoordinateAt(0, 0), 0);
75
		Assert.assertEquals(2.0, curve.getCoordinateAt(0, 1), 0);
76
		Assert.assertEquals(1.0, spline.getCoordinateAt(0, 0), 0);
77
		Assert.assertEquals(2.0, spline.getCoordinateAt(0, 1), 0);
76 78
		
77 79
	}
78 80
}
branches/v2_0_0_prep/libraries/libFMap_geometries/src-test/org/gvsig/fmap/geom/primitive/EllipticArcTest.java
33 33
import org.gvsig.fmap.geom.GeometryLibrary;
34 34
import org.gvsig.fmap.geom.GeometryLocator;
35 35
import org.gvsig.fmap.geom.GeometryManager;
36
import org.gvsig.fmap.geom.Geometry.SUBTYPES;
37
import org.gvsig.fmap.geom.Geometry.TYPES;
36 38
import org.slf4j.Logger;
37 39
import org.slf4j.LoggerFactory;
38 40

  
......
59 61
	}
60 62
	
61 63
	public void testEllipticArc2D() throws InstantiationException, IllegalAccessException{
62
		EllipticArc ellipticArc = (EllipticArc)manager.create(EllipticArc2D.CODE);
64
		EllipticArc ellipticArc = (EllipticArc)manager.create(TYPES.ELLIPTICARC, SUBTYPES.GEOM2D);
63 65
		GeneralPathX generalPathX = new GeneralPathX();
64 66
		Exception e = null;
65 67
		try{
......
69 71
		}
70 72
		Assert.assertTrue(e instanceof UnsupportedOperationException);
71 73
		
72
		Point axis1Start = (Point)manager.create(Point2D.CODE);
74
		Point axis1Start = (Point)manager.create(TYPES.POINT, SUBTYPES.GEOM2D);
73 75
		axis1Start.setCoordinateAt(0, 0);
74 76
		axis1Start.setCoordinateAt(1, 0);
75 77
		
76
		Point axix1End = (Point)manager.create(Point2D.CODE);
78
		Point axix1End = (Point)manager.create(TYPES.POINT, SUBTYPES.GEOM2D);
77 79
		axix1End.setCoordinateAt(0, 1);
78 80
		axix1End.setCoordinateAt(1, 1);
79 81
		
branches/v2_0_0_prep/libraries/libFMap_geometries/src-test/org/gvsig/fmap/geom/primitive/EllipseTest.java
33 33
import org.gvsig.fmap.geom.GeometryLibrary;
34 34
import org.gvsig.fmap.geom.GeometryLocator;
35 35
import org.gvsig.fmap.geom.GeometryManager;
36
import org.gvsig.fmap.geom.Geometry.SUBTYPES;
37
import org.gvsig.fmap.geom.Geometry.TYPES;
36 38
import org.slf4j.Logger;
37 39
import org.slf4j.LoggerFactory;
38 40

  
......
59 61
	}
60 62
	
61 63
	public void testEllipse2D() throws InstantiationException, IllegalAccessException{
62
		Ellipse ellipse = (Ellipse)manager.create(Ellipse2D.CODE);
64
		Ellipse ellipse = (Ellipse)manager.create(TYPES.ELLIPSE, SUBTYPES.GEOM2D);
63 65
		GeneralPathX generalPathX = new GeneralPathX();
64 66
		Exception e = null;
65 67
		try{
......
69 71
		}
70 72
		Assert.assertTrue(e instanceof UnsupportedOperationException);
71 73
		
72
		Point initPoint = (Point)manager.create(Point2D.CODE);
74
		Point initPoint = (Point)manager.create(TYPES.POINT, SUBTYPES.GEOM2D);
73 75
		initPoint.setCoordinateAt(0, 0);
74 76
		initPoint.setCoordinateAt(1, 0);
75 77
		
76
		Point endPoint = (Point)manager.create(Point2D.CODE);
78
		Point endPoint = (Point)manager.create(TYPES.POINT, SUBTYPES.GEOM2D);
77 79
		endPoint.setCoordinateAt(0, 1);
78 80
		endPoint.setCoordinateAt(1, 1);
79 81
		
branches/v2_0_0_prep/libraries/libFMap_geometries/src-test/org/gvsig/fmap/geom/primitive/CircleTest.java
33 33
import org.gvsig.fmap.geom.GeometryLibrary;
34 34
import org.gvsig.fmap.geom.GeometryLocator;
35 35
import org.gvsig.fmap.geom.GeometryManager;
36
import org.gvsig.fmap.geom.Geometry.SUBTYPES;
37
import org.gvsig.fmap.geom.Geometry.TYPES;
36 38
import org.slf4j.Logger;
37 39
import org.slf4j.LoggerFactory;
38 40

  
......
59 61
	}
60 62
	
61 63
	public void testCreateCircle2D() throws InstantiationException, IllegalAccessException{
62
		Circle circle = (Circle)manager.create(Circle2D.CODE);
64
		Circle circle = (Circle)manager.create(TYPES.CIRCLE, SUBTYPES.GEOM2D);
63 65
		GeneralPathX generalPathX = new GeneralPathX();
64 66
		Exception e = null;
65 67
		try{
......
69 71
		}
70 72
		Assert.assertTrue(e instanceof UnsupportedOperationException);
71 73
		
72
		Point center = (Point)manager.create(Point2D.CODE);
74
		Point center = (Point)manager.create(TYPES.POINT, SUBTYPES.GEOM2D);
73 75
		center.setCoordinateAt(0, 0);
74 76
		center.setCoordinateAt(1, 0);
75 77
		
76
		Point radious = (Point)manager.create(Point2D.CODE);
78
		Point radious = (Point)manager.create(TYPES.POINT, SUBTYPES.GEOM2D);
77 79
		radious.setCoordinateAt(0, 1);
78 80
		radious.setCoordinateAt(1, 1);
79 81
				
branches/v2_0_0_prep/libraries/libFMap_geometries/src-test/org/gvsig/fmap/geom/primitive/CurveTest.java
36 36
import org.gvsig.fmap.geom.GeometryLibrary;
37 37
import org.gvsig.fmap.geom.GeometryLocator;
38 38
import org.gvsig.fmap.geom.GeometryManager;
39
import org.gvsig.fmap.geom.Geometry.SUBTYPES;
40
import org.gvsig.fmap.geom.Geometry.TYPES;
39 41
import org.slf4j.Logger;
40 42
import org.slf4j.LoggerFactory;
41 43

  
......
62 64
	}
63 65
	
64 66
	public void testCreateCurve2D() throws InstantiationException, IllegalAccessException{
65
		Curve curve = (Curve)manager.create(Curve2D.CODE);
67
		Curve curve = (Curve)manager.create(TYPES.CURVE, SUBTYPES.GEOM2D);
66 68
		GeneralPathX generalPathX = new GeneralPathX();
67 69
		generalPathX.moveTo(0, 0);
68 70
		generalPathX.lineTo(1, 1);
......
99 101
	}
100 102
	
101 103
	public void testCreateCurve2DZ() throws InstantiationException, IllegalAccessException{
102
		Curve curve = (Curve)manager.create(Curve2DZ.CODE);
104
		Curve curve = (Curve)manager.create(TYPES.CURVE, SUBTYPES.GEOM2DZ);
103 105
		GeneralPathX generalPathX = new GeneralPathX();
104 106
		generalPathX.moveTo(0, 0);
105 107
		generalPathX.lineTo(1, 1);
branches/v2_0_0_prep/libraries/libFMap_geometries/src-test/org/gvsig/fmap/geom/GeometryManagerTest.java
2 2

  
3 3
import junit.framework.TestCase;
4 4

  
5
import org.gvsig.fmap.geom.Geometry.SUBTYPES;
6
import org.gvsig.fmap.geom.Geometry.TYPES;
5 7
import org.gvsig.fmap.geom.operation.GeometryOperation;
6 8
import org.gvsig.fmap.geom.operation.GeometryOperationContext;
7 9
import org.gvsig.fmap.geom.operation.GeometryOperationException;
......
46 48
		logger.debug("--------- testRegister() START ----------");
47 49

  
48 50
		//Point p2d = (Point) factory.createPoint2D(0,0);
49
		Point p2d = (Point) manager.create(Point2D.CODE);
51
		Point p2d = (Point) manager.create(TYPES.POINT, SUBTYPES.GEOM2D);
50 52
		p2d.setCoordinateAt(0, 0);
51 53
		p2d.setCoordinateAt(1, 0);
52 54
		
......
54 56
		java.awt.geom.Point2D pt2 = new java.awt.geom.Point2D.Float(1,1);
55 57
		java.awt.geom.Point2D pt3 = new java.awt.geom.Point2D.Float(1,0);
56 58
		//Arc2D c2d = (Arc2D) factory.createArc(pt1, pt2, pt3);
57
		Arc2D c2d = (Arc2D) manager.create(Arc2D.CODE);
59
		Arc2D c2d = (Arc2D) manager.create(TYPES.ARC, SUBTYPES.GEOM2D);
58 60

  
59 61
		GeometryType geomType1 = manager.getGeometryType(Point2D.class);
60 62
		GeometryType geomType2 = manager.getGeometryType(Arc2D.class);
......
85 87
		assertFalse("FALLO: op4 == op", op4 == op1);
86 88

  
87 89
		//Point p = (Point) factory.createPoint2D(1, 2);
88
		Point p = (Point) manager.create(Point2D.CODE);
90
		Point p = (Point) manager.create(TYPES.POINT, SUBTYPES.GEOM2D);
89 91
									
90 92
		GeometryOperationContext ctx = new GeometryOperationContext();
91 93
		ctx.setAttribute("dummy", "DummyValue");
......
98 100
			logger.error("Error, ", e);
99 101
		}
100 102

  
101
		Geometry sol = manager.create(Solid2DZ.CODE);
103
		Geometry sol = manager.create(TYPES.SOLID, SUBTYPES.GEOM2DZ);
102 104
		assertNotNull(sol);
103 105
		//logger.debug(sol);
104 106

  
......
122 124
//		java.awt.geom.Point2D p2 = new java.awt.geom.Point2D.Double(2,1);
123 125
//		java.awt.geom.Point2D p3 = new java.awt.geom.Point2D.Double(3,3);
124 126
		
125
		Point p1 = (Point)manager.create(Point2D.CODE);
127
		Point p1 = (Point)manager.create(TYPES.POINT, SUBTYPES.GEOM2D);
126 128
		p1.setCoordinateAt(0, 1);
127 129
		p1.setCoordinateAt(1, 2);	
128 130
		
129
		Point p2 = (Point)manager.create(Point2D.CODE);
131
		Point p2 = (Point)manager.create(TYPES.POINT, SUBTYPES.GEOM2D);
130 132
		p2.setCoordinateAt(0, 2);
131 133
		p2.setCoordinateAt(1, 1);
132 134
		
133
		Point p3 = (Point)manager.create(Point2D.CODE);
135
		Point p3 = (Point)manager.create(TYPES.POINT, SUBTYPES.GEOM2D);
134 136
		p3.setCoordinateAt(0, 3);
135 137
		p3.setCoordinateAt(1, 3);		
136 138
		
137 139
		//Build a curve to get the operation invoked with the registered operation.
138 140
		//Geometry curve = (Curve) factory.createArc(p1, p2, p3);
139
		Arc arc = (Arc) manager.create(Arc2D.CODE);
141
		Arc arc = (Arc) manager.create(TYPES.ARC, SUBTYPES.GEOM2D);
140 142
        arc.setPoints(p1, p2, p3);
141 143

  
142 144
		try {
......
205 207
		Geometry[] geom = new Geometry[size];
206 208
		for (int i = 0; i < size; i++) {
207 209
			//geom[i] = factory.createPoint2D(Math.log(1 - i), Math.log(i + 1));
208
			geom[i] = manager.create(Point2D.CODE);
210
			geom[i] = manager.create(TYPES.POINT, SUBTYPES.GEOM2D);
209 211
		}
210 212
		return geom;
211 213
	}
......
266 268

  
267 269
	public void testRegisterBasicGeometryType() {
268 270
		GeometryType gt = GeometryLocator.getGeometryManager()
269
		.registerGeometryType(DummyPoint2D.class, "DummyPoint2D", Geometry.TYPES.ELLIPSE | Geometry.TYPES.Z);
271
		.registerGeometryType(DummyPoint2D.class, "DummyPoint2D", TYPES.ELLIPSE,  SUBTYPES.GEOM2DZ);
270 272

  
271 273
		logger.debug(String.valueOf(gt.getType()));
272 274

  
273 275
		GeometryLocator.getGeometryManager().unregisterGeometryType(DummyPoint2D.class);
274 276

  
275 277
		gt = GeometryLocator.getGeometryManager()
276
		.registerGeometryType(DummyPoint2D.class, "DummyPoint2D", Point.CODE);
278
		.registerGeometryType(DummyPoint2D.class, "DummyPoint2D", TYPES.POINT, SUBTYPES.GEOM2D);
277 279

  
278 280
		logger.debug(String.valueOf(gt.getType()));
279 281
	}
branches/v2_0_0_prep/libraries/libFMap_geometries/src-test/org/gvsig/fmap/geom/aggregate/MultiCurveTest.java
33 33
import org.gvsig.fmap.geom.GeometryLibrary;
34 34
import org.gvsig.fmap.geom.GeometryLocator;
35 35
import org.gvsig.fmap.geom.GeometryManager;
36
import org.gvsig.fmap.geom.Geometry.SUBTYPES;
37
import org.gvsig.fmap.geom.Geometry.TYPES;
36 38
import org.gvsig.fmap.geom.primitive.Curve;
37 39
import org.gvsig.fmap.geom.primitive.Curve2D;
38 40
import org.gvsig.fmap.geom.primitive.GeneralPathX;
......
62 64
	}
63 65
	
64 66
	public void testCreateMultiCurve2D() throws InstantiationException, IllegalAccessException{
65
		Curve curve1 = (Curve)manager.create(Curve2D.CODE);
67
		Curve curve1 = (Curve)manager.create(TYPES.CURVE, SUBTYPES.GEOM2D);
66 68
		GeneralPathX generalPathX1 = new GeneralPathX();
67 69
		generalPathX1.moveTo(0, 0);
68 70
		generalPathX1.lineTo(1, 1);
69 71
		generalPathX1.lineTo(2, 1);		
70 72
		curve1.setGeneralPath(generalPathX1);	
71 73
		
72
		Curve curve2 = (Curve)manager.create(Curve2D.CODE);
74
		Curve curve2 = (Curve)manager.create(TYPES.CURVE, SUBTYPES.GEOM2D);
73 75
		GeneralPathX generalPathX2 = new GeneralPathX();
74 76
		generalPathX2.moveTo(0, 0);
75 77
		generalPathX2.lineTo(1, 1);
76 78
		generalPathX2.lineTo(2, 1);		
77 79
		curve2.setGeneralPath(generalPathX2);	
78 80
		
79
		MultiCurve multiCurve = (MultiCurve)manager.create(MultiCurve2D.CODE);
81
		MultiCurve multiCurve = (MultiCurve)manager.create(TYPES.MULTICURVE, SUBTYPES.GEOM2D);
80 82
		multiCurve.addCurve(curve1);
81 83
		multiCurve.addCurve(curve2);
82 84
				
branches/v2_0_0_prep/libraries/libFMap_geometries/src-test/org/gvsig/fmap/geom/aggregate/MultiPrimitiveTest.java
33 33
import org.gvsig.fmap.geom.GeometryLibrary;
34 34
import org.gvsig.fmap.geom.GeometryLocator;
35 35
import org.gvsig.fmap.geom.GeometryManager;
36
import org.gvsig.fmap.geom.Geometry.SUBTYPES;
37
import org.gvsig.fmap.geom.Geometry.TYPES;
36 38
import org.gvsig.fmap.geom.primitive.Curve;
37 39
import org.gvsig.fmap.geom.primitive.Curve2D;
38 40
import org.gvsig.fmap.geom.primitive.GeneralPathX;
......
66 68
	}
67 69
	
68 70
	public void testCreateMultiGeometry() throws InstantiationException, IllegalAccessException{
69
		Curve curve1 = (Curve)manager.create(Curve2D.CODE);
71
		Curve curve1 = (Curve)manager.create(TYPES.CURVE, SUBTYPES.GEOM2D);
70 72
		GeneralPathX generalPathX1 = new GeneralPathX();
71 73
		generalPathX1.moveTo(0, 0);
72 74
		generalPathX1.lineTo(1, 1);
73 75
		generalPathX1.lineTo(2, 1);		
74 76
		curve1.setGeneralPath(generalPathX1);	
75 77
		
76
		Curve curve2 = (Curve)manager.create(Curve2D.CODE);
78
		Curve curve2 = (Curve)manager.create(TYPES.CURVE, SUBTYPES.GEOM2D);
77 79
		GeneralPathX generalPathX2 = new GeneralPathX();
78 80
		generalPathX2.moveTo(0, 0);
79 81
		generalPathX2.lineTo(1, 1);
80 82
		generalPathX2.lineTo(2, 1);		
81 83
		curve2.setGeneralPath(generalPathX2);	
82 84
		
83
		Point point = (Point)manager.create(Point2D.CODE);
85
		Point point = (Point)manager.create(TYPES.POINT, SUBTYPES.GEOM2D);
84 86
		point.setCoordinateAt(0, 1.0);
85 87
		point.setCoordinateAt(1, 2.0);
86 88
		
87
		Surface surface = (Surface)manager.create(Surface2D.CODE);
89
		Surface surface = (Surface)manager.create(TYPES.SURFACE, SUBTYPES.GEOM2D);
88 90
		GeneralPathX generalPathX = new GeneralPathX();
89 91
		generalPathX.moveTo(0, 0);
90 92
		generalPathX.lineTo(1, 1);
91 93
		generalPathX.lineTo(2, 1);
92 94
		surface.setGeneralPath(generalPathX);	
93 95
		
94
		MultiPrimitive multiPrimitive = (MultiPrimitive)manager.create(BaseMultiPrimitive.CODE);
96
		MultiPrimitive multiPrimitive = (MultiPrimitive)manager.create(TYPES.AGGREGATE, SUBTYPES.GEOM2D);
95 97
		multiPrimitive.addPrimitive(curve1);
96 98
		multiPrimitive.addPrimitive(point);
97 99
		multiPrimitive.addPrimitive(surface);
branches/v2_0_0_prep/libraries/libFMap_geometries/src-test/org/gvsig/fmap/geom/aggregate/MultiSurfaceTest.java
33 33
import org.gvsig.fmap.geom.GeometryLibrary;
34 34
import org.gvsig.fmap.geom.GeometryLocator;
35 35
import org.gvsig.fmap.geom.GeometryManager;
36
import org.gvsig.fmap.geom.Geometry.SUBTYPES;
37
import org.gvsig.fmap.geom.Geometry.TYPES;
36 38
import org.gvsig.fmap.geom.primitive.GeneralPathX;
37 39
import org.gvsig.fmap.geom.primitive.Surface;
38 40
import org.gvsig.fmap.geom.primitive.Surface2D;
......
62 64
	}
63 65
	
64 66
	public void testCreateMultiSurface2D() throws InstantiationException, IllegalAccessException{
65
		Surface surface1 = (Surface)manager.create(Surface2D.CODE);		
67
		Surface surface1 = (Surface)manager.create(TYPES.SURFACE, SUBTYPES.GEOM2D);
66 68
		GeneralPathX generalPathX1 = new GeneralPathX();
67 69
		generalPathX1.moveTo(0, 0);
68 70
		generalPathX1.lineTo(1, 1);
69 71
		generalPathX1.lineTo(2, 1);		
70 72
		surface1.setGeneralPath(generalPathX1);	
71 73
		
72
		Surface surface2 = (Surface)manager.create(Surface2D.CODE);		
74
		Surface surface2 = (Surface)manager.create(TYPES.SURFACE, SUBTYPES.GEOM2D);		
73 75
		GeneralPathX generalPathX2 = new GeneralPathX();
74 76
		generalPathX2.moveTo(0, 0);
75 77
		generalPathX2.lineTo(1, 1);
76 78
		generalPathX2.lineTo(2, 1);		
77 79
		surface2.setGeneralPath(generalPathX2);	
78 80
		
79
		MultiSurface multiSurface = (MultiSurface)manager.create(MultiSurface2D.CODE);
81
		MultiSurface multiSurface = (MultiSurface)manager.create(TYPES.MULTISURFACE, SUBTYPES.GEOM2D);
80 82
		multiSurface.addSurface(surface1);
81 83
		multiSurface.addSurface(surface2);
82 84
				
branches/v2_0_0_prep/libraries/libFMap_geometries/src-test/org/gvsig/fmap/geom/aggregate/MultiPointTest.java
33 33
import org.gvsig.fmap.geom.GeometryLibrary;
34 34
import org.gvsig.fmap.geom.GeometryLocator;
35 35
import org.gvsig.fmap.geom.GeometryManager;
36
import org.gvsig.fmap.geom.Geometry.SUBTYPES;
37
import org.gvsig.fmap.geom.Geometry.TYPES;
36 38
import org.gvsig.fmap.geom.primitive.Point;
37 39
import org.gvsig.fmap.geom.primitive.Point2DZ;
38 40
import org.slf4j.Logger;
......
61 63
	}
62 64
	
63 65
	public void testCreateMultiPoint2D() throws InstantiationException, IllegalAccessException{
64
		Point point1 = (Point)manager.create(Point2DZ.CODE);
66
		Point point1 = (Point)manager.create(TYPES.POINT, SUBTYPES.GEOM2DZ);
65 67
		point1.setCoordinateAt(0, 1.0);
66 68
		point1.setCoordinateAt(1, 2.0);
67 69
		point1.setCoordinateAt(2, 3.0);
68 70
		
69
		Point point2 = (Point)manager.create(Point2DZ.CODE);
71
		Point point2 = (Point)manager.create(TYPES.POINT, SUBTYPES.GEOM2DZ);
70 72
		point2.setCoordinateAt(0, 4.0);
71 73
		point2.setCoordinateAt(1, 5.0);
72 74
		point2.setCoordinateAt(2, 6.0);
73 75
		
74
		MultiPoint multiPoint = (MultiPoint)manager.create(MultiPoint2D.CODE);
76
		MultiPoint multiPoint = (MultiPoint)manager.create(TYPES.MULTIPOINT, SUBTYPES.GEOM2D);
75 77
		multiPoint.addPoint(point1);
76 78
		multiPoint.addPoint(point2);
77 79
		
branches/v2_0_0_prep/libraries/libFMap_geometries/src/org/gvsig/fmap/geom/GeometryManager.java
188 188
	 * 			  Symbolic name for the geometry type, it can be null. If it is null then the symbolic name
189 189
	 * 		      will be the simple class name.
190 190
	 * @param type
191
	 * 			  Type of geometry. Must be a value defined in {@link Geometry.TYPES}
191
	 * Type of geometry. Must be a value defined in {@link Geometry.TYPES}
192
	 * @param subType
193
	 * SubType of geometry. Must be a value defined in {@link Geometry.SUBTYPES}
192 194
	 * @return Instance of GeometryType associated to the Geometry implementation class
193 195
	 *         geomClass
194 196
	 * @throws IllegalArgumentException
195 197
	 *             If geomClass is null or does not implement Geometry
196 198
	 */
197
	public GeometryType registerGeometryType(Class geomClass, String name, int type);
199
	public GeometryType registerGeometryType(Class geomClass, String name, int type, int subType);
198 200
		
199 201
	/**
200 202
	 * Registers a Geometry implementation as a new geometry type and returns the
......
221 223
	 * @param geomClass Geometry implementation class. It must not be null and must implement Geometry,
222 224
	 * otherwise an exception is thrown.
223 225
	 * @param type
224
	 * 
226
	 * Type of geometry. Must be a value defined in {@link Geometry.TYPES}
227
	 * @param subType
228
	 * SubType of geometry. Must be a value defined in {@link Geometry.SUBTYPES}
225 229
	 * @return Instance of GeometryType associated to the Geometry implementation class
226 230
	 * @throws IllegalArgumentException
227 231
	 *             If geomClass is null or does not implement Geometry
228 232
	 */
229
	public GeometryType registerGeometryType(Class geomClass, int type);
233
	public GeometryType registerGeometryType(Class geomClass, int type, int subType);
230 234
	
231 235
	/**
232 236
	 * Returns an instance of GeometryType given the associated Geometry implementation
......
322 326
	 * 	point.setY(1);
323 327
	 * </pre>
324 328
	 * 
325
	 * @param name
326
	 * The name of the geometry type
329
	 * @param type
330
	 * Type of geometry. Must be a value defined in {@link Geometry.TYPES}
331
	 * @param subType
332
	 * SubType of geometry. Must be a value defined in {@link Geometry.SUBTYPES}
327 333
	 * @return
328 334
	 * A instance of a geometry.
329 335
	 * @throws InstantiationException
......
333 339
	 * This exception is maybe thrown when  the application is  trying 
334 340
	 * to instantiate the geometry
335 341
	 */
336
	public Geometry create(int id) throws InstantiationException, IllegalAccessException;
342
	public Geometry create(int type, int subType) throws InstantiationException, IllegalAccessException;
337 343

  
338 344
	/**
339 345
	 * Returns an operation given the Geometry implementation class and the operation
branches/v2_0_0_prep/libraries/libFMap_geometries/src/org/gvsig/fmap/geom/aggregate/MultiCurve.java
55 55
 * @author Jorge Piera Llodr? (jorge.piera@iver.es)
56 56
 */
57 57
public interface MultiCurve extends Aggregate{
58
	public final static int CODE = TYPES.MULTICURVE;
58
	//public final static int CODE = TYPES.MULTICURVE;
59 59
	
60 60
	void addCurve(Curve curve);
61 61
}
branches/v2_0_0_prep/libraries/libFMap_geometries/src/org/gvsig/fmap/geom/aggregate/MultiSurface.java
55 55
 * @author Jorge Piera Llodr? (jorge.piera@iver.es)
56 56
 */
57 57
public interface MultiSurface extends Aggregate{
58
	public final static int CODE = TYPES.MULTISURFACE;
58
	//public final static int CODE = TYPES.MULTISURFACE;
59 59
	
60 60
	void addSurface(Surface surface);
61 61
}
branches/v2_0_0_prep/libraries/libFMap_geometries/src/org/gvsig/fmap/geom/aggregate/BaseMultiPrimitive2D.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
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 2
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
 */
22

  
23
/*
24
 * AUTHORS (In addition to CIT):
25
 * 2009 {Iver T.I.}   {Task}
26
 */
27

  
28
package org.gvsig.fmap.geom.aggregate;
29

  
30
import org.cresques.cts.IProjection;
31
import org.gvsig.fmap.geom.Geometry;
32
import org.gvsig.fmap.geom.GeometryLocator;
33
import org.gvsig.fmap.geom.Geometry.SUBTYPES;
34
import org.gvsig.fmap.geom.Geometry.TYPES;
35
import org.gvsig.fmap.geom.primitive.Primitive;
36
import org.gvsig.fmap.geom.type.GeometryType;
37

  
38
/**
39
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
40
 */
41
public class BaseMultiPrimitive2D extends BaseMultiPrimitive implements
42
MultiPrimitive {
43

  
44
	// Registramos este tipo de geometría
45
	private static GeometryType geomType = GeometryLocator.getGeometryManager()
46
	.registerGeometryType(BaseMultiPrimitive2D.class, null, TYPES.AGGREGATE, SUBTYPES.GEOM2D);
47

  
48
	/**
49
	 * Constructor without arguments. It is necessary to create
50
	 * geometries using the {@link GeometryType}{@link #create()}
51
	 * method
52
	 */
53
	public BaseMultiPrimitive2D() {
54
		super();
55
	}
56

  
57
	/**
58
	 * @param id
59
	 * @param projection
60
	 * @param geometries
61
	 */
62
	public BaseMultiPrimitive2D(String id, IProjection projection,
63
			Geometry[] geometries) {
64
		super(id, projection, geometries);
65
	}
66
	
67
	/**
68
	 * @param geometries
69
	 */
70
	public BaseMultiPrimitive2D(Geometry[] geometries) {
71
		super(geometries);		
72
	}
73

  
74
	/*
75
	 * (non-Javadoc)
76
	 *
77
	 * @see com.iver.cit.gvsig.fmap.core.IGeometry#cloneGeometry()
78
	 */
79
	public Geometry cloneGeometry() {
80
		Primitive[] aux = new Primitive[getPrimitivesNumber()];
81
		for (int i = 0; i < getPrimitivesNumber(); i++) {
82
			aux[i] = (Primitive)((Geometry)geometries.get(i)).cloneGeometry()
83
			.getInternalShape();
84
		}
85
		return new BaseMultiPrimitive2D(id, projection, aux);
86
	}
87

  
88
	/*
89
	 * (non-Javadoc)
90
	 * @see org.gvsig.fmap.geom.primitive.AbstractPrimitive#getGeometryType()
91
	 */
92
	public GeometryType getGeometryType() {
93
		return geomType;
94
	}
95
}
96

  
0 97

  
branches/v2_0_0_prep/libraries/libFMap_geometries/src/org/gvsig/fmap/geom/aggregate/MultiPoint.java
55 55
 * @author Jorge Piera Llodr? (jorge.piera@iver.es)
56 56
 */
57 57
public interface MultiPoint extends Aggregate {
58
	public final static int CODE = TYPES.MULTIPOINT;
58
	//public final static int CODE = TYPES.MULTIPOINT;
59 59
	
60 60
	void setPoints(double[] x, double[] y);
61 61
	
branches/v2_0_0_prep/libraries/libFMap_geometries/src/org/gvsig/fmap/geom/aggregate/MultiPoint2DZ.java
45 45
import org.cresques.cts.IProjection;
46 46
import org.gvsig.fmap.geom.Geometry;
47 47
import org.gvsig.fmap.geom.GeometryLocator;
48
import org.gvsig.fmap.geom.Geometry.SUBTYPES;
48 49
import org.gvsig.fmap.geom.primitive.FShape;
49 50
import org.gvsig.fmap.geom.type.GeometryType;
50 51

  
......
59 60

  
60 61
	// Registramos el tipo de geometria
61 62
	private static GeometryType geomType = GeometryLocator.getGeometryManager()
62
			.registerGeometryType(MultiPoint2DZ.class, null, MultiPoint.CODE);
63
			.registerGeometryType(MultiPoint2DZ.class, null, TYPES.MULTIPOINT, SUBTYPES.GEOM2DZ);
63 64
	
64 65
	public static int CODE = geomType.getId();
65 66

  
branches/v2_0_0_prep/libraries/libFMap_geometries/src/org/gvsig/fmap/geom/aggregate/MultiCurve2D.java
3 3
import org.cresques.cts.IProjection;
4 4
import org.gvsig.fmap.geom.Geometry;
5 5
import org.gvsig.fmap.geom.GeometryLocator;
6
import org.gvsig.fmap.geom.Geometry.SUBTYPES;
6 7
import org.gvsig.fmap.geom.primitive.Curve;
7 8
import org.gvsig.fmap.geom.primitive.Curve2D;
8 9
import org.gvsig.fmap.geom.primitive.FShape;
......
68 69
	private static final long serialVersionUID = 1L;
69 70

  
70 71
	private static GeometryType geomType = GeometryLocator.getGeometryManager()
71
			.registerGeometryType(MultiCurve2D.class, null, TYPES.MULTICURVE);
72
			.registerGeometryType(MultiCurve2D.class, null, TYPES.MULTICURVE,  SUBTYPES.GEOM2D);
72 73
	public static int CODE = geomType.getId();
73 74

  
74 75
	/**
branches/v2_0_0_prep/libraries/libFMap_geometries/src/org/gvsig/fmap/geom/aggregate/MultiSolid.java
55 55
 * @author Jorge Piera Llodr? (jorge.piera@iver.es)
56 56
 */
57 57
public interface MultiSolid extends Aggregate{
58
	public final static int CODE = TYPES.MULTISOLID;
58
	//public final static int CODE = TYPES.MULTISOLID;
59 59
	
60 60
	void addSolid(Solid solid);
61 61
}
branches/v2_0_0_prep/libraries/libFMap_geometries/src/org/gvsig/fmap/geom/aggregate/MultiSolid2DZ.java
2 2

  
3 3
import org.cresques.cts.IProjection;
4 4
import org.gvsig.fmap.geom.GeometryLocator;
5
import org.gvsig.fmap.geom.Geometry.SUBTYPES;
5 6
import org.gvsig.fmap.geom.primitive.Solid;
6 7
import org.gvsig.fmap.geom.primitive.Solid2DZ;
7 8
import org.gvsig.fmap.geom.type.GeometryType;
......
66 67
	private static final long serialVersionUID = 1L;
67 68

  
68 69
	private static GeometryType geomType = GeometryLocator.getGeometryManager()
69
			.registerGeometryType(MultiSolid2DZ.class, null, MultiSolid.CODE);
70
			.registerGeometryType(MultiSolid2DZ.class, null, MultiSolid.CODE, SUBTYPES.GEOM2DZ);
70 71
	public static int CODE = geomType.getId();
71 72

  
72 73
	/**
branches/v2_0_0_prep/libraries/libFMap_geometries/src/org/gvsig/fmap/geom/aggregate/MultiSurface2D.java
3 3
import org.cresques.cts.IProjection;
4 4
import org.gvsig.fmap.geom.Geometry;
5 5
import org.gvsig.fmap.geom.GeometryLocator;
6
import org.gvsig.fmap.geom.Geometry.SUBTYPES;
6 7
import org.gvsig.fmap.geom.primitive.FShape;
7 8
import org.gvsig.fmap.geom.primitive.Surface;
8 9
import org.gvsig.fmap.geom.primitive.Surface2D;
......
68 69
	private static final long serialVersionUID = 1L;
69 70

  
70 71
	private static GeometryType geomType = GeometryLocator.getGeometryManager()
71
			.registerGeometryType(MultiSurface2D.class, null, MultiSurface.CODE);
72
			.registerGeometryType(MultiSurface2D.class, null, TYPES.MULTISURFACE, SUBTYPES.GEOM2D);
72 73
	public static int CODE = geomType.getId();
73 74

  
74 75
	/**
branches/v2_0_0_prep/libraries/libFMap_geometries/src/org/gvsig/fmap/geom/aggregate/MultiPoint2D.java
48 48
import org.cresques.cts.IProjection;
49 49
import org.gvsig.fmap.geom.Geometry;
50 50
import org.gvsig.fmap.geom.GeometryLocator;
51
import org.gvsig.fmap.geom.Geometry.SUBTYPES;
51 52
import org.gvsig.fmap.geom.handler.AbstractHandler;
52 53
import org.gvsig.fmap.geom.primitive.DefaultEnvelope;
53 54
import org.gvsig.fmap.geom.primitive.Envelope;
......
66 67
	private static final long serialVersionUID = 1L;
67 68

  
68 69
	private static GeometryType geomType = GeometryLocator.getGeometryManager()
69
	.registerGeometryType(MultiPoint2D.class, null, MultiPoint.CODE);
70
	.registerGeometryType(MultiPoint2D.class, null, TYPES.MULTIPOINT, SUBTYPES.GEOM2D);
70 71
	public static int CODE = geomType.getId();
71 72

  
72 73
	/**
branches/v2_0_0_prep/libraries/libFMap_geometries/src/org/gvsig/fmap/geom/aggregate/BaseMultiPrimitive.java
12 12
import org.cresques.cts.IProjection;
13 13
import org.gvsig.fmap.geom.Geometry;
14 14
import org.gvsig.fmap.geom.GeometryLocator;
15
import org.gvsig.fmap.geom.Geometry.SUBTYPES;
15 16
import org.gvsig.fmap.geom.handler.Handler;
16 17
import org.gvsig.fmap.geom.primitive.AbstractPrimitive;
17 18
import org.gvsig.fmap.geom.primitive.Envelope;
......
76 77
/**
77 78
 * @author Jorge Piera Llodr? (jorge.piera@iver.es)
78 79
 */
79
public class BaseMultiPrimitive extends AbstractPrimitive implements
80
public abstract class BaseMultiPrimitive extends AbstractPrimitive implements
80 81
		MultiPrimitive {
81
	/**
82
	 * Default serial versionID
83
	 */
84
	private static final long serialVersionUID = 1L;
85

  
86
	// Registramos este tipo de geometría
87
	private static GeometryType geomType = GeometryLocator.getGeometryManager()
88
			.registerGeometryType(BaseMultiPrimitive.class, null, TYPES.AGGREGATE);
89

  
90
	public static int CODE = geomType.getId();
91

  
82
	private static final long serialVersionUID = 8023609161647736932L;
92 83
	protected ArrayList geometries = null;
93 84

  
94 85
	/**
......
127 118
		this(id, projection, null);
128 119
	}
129 120

  
130
	/*
131
	 * (non-Javadoc)
132
	 *
133
	 * @see com.iver.cit.gvsig.fmap.core.IGeometry#cloneGeometry()
134
	 */
135
	public Geometry cloneGeometry() {
136
		Primitive[] aux = new Primitive[getPrimitivesNumber()];
137
		for (int i = 0; i < getPrimitivesNumber(); i++) {
138
			aux[i] = (Primitive)((Geometry)geometries.get(i)).cloneGeometry()
139
					.getInternalShape();
140
		}
141
		return new BaseMultiPrimitive(id, projection, aux);
142
	}
143 121

  
144 122
	/*
145 123
	 * (non-Javadoc)
......
441 419
		return null;
442 420
	}
443 421

  
444
	public GeometryType getGeometryType() {
445
		return geomType;
446
	}
447

  
448 422
	public int getType() {
449 423
		return CODE;
450 424
	}
branches/v2_0_0_prep/libraries/libFMap_geometries/src/org/gvsig/fmap/geom/primitive/Curve.java
56 56
 * @author Jorge Piera Llodr? (jorge.piera@iver.es)
57 57
 */
58 58
public interface Curve extends OrientableCurve{
59
	public final static int CODE = TYPES.CURVE;
59
	//public final static int CODE = TYPES.CURVE;
60 60
	
61 61
	public void setGeneralPath(GeneralPathX generalPathX);
62 62
	
branches/v2_0_0_prep/libraries/libFMap_geometries/src/org/gvsig/fmap/geom/primitive/Arc2DZ.java
21 21
	private static final long serialVersionUID = -4622030261473894548L;
22 22

  
23 23
	private static GeometryType geomType = GeometryLocator.getGeometryManager()
24
		.registerGeometryType(Arc2DZ.class,null,TYPES.ARC | TYPES.Z);
24
		.registerGeometryType(Arc2DZ.class, null, TYPES.ARC, SUBTYPES.GEOM2DZ);
25 25
	public static int CODE = geomType.getId();
26 26

  
27 27
	private double z;
branches/v2_0_0_prep/libraries/libFMap_geometries/src/org/gvsig/fmap/geom/primitive/NullGeometry.java
49 49
import org.cresques.cts.ICoordTrans;
50 50
import org.cresques.cts.IProjection;
51 51
import org.gvsig.fmap.geom.GeometryLocator;
52
import org.gvsig.fmap.geom.Geometry.SUBTYPES;
52 53
import org.gvsig.fmap.geom.handler.Handler;
53 54
import org.gvsig.fmap.geom.type.GeometryType;
54 55

  
......
61 62
	private static final long serialVersionUID = 1L;
62 63

  
63 64
	private static GeometryType geomType = GeometryLocator.getGeometryManager()
64
			.registerGeometryType(NullGeometry.class,null,TYPES.NULL);
65
			.registerGeometryType(NullGeometry.class, null, TYPES.NULL, SUBTYPES.GEOM2D);
65 66

  
66
	public static int CODE = geomType.getType();
67
	//public static int CODE = geomType.getType();
67 68

  
68 69

  
69 70
	public NullGeometry() {
......
215 216
	}
216 217

  
217 218
	public int getType() {
218
		return CODE;
219
		return TYPES.NULL;
219 220
	}
220 221

  
221 222
	public Envelope getEnvelope() {
branches/v2_0_0_prep/libraries/libFMap_geometries/src/org/gvsig/fmap/geom/primitive/Circle2D.java
63 63
	private static final long serialVersionUID = -2709867465161215668L;
64 64

  
65 65
	private static GeometryType geomType = GeometryLocator.getGeometryManager()
66
			.registerGeometryType(Circle2D.class,null,TYPES.CIRCLE);
66
			.registerGeometryType(Circle2D.class, null, TYPES.CIRCLE, SUBTYPES.GEOM2D);
67 67

  
68 68
	public static int CODE = geomType.getId();
69 69

  
branches/v2_0_0_prep/libraries/libFMap_geometries/src/org/gvsig/fmap/geom/primitive/Spline.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
*
3
* Copyright (C) 2007-2008 Infrastructures and Transports Department
4
* of the Valencian Government (CIT)
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 2
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
*/
22

  
23
/*
24
* AUTHORS (In addition to CIT):
25
* 2009 {Iver T.I.}   {Task}
26
*/
27
 
28
package org.gvsig.fmap.geom.primitive;
29
/**
30
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
31
 */
32
public interface Spline extends Curve{
33

  
34
}
35

  
0 36

  
branches/v2_0_0_prep/libraries/libFMap_geometries/src/org/gvsig/fmap/geom/primitive/Arc2D.java
69 69
	private static final long serialVersionUID = 6416027005106924030L;
70 70

  
71 71
	private static GeometryType geomType = GeometryLocator.getGeometryManager()
72
	.registerGeometryType(Arc2D.class,null,TYPES.ARC);
72
	.registerGeometryType(Arc2D.class, null, TYPES.ARC, SUBTYPES.GEOM2D);
73 73

  
74 74
	public static int CODE = geomType.getId();
75 75

  
branches/v2_0_0_prep/libraries/libFMap_geometries/src/org/gvsig/fmap/geom/primitive/Ellipse.java
32 32
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
33 33
 */
34 34
public interface Ellipse extends Surface {
35
	public final static int CODE = TYPES.ELLIPSE;
35
	//public final static int CODE = TYPES.ELLIPSE;
36 36
	
37 37
	void setPoints(Point axis1Start, Point axis1End, double axis2Length);	
38 38
	
branches/v2_0_0_prep/libraries/libFMap_geometries/src/org/gvsig/fmap/geom/primitive/Circle.java
2 2

  
3 3

  
4 4
public interface Circle extends Surface {
5
	public final static int CODE = TYPES.CIRCLE;
5
	//public final static int CODE = TYPES.CIRCLE;
6 6
	
7 7
	void setPoints(Point center, Point radious);		
8 8
	
branches/v2_0_0_prep/libraries/libFMap_geometries/src/org/gvsig/fmap/geom/primitive/Curve2DZ.java
54 54
	private static final long serialVersionUID = 1L;
55 55

  
56 56
	private static GeometryType geomType = GeometryLocator.getGeometryManager()
57
			.registerGeometryType(Curve2DZ.class,null,TYPES.CURVE | TYPES.Z);
57
			.registerGeometryType(Curve2DZ.class, null, TYPES.CURVE, SUBTYPES.GEOM2DZ);
58 58
	public static int CODE = geomType.getId();
59 59

  
60 60
	double[] pZ = null;
branches/v2_0_0_prep/libraries/libFMap_geometries/src/org/gvsig/fmap/geom/primitive/Arc.java
2 2

  
3 3

  
4 4
public interface Arc extends Curve {
5
	public final static int CODE = TYPES.ARC;
5
	//public final static int CODE = TYPES.ARC;
6 6
	
7 7
	void setPoints(Point point1, Point point2, Point point3);
8 8
	
branches/v2_0_0_prep/libraries/libFMap_geometries/src/org/gvsig/fmap/geom/primitive/Point2DZ.java
42 42

  
43 43
import org.cresques.cts.IProjection;
44 44
import org.gvsig.fmap.geom.GeometryLocator;
45
import org.gvsig.fmap.geom.Geometry.SUBTYPES;
45 46
import org.gvsig.fmap.geom.type.GeometryType;
46 47

  
47 48
/**
......
53 54
	private static final long serialVersionUID = 1L;
54 55

  
55 56
	private static GeometryType geomType = GeometryLocator.getGeometryManager()
56
		.registerGeometryType(Point2DZ.class,null,TYPES.POINT | TYPES.Z);
57
		.registerGeometryType(Point2DZ.class, null, TYPES.POINT, SUBTYPES.GEOM2DZ);
57 58

  
58 59
	public static int CODE = geomType.getId();
59 60
	
branches/v2_0_0_prep/libraries/libFMap_geometries/src/org/gvsig/fmap/geom/primitive/Solid.java
54 54
 * @author Jorge Piera Llodr? (jorge.piera@iver.es)
55 55
 */
56 56
public interface Solid extends Primitive{
57
	public final static int CODE = TYPES.SURFACE;
57
	//public final static int CODE = TYPES.SURFACE;
58 58
	
59 59
	/** Merged from IGeometry3D
60 60
	 * Devuelve un array con el valor de todas las Zs.
branches/v2_0_0_prep/libraries/libFMap_geometries/src/org/gvsig/fmap/geom/primitive/Spline2DZ.java
7 7

  
8 8
import org.cresques.cts.IProjection;
9 9
import org.gvsig.fmap.geom.GeometryLocator;
10
import org.gvsig.fmap.geom.Geometry.SUBTYPES;
10 11
import org.gvsig.fmap.geom.type.GeometryType;
11 12

  
12 13
/**
13 14
 * @author paco
14 15
 *
15 16
 */
16
public class Spline2DZ extends Spline2D implements Curve {
17
public class Spline2DZ extends Spline2D implements Spline {
17 18

  
18 19

  
19 20
	/**
......
21 22
	 */
22 23
	private static final long serialVersionUID = 8745988712085629939L;
23 24
	private static GeometryType geomType = GeometryLocator.getGeometryManager()
24
		.registerGeometryType(Spline2DZ.class,null,TYPES.CURVE | TYPES.Z);
25
		.registerGeometryType(Spline2DZ.class, null, TYPES.SPLINE, SUBTYPES.GEOM2DZ);
25 26
	public static int CODE = geomType.getId();
26 27

  
27 28
	private double z;
branches/v2_0_0_prep/libraries/libFMap_geometries/src/org/gvsig/fmap/geom/primitive/Surface2D.java
44 44

  
45 45
import org.cresques.cts.IProjection;
46 46
import org.gvsig.fmap.geom.GeometryLocator;
47
import org.gvsig.fmap.geom.Geometry.SUBTYPES;
47 48
import org.gvsig.fmap.geom.type.GeometryType;
48 49

  
49 50
/**
......
58 59
	private GeneralPathX generalpathx;
59 60

  
60 61
	private static GeometryType geomType = GeometryLocator.getGeometryManager()
61
			.registerGeometryType(Surface2D.class,null,TYPES.SURFACE);
62
			.registerGeometryType(Surface2D.class, null, TYPES.SURFACE, SUBTYPES.GEOM2D);
62 63

  
63 64
	public static int CODE = geomType.getId();
64 65

  
branches/v2_0_0_prep/libraries/libFMap_geometries/src/org/gvsig/fmap/geom/primitive/Point2D.java
50 50
import org.cresques.cts.IProjection;
51 51
import org.gvsig.fmap.geom.DirectPosition;
52 52
import org.gvsig.fmap.geom.GeometryLocator;
53
import org.gvsig.fmap.geom.Geometry.SUBTYPES;
53 54
import org.gvsig.fmap.geom.handler.AbstractHandler;
54 55
import org.gvsig.fmap.geom.handler.FinalHandler;
55 56
import org.gvsig.fmap.geom.handler.Handler;
......
67 68
	
68 69
	/** Instancia de GeometryType obtenida al registrar esta clase */
69 70
	private static final GeometryType geomType = GeometryLocator.getGeometryManager()
70
			.registerGeometryType(Point2D.class,null,TYPES.POINT);
71
			.registerGeometryType(Point2D.class, null, TYPES.POINT, SUBTYPES.GEOM2D);
71 72

  
72 73
	public static final int CODE = geomType.getId();
73 74

  
branches/v2_0_0_prep/libraries/libFMap_geometries/src/org/gvsig/fmap/geom/primitive/Surface.java
55 55
 * @author Jorge Piera Llodr? (jorge.piera@iver.es)
56 56
 */
57 57
public interface Surface extends OrientableSurface {
58
	public final static int CODE = TYPES.SURFACE;
58
	//public final static int CODE = TYPES.SURFACE;
59 59
	
60 60
	public void setGeneralPath(GeneralPathX generalPathX);
61 61
	
branches/v2_0_0_prep/libraries/libFMap_geometries/src/org/gvsig/fmap/geom/primitive/Point.java
33 33
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
34 34
 */
35 35
public interface Point extends Primitive {
36
	public final static int CODE = TYPES.POINT;
36
	//public final static int CODE = TYPES.POINT;
37 37
	
38 38
	public DirectPosition getDirectPosition();
39 39
	
branches/v2_0_0_prep/libraries/libFMap_geometries/src/org/gvsig/fmap/geom/primitive/Solid2DZ.java
10 10
import org.cresques.cts.IProjection;
11 11
import org.gvsig.fmap.geom.Geometry;
12 12
import org.gvsig.fmap.geom.GeometryLocator;
13
import org.gvsig.fmap.geom.Geometry.SUBTYPES;
13 14
import org.gvsig.fmap.geom.handler.Handler;
14 15
import org.gvsig.fmap.geom.type.GeometryType;
15 16

  
......
73 74
	private static final long serialVersionUID = 1L;
74 75

  
75 76
	private static GeometryType geomType = GeometryLocator.getGeometryManager()
76
			.registerGeometryType(Solid2DZ.class, null, Geometry.TYPES.SOLID);
77
			.registerGeometryType(Solid2DZ.class, null, TYPES.SOLID, SUBTYPES.GEOM2DZ);
77 78

  
78 79
	public static int CODE = geomType.getId();
79 80

  
branches/v2_0_0_prep/libraries/libFMap_geometries/src/org/gvsig/fmap/geom/primitive/Primitive.java
35 35
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
36 36
 */
37 37
public interface Primitive extends Geometry {
38
	public final static int CODE = TYPES.GEOMETRY;
38
	//public final static int CODE = TYPES.GEOMETRY;
39 39
}
branches/v2_0_0_prep/libraries/libFMap_geometries/src/org/gvsig/fmap/geom/primitive/Surface2DZ.java
42 42

  
43 43
import org.cresques.cts.IProjection;
44 44
import org.gvsig.fmap.geom.GeometryLocator;
45
import org.gvsig.fmap.geom.Geometry.SUBTYPES;
45 46
import org.gvsig.fmap.geom.type.GeometryType;
46 47

  
47 48
/**
......
54 55
	private static final long serialVersionUID = 1L;
55 56

  
56 57
	private static GeometryType geomType = GeometryLocator.getGeometryManager()
57
			.registerGeometryType(Surface2DZ.class,null,TYPES.SURFACE | TYPES.Z);
58
			.registerGeometryType(Surface2DZ.class, null, TYPES.SURFACE, SUBTYPES.GEOM2D);
58 59
	public static int CODE = geomType.getId();
59 60

  
60 61
	double[] pZ = null;
branches/v2_0_0_prep/libraries/libFMap_geometries/src/org/gvsig/fmap/geom/primitive/Curve2D.java
59 59

  
60 60

  
61 61
	private static GeometryType geomType = GeometryLocator.getGeometryManager()
62
	.registerGeometryType(Curve2D.class,null,TYPES.CURVE);
62
	.registerGeometryType(Curve2D.class, null, TYPES.CURVE, SUBTYPES.GEOM2D);
63 63

  
64 64
	public static int CODE = geomType.getId();
65 65

  
branches/v2_0_0_prep/libraries/libFMap_geometries/src/org/gvsig/fmap/geom/primitive/EllipticArc2DZ.java
7 7

  
8 8
import org.cresques.cts.IProjection;
9 9
import org.gvsig.fmap.geom.GeometryLocator;
10
import org.gvsig.fmap.geom.Geometry.SUBTYPES;
10 11
import org.gvsig.fmap.geom.type.GeometryType;
11 12

  
12 13
/**
......
21 22
	private static final long serialVersionUID = -7625487589450160319L;
22 23

  
23 24
	private static GeometryType geomType = GeometryLocator.getGeometryManager()
24
		.registerGeometryType(EllipticArc2DZ.class,null,TYPES.CURVE | TYPES.Z);
25
		.registerGeometryType(EllipticArc2DZ.class, null, TYPES.ELLIPTICARC, SUBTYPES.GEOM2DZ);
25 26
	public static int CODE = geomType.getId();
26 27

  
27 28
	private double z;
branches/v2_0_0_prep/libraries/libFMap_geometries/src/org/gvsig/fmap/geom/primitive/Ellipse2DZ.java
14 14
 *
15 15
 */
16 16
public class Ellipse2DZ extends Ellipse2D implements Surface {
17

  
18
	/**
19
	 *
20
	 */
21 17
	private static final long serialVersionUID = -6678908069111004754L;
22 18

  
23 19
	private static GeometryType geomType = GeometryLocator.getGeometryManager()
24
	.registerGeometryType(Ellipse2D.class,null,TYPES.ELLIPSE | TYPES.Z);
20
	.registerGeometryType(Ellipse2D.class, null, TYPES.ELLIPSE, SUBTYPES.GEOM2DZ);
25 21
	public static int CODE = geomType.getId();
26 22

  
27 23
	private double z;
branches/v2_0_0_prep/libraries/libFMap_geometries/src/org/gvsig/fmap/geom/primitive/Spline2D.java
46 46

  
47 47
import org.cresques.cts.IProjection;
48 48
import org.gvsig.fmap.geom.GeometryLocator;
49
import org.gvsig.fmap.geom.Geometry.SUBTYPES;
49 50
import org.gvsig.fmap.geom.handler.AbstractHandler;
50 51
import org.gvsig.fmap.geom.handler.FinalHandler;
51 52
import org.gvsig.fmap.geom.handler.Handler;
......
57 58
 *
58 59
 * @author Vicente Caballero Navarro
59 60
 */
60
public class Spline2D extends Curve2D implements Curve {
61
public class Spline2D extends Curve2D implements Spline {
61 62

  
62 63
	private static final long serialVersionUID = 1L;
63 64

  
64 65
	private static GeometryType geomType = GeometryLocator.getGeometryManager()
65
	.registerGeometryType(Spline2D.class, null, TYPES.SOLID);
66
	.registerGeometryType(Spline2D.class, null, TYPES.SPLINE,  SUBTYPES.GEOM2D);
66 67
	public static int CODE = geomType.getId();
67 68

  
68 69
	private ArrayList points;
......
75 76
	public Spline2D() {
76 77
		super();
77 78
		points = new ArrayList();
79
		gp = new GeneralPathX();
78 80
	}
79 81
	/**
80 82
	 * Crea un nuevo FPolyline2D.
branches/v2_0_0_prep/libraries/libFMap_geometries/src/org/gvsig/fmap/geom/primitive/Circle2DZ.java
21 21
	private static final long serialVersionUID = 5806439460681368421L;
22 22

  
23 23
	private static GeometryType geomType = GeometryLocator.getGeometryManager()
24
	.registerGeometryType(Circle2DZ.class,null,TYPES.CIRCLE | TYPES.Z);
24
	.registerGeometryType(Circle2DZ.class, null, TYPES.CIRCLE, SUBTYPES.GEOM2DZ);
25 25
	public static int CODE = geomType.getId();
26 26

  
27 27
	private double z;
branches/v2_0_0_prep/libraries/libFMap_geometries/src/org/gvsig/fmap/geom/primitive/EllipticArc2D.java
69 69
	private static final long serialVersionUID = 2988037614443119814L;
70 70

  
71 71
	private static GeometryType geomType = GeometryLocator.getGeometryManager()
72
	.registerGeometryType(EllipticArc2D.class,null,TYPES.CURVE);
72
	.registerGeometryType(EllipticArc2D.class, null, TYPES.ELLIPTICARC, SUBTYPES.GEOM2D);
73 73

  
74 74
	public static int CODE = geomType.getId();
75 75

  
branches/v2_0_0_prep/libraries/libFMap_geometries/src/org/gvsig/fmap/geom/primitive/Ellipse2D.java
64 64
	private static final long serialVersionUID = 1L;
65 65

  
66 66
	private static GeometryType geomType = GeometryLocator.getGeometryManager()
67
			.registerGeometryType(Ellipse2D.class,null,TYPES.ELLIPSE);
67
			.registerGeometryType(Ellipse2D.class, null, TYPES.ELLIPSE, SUBTYPES.GEOM2D);
68 68
	public static int CODE = geomType.getId();
69 69

  
70 70
	private Point2D init;
branches/v2_0_0_prep/libraries/libFMap_geometries/src/org/gvsig/fmap/geom/DefaultGeometryManager.java
70 70
	 * operations associated to the class org.gvsig.fmap.geom.primitive.Point2D.
71 71
	 */
72 72
	private Map geometryTypeName = new HashMap();
73
	
74
	/**
75
	 * This attribute is used to keep the relationship between type, 
76
	 * subtype and GeometryType. The key is the type and the
77
	 * value is other Map with the GeometryTypes
78
	 */
79
	private Map geometrySubtypes = new HashMap();
73 80

  
74 81
	/**
75 82
	 * This array contains all the geometry types.
......
211 218
	 * (non-Javadoc)
212 219
	 * @see org.gvsig.fmap.geom.GeometryManager#registerGeometryType(java.lang.Class, java.lang.String, int)
213 220
	 */
214
	public GeometryType registerGeometryType(Class geomClass, String name, int type) {
215
		return registerGeometryType(geomClass, name, geometryTypeIndex++, type);
221
	public GeometryType registerGeometryType(Class geomClass, String name, int type, int subType) {
222
		return registerGeometryType(geomClass, name, geometryTypeIndex++, type, subType);
216 223
	}
217 224

  
218 225
	/**
......
245 252
	 * 			  Geometry identifier. 
246 253
	 * @param type
247 254
	 * 			  Type of geometry. Must be a value defined in {@link Geometry.TYPES}
255
	 * @param subType
256
	 * SubType of geometry. Must be a value defined in {@link Geometry.SUBTYPES}
248 257
	 * @return Instance of GeometryType associated to the Geometry implementation class
249 258
	 *         geomClass
250 259
	 * @throws IllegalArgumentException
251 260
	 *             If geomClass is null or does not implement Geometry
252 261
	 */
253
	private GeometryType registerGeometryType(Class geomClass, String name, int id, int type){
262
	private GeometryType registerGeometryType(Class geomClass, String name, int id, 
263
			int type, int subType){
254 264
		if (geomClass == null) {
255 265
			throw new IllegalArgumentException("geomClass cannot be null.");
256 266
		}
......
266 276

  
267 277
		// If it is not, register it
268 278
		if (geomType == null) {
269
			geomType = new DefaultGeometryType(geomClass, name, id, null, type);
270
			geometryTypeName.put(geomClass.getName(), geomType);
271
			geometryTypeList.add(id, geomType);			
279
			geomType = new DefaultGeometryType(geomClass, name, id, type, subType);
280
			geometryTypeName.put(geomType.getName(), geomType);
281
			geometryTypeList.add(id, geomType);
282
			Map subTypes = null;
283
			Integer key = new Integer(type);
284
			if (!geometrySubtypes.containsKey(key)){
285
				subTypes = new HashMap();
286
				geometrySubtypes.put(key, subTypes);
287
			}else{
288
				subTypes = (HashMap)geometrySubtypes.get(key);
289
			}
290
			subTypes.put(new Integer(subType), geomType);
272 291
		} else {
273 292
			// If it is already registered, throw exception
274
			throw new IllegalArgumentException("Attempt to register a geometry type that is already registered: " + geomClass.getName());
293
			geometryTypeIndex--;
294
			//throw new IllegalArgumentException("Attempt to register a geometry type that is already registered: " + geomClass.getName());
275 295
		}
276 296
		logger.debug("Class " + geomClass + " registered with name " + geomType.getName());
277 297

  
......
282 302
	 * (non-Javadoc)
283 303
	 * @see org.gvsig.fmap.geom.GeometryManager#registerGeometryType(java.lang.Class, int)
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff