Revision 20961

View differences:

branches/v2_0_0_prep/libraries/libFMap_geometries/src-test/org/gvsig/fmap/geom/GeometryManagerTest.java
3 3

  
4 4
import junit.framework.TestCase;
5 5

  
6
import org.apache.log4j.Appender;
7 6
import org.apache.log4j.ConsoleAppender;
8
import org.apache.log4j.FileAppender;
9
import org.apache.log4j.Layout;
10 7
import org.apache.log4j.Logger;
11 8
import org.apache.log4j.SimpleLayout;
12
import org.gvsig.fmap.geom.GeometryManager;
13 9
import org.gvsig.fmap.geom.operation.GeometryOperationContext;
14 10
import org.gvsig.fmap.geom.operation.println.PrintlnPoint2D;
15 11
import org.gvsig.fmap.geom.primitive.Point;
......
75 71
		ctx.setAttribute("dummy", "DummyValue");
76 72
		
77 73
		try {
78
			p.invokeOperation(PrintlnPoint2D.OPERATION_PRINTLN, ctx);
74
			p.invokeOperation(PrintlnPoint2D.OPERATION_INDEX, ctx);
79 75
		} catch (Exception e) {
80 76
			logger.error("Error, ", e);
81 77
		}
branches/v2_0_0_prep/libraries/libFMap_geometries/src/org/gvsig/fmap/geom/aggregate/BaseMultiPrimitive.java
6 6
import java.awt.geom.PathIterator;
7 7
import java.awt.geom.Point2D;
8 8
import java.awt.geom.Rectangle2D;
9
import java.io.IOException;
10 9

  
11 10
import org.cresques.cts.ICoordTrans;
12 11
import org.cresques.cts.IProjection;
13
import org.geotools.data.postgis.attributeio.WKBEncoder;
14 12
import org.gvsig.fmap.geom.Geometry;
15 13
import org.gvsig.fmap.geom.GeometryManager;
16 14
import org.gvsig.fmap.geom.handler.Handler;
......
371 369
	/*
372 370
	 * (non-Javadoc)
373 371
	 * 
374
	 * @see com.iver.cit.gvsig.fmap.core.IGeometry#toWKB()
375
	 */
376
	public byte[] toWKB() throws IOException {
377
		return WKBEncoder.encodeGeometry(toJTSGeometry());
378
	}
379

  
380
	/*
381
	 * (non-Javadoc)
382
	 * 
383 372
	 * @see com.iver.cit.gvsig.fmap.core.IGeometry#transform(java.awt.geom.AffineTransform)
384 373
	 */
385 374
	public void transform(AffineTransform at) {
branches/v2_0_0_prep/libraries/libFMap_geometries/src/org/gvsig/fmap/geom/aggregate/MultiPoint2D.java
43 43
import java.awt.Rectangle;
44 44
import java.awt.geom.AffineTransform;
45 45
import java.awt.geom.Rectangle2D;
46
import java.io.IOException;
47 46

  
48 47
import org.cresques.cts.IProjection;
49
import org.geotools.data.postgis.attributeio.WKBEncoder;
50 48
import org.gvsig.fmap.geom.Geometry;
51 49
import org.gvsig.fmap.geom.handler.AbstractHandler;
52 50
import org.gvsig.fmap.geom.primitive.FShape;
......
269 267

  
270 268
	}
271 269

  
272
	public byte[] toWKB() throws IOException {
273
		return WKBEncoder.encodeGeometry(toJTSGeometry());
274
	}
275 270
}
branches/v2_0_0_prep/libraries/libFMap_geometries/src/org/gvsig/fmap/geom/primitive/NullGeometry.java
140 140
		return false;
141 141
	}
142 142

  
143
	/**
144
	 * @see org.gvsig.fmap.geom.Geometry#toWKB()
145
	 */
146
	public byte[] toWKB() throws IOException {
147
		// TODO Auto-generated method stub
148
		return null;
149
	}
150

  
151 143
	/*
152 144
	 * (non-Javadoc)
153 145
	 * 
branches/v2_0_0_prep/libraries/libFMap_geometries/src/org/gvsig/fmap/geom/primitive/AbstractPrimitive.java
164 164
		geometry.transform(at);
165 165
	}
166 166

  
167
/*
168
	public AbstractPrimitive(String id, IProjection projection) {
169
		super(id, projection);		
170
	}
171
	
172
	public AbstractPrimitive(IProjection projection) {
173
		this(null, projection);
174
	}
175
	
176
	public byte[] toWKB() throws IOException {
177
		return WKBEncoder.encodeGeometry(toJTSGeometry());
178
	}
179

  
180
	public Shape getInternalShape() {
181
		return this;
182
	}
183
*/
184 167
	public boolean fastIntersects(double x, double y, double w, double h) {
185 168
		return intersects(x,y,w,h);
186 169
	}
branches/v2_0_0_prep/libraries/libFMap_geometries/src/org/gvsig/fmap/geom/Geometry.java
271 271
	 */
272 272
	public PathIterator getPathIterator(AffineTransform at);
273 273

  
274
    //public byte[] toWKB() throws IOException;
275 274
    /**
276 275
	 * It returns the handlers of the geomety,
277 276
	 * these they can be of two types is straightening and of seleccion.
branches/v2_0_0_prep/libraries/libFMap_geometries/src/org/gvsig/fmap/geom/operation/println/PrintlnPoint2D.java
9 9
public class PrintlnPoint2D extends GeometryOperation {
10 10

  
11 11
	/** CTEs para identificar las operaciones registradas para el tipo de geometría geomType */
12
    public static final int OPERATION_PRINTLN = GeometryManager.getInstance()
12
    public static final int OPERATION_INDEX = GeometryManager.getInstance()
13 13
			.registerGeometryOperation("println", new PrintlnPoint2D(), Point2D.class);
14 14
	
15 15
	
......
19 19
		return null;
20 20
	}
21 21
	
22
	public int getOperationIndex() {
23
		return OPERATION_INDEX;
24
	}
22 25
}
branches/v2_0_0_prep/libraries/libFMap_geometries/src/org/gvsig/fmap/geom/operation/GeometryOperation.java
6 6
	
7 7
	public abstract Object invoke(Geometry geom, GeometryOperationContext ctx);
8 8

  
9
	public abstract int getOperationIndex();
9 10
}
branches/v2_0_0_prep/libraries/libFMap_geometries/src/org/gvsig/fmap/geom/operation/tojtsgeometry/ToJtsGeometry.java
8 8

  
9 9
public class ToJtsGeometry extends GeometryOperation {
10 10

  
11
	public static final int TO_JTS_GEOMETRY = GeometryManager.getInstance()
12
		.registerGeometryOperation("toJtsGeometry", new ToJtsGeometry());
13
		
14
		@Override
11
	public static final int OPERATION_INDEX = GeometryManager.getInstance()
12
			.registerGeometryOperation("toJtsGeometry", new ToJtsGeometry());
13

  
14
	@Override
15 15
	public Object invoke(Geometry geom, GeometryOperationContext ctx) {
16 16
		return Converter.geometryToJts(geom);
17 17
	}
18 18

  
19
	@Override
20
	public int getOperationIndex() {
21
		return OPERATION_INDEX;
22
	}
23

  
19 24
}
branches/v2_0_0_prep/libraries/libFMap_geometries/src/org/gvsig/fmap/geom/type/GeometryType.java
29 29
	public int getType() {
30 30
		return type;
31 31
	}
32

  
33 32
	
34
	
35
	/*
36
	public void setGeometryOperationClass(int index, String name, Class geomOpClass) {
37
		
38
		if (!geomOpClass.isAssignableFrom(GeometryOperation.class)) throw new IllegalArgumentException("geomOpClass must be or extend GeometryOperation.");
39
		
40
		geometryOperations.set(index, geomOpClass);
33
	public String getName() {
34
		return name;
41 35
	}
42 36
	
43
	public GeometryOperation getGeometryOperationInstance(int index) throws InstantiationException, IllegalAccessException {
44
		Class clazz = (Class) geometryOperations.get(index);
45
		return (GeometryOperation) clazz.newInstance();
46
	}
47
	*/
48
	
49 37
	/**
50 38
	 * Guardamos una referencia a una instancia de la operación en el índice que se pasa como parámetro.
51 39
	 * Si el índice ya está ocupado se sobrescribe.

Also available in: Unified diff